@microsoft/applicationinsights-offlinechannel-js 0.1.1-nightly3.2403-01 → 0.1.1-nightly3.2403-02
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.
- package/dist/es5/applicationinsights-offlinechannel-js.js +698 -510
- package/dist/es5/applicationinsights-offlinechannel-js.js.map +1 -1
- package/dist/es5/applicationinsights-offlinechannel-js.min.js +2 -2
- package/dist/es5/applicationinsights-offlinechannel-js.min.js.map +1 -1
- package/dist-es5/Helpers/Utils.js +5 -5
- package/dist-es5/Helpers/Utils.js.map +1 -1
- package/dist-es5/InMemoryBatch.js +1 -1
- package/dist-es5/Interfaces/IInMemoryBatch.js +1 -1
- package/dist-es5/Interfaces/IOfflineBatch.js +1 -1
- package/dist-es5/Interfaces/IOfflineIndexDb.js +1 -1
- package/dist-es5/Interfaces/IOfflineProvider.js +1 -1
- package/dist-es5/Interfaces/ISender.js +1 -1
- package/dist-es5/OfflineBatchHandler.js +4 -4
- package/dist-es5/OfflineBatchHandler.js.map +1 -1
- package/dist-es5/OfflineChannel.js +4 -4
- package/dist-es5/OfflineChannel.js.map +1 -1
- package/dist-es5/PayloadHelper.js +1 -1
- package/dist-es5/Providers/IndexDbHelper.js +4 -4
- package/dist-es5/Providers/IndexDbHelper.js.map +1 -1
- package/dist-es5/Providers/IndexDbProvider.js +1 -1
- package/dist-es5/Providers/WebStorageProvider.js +1 -1
- package/dist-es5/Sender.js +55 -400
- package/dist-es5/Sender.js.map +1 -1
- package/dist-es5/__DynamicConstants.js +10 -13
- package/dist-es5/__DynamicConstants.js.map +1 -1
- package/dist-es5/applicationinsights-offlinechannel-js.js +1 -1
- package/package.json +3 -3
- package/types/applicationinsights-offlinechannel-js.d.ts +1 -1
- package/types/applicationinsights-offlinechannel-js.namespaced.d.ts +6 -1
package/dist-es5/Sender.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sender.js.map","sources":["Sender.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 { BreezeChannelIdentifier, DisabledPropertyName, utlSetStoragePrefix } from \"@microsoft/applicationinsights-common\";\r\nimport { _throwInternal, arrForEach, createProcessTelemetryContext, dumpObj, getExceptionName, getJSON, getLocation, getNavigator, getWindow, isArray, isBeaconsSupported, isFetchSupported, isXhrSupported, objKeys, onConfigChange, useXDomainRequest } from \"@microsoft/applicationinsights-core-js\";\r\nimport { createPromise, doAwaitResponse } from \"@nevware21/ts-async\";\r\nimport { isFunction, isNumber } from \"@nevware21/ts-utils\";\r\nimport { _DYN_DATA, _DYN_INITIALIZE, _DYN_IS_COMPLETELY_IDLE, _DYN_LENGTH, _DYN_ONERROR, _DYN_REASON, _DYN_REJECTED, _DYN_REPLACE, _DYN_SEND_POST, _DYN_SET_REQUEST_HEADER, _DYN_STATUS, _DYN_URL_STRING, _DYN_VALUE } from \"./__DynamicConstants\";\r\nvar DefaultOfflineIdentifier = \"OfflineChannel\";\r\n//const FetchSyncRequestSizeLimitBytes = 65000; // approx 64kb (the current Edge, Firefox and Chrome max limit)\r\nvar PostChannelId = \"PostChannel\";\r\nfunction _getResponseText(xhr) {\r\n try {\r\n return xhr.responseText;\r\n }\r\n catch (e) {\r\n // Best effort, as XHR may throw while XDR wont so just ignore\r\n }\r\n return null;\r\n}\r\nfunction isOverrideFn(httpXHROverride) {\r\n return httpXHROverride && httpXHROverride[_DYN_SEND_POST /* @min:%2esendPOST */];\r\n}\r\nfunction _prependTransports(theTransports, newTransports) {\r\n if (newTransports) {\r\n if (isNumber(newTransports)) {\r\n theTransports = [newTransports].concat(theTransports);\r\n }\r\n else if (isArray(newTransports)) {\r\n theTransports = newTransports.concat(theTransports);\r\n }\r\n }\r\n return theTransports;\r\n}\r\nvar Sender = /** @class */ (function () {\r\n function Sender() {\r\n var _consecutiveErrors; // How many times in a row a retryable error condition has occurred.\r\n var _retryAt; // The time to retry at in milliseconds from 1970/01/01 (this makes the timer calculation easy).\r\n //let _lastSend: number; // The time of the last send operation.\r\n var _paused; // Flag indicating that the sending should be paused\r\n var _stamp_specific_redirects;\r\n var _syncFetchPayload = 0; // Keep track of the outstanding sync fetch payload total (as sync fetch has limits)\r\n var _enableSendPromise;\r\n var _alwaysUseCustomSend;\r\n var _disableXhr;\r\n var _fallbackSend;\r\n var _isInitialized;\r\n var _diagLog;\r\n var _core;\r\n var _httpInterface;\r\n var _onlineChannelId;\r\n var _isOneDs;\r\n dynamicProto(Sender, this, function (_self, _base) {\r\n var _sendCredentials = true; // for 1ds\r\n _initDefaults();\r\n _self.pause = function () {\r\n _clearScheduledTimer();\r\n _paused = true;\r\n };\r\n _self.resume = function () {\r\n if (_paused) {\r\n _paused = false;\r\n _retryAt = null;\r\n }\r\n };\r\n _self.getXhrInst = function (sync) {\r\n // unload events will be saved. so not return unload interface\r\n return _httpInterface;\r\n };\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, core, cxt, diagLog, channelId, unloadHookContainer) {\r\n _diagLog = diagLog || core.logger;\r\n if (_isInitialized) {\r\n _throwInternal(_diagLog, 1 /* eLoggingSeverity.CRITICAL */, 28 /* _eInternalMessageId.SenderNotInitialized */, \"Sender is already initialized\");\r\n }\r\n _core = core;\r\n _consecutiveErrors = 0;\r\n _retryAt = null;\r\n _stamp_specific_redirects = 0;\r\n // This function will be re-called whenever any referenced configuration is changed\r\n var hook = onConfigChange(config, function (details) {\r\n var config = details.cfg;\r\n if (config.storagePrefix) {\r\n utlSetStoragePrefix(config.storagePrefix);\r\n }\r\n var ctx = createProcessTelemetryContext(null, config, core);\r\n var offlineCfg = ctx.getExtCfg(DefaultOfflineIdentifier);\r\n _onlineChannelId = channelId || BreezeChannelIdentifier;\r\n var senderConfig = ctx.getExtCfg(_onlineChannelId, {});\r\n var offlineSenderCfg = offlineCfg.senderCfg || {};\r\n if (_onlineChannelId == PostChannelId) {\r\n _isOneDs = true;\r\n }\r\n _alwaysUseCustomSend = offlineSenderCfg.alwaysUseXhrOverride;\r\n // default true\r\n _enableSendPromise = !(senderConfig.enableSendPromise === false);\r\n var xhrOverride = offlineSenderCfg.httpXHROverride || senderConfig.httpXHROverride;\r\n var customInterface = isOverrideFn(xhrOverride) ? xhrOverride : null;\r\n if (!customInterface && _isOneDs) {\r\n var location_1 = getLocation();\r\n if (location_1 && location_1.protocol && location_1.protocol.toLowerCase() === \"file:\") {\r\n // Special case where a local html file fails with a CORS error on Chromium browsers\r\n _sendCredentials = false;\r\n }\r\n }\r\n var httpInterface = null;\r\n var customTransPorts = offlineSenderCfg.transports || senderConfig.transports || [];\r\n // User requested transport(s) values > Beacon > Fetch > XHR\r\n // Beacon would be filtered out if user has set disableBeaconApi to true at _getSenderInterface\r\n var theTransports = _prependTransports([1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], customTransPorts);\r\n httpInterface = _getSenderInterface(theTransports, false);\r\n var xhrInterface = { sendPOST: _xhrSender };\r\n _fallbackSend = _xhrSender;\r\n httpInterface = _alwaysUseCustomSend ? customInterface : (httpInterface || customInterface || xhrInterface);\r\n _httpInterface = httpInterface || xhrInterface;\r\n });\r\n unloadHookContainer && unloadHookContainer.add(hook);\r\n };\r\n _self[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */] = function () {\r\n try {\r\n var senderPlugin = _core.getPlugin(_onlineChannelId).plugin;\r\n if (senderPlugin && isFunction(senderPlugin[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */])) {\r\n if (!senderPlugin[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */]()) {\r\n return false;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // if can't get idle status of online sender, then isidle status only depends on offine sender idle status\r\n }\r\n return !_paused && _syncFetchPayload === 0;\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _initDefaults();\r\n };\r\n /**\r\n * success handler\r\n */\r\n function _onSuccess(res, onComplete) {\r\n _doOnComplete(onComplete, 200, {}, res);\r\n }\r\n /**\r\n * error handler\r\n */\r\n function _onError(message, onComplete) {\r\n _throwInternal(_diagLog, 2 /* eLoggingSeverity.WARNING */, 26 /* _eInternalMessageId.OnError */, \"Failed to send telemetry.\", { message: message });\r\n _doOnComplete(onComplete, 400, {});\r\n }\r\n function _onNoPayloadUrl(onComplete) {\r\n _onError(\"No endpoint url is provided for the batch\", onComplete);\r\n }\r\n /**\r\n * partial success handler\r\n */\r\n //TODO: partial success handler\r\n // function _onPartialSuccess (payload: string[], results: IBackendResponse, onComplete?: OnCompleteCallback) {\r\n // }\r\n function _getSenderInterface(transports, syncSupport) {\r\n var _a;\r\n var transportType = null;\r\n var sendPostFunc = null;\r\n var lp = 0;\r\n while (sendPostFunc == null && lp < transports[_DYN_LENGTH /* @min:%2elength */]) {\r\n transportType = transports[lp];\r\n if (!_disableXhr && transportType === 1 /* TransportType.Xhr */) {\r\n if (useXDomainRequest()) {\r\n // IE 8 and 9\r\n sendPostFunc = _xdrSender;\r\n }\r\n else if (isXhrSupported()) {\r\n sendPostFunc = _xhrSender;\r\n }\r\n }\r\n else if (transportType === 2 /* TransportType.Fetch */ && isFetchSupported(syncSupport)) {\r\n sendPostFunc = _fetchSender;\r\n }\r\n else if (transportType === 3 /* TransportType.Beacon */ && isBeaconsSupported()) {\r\n sendPostFunc = _beaconSender;\r\n }\r\n lp++;\r\n }\r\n if (sendPostFunc) {\r\n return _a = {},\r\n _a[_DYN_SEND_POST /* @min:sendPOST */] = sendPostFunc,\r\n _a;\r\n }\r\n return null;\r\n }\r\n /**\r\n * Send fetch API request\r\n * @param payload - {string} - The data payload to be sent.\r\n * @param oncomplete - {function} on complete function\r\n * @param sync - {boolean} - not used\r\n */\r\n function _fetchSender(payload, oncomplete, sync) {\r\n return _doFetchSender(payload, oncomplete, false);\r\n }\r\n function _doOnComplete(oncomplete, status, headers, response) {\r\n try {\r\n oncomplete && oncomplete(status, headers, response);\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n }\r\n function _doBeaconSend(payload, oncomplete) {\r\n var nav = getNavigator();\r\n var url = payload[_DYN_URL_STRING /* @min:%2eurlString */];\r\n if (!url) {\r\n _onNoPayloadUrl(oncomplete);\r\n // return true here, because we don't want to retry it with fallback sender\r\n return true;\r\n }\r\n var data = payload[_DYN_DATA /* @min:%2edata */];\r\n // Chrome only allows CORS-safelisted values for the sendBeacon data argument\r\n // see: https://bugs.chromium.org/p/chromium/issues/detail?id=720283\r\n //const batch = buffer.batchPayloads(payload);\r\n // Chrome only allows CORS-safelisted values for the sendBeacon data argument\r\n // see: https://bugs.chromium.org/p/chromium/issues/detail?id=720283\r\n var plainTextBatch = new Blob([data], { type: \"text/plain;charset=UTF-8\" });\r\n // The sendBeacon method returns true if the user agent is able to successfully queue the data for transfer. Otherwise it returns false.\r\n var queued = nav.sendBeacon(url, plainTextBatch);\r\n if (queued) {\r\n _onSuccess(null, oncomplete);\r\n }\r\n return queued;\r\n }\r\n /**\r\n * Send Beacon API request\r\n * @param payload - {string} - The data payload to be sent.\r\n * @param sync - {boolean} - not used\r\n * Note: Beacon API does not support custom headers and we are not able to get\r\n * appId from the backend for the correct correlation.\r\n */\r\n function _beaconSender(payload, oncomplete, sync) {\r\n var data = payload[_DYN_DATA /* @min:%2edata */];\r\n if (data) {\r\n // The sendBeacon method returns true if the user agent is able to successfully queue the data for transfer. Otherwise it returns false.\r\n if (!_doBeaconSend(payload, oncomplete)) {\r\n _fallbackSend && _fallbackSend(payload, oncomplete, true);\r\n _throwInternal(_diagLog, 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, \". \" + \"Failed to send telemetry with Beacon API, retried with normal sender.\");\r\n }\r\n }\r\n return;\r\n }\r\n /**\r\n * Send XMLHttpRequest\r\n * @param payload - {string} - The data payload to be sent.\r\n * @param sync - {boolean} - Indicates if the request should be sent synchronously\r\n */\r\n function _xhrSender(payload, oncomplete, sync) {\r\n //let internalPayload = payload as IInternalPayloadData;\r\n var thePromise;\r\n var resolveFunc;\r\n var rejectFunc;\r\n var headers = payload.headers || {};\r\n if (!sync && _enableSendPromise) {\r\n thePromise = createPromise(function (resolve, reject) {\r\n resolveFunc = resolve;\r\n rejectFunc = reject;\r\n });\r\n }\r\n var xhr = new XMLHttpRequest();\r\n var endPointUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */];\r\n if (!endPointUrl) {\r\n _onNoPayloadUrl(oncomplete);\r\n resolveFunc && resolveFunc(false);\r\n return;\r\n }\r\n try {\r\n xhr[DisabledPropertyName] = true;\r\n }\r\n catch (e) {\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n }\r\n xhr.open(\"POST\", endPointUrl, !sync);\r\n xhr[_DYN_SET_REQUEST_HEADER /* @min:%2esetRequestHeader */](\"Content-type\", \"application/json\");\r\n arrForEach(objKeys(headers), function (headerName) {\r\n xhr[_DYN_SET_REQUEST_HEADER /* @min:%2esetRequestHeader */](headerName, headers[headerName]);\r\n });\r\n xhr.onreadystatechange = function () {\r\n var response = _getResponseText(xhr);\r\n if (xhr.readyState !== 4) {\r\n //TODO: this should not need, add in case\r\n _handleResponse(oncomplete, xhr[_DYN_STATUS /* @min:%2estatus */], {}, response);\r\n resolveFunc && resolveFunc(false);\r\n }\r\n _handleResponse(oncomplete, xhr[_DYN_STATUS /* @min:%2estatus */], {}, response);\r\n resolveFunc && resolveFunc(true);\r\n };\r\n xhr[_DYN_ONERROR /* @min:%2eonerror */] = function (event) {\r\n _doOnComplete(oncomplete, 400, {}, _formatErrorMessageXhr(xhr));\r\n rejectFunc && rejectFunc(event);\r\n };\r\n xhr.ontimeout = function () {\r\n _doOnComplete(oncomplete, 500, {}, _formatErrorMessageXhr(xhr));\r\n resolveFunc && resolveFunc(false);\r\n };\r\n xhr.send(payload[_DYN_DATA /* @min:%2edata */]);\r\n return thePromise;\r\n }\r\n /**\r\n * Send fetch API request\r\n * @param payload - {string} - The data payload to be sent.\r\n * @param sync - {boolean} - For fetch this identifies whether we are \"unloading\" (false) or a normal request\r\n */\r\n function _doFetchSender(payload, oncomplete, sync) {\r\n var _a;\r\n var endPointUrl = payload[_DYN_URL_STRING /* @min:%2eurlString */];\r\n var batch = payload[_DYN_DATA /* @min:%2edata */];\r\n var plainTextBatch = new Blob([batch], { type: \"application/json\" });\r\n var thePromise;\r\n var resolveFunc;\r\n var rejectFunc;\r\n var requestHeaders = new Headers();\r\n var batchLength = batch[_DYN_LENGTH /* @min:%2elength */];\r\n var ignoreResponse = false;\r\n var responseHandled = false;\r\n var headers = payload.headers || [];\r\n //TODO: handle time out for 1ds\r\n arrForEach(objKeys(headers), function (headerName) {\r\n requestHeaders.append(headerName, headers[headerName]);\r\n });\r\n var init = (_a = {\r\n method: \"POST\",\r\n headers: requestHeaders,\r\n body: plainTextBatch\r\n },\r\n _a[DisabledPropertyName] = true // Mark so we don't attempt to track this request\r\n ,\r\n _a);\r\n if (_sendCredentials && _isOneDs) {\r\n // for 1ds, Don't send credentials when URL is file://\r\n init.credentials = \"include\";\r\n }\r\n if (sync) {\r\n // since offline will not trigger sync call\r\n // this will not be called, add it here in case\r\n init.keepalive = true;\r\n ignoreResponse = true;\r\n _syncFetchPayload += batchLength;\r\n }\r\n var request = new Request(endPointUrl, init);\r\n try {\r\n // Also try and tag the request (just in case the value in init is not copied over)\r\n request[DisabledPropertyName] = true;\r\n }\r\n catch (e) {\r\n // If the environment has locked down the XMLHttpRequest (preventExtensions and/or freeze), this would\r\n // cause the request to fail and we no telemetry would be sent\r\n }\r\n if (!sync && _enableSendPromise) {\r\n thePromise = createPromise(function (resolve, reject) {\r\n resolveFunc = resolve;\r\n rejectFunc = reject;\r\n });\r\n }\r\n if (!endPointUrl) {\r\n _onNoPayloadUrl(oncomplete);\r\n resolveFunc && resolveFunc(false);\r\n return;\r\n }\r\n try {\r\n doAwaitResponse(fetch(request), function (result) {\r\n if (sync) {\r\n _syncFetchPayload -= batchLength;\r\n batchLength = 0;\r\n }\r\n if (!responseHandled) {\r\n responseHandled = true;\r\n if (!result[_DYN_REJECTED /* @min:%2erejected */]) {\r\n var response_1 = result[_DYN_VALUE /* @min:%2evalue */];\r\n /**\r\n * The Promise returned from fetch() won’t reject on HTTP error status even if the response is an HTTP 404 or 500.\r\n * Instead, it will resolve normally (with ok status set to false), and it will only reject on network failure\r\n * or if anything prevented the request from completing.\r\n */\r\n if (!response_1.ok) {\r\n _doOnComplete(oncomplete, 400, {}, response_1.statusText);\r\n resolveFunc && resolveFunc(false);\r\n }\r\n else {\r\n doAwaitResponse(response_1.text(), function (resp) {\r\n var status = response_1[_DYN_STATUS /* @min:%2estatus */];\r\n _handleResponse(oncomplete, status, {}, response_1.statusText);\r\n resolveFunc && resolveFunc(true);\r\n });\r\n }\r\n }\r\n else {\r\n _doOnComplete(oncomplete, 400, {}, result[_DYN_REASON /* @min:%2ereason */] && result[_DYN_REASON /* @min:%2ereason */].message);\r\n rejectFunc && rejectFunc(result[_DYN_REASON /* @min:%2ereason */]);\r\n }\r\n }\r\n });\r\n }\r\n catch (e) {\r\n if (!responseHandled) {\r\n _doOnComplete(oncomplete, 400, {}, dumpObj(e));\r\n rejectFunc && rejectFunc(e);\r\n }\r\n }\r\n if (ignoreResponse && !responseHandled) {\r\n // Assume success during unload processing as we most likely won't get the response\r\n responseHandled = true;\r\n _doOnComplete(oncomplete, 200, {});\r\n resolveFunc && resolveFunc(true);\r\n }\r\n return thePromise;\r\n }\r\n function _handleResponse(oncomplete, status, headers, response) {\r\n if (status == 206 && !_isOneDs) {\r\n // for breeze, 206 is partially success, currently consider success\r\n // TODO: handle partial success\r\n _doOnComplete(oncomplete, 200, headers, response); // TODO: doc (support partial success)-> partial success add known issue (breeze)\r\n }\r\n else if (status == 204 && _isOneDs) {\r\n // one collector\r\n _doOnComplete(oncomplete, 200, headers, response);\r\n }\r\n else {\r\n _doOnComplete(oncomplete, status, headers, response);\r\n }\r\n }\r\n /**\r\n * Parses the response from the backend.\r\n * @param response - XMLHttpRequest or XDomainRequest response\r\n */\r\n function _parseResponse(response) {\r\n try {\r\n if (response && response !== \"\") {\r\n var result = getJSON().parse(response);\r\n if (_isOneDs) {\r\n return result;\r\n }\r\n // TODO: handle partial success\r\n // if (result && result.itemsReceived && result.itemsReceived >= result.itemsAccepted &&\r\n // result.itemsReceived - result.itemsAccepted === result.errors.length) {\r\n // return result;\r\n // }\r\n if (result && result.itemsReceived) {\r\n return result;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n _throwInternal(_diagLog, 1 /* eLoggingSeverity.CRITICAL */, 43 /* _eInternalMessageId.InvalidBackendResponse */, \"Cannot parse the response. \" + getExceptionName(e), {\r\n response: response\r\n });\r\n }\r\n return null;\r\n }\r\n function _clearScheduledTimer() {\r\n _retryAt = null;\r\n }\r\n function _formatErrorMessageXhr(xhr, message) {\r\n if (xhr) {\r\n return \"XMLHttpRequest,Status:\" + xhr[_DYN_STATUS /* @min:%2estatus */] + \",Response:\" + _getResponseText(xhr) || xhr.response || \"\";\r\n }\r\n return message;\r\n }\r\n /**\r\n * Send XDomainRequest\r\n * @param payload - {string} - The data payload to be sent.\r\n * @param sync - {boolean} - Indicates if the request should be sent synchronously\r\n *\r\n * Note: XDomainRequest does not support sync requests. This 'isAsync' parameter is added\r\n * to maintain consistency with the xhrSender's contract\r\n * Note: XDomainRequest does not support custom headers and we are not able to get\r\n * appId from the backend for the correct correlation.\r\n */\r\n function _xdrSender(payload, oncomplete, sync) {\r\n // It doesn't support custom headers, so no action is taken with current requestHeaders\r\n var _window = getWindow();\r\n var xdr = new XDomainRequest();\r\n var data = payload[_DYN_DATA /* @min:%2edata */];\r\n xdr.onload = function () {\r\n var response = _getResponseText(xdr);\r\n if (_isOneDs) {\r\n // for 1ds. we will assume onload means the request succeeded.\r\n _doOnComplete(oncomplete, 200, {}, response);\r\n }\r\n else {\r\n _xdrOnLoad(xdr, oncomplete);\r\n }\r\n };\r\n xdr[_DYN_ONERROR /* @min:%2eonerror */] = function () {\r\n _doOnComplete(oncomplete, 400, {}, _formatErrorMessageXdr(xdr));\r\n };\r\n xdr.ontimeout = function () {\r\n _doOnComplete(oncomplete, 500, {});\r\n };\r\n xdr.onprogress = function () { };\r\n // XDomainRequest requires the same protocol as the hosting page.\r\n // If the protocol doesn't match, we can't send the telemetry :(.\r\n var hostingProtocol = _window && _window.location && _window.location.protocol || \"\";\r\n var endpoint = payload[_DYN_URL_STRING /* @min:%2eurlString */];\r\n if (!endpoint) {\r\n _onNoPayloadUrl(oncomplete);\r\n return;\r\n }\r\n if (endpoint.lastIndexOf(hostingProtocol, 0) !== 0) {\r\n _throwInternal(_diagLog, 2 /* eLoggingSeverity.WARNING */, 40 /* _eInternalMessageId.TransmissionFailed */, \". \" +\r\n \"Cannot send XDomain request. The endpoint URL protocol doesn't match the hosting page protocol.\");\r\n return;\r\n }\r\n var endpointUrl = endpoint[_DYN_REPLACE /* @min:%2ereplace */](/^(https?:)/, \"\");\r\n xdr.open(\"POST\", endpointUrl);\r\n xdr.send(data);\r\n }\r\n /**\r\n * xdr state changes\r\n */\r\n function _xdrOnLoad(xdr, oncomplete) {\r\n var responseText = _getResponseText(xdr);\r\n if (xdr && (responseText + \"\" === \"200\" || responseText === \"\")) {\r\n _consecutiveErrors = 0;\r\n _onSuccess(responseText, oncomplete);\r\n }\r\n else {\r\n var results = _parseResponse(responseText);\r\n if (results && results.itemsAccepted) {\r\n // TODO: onPartial success for appInsights\r\n _onSuccess(responseText, oncomplete);\r\n }\r\n else {\r\n _onError(_formatErrorMessageXdr(xdr), oncomplete);\r\n }\r\n }\r\n }\r\n function _formatErrorMessageXdr(xdr, message) {\r\n if (xdr) {\r\n return \"XDomainRequest,Response:\" + _getResponseText(xdr) || \"\";\r\n }\r\n return message;\r\n }\r\n // TDOD: add notification manager\r\n // TODO: handler one collector \"MSFPC\"\r\n function _initDefaults() {\r\n _self._appId = null;\r\n _consecutiveErrors = 0;\r\n _retryAt = null;\r\n _paused = false;\r\n _stamp_specific_redirects = 0;\r\n _syncFetchPayload = 0;\r\n _disableXhr = false;\r\n _isInitialized = false;\r\n _fallbackSend = null;\r\n _core = null;\r\n _onlineChannelId = null;\r\n }\r\n });\r\n }\r\n /**\r\n * Pause the sending (transmission) of events, this will cause all events to be batched only until the maximum limits are\r\n * hit at which point new events are dropped. Will also cause events to NOT be sent during page unload, so if Session storage\r\n * is disabled events will be lost.\r\n */\r\n Sender.prototype.pause = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Resume the sending (transmission) of events, this will restart the timer and any batched events will be sent using the normal\r\n * send interval.\r\n */\r\n Sender.prototype.resume = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n Sender.prototype.initialize = function (config, core, cxt, diagLog, channelId, unloadHookContainer) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Trigger the immediate send of buffered data; If executing asynchronously (the default) this may (not required) return\r\n * an [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) that will resolve once the\r\n * send is complete. The actual implementation of the `IPromise` will be a native Promise (if supported) or the default\r\n * as supplied by [ts-async library](https://github.com/nevware21/ts-async)\r\n * @param async - Indicates if the events should be sent asynchronously\r\n * @param forcedSender - {SenderFunction} - Indicates the forcedSender, undefined if not passed\r\n * @returns - Nothing or optionally, if occurring asynchronously a [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * which will be resolved (or reject) once the send is complete, the [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * should only be returned when async is true.\r\n */\r\n Sender.prototype.triggerSend = function (async, forcedSender, sendReason) {\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 /**\r\n * Check if there are no active requests being sent.\r\n * @returns True if idle, false otherwise.\r\n */\r\n Sender.prototype.isCompletelyIdle = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Get current xhr instance\r\n */\r\n Sender.prototype.getXhrInst = function (sync) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n Sender.prototype._doTeardown = function (unloadCtx, unloadState) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return Sender;\r\n}());\r\nexport { Sender };\r\n//# sourceMappingURL=Sender.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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;iDAkDM,CAAC;;;;;kBACW;AAClB;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"Sender.js.map","sources":["Sender.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 { BreezeChannelIdentifier, SenderPostManager, formatErrorMessageXdr, getResponseText, parseResponse, prependTransports, utlSetStoragePrefix } from \"@microsoft/applicationinsights-common\";\r\nimport { _throwInternal, createProcessTelemetryContext, onConfigChange } from \"@microsoft/applicationinsights-core-js\";\r\nimport { isFunction } from \"@nevware21/ts-utils\";\r\nimport { _DYN_ENABLE_SEND_PROMISE, _DYN_GET_XHR_INST, _DYN_INITIALIZE, _DYN_IS_COMPLETELY_IDLE, _DYN_SEND_POST } from \"./__DynamicConstants\";\r\nvar DefaultOfflineIdentifier = \"OfflineChannel\";\r\nvar PostChannelId = \"PostChannel\";\r\nfunction isOverrideFn(httpXHROverride) {\r\n return httpXHROverride && httpXHROverride[_DYN_SEND_POST /* @min:%2esendPOST */];\r\n}\r\nvar Sender = /** @class */ (function () {\r\n function Sender() {\r\n var _consecutiveErrors; // How many times in a row a retryable error condition has occurred.\r\n var _retryAt; // The time to retry at in milliseconds from 1970/01/01 (this makes the timer calculation easy).\r\n var _paused; // Flag indicating that the sending should be paused\r\n var _enableSendPromise;\r\n var _alwaysUseCustomSend;\r\n var _isInitialized;\r\n var _diagLog;\r\n var _core;\r\n var _httpInterface;\r\n var _onlineChannelId;\r\n var _isOneDs;\r\n var _sendPostMgr;\r\n var _disableCredentials;\r\n dynamicProto(Sender, this, function (_self, _base) {\r\n //let _sendCredentials = true; // for 1ds\r\n _initDefaults();\r\n _self.pause = function () {\r\n _clearScheduledTimer();\r\n _paused = true;\r\n };\r\n _self.resume = function () {\r\n if (_paused) {\r\n _paused = false;\r\n _retryAt = null;\r\n }\r\n };\r\n _self[_DYN_GET_XHR_INST /* @min:%2egetXhrInst */] = function (sync) {\r\n // unload events will be saved. so not return unload interface\r\n return _httpInterface;\r\n };\r\n _self[_DYN_INITIALIZE /* @min:%2einitialize */] = function (config, core, cxt, diagLog, channelId, unloadHookContainer) {\r\n _diagLog = diagLog || core.logger;\r\n if (_isInitialized) {\r\n _throwInternal(_diagLog, 1 /* eLoggingSeverity.CRITICAL */, 28 /* _eInternalMessageId.SenderNotInitialized */, \"Sender is already initialized\");\r\n }\r\n _core = core;\r\n _consecutiveErrors = 0;\r\n _retryAt = null;\r\n // This function will be re-called whenever any referenced configuration is changed\r\n var hook = onConfigChange(config, function (details) {\r\n var config = details.cfg;\r\n if (config.storagePrefix) {\r\n utlSetStoragePrefix(config.storagePrefix);\r\n }\r\n var ctx = createProcessTelemetryContext(null, config, core);\r\n var offlineCfg = ctx.getExtCfg(DefaultOfflineIdentifier);\r\n _onlineChannelId = channelId || BreezeChannelIdentifier;\r\n var senderConfig = ctx.getExtCfg(_onlineChannelId, {});\r\n var offlineSenderCfg = offlineCfg.senderCfg || {};\r\n if (_onlineChannelId == PostChannelId) {\r\n _isOneDs = true;\r\n }\r\n _alwaysUseCustomSend = offlineSenderCfg.alwaysUseXhrOverride;\r\n // default true\r\n _enableSendPromise = !(senderConfig[_DYN_ENABLE_SEND_PROMISE /* @min:%2eenableSendPromise */] === false);\r\n var xhrOverride = offlineSenderCfg.httpXHROverride || senderConfig.httpXHROverride;\r\n var customInterface = isOverrideFn(xhrOverride) ? xhrOverride : null;\r\n _disableCredentials = !customInterface && _isOneDs;\r\n var sendPostMgrConfig = _getSendPostMgrConfig();\r\n if (!_sendPostMgr) {\r\n _sendPostMgr = new SenderPostManager();\r\n _sendPostMgr[_DYN_INITIALIZE /* @min:%2einitialize */](sendPostMgrConfig, _diagLog);\r\n }\r\n else {\r\n _sendPostMgr.SetConfig(sendPostMgrConfig);\r\n }\r\n var httpInterface = null;\r\n var customTransPorts = offlineSenderCfg.transports || senderConfig.transports || [];\r\n var theTransports = prependTransports([1 /* TransportType.Xhr */, 2 /* TransportType.Fetch */, 3 /* TransportType.Beacon */], customTransPorts);\r\n httpInterface = _sendPostMgr[_DYN_GET_XHR_INST /* @min:%2egetXhrInst */](theTransports, false);\r\n var xhrInterface = _sendPostMgr.getFallbackInst();\r\n httpInterface = _alwaysUseCustomSend ? customInterface : (httpInterface || customInterface || xhrInterface);\r\n _httpInterface = httpInterface || xhrInterface;\r\n });\r\n unloadHookContainer && unloadHookContainer.add(hook);\r\n };\r\n _self[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */] = function () {\r\n var syncPayload = 0;\r\n try {\r\n var senderPlugin = _core.getPlugin(_onlineChannelId).plugin;\r\n if (senderPlugin && isFunction(senderPlugin[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */])) {\r\n if (!senderPlugin[_DYN_IS_COMPLETELY_IDLE /* @min:%2eisCompletelyIdle */]()) {\r\n return false;\r\n }\r\n }\r\n if (_sendPostMgr) {\r\n syncPayload = _sendPostMgr.getSyncFetchPayload();\r\n }\r\n }\r\n catch (e) {\r\n // if can't get idle status of online sender, then isidle status only depends on offine sender idle status\r\n }\r\n return !_paused && syncPayload === 0;\r\n };\r\n // partial 206, parse payload (not send again)\r\n _self._doTeardown = function (unloadCtx, unloadState) {\r\n _initDefaults();\r\n };\r\n /**\r\n * success handler\r\n */\r\n function _onSuccess(res, onComplete) {\r\n _doOnComplete(onComplete, 200, {}, res);\r\n }\r\n function _getSendPostMgrConfig() {\r\n var _a;\r\n var config = (_a = {},\r\n _a[_DYN_ENABLE_SEND_PROMISE /* @min:enableSendPromise */] = _enableSendPromise,\r\n _a.isOneDs = _isOneDs,\r\n _a.disableCredentials = _disableCredentials,\r\n _a.senderOnCompleteCallBack = _getOnCompleteFuncs(),\r\n _a);\r\n return config;\r\n }\r\n /**\r\n * error handler\r\n */\r\n function _onError(message, onComplete) {\r\n _throwInternal(_diagLog, 2 /* eLoggingSeverity.WARNING */, 26 /* _eInternalMessageId.OnError */, \"Failed to send telemetry.\", { message: message });\r\n _doOnComplete(onComplete, 400, {});\r\n }\r\n function _getOnCompleteFuncs() {\r\n var funcs = {\r\n xdrOnComplete: function (response, oncomplete) {\r\n return _xdrOnLoad(response, oncomplete);\r\n },\r\n fetchOnComplete: function (response, onComplete, resValue) {\r\n var status = response.status;\r\n return _handleResponse(onComplete, status, {}, resValue);\r\n },\r\n xhrOnComplete: function (request, oncomplete) {\r\n var response = getResponseText(request);\r\n return _handleResponse(oncomplete, request.status, {}, response);\r\n }\r\n };\r\n return funcs;\r\n }\r\n function _doOnComplete(oncomplete, status, headers, response) {\r\n try {\r\n oncomplete && oncomplete(status, headers, response);\r\n }\r\n catch (e) {\r\n // eslint-disable-next-line no-empty\r\n }\r\n }\r\n function _handleResponse(oncomplete, status, headers, response) {\r\n if (status == 206 && !_isOneDs) {\r\n // for breeze, 206 is partially success, currently consider success\r\n // TODO: handle partial success\r\n _doOnComplete(oncomplete, 200, headers, response); // TODO: doc (support partial success)-> partial success add known issue (breeze)\r\n }\r\n else if (status == 204 && _isOneDs) {\r\n // one collector\r\n _doOnComplete(oncomplete, 200, headers, response);\r\n }\r\n else {\r\n _doOnComplete(oncomplete, status, headers, response);\r\n }\r\n }\r\n function _clearScheduledTimer() {\r\n _retryAt = null;\r\n }\r\n /**\r\n * xdr state changes\r\n */\r\n function _xdrOnLoad(xdr, oncomplete) {\r\n var responseText = getResponseText(xdr);\r\n if (xdr && (responseText + \"\" === \"200\" || responseText === \"\")) {\r\n _consecutiveErrors = 0;\r\n _onSuccess(responseText, oncomplete);\r\n }\r\n else {\r\n var results = parseResponse(responseText, _diagLog);\r\n if (results && results.itemsAccepted) {\r\n // TODO: onPartial success for appInsights\r\n _onSuccess(responseText, oncomplete);\r\n }\r\n else {\r\n _onError(formatErrorMessageXdr(xdr), oncomplete);\r\n }\r\n }\r\n }\r\n function _initDefaults() {\r\n _self._appId = null;\r\n _consecutiveErrors = 0;\r\n _retryAt = null;\r\n _paused = false;\r\n _isInitialized = false;\r\n _core = null;\r\n _onlineChannelId = null;\r\n _sendPostMgr = null;\r\n }\r\n });\r\n }\r\n /**\r\n * Pause the sending (transmission) of events, this will cause all events to be batched only until the maximum limits are\r\n * hit at which point new events are dropped. Will also cause events to NOT be sent during page unload, so if Session storage\r\n * is disabled events will be lost.\r\n */\r\n Sender.prototype.pause = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Resume the sending (transmission) of events, this will restart the timer and any batched events will be sent using the normal\r\n * send interval.\r\n */\r\n Sender.prototype.resume = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n Sender.prototype.initialize = function (config, core, cxt, diagLog, channelId, unloadHookContainer) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * Trigger the immediate send of buffered data; If executing asynchronously (the default) this may (not required) return\r\n * an [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html) that will resolve once the\r\n * send is complete. The actual implementation of the `IPromise` will be a native Promise (if supported) or the default\r\n * as supplied by [ts-async library](https://github.com/nevware21/ts-async)\r\n * @param async - Indicates if the events should be sent asynchronously\r\n * @param forcedSender - {SenderFunction} - Indicates the forcedSender, undefined if not passed\r\n * @returns - Nothing or optionally, if occurring asynchronously a [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * which will be resolved (or reject) once the send is complete, the [IPromise](https://nevware21.github.io/ts-async/typedoc/interfaces/IPromise.html)\r\n * should only be returned when async is true.\r\n */\r\n Sender.prototype.triggerSend = function (async, forcedSender, sendReason) {\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 /**\r\n * Check if there are no active requests being sent.\r\n * @returns True if idle, false otherwise.\r\n */\r\n Sender.prototype.isCompletelyIdle = function () {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return false;\r\n };\r\n /**\r\n * Get current xhr instance\r\n */\r\n Sender.prototype.getXhrInst = function (sync) {\r\n // @DynamicProtoStub - DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n Sender.prototype._doTeardown = function (unloadCtx, unloadState) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return Sender;\r\n}());\r\nexport { Sender };\r\n//# sourceMappingURL=Sender.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;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;;;;;;iDAkDM,CAAC;;;;;kBACW;AAClB;AACA;AACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Offline Channel, 0.1.1-nightly3.2403-
|
|
2
|
+
* Application Insights JavaScript SDK - Offline Channel, 0.1.1-nightly3.2403-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -15,27 +15,27 @@ export var _DYN_ENDPOINT = "endpoint"; // Count: 4
|
|
|
15
15
|
export var _DYN_ADD_EVENT = "addEvent"; // Count: 8
|
|
16
16
|
export var _DYN_COUNT = "count"; // Count: 5
|
|
17
17
|
export var _DYN_PUSH = "push"; // Count: 18
|
|
18
|
-
export var _DYN_LENGTH = "length"; // Count:
|
|
18
|
+
export var _DYN_LENGTH = "length"; // Count: 50
|
|
19
19
|
export var _DYN_CLEAR = "clear"; // Count: 5
|
|
20
20
|
export var _DYN_GET_ITEMS = "getItems"; // Count: 4
|
|
21
21
|
export var _DYN_SPLIT = "split"; // Count: 5
|
|
22
22
|
export var _DYN_SPLICE = "splice"; // Count: 4
|
|
23
|
-
export var _DYN_INITIALIZE = "initialize"; // Count:
|
|
23
|
+
export var _DYN_INITIALIZE = "initialize"; // Count: 11
|
|
24
24
|
export var _DYN_DIAG_LOG = "diagLog"; // Count: 6
|
|
25
25
|
export var _DYN_ITEM_CTX = "itemCtx"; // Count: 4
|
|
26
26
|
export var _DYN_STORAGE_CONFIG = "storageConfig"; // Count: 4
|
|
27
|
-
export var _DYN_VALUE = "value"; // Count:
|
|
28
|
-
export var
|
|
29
|
-
export var _DYN_REJECTED = "rejected"; // Count: 7
|
|
27
|
+
export var _DYN_VALUE = "value"; // Count: 12
|
|
28
|
+
export var _DYN_REJECTED = "rejected"; // Count: 6
|
|
30
29
|
export var _DYN_GET_NEXT_BATCH = "getNextBatch"; // Count: 5
|
|
31
30
|
export var _DYN_REMOVE_EVENTS = "removeEvents"; // Count: 3
|
|
32
|
-
export var _DYN_DATA = "data"; // Count:
|
|
33
|
-
export var _DYN_SEND_POST = "sendPOST"; // Count:
|
|
31
|
+
export var _DYN_DATA = "data"; // Count: 11
|
|
32
|
+
export var _DYN_SEND_POST = "sendPOST"; // Count: 3
|
|
34
33
|
export var _DYN_ATTEMP_CNT = "attempCnt"; // Count: 4
|
|
35
34
|
export var _DYN_STATE = "state"; // Count: 9
|
|
36
35
|
export var _DYN_TEARDOWN = "teardown"; // Count: 6
|
|
37
36
|
export var _DYN_IS_ARR = "isArr"; // Count: 5
|
|
38
37
|
export var _DYN_INDEX_OF = "indexOf"; // Count: 9
|
|
38
|
+
export var _DYN_GET_XHR_INST = "getXhrInst"; // Count: 3
|
|
39
39
|
export var _DYN_IS_ONLINE = "isOnline"; // Count: 3
|
|
40
40
|
export var _DYN_CANCEL = "cancel"; // Count: 5
|
|
41
41
|
export var _DYN_PROCESS_NEXT = "processNext"; // Count: 3
|
|
@@ -51,11 +51,7 @@ export var _DYN_OVERRIDE_INSTRUMENTA1 = "overrideInstrumentationKey"; // Count:
|
|
|
51
51
|
export var _DYN_INSTRUMENTATION_KEY = "instrumentationKey"; // Count: 3
|
|
52
52
|
export var _DYN_NOTIFICATION_MGR = "notificationMgr"; // Count: 3
|
|
53
53
|
export var _DYN_TO_STRING = "toString"; // Count: 5
|
|
54
|
-
export var
|
|
55
|
-
export var _DYN_SET_REQUEST_HEADER = "setRequestHeader"; // Count: 2
|
|
56
|
-
export var _DYN_STATUS = "status"; // Count: 4
|
|
57
|
-
export var _DYN_ONERROR = "onerror"; // Count: 11
|
|
58
|
-
export var _DYN_REPLACE = "replace"; // Count: 4
|
|
54
|
+
export var _DYN_ENABLE_SEND_PROMISE = "enableSendPromise"; // Count: 2
|
|
59
55
|
export var _DYN_CHAR_CODE_AT = "charCodeAt"; // Count: 3
|
|
60
56
|
export var _DYN_CHAR_AT = "charAt"; // Count: 8
|
|
61
57
|
export var _DYN_FROM_CHAR_CODE = "fromCharCode"; // Count: 3
|
|
@@ -68,6 +64,7 @@ export var _DYN_OPEN_STORE = "openStore"; // Count: 3
|
|
|
68
64
|
export var _DYN_OPEN_CURSOR = "openCursor"; // Count: 3
|
|
69
65
|
export var _DYN_DB_NAME = "dbName"; // Count: 5
|
|
70
66
|
export var _DYN_REMOVE = "remove"; // Count: 4
|
|
67
|
+
export var _DYN_ONERROR = "onerror"; // Count: 9
|
|
71
68
|
export var _DYN_ONSUCCESS = "onsuccess"; // Count: 7
|
|
72
69
|
export var _DYN_THEN = "then"; // Count: 12
|
|
73
70
|
export var _DYN_KEY_RANGE = "keyRange"; // Count: 3
|
|
@@ -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_ENDPOINT = \"endpoint\"; // Count: 4\r\nexport var _DYN_ADD_EVENT = \"addEvent\"; // Count: 8\r\nexport var _DYN_COUNT = \"count\"; // Count: 5\r\nexport var _DYN_PUSH = \"push\"; // Count: 18\r\nexport var _DYN_LENGTH = \"length\"; // Count:
|
|
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_ENDPOINT = \"endpoint\"; // Count: 4\r\nexport var _DYN_ADD_EVENT = \"addEvent\"; // Count: 8\r\nexport var _DYN_COUNT = \"count\"; // Count: 5\r\nexport var _DYN_PUSH = \"push\"; // Count: 18\r\nexport var _DYN_LENGTH = \"length\"; // Count: 50\r\nexport var _DYN_CLEAR = \"clear\"; // Count: 5\r\nexport var _DYN_GET_ITEMS = \"getItems\"; // Count: 4\r\nexport var _DYN_SPLIT = \"split\"; // Count: 5\r\nexport var _DYN_SPLICE = \"splice\"; // Count: 4\r\nexport var _DYN_INITIALIZE = \"initialize\"; // Count: 11\r\nexport var _DYN_DIAG_LOG = \"diagLog\"; // Count: 6\r\nexport var _DYN_ITEM_CTX = \"itemCtx\"; // Count: 4\r\nexport var _DYN_STORAGE_CONFIG = \"storageConfig\"; // Count: 4\r\nexport var _DYN_VALUE = \"value\"; // Count: 12\r\nexport var _DYN_REJECTED = \"rejected\"; // Count: 6\r\nexport var _DYN_GET_NEXT_BATCH = \"getNextBatch\"; // Count: 5\r\nexport var _DYN_REMOVE_EVENTS = \"removeEvents\"; // Count: 3\r\nexport var _DYN_DATA = \"data\"; // Count: 11\r\nexport var _DYN_SEND_POST = \"sendPOST\"; // Count: 3\r\nexport var _DYN_ATTEMP_CNT = \"attempCnt\"; // Count: 4\r\nexport var _DYN_STATE = \"state\"; // Count: 9\r\nexport var _DYN_TEARDOWN = \"teardown\"; // Count: 6\r\nexport var _DYN_IS_ARR = \"isArr\"; // Count: 5\r\nexport var _DYN_INDEX_OF = \"indexOf\"; // Count: 9\r\nexport var _DYN_GET_XHR_INST = \"getXhrInst\"; // Count: 3\r\nexport var _DYN_IS_ONLINE = \"isOnline\"; // Count: 3\r\nexport var _DYN_CANCEL = \"cancel\"; // Count: 5\r\nexport var _DYN_PROCESS_NEXT = \"processNext\"; // Count: 3\r\nexport var _DYN_PERSISTENCE = \"persistence\"; // Count: 8\r\nexport var _DYN_ONUNLOAD_FLUSH = \"onunloadFlush\"; // Count: 3\r\nexport var _DYN_BATCH_HANDLER = \"batchHandler\"; // Count: 3\r\nexport var _DYN_MIN_PERSISTENCE_CACH0 = \"minPersistenceCacheLevel\"; // Count: 2\r\nexport var _DYN_REFRESH = \"refresh\"; // Count: 4\r\nexport var _DYN_IS_COMPLETELY_IDLE = \"isCompletelyIdle\"; // Count: 5\r\nexport var _DYN_CRITICAL_CNT = \"criticalCnt\"; // Count: 7\r\nexport var _DYN_GET_OFFLINE_SUPPORT = \"getOfflineSupport\"; // Count: 2\r\nexport var _DYN_OVERRIDE_INSTRUMENTA1 = \"overrideInstrumentationKey\"; // Count: 2\r\nexport var _DYN_INSTRUMENTATION_KEY = \"instrumentationKey\"; // Count: 3\r\nexport var _DYN_NOTIFICATION_MGR = \"notificationMgr\"; // Count: 3\r\nexport var _DYN_TO_STRING = \"toString\"; // Count: 5\r\nexport var _DYN_ENABLE_SEND_PROMISE = \"enableSendPromise\"; // Count: 2\r\nexport var _DYN_CHAR_CODE_AT = \"charCodeAt\"; // Count: 3\r\nexport var _DYN_CHAR_AT = \"charAt\"; // Count: 8\r\nexport var _DYN_FROM_CHAR_CODE = \"fromCharCode\"; // Count: 3\r\nexport var _DYN_GET_TIME = \"getTime\"; // Count: 5\r\nexport var _DYN_NAME = \"name\"; // Count: 7\r\nexport var _DYN_DB_HDL = \"dbHdl\"; // Count: 7\r\nexport var _DYN_IS_AVAILABLE = \"isAvailable\"; // Count: 8\r\nexport var _DYN_TRANSACTION = \"transaction\"; // Count: 5\r\nexport var _DYN_OPEN_STORE = \"openStore\"; // Count: 3\r\nexport var _DYN_OPEN_CURSOR = \"openCursor\"; // Count: 3\r\nexport var _DYN_DB_NAME = \"dbName\"; // Count: 5\r\nexport var _DYN_REMOVE = \"remove\"; // Count: 4\r\nexport var _DYN_ONERROR = \"onerror\"; // Count: 9\r\nexport var _DYN_ONSUCCESS = \"onsuccess\"; // Count: 7\r\nexport var _DYN_THEN = \"then\"; // Count: 12\r\nexport var _DYN_KEY_RANGE = \"keyRange\"; // Count: 3\r\nexport var _DYN_CONTINUE = \"continue\"; // Count: 7\r\nexport var _DYN_SUBSTRING = \"substring\"; // Count: 3\r\nexport var _DYN_STORAGE_KEY_PREFIX = \"storageKeyPrefix\"; // Count: 2\r\nexport var _DYN_IN_STORAGE_MAX_TIME = \"inStorageMaxTime\"; // Count: 2\r\nexport var _DYN__EVENTS_TO_DROP_PER_2 = \"EventsToDropPerTime\"; // Count: 2\r\nexport var _DYN_MAX_CRITICAL_EVTS_DR3 = \"maxCriticalEvtsDropCnt\"; // Count: 2\r\nexport var _DYN_SUPPORTS_SYNC_REQUES4 = \"supportsSyncRequests\"; // Count: 2\r\nexport var _DYN_REMOVE_ITEM = \"removeItem\"; // Count: 3\r\nexport var _DYN_EVTS = \"evts\"; // Count: 6\r\nexport var _DYN_LAST_ACCESS_TIME = \"lastAccessTime\"; // Count: 3\r\n//# sourceMappingURL=__DynamicConstants.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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Offline Channel, 0.1.1-nightly3.2403-
|
|
2
|
+
* Application Insights JavaScript SDK - Offline Channel, 0.1.1-nightly3.2403-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
export { WebStorageProvider } from "./Providers/WebStorageProvider";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/applicationinsights-offlinechannel-js",
|
|
3
|
-
"version": "0.1.1-nightly3.2403-
|
|
3
|
+
"version": "0.1.1-nightly3.2403-02",
|
|
4
4
|
"description": "Microsoft Application Insights JavaScript SDK Offline Channel",
|
|
5
5
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
6
6
|
"author": "Microsoft Application Insights Team",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@microsoft/dynamicproto-js": "^2.0.3",
|
|
30
30
|
"@microsoft/applicationinsights-shims": "3.0.1",
|
|
31
|
-
"@microsoft/applicationinsights-core-js": "3.1.1-nightly3.2403-
|
|
32
|
-
"@microsoft/applicationinsights-common": "3.1.1-nightly3.2403-
|
|
31
|
+
"@microsoft/applicationinsights-core-js": "3.1.1-nightly3.2403-02",
|
|
32
|
+
"@microsoft/applicationinsights-common": "3.1.1-nightly3.2403-02",
|
|
33
33
|
"@nevware21/ts-utils": ">= 0.10.5 < 2.x",
|
|
34
34
|
"@nevware21/ts-async": ">= 0.3.0 < 2.x"
|
|
35
35
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights JavaScript SDK Offline Channel, 0.1.1-nightly3.2403-
|
|
2
|
+
* Microsoft Application Insights JavaScript SDK Offline Channel, 0.1.1-nightly3.2403-02
|
|
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 Application Insights JavaScript SDK Offline Channel, 0.1.1-nightly3.2403-
|
|
2
|
+
* Microsoft Application Insights JavaScript SDK Offline Channel, 0.1.1-nightly3.2403-02
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -909,6 +909,11 @@ declare namespace ApplicationInsights {
|
|
|
909
909
|
throttleMgrCfg?: {
|
|
910
910
|
[key: number]: IThrottleMgrConfig;
|
|
911
911
|
};
|
|
912
|
+
/**
|
|
913
|
+
* [Optional] Specifies a Highest Priority custom endpoint URL where telemetry data will be sent.
|
|
914
|
+
* This URL takes precedence over the 'config.endpointUrl' and any endpoint in the connection string.
|
|
915
|
+
*/
|
|
916
|
+
userOverrideEndpointUrl?: string;
|
|
912
917
|
}
|
|
913
918
|
|
|
914
919
|
/**
|