@microsoft/applicationinsights-core-js 2.8.1-nightly.2204-21 → 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 (69) 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 +94 -0
  7. package/dist/applicationinsights-core-js.api.md +3 -0
  8. package/dist/applicationinsights-core-js.d.ts +11 -1
  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 +11 -1
  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 +67 -70
  66. package/src/JavaScriptSDK/DataCacheHelper.ts +1 -1
  67. package/src/JavaScriptSDK/InstrumentHooks.ts +74 -47
  68. package/types/JavaScriptSDK/InstrumentHooks.d.ts +9 -0
  69. package/types/applicationinsights-core-js.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Core, 2.8.1-nightly.2204-21
2
+ * Application Insights JavaScript SDK - Core, 2.8.1
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  export { MinChannelPriorty } from "./JavaScriptSDK.Interfaces/IChannelControls";
@@ -22,7 +22,7 @@ export { ProcessTelemetryContext, createProcessTelemetryContext
22
22
  } from "./JavaScriptSDK/ProcessTelemetryContext";
23
23
  export { initializePlugins, sortPlugins, unloadComponents } from "./JavaScriptSDK/TelemetryHelpers";
24
24
  export { _InternalMessageId, LoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
25
- export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs } from "./JavaScriptSDK/InstrumentHooks";
25
+ export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from "./JavaScriptSDK/InstrumentHooks";
26
26
  export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from "./JavaScriptSDK/CookieMgr";
27
27
  export { getDebugListener, getDebugExt } from "./JavaScriptSDK/DbgExtensionUtils";
28
28
  export { createUniqueNamespace } from "./JavaScriptSDK/DataCacheHelper";
@@ -1 +1 @@
1
- {"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseCore } from \"./JavaScriptSDK/BaseCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { CoreUtils, EventHelper, Undefined, newGuid, perfNow, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr } from \"./JavaScriptSDK/CoreUtils\";\r\nexport { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal, objExtend, objToString, deepFreeze } from \"./JavaScriptSDK/HelperFuncs\";\r\nexport { createEnumStyle, createEnumMap, createValueMap } from \"./JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nexport { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from \"./JavaScriptSDK/EventHelpers\";\r\nexport { getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported } from \"./JavaScriptSDK/EnvUtils\";\r\nexport { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from \"@microsoft/applicationinsights-shims\";\r\nexport { NotificationManager } from \"./JavaScriptSDK/NotificationManager\";\r\nexport { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from \"./JavaScriptSDK/PerfManager\";\r\nexport { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from \"./JavaScriptSDK/DiagnosticLogger\";\r\nexport { ProcessTelemetryContext, createProcessTelemetryContext\r\n// Explicitly NOT exporting createProcessTelemetryUnloadContext() and createProcessTelemetryUpdateContext() as these should only be created internally\r\n } from \"./JavaScriptSDK/ProcessTelemetryContext\";\r\nexport { initializePlugins, sortPlugins, unloadComponents } from \"./JavaScriptSDK/TelemetryHelpers\";\r\nexport { _InternalMessageId, LoggingSeverity } from \"./JavaScriptSDK.Enums/LoggingEnums\";\r\nexport { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs } from \"./JavaScriptSDK/InstrumentHooks\";\r\nexport { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from \"./JavaScriptSDK/CookieMgr\";\r\nexport { getDebugListener, getDebugExt } from \"./JavaScriptSDK/DbgExtensionUtils\";\r\nexport { createUniqueNamespace } from \"./JavaScriptSDK/DataCacheHelper\";\r\nexport { createUnloadHandlerContainer } from \"./JavaScriptSDK/UnloadHandlerContainer\";\r\n//# sourceMappingURL=applicationinsights-core-js.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseCore } from \"./JavaScriptSDK/BaseCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { CoreUtils, EventHelper, Undefined, newGuid, perfNow, generateW3CId, disableCookies, canUseCookies, getCookie, setCookie, deleteCookie, _legacyCookieMgr } from \"./JavaScriptSDK/CoreUtils\";\r\nexport { isTypeof, isUndefined, isNullOrUndefined, hasOwnProperty, isObject, isFunction, normalizeJsName, objForEachKey, strEndsWith, strStartsWith, isDate, isArray, isError, isString, isNumber, isBoolean, toISOString, arrForEach, arrIndexOf, arrMap, arrReduce, strTrim, objKeys, objDefineAccessors, dateNow, getExceptionName, throwError, strContains, isSymbol, setValue, getSetValue, isNotTruthy, isTruthy, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objFreeze, objSeal, objExtend, objToString, deepFreeze } from \"./JavaScriptSDK/HelperFuncs\";\r\nexport { createEnumStyle, createEnumMap, createValueMap } from \"./JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nexport { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from \"./JavaScriptSDK/EventHelpers\";\r\nexport { getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, getCrypto, getMsCrypto, hasNavigator, getNavigator, hasHistory, getHistory, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, dumpObj, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported } from \"./JavaScriptSDK/EnvUtils\";\r\nexport { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from \"@microsoft/applicationinsights-shims\";\r\nexport { NotificationManager } from \"./JavaScriptSDK/NotificationManager\";\r\nexport { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from \"./JavaScriptSDK/PerfManager\";\r\nexport { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from \"./JavaScriptSDK/DiagnosticLogger\";\r\nexport { ProcessTelemetryContext, createProcessTelemetryContext\r\n// Explicitly NOT exporting createProcessTelemetryUnloadContext() and createProcessTelemetryUpdateContext() as these should only be created internally\r\n } from \"./JavaScriptSDK/ProcessTelemetryContext\";\r\nexport { initializePlugins, sortPlugins, unloadComponents } from \"./JavaScriptSDK/TelemetryHelpers\";\r\nexport { _InternalMessageId, LoggingSeverity } from \"./JavaScriptSDK.Enums/LoggingEnums\";\r\nexport { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from \"./JavaScriptSDK/InstrumentHooks\";\r\nexport { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from \"./JavaScriptSDK/CookieMgr\";\r\nexport { getDebugListener, getDebugExt } from \"./JavaScriptSDK/DbgExtensionUtils\";\r\nexport { createUniqueNamespace } from \"./JavaScriptSDK/DataCacheHelper\";\r\nexport { createUnloadHandlerContainer } from \"./JavaScriptSDK/UnloadHandlerContainer\";\r\n//# sourceMappingURL=applicationinsights-core-js.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
package/package.json CHANGED
@@ -1,70 +1,67 @@
1
- {
2
- "name": "@microsoft/applicationinsights-core-js",
3
- "author": "Microsoft Application Insights Team",
4
- "version": "2.8.1-nightly.2204-21",
5
- "description": "Microsoft Application Insights Core Javascript SDK",
6
- "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
7
- "keywords": [
8
- "azure",
9
- "cloud",
10
- "script errors",
11
- "microsoft",
12
- "application insights",
13
- "browser performance monitoring",
14
- "web analytics"
15
- ],
16
- "main": "dist/applicationinsights-core-js.js",
17
- "module": "dist-esm/applicationinsights-core-js.js",
18
- "types": "types/applicationinsights-core-js.d.ts",
19
- "scripts": {
20
- "clean": "grunt clean",
21
- "build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
22
- "build:esm": "grunt core",
23
- "build:browser": "rollup -c rollup.config.js",
24
- "rebuild": "npm run build",
25
- "test": "grunt coreunittest",
26
- "perftest": "grunt coreperftest",
27
- "lint": "tslint -p tsconfig.json",
28
- "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights Core Javascript SDK\"",
29
- "sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js"
30
- },
31
- "repository": {
32
- "type": "git",
33
- "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCore"
34
- },
35
- "license": "MIT",
36
- "sideEffects": false,
37
- "devDependencies": {
38
- "@microsoft/ai-test-framework": "0.0.1",
39
- "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
40
- "@microsoft/applicationinsights-rollup-es3": "1.1.3",
41
- "@microsoft/api-extractor": "^7.18.1",
42
- "grunt": "^1.4.1",
43
- "grunt-cli": "^1.4.3",
44
- "grunt-contrib-qunit": "^5.0.1",
45
- "@nevware21/grunt-ts-plugin": "^0.4.3",
46
- "@nevware21/grunt-eslint-ts": "^0.2.2",
47
- "globby": "^11.0.0",
48
- "magic-string": "^0.25.7",
49
- "pako": "^2.0.3",
50
- "@rollup/plugin-commonjs": "^18.0.0",
51
- "@rollup/plugin-node-resolve": "^11.2.1",
52
- "@rollup/plugin-replace": "^2.3.3",
53
- "rollup-plugin-cleanup": "^3.2.1",
54
- "rollup": "^2.32.0",
55
- "typescript": "^4.3.4",
56
- "tslib": "^2.0.0",
57
- "qunit": "^2.11.2",
58
- "sinon": "^7.3.1"
59
- },
60
- "peerDependencies": {
61
- "tslib": "*"
62
- },
63
- "dependencies": {
64
- "@microsoft/applicationinsights-shims": "2.0.1",
65
- "@microsoft/dynamicproto-js": "^1.1.4"
66
- },
67
- "publishConfig": {
68
- "tag": "nightly"
69
- }
70
- }
1
+ {
2
+ "name": "@microsoft/applicationinsights-core-js",
3
+ "author": "Microsoft Application Insights Team",
4
+ "version": "2.8.1",
5
+ "description": "Microsoft Application Insights Core Javascript SDK",
6
+ "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
7
+ "keywords": [
8
+ "azure",
9
+ "cloud",
10
+ "script errors",
11
+ "microsoft",
12
+ "application insights",
13
+ "browser performance monitoring",
14
+ "web analytics"
15
+ ],
16
+ "main": "dist/applicationinsights-core-js.js",
17
+ "module": "dist-esm/applicationinsights-core-js.js",
18
+ "types": "types/applicationinsights-core-js.d.ts",
19
+ "scripts": {
20
+ "clean": "grunt clean",
21
+ "build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
22
+ "build:esm": "grunt core",
23
+ "build:browser": "rollup -c rollup.config.js",
24
+ "rebuild": "npm run build",
25
+ "test": "grunt coreunittest",
26
+ "perftest": "grunt coreperftest",
27
+ "lint": "tslint -p tsconfig.json",
28
+ "dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js \"Microsoft Application Insights Core Javascript SDK\"",
29
+ "sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "https://github.com/microsoft/ApplicationInsights-JS/tree/master/shared/AppInsightsCore"
34
+ },
35
+ "license": "MIT",
36
+ "sideEffects": false,
37
+ "devDependencies": {
38
+ "@microsoft/ai-test-framework": "0.0.1",
39
+ "@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
40
+ "@microsoft/applicationinsights-rollup-es3": "1.1.3",
41
+ "@microsoft/api-extractor": "^7.18.1",
42
+ "grunt": "^1.4.1",
43
+ "grunt-cli": "^1.4.3",
44
+ "grunt-contrib-qunit": "^5.0.1",
45
+ "@nevware21/grunt-ts-plugin": "^0.4.3",
46
+ "@nevware21/grunt-eslint-ts": "^0.2.2",
47
+ "globby": "^11.0.0",
48
+ "magic-string": "^0.25.7",
49
+ "pako": "^2.0.3",
50
+ "@rollup/plugin-commonjs": "^18.0.0",
51
+ "@rollup/plugin-node-resolve": "^11.2.1",
52
+ "@rollup/plugin-replace": "^2.3.3",
53
+ "rollup-plugin-cleanup": "^3.2.1",
54
+ "rollup": "^2.32.0",
55
+ "typescript": "^4.3.4",
56
+ "tslib": "^2.0.0",
57
+ "qunit": "^2.11.2",
58
+ "sinon": "^7.3.1"
59
+ },
60
+ "peerDependencies": {
61
+ "tslib": "*"
62
+ },
63
+ "dependencies": {
64
+ "@microsoft/applicationinsights-shims": "2.0.1",
65
+ "@microsoft/dynamicproto-js": "^1.1.4"
66
+ }
67
+ }
@@ -7,7 +7,7 @@ import { newId } from "./RandomHelper";
7
7
 
8
8
  const _objDefineProperty = ObjDefineProperty;
9
9
 
10
- const version = "2.8.1-nightly.2204-21";
10
+ const version = "2.8.1";
11
11
  let instanceName = "." + newId(6);
12
12
  let _dataUid = 0;
13
13
 
@@ -7,6 +7,7 @@ import {
7
7
  import { strShimFunction, strShimPrototype } from "@microsoft/applicationinsights-shims";
8
8
  import { hasOwnProperty, _getObjProto } from "./HelperFuncs";
9
9
  import { getGlobalInst } from "./EnvUtils";
10
+ import { createElmNodeData } from "./DataCacheHelper";
10
11
 
11
12
  const aiInstrumentHooks = "_aiHooks";
12
13
 
@@ -109,15 +110,17 @@ function _createFunctionHook(aiHook:IInstrumentHooks) {
109
110
 
110
111
  // Call the original function was called
111
112
  let theFunc = aiHook.f;
112
- try {
113
- funcArgs.rslt = theFunc.apply(funcThis, orgArgs);
114
- } catch (err) {
115
- // Report the request callback
116
- funcArgs.err = err;
117
- _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, CallbackType.FunctionError);
118
-
119
- // rethrow the original exception so anyone listening for it can catch the exception
120
- throw err;
113
+ if (theFunc) {
114
+ try {
115
+ funcArgs.rslt = theFunc.apply(funcThis, orgArgs);
116
+ } catch (err) {
117
+ // Report the request callback
118
+ funcArgs.err = err;
119
+ _doCallbacks(hooks, funcArgs, cbArgs, hookCtx, CallbackType.FunctionError);
120
+
121
+ // rethrow the original exception so anyone listening for it can catch the exception
122
+ throw err;
123
+ }
121
124
  }
122
125
 
123
126
  // Call the post-request hooks
@@ -170,6 +173,47 @@ export function InstrumentProtos(target:any, funcNames:string[], callbacks: IIns
170
173
  return null;
171
174
  }
172
175
 
176
+ function _createInstrumentHook(owner: any, funcName: string, fn: any, callbacks: IInstrumentHooksCallbacks) {
177
+ let aiHook: IInstrumentHooks = fn && fn[aiInstrumentHooks];
178
+ if (!aiHook) {
179
+ // Only hook the function once
180
+ aiHook = {
181
+ i: 0,
182
+ n: funcName,
183
+ f: fn,
184
+ h: []
185
+ };
186
+
187
+ // Override (hook) the original function
188
+ let newFunc = _createFunctionHook(aiHook);
189
+ newFunc[aiInstrumentHooks] = aiHook; // Tag and store the function hooks
190
+ owner[funcName] = newFunc;
191
+ }
192
+
193
+ const theHook: IInstrumentHook = {
194
+ // tslint:disable:object-literal-shorthand
195
+ id: aiHook.i,
196
+ cbks: callbacks,
197
+ rm: function () {
198
+ // DO NOT Use () => { shorthand for the function as the this gets replaced
199
+ // with the outer this and not the this for theHook instance.
200
+ let id = this.id;
201
+ _arrLoop(aiHook.h, (hook, idx) => {
202
+ if (hook.id === id) {
203
+ aiHook.h.splice(idx, 1);
204
+ return 1;
205
+ }
206
+ });
207
+ }
208
+ // tslint:enable:object-literal-shorthand
209
+ };
210
+
211
+ aiHook.i++;
212
+ aiHook.h.push(theHook);
213
+
214
+ return theHook;
215
+ }
216
+
173
217
  /**
174
218
  * Intercept the named prototype functions for the target class / object
175
219
  * @param target - The target object
@@ -183,44 +227,7 @@ export function InstrumentFunc(target:any, funcName:string, callbacks: IInstrume
183
227
  if (owner) {
184
228
  let fn = owner[funcName]
185
229
  if (typeof fn === strShimFunction) {
186
- let aiHook:IInstrumentHooks = fn[aiInstrumentHooks];
187
- if (!aiHook) {
188
- // Only hook the function once
189
- aiHook = {
190
- i: 0,
191
- n: funcName,
192
- f: fn,
193
- h: []
194
- };
195
-
196
- // Override (hook) the original function
197
- let newFunc = _createFunctionHook(aiHook);
198
- newFunc[aiInstrumentHooks] = aiHook; // Tag and store the function hooks
199
- owner[funcName] = newFunc;
200
- }
201
-
202
- const theHook: IInstrumentHook = {
203
- // tslint:disable:object-literal-shorthand
204
- id: aiHook.i,
205
- cbks: callbacks,
206
- rm: function() {
207
- // DO NOT Use () => { shorthand for the function as the this gets replaced
208
- // with the outer this and not the this for theHook instance.
209
- let id = this.id;
210
- _arrLoop(aiHook.h, (hook, idx) => {
211
- if (hook.id === id) {
212
- aiHook.h.splice(idx, 1);
213
- return 1;
214
- }
215
- });
216
- }
217
- // tslint:enable:object-literal-shorthand
218
- }
219
-
220
- aiHook.i ++;
221
- aiHook.h.push(theHook);
222
-
223
- return theHook;
230
+ return _createInstrumentHook(owner, funcName, fn, callbacks);
224
231
  }
225
232
  }
226
233
  }
@@ -250,3 +257,23 @@ export function InstrumentFuncs(target:any, funcNames:string[], callbacks: IInst
250
257
 
251
258
  return hooks;
252
259
  }
260
+
261
+ /**
262
+ * Add an instrumentation hook to the provided named "event" for the target class / object, this doesn't check whether the
263
+ * named "event" is in fact a function and just assigns the instrumentation hook to the target[evtName]
264
+ * @param target - The target object
265
+ * @param evtName - The name of the event
266
+ * @param callbacks - The callbacks to configure and call whenever the function is called
267
+ * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
268
+ */
269
+ export function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype:boolean = true): IInstrumentHook {
270
+ if (target && evtName && callbacks) {
271
+ let owner = _getOwner(target, evtName, checkPrototype);
272
+ if (owner) {
273
+ return _createInstrumentHook(owner, evtName, owner[evtName], callbacks);
274
+ }
275
+ }
276
+
277
+ return null;
278
+ }
279
+
@@ -29,3 +29,12 @@ export declare function InstrumentFunc(target: any, funcName: string, callbacks:
29
29
  * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
30
30
  */
31
31
  export declare function InstrumentFuncs(target: any, funcNames: string[], callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook[];
32
+ /**
33
+ * Add an instrumentation hook to the provided named "event" for the target class / object, this doesn't check whether the
34
+ * named "event" is in fact a function and just assigns the instrumentation hook to the target[evtName]
35
+ * @param target - The target object
36
+ * @param evtName - The name of the event
37
+ * @param callbacks - The callbacks to configure and call whenever the function is called
38
+ * @param checkPrototype - If the function doesn't exist on the target should it attempt to hook the prototype function
39
+ */
40
+ export declare function InstrumentEvent(target: any, evtName: string, callbacks: IInstrumentHooksCallbacks, checkPrototype?: boolean): IInstrumentHook;
@@ -32,7 +32,7 @@ export { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _
32
32
  export { ProcessTelemetryContext, createProcessTelemetryContext } from "./JavaScriptSDK/ProcessTelemetryContext";
33
33
  export { initializePlugins, sortPlugins, unloadComponents } from "./JavaScriptSDK/TelemetryHelpers";
34
34
  export { _InternalMessageId, _eInternalMessageId, LoggingSeverity, eLoggingSeverity } from "./JavaScriptSDK.Enums/LoggingEnums";
35
- export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs } from "./JavaScriptSDK/InstrumentHooks";
35
+ export { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from "./JavaScriptSDK/InstrumentHooks";
36
36
  export { ICookieMgr, ICookieMgrConfig } from "./JavaScriptSDK.Interfaces/ICookieMgr";
37
37
  export { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from "./JavaScriptSDK/CookieMgr";
38
38
  export { IDbgExtension } from "./JavaScriptSDK.Interfaces/IDbgExtension";