o11y 246.5.0 → 248.1.2

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 (79) hide show
  1. package/dist/modules/o11y/client/client.js +43 -31
  2. package/dist/modules/o11y/client/client.js.map +1 -1
  3. package/dist/modules/o11y/client/interfaces/DomEventApiOptions.d.ts +1 -0
  4. package/dist/modules/o11y/client/interfaces/InstrumentedAppOptions.d.ts +1 -0
  5. package/dist/modules/o11y/client/interfaces-private/EventData.d.ts +4 -0
  6. package/dist/modules/o11y/client/interfaces-private/InstrumentedEventData.d.ts +3 -2
  7. package/dist/modules/o11y/client/interfaces-private/index.d.ts +1 -0
  8. package/dist/modules/o11y/client/library/DomEventHelpers.d.ts +4 -3
  9. package/dist/modules/o11y/client/library/NextgenImpl.d.ts +1 -0
  10. package/dist/modules/o11y/client/shared/Utility.d.ts +3 -0
  11. package/dist/modules/o11y/client/test/MockMouseEvent.d.ts +4 -27
  12. package/dist/modules/o11y/client/test/MockUiEvent.d.ts +31 -0
  13. package/dist/modules/o11y/client/types/TypeDefinitions-Private.d.ts +6 -2
  14. package/dist/modules/o11y/client/version.d.ts +1 -1
  15. package/dist/modules/o11y/collectors/interfaces/DomEventApiOptions.d.ts +1 -0
  16. package/dist/modules/o11y/collectors/interfaces/InstrumentedAppOptions.d.ts +1 -0
  17. package/dist/modules/o11y/collectors/interfaces-private/EventData.d.ts +4 -0
  18. package/dist/modules/o11y/collectors/interfaces-private/InstrumentedEventData.d.ts +3 -2
  19. package/dist/modules/o11y/collectors/interfaces-private/index.d.ts +1 -0
  20. package/dist/modules/o11y/collectors/library/DomEventHelpers.d.ts +4 -3
  21. package/dist/modules/o11y/collectors/library/NextgenImpl.d.ts +1 -0
  22. package/dist/modules/o11y/collectors/shared/Utility.d.ts +3 -0
  23. package/dist/modules/o11y/collectors/test/MockMouseEvent.d.ts +4 -27
  24. package/dist/modules/o11y/collectors/test/MockUiEvent.d.ts +31 -0
  25. package/dist/modules/o11y/collectors/types/TypeDefinitions-Private.d.ts +6 -2
  26. package/dist/modules/o11y/collectors/version.d.ts +1 -1
  27. package/dist/modules/o11y/core_envelope/core_envelope.js +1 -1
  28. package/dist/modules/o11y/core_envelope/core_envelope.js.map +1 -1
  29. package/dist/modules/o11y/core_envelope/interfaces/DomEventApiOptions.d.ts +1 -0
  30. package/dist/modules/o11y/core_envelope/interfaces/InstrumentedAppOptions.d.ts +1 -0
  31. package/dist/modules/o11y/core_envelope/interfaces-private/EventData.d.ts +4 -0
  32. package/dist/modules/o11y/core_envelope/interfaces-private/InstrumentedEventData.d.ts +3 -2
  33. package/dist/modules/o11y/core_envelope/interfaces-private/index.d.ts +1 -0
  34. package/dist/modules/o11y/core_envelope/library/DomEventHelpers.d.ts +4 -3
  35. package/dist/modules/o11y/core_envelope/library/NextgenImpl.d.ts +1 -0
  36. package/dist/modules/o11y/core_envelope/shared/Utility.d.ts +3 -0
  37. package/dist/modules/o11y/core_envelope/test/MockMouseEvent.d.ts +4 -27
  38. package/dist/modules/o11y/core_envelope/test/MockUiEvent.d.ts +31 -0
  39. package/dist/modules/o11y/core_envelope/types/TypeDefinitions-Private.d.ts +6 -2
  40. package/dist/modules/o11y/core_envelope/version.d.ts +1 -1
  41. package/dist/modules/o11y/shared/interfaces/DomEventApiOptions.d.ts +1 -0
  42. package/dist/modules/o11y/shared/interfaces/InstrumentedAppOptions.d.ts +1 -0
  43. package/dist/modules/o11y/shared/interfaces-private/EventData.d.ts +4 -0
  44. package/dist/modules/o11y/shared/interfaces-private/InstrumentedEventData.d.ts +3 -2
  45. package/dist/modules/o11y/shared/interfaces-private/index.d.ts +1 -0
  46. package/dist/modules/o11y/shared/library/DomEventHelpers.d.ts +4 -3
  47. package/dist/modules/o11y/shared/library/NextgenImpl.d.ts +1 -0
  48. package/dist/modules/o11y/shared/shared/Utility.d.ts +3 -0
  49. package/dist/modules/o11y/shared/shared.js +13 -0
  50. package/dist/modules/o11y/shared/shared.js.map +1 -1
  51. package/dist/modules/o11y/shared/test/MockMouseEvent.d.ts +4 -27
  52. package/dist/modules/o11y/shared/test/MockUiEvent.d.ts +31 -0
  53. package/dist/modules/o11y/shared/types/TypeDefinitions-Private.d.ts +6 -2
  54. package/dist/modules/o11y/shared/version.d.ts +1 -1
  55. package/dist/modules/o11y/simple_collector/interfaces/DomEventApiOptions.d.ts +1 -0
  56. package/dist/modules/o11y/simple_collector/interfaces/InstrumentedAppOptions.d.ts +1 -0
  57. package/dist/modules/o11y/simple_collector/interfaces-private/EventData.d.ts +4 -0
  58. package/dist/modules/o11y/simple_collector/interfaces-private/InstrumentedEventData.d.ts +3 -2
  59. package/dist/modules/o11y/simple_collector/interfaces-private/index.d.ts +1 -0
  60. package/dist/modules/o11y/simple_collector/library/DomEventHelpers.d.ts +4 -3
  61. package/dist/modules/o11y/simple_collector/library/NextgenImpl.d.ts +1 -0
  62. package/dist/modules/o11y/simple_collector/shared/Utility.d.ts +3 -0
  63. package/dist/modules/o11y/simple_collector/test/MockMouseEvent.d.ts +4 -27
  64. package/dist/modules/o11y/simple_collector/test/MockUiEvent.d.ts +31 -0
  65. package/dist/modules/o11y/simple_collector/types/TypeDefinitions-Private.d.ts +6 -2
  66. package/dist/modules/o11y/simple_collector/version.d.ts +1 -1
  67. package/dist/modules/o11y/web_vitals/interfaces/DomEventApiOptions.d.ts +1 -0
  68. package/dist/modules/o11y/web_vitals/interfaces/InstrumentedAppOptions.d.ts +1 -0
  69. package/dist/modules/o11y/web_vitals/interfaces-private/EventData.d.ts +4 -0
  70. package/dist/modules/o11y/web_vitals/interfaces-private/InstrumentedEventData.d.ts +3 -2
  71. package/dist/modules/o11y/web_vitals/interfaces-private/index.d.ts +1 -0
  72. package/dist/modules/o11y/web_vitals/library/DomEventHelpers.d.ts +4 -3
  73. package/dist/modules/o11y/web_vitals/library/NextgenImpl.d.ts +1 -0
  74. package/dist/modules/o11y/web_vitals/shared/Utility.d.ts +3 -0
  75. package/dist/modules/o11y/web_vitals/test/MockMouseEvent.d.ts +4 -27
  76. package/dist/modules/o11y/web_vitals/test/MockUiEvent.d.ts +31 -0
  77. package/dist/modules/o11y/web_vitals/types/TypeDefinitions-Private.d.ts +6 -2
  78. package/dist/modules/o11y/web_vitals/version.d.ts +1 -1
  79. package/package.json +3 -2
@@ -1,19 +1,6 @@
1
+ import { simpleSchema, errorSchema, activitySchema, instrumentedEventSchema, idleDetectorReportSchema } from 'o11y_schema/sf_instrumentation';
1
2
  import { utility, PublicSafety, schemaUtil, metricsUtility } from 'o11y/shared';
2
3
 
3
- const activity={namespace:"sf.instrumentation",name:"Activity",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"Activity":{"reserved":[[5,5],[7,7]],"fields":{"duration":{"id":3,"type":"double"},"stopReason":{"id":6,"type":"string"},"isRoot":{"id":8,"type":"bool"},"timerOverridden":{"id":12,"type":"uint32"},"name":{"options":{"(meta.max_length)":25},"id":2,"type":"string"},"isSampled":{"id":11,"type":"bool"},"preRootId":{"id":9,"type":"string"},"id":{"id":1,"type":"string"},
4
- "userPayload":{"id":4,"type":"Payload"},"errorCount":{"id":10,"type":"uint32"},"parentId":{"id":13,"type":"string"}}},"Payload":{"fields":{"payload":{"id":2,"type":"bytes"},"schemaName":{"id":1,"type":"string"}}}}}}}}}};
5
-
6
- const error={namespace:"sf.instrumentation",name:"Error",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"Error":{"reserved":[[5,5],[7,7]],"fields":{"activityId":{"id":6,"type":"string"},"stack":{"id":3,"type":"string"},"name":{"id":1,"type":"string"},"message":{"options":{"(meta.max_length)":200},"id":2,"type":"string"},"userPayload":{"id":4,"type":"Payload"}}},"Payload":{"fields":{"payload":{"id":2,"type":"bytes"},"schemaName":{"id":1,"type":"string"}}}}}}}}}};
7
-
8
- const idle_detector_report={namespace:"sf.instrumentation",name:"IdleDetectorReport",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"IdleDetectorReport":{"fields":{"listenerCount":{"id":3,"type":"uint32"},"busyTasks":{"rule":"repeated","id":5,"type":"string"},"busyDurations":{"rule":"repeated","id":6,"type":"double"},"pollableCount":{"id":4,"type":"uint32"},"pollCounts":{"rule":"repeated","id":8,"type":"double"},"logThreshold":{"id":2,"type":"double"},"maxDuration":{"id":1,
9
- "type":"double"},"pollables":{"rule":"repeated","id":7,"type":"string"}}}}}}}}}};
10
-
11
- const instrumented_event={namespace:"sf.instrumentation",name:"InstrumentedEvent",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"MouseEvent":{"fields":{"cancelable":{"id":5,"type":"bool"},"ctrlKey":{"id":9,"type":"bool"},"type":{"id":25,"type":"string"},"button":{"id":3,"type":"uint32"},"offsetX":{"id":17,"type":"uint32"},"eventPhase":{"id":12,"type":"uint32"},"shiftKey":{"id":23,"type":"bool"},"offsetY":{"id":18,"type":"uint32"},"composed":{"id":8,"type":"bool"},"altKey":{"id":1,
12
- "type":"bool"},"isTrusted":{"id":13,"type":"bool"},"buttons":{"id":4,"type":"uint32"},"movementY":{"id":16,"type":"uint32"},"clientY":{"id":7,"type":"uint32"},"clientX":{"id":6,"type":"uint32"},"movementX":{"id":15,"type":"uint32"},"defaultPrevented":{"id":10,"type":"bool"},"metaKey":{"id":14,"type":"bool"},"timeStamp":{"id":24,"type":"double"},"bubbles":{"id":2,"type":"bool"},"detail":{"id":11,"type":"int64"},"pageY":{"id":20,"type":"uint32"},"pageX":{"id":19,"type":"uint32"},"screenX":{"id":21,
13
- "type":"uint32"},"screenY":{"id":22,"type":"uint32"}}},"InstrumentedEvent":{"oneofs":{"event":{"oneof":["mouseEvent"]}},"reserved":[[4,4],"xpath",[6,6],[8,8]],"fields":{"mouseEvent":{"id":7,"type":"MouseEvent"},"auto":{"id":3,"type":"bool"},"parentComponent":{"id":2,"type":"string"},"ownerComponent":{"id":1,"type":"string"},"userPayload":{"id":5,"type":"Payload"},"simplePath":{"id":9,"type":"string"}}},"Payload":{"fields":{"payload":{"id":2,"type":"bytes"},"schemaName":{"id":1,"type":"string"}}}}}}}}}};
14
-
15
- const simple={namespace:"sf.instrumentation",name:"Simple",pbjsSchema:{"nested":{"sf":{"nested":{"instrumentation":{"nested":{"Simple":{"fields":{"text":{"options":{"(meta.max_length)":25},"id":1,"type":"string"}}}}}}}}}};
16
-
17
4
  class TaskerImpl {
18
5
  get isBusy() {
19
6
  return this._isOk ? this._busyCount > 0 : undefined;
@@ -814,19 +801,31 @@ class ActivityNoOp {
814
801
  const activityNoOp = Object.freeze(new ActivityNoOp());
815
802
 
816
803
  class DomEventHelpers {
817
- getInstrumentedEventData(eventData, handledBy, userPayload) {
804
+ getInstrumentedEventData(domEventDataField, domEventData, handledBy, userPayload) {
818
805
  var _a;
819
806
  const instrumentedEvent = {
820
807
  ownerComponent: handledBy.tagName,
821
808
  parentComponent: ((_a = handledBy.parentElement) === null || _a === void 0 ? void 0 : _a.tagName) || undefined,
822
- event: eventData,
823
809
  simplePath: utility.getXpath(handledBy)
824
810
  };
811
+ switch (domEventDataField) {
812
+ case 0:
813
+ instrumentedEvent.baseEvent = domEventData;
814
+ break;
815
+ case 1:
816
+ instrumentedEvent.mouseEvent = domEventData;
817
+ break;
818
+ }
825
819
  if (userPayload) {
826
820
  instrumentedEvent.userPayload = schemaUtil.makePayload(userPayload.schema, userPayload.payload, true);
827
821
  }
828
822
  return instrumentedEvent;
829
823
  }
824
+ getEventData(e) {
825
+ return {
826
+ type: e.type
827
+ };
828
+ }
830
829
  getMouseEventData(e) {
831
830
  return {
832
831
  altKey: e.altKey,
@@ -1379,7 +1378,7 @@ class InstrumentationImpl {
1379
1378
  increment: (increment) => this._incrementError(increment)
1380
1379
  });
1381
1380
  this._metrics = this._initMetrics();
1382
- const simpleTextOptions = schemaUtil.getOptions(simple, 'Simple', 'text');
1381
+ const simpleTextOptions = schemaUtil.getOptions(simpleSchema, 'Simple', 'text');
1383
1382
  this._simpleTextMaxLength = simpleTextOptions
1384
1383
  ? simpleTextOptions['(meta.max_length)']
1385
1384
  : maxStringLengthAppLimit;
@@ -1396,7 +1395,7 @@ class InstrumentationImpl {
1396
1395
  _wrapUserPayload(userSchemaOrText, userData, onlyIfBoth = false) {
1397
1396
  let userSchema;
1398
1397
  if (typeof userSchemaOrText === 'string') {
1399
- userSchema = simple;
1398
+ userSchema = simpleSchema;
1400
1399
  if (userSchemaOrText) {
1401
1400
  userData = {
1402
1401
  text: userSchemaOrText.substring(0, this._simpleTextMaxLength)
@@ -1447,9 +1446,9 @@ class InstrumentationImpl {
1447
1446
  }
1448
1447
  _errorInternal(err, userSchemaOrText, userData, activityId, rootActivityId) {
1449
1448
  const loggedTimestamp = utility.time().tsNow;
1450
- let error$1;
1449
+ let error;
1451
1450
  if (err instanceof Error) {
1452
- error$1 = err;
1451
+ error = err;
1453
1452
  }
1454
1453
  else {
1455
1454
  let msg;
@@ -1459,17 +1458,17 @@ class InstrumentationImpl {
1459
1458
  else {
1460
1459
  msg = err.toString();
1461
1460
  }
1462
- error$1 = new Error(msg);
1461
+ error = new Error(msg);
1463
1462
  }
1464
1463
  const userPayload = this._wrapUserPayload(userSchemaOrText, userData, true);
1465
1464
  const errorData = {
1466
- name: error$1.name,
1467
- message: error$1.message,
1468
- stack: error$1.stack,
1465
+ name: error.name,
1466
+ message: error.message,
1467
+ stack: error.stack,
1469
1468
  userPayload,
1470
1469
  activityId
1471
1470
  };
1472
- return this._logInternal(this.name, error, errorData, loggedTimestamp, rootActivityId);
1471
+ return this._logInternal(this.name, errorSchema, errorData, loggedTimestamp, rootActivityId);
1473
1472
  }
1474
1473
  startActivity(name, options) {
1475
1474
  return this._safety.tryCatchReturn(() => {
@@ -1512,7 +1511,7 @@ class InstrumentationImpl {
1512
1511
  this._logActivity(activityData, detail.startTimestamp, detail.rootId);
1513
1512
  }
1514
1513
  _logActivity(activityData, startTimestamp, rootId) {
1515
- this._logInternal(this.name, activity, activityData, startTimestamp, rootId);
1514
+ this._logInternal(this.name, activitySchema, activityData, startTimestamp, rootId);
1516
1515
  }
1517
1516
  _handleActivityError(error, detail) {
1518
1517
  this._errorInternal(error, detail.userSchemaOrText, detail.userData, detail.id, detail.rootId);
@@ -1552,10 +1551,14 @@ class InstrumentationImpl {
1552
1551
  if (acd) {
1553
1552
  acd.markEventHandled(mouseEvent);
1554
1553
  }
1555
- const mouseEventData = domEventHelpers.getMouseEventData(mouseEvent);
1556
- const instrumentedEvent = domEventHelpers.getInstrumentedEventData(mouseEventData, htmlElement, userPayload);
1554
+ const captureMouse = options === null || options === void 0 ? void 0 : options.captureMouseData;
1555
+ const instrumentedEvent = domEventHelpers.getInstrumentedEventData(captureMouse
1556
+ ? 1
1557
+ : 0, captureMouse
1558
+ ? domEventHelpers.getMouseEventData(mouseEvent)
1559
+ : domEventHelpers.getEventData(mouseEvent), htmlElement, userPayload);
1557
1560
  instrumentedEvent.auto = options === null || options === void 0 ? void 0 : options._auto;
1558
- this._logInternal(this.name, instrumented_event, instrumentedEvent, tsNow, rootId);
1561
+ this._logInternal(this.name, instrumentedEventSchema, instrumentedEvent, tsNow, rootId);
1559
1562
  break;
1560
1563
  }
1561
1564
  default:
@@ -2077,6 +2080,7 @@ class NextgenImpl {
2077
2080
  this._opMode = 'default';
2078
2081
  this._isSender = false;
2079
2082
  this._isReceiver = false;
2083
+ this._decimalPoints = 2;
2080
2084
  }
2081
2085
  registerApp(name, options) {
2082
2086
  var _a;
@@ -2091,6 +2095,9 @@ class NextgenImpl {
2091
2095
  this._initOpMode(options === null || options === void 0 ? void 0 : options.operationMode);
2092
2096
  this._isSender = this._opMode === 'sender';
2093
2097
  this._isReceiver = this._opMode === 'receiver';
2098
+ if ((options === null || options === void 0 ? void 0 : options.decimalPoints) !== undefined) {
2099
+ this._decimalPoints = options.decimalPoints;
2100
+ }
2094
2101
  this._clientSessionId = ((_a = options === null || options === void 0 ? void 0 : options.clientSessionId) === null || _a === void 0 ? void 0 : _a.toString()) || utility.generateUniqueId();
2095
2102
  this._appInstr = new AppInstrumentationImpl(this, name, options === null || options === void 0 ? void 0 : options.allowMultipleRootActivities);
2096
2103
  this._instruments.set(name, this._appInstr);
@@ -2173,6 +2180,11 @@ class NextgenImpl {
2173
2180
  if (!this._isSender) {
2174
2181
  data = utility.clone(data);
2175
2182
  }
2183
+ if (typeof this._decimalPoints === 'number') {
2184
+ utility.roundNumbersInObject(data, this._decimalPoints);
2185
+ utility.roundNumbersInObject(pagePayload === null || pagePayload === void 0 ? void 0 : pagePayload.payload, this._decimalPoints);
2186
+ utility.roundNumbersInObject(appPayload === null || appPayload === void 0 ? void 0 : appPayload.payload, this._decimalPoints);
2187
+ }
2176
2188
  const logMeta = {
2177
2189
  timestamp,
2178
2190
  rootId,
@@ -2398,12 +2410,12 @@ class ConsoleCollector {
2398
2410
  }
2399
2411
  }
2400
2412
 
2401
- const version = '246.5.0';
2413
+ const version = '248.1.2';
2402
2414
 
2403
2415
  const idleDetector = new IdleDetectorImpl({
2404
2416
  logThreshold: 300,
2405
2417
  reportListener: (report) => {
2406
- idleDetectorInstr === null || idleDetectorInstr === void 0 ? void 0 : idleDetectorInstr.log(idle_detector_report, report);
2418
+ idleDetectorInstr === null || idleDetectorInstr === void 0 ? void 0 : idleDetectorInstr.log(idleDetectorReportSchema, report);
2407
2419
  },
2408
2420
  errorListener: (e, text) => {
2409
2421
  idleDetectorInstr === null || idleDetectorInstr === void 0 ? void 0 : idleDetectorInstr.error(e, text);