@microsoft/applicationinsights-core-js 2.8.0 → 2.8.1

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 (71) hide show
  1. package/browser/applicationinsights-core-js.integrity.json +9 -9
  2. package/browser/applicationinsights-core-js.js +53 -37
  3. package/browser/applicationinsights-core-js.js.map +1 -1
  4. package/browser/applicationinsights-core-js.min.js +2 -2
  5. package/browser/applicationinsights-core-js.min.js.map +1 -1
  6. package/dist/applicationinsights-core-js.api.json +95 -1
  7. package/dist/applicationinsights-core-js.api.md +4 -1
  8. package/dist/applicationinsights-core-js.d.ts +12 -2
  9. package/dist/applicationinsights-core-js.js +53 -37
  10. package/dist/applicationinsights-core-js.js.map +1 -1
  11. package/dist/applicationinsights-core-js.min.js +2 -2
  12. package/dist/applicationinsights-core-js.min.js.map +1 -1
  13. package/dist/applicationinsights-core-js.rollup.d.ts +12 -2
  14. package/dist-esm/JavaScriptSDK/AppInsightsCore.js +1 -1
  15. package/dist-esm/JavaScriptSDK/BaseCore.js +1 -1
  16. package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +1 -1
  17. package/dist-esm/JavaScriptSDK/ChannelController.js +1 -1
  18. package/dist-esm/JavaScriptSDK/Constants.js +1 -1
  19. package/dist-esm/JavaScriptSDK/CookieMgr.js +1 -1
  20. package/dist-esm/JavaScriptSDK/CoreUtils.js +1 -1
  21. package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
  22. package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
  23. package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +1 -1
  24. package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +1 -1
  25. package/dist-esm/JavaScriptSDK/EnvUtils.js +1 -1
  26. package/dist-esm/JavaScriptSDK/EventHelpers.js +1 -1
  27. package/dist-esm/JavaScriptSDK/HelperFuncs.js +1 -1
  28. package/dist-esm/JavaScriptSDK/InstrumentHooks.js +67 -44
  29. package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
  30. package/dist-esm/JavaScriptSDK/InternalConstants.js +1 -1
  31. package/dist-esm/JavaScriptSDK/NotificationManager.js +1 -1
  32. package/dist-esm/JavaScriptSDK/PerfManager.js +1 -1
  33. package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +1 -1
  34. package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
  35. package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +1 -1
  36. package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +1 -1
  37. package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +1 -1
  38. package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +1 -1
  39. package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
  40. package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
  41. package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
  42. package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
  43. package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
  44. package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
  45. package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
  46. package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
  47. package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
  48. package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
  49. package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
  50. package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
  51. package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
  52. package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
  53. package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
  54. package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
  55. package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
  56. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
  57. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
  58. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
  59. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
  60. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
  61. package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
  62. package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
  63. package/dist-esm/applicationinsights-core-js.js +2 -2
  64. package/dist-esm/applicationinsights-core-js.js.map +1 -1
  65. package/package.json +1 -1
  66. package/src/JavaScriptSDK/DataCacheHelper.ts +1 -1
  67. package/src/JavaScriptSDK/InstrumentHooks.ts +74 -47
  68. package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +1 -1
  69. package/types/JavaScriptSDK/InstrumentHooks.d.ts +9 -0
  70. package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +1 -1
  71. package/types/applicationinsights-core-js.d.ts +1 -1
@@ -6582,7 +6582,7 @@
6582
6582
  },
6583
6583
  {
6584
6584
  "kind": "Content",
6585
- "text": "{\n [key in keyof E]: [eValue: E[keyof E], mapValue: V[keyof V]];\n}"
6585
+ "text": "{\n [key in keyof E]: [E[keyof E], V[keyof V]];\n}"
6586
6586
  },
6587
6587
  {
6588
6588
  "kind": "Content",
@@ -15343,6 +15343,100 @@
15343
15343
  ],
15344
15344
  "extendsTokenRanges": []
15345
15345
  },
15346
+ {
15347
+ "kind": "Function",
15348
+ "canonicalReference": "@microsoft/applicationinsights-core-js!InstrumentEvent:function(1)",
15349
+ "docComment": "/**\n * Add an instrumentation hook to the provided named \"event\" for the target class / object, this doesn't check whether the named \"event\" is in fact a function and just assigns the instrumentation hook to the target[evtName]\n *\n * @param target - The target object\n *\n * @param evtName - The name of the event\n *\n * @param callbacks - The callbacks to configure and call whenever the function is called\n *\n * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function\n */\n",
15350
+ "excerptTokens": [
15351
+ {
15352
+ "kind": "Content",
15353
+ "text": "export declare function InstrumentEvent(target: "
15354
+ },
15355
+ {
15356
+ "kind": "Content",
15357
+ "text": "any"
15358
+ },
15359
+ {
15360
+ "kind": "Content",
15361
+ "text": ", evtName: "
15362
+ },
15363
+ {
15364
+ "kind": "Content",
15365
+ "text": "string"
15366
+ },
15367
+ {
15368
+ "kind": "Content",
15369
+ "text": ", callbacks: "
15370
+ },
15371
+ {
15372
+ "kind": "Reference",
15373
+ "text": "IInstrumentHooksCallbacks",
15374
+ "canonicalReference": "@microsoft/applicationinsights-core-js!IInstrumentHooksCallbacks:interface"
15375
+ },
15376
+ {
15377
+ "kind": "Content",
15378
+ "text": ", checkPrototype?: "
15379
+ },
15380
+ {
15381
+ "kind": "Content",
15382
+ "text": "boolean"
15383
+ },
15384
+ {
15385
+ "kind": "Content",
15386
+ "text": "): "
15387
+ },
15388
+ {
15389
+ "kind": "Reference",
15390
+ "text": "IInstrumentHook",
15391
+ "canonicalReference": "@microsoft/applicationinsights-core-js!IInstrumentHook:interface"
15392
+ },
15393
+ {
15394
+ "kind": "Content",
15395
+ "text": ";"
15396
+ }
15397
+ ],
15398
+ "returnTypeTokenRange": {
15399
+ "startIndex": 9,
15400
+ "endIndex": 10
15401
+ },
15402
+ "releaseTag": "Public",
15403
+ "overloadIndex": 1,
15404
+ "parameters": [
15405
+ {
15406
+ "parameterName": "target",
15407
+ "parameterTypeTokenRange": {
15408
+ "startIndex": 1,
15409
+ "endIndex": 2
15410
+ },
15411
+ "isOptional": false
15412
+ },
15413
+ {
15414
+ "parameterName": "evtName",
15415
+ "parameterTypeTokenRange": {
15416
+ "startIndex": 3,
15417
+ "endIndex": 4
15418
+ },
15419
+ "isOptional": false
15420
+ },
15421
+ {
15422
+ "parameterName": "callbacks",
15423
+ "parameterTypeTokenRange": {
15424
+ "startIndex": 5,
15425
+ "endIndex": 6
15426
+ },
15427
+ "isOptional": false
15428
+ },
15429
+ {
15430
+ "parameterName": "checkPrototype",
15431
+ "parameterTypeTokenRange": {
15432
+ "startIndex": 7,
15433
+ "endIndex": 8
15434
+ },
15435
+ "isOptional": true
15436
+ }
15437
+ ],
15438
+ "name": "InstrumentEvent"
15439
+ },
15346
15440
  {
15347
15441
  "kind": "Function",
15348
15442
  "canonicalReference": "@microsoft/applicationinsights-core-js!InstrumentFunc:function(1)",
@@ -168,7 +168,7 @@ export function createUnloadHandlerContainer(): {
168
168
 
169
169
  // @public
170
170
  export function createValueMap<E, V = E>(values: {
171
- [key in keyof E]: [eValue: E[keyof E], mapValue: V[keyof V]];
171
+ [key in keyof E]: [E[keyof E], V[keyof V]];
172
172
  }): V;
173
173
 
174
174
  // @public
@@ -776,6 +776,9 @@ export interface INotificationManager {
776
776
  removeNotificationListener(listener: INotificationListener): void;
777
777
  }
778
778
 
779
+ // @public
780
+ export function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
781
+
779
782
  // @public
780
783
  export function InstrumentFunc(target: any, funcName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
781
784
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft Application Insights Core Javascript SDK, 2.8.0
2
+ * Microsoft Application Insights Core Javascript SDK, 2.8.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -400,7 +400,7 @@ declare namespace ApplicationInsights {
400
400
  * @returns
401
401
  */
402
402
  function createValueMap<E, V = E>(values: {
403
- [key in keyof E]: [eValue: E[keyof E], mapValue: V[keyof V]];
403
+ [key in keyof E]: [E[keyof E], V[keyof V]];
404
404
  }): V;
405
405
 
406
406
  /**
@@ -1722,6 +1722,16 @@ declare namespace ApplicationInsights {
1722
1722
  perfEvent?(perfEvent: IPerfEvent): void;
1723
1723
  }
1724
1724
 
1725
+ /**
1726
+ * Add an instrumentation hook to the provided named "event" for the target class / object, this doesn't check whether the
1727
+ * named "event" is in fact a function and just assigns the instrumentation hook to the target[evtName]
1728
+ * @param target - The target object
1729
+ * @param evtName - The name of the event
1730
+ * @param callbacks - The callbacks to configure and call whenever the function is called
1731
+ * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
1732
+ */
1733
+ function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
1734
+
1725
1735
  /**
1726
1736
  * Intercept the named prototype functions for the target class / object
1727
1737
  * @param target - The target object
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Core, 2.8.0
2
+ * Application Insights JavaScript SDK - Core, 2.8.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -1577,7 +1577,7 @@
1577
1577
  }
1578
1578
 
1579
1579
  var _objDefineProperty = ObjDefineProperty;
1580
- var version = "2.8.0";
1580
+ var version = "2.8.1";
1581
1581
  var instanceName = "." + newId(6);
1582
1582
  var _dataUid = 0;
1583
1583
  function _createAccessor(target, prop, value) {
@@ -3940,13 +3940,15 @@
3940
3940
  }
3941
3941
  _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 0 );
3942
3942
  var theFunc = aiHook.f;
3943
- try {
3944
- funcArgs.rslt = theFunc.apply(funcThis, orgArgs);
3945
- }
3946
- catch (err) {
3947
- funcArgs.err = err;
3948
- _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 3 );
3949
- throw err;
3943
+ if (theFunc) {
3944
+ try {
3945
+ funcArgs.rslt = theFunc.apply(funcThis, orgArgs);
3946
+ }
3947
+ catch (err) {
3948
+ funcArgs.err = err;
3949
+ _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 3 );
3950
+ throw err;
3951
+ }
3950
3952
  }
3951
3953
  _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, 1 );
3952
3954
  return funcArgs.rslt;
@@ -3976,6 +3978,36 @@
3976
3978
  }
3977
3979
  return null;
3978
3980
  }
3981
+ function _createInstrumentHook(owner, funcName, fn, callbacks) {
3982
+ var aiHook = fn && fn[aiInstrumentHooks];
3983
+ if (!aiHook) {
3984
+ aiHook = {
3985
+ i: 0,
3986
+ n: funcName,
3987
+ f: fn,
3988
+ h: []
3989
+ };
3990
+ var newFunc = _createFunctionHook(aiHook);
3991
+ newFunc[aiInstrumentHooks] = aiHook;
3992
+ owner[funcName] = newFunc;
3993
+ }
3994
+ var theHook = {
3995
+ id: aiHook.i,
3996
+ cbks: callbacks,
3997
+ rm: function () {
3998
+ var id = this.id;
3999
+ _arrLoop(aiHook.h, function (hook, idx) {
4000
+ if (hook.id === id) {
4001
+ aiHook.h.splice(idx, 1);
4002
+ return 1;
4003
+ }
4004
+ });
4005
+ }
4006
+ };
4007
+ aiHook.i++;
4008
+ aiHook.h.push(theHook);
4009
+ return theHook;
4010
+ }
3979
4011
  function InstrumentFunc(target, funcName, callbacks, checkPrototype) {
3980
4012
  if (checkPrototype === void 0) { checkPrototype = true; }
3981
4013
  if (target && funcName && callbacks) {
@@ -3983,34 +4015,7 @@
3983
4015
  if (owner) {
3984
4016
  var fn = owner[funcName];
3985
4017
  if (typeof fn === strShimFunction) {
3986
- var aiHook_1 = fn[aiInstrumentHooks];
3987
- if (!aiHook_1) {
3988
- aiHook_1 = {
3989
- i: 0,
3990
- n: funcName,
3991
- f: fn,
3992
- h: []
3993
- };
3994
- var newFunc = _createFunctionHook(aiHook_1);
3995
- newFunc[aiInstrumentHooks] = aiHook_1;
3996
- owner[funcName] = newFunc;
3997
- }
3998
- var theHook = {
3999
- id: aiHook_1.i,
4000
- cbks: callbacks,
4001
- rm: function () {
4002
- var id = this.id;
4003
- _arrLoop(aiHook_1.h, function (hook, idx) {
4004
- if (hook.id === id) {
4005
- aiHook_1.h.splice(idx, 1);
4006
- return 1;
4007
- }
4008
- });
4009
- }
4010
- };
4011
- aiHook_1.i++;
4012
- aiHook_1.h.push(theHook);
4013
- return theHook;
4018
+ return _createInstrumentHook(owner, funcName, fn, callbacks);
4014
4019
  }
4015
4020
  }
4016
4021
  }
@@ -4030,6 +4035,16 @@
4030
4035
  });
4031
4036
  return hooks;
4032
4037
  }
4038
+ function InstrumentEvent(target, evtName, callbacks, checkPrototype) {
4039
+ if (checkPrototype === void 0) { checkPrototype = true; }
4040
+ if (target && evtName && callbacks) {
4041
+ var owner = _getOwner(target, evtName, checkPrototype);
4042
+ if (owner) {
4043
+ return _createInstrumentHook(owner, evtName, owner[evtName], callbacks);
4044
+ }
4045
+ }
4046
+ return null;
4047
+ }
4033
4048
 
4034
4049
  exports.AppInsightsCore = AppInsightsCore;
4035
4050
  exports.BaseCore = BaseCore;
@@ -4038,6 +4053,7 @@
4038
4053
  exports.DiagnosticLogger = DiagnosticLogger;
4039
4054
  exports.EventHelper = EventHelper;
4040
4055
  exports.EventsDiscardedReason = EventsDiscardedReason;
4056
+ exports.InstrumentEvent = InstrumentEvent;
4041
4057
  exports.InstrumentFunc = InstrumentFunc;
4042
4058
  exports.InstrumentFuncs = InstrumentFuncs;
4043
4059
  exports.InstrumentProto = InstrumentProto;