@equinor/echo-framework 0.9.13 → 0.9.14
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/components/appLinks/applinkUtils.d.ts +2 -0
- package/dist/components/appLinks/applinkUtils.test.d.ts +1 -0
- package/dist/components/containers/layouts.d.ts +5 -3
- package/dist/components/panel/corePanelLeft.d.ts +1 -4
- package/dist/components/panel/corePanelRight.d.ts +1 -4
- package/dist/components/router/echoRoute.d.ts +2 -2
- package/dist/components/router/index.d.ts +1 -0
- package/dist/components/router/useLayout.d.ts +3 -0
- package/dist/coreApplication/index.d.ts +0 -2
- package/dist/hooks/index.d.ts +0 -2
- package/dist/index.d.ts +0 -8
- package/dist/index.js +3 -0
- package/dist/types/hookLibrary.d.ts +0 -1
- package/package.json +42 -39
- package/dist/_virtual/_tslib.js +0 -67
- package/dist/_virtual/index.js +0 -9
- package/dist/coreApplication/EchoBarComponent.d.ts +0 -9
- package/dist/coreApplication/EchoUserInterfaceContextProvider.d.ts +0 -11
- package/dist/hooks/useIsCompactLayout.d.ts +0 -5
- package/dist/hooks/useScreenOrientation.d.ts +0 -5
- package/dist/hooks/useScreenValues.d.ts +0 -13
- package/dist/hooks/useWindowSize.d.ts +0 -9
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +0 -25
- package/dist/node_modules/@equinor/eds-icons/dist/icons.esm.js +0 -5285
- package/dist/node_modules/@microsoft/signalr/dist/esm/AbortController.js +0 -54
- package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultHttpClient.js +0 -96
- package/dist/node_modules/@microsoft/signalr/dist/esm/DefaultReconnectPolicy.js +0 -47
- package/dist/node_modules/@microsoft/signalr/dist/esm/Errors.js +0 -287
- package/dist/node_modules/@microsoft/signalr/dist/esm/FetchHttpClient.js +0 -283
- package/dist/node_modules/@microsoft/signalr/dist/esm/HandshakeProtocol.js +0 -86
- package/dist/node_modules/@microsoft/signalr/dist/esm/HeaderNames.js +0 -20
- package/dist/node_modules/@microsoft/signalr/dist/esm/HttpClient.js +0 -82
- package/dist/node_modules/@microsoft/signalr/dist/esm/HttpConnection.js +0 -1169
- package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnection.js +0 -1346
- package/dist/node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js +0 -165
- package/dist/node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js +0 -33
- package/dist/node_modules/@microsoft/signalr/dist/esm/ILogger.js +0 -37
- package/dist/node_modules/@microsoft/signalr/dist/esm/ITransport.js +0 -37
- package/dist/node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js +0 -179
- package/dist/node_modules/@microsoft/signalr/dist/esm/Loggers.js +0 -35
- package/dist/node_modules/@microsoft/signalr/dist/esm/LongPollingTransport.js +0 -448
- package/dist/node_modules/@microsoft/signalr/dist/esm/ServerSentEventsTransport.js +0 -238
- package/dist/node_modules/@microsoft/signalr/dist/esm/Subject.js +0 -99
- package/dist/node_modules/@microsoft/signalr/dist/esm/TextMessageFormat.js +0 -45
- package/dist/node_modules/@microsoft/signalr/dist/esm/Utils.js +0 -435
- package/dist/node_modules/@microsoft/signalr/dist/esm/WebSocketTransport.js +0 -264
- package/dist/node_modules/@microsoft/signalr/dist/esm/XhrHttpClient.js +0 -133
- package/dist/node_modules/classnames/index.js +0 -67
- package/dist/node_modules/history/esm/history.js +0 -498
- package/dist/node_modules/resolve-pathname/esm/resolve-pathname.js +0 -73
- package/dist/node_modules/style-inject/dist/style-inject.es.js +0 -36
- package/dist/node_modules/tiny-invariant/dist/tiny-invariant.esm.js +0 -23
- package/dist/node_modules/tiny-warning/dist/tiny-warning.esm.js +0 -26
- package/dist/src/components/appLinks/AppLinks.js +0 -38
- package/dist/src/components/appLinks/AppLinks.module.css.js +0 -14
- package/dist/src/components/appLinks/linkButton/linkButton.js +0 -45
- package/dist/src/components/containers/layout.module.css.js +0 -29
- package/dist/src/components/containers/layouts.js +0 -101
- package/dist/src/components/contextualAppLinks/contextualAppLinks.context.js +0 -20
- package/dist/src/components/contextualAppLinks/contextualAppLinks.js +0 -47
- package/dist/src/components/contextualAppLinks/externalAppsMenu.js +0 -157
- package/dist/src/components/contextualAppLinks/externalAppsMenu.module.css.js +0 -16
- package/dist/src/components/contextualAppLinks/externalLinkButtons/allExternalLinks.js +0 -127
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkButtons.helpers.js +0 -169
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToCommApp.js +0 -95
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToMcApp.js +0 -95
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToProCoSys.js +0 -84
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSafeX.js +0 -38
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSap.js +0 -110
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToSemiDoc.js +0 -59
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToStid.js +0 -40
- package/dist/src/components/contextualAppLinks/externalLinkButtons/externalLinkToTr2000.js +0 -114
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.js +0 -44
- package/dist/src/components/contextualAppLinks/externalLinkButtons/iconButtonSpinner.module.css.js +0 -15
- package/dist/src/components/contextualAppLinks/hooks/useContextualAppLinks.js +0 -52
- package/dist/src/components/contextualAppLinks/hooks/useContextualAppLinksContext.js +0 -36
- package/dist/src/components/contextualAppLinks/index.js +0 -22
- package/dist/src/components/contextualAppLinks/internalAppLinks.js +0 -115
- package/dist/src/components/contextualAppLinks/linkButton.js +0 -57
- package/dist/src/components/echoLogo/echoLogo.js +0 -30
- package/dist/src/components/echoLogo/echoLogo.module.css.js +0 -15
- package/dist/src/components/errorBoundary/components/chunkLoadErrorMessage.js +0 -64
- package/dist/src/components/errorBoundary/components/chunkLoadErrorMessage.module.css.js +0 -17
- package/dist/src/components/errorBoundary/components/errorBoundaryBaseMessage.js +0 -85
- package/dist/src/components/errorBoundary/components/errorBoundaryBaseMessage.module.css.js +0 -19
- package/dist/src/components/errorBoundary/components/notificationCardWithLogo.js +0 -55
- package/dist/src/components/errorBoundary/components/notificationCardWithLogo.module.css.js +0 -19
- package/dist/src/components/errorBoundary/errorBoundary.js +0 -100
- package/dist/src/components/externalLinkButton/externalLinkButton.js +0 -310
- package/dist/src/components/externalLinkButton/externalLinkButton.module.css.js +0 -23
- package/dist/src/components/footer/footer.js +0 -42
- package/dist/src/components/footer/footer.module.css.js +0 -17
- package/dist/src/components/lazyLoading/appLoadingIndicator.js +0 -34
- package/dist/src/components/lazyLoading/appLoadingIndicator.module.css.js +0 -15
- package/dist/src/components/lazyLoading/lazyLoadedAppWrapper.js +0 -40
- package/dist/src/components/mediator/mediator.js +0 -32
- package/dist/src/components/pageMenu/Navigation/applicationList.js +0 -35
- package/dist/src/components/pageMenu/Navigation/applicationList.module.css.js +0 -17
- package/dist/src/components/pageMenu/accordionItem.module.css.js +0 -16
- package/dist/src/components/pageMenu/defaultAccordionItem.js +0 -61
- package/dist/src/components/pageMenu/pageMenu.js +0 -141
- package/dist/src/components/pageMenu/pageMenu.module.css.js +0 -17
- package/dist/src/components/pageMenu/pageMenuDrawerItem.js +0 -77
- package/dist/src/components/pageMenu/pageMenuDrawerItem.module.css.js +0 -20
- package/dist/src/components/pageMenu/settings/asset.js +0 -40
- package/dist/src/components/pageMenu/settings/profile.js +0 -62
- package/dist/src/components/pageMenu/settings/settings.js +0 -41
- package/dist/src/components/pageMenu/settings/settings.module.css.js +0 -25
- package/dist/src/components/pageMenu/version/version.js +0 -88
- package/dist/src/components/pageMenu/version/version.module.css.js +0 -14
- package/dist/src/components/panel/corePanelIcon.js +0 -31
- package/dist/src/components/panel/corePanelLeft.js +0 -94
- package/dist/src/components/panel/corePanelLeft.module.css.js +0 -21
- package/dist/src/components/panel/corePanelRight.js +0 -98
- package/dist/src/components/panel/corePanelRight.module.css.js +0 -18
- package/dist/src/components/panelButton/panelButton.js +0 -124
- package/dist/src/components/panelButton/panelButton.module.css.js +0 -25
- package/dist/src/components/plantSelector/plantSelector.js +0 -137
- package/dist/src/components/projectSelector/ProcosysProjectSelector.js +0 -115
- package/dist/src/components/projectSelector/ProcosysProjectSelector.module.css.js +0 -14
- package/dist/src/components/realTimeData/RealTimePopoverButton.js +0 -168
- package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.js +0 -83
- package/dist/src/components/realTimeData/components/IMSDropdown/RealTimeIMSDropdown.module.css.js +0 -15
- package/dist/src/components/realTimeData/components/connectorForIMSTag/IMSConnector.module.css.js +0 -17
- package/dist/src/components/realTimeData/components/connectorForIMSTag/RealTimeConnectorForIMSTag.js +0 -149
- package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.js +0 -75
- package/dist/src/components/realTimeData/components/contextButton/RealTimeContextButton.module.css.js +0 -15
- package/dist/src/components/realTimeData/components/contextPopover/Popover.js +0 -37
- package/dist/src/components/realTimeData/components/contextPopover/Popover.module.css.js +0 -15
- package/dist/src/components/realTimeData/hooks/useRealTimeHub.js +0 -124
- package/dist/src/components/realTimeData/hooks/useSignalR.js +0 -175
- package/dist/src/components/realTimeData/hooks/useSignalRListener.js +0 -22
- package/dist/src/components/router/echoRoute.js +0 -51
- package/dist/src/components/router/echoRouter.js +0 -30
- package/dist/src/components/router/echoWrapper.js +0 -33
- package/dist/src/components/router/routes.js +0 -43
- package/dist/src/components/searchMenu/searchMenu.js +0 -46
- package/dist/src/components/searchMenu/searchMenu.module.css.js +0 -16
- package/dist/src/components/tagNumber/tagNo.module.css.js +0 -14
- package/dist/src/components/tagNumber/tagNumber.js +0 -38
- package/dist/src/components/toaster/toaster.js +0 -44
- package/dist/src/components/toaster/toaster.module.css.js +0 -16
- package/dist/src/components/toaster/toasters.js +0 -101
- package/dist/src/coreApplication/EchoBarComponent.js +0 -164
- package/dist/src/coreApplication/EchoContent.js +0 -52
- package/dist/src/coreApplication/EchoContent.module.css.js +0 -17
- package/dist/src/coreApplication/EchoContentPanels.js +0 -40
- package/dist/src/coreApplication/EchoEventHandler.js +0 -79
- package/dist/src/coreApplication/EchoEventHandler.module.css.js +0 -14
- package/dist/src/coreApplication/EchoUserInterfaceContextProvider.js +0 -66
- package/dist/src/globalStyles.css.js +0 -6
- package/dist/src/hooks/hookLibrary.js +0 -86
- package/dist/src/hooks/index.js +0 -18
- package/dist/src/hooks/useEchoHistory.js +0 -38
- package/dist/src/hooks/useIsCompactLayout.js +0 -50
- package/dist/src/hooks/useLongPress.js +0 -37
- package/dist/src/hooks/useScreenOrientation.js +0 -62
- package/dist/src/hooks/useScreenValues.js +0 -35
- package/dist/src/hooks/useSemi.js +0 -100
- package/dist/src/hooks/useTagDetails.js +0 -153
- package/dist/src/hooks/useWindowSize.js +0 -62
- package/dist/src/icons/common/CommissionApp-icon.png.js +0 -7
- package/dist/src/icons/common/Evision.svg.js +0 -68
- package/dist/src/icons/common/Fusion.svg.js +0 -111
- package/dist/src/icons/common/McApp.svg.js +0 -70
- package/dist/src/icons/common/Notification.svg.js +0 -81
- package/dist/src/icons/common/ProCoSysIcon.svg.js +0 -68
- package/dist/src/icons/common/Robim.svg.js +0 -66
- package/dist/src/icons/common/SX-logo.png.js +0 -7
- package/dist/src/icons/common/SapLogo.svg.js +0 -95
- package/dist/src/icons/common/SemiIcon.svg.js +0 -82
- package/dist/src/icons/common/Stid.svg.js +0 -65
- package/dist/src/icons/common/TR2000.svg.js +0 -73
- package/dist/src/icons/common/WorkOrder.svg.js +0 -71
- package/dist/src/icons/common/Yammer.svg.js +0 -65
- package/dist/src/icons/common/satos-logo.png.js +0 -7
- package/dist/src/icons/edsIons.js +0 -15
- package/dist/src/icons/equinor-logo.js +0 -62
- package/dist/src/icons/logo_ee.js +0 -37
- package/dist/src/icons/search.js +0 -35
- package/dist/src/index.js +0 -218
- package/dist/src/index2.js +0 -205
- package/dist/src/services/api/api-manager.js +0 -190
- package/dist/src/services/api/api-plantinfo.js +0 -196
- package/dist/src/services/api/api-plants.js +0 -75
- package/dist/src/services/api/api-realtimedata.js +0 -55
- package/dist/src/services/api/api-tag-details.js +0 -69
- package/dist/src/services/api/api-tags.js +0 -88
- package/dist/src/services/api/api-version.js +0 -124
- package/dist/src/services/componentRegistry/componentRegistry.js +0 -69
- package/dist/src/services/echopediaAnalyticsModule/echopediaAnalyticsModule.js +0 -10
- package/dist/src/services/eventCallbacks/plantChanged.js +0 -42
- package/dist/src/services/eventHubActions/toastActions.js +0 -18
- package/dist/src/theme/themeConst.js +0 -75
- package/dist/src/types/extensions.js +0 -10
- package/dist/src/types/legend.js +0 -58
- package/dist/src/types/pingableSources.js +0 -11
- package/dist/src/utils/copyText.js +0 -67
- package/dist/src/utils/eventHandlerUtils.js +0 -11
- package/dist/src/utils/legendUtils.js +0 -168
- package/dist/src/utils/navigationUtils.js +0 -28
- package/dist/src/utils/plantInfo.js +0 -535
- package/dist/src/utils/plantsDataUtils.js +0 -35
- package/dist/src/utils/projectSelectorUtils.js +0 -19
- package/dist/src/utils/startup.js +0 -89
- package/dist/src/utils/taskCache.js +0 -89
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
6
|
-
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
-
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
|
|
11
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
|
|
13
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
14
|
-
|
|
15
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
16
|
-
|
|
17
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
|
-
|
|
19
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
20
|
-
|
|
21
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
22
|
-
|
|
23
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
|
-
|
|
25
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
26
|
-
|
|
27
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
28
|
-
|
|
29
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
30
|
-
|
|
31
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
32
|
-
|
|
33
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
34
|
-
|
|
35
|
-
Object.defineProperty(exports, '__esModule', {
|
|
36
|
-
value: true
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
var HeaderNames = require('./HeaderNames.js');
|
|
40
|
-
|
|
41
|
-
var ILogger = require('./ILogger.js');
|
|
42
|
-
|
|
43
|
-
var ITransport = require('./ITransport.js');
|
|
44
|
-
|
|
45
|
-
var Utils = require('./Utils.js'); // Licensed to the .NET Foundation under one or more agreements.
|
|
46
|
-
|
|
47
|
-
/** @private */
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
var WebSocketTransport = /*#__PURE__*/function () {
|
|
51
|
-
function WebSocketTransport(httpClient, accessTokenFactory, logger, logMessageContent, webSocketConstructor, headers) {
|
|
52
|
-
_classCallCheck(this, WebSocketTransport);
|
|
53
|
-
|
|
54
|
-
this._logger = logger;
|
|
55
|
-
this._accessTokenFactory = accessTokenFactory;
|
|
56
|
-
this._logMessageContent = logMessageContent;
|
|
57
|
-
this._webSocketConstructor = webSocketConstructor;
|
|
58
|
-
this._httpClient = httpClient;
|
|
59
|
-
this.onreceive = null;
|
|
60
|
-
this.onclose = null;
|
|
61
|
-
this._headers = headers;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
_createClass(WebSocketTransport, [{
|
|
65
|
-
key: "connect",
|
|
66
|
-
value: function () {
|
|
67
|
-
var _connect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, transferFormat) {
|
|
68
|
-
var _this = this;
|
|
69
|
-
|
|
70
|
-
var token;
|
|
71
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
72
|
-
while (1) {
|
|
73
|
-
switch (_context.prev = _context.next) {
|
|
74
|
-
case 0:
|
|
75
|
-
Utils.Arg.isRequired(url, "url");
|
|
76
|
-
Utils.Arg.isRequired(transferFormat, "transferFormat");
|
|
77
|
-
Utils.Arg.isIn(transferFormat, ITransport.TransferFormat, "transferFormat");
|
|
78
|
-
|
|
79
|
-
this._logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) Connecting.");
|
|
80
|
-
|
|
81
|
-
if (!this._accessTokenFactory) {
|
|
82
|
-
_context.next = 9;
|
|
83
|
-
break;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
_context.next = 7;
|
|
87
|
-
return this._accessTokenFactory();
|
|
88
|
-
|
|
89
|
-
case 7:
|
|
90
|
-
token = _context.sent;
|
|
91
|
-
|
|
92
|
-
if (token) {
|
|
93
|
-
url += (url.indexOf("?") < 0 ? "?" : "&") + "access_token=".concat(encodeURIComponent(token));
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
case 9:
|
|
97
|
-
return _context.abrupt("return", new Promise(function (resolve, reject) {
|
|
98
|
-
url = url.replace(/^http/, "ws");
|
|
99
|
-
var webSocket;
|
|
100
|
-
|
|
101
|
-
var cookies = _this._httpClient.getCookieString(url);
|
|
102
|
-
|
|
103
|
-
var opened = false;
|
|
104
|
-
|
|
105
|
-
if (Utils.Platform.isNode) {
|
|
106
|
-
var headers = {};
|
|
107
|
-
|
|
108
|
-
var _Utils$getUserAgentHe = Utils.getUserAgentHeader(),
|
|
109
|
-
_Utils$getUserAgentHe2 = _slicedToArray(_Utils$getUserAgentHe, 2),
|
|
110
|
-
name = _Utils$getUserAgentHe2[0],
|
|
111
|
-
value = _Utils$getUserAgentHe2[1];
|
|
112
|
-
|
|
113
|
-
headers[name] = value;
|
|
114
|
-
|
|
115
|
-
if (cookies) {
|
|
116
|
-
headers[HeaderNames.HeaderNames.Cookie] = "".concat(cookies);
|
|
117
|
-
} // Only pass headers when in non-browser environments
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
webSocket = new _this._webSocketConstructor(url, undefined, {
|
|
121
|
-
headers: _objectSpread(_objectSpread({}, headers), _this._headers)
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (!webSocket) {
|
|
126
|
-
// Chrome is not happy with passing 'undefined' as protocol
|
|
127
|
-
webSocket = new _this._webSocketConstructor(url);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (transferFormat === ITransport.TransferFormat.Binary) {
|
|
131
|
-
webSocket.binaryType = "arraybuffer";
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
webSocket.onopen = function (_event) {
|
|
135
|
-
_this._logger.log(ILogger.LogLevel.Information, "WebSocket connected to ".concat(url, "."));
|
|
136
|
-
|
|
137
|
-
_this._webSocket = webSocket;
|
|
138
|
-
opened = true;
|
|
139
|
-
resolve();
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
webSocket.onerror = function (event) {
|
|
143
|
-
var error = null; // ErrorEvent is a browser only type we need to check if the type exists before using it
|
|
144
|
-
|
|
145
|
-
if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) {
|
|
146
|
-
error = event.error;
|
|
147
|
-
} else {
|
|
148
|
-
error = "There was an error with the transport";
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
_this._logger.log(ILogger.LogLevel.Information, "(WebSockets transport) ".concat(error, "."));
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
webSocket.onmessage = function (message) {
|
|
155
|
-
_this._logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) data received. ".concat(Utils.getDataDetail(message.data, _this._logMessageContent), "."));
|
|
156
|
-
|
|
157
|
-
if (_this.onreceive) {
|
|
158
|
-
try {
|
|
159
|
-
_this.onreceive(message.data);
|
|
160
|
-
} catch (error) {
|
|
161
|
-
_this._close(error);
|
|
162
|
-
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
webSocket.onclose = function (event) {
|
|
169
|
-
// Don't call close handler if connection was never established
|
|
170
|
-
// We'll reject the connect call instead
|
|
171
|
-
if (opened) {
|
|
172
|
-
_this._close(event);
|
|
173
|
-
} else {
|
|
174
|
-
var error = null; // ErrorEvent is a browser only type we need to check if the type exists before using it
|
|
175
|
-
|
|
176
|
-
if (typeof ErrorEvent !== "undefined" && event instanceof ErrorEvent) {
|
|
177
|
-
error = event.error;
|
|
178
|
-
} else {
|
|
179
|
-
error = "WebSocket failed to connect. The connection could not be found on the server," + " either the endpoint may not be a SignalR endpoint," + " the connection ID is not present on the server, or there is a proxy blocking WebSockets." + " If you have multiple servers check that sticky sessions are enabled.";
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
reject(new Error(error));
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
}));
|
|
186
|
-
|
|
187
|
-
case 10:
|
|
188
|
-
case "end":
|
|
189
|
-
return _context.stop();
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}, _callee, this);
|
|
193
|
-
}));
|
|
194
|
-
|
|
195
|
-
function connect(_x, _x2) {
|
|
196
|
-
return _connect.apply(this, arguments);
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return connect;
|
|
200
|
-
}()
|
|
201
|
-
}, {
|
|
202
|
-
key: "send",
|
|
203
|
-
value: function send(data) {
|
|
204
|
-
if (this._webSocket && this._webSocket.readyState === this._webSocketConstructor.OPEN) {
|
|
205
|
-
this._logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) sending data. ".concat(Utils.getDataDetail(data, this._logMessageContent), "."));
|
|
206
|
-
|
|
207
|
-
this._webSocket.send(data);
|
|
208
|
-
|
|
209
|
-
return Promise.resolve();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return Promise.reject("WebSocket is not in the OPEN state");
|
|
213
|
-
}
|
|
214
|
-
}, {
|
|
215
|
-
key: "stop",
|
|
216
|
-
value: function stop() {
|
|
217
|
-
if (this._webSocket) {
|
|
218
|
-
// Manually invoke onclose callback inline so we know the HttpConnection was closed properly before returning
|
|
219
|
-
// This also solves an issue where websocket.onclose could take 18+ seconds to trigger during network disconnects
|
|
220
|
-
this._close(undefined);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
return Promise.resolve();
|
|
224
|
-
}
|
|
225
|
-
}, {
|
|
226
|
-
key: "_close",
|
|
227
|
-
value: function _close(event) {
|
|
228
|
-
// webSocket will be null if the transport did not start successfully
|
|
229
|
-
if (this._webSocket) {
|
|
230
|
-
// Clear websocket handlers because we are considering the socket closed now
|
|
231
|
-
this._webSocket.onclose = function () {};
|
|
232
|
-
|
|
233
|
-
this._webSocket.onmessage = function () {};
|
|
234
|
-
|
|
235
|
-
this._webSocket.onerror = function () {};
|
|
236
|
-
|
|
237
|
-
this._webSocket.close();
|
|
238
|
-
|
|
239
|
-
this._webSocket = undefined;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
this._logger.log(ILogger.LogLevel.Trace, "(WebSockets transport) socket closed.");
|
|
243
|
-
|
|
244
|
-
if (this.onclose) {
|
|
245
|
-
if (this._isCloseEvent(event) && (event.wasClean === false || event.code !== 1000)) {
|
|
246
|
-
this.onclose(new Error("WebSocket closed with status code: ".concat(event.code, " (").concat(event.reason || "no reason given", ").")));
|
|
247
|
-
} else if (event instanceof Error) {
|
|
248
|
-
this.onclose(event);
|
|
249
|
-
} else {
|
|
250
|
-
this.onclose();
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}, {
|
|
255
|
-
key: "_isCloseEvent",
|
|
256
|
-
value: function _isCloseEvent(event) {
|
|
257
|
-
return event && typeof event.wasClean === "boolean" && typeof event.code === "number";
|
|
258
|
-
}
|
|
259
|
-
}]);
|
|
260
|
-
|
|
261
|
-
return WebSocketTransport;
|
|
262
|
-
}();
|
|
263
|
-
|
|
264
|
-
exports.WebSocketTransport = WebSocketTransport;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
|
-
|
|
7
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
8
|
-
|
|
9
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
10
|
-
|
|
11
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12
|
-
|
|
13
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
-
|
|
15
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
-
|
|
17
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
-
|
|
19
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
-
|
|
21
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
|
-
|
|
23
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
-
|
|
25
|
-
Object.defineProperty(exports, '__esModule', {
|
|
26
|
-
value: true
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
var Errors = require('./Errors.js');
|
|
30
|
-
|
|
31
|
-
var HttpClient = require('./HttpClient.js');
|
|
32
|
-
|
|
33
|
-
var ILogger = require('./ILogger.js'); // Licensed to the .NET Foundation under one or more agreements.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
var XhrHttpClient = /*#__PURE__*/function (_HttpClient$HttpClien) {
|
|
37
|
-
_inherits(XhrHttpClient, _HttpClient$HttpClien);
|
|
38
|
-
|
|
39
|
-
var _super = _createSuper(XhrHttpClient);
|
|
40
|
-
|
|
41
|
-
function XhrHttpClient(logger) {
|
|
42
|
-
var _this;
|
|
43
|
-
|
|
44
|
-
_classCallCheck(this, XhrHttpClient);
|
|
45
|
-
|
|
46
|
-
_this = _super.call(this);
|
|
47
|
-
_this._logger = logger;
|
|
48
|
-
return _this;
|
|
49
|
-
}
|
|
50
|
-
/** @inheritDoc */
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_createClass(XhrHttpClient, [{
|
|
54
|
-
key: "send",
|
|
55
|
-
value: function send(request) {
|
|
56
|
-
var _this2 = this;
|
|
57
|
-
|
|
58
|
-
// Check that abort was not signaled before calling send
|
|
59
|
-
if (request.abortSignal && request.abortSignal.aborted) {
|
|
60
|
-
return Promise.reject(new Errors.AbortError());
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (!request.method) {
|
|
64
|
-
return Promise.reject(new Error("No method defined."));
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (!request.url) {
|
|
68
|
-
return Promise.reject(new Error("No url defined."));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return new Promise(function (resolve, reject) {
|
|
72
|
-
var xhr = new XMLHttpRequest();
|
|
73
|
-
xhr.open(request.method, request.url, true);
|
|
74
|
-
xhr.withCredentials = request.withCredentials === undefined ? true : request.withCredentials;
|
|
75
|
-
xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); // Explicitly setting the Content-Type header for React Native on Android platform.
|
|
76
|
-
|
|
77
|
-
xhr.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");
|
|
78
|
-
var headers = request.headers;
|
|
79
|
-
|
|
80
|
-
if (headers) {
|
|
81
|
-
Object.keys(headers).forEach(function (header) {
|
|
82
|
-
xhr.setRequestHeader(header, headers[header]);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (request.responseType) {
|
|
87
|
-
xhr.responseType = request.responseType;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (request.abortSignal) {
|
|
91
|
-
request.abortSignal.onabort = function () {
|
|
92
|
-
xhr.abort();
|
|
93
|
-
reject(new Errors.AbortError());
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (request.timeout) {
|
|
98
|
-
xhr.timeout = request.timeout;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
xhr.onload = function () {
|
|
102
|
-
if (request.abortSignal) {
|
|
103
|
-
request.abortSignal.onabort = null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (xhr.status >= 200 && xhr.status < 300) {
|
|
107
|
-
resolve(new HttpClient.HttpResponse(xhr.status, xhr.statusText, xhr.response || xhr.responseText));
|
|
108
|
-
} else {
|
|
109
|
-
reject(new Errors.HttpError(xhr.response || xhr.responseText || xhr.statusText, xhr.status));
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
xhr.onerror = function () {
|
|
114
|
-
_this2._logger.log(ILogger.LogLevel.Warning, "Error from HTTP request. ".concat(xhr.status, ": ").concat(xhr.statusText, "."));
|
|
115
|
-
|
|
116
|
-
reject(new Errors.HttpError(xhr.statusText, xhr.status));
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
xhr.ontimeout = function () {
|
|
120
|
-
_this2._logger.log(ILogger.LogLevel.Warning, "Timeout from HTTP request.");
|
|
121
|
-
|
|
122
|
-
reject(new Errors.TimeoutError());
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
xhr.send(request.content || "");
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}]);
|
|
129
|
-
|
|
130
|
-
return XhrHttpClient;
|
|
131
|
-
}(HttpClient.HttpClient);
|
|
132
|
-
|
|
133
|
-
exports.XhrHttpClient = XhrHttpClient;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, '__esModule', {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
var index = require('../../_virtual/index.js');
|
|
10
|
-
/*!
|
|
11
|
-
Copyright (c) 2018 Jed Watson.
|
|
12
|
-
Licensed under the MIT License (MIT), see
|
|
13
|
-
http://jedwatson.github.io/classnames
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
(function (module) {
|
|
18
|
-
/* global define */
|
|
19
|
-
(function () {
|
|
20
|
-
var hasOwn = {}.hasOwnProperty;
|
|
21
|
-
|
|
22
|
-
function classNames() {
|
|
23
|
-
var classes = [];
|
|
24
|
-
|
|
25
|
-
for (var i = 0; i < arguments.length; i++) {
|
|
26
|
-
var arg = arguments[i];
|
|
27
|
-
if (!arg) continue;
|
|
28
|
-
|
|
29
|
-
var argType = _typeof(arg);
|
|
30
|
-
|
|
31
|
-
if (argType === 'string' || argType === 'number') {
|
|
32
|
-
classes.push(arg);
|
|
33
|
-
} else if (Array.isArray(arg)) {
|
|
34
|
-
if (arg.length) {
|
|
35
|
-
var inner = classNames.apply(null, arg);
|
|
36
|
-
|
|
37
|
-
if (inner) {
|
|
38
|
-
classes.push(inner);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
} else if (argType === 'object') {
|
|
42
|
-
if (arg.toString === Object.prototype.toString) {
|
|
43
|
-
for (var key in arg) {
|
|
44
|
-
if (hasOwn.call(arg, key) && arg[key]) {
|
|
45
|
-
classes.push(key);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
} else {
|
|
49
|
-
classes.push(arg.toString());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return classes.join(' ');
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
if (module.exports) {
|
|
58
|
-
classNames["default"] = classNames;
|
|
59
|
-
module.exports = classNames;
|
|
60
|
-
} else {
|
|
61
|
-
window.classNames = classNames;
|
|
62
|
-
}
|
|
63
|
-
})();
|
|
64
|
-
})(index.classnames);
|
|
65
|
-
|
|
66
|
-
var classNames = index.classnames.exports;
|
|
67
|
-
exports["default"] = classNames;
|