@microsoft/applicationinsights-web-basic 3.3.0-nightly3.2406-07 → 3.3.0-nightly3.2406-09

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 (47) hide show
  1. package/browser/es5/{aib.3.3.0-nightly3.2406-07.cjs.js → aib.3.3.0-nightly3.2406-09.cjs.js} +299 -77
  2. package/browser/es5/aib.3.3.0-nightly3.2406-09.cjs.js.map +1 -0
  3. package/browser/es5/aib.3.3.0-nightly3.2406-09.cjs.min.js +6 -0
  4. package/browser/es5/aib.3.3.0-nightly3.2406-09.cjs.min.js.map +1 -0
  5. package/browser/es5/{aib.3.3.0-nightly3.2406-07.gbl.js → aib.3.3.0-nightly3.2406-09.gbl.js} +301 -79
  6. package/browser/es5/aib.3.3.0-nightly3.2406-09.gbl.js.map +1 -0
  7. package/browser/es5/aib.3.3.0-nightly3.2406-09.gbl.min.js +6 -0
  8. package/browser/es5/aib.3.3.0-nightly3.2406-09.gbl.min.js.map +1 -0
  9. package/browser/es5/aib.3.3.0-nightly3.2406-09.integrity.json +66 -0
  10. package/browser/es5/{aib.3.3.0-nightly3.2406-07.js → aib.3.3.0-nightly3.2406-09.js} +301 -79
  11. package/browser/es5/aib.3.3.0-nightly3.2406-09.js.map +1 -0
  12. package/browser/es5/aib.3.3.0-nightly3.2406-09.min.js +6 -0
  13. package/browser/es5/aib.3.3.0-nightly3.2406-09.min.js.map +1 -0
  14. package/browser/es5/aib.3.cjs.js +298 -76
  15. package/browser/es5/aib.3.cjs.js.map +1 -1
  16. package/browser/es5/aib.3.cjs.min.js +2 -2
  17. package/browser/es5/aib.3.cjs.min.js.map +1 -1
  18. package/browser/es5/aib.3.gbl.js +300 -78
  19. package/browser/es5/aib.3.gbl.js.map +1 -1
  20. package/browser/es5/aib.3.gbl.min.js +2 -2
  21. package/browser/es5/aib.3.gbl.min.js.map +1 -1
  22. package/browser/es5/aib.3.integrity.json +25 -25
  23. package/browser/es5/aib.3.js +300 -78
  24. package/browser/es5/aib.3.js.map +1 -1
  25. package/browser/es5/aib.3.min.js +2 -2
  26. package/browser/es5/aib.3.min.js.map +1 -1
  27. package/dist/es5/applicationinsights-web-basic.js +298 -76
  28. package/dist/es5/applicationinsights-web-basic.js.map +1 -1
  29. package/dist/es5/applicationinsights-web-basic.min.js +2 -2
  30. package/dist/es5/applicationinsights-web-basic.min.js.map +1 -1
  31. package/dist-es5/__DynamicConstants.js +6 -4
  32. package/dist-es5/__DynamicConstants.js.map +1 -1
  33. package/dist-es5/index.js +40 -9
  34. package/dist-es5/index.js.map +1 -1
  35. package/package.json +4 -4
  36. package/types/applicationinsights-web-basic.d.ts +1 -1
  37. package/types/applicationinsights-web-basic.namespaced.d.ts +67 -5
  38. package/browser/es5/aib.3.3.0-nightly3.2406-07.cjs.js.map +0 -1
  39. package/browser/es5/aib.3.3.0-nightly3.2406-07.cjs.min.js +0 -6
  40. package/browser/es5/aib.3.3.0-nightly3.2406-07.cjs.min.js.map +0 -1
  41. package/browser/es5/aib.3.3.0-nightly3.2406-07.gbl.js.map +0 -1
  42. package/browser/es5/aib.3.3.0-nightly3.2406-07.gbl.min.js +0 -6
  43. package/browser/es5/aib.3.3.0-nightly3.2406-07.gbl.min.js.map +0 -1
  44. package/browser/es5/aib.3.3.0-nightly3.2406-07.integrity.json +0 -66
  45. package/browser/es5/aib.3.3.0-nightly3.2406-07.js.map +0 -1
  46. package/browser/es5/aib.3.3.0-nightly3.2406-07.min.js +0 -6
  47. package/browser/es5/aib.3.3.0-nightly3.2406-07.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript Web SDK - Basic, 3.3.0-nightly3.2406-07
2
+ * Application Insights JavaScript Web SDK - Basic, 3.3.0-nightly3.2406-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -11,8 +11,10 @@
11
11
  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
  // Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!
13
13
  // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
14
- export var _DYN_INSTRUMENTATION_KEY = "instrumentationKey"; // Count: 3
14
+ export var _DYN_INSTRUMENTATION_KEY = "instrumentationKey"; // Count: 5
15
15
  export var _DYN_CONNECTION_STRING = "connectionString"; // Count: 3
16
- export var _DYN_ENDPOINT_URL = "endpointUrl"; // Count: 3
17
- export var _DYN_USER_OVERRIDE_ENDPOI0 = "userOverrideEndpointUrl"; // Count: 4
16
+ export var _DYN_INSTRUMENTATIONKEY0 = "instrumentationkey"; // Count: 2
17
+ export var _DYN_ENDPOINT_URL = "endpointUrl"; // Count: 5
18
+ export var _DYN_INGESTIONENDPOINT = "ingestionendpoint"; // Count: 2
19
+ export var _DYN_USER_OVERRIDE_ENDPOI1 = "userOverrideEndpointUrl"; // Count: 5
18
20
  //# sourceMappingURL=__DynamicConstants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_INSTRUMENTATION_KEY = \"instrumentationKey\"; // Count: 3\r\nexport var _DYN_CONNECTION_STRING = \"connectionString\"; // Count: 3\r\nexport var _DYN_ENDPOINT_URL = \"endpointUrl\"; // Count: 3\r\nexport var _DYN_USER_OVERRIDE_ENDPOI0 = \"userOverrideEndpointUrl\"; // Count: 4\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"__DynamicConstants.js.map","sources":["__DynamicConstants.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\n// @skip-file-minify\r\n// ##############################################################\r\n// AUTO GENERATED FILE: This file is Auto Generated during build.\r\n// ##############################################################\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n// Note: DON'T Export these const from the package as we are still targeting ES3 this will export a mutable variables that someone could change!!!\r\n// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\nexport var _DYN_INSTRUMENTATION_KEY = \"instrumentationKey\"; // Count: 5\r\nexport var _DYN_CONNECTION_STRING = \"connectionString\"; // Count: 3\r\nexport var _DYN_INSTRUMENTATIONKEY0 = \"instrumentationkey\"; // Count: 2\r\nexport var _DYN_ENDPOINT_URL = \"endpointUrl\"; // Count: 5\r\nexport var _DYN_INGESTIONENDPOINT = \"ingestionendpoint\"; // Count: 2\r\nexport var _DYN_USER_OVERRIDE_ENDPOI1 = \"userOverrideEndpointUrl\"; // Count: 5\r\n//# sourceMappingURL=__DynamicConstants.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
package/dist-es5/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript Web SDK - Basic, 3.3.0-nightly3.2406-07
2
+ * Application Insights JavaScript Web SDK - Basic, 3.3.0-nightly3.2406-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -8,8 +8,9 @@ import dynamicProto from "@microsoft/dynamicproto-js";
8
8
  import { Sender } from "@microsoft/applicationinsights-channel-js";
9
9
  import { DEFAULT_BREEZE_PATH, parseConnectionString } from "@microsoft/applicationinsights-common";
10
10
  import { AppInsightsCore, cfgDfValidate, createDynamicConfig, onConfigChange, proxyFunctions } from "@microsoft/applicationinsights-core-js";
11
- import { isNullOrUndefined, objDefine, throwError } from "@nevware21/ts-utils";
12
- import { _DYN_CONNECTION_STRING, _DYN_ENDPOINT_URL, _DYN_INSTRUMENTATION_KEY, _DYN_USER_OVERRIDE_ENDPOI0 } from "./__DynamicConstants";
11
+ import { createAsyncPromise, doAwaitResponse } from "@nevware21/ts-async";
12
+ import { isNullOrUndefined, isPromiseLike, isString, objDefine, throwError } from "@nevware21/ts-utils";
13
+ import { _DYN_CONNECTION_STRING, _DYN_ENDPOINT_URL, _DYN_INGESTIONENDPOINT, _DYN_INSTRUMENTATIONKEY0, _DYN_INSTRUMENTATION_KEY, _DYN_USER_OVERRIDE_ENDPOI1 } from "./__DynamicConstants";
13
14
  var defaultConfigValues = {
14
15
  diagnosticLogInterval: cfgDfValidate(_chkDiagLevel, 10000)
15
16
  };
@@ -58,14 +59,44 @@ var ApplicationInsights = /** @class */ (function () {
58
59
  var cfgHandler = createDynamicConfig(config || {}, defaultConfigValues);
59
60
  _config = cfgHandler.cfg;
60
61
  core.addUnloadHook(onConfigChange(cfgHandler, function () {
61
- if (_config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */]) {
62
- var cs = parseConnectionString(_config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */]);
63
- var ingest = cs.ingestionendpoint;
64
- _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] : (ingest + DEFAULT_BREEZE_PATH); // only add /v2/track when from connectionstring
65
- _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = cs.instrumentationkey || _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];
62
+ var configCs = _config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */];
63
+ if (isPromiseLike(configCs)) {
64
+ var ikeyPromise = createAsyncPromise(function (resolve, reject) {
65
+ doAwaitResponse(configCs, function (res) {
66
+ var curCs = res.value;
67
+ var ikey = _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];
68
+ if (!res.rejected && curCs) {
69
+ // replace cs with resolved values in case of circular promises
70
+ _config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */] = curCs;
71
+ var resolvedCs = parseConnectionString(curCs);
72
+ ikey = resolvedCs[_DYN_INSTRUMENTATIONKEY0 /* @min:%2einstrumentationkey */] || ikey;
73
+ }
74
+ resolve(ikey);
75
+ });
76
+ });
77
+ var urlPromise = createAsyncPromise(function (resolve, reject) {
78
+ doAwaitResponse(configCs, function (res) {
79
+ var curCs = res.value;
80
+ var url = _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];
81
+ if (!res.rejected && curCs) {
82
+ var resolvedCs = parseConnectionString(curCs);
83
+ var ingest = resolvedCs[_DYN_INGESTIONENDPOINT /* @min:%2eingestionendpoint */];
84
+ url = ingest ? ingest + DEFAULT_BREEZE_PATH : url;
85
+ }
86
+ resolve(url);
87
+ });
88
+ });
89
+ _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = ikeyPromise;
90
+ _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] || urlPromise;
91
+ }
92
+ if (isString(configCs)) {
93
+ var cs = parseConnectionString(configCs);
94
+ var ingest = cs[_DYN_INGESTIONENDPOINT /* @min:%2eingestionendpoint */];
95
+ _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] : (ingest + DEFAULT_BREEZE_PATH); // only add /v2/track when from connectionstring
96
+ _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = cs[_DYN_INSTRUMENTATIONKEY0 /* @min:%2einstrumentationkey */] || _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];
66
97
  }
67
98
  // userOverrideEndpointUrl have the highest priority
68
- _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] : _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];
99
+ _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] : _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];
69
100
  }));
70
101
  // initialize core
71
102
  core.initialize(_config, [new Sender()]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js.map","sources":["index.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { Sender } from \"@microsoft/applicationinsights-channel-js\";\r\nimport { DEFAULT_BREEZE_PATH, parseConnectionString } from \"@microsoft/applicationinsights-common\";\r\nimport { AppInsightsCore, cfgDfValidate, createDynamicConfig, onConfigChange, proxyFunctions } from \"@microsoft/applicationinsights-core-js\";\r\nimport { isNullOrUndefined, objDefine, throwError } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CONNECTION_STRING, _DYN_ENDPOINT_URL, _DYN_INSTRUMENTATION_KEY, _DYN_USER_OVERRIDE_ENDPOI0 } from \"./__DynamicConstants\";\r\nvar defaultConfigValues = {\r\n diagnosticLogInterval: cfgDfValidate(_chkDiagLevel, 10000)\r\n};\r\nfunction _chkDiagLevel(value) {\r\n // Make sure we have a value > 0\r\n return value && value > 0;\r\n}\r\n/**\r\n * @export\r\n * @class ApplicationInsights\r\n */\r\nvar ApplicationInsights = /** @class */ (function () {\r\n /**\r\n * Creates an instance of ApplicationInsights.\r\n * @param config\r\n * @memberof ApplicationInsights\r\n */\r\n function ApplicationInsights(config) {\r\n var core = new AppInsightsCore();\r\n var _config;\r\n // initialize the queue and config in case they are undefined\r\n if (isNullOrUndefined(config) ||\r\n (isNullOrUndefined(config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */]) && isNullOrUndefined(config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */]))) {\r\n throwError(\"Invalid input configuration\");\r\n }\r\n dynamicProto(ApplicationInsights, this, function (_self) {\r\n // Define _self.config\r\n objDefine(_self, \"config\", {\r\n g: function () { return _config; }\r\n });\r\n _initialize();\r\n _self.initialize = _initialize;\r\n _self.track = _track;\r\n proxyFunctions(_self, core, [\r\n \"flush\",\r\n \"pollInternalLogs\",\r\n \"stopPollingInternalLogs\",\r\n \"unload\",\r\n \"getPlugin\",\r\n \"addPlugin\",\r\n \"evtNamespace\",\r\n \"addUnloadCb\",\r\n \"onCfgChange\"\r\n ]);\r\n function _initialize() {\r\n var cfgHandler = createDynamicConfig(config || {}, defaultConfigValues);\r\n _config = cfgHandler.cfg;\r\n core.addUnloadHook(onConfigChange(cfgHandler, function () {\r\n if (_config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */]) {\r\n var cs = parseConnectionString(_config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */]);\r\n var ingest = cs.ingestionendpoint;\r\n _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] : (ingest + DEFAULT_BREEZE_PATH); // only add /v2/track when from connectionstring\r\n _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = cs.instrumentationkey || _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];\r\n }\r\n // userOverrideEndpointUrl have the highest priority\r\n _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI0 /* @min:%2euserOverrideEndpointUrl */] : _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];\r\n }));\r\n // initialize core\r\n core.initialize(_config, [new Sender()]);\r\n }\r\n });\r\n function _track(item) {\r\n if (item) {\r\n // to pass sender.processTelemetry()\r\n item.baseData = item.baseData || {};\r\n item.baseType = item.baseType || \"EventData\";\r\n }\r\n core.track(item);\r\n }\r\n }\r\n /**\r\n * Initialize this instance of ApplicationInsights\r\n *\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.initialize = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Send a manually constructed custom event\r\n *\r\n * @param item\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.track = function (item) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Immediately send all batched telemetry\r\n * @param [async=true]\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.flush = function (async) {\r\n if (async === void 0) { async = true; }\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.prototype.pollInternalLogs = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.prototype.stopPollingInternalLogs = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered\r\n * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous\r\n * unload call return `true` stating that all plugins reported that they also unloaded, the recommended\r\n * approach is to create a new instance and initialize that instance.\r\n * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable\r\n * to successfully remove any global references or they may just be completing the unload process asynchronously.\r\n * @param isAsync - Can the unload be performed asynchronously (default)\r\n * @param unloadComplete - An optional callback that will be called once the unload has completed\r\n * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the\r\n * unload. Defaults to 5 seconds.\r\n * @return Nothing or if occurring asynchronously a [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * which will be resolved once the unload is complete, the [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * will only be returned when no callback is provided and isAsync is true\r\n */\r\n ApplicationInsights.prototype.unload = function (isAsync, unloadComplete, cbTimeout) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Find and return the (first) plugin with the specified identifier if present\r\n * @param pluginIdentifier\r\n */\r\n ApplicationInsights.prototype.getPlugin = function (pluginIdentifier) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Add a new plugin to the installation\r\n * @param plugin - The new plugin to add\r\n * @param replaceExisting - should any existing plugin be replaced\r\n * @param doAsync - Should the add be performed asynchronously\r\n */\r\n ApplicationInsights.prototype.addPlugin = function (plugin, replaceExisting, doAsync, addCb) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Returns the unique event namespace that should be used\r\n */\r\n ApplicationInsights.prototype.evtNamespace = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Add an unload handler that will be called when the SDK is being unloaded\r\n * @param handler - the handler\r\n */\r\n ApplicationInsights.prototype.addUnloadCb = function (handler) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Watches and tracks changes for accesses to the current config, and if the accessed config changes the\r\n * handler will be recalled.\r\n * @param handler\r\n * @returns A watcher handler instance that can be used to remove itself when being unloaded\r\n */\r\n ApplicationInsights.prototype.onCfgChange = function (handler) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return ApplicationInsights;\r\n}());\r\nexport { ApplicationInsights };\r\nexport { AppInsightsCore, arrForEach, isNullOrUndefined, throwError, proxyFunctions } from \"@microsoft/applicationinsights-core-js\";\r\nexport { SeverityLevel } from \"@microsoft/applicationinsights-common\";\r\nexport { Sender } from \"@microsoft/applicationinsights-channel-js\";\r\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;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;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;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;AACA;;;;;;;;;;8DA2FM,CAAC;;;;;+BACwB;AAC/B;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"file":"index.js.map","sources":["index.js"],"sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT License.\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { Sender } from \"@microsoft/applicationinsights-channel-js\";\r\nimport { DEFAULT_BREEZE_PATH, parseConnectionString } from \"@microsoft/applicationinsights-common\";\r\nimport { AppInsightsCore, cfgDfValidate, createDynamicConfig, onConfigChange, proxyFunctions } from \"@microsoft/applicationinsights-core-js\";\r\nimport { createAsyncPromise, doAwaitResponse } from \"@nevware21/ts-async\";\r\nimport { isNullOrUndefined, isPromiseLike, isString, objDefine, throwError } from \"@nevware21/ts-utils\";\r\nimport { _DYN_CONNECTION_STRING, _DYN_ENDPOINT_URL, _DYN_INGESTIONENDPOINT, _DYN_INSTRUMENTATIONKEY0, _DYN_INSTRUMENTATION_KEY, _DYN_USER_OVERRIDE_ENDPOI1 } from \"./__DynamicConstants\";\r\nvar defaultConfigValues = {\r\n diagnosticLogInterval: cfgDfValidate(_chkDiagLevel, 10000)\r\n};\r\nfunction _chkDiagLevel(value) {\r\n // Make sure we have a value > 0\r\n return value && value > 0;\r\n}\r\n/**\r\n * @export\r\n * @class ApplicationInsights\r\n */\r\nvar ApplicationInsights = /** @class */ (function () {\r\n /**\r\n * Creates an instance of ApplicationInsights.\r\n * @param config\r\n * @memberof ApplicationInsights\r\n */\r\n function ApplicationInsights(config) {\r\n var core = new AppInsightsCore();\r\n var _config;\r\n // initialize the queue and config in case they are undefined\r\n if (isNullOrUndefined(config) ||\r\n (isNullOrUndefined(config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */]) && isNullOrUndefined(config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */]))) {\r\n throwError(\"Invalid input configuration\");\r\n }\r\n dynamicProto(ApplicationInsights, this, function (_self) {\r\n // Define _self.config\r\n objDefine(_self, \"config\", {\r\n g: function () { return _config; }\r\n });\r\n _initialize();\r\n _self.initialize = _initialize;\r\n _self.track = _track;\r\n proxyFunctions(_self, core, [\r\n \"flush\",\r\n \"pollInternalLogs\",\r\n \"stopPollingInternalLogs\",\r\n \"unload\",\r\n \"getPlugin\",\r\n \"addPlugin\",\r\n \"evtNamespace\",\r\n \"addUnloadCb\",\r\n \"onCfgChange\"\r\n ]);\r\n function _initialize() {\r\n var cfgHandler = createDynamicConfig(config || {}, defaultConfigValues);\r\n _config = cfgHandler.cfg;\r\n core.addUnloadHook(onConfigChange(cfgHandler, function () {\r\n var configCs = _config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */];\r\n if (isPromiseLike(configCs)) {\r\n var ikeyPromise = createAsyncPromise(function (resolve, reject) {\r\n doAwaitResponse(configCs, function (res) {\r\n var curCs = res.value;\r\n var ikey = _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];\r\n if (!res.rejected && curCs) {\r\n // replace cs with resolved values in case of circular promises\r\n _config[_DYN_CONNECTION_STRING /* @min:%2econnectionString */] = curCs;\r\n var resolvedCs = parseConnectionString(curCs);\r\n ikey = resolvedCs[_DYN_INSTRUMENTATIONKEY0 /* @min:%2einstrumentationkey */] || ikey;\r\n }\r\n resolve(ikey);\r\n });\r\n });\r\n var urlPromise = createAsyncPromise(function (resolve, reject) {\r\n doAwaitResponse(configCs, function (res) {\r\n var curCs = res.value;\r\n var url = _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];\r\n if (!res.rejected && curCs) {\r\n var resolvedCs = parseConnectionString(curCs);\r\n var ingest = resolvedCs[_DYN_INGESTIONENDPOINT /* @min:%2eingestionendpoint */];\r\n url = ingest ? ingest + DEFAULT_BREEZE_PATH : url;\r\n }\r\n resolve(url);\r\n });\r\n });\r\n _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = ikeyPromise;\r\n _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] || urlPromise;\r\n }\r\n if (isString(configCs)) {\r\n var cs = parseConnectionString(configCs);\r\n var ingest = cs[_DYN_INGESTIONENDPOINT /* @min:%2eingestionendpoint */];\r\n _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] : (ingest + DEFAULT_BREEZE_PATH); // only add /v2/track when from connectionstring\r\n _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */] = cs[_DYN_INSTRUMENTATIONKEY0 /* @min:%2einstrumentationkey */] || _config[_DYN_INSTRUMENTATION_KEY /* @min:%2einstrumentationKey */];\r\n }\r\n // userOverrideEndpointUrl have the highest priority\r\n _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */] = _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] ? _config[_DYN_USER_OVERRIDE_ENDPOI1 /* @min:%2euserOverrideEndpointUrl */] : _config[_DYN_ENDPOINT_URL /* @min:%2eendpointUrl */];\r\n }));\r\n // initialize core\r\n core.initialize(_config, [new Sender()]);\r\n }\r\n });\r\n function _track(item) {\r\n if (item) {\r\n // to pass sender.processTelemetry()\r\n item.baseData = item.baseData || {};\r\n item.baseType = item.baseType || \"EventData\";\r\n }\r\n core.track(item);\r\n }\r\n }\r\n /**\r\n * Initialize this instance of ApplicationInsights\r\n *\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.initialize = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Send a manually constructed custom event\r\n *\r\n * @param item\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.track = function (item) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Immediately send all batched telemetry\r\n * @param [async=true]\r\n * @memberof ApplicationInsights\r\n */\r\n ApplicationInsights.prototype.flush = function (async) {\r\n if (async === void 0) { async = true; }\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.prototype.pollInternalLogs = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ApplicationInsights.prototype.stopPollingInternalLogs = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered\r\n * to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous\r\n * unload call return `true` stating that all plugins reported that they also unloaded, the recommended\r\n * approach is to create a new instance and initialize that instance.\r\n * This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable\r\n * to successfully remove any global references or they may just be completing the unload process asynchronously.\r\n * @param isAsync - Can the unload be performed asynchronously (default)\r\n * @param unloadComplete - An optional callback that will be called once the unload has completed\r\n * @param cbTimeout - An optional timeout to wait for any flush operations to complete before proceeding with the\r\n * unload. Defaults to 5 seconds.\r\n * @return Nothing or if occurring asynchronously a [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * which will be resolved once the unload is complete, the [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * will only be returned when no callback is provided and isAsync is true\r\n */\r\n ApplicationInsights.prototype.unload = function (isAsync, unloadComplete, cbTimeout) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Find and return the (first) plugin with the specified identifier if present\r\n * @param pluginIdentifier\r\n */\r\n ApplicationInsights.prototype.getPlugin = function (pluginIdentifier) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Add a new plugin to the installation\r\n * @param plugin - The new plugin to add\r\n * @param replaceExisting - should any existing plugin be replaced\r\n * @param doAsync - Should the add be performed asynchronously\r\n */\r\n ApplicationInsights.prototype.addPlugin = function (plugin, replaceExisting, doAsync, addCb) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Returns the unique event namespace that should be used\r\n */\r\n ApplicationInsights.prototype.evtNamespace = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Add an unload handler that will be called when the SDK is being unloaded\r\n * @param handler - the handler\r\n */\r\n ApplicationInsights.prototype.addUnloadCb = function (handler) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Watches and tracks changes for accesses to the current config, and if the accessed config changes the\r\n * handler will be recalled.\r\n * @param handler\r\n * @returns A watcher handler instance that can be used to remove itself when being unloaded\r\n */\r\n ApplicationInsights.prototype.onCfgChange = function (handler) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return ApplicationInsights;\r\n}());\r\nexport { ApplicationInsights };\r\nexport { AppInsightsCore, arrForEach, isNullOrUndefined, throwError, proxyFunctions } from \"@microsoft/applicationinsights-core-js\";\r\nexport { SeverityLevel } from \"@microsoft/applicationinsights-common\";\r\nexport { Sender } from \"@microsoft/applicationinsights-channel-js\";\r\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;AAA4D;AAC1B;AAClC;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;8DA2FM,CAAC;;;;;+BACwB;AAC/B;AACA;AACA;AACA;AACA;AACA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/applicationinsights-web-basic",
3
- "version": "3.3.0-nightly3.2406-07",
3
+ "version": "3.3.0-nightly3.2406-09",
4
4
  "description": "Microsoft Application Insights JavaScript SDK - Web Basic",
5
5
  "homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
6
6
  "author": "Microsoft Application Insights Team",
@@ -57,9 +57,9 @@
57
57
  "dependencies": {
58
58
  "@microsoft/dynamicproto-js": "^2.0.3",
59
59
  "@microsoft/applicationinsights-shims": "3.0.1",
60
- "@microsoft/applicationinsights-common": "3.3.0-nightly3.2406-07",
61
- "@microsoft/applicationinsights-channel-js": "3.3.0-nightly3.2406-07",
62
- "@microsoft/applicationinsights-core-js": "3.3.0-nightly3.2406-07",
60
+ "@microsoft/applicationinsights-common": "3.3.0-nightly3.2406-09",
61
+ "@microsoft/applicationinsights-channel-js": "3.3.0-nightly3.2406-09",
62
+ "@microsoft/applicationinsights-core-js": "3.3.0-nightly3.2406-09",
63
63
  "@nevware21/ts-utils": ">= 0.11.1 < 2.x",
64
64
  "@nevware21/ts-async": ">= 0.5.1 < 2.x"
65
65
  },
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 3.3.0-nightly3.2406-07
2
+ * Microsoft.ApplicationInsights, 3.3.0-nightly3.2406-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 3.3.0-nightly3.2406-07
2
+ * Microsoft.ApplicationInsights, 3.3.0-nightly3.2406-09
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -150,6 +150,21 @@ declare namespace ApplicationInsights {
150
150
  * @returns A watcher handler instance that can be used to remove itself when being unloaded
151
151
  */
152
152
  onCfgChange(handler: WatcherFunction<CfgType>): IUnloadHook;
153
+ /**
154
+ * Watches and tracks status of initialization process
155
+ * @returns ActiveStatus
156
+ * @since 3.3.0
157
+ * If returned status is active, it means initialization process is completed.
158
+ * If returned status is pending, it means the initialization process is waiting for promieses to be resolved.
159
+ * If returned status is inactive, it means ikey is invalid or can 't get ikey or enpoint url from promsises.
160
+ */
161
+ activeStatus(): eActiveStatus | number;
162
+ /**
163
+ * Set Active Status to pending, which will block the incoming changes until internal promises are resolved
164
+ * @internal Internal use
165
+ * @since 3.3.0
166
+ */
167
+ _setPendingStatus(): void;
153
168
  protected releaseQueue(): void;
154
169
  /**
155
170
  * Hook for Core extensions to allow them to update their own configuration before updating all of the plugins.
@@ -405,6 +420,23 @@ declare namespace ApplicationInsights {
405
420
 
406
421
  type DistributedTracingModes = number | eDistributedTracingModes;
407
422
 
423
+ const enum eActiveStatus {
424
+ NONE = 0,
425
+ /**
426
+ * inactive status means there might be rejected ikey/endpoint promises or ikey/endpoint resolved is not valid
427
+ */
428
+ INACTIVE = 1,
429
+ /**
430
+ * active mean ikey/endpoint promises is resolved and initializing with ikey/endpoint is successful
431
+ */
432
+ ACTIVE = 2,
433
+ /**
434
+ * Waiting for promises to be resolved
435
+ * NOTE: if status is set to be pending, incoming changes will be dropped until pending status is removed
436
+ */
437
+ PENDING = 3
438
+ }
439
+
408
440
  const enum eDistributedTracingModes {
409
441
  /**
410
442
  * (Default) Send Application Insights correlation headers
@@ -509,7 +541,8 @@ declare namespace ApplicationInsights {
509
541
  DynamicConfigException = 108,
510
542
  DefaultThrottleMsgKey = 109,
511
543
  CdnDeprecation = 110,
512
- SdkLdrUpdate = 111
544
+ SdkLdrUpdate = 111,
545
+ InitPromiseException = 112
513
546
  }
514
547
 
515
548
  const enum eLoggingSeverity {
@@ -720,6 +753,21 @@ declare namespace ApplicationInsights {
720
753
  * Function used to identify the get w parameter used to identify status bit to some channels
721
754
  */
722
755
  getWParam: () => number;
756
+ /**
757
+ * Watches and tracks status of initialization process
758
+ * @returns ActiveStatus
759
+ * @since 3.3.0
760
+ * If returned status is active, it means initialization process is completed.
761
+ * If returned status is pending, it means the initialization process is waiting for promieses to be resolved.
762
+ * If returned status is inactive, it means ikey is invalid or can 't get ikey or enpoint url from promsises.
763
+ */
764
+ activeStatus?: () => eActiveStatus | number;
765
+ /**
766
+ * Set Active Status to pending, which will block the incoming changes until internal promises are resolved
767
+ * @internal Internal use
768
+ * @since 3.3.0
769
+ */
770
+ _setPendingStatus?: () => void;
723
771
  }
724
772
 
725
773
  /**
@@ -1312,11 +1360,11 @@ declare namespace ApplicationInsights {
1312
1360
  /**
1313
1361
  * Instrumentation key of resource. Either this or connectionString must be specified.
1314
1362
  */
1315
- instrumentationKey?: string;
1363
+ instrumentationKey?: string | IPromise<string>;
1316
1364
  /**
1317
1365
  * Connection string of resource. Either this or instrumentationKey must be specified.
1318
1366
  */
1319
- connectionString?: string;
1367
+ connectionString?: string | IPromise<string>;
1320
1368
  /**
1321
1369
  * Set the timer interval (in ms) for internal logging queue, this is the
1322
1370
  * amount of time to wait after logger.queue messages are detected to be sent.
@@ -1360,7 +1408,7 @@ declare namespace ApplicationInsights {
1360
1408
  /**
1361
1409
  * Endpoint where telemetry data is sent
1362
1410
  */
1363
- endpointUrl?: string;
1411
+ endpointUrl?: string | IPromise<string>;
1364
1412
  /**
1365
1413
  * Extension configs loaded in SDK
1366
1414
  */
@@ -1462,6 +1510,20 @@ declare namespace ApplicationInsights {
1462
1510
  * @defaultValue undefined
1463
1511
  */
1464
1512
  featureOptIn?: IFeatureOptIn;
1513
+ /**
1514
+ * If your connection string, instrumentation key and endpoint url are promises,
1515
+ * this config is to manually set timeout for those promises.
1516
+ * Default: 50000ms
1517
+ * @since 3.3.0
1518
+ */
1519
+ initTimeOut?: number;
1520
+ /**
1521
+ * If your connection string, instrumentation key and endpoint url are promises,
1522
+ * this config is to manually set in memory proxy track calls count limit before promises finished.
1523
+ * Default: 100
1524
+ * @since 3.3.0
1525
+ */
1526
+ initInMemoMaxSize?: number;
1465
1527
  }
1466
1528
 
1467
1529
  interface ICookieMgr {