{"version":3,"sources":["webpack:///./node_modules/@microsoft/signalr/dist/esm/ILogger.js","webpack:///./node_modules/@microsoft/signalr/dist/esm/HubConnection.js","webpack:///./node_modules/@microsoft/signalr/dist/esm/ITransport.js","webpack:///./node_modules/@microsoft/signalr/dist/esm/HubConnectionBuilder.js","webpack:///./node_modules/@microsoft/signalr/dist/esm/JsonHubProtocol.js","webpack:///./node_modules/@microsoft/signalr/dist/esm/IHubProtocol.js"],"names":["LogLevel","HubConnectionState","__awaiter","thisArg","_arguments","P","generator","Promise","resolve","reject","fulfilled","value","step","next","e","rejected","result","done","then","apply","__generator","body","f","y","t","g","_","label","sent","trys","ops","verb","Symbol","iterator","this","n","v","op","TypeError","call","pop","length","push","DEFAULT_TIMEOUT_IN_MS","DEFAULT_PING_INTERVAL_IN_MS","HubConnection","connection","logger","protocol","reconnectPolicy","_this","nextKeepAlive","isRequired","serverTimeoutInMilliseconds","keepAliveIntervalInMilliseconds","handshakeProtocol","onreceive","data","processIncomingData","onclose","error","connectionClosed","callbacks","methods","closedCallbacks","reconnectingCallbacks","reconnectedCallbacks","invocationId","receivedHandshakeResponse","connectionState","Disconnected","connectionStarted","cachedPingMessage","writeMessage","type","Ping","create","Object","defineProperty","prototype","get","enumerable","configurable","connectionId","baseUrl","set","url","Reconnecting","Error","start","startPromise","startWithStateTransitions","e_1","_a","Connecting","log","Debug","startInternal","Connected","handshakePromise","handshakeRequest","e_2","stopDuringStartError","undefined","handshakeResolver","handshakeRejecter","transferFormat","name","version","sendMessage","writeHandshakeRequest","Information","cleanupTimeout","resetTimeoutPeriod","resetKeepAliveInterval","cleanupPingTimer","stop","stopPromise","stopInternal","Disconnecting","reconnectDelayHandle","clearTimeout","completeClose","stream","methodName","args","_i","arguments","promiseQueue","replaceStreamingParams","streams","streamIds","invocationDescriptor","createStreamInvocation","subject","cancelCallback","cancelInvocation","createCancelInvocation","sendWithProtocol","invocationEvent","Completion","complete","catch","launchStreams","message","send","sendPromise","createInvocation","invoke","p","on","newMethod","toLowerCase","indexOf","off","method","handlers","removeIdx","splice","callback","onreconnecting","onreconnected","processHandshakeResponse","messages","parseMessages","messages_1","Invocation","invokeClientMethod","StreamItem","Close","allowReconnect","Warning","responseMessage","remainingData","parseHandshakeResponse","features","inherentKeepAlive","Date","getTime","timeoutHandle","setTimeout","serverTimeout","pingServerHandle","nextPing","_b","invocationMessage","target","forEach","m","cancelCallbacksWithError","reconnect","c","reconnectStartTime","previousReconnectAttempts","retryError","nextRetryDelay","e_4","now","getNextRetryDelay","toString","previousRetryCount","elapsedMilliseconds","retryReason","nextRetryDelayInMilliseconds","keys","key","nonblocking","_loop_1","streamId","subscribe","createCompletionMessage","err","item","createStreamItemMessage","i","argument","isObservable","arg","StreamInvocation","id","CancelInvocation","HttpTransportType","TransferFormat","__assign","assign","s","hasOwnProperty","LogLevelNameMapping","trace","Trace","debug","info","information","warn","warning","critical","Critical","none","None","parseLogLevel","mapping","HubConnectionBuilder","configureLogging","logging","isLogger","logLevel","withUrl","transportTypeOrOptions","isNotEmpty","httpConnectionOptions","transport","withHubProtocol","withAutomaticReconnect","retryDelaysOrReconnectPolicy","Array","isArray","build","instance","JSON_HUB_PROTOCOL_NAME","JsonHubProtocol","Text","input","parse","hubMessages","parsedMessage","JSON","isInvocationMessage","isStreamItemMessage","isCompletionMessage","write","stringify","assertNotEmptyString","errorMessage","MessageType"],"mappings":"0HAOO,IAAIA,EAPX,kCAQA,SAAWA,GAEPA,EAASA,EAAS,SAAW,GAAK,QAElCA,EAASA,EAAS,SAAW,GAAK,QAElCA,EAASA,EAAS,eAAiB,GAAK,cAExCA,EAASA,EAAS,WAAa,GAAK,UAEpCA,EAASA,EAAS,SAAW,GAAK,QAElCA,EAASA,EAAS,YAAc,GAAK,WAErCA,EAASA,EAAS,QAAU,GAAK,OAdrC,CAeGA,IAAaA,EAAW,M,oCCvB3B,wEA6CWC,EA7CX,4DAEIC,EAAwC,SAAUC,EAASC,EAAYC,EAAGC,GAC1E,OAAO,IAAKD,IAA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qB/H,EAAQ7E,aAAc,4CAEpDgM,EAAgBpL,UAAUgM,qBAAuB,SAAUpQ,EAAOqQ,GAC9D,GAAqB,kBAAVrQ,GAAgC,KAAVA,EAC7B,MAAM,IAAI6E,MAAMwL,IAGjBb,EA7FyB,I,kCCN7B,IAAIc,EAHX,kCAIA,SAAWA,GAEPA,EAAYA,EAAY,cAAgB,GAAK,aAE7CA,EAAYA,EAAY,cAAgB,GAAK,aAE7CA,EAAYA,EAAY,cAAgB,GAAK,aAE7CA,EAAYA,EAAY,oBAAsB,GAAK,mBAEnDA,EAAYA,EAAY,oBAAsB,GAAK,mBAEnDA,EAAYA,EAAY,QAAU,GAAK,OAEvCA,EAAYA,EAAY,SAAW,GAAK,QAd5C,CAeGA,IAAgBA,EAAc","file":"js/chunk-vendors~d2f2c4f9.9ea89a68.js","sourcesContent":["// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.\r\n/** Indicates the severity of a log message.\r\n *\r\n * Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.\r\n */\r\nexport var LogLevel;\r\n(function (LogLevel) {\r\n /** Log level for very low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Trace\"] = 0] = \"Trace\";\r\n /** Log level for low severity diagnostic messages. */\r\n LogLevel[LogLevel[\"Debug\"] = 1] = \"Debug\";\r\n /** Log level for informational diagnostic messages. */\r\n LogLevel[LogLevel[\"Information\"] = 2] = \"Information\";\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n LogLevel[LogLevel[\"Warning\"] = 3] = \"Warning\";\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n LogLevel[LogLevel[\"Error\"] = 4] = \"Error\";\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n LogLevel[LogLevel[\"Critical\"] = 5] = \"Critical\";\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n LogLevel[LogLevel[\"None\"] = 6] = \"None\";\r\n})(LogLevel || (LogLevel = {}));\r\n//# sourceMappingURL=ILogger.js.map","// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n};\r\nvar __generator = (this && this.__generator) || function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n};\r\nimport { HandshakeProtocol } from \"./HandshakeProtocol\";\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { Subject } from \"./Subject\";\r\nimport { Arg } from \"./Utils\";\r\nvar DEFAULT_TIMEOUT_IN_MS = 30 * 1000;\r\nvar DEFAULT_PING_INTERVAL_IN_MS = 15 * 1000;\r\n/** Describes the current state of the {@link HubConnection} to the server. */\r\nexport var HubConnectionState;\r\n(function (HubConnectionState) {\r\n /** The hub connection is disconnected. */\r\n HubConnectionState[\"Disconnected\"] = \"Disconnected\";\r\n /** The hub connection is connecting. */\r\n HubConnectionState[\"Connecting\"] = \"Connecting\";\r\n /** The hub connection is connected. */\r\n HubConnectionState[\"Connected\"] = \"Connected\";\r\n /** The hub connection is disconnecting. */\r\n HubConnectionState[\"Disconnecting\"] = \"Disconnecting\";\r\n /** The hub connection is reconnecting. */\r\n HubConnectionState[\"Reconnecting\"] = \"Reconnecting\";\r\n})(HubConnectionState || (HubConnectionState = {}));\r\n/** Represents a connection to a SignalR Hub. */\r\nvar HubConnection = /** @class */ (function () {\r\n function HubConnection(connection, logger, protocol, reconnectPolicy) {\r\n var _this = this;\r\n this.nextKeepAlive = 0;\r\n Arg.isRequired(connection, \"connection\");\r\n Arg.isRequired(logger, \"logger\");\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;\r\n this.keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;\r\n this.logger = logger;\r\n this.protocol = protocol;\r\n this.connection = connection;\r\n this.reconnectPolicy = reconnectPolicy;\r\n this.handshakeProtocol = new HandshakeProtocol();\r\n this.connection.onreceive = function (data) { return _this.processIncomingData(data); };\r\n this.connection.onclose = function (error) { return _this.connectionClosed(error); };\r\n this.callbacks = {};\r\n this.methods = {};\r\n this.closedCallbacks = [];\r\n this.reconnectingCallbacks = [];\r\n this.reconnectedCallbacks = [];\r\n this.invocationId = 0;\r\n this.receivedHandshakeResponse = false;\r\n this.connectionState = HubConnectionState.Disconnected;\r\n this.connectionStarted = false;\r\n this.cachedPingMessage = this.protocol.writeMessage({ type: MessageType.Ping });\r\n }\r\n /** @internal */\r\n // Using a public static factory method means we can have a private constructor and an _internal_\r\n // create method that can be used by HubConnectionBuilder. An \"internal\" constructor would just\r\n // be stripped away and the '.d.ts' file would have no constructor, which is interpreted as a\r\n // public parameter-less constructor.\r\n HubConnection.create = function (connection, logger, protocol, reconnectPolicy) {\r\n return new HubConnection(connection, logger, protocol, reconnectPolicy);\r\n };\r\n Object.defineProperty(HubConnection.prototype, \"state\", {\r\n /** Indicates the state of the {@link HubConnection} to the server. */\r\n get: function () {\r\n return this.connectionState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HubConnection.prototype, \"connectionId\", {\r\n /** Represents the connection id of the {@link HubConnection} on the server. The connection id will be null when the connection is either\r\n * in the disconnected state or if the negotiation step was skipped.\r\n */\r\n get: function () {\r\n return this.connection ? (this.connection.connectionId || null) : null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(HubConnection.prototype, \"baseUrl\", {\r\n /** Indicates the url of the {@link HubConnection} to the server. */\r\n get: function () {\r\n return this.connection.baseUrl || \"\";\r\n },\r\n /**\r\n * Sets a new url for the HubConnection. Note that the url can only be changed when the connection is in either the Disconnected or\r\n * Reconnecting states.\r\n * @param {string} url The url to connect to.\r\n */\r\n set: function (url) {\r\n if (this.connectionState !== HubConnectionState.Disconnected && this.connectionState !== HubConnectionState.Reconnecting) {\r\n throw new Error(\"The HubConnection must be in the Disconnected or Reconnecting state to change the url.\");\r\n }\r\n if (!url) {\r\n throw new Error(\"The HubConnection url must be a valid url.\");\r\n }\r\n this.connection.baseUrl = url;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Starts the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully established, or rejects with an error.\r\n */\r\n HubConnection.prototype.start = function () {\r\n this.startPromise = this.startWithStateTransitions();\r\n return this.startPromise;\r\n };\r\n HubConnection.prototype.startWithStateTransitions = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var e_1;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n if (this.connectionState !== HubConnectionState.Disconnected) {\r\n return [2 /*return*/, Promise.reject(new Error(\"Cannot start a HubConnection that is not in the 'Disconnected' state.\"))];\r\n }\r\n this.connectionState = HubConnectionState.Connecting;\r\n this.logger.log(LogLevel.Debug, \"Starting HubConnection.\");\r\n _a.label = 1;\r\n case 1:\r\n _a.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.startInternal()];\r\n case 2:\r\n _a.sent();\r\n this.connectionState = HubConnectionState.Connected;\r\n this.connectionStarted = true;\r\n this.logger.log(LogLevel.Debug, \"HubConnection connected successfully.\");\r\n return [3 /*break*/, 4];\r\n case 3:\r\n e_1 = _a.sent();\r\n this.connectionState = HubConnectionState.Disconnected;\r\n this.logger.log(LogLevel.Debug, \"HubConnection failed to start successfully because of error '\" + e_1 + \"'.\");\r\n return [2 /*return*/, Promise.reject(e_1)];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n HubConnection.prototype.startInternal = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var handshakePromise, handshakeRequest, e_2;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n this.stopDuringStartError = undefined;\r\n this.receivedHandshakeResponse = false;\r\n handshakePromise = new Promise(function (resolve, reject) {\r\n _this.handshakeResolver = resolve;\r\n _this.handshakeRejecter = reject;\r\n });\r\n return [4 /*yield*/, this.connection.start(this.protocol.transferFormat)];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 5, , 7]);\r\n handshakeRequest = {\r\n protocol: this.protocol.name,\r\n version: this.protocol.version,\r\n };\r\n this.logger.log(LogLevel.Debug, \"Sending handshake request.\");\r\n return [4 /*yield*/, this.sendMessage(this.handshakeProtocol.writeHandshakeRequest(handshakeRequest))];\r\n case 3:\r\n _a.sent();\r\n this.logger.log(LogLevel.Information, \"Using HubProtocol '\" + this.protocol.name + \"'.\");\r\n // defensively cleanup timeout in case we receive a message from the server before we finish start\r\n this.cleanupTimeout();\r\n this.resetTimeoutPeriod();\r\n this.resetKeepAliveInterval();\r\n return [4 /*yield*/, handshakePromise];\r\n case 4:\r\n _a.sent();\r\n // It's important to check the stopDuringStartError instead of just relying on the handshakePromise\r\n // being rejected on close, because this continuation can run after both the handshake completed successfully\r\n // and the connection was closed.\r\n if (this.stopDuringStartError) {\r\n // It's important to throw instead of returning a rejected promise, because we don't want to allow any state\r\n // transitions to occur between now and the calling code observing the exceptions. Returning a rejected promise\r\n // will cause the calling continuation to get scheduled to run later.\r\n throw this.stopDuringStartError;\r\n }\r\n return [3 /*break*/, 7];\r\n case 5:\r\n e_2 = _a.sent();\r\n this.logger.log(LogLevel.Debug, \"Hub handshake failed with error '\" + e_2 + \"' during start(). Stopping HubConnection.\");\r\n this.cleanupTimeout();\r\n this.cleanupPingTimer();\r\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\r\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\r\n return [4 /*yield*/, this.connection.stop(e_2)];\r\n case 6:\r\n // HttpConnection.stop() should not complete until after the onclose callback is invoked.\r\n // This will transition the HubConnection to the disconnected state before HttpConnection.stop() completes.\r\n _a.sent();\r\n throw e_2;\r\n case 7: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n /** Stops the connection.\r\n *\r\n * @returns {Promise} A Promise that resolves when the connection has been successfully terminated, or rejects with an error.\r\n */\r\n HubConnection.prototype.stop = function () {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var startPromise, e_3;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n startPromise = this.startPromise;\r\n this.stopPromise = this.stopInternal();\r\n return [4 /*yield*/, this.stopPromise];\r\n case 1:\r\n _a.sent();\r\n _a.label = 2;\r\n case 2:\r\n _a.trys.push([2, 4, , 5]);\r\n // Awaiting undefined continues immediately\r\n return [4 /*yield*/, startPromise];\r\n case 3:\r\n // Awaiting undefined continues immediately\r\n _a.sent();\r\n return [3 /*break*/, 5];\r\n case 4:\r\n e_3 = _a.sent();\r\n return [3 /*break*/, 5];\r\n case 5: return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n HubConnection.prototype.stopInternal = function (error) {\r\n if (this.connectionState === HubConnectionState.Disconnected) {\r\n this.logger.log(LogLevel.Debug, \"Call to HubConnection.stop(\" + error + \") ignored because it is already in the disconnected state.\");\r\n return Promise.resolve();\r\n }\r\n if (this.connectionState === HubConnectionState.Disconnecting) {\r\n this.logger.log(LogLevel.Debug, \"Call to HttpConnection.stop(\" + error + \") ignored because the connection is already in the disconnecting state.\");\r\n return this.stopPromise;\r\n }\r\n this.connectionState = HubConnectionState.Disconnecting;\r\n this.logger.log(LogLevel.Debug, \"Stopping HubConnection.\");\r\n if (this.reconnectDelayHandle) {\r\n // We're in a reconnect delay which means the underlying connection is currently already stopped.\r\n // Just clear the handle to stop the reconnect loop (which no one is waiting on thankfully) and\r\n // fire the onclose callbacks.\r\n this.logger.log(LogLevel.Debug, \"Connection stopped during reconnect delay. Done reconnecting.\");\r\n clearTimeout(this.reconnectDelayHandle);\r\n this.reconnectDelayHandle = undefined;\r\n this.completeClose();\r\n return Promise.resolve();\r\n }\r\n this.cleanupTimeout();\r\n this.cleanupPingTimer();\r\n this.stopDuringStartError = error || new Error(\"The connection was stopped before the hub handshake could complete.\");\r\n // HttpConnection.stop() should not complete until after either HttpConnection.start() fails\r\n // or the onclose callback is invoked. The onclose callback will transition the HubConnection\r\n // to the disconnected state if need be before HttpConnection.stop() completes.\r\n return this.connection.stop(error);\r\n };\r\n /** Invokes a streaming hub method on the server using the specified name and arguments.\r\n *\r\n * @typeparam T The type of the items returned by the server.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {IStreamResult} An object that yields results from the server as they are received.\r\n */\r\n HubConnection.prototype.stream = function (methodName) {\r\n var _this = this;\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1];\r\n var invocationDescriptor = this.createStreamInvocation(methodName, args, streamIds);\r\n var promiseQueue;\r\n var subject = new Subject();\r\n subject.cancelCallback = function () {\r\n var cancelInvocation = _this.createCancelInvocation(invocationDescriptor.invocationId);\r\n delete _this.callbacks[invocationDescriptor.invocationId];\r\n return promiseQueue.then(function () {\r\n return _this.sendWithProtocol(cancelInvocation);\r\n });\r\n };\r\n this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {\r\n if (error) {\r\n subject.error(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n subject.error(new Error(invocationEvent.error));\r\n }\r\n else {\r\n subject.complete();\r\n }\r\n }\r\n else {\r\n subject.next((invocationEvent.item));\r\n }\r\n }\r\n };\r\n promiseQueue = this.sendWithProtocol(invocationDescriptor)\r\n .catch(function (e) {\r\n subject.error(e);\r\n delete _this.callbacks[invocationDescriptor.invocationId];\r\n });\r\n this.launchStreams(streams, promiseQueue);\r\n return subject;\r\n };\r\n HubConnection.prototype.sendMessage = function (message) {\r\n this.resetKeepAliveInterval();\r\n return this.connection.send(message);\r\n };\r\n /**\r\n * Sends a js object to the server.\r\n * @param message The js object to serialize and send.\r\n */\r\n HubConnection.prototype.sendWithProtocol = function (message) {\r\n return this.sendMessage(this.protocol.writeMessage(message));\r\n };\r\n /** Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.\r\n *\r\n * The Promise returned by this method resolves when the client has sent the invocation to the server. The server may still\r\n * be processing the invocation.\r\n *\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves when the invocation has been successfully sent, or rejects with an error.\r\n */\r\n HubConnection.prototype.send = function (methodName) {\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1];\r\n var sendPromise = this.sendWithProtocol(this.createInvocation(methodName, args, true, streamIds));\r\n this.launchStreams(streams, sendPromise);\r\n return sendPromise;\r\n };\r\n /** Invokes a hub method on the server using the specified name and arguments.\r\n *\r\n * The Promise returned by this method resolves when the server indicates it has finished invoking the method. When the promise\r\n * resolves, the server has finished invoking the method. If the server method returns a result, it is produced as the result of\r\n * resolving the Promise.\r\n *\r\n * @typeparam T The expected return type.\r\n * @param {string} methodName The name of the server method to invoke.\r\n * @param {any[]} args The arguments used to invoke the server method.\r\n * @returns {Promise} A Promise that resolves with the result of the server method (if any), or rejects with an error.\r\n */\r\n HubConnection.prototype.invoke = function (methodName) {\r\n var _this = this;\r\n var args = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n args[_i - 1] = arguments[_i];\r\n }\r\n var _a = this.replaceStreamingParams(args), streams = _a[0], streamIds = _a[1];\r\n var invocationDescriptor = this.createInvocation(methodName, args, false, streamIds);\r\n var p = new Promise(function (resolve, reject) {\r\n // invocationId will always have a value for a non-blocking invocation\r\n _this.callbacks[invocationDescriptor.invocationId] = function (invocationEvent, error) {\r\n if (error) {\r\n reject(error);\r\n return;\r\n }\r\n else if (invocationEvent) {\r\n // invocationEvent will not be null when an error is not passed to the callback\r\n if (invocationEvent.type === MessageType.Completion) {\r\n if (invocationEvent.error) {\r\n reject(new Error(invocationEvent.error));\r\n }\r\n else {\r\n resolve(invocationEvent.result);\r\n }\r\n }\r\n else {\r\n reject(new Error(\"Unexpected message type: \" + invocationEvent.type));\r\n }\r\n }\r\n };\r\n var promiseQueue = _this.sendWithProtocol(invocationDescriptor)\r\n .catch(function (e) {\r\n reject(e);\r\n // invocationId will always have a value for a non-blocking invocation\r\n delete _this.callbacks[invocationDescriptor.invocationId];\r\n });\r\n _this.launchStreams(streams, promiseQueue);\r\n });\r\n return p;\r\n };\r\n /** Registers a handler that will be invoked when the hub method with the specified method name is invoked.\r\n *\r\n * @param {string} methodName The name of the hub method to define.\r\n * @param {Function} newMethod The handler that will be raised when the hub method is invoked.\r\n */\r\n HubConnection.prototype.on = function (methodName, newMethod) {\r\n if (!methodName || !newMethod) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n if (!this.methods[methodName]) {\r\n this.methods[methodName] = [];\r\n }\r\n // Preventing adding the same handler multiple times.\r\n if (this.methods[methodName].indexOf(newMethod) !== -1) {\r\n return;\r\n }\r\n this.methods[methodName].push(newMethod);\r\n };\r\n HubConnection.prototype.off = function (methodName, method) {\r\n if (!methodName) {\r\n return;\r\n }\r\n methodName = methodName.toLowerCase();\r\n var handlers = this.methods[methodName];\r\n if (!handlers) {\r\n return;\r\n }\r\n if (method) {\r\n var removeIdx = handlers.indexOf(method);\r\n if (removeIdx !== -1) {\r\n handlers.splice(removeIdx, 1);\r\n if (handlers.length === 0) {\r\n delete this.methods[methodName];\r\n }\r\n }\r\n }\r\n else {\r\n delete this.methods[methodName];\r\n }\r\n };\r\n /** Registers a handler that will be invoked when the connection is closed.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection is closed. Optionally receives a single argument containing the error that caused the connection to close (if any).\r\n */\r\n HubConnection.prototype.onclose = function (callback) {\r\n if (callback) {\r\n this.closedCallbacks.push(callback);\r\n }\r\n };\r\n /** Registers a handler that will be invoked when the connection starts reconnecting.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection starts reconnecting. Optionally receives a single argument containing the error that caused the connection to start reconnecting (if any).\r\n */\r\n HubConnection.prototype.onreconnecting = function (callback) {\r\n if (callback) {\r\n this.reconnectingCallbacks.push(callback);\r\n }\r\n };\r\n /** Registers a handler that will be invoked when the connection successfully reconnects.\r\n *\r\n * @param {Function} callback The handler that will be invoked when the connection successfully reconnects.\r\n */\r\n HubConnection.prototype.onreconnected = function (callback) {\r\n if (callback) {\r\n this.reconnectedCallbacks.push(callback);\r\n }\r\n };\r\n HubConnection.prototype.processIncomingData = function (data) {\r\n this.cleanupTimeout();\r\n if (!this.receivedHandshakeResponse) {\r\n data = this.processHandshakeResponse(data);\r\n this.receivedHandshakeResponse = true;\r\n }\r\n // Data may have all been read when processing handshake response\r\n if (data) {\r\n // Parse the messages\r\n var messages = this.protocol.parseMessages(data, this.logger);\r\n for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) {\r\n var message = messages_1[_i];\r\n switch (message.type) {\r\n case MessageType.Invocation:\r\n this.invokeClientMethod(message);\r\n break;\r\n case MessageType.StreamItem:\r\n case MessageType.Completion:\r\n var callback = this.callbacks[message.invocationId];\r\n if (callback) {\r\n if (message.type === MessageType.Completion) {\r\n delete this.callbacks[message.invocationId];\r\n }\r\n callback(message);\r\n }\r\n break;\r\n case MessageType.Ping:\r\n // Don't care about pings\r\n break;\r\n case MessageType.Close:\r\n this.logger.log(LogLevel.Information, \"Close message received from server.\");\r\n var error = message.error ? new Error(\"Server returned an error on close: \" + message.error) : undefined;\r\n if (message.allowReconnect === true) {\r\n // It feels wrong not to await connection.stop() here, but processIncomingData is called as part of an onreceive callback which is not async,\r\n // this is already the behavior for serverTimeout(), and HttpConnection.Stop() should catch and log all possible exceptions.\r\n // tslint:disable-next-line:no-floating-promises\r\n this.connection.stop(error);\r\n }\r\n else {\r\n // We cannot await stopInternal() here, but subsequent calls to stop() will await this if stopInternal() is still ongoing.\r\n this.stopPromise = this.stopInternal(error);\r\n }\r\n break;\r\n default:\r\n this.logger.log(LogLevel.Warning, \"Invalid message type: \" + message.type + \".\");\r\n break;\r\n }\r\n }\r\n }\r\n this.resetTimeoutPeriod();\r\n };\r\n HubConnection.prototype.processHandshakeResponse = function (data) {\r\n var _a;\r\n var responseMessage;\r\n var remainingData;\r\n try {\r\n _a = this.handshakeProtocol.parseHandshakeResponse(data), remainingData = _a[0], responseMessage = _a[1];\r\n }\r\n catch (e) {\r\n var message = \"Error parsing handshake response: \" + e;\r\n this.logger.log(LogLevel.Error, message);\r\n var error = new Error(message);\r\n this.handshakeRejecter(error);\r\n throw error;\r\n }\r\n if (responseMessage.error) {\r\n var message = \"Server returned handshake error: \" + responseMessage.error;\r\n this.logger.log(LogLevel.Error, message);\r\n var error = new Error(message);\r\n this.handshakeRejecter(error);\r\n throw error;\r\n }\r\n else {\r\n this.logger.log(LogLevel.Debug, \"Server handshake complete.\");\r\n }\r\n this.handshakeResolver();\r\n return remainingData;\r\n };\r\n HubConnection.prototype.resetKeepAliveInterval = function () {\r\n if (this.connection.features.inherentKeepAlive) {\r\n return;\r\n }\r\n // Set the time we want the next keep alive to be sent\r\n // Timer will be setup on next message receive\r\n this.nextKeepAlive = new Date().getTime() + this.keepAliveIntervalInMilliseconds;\r\n this.cleanupPingTimer();\r\n };\r\n HubConnection.prototype.resetTimeoutPeriod = function () {\r\n var _this = this;\r\n if (!this.connection.features || !this.connection.features.inherentKeepAlive) {\r\n // Set the timeout timer\r\n this.timeoutHandle = setTimeout(function () { return _this.serverTimeout(); }, this.serverTimeoutInMilliseconds);\r\n // Set keepAlive timer if there isn't one\r\n if (this.pingServerHandle === undefined) {\r\n var nextPing = this.nextKeepAlive - new Date().getTime();\r\n if (nextPing < 0) {\r\n nextPing = 0;\r\n }\r\n // The timer needs to be set from a networking callback to avoid Chrome timer throttling from causing timers to run once a minute\r\n this.pingServerHandle = setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {\r\n var _a;\r\n return __generator(this, function (_b) {\r\n switch (_b.label) {\r\n case 0:\r\n if (!(this.connectionState === HubConnectionState.Connected)) return [3 /*break*/, 4];\r\n _b.label = 1;\r\n case 1:\r\n _b.trys.push([1, 3, , 4]);\r\n return [4 /*yield*/, this.sendMessage(this.cachedPingMessage)];\r\n case 2:\r\n _b.sent();\r\n return [3 /*break*/, 4];\r\n case 3:\r\n _a = _b.sent();\r\n // We don't care about the error. It should be seen elsewhere in the client.\r\n // The connection is probably in a bad or closed state now, cleanup the timer so it stops triggering\r\n this.cleanupPingTimer();\r\n return [3 /*break*/, 4];\r\n case 4: return [2 /*return*/];\r\n }\r\n });\r\n }); }, nextPing);\r\n }\r\n }\r\n };\r\n HubConnection.prototype.serverTimeout = function () {\r\n // The server hasn't talked to us in a while. It doesn't like us anymore ... :(\r\n // Terminate the connection, but we don't need to wait on the promise. This could trigger reconnecting.\r\n // tslint:disable-next-line:no-floating-promises\r\n this.connection.stop(new Error(\"Server timeout elapsed without receiving a message from the server.\"));\r\n };\r\n HubConnection.prototype.invokeClientMethod = function (invocationMessage) {\r\n var _this = this;\r\n var methods = this.methods[invocationMessage.target.toLowerCase()];\r\n if (methods) {\r\n try {\r\n methods.forEach(function (m) { return m.apply(_this, invocationMessage.arguments); });\r\n }\r\n catch (e) {\r\n this.logger.log(LogLevel.Error, \"A callback for the method \" + invocationMessage.target.toLowerCase() + \" threw error '\" + e + \"'.\");\r\n }\r\n if (invocationMessage.invocationId) {\r\n // This is not supported in v1. So we return an error to avoid blocking the server waiting for the response.\r\n var message = \"Server requested a response, which is not supported in this version of the client.\";\r\n this.logger.log(LogLevel.Error, message);\r\n // We don't want to wait on the stop itself.\r\n this.stopPromise = this.stopInternal(new Error(message));\r\n }\r\n }\r\n else {\r\n this.logger.log(LogLevel.Warning, \"No client method with the name '\" + invocationMessage.target + \"' found.\");\r\n }\r\n };\r\n HubConnection.prototype.connectionClosed = function (error) {\r\n this.logger.log(LogLevel.Debug, \"HubConnection.connectionClosed(\" + error + \") called while in state \" + this.connectionState + \".\");\r\n // Triggering this.handshakeRejecter is insufficient because it could already be resolved without the continuation having run yet.\r\n this.stopDuringStartError = this.stopDuringStartError || error || new Error(\"The underlying connection was closed before the hub handshake could complete.\");\r\n // If the handshake is in progress, start will be waiting for the handshake promise, so we complete it.\r\n // If it has already completed, this should just noop.\r\n if (this.handshakeResolver) {\r\n this.handshakeResolver();\r\n }\r\n this.cancelCallbacksWithError(error || new Error(\"Invocation canceled due to the underlying connection being closed.\"));\r\n this.cleanupTimeout();\r\n this.cleanupPingTimer();\r\n if (this.connectionState === HubConnectionState.Disconnecting) {\r\n this.completeClose(error);\r\n }\r\n else if (this.connectionState === HubConnectionState.Connected && this.reconnectPolicy) {\r\n // tslint:disable-next-line:no-floating-promises\r\n this.reconnect(error);\r\n }\r\n else if (this.connectionState === HubConnectionState.Connected) {\r\n this.completeClose(error);\r\n }\r\n // If none of the above if conditions were true were called the HubConnection must be in either:\r\n // 1. The Connecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail it.\r\n // 2. The Reconnecting state in which case the handshakeResolver will complete it and stopDuringStartError will fail the current reconnect attempt\r\n // and potentially continue the reconnect() loop.\r\n // 3. The Disconnected state in which case we're already done.\r\n };\r\n HubConnection.prototype.completeClose = function (error) {\r\n var _this = this;\r\n if (this.connectionStarted) {\r\n this.connectionState = HubConnectionState.Disconnected;\r\n this.connectionStarted = false;\r\n try {\r\n this.closedCallbacks.forEach(function (c) { return c.apply(_this, [error]); });\r\n }\r\n catch (e) {\r\n this.logger.log(LogLevel.Error, \"An onclose callback called with error '\" + error + \"' threw error '\" + e + \"'.\");\r\n }\r\n }\r\n };\r\n HubConnection.prototype.reconnect = function (error) {\r\n return __awaiter(this, void 0, void 0, function () {\r\n var reconnectStartTime, previousReconnectAttempts, retryError, nextRetryDelay, e_4;\r\n var _this = this;\r\n return __generator(this, function (_a) {\r\n switch (_a.label) {\r\n case 0:\r\n reconnectStartTime = Date.now();\r\n previousReconnectAttempts = 0;\r\n retryError = error !== undefined ? error : new Error(\"Attempting to reconnect due to a unknown error.\");\r\n nextRetryDelay = this.getNextRetryDelay(previousReconnectAttempts++, 0, retryError);\r\n if (nextRetryDelay === null) {\r\n this.logger.log(LogLevel.Debug, \"Connection not reconnecting because the IRetryPolicy returned null on the first reconnect attempt.\");\r\n this.completeClose(error);\r\n return [2 /*return*/];\r\n }\r\n this.connectionState = HubConnectionState.Reconnecting;\r\n if (error) {\r\n this.logger.log(LogLevel.Information, \"Connection reconnecting because of error '\" + error + \"'.\");\r\n }\r\n else {\r\n this.logger.log(LogLevel.Information, \"Connection reconnecting.\");\r\n }\r\n if (this.onreconnecting) {\r\n try {\r\n this.reconnectingCallbacks.forEach(function (c) { return c.apply(_this, [error]); });\r\n }\r\n catch (e) {\r\n this.logger.log(LogLevel.Error, \"An onreconnecting callback called with error '\" + error + \"' threw error '\" + e + \"'.\");\r\n }\r\n // Exit early if an onreconnecting callback called connection.stop().\r\n if (this.connectionState !== HubConnectionState.Reconnecting) {\r\n this.logger.log(LogLevel.Debug, \"Connection left the reconnecting state in onreconnecting callback. Done reconnecting.\");\r\n return [2 /*return*/];\r\n }\r\n }\r\n _a.label = 1;\r\n case 1:\r\n if (!(nextRetryDelay !== null)) return [3 /*break*/, 7];\r\n this.logger.log(LogLevel.Information, \"Reconnect attempt number \" + previousReconnectAttempts + \" will start in \" + nextRetryDelay + \" ms.\");\r\n return [4 /*yield*/, new Promise(function (resolve) {\r\n _this.reconnectDelayHandle = setTimeout(resolve, nextRetryDelay);\r\n })];\r\n case 2:\r\n _a.sent();\r\n this.reconnectDelayHandle = undefined;\r\n if (this.connectionState !== HubConnectionState.Reconnecting) {\r\n this.logger.log(LogLevel.Debug, \"Connection left the reconnecting state during reconnect delay. Done reconnecting.\");\r\n return [2 /*return*/];\r\n }\r\n _a.label = 3;\r\n case 3:\r\n _a.trys.push([3, 5, , 6]);\r\n return [4 /*yield*/, this.startInternal()];\r\n case 4:\r\n _a.sent();\r\n this.connectionState = HubConnectionState.Connected;\r\n this.logger.log(LogLevel.Information, \"HubConnection reconnected successfully.\");\r\n if (this.onreconnected) {\r\n try {\r\n this.reconnectedCallbacks.forEach(function (c) { return c.apply(_this, [_this.connection.connectionId]); });\r\n }\r\n catch (e) {\r\n this.logger.log(LogLevel.Error, \"An onreconnected callback called with connectionId '\" + this.connection.connectionId + \"; threw error '\" + e + \"'.\");\r\n }\r\n }\r\n return [2 /*return*/];\r\n case 5:\r\n e_4 = _a.sent();\r\n this.logger.log(LogLevel.Information, \"Reconnect attempt failed because of error '\" + e_4 + \"'.\");\r\n if (this.connectionState !== HubConnectionState.Reconnecting) {\r\n this.logger.log(LogLevel.Debug, \"Connection moved to the '\" + this.connectionState + \"' from the reconnecting state during reconnect attempt. Done reconnecting.\");\r\n // The TypeScript compiler thinks that connectionState must be Connected here. The TypeScript compiler is wrong.\r\n if (this.connectionState === HubConnectionState.Disconnecting) {\r\n this.completeClose();\r\n }\r\n return [2 /*return*/];\r\n }\r\n retryError = e_4 instanceof Error ? e_4 : new Error(e_4.toString());\r\n nextRetryDelay = this.getNextRetryDelay(previousReconnectAttempts++, Date.now() - reconnectStartTime, retryError);\r\n return [3 /*break*/, 6];\r\n case 6: return [3 /*break*/, 1];\r\n case 7:\r\n this.logger.log(LogLevel.Information, \"Reconnect retries have been exhausted after \" + (Date.now() - reconnectStartTime) + \" ms and \" + previousReconnectAttempts + \" failed attempts. Connection disconnecting.\");\r\n this.completeClose();\r\n return [2 /*return*/];\r\n }\r\n });\r\n });\r\n };\r\n HubConnection.prototype.getNextRetryDelay = function (previousRetryCount, elapsedMilliseconds, retryReason) {\r\n try {\r\n return this.reconnectPolicy.nextRetryDelayInMilliseconds({\r\n elapsedMilliseconds: elapsedMilliseconds,\r\n previousRetryCount: previousRetryCount,\r\n retryReason: retryReason,\r\n });\r\n }\r\n catch (e) {\r\n this.logger.log(LogLevel.Error, \"IRetryPolicy.nextRetryDelayInMilliseconds(\" + previousRetryCount + \", \" + elapsedMilliseconds + \") threw error '\" + e + \"'.\");\r\n return null;\r\n }\r\n };\r\n HubConnection.prototype.cancelCallbacksWithError = function (error) {\r\n var callbacks = this.callbacks;\r\n this.callbacks = {};\r\n Object.keys(callbacks)\r\n .forEach(function (key) {\r\n var callback = callbacks[key];\r\n callback(null, error);\r\n });\r\n };\r\n HubConnection.prototype.cleanupPingTimer = function () {\r\n if (this.pingServerHandle) {\r\n clearTimeout(this.pingServerHandle);\r\n this.pingServerHandle = undefined;\r\n }\r\n };\r\n HubConnection.prototype.cleanupTimeout = function () {\r\n if (this.timeoutHandle) {\r\n clearTimeout(this.timeoutHandle);\r\n }\r\n };\r\n HubConnection.prototype.createInvocation = function (methodName, args, nonblocking, streamIds) {\r\n if (nonblocking) {\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n streamIds: streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n else {\r\n var invocationId = this.invocationId;\r\n this.invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds: streamIds,\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.Invocation,\r\n };\r\n }\r\n }\r\n };\r\n HubConnection.prototype.launchStreams = function (streams, promiseQueue) {\r\n var _this = this;\r\n if (streams.length === 0) {\r\n return;\r\n }\r\n // Synchronize stream data so they arrive in-order on the server\r\n if (!promiseQueue) {\r\n promiseQueue = Promise.resolve();\r\n }\r\n var _loop_1 = function (streamId) {\r\n streams[streamId].subscribe({\r\n complete: function () {\r\n promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createCompletionMessage(streamId)); });\r\n },\r\n error: function (err) {\r\n var message;\r\n if (err instanceof Error) {\r\n message = err.message;\r\n }\r\n else if (err && err.toString) {\r\n message = err.toString();\r\n }\r\n else {\r\n message = \"Unknown error\";\r\n }\r\n promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createCompletionMessage(streamId, message)); });\r\n },\r\n next: function (item) {\r\n promiseQueue = promiseQueue.then(function () { return _this.sendWithProtocol(_this.createStreamItemMessage(streamId, item)); });\r\n },\r\n });\r\n };\r\n // We want to iterate over the keys, since the keys are the stream ids\r\n // tslint:disable-next-line:forin\r\n for (var streamId in streams) {\r\n _loop_1(streamId);\r\n }\r\n };\r\n HubConnection.prototype.replaceStreamingParams = function (args) {\r\n var streams = [];\r\n var streamIds = [];\r\n for (var i = 0; i < args.length; i++) {\r\n var argument = args[i];\r\n if (this.isObservable(argument)) {\r\n var streamId = this.invocationId;\r\n this.invocationId++;\r\n // Store the stream for later use\r\n streams[streamId] = argument;\r\n streamIds.push(streamId.toString());\r\n // remove stream from args\r\n args.splice(i, 1);\r\n }\r\n }\r\n return [streams, streamIds];\r\n };\r\n HubConnection.prototype.isObservable = function (arg) {\r\n // This allows other stream implementations to just work (like rxjs)\r\n return arg && arg.subscribe && typeof arg.subscribe === \"function\";\r\n };\r\n HubConnection.prototype.createStreamInvocation = function (methodName, args, streamIds) {\r\n var invocationId = this.invocationId;\r\n this.invocationId++;\r\n if (streamIds.length !== 0) {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n streamIds: streamIds,\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n else {\r\n return {\r\n arguments: args,\r\n invocationId: invocationId.toString(),\r\n target: methodName,\r\n type: MessageType.StreamInvocation,\r\n };\r\n }\r\n };\r\n HubConnection.prototype.createCancelInvocation = function (id) {\r\n return {\r\n invocationId: id,\r\n type: MessageType.CancelInvocation,\r\n };\r\n };\r\n HubConnection.prototype.createStreamItemMessage = function (id, item) {\r\n return {\r\n invocationId: id,\r\n item: item,\r\n type: MessageType.StreamItem,\r\n };\r\n };\r\n HubConnection.prototype.createCompletionMessage = function (id, error, result) {\r\n if (error) {\r\n return {\r\n error: error,\r\n invocationId: id,\r\n type: MessageType.Completion,\r\n };\r\n }\r\n return {\r\n invocationId: id,\r\n result: result,\r\n type: MessageType.Completion,\r\n };\r\n };\r\n return HubConnection;\r\n}());\r\nexport { HubConnection };\r\n//# sourceMappingURL=HubConnection.js.map","// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n// This will be treated as a bit flag in the future, so we keep it using power-of-two values.\r\n/** Specifies a specific HTTP transport type. */\r\nexport var HttpTransportType;\r\n(function (HttpTransportType) {\r\n /** Specifies no transport preference. */\r\n HttpTransportType[HttpTransportType[\"None\"] = 0] = \"None\";\r\n /** Specifies the WebSockets transport. */\r\n HttpTransportType[HttpTransportType[\"WebSockets\"] = 1] = \"WebSockets\";\r\n /** Specifies the Server-Sent Events transport. */\r\n HttpTransportType[HttpTransportType[\"ServerSentEvents\"] = 2] = \"ServerSentEvents\";\r\n /** Specifies the Long Polling transport. */\r\n HttpTransportType[HttpTransportType[\"LongPolling\"] = 4] = \"LongPolling\";\r\n})(HttpTransportType || (HttpTransportType = {}));\r\n/** Specifies the transfer format for a connection. */\r\nexport var TransferFormat;\r\n(function (TransferFormat) {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Text\"] = 1] = \"Text\";\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n TransferFormat[TransferFormat[\"Binary\"] = 2] = \"Binary\";\r\n})(TransferFormat || (TransferFormat = {}));\r\n//# sourceMappingURL=ITransport.js.map","// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\nvar __assign = (this && this.__assign) || Object.assign || function(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\r\n t[p] = s[p];\r\n }\r\n return t;\r\n};\r\nimport { DefaultReconnectPolicy } from \"./DefaultReconnectPolicy\";\r\nimport { HttpConnection } from \"./HttpConnection\";\r\nimport { HubConnection } from \"./HubConnection\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { Arg, ConsoleLogger } from \"./Utils\";\r\n// tslint:disable:object-literal-sort-keys\r\nvar LogLevelNameMapping = {\r\n trace: LogLevel.Trace,\r\n debug: LogLevel.Debug,\r\n info: LogLevel.Information,\r\n information: LogLevel.Information,\r\n warn: LogLevel.Warning,\r\n warning: LogLevel.Warning,\r\n error: LogLevel.Error,\r\n critical: LogLevel.Critical,\r\n none: LogLevel.None,\r\n};\r\nfunction parseLogLevel(name) {\r\n // Case-insensitive matching via lower-casing\r\n // Yes, I know case-folding is a complicated problem in Unicode, but we only support\r\n // the ASCII strings defined in LogLevelNameMapping anyway, so it's fine -anurse.\r\n var mapping = LogLevelNameMapping[name.toLowerCase()];\r\n if (typeof mapping !== \"undefined\") {\r\n return mapping;\r\n }\r\n else {\r\n throw new Error(\"Unknown log level: \" + name);\r\n }\r\n}\r\n/** A builder for configuring {@link @microsoft/signalr.HubConnection} instances. */\r\nvar HubConnectionBuilder = /** @class */ (function () {\r\n function HubConnectionBuilder() {\r\n }\r\n HubConnectionBuilder.prototype.configureLogging = function (logging) {\r\n Arg.isRequired(logging, \"logging\");\r\n if (isLogger(logging)) {\r\n this.logger = logging;\r\n }\r\n else if (typeof logging === \"string\") {\r\n var logLevel = parseLogLevel(logging);\r\n this.logger = new ConsoleLogger(logLevel);\r\n }\r\n else {\r\n this.logger = new ConsoleLogger(logging);\r\n }\r\n return this;\r\n };\r\n HubConnectionBuilder.prototype.withUrl = function (url, transportTypeOrOptions) {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isNotEmpty(url, \"url\");\r\n this.url = url;\r\n // Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed\r\n // to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.\r\n if (typeof transportTypeOrOptions === \"object\") {\r\n this.httpConnectionOptions = __assign({}, this.httpConnectionOptions, transportTypeOrOptions);\r\n }\r\n else {\r\n this.httpConnectionOptions = __assign({}, this.httpConnectionOptions, { transport: transportTypeOrOptions });\r\n }\r\n return this;\r\n };\r\n /** Configures the {@link @microsoft/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @microsoft/signalr.IHubProtocol} implementation to use.\r\n */\r\n HubConnectionBuilder.prototype.withHubProtocol = function (protocol) {\r\n Arg.isRequired(protocol, \"protocol\");\r\n this.protocol = protocol;\r\n return this;\r\n };\r\n HubConnectionBuilder.prototype.withAutomaticReconnect = function (retryDelaysOrReconnectPolicy) {\r\n if (this.reconnectPolicy) {\r\n throw new Error(\"A reconnectPolicy has already been set.\");\r\n }\r\n if (!retryDelaysOrReconnectPolicy) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy();\r\n }\r\n else if (Array.isArray(retryDelaysOrReconnectPolicy)) {\r\n this.reconnectPolicy = new DefaultReconnectPolicy(retryDelaysOrReconnectPolicy);\r\n }\r\n else {\r\n this.reconnectPolicy = retryDelaysOrReconnectPolicy;\r\n }\r\n return this;\r\n };\r\n /** Creates a {@link @microsoft/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @microsoft/signalr.HubConnection}.\r\n */\r\n HubConnectionBuilder.prototype.build = function () {\r\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\r\n // provided to configureLogger\r\n var httpConnectionOptions = this.httpConnectionOptions || {};\r\n // If it's 'null', the user **explicitly** asked for null, don't mess with it.\r\n if (httpConnectionOptions.logger === undefined) {\r\n // If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.\r\n httpConnectionOptions.logger = this.logger;\r\n }\r\n // Now create the connection\r\n if (!this.url) {\r\n throw new Error(\"The 'HubConnectionBuilder.withUrl' method must be called before building the connection.\");\r\n }\r\n var connection = new HttpConnection(this.url, httpConnectionOptions);\r\n return HubConnection.create(connection, this.logger || NullLogger.instance, this.protocol || new JsonHubProtocol(), this.reconnectPolicy);\r\n };\r\n return HubConnectionBuilder;\r\n}());\r\nexport { HubConnectionBuilder };\r\nfunction isLogger(logger) {\r\n return logger.log !== undefined;\r\n}\r\n//# sourceMappingURL=HubConnectionBuilder.js.map","// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\nimport { MessageType } from \"./IHubProtocol\";\r\nimport { LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nvar JSON_HUB_PROTOCOL_NAME = \"json\";\r\n/** Implements the JSON Hub Protocol. */\r\nvar JsonHubProtocol = /** @class */ (function () {\r\n function JsonHubProtocol() {\r\n /** @inheritDoc */\r\n this.name = JSON_HUB_PROTOCOL_NAME;\r\n /** @inheritDoc */\r\n this.version = 1;\r\n /** @inheritDoc */\r\n this.transferFormat = TransferFormat.Text;\r\n }\r\n /** Creates an array of {@link @microsoft/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * @param {string} input A string containing the serialized representation.\r\n * @param {ILogger} logger A logger that will be used to log messages that occur during parsing.\r\n */\r\n JsonHubProtocol.prototype.parseMessages = function (input, logger) {\r\n // The interface does allow \"ArrayBuffer\" to be passed in, but this implementation does not. So let's throw a useful error.\r\n if (typeof input !== \"string\") {\r\n throw new Error(\"Invalid input for JSON hub protocol. Expected a string.\");\r\n }\r\n if (!input) {\r\n return [];\r\n }\r\n if (logger === null) {\r\n logger = NullLogger.instance;\r\n }\r\n // Parse the messages\r\n var messages = TextMessageFormat.parse(input);\r\n var hubMessages = [];\r\n for (var _i = 0, messages_1 = messages; _i < messages_1.length; _i++) {\r\n var message = messages_1[_i];\r\n var parsedMessage = JSON.parse(message);\r\n if (typeof parsedMessage.type !== \"number\") {\r\n throw new Error(\"Invalid payload.\");\r\n }\r\n switch (parsedMessage.type) {\r\n case MessageType.Invocation:\r\n this.isInvocationMessage(parsedMessage);\r\n break;\r\n case MessageType.StreamItem:\r\n this.isStreamItemMessage(parsedMessage);\r\n break;\r\n case MessageType.Completion:\r\n this.isCompletionMessage(parsedMessage);\r\n break;\r\n case MessageType.Ping:\r\n // Single value, no need to validate\r\n break;\r\n case MessageType.Close:\r\n // All optional values, no need to validate\r\n break;\r\n default:\r\n // Future protocol changes can add message types, old clients can ignore them\r\n logger.log(LogLevel.Information, \"Unknown message type '\" + parsedMessage.type + \"' ignored.\");\r\n continue;\r\n }\r\n hubMessages.push(parsedMessage);\r\n }\r\n return hubMessages;\r\n };\r\n /** Writes the specified {@link @microsoft/signalr.HubMessage} to a string and returns it.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string} A string containing the serialized representation of the message.\r\n */\r\n JsonHubProtocol.prototype.writeMessage = function (message) {\r\n return TextMessageFormat.write(JSON.stringify(message));\r\n };\r\n JsonHubProtocol.prototype.isInvocationMessage = function (message) {\r\n this.assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\r\n if (message.invocationId !== undefined) {\r\n this.assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\r\n }\r\n };\r\n JsonHubProtocol.prototype.isStreamItemMessage = function (message) {\r\n this.assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\r\n if (message.item === undefined) {\r\n throw new Error(\"Invalid payload for StreamItem message.\");\r\n }\r\n };\r\n JsonHubProtocol.prototype.isCompletionMessage = function (message) {\r\n if (message.result && message.error) {\r\n throw new Error(\"Invalid payload for Completion message.\");\r\n }\r\n if (!message.result && message.error) {\r\n this.assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\r\n }\r\n this.assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\r\n };\r\n JsonHubProtocol.prototype.assertNotEmptyString = function (value, errorMessage) {\r\n if (typeof value !== \"string\" || value === \"\") {\r\n throw new Error(errorMessage);\r\n }\r\n };\r\n return JsonHubProtocol;\r\n}());\r\nexport { JsonHubProtocol };\r\n//# sourceMappingURL=JsonHubProtocol.js.map","// Copyright (c) .NET Foundation. All rights reserved.\r\n// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.\r\n/** Defines the type of a Hub Message. */\r\nexport var MessageType;\r\n(function (MessageType) {\r\n /** Indicates the message is an Invocation message and implements the {@link @microsoft/signalr.InvocationMessage} interface. */\r\n MessageType[MessageType[\"Invocation\"] = 1] = \"Invocation\";\r\n /** Indicates the message is a StreamItem message and implements the {@link @microsoft/signalr.StreamItemMessage} interface. */\r\n MessageType[MessageType[\"StreamItem\"] = 2] = \"StreamItem\";\r\n /** Indicates the message is a Completion message and implements the {@link @microsoft/signalr.CompletionMessage} interface. */\r\n MessageType[MessageType[\"Completion\"] = 3] = \"Completion\";\r\n /** Indicates the message is a Stream Invocation message and implements the {@link @microsoft/signalr.StreamInvocationMessage} interface. */\r\n MessageType[MessageType[\"StreamInvocation\"] = 4] = \"StreamInvocation\";\r\n /** Indicates the message is a Cancel Invocation message and implements the {@link @microsoft/signalr.CancelInvocationMessage} interface. */\r\n MessageType[MessageType[\"CancelInvocation\"] = 5] = \"CancelInvocation\";\r\n /** Indicates the message is a Ping message and implements the {@link @microsoft/signalr.PingMessage} interface. */\r\n MessageType[MessageType[\"Ping\"] = 6] = \"Ping\";\r\n /** Indicates the message is a Close message and implements the {@link @microsoft/signalr.CloseMessage} interface. */\r\n MessageType[MessageType[\"Close\"] = 7] = \"Close\";\r\n})(MessageType || (MessageType = {}));\r\n//# sourceMappingURL=IHubProtocol.js.map"],"sourceRoot":""}