提交 2eacbfb5 编写于 作者: lwplvx's avatar lwplvx

add app

上级 497f8f76
{ // launch.json 配置了启动调试时相关设置,configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数,remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"h5" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}
<script>
export default {
onLaunch: function() {
console.log('App Launch')
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style>
/*每个页面公共css */
</style>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>
import App from './App'
// #ifndef VUE3
import Vue from 'vue'
import signalr from './utils/signalR'
Vue.use(signalr);
Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
...App
})
app.$mount()
// #endif
// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
\ No newline at end of file
{
"name" : "TransRocket",
"appid" : "",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
"sdkConfigs" : {}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "2"
}
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "uni-app"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
}
}
<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'Tanslate Rocket 666'
}
},
onLoad() {
},
methods: {
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>
JavaScript and TypeScript clients for SignalR for ASP.NET Core
## Installation
```bash
npm install @aspnet/signalr
```
## Usage
See the [SignalR Documentation](https://docs.microsoft.com/en-us/aspnet/core/signalr) at docs.microsoft.com for documentation on the latest release. [API Reference Documentation](https://docs.microsoft.com/javascript/api/%40aspnet/signalr/?view=signalr-js-latest) is also available on docs.microsoft.com.
### Browser
To use the client in a browser, copy `*.js` files from the `dist/browser` folder to your script folder include on your page using the `<script>` tag.
### Node.js
To use the client in a NodeJS application, install the package to your `node_modules` folder and use `require('@aspnet/signalr')` to load the module. The object returned by `require('@aspnet/signalr')` has the same members as the global `signalR` object (when used in a browser).
### Example (Browser)
```JavaScript
let connection = new signalR.HubConnectionBuilder()
.withUrl("/chat")
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
```
### Example (NodeJS)
```JavaScript
const signalR = require("@aspnet/signalr");
let connection = new signalR.HubConnectionBuilder()
.withUrl("/chat")
.build();
connection.on("send", data => {
console.log(data);
});
connection.start()
.then(() => connection.invoke("send", "Hello"));
```
此差异已折叠。
因为 它太大了无法显示 source diff 。你可以改为 查看blob
此差异已折叠。
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController
// We don't actually ever use the API being polyfilled, we always use the polyfill because
// it's a very new API right now.
// Not exported from index.
/** @private */
var AbortController = /** @class */ (function () {
function AbortController() {
this.isAborted = false;
this.onabort = null;
}
AbortController.prototype.abort = function () {
if (!this.isAborted) {
this.isAborted = true;
if (this.onabort) {
this.onabort();
}
}
};
Object.defineProperty(AbortController.prototype, "signal", {
get: function () {
return this;
},
enumerable: true,
configurable: true
});
Object.defineProperty(AbortController.prototype, "aborted", {
get: function () {
return this.isAborted;
},
enumerable: true,
configurable: true
});
return AbortController;
}());
exports.AbortController = AbortController;
//# sourceMappingURL=AbortController.js.map
\ No newline at end of file
{"version":3,"file":"AbortController.js","sourceRoot":"","sources":["../../src/AbortController.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,qFAAqF;AACrF,0FAA0F;AAC1F,iCAAiC;AAEjC,2BAA2B;AAC3B,eAAe;AACf;IAAA;QACY,cAAS,GAAY,KAAK,CAAC;QAC5B,YAAO,GAAwB,IAAI,CAAC;IAkB/C,CAAC;IAhBU,+BAAK,GAAZ;QACI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,IAAI,IAAI,CAAC,OAAO,EAAE;gBACd,IAAI,CAAC,OAAO,EAAE,CAAC;aAClB;SACJ;IACL,CAAC;IAED,sBAAI,mCAAM;aAAV;YACI,OAAO,IAAI,CAAC;QAChB,CAAC;;;OAAA;IAED,sBAAI,oCAAO;aAAX;YACI,OAAO,IAAI,CAAC,SAAS,CAAC;QAC1B,CAAC;;;OAAA;IACL,sBAAC;AAAD,CAAC,AApBD,IAoBC;AApBY,0CAAe","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\r\n// Rough polyfill of https://developer.mozilla.org/en-US/docs/Web/API/AbortController\r\n// We don't actually ever use the API being polyfilled, we always use the polyfill because\r\n// it's a very new API right now.\r\n\r\n// Not exported from index.\r\n/** @private */\r\nexport class AbortController implements AbortSignal {\r\n private isAborted: boolean = false;\r\n public onabort: (() => void) | null = null;\r\n\r\n public abort() {\r\n if (!this.isAborted) {\r\n this.isAborted = true;\r\n if (this.onabort) {\r\n this.onabort();\r\n }\r\n }\r\n }\r\n\r\n get signal(): AbortSignal {\r\n return this;\r\n }\r\n\r\n get aborted(): boolean {\r\n return this.isAborted;\r\n }\r\n}\r\n\r\n/** Represents a signal that can be monitored to determine if a request has been aborted. */\r\nexport interface AbortSignal {\r\n /** Indicates if the request has been aborted. */\r\n aborted: boolean;\r\n /** Set this to a handler that will be invoked when the request is aborted. */\r\n onabort: (() => void) | null;\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var Errors_1 = require("./Errors");
var HttpClient_1 = require("./HttpClient");
var NodeHttpClient_1 = require("./NodeHttpClient");
var XhrHttpClient_1 = require("./XhrHttpClient");
/** Default implementation of {@link @aspnet/signalr.HttpClient}. */
var DefaultHttpClient = /** @class */ (function (_super) {
__extends(DefaultHttpClient, _super);
/** Creates a new instance of the {@link @aspnet/signalr.DefaultHttpClient}, using the provided {@link @aspnet/signalr.ILogger} to log messages. */
function DefaultHttpClient(logger) {
var _this = _super.call(this) || this;
if (typeof XMLHttpRequest !== "undefined") {
_this.httpClient = new XhrHttpClient_1.XhrHttpClient(logger);
}
else {
_this.httpClient = new NodeHttpClient_1.NodeHttpClient(logger);
}
return _this;
}
/** @inheritDoc */
DefaultHttpClient.prototype.send = function (request) {
// Check that abort was not signaled before calling send
if (request.abortSignal && request.abortSignal.aborted) {
return Promise.reject(new Errors_1.AbortError());
}
if (!request.method) {
return Promise.reject(new Error("No method defined."));
}
if (!request.url) {
return Promise.reject(new Error("No url defined."));
}
return this.httpClient.send(request);
};
DefaultHttpClient.prototype.getCookieString = function (url) {
return this.httpClient.getCookieString(url);
};
return DefaultHttpClient;
}(HttpClient_1.HttpClient));
exports.DefaultHttpClient = DefaultHttpClient;
//# sourceMappingURL=DefaultHttpClient.js.map
\ No newline at end of file
{"version":3,"file":"DefaultHttpClient.js","sourceRoot":"","sources":["../../src/DefaultHttpClient.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;;;;AAE/G,mCAAsC;AACtC,2CAAqE;AAErE,mDAAkD;AAClD,iDAAgD;AAEhD,oEAAoE;AACpE;IAAuC,qCAAU;IAG7C,mJAAmJ;IACnJ,2BAAmB,MAAe;QAAlC,YACI,iBAAO,SAOV;QALG,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE;YACvC,KAAI,CAAC,UAAU,GAAG,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC;SAC/C;aAAM;YACH,KAAI,CAAC,UAAU,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;SAChD;;IACL,CAAC;IAED,kBAAkB;IACX,gCAAI,GAAX,UAAY,OAAoB;QAC5B,wDAAwD;QACxD,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE;YACpD,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,mBAAU,EAAE,CAAC,CAAC;SAC3C;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;YACjB,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;SAC1D;QACD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YACd,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;SACvD;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,2CAAe,GAAtB,UAAuB,GAAW;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAChD,CAAC;IACL,wBAAC;AAAD,CAAC,AAlCD,CAAuC,uBAAU,GAkChD;AAlCY,8CAAiB","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\r\nimport { AbortError } from \"./Errors\";\r\nimport { HttpClient, HttpRequest, HttpResponse } from \"./HttpClient\";\r\nimport { ILogger } from \"./ILogger\";\r\nimport { NodeHttpClient } from \"./NodeHttpClient\";\r\nimport { XhrHttpClient } from \"./XhrHttpClient\";\r\n\r\n/** Default implementation of {@link @aspnet/signalr.HttpClient}. */\r\nexport class DefaultHttpClient extends HttpClient {\r\n private readonly httpClient: HttpClient;\r\n\r\n /** Creates a new instance of the {@link @aspnet/signalr.DefaultHttpClient}, using the provided {@link @aspnet/signalr.ILogger} to log messages. */\r\n public constructor(logger: ILogger) {\r\n super();\r\n\r\n if (typeof XMLHttpRequest !== \"undefined\") {\r\n this.httpClient = new XhrHttpClient(logger);\r\n } else {\r\n this.httpClient = new NodeHttpClient(logger);\r\n }\r\n }\r\n\r\n /** @inheritDoc */\r\n public send(request: HttpRequest): Promise<HttpResponse> {\r\n // Check that abort was not signaled before calling send\r\n if (request.abortSignal && request.abortSignal.aborted) {\r\n return Promise.reject(new AbortError());\r\n }\r\n\r\n if (!request.method) {\r\n return Promise.reject(new Error(\"No method defined.\"));\r\n }\r\n if (!request.url) {\r\n return Promise.reject(new Error(\"No url defined.\"));\r\n }\r\n\r\n return this.httpClient.send(request);\r\n }\r\n\r\n public getCookieString(url: string): string {\r\n return this.httpClient.getCookieString(url);\r\n }\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
// This is an empty implementation of the NodeHttpClient that will be included in browser builds so the output file will be smaller
var HttpClient_1 = require("./HttpClient");
var NodeHttpClient = /** @class */ (function (_super) {
__extends(NodeHttpClient, _super);
// @ts-ignore: Need ILogger to compile, but unused variables generate errors
function NodeHttpClient(logger) {
return _super.call(this) || this;
}
NodeHttpClient.prototype.send = function () {
return Promise.reject(new Error("If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one."));
};
return NodeHttpClient;
}(HttpClient_1.HttpClient));
exports.NodeHttpClient = NodeHttpClient;
//# sourceMappingURL=EmptyNodeHttpClient.js.map
\ No newline at end of file
{"version":3,"file":"EmptyNodeHttpClient.js","sourceRoot":"","sources":["../../src/EmptyNodeHttpClient.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;;;;AAE/G,mIAAmI;AAEnI,2CAAwD;AAGxD;IAAoC,kCAAU;IAC1C,4EAA4E;IAC5E,wBAAmB,MAAe;eAC9B,iBAAO;IACX,CAAC;IAEM,6BAAI,GAAX;QACI,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iIAAiI,CAAC,CAAC,CAAC;IACxK,CAAC;IACL,qBAAC;AAAD,CAAC,AATD,CAAoC,uBAAU,GAS7C;AATY,wCAAc","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\r\n// This is an empty implementation of the NodeHttpClient that will be included in browser builds so the output file will be smaller\r\n\r\nimport { HttpClient, HttpResponse } from \"./HttpClient\";\r\nimport { ILogger } from \"./ILogger\";\r\n\r\nexport class NodeHttpClient extends HttpClient {\r\n // @ts-ignore: Need ILogger to compile, but unused variables generate errors\r\n public constructor(logger: ILogger) {\r\n super();\r\n }\r\n\r\n public send(): Promise<HttpResponse> {\r\n return Promise.reject(new Error(\"If using Node either provide an XmlHttpRequest polyfill or consume the cjs or esm script instead of the browser/signalr.js one.\"));\r\n }\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
/** Error thrown when an HTTP request fails. */
var HttpError = /** @class */ (function (_super) {
__extends(HttpError, _super);
/** Constructs a new instance of {@link @aspnet/signalr.HttpError}.
*
* @param {string} errorMessage A descriptive error message.
* @param {number} statusCode The HTTP status code represented by this error.
*/
function HttpError(errorMessage, statusCode) {
var _newTarget = this.constructor;
var _this = this;
var trueProto = _newTarget.prototype;
_this = _super.call(this, errorMessage) || this;
_this.statusCode = statusCode;
// Workaround issue in Typescript compiler
// https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
_this.__proto__ = trueProto;
return _this;
}
return HttpError;
}(Error));
exports.HttpError = HttpError;
/** Error thrown when a timeout elapses. */
var TimeoutError = /** @class */ (function (_super) {
__extends(TimeoutError, _super);
/** Constructs a new instance of {@link @aspnet/signalr.TimeoutError}.
*
* @param {string} errorMessage A descriptive error message.
*/
function TimeoutError(errorMessage) {
var _newTarget = this.constructor;
if (errorMessage === void 0) { errorMessage = "A timeout occurred."; }
var _this = this;
var trueProto = _newTarget.prototype;
_this = _super.call(this, errorMessage) || this;
// Workaround issue in Typescript compiler
// https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
_this.__proto__ = trueProto;
return _this;
}
return TimeoutError;
}(Error));
exports.TimeoutError = TimeoutError;
/** Error thrown when an action is aborted. */
var AbortError = /** @class */ (function (_super) {
__extends(AbortError, _super);
/** Constructs a new instance of {@link AbortError}.
*
* @param {string} errorMessage A descriptive error message.
*/
function AbortError(errorMessage) {
var _newTarget = this.constructor;
if (errorMessage === void 0) { errorMessage = "An abort occurred."; }
var _this = this;
var trueProto = _newTarget.prototype;
_this = _super.call(this, errorMessage) || this;
// Workaround issue in Typescript compiler
// https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200
_this.__proto__ = trueProto;
return _this;
}
return AbortError;
}(Error));
exports.AbortError = AbortError;
//# sourceMappingURL=Errors.js.map
\ No newline at end of file
{"version":3,"file":"Errors.js","sourceRoot":"","sources":["../../src/Errors.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;;;;AAE/G,+CAA+C;AAC/C;IAA+B,6BAAK;IAQhC;;;;OAIG;IACH,mBAAY,YAAoB,EAAE,UAAkB;;QAApD,iBAQC;QAPG,IAAM,SAAS,GAAG,WAAW,SAAS,CAAC;QACvC,QAAA,kBAAM,YAAY,CAAC,SAAC;QACpB,KAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAE7B,0CAA0C;QAC1C,8EAA8E;QAC9E,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;;IAC/B,CAAC;IACL,gBAAC;AAAD,CAAC,AAtBD,CAA+B,KAAK,GAsBnC;AAtBY,8BAAS;AAwBtB,2CAA2C;AAC3C;IAAkC,gCAAK;IAKnC;;;OAGG;IACH,sBAAY,YAA4C;;QAA5C,6BAAA,EAAA,oCAA4C;QAAxD,iBAOC;QANG,IAAM,SAAS,GAAG,WAAW,SAAS,CAAC;QACvC,QAAA,kBAAM,YAAY,CAAC,SAAC;QAEpB,0CAA0C;QAC1C,8EAA8E;QAC9E,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;;IAC/B,CAAC;IACL,mBAAC;AAAD,CAAC,AAjBD,CAAkC,KAAK,GAiBtC;AAjBY,oCAAY;AAmBzB,8CAA8C;AAC9C;IAAgC,8BAAK;IAKjC;;;OAGG;IACH,oBAAY,YAA2C;;QAA3C,6BAAA,EAAA,mCAA2C;QAAvD,iBAOC;QANG,IAAM,SAAS,GAAG,WAAW,SAAS,CAAC;QACvC,QAAA,kBAAM,YAAY,CAAC,SAAC;QAEpB,0CAA0C;QAC1C,8EAA8E;QAC9E,KAAI,CAAC,SAAS,GAAG,SAAS,CAAC;;IAC/B,CAAC;IACL,iBAAC;AAAD,CAAC,AAjBD,CAAgC,KAAK,GAiBpC;AAjBY,gCAAU","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\r\n/** Error thrown when an HTTP request fails. */\r\nexport class HttpError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // tslint:disable-next-line:variable-name\r\n private __proto__: Error;\r\n\r\n /** The HTTP status code represented by this error. */\r\n public statusCode: number;\r\n\r\n /** Constructs a new instance of {@link @aspnet/signalr.HttpError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n * @param {number} statusCode The HTTP status code represented by this error.\r\n */\r\n constructor(errorMessage: string, statusCode: number) {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n this.statusCode = statusCode;\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when a timeout elapses. */\r\nexport class TimeoutError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // tslint:disable-next-line:variable-name\r\n private __proto__: Error;\r\n\r\n /** Constructs a new instance of {@link @aspnet/signalr.TimeoutError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage: string = \"A timeout occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n\r\n/** Error thrown when an action is aborted. */\r\nexport class AbortError extends Error {\r\n // @ts-ignore: Intentionally unused.\r\n // tslint:disable-next-line:variable-name\r\n private __proto__: Error;\r\n\r\n /** Constructs a new instance of {@link AbortError}.\r\n *\r\n * @param {string} errorMessage A descriptive error message.\r\n */\r\n constructor(errorMessage: string = \"An abort occurred.\") {\r\n const trueProto = new.target.prototype;\r\n super(errorMessage);\r\n\r\n // Workaround issue in Typescript compiler\r\n // https://github.com/Microsoft/TypeScript/issues/13965#issuecomment-278570200\r\n this.__proto__ = trueProto;\r\n }\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
var TextMessageFormat_1 = require("./TextMessageFormat");
var Utils_1 = require("./Utils");
/** @private */
var HandshakeProtocol = /** @class */ (function () {
function HandshakeProtocol() {
}
// Handshake request is always JSON
HandshakeProtocol.prototype.writeHandshakeRequest = function (handshakeRequest) {
return TextMessageFormat_1.TextMessageFormat.write(JSON.stringify(handshakeRequest));
};
HandshakeProtocol.prototype.parseHandshakeResponse = function (data) {
var responseMessage;
var messageData;
var remainingData;
if (Utils_1.isArrayBuffer(data) || (typeof Buffer !== "undefined" && data instanceof Buffer)) {
// Format is binary but still need to read JSON text from handshake response
var binaryData = new Uint8Array(data);
var separatorIndex = binaryData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparatorCode);
if (separatorIndex === -1) {
throw new Error("Message is incomplete.");
}
// content before separator is handshake response
// optional content after is additional messages
var responseLength = separatorIndex + 1;
messageData = String.fromCharCode.apply(null, binaryData.slice(0, responseLength));
remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;
}
else {
var textData = data;
var separatorIndex = textData.indexOf(TextMessageFormat_1.TextMessageFormat.RecordSeparator);
if (separatorIndex === -1) {
throw new Error("Message is incomplete.");
}
// content before separator is handshake response
// optional content after is additional messages
var responseLength = separatorIndex + 1;
messageData = textData.substring(0, responseLength);
remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;
}
// At this point we should have just the single handshake message
var messages = TextMessageFormat_1.TextMessageFormat.parse(messageData);
var response = JSON.parse(messages[0]);
if (response.type) {
throw new Error("Expected a handshake response from the server.");
}
responseMessage = response;
// multiple messages could have arrived with handshake
// return additional data to be parsed as usual, or null if all parsed
return [remainingData, responseMessage];
};
return HandshakeProtocol;
}());
exports.HandshakeProtocol = HandshakeProtocol;
//# sourceMappingURL=HandshakeProtocol.js.map
\ No newline at end of file
{"version":3,"file":"HandshakeProtocol.js","sourceRoot":"","sources":["../../src/HandshakeProtocol.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,yDAAwD;AACxD,iCAAwC;AAaxC,eAAe;AACf;IAAA;IAkDA,CAAC;IAjDG,mCAAmC;IAC5B,iDAAqB,GAA5B,UAA6B,gBAAyC;QAClE,OAAO,qCAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACrE,CAAC;IAEM,kDAAsB,GAA7B,UAA8B,IAAS;QACnC,IAAI,eAAyC,CAAC;QAC9C,IAAI,WAAmB,CAAC;QACxB,IAAI,aAAkB,CAAC;QAEvB,IAAI,qBAAa,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,MAAM,KAAK,WAAW,IAAI,IAAI,YAAY,MAAM,CAAC,EAAE;YAClF,4EAA4E;YAC5E,IAAM,UAAU,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;YACxC,IAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,qCAAiB,CAAC,mBAAmB,CAAC,CAAC;YACjF,IAAI,cAAc,K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AC;SACrE;QACD,eAAe,GAAG,QAAQ,CAAC;QAE3B,sDAAsD;QACtD,sEAAsE;QACtE,OAAO,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IAC5C,CAAC;IACL,wBAAC;AAAD,CAAC,AAlDD,IAkDC;AAlDY,8CAAiB","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\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\nimport { isArrayBuffer } from \"./Utils\";\r\n\r\n/** @private */\r\nexport interface HandshakeRequestMessage {\r\n readonly protocol: string;\r\n readonly version: number;\r\n}\r\n\r\n/** @private */\r\nexport interface HandshakeResponseMessage {\r\n readonly error: string;\r\n}\r\n\r\n/** @private */\r\nexport class HandshakeProtocol {\r\n // Handshake request is always JSON\r\n public writeHandshakeRequest(handshakeRequest: HandshakeRequestMessage): string {\r\n return TextMessageFormat.write(JSON.stringify(handshakeRequest));\r\n }\r\n\r\n public parseHandshakeResponse(data: any): [any, HandshakeResponseMessage] {\r\n let responseMessage: HandshakeResponseMessage;\r\n let messageData: string;\r\n let remainingData: any;\r\n\r\n if (isArrayBuffer(data) || (typeof Buffer !== \"undefined\" && data instanceof Buffer)) {\r\n // Format is binary but still need to read JSON text from handshake response\r\n const binaryData = new Uint8Array(data);\r\n const separatorIndex = binaryData.indexOf(TextMessageFormat.RecordSeparatorCode);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = String.fromCharCode.apply(null, binaryData.slice(0, responseLength));\r\n remainingData = (binaryData.byteLength > responseLength) ? binaryData.slice(responseLength).buffer : null;\r\n } else {\r\n const textData: string = data;\r\n const separatorIndex = textData.indexOf(TextMessageFormat.RecordSeparator);\r\n if (separatorIndex === -1) {\r\n throw new Error(\"Message is incomplete.\");\r\n }\r\n\r\n // content before separator is handshake response\r\n // optional content after is additional messages\r\n const responseLength = separatorIndex + 1;\r\n messageData = textData.substring(0, responseLength);\r\n remainingData = (textData.length > responseLength) ? textData.substring(responseLength) : null;\r\n }\r\n\r\n // At this point we should have just the single handshake message\r\n const messages = TextMessageFormat.parse(messageData);\r\n const response = JSON.parse(messages[0]);\r\n if (response.type) {\r\n throw new Error(\"Expected a handshake response from the server.\");\r\n }\r\n responseMessage = response;\r\n\r\n // multiple messages could have arrived with handshake\r\n // return additional data to be parsed as usual, or null if all parsed\r\n return [remainingData, responseMessage];\r\n }\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
/** Represents an HTTP response. */
var HttpResponse = /** @class */ (function () {
function HttpResponse(statusCode, statusText, content) {
this.statusCode = statusCode;
this.statusText = statusText;
this.content = content;
}
return HttpResponse;
}());
exports.HttpResponse = HttpResponse;
/** Abstraction over an HTTP client.
*
* This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.
*/
var HttpClient = /** @class */ (function () {
function HttpClient() {
}
HttpClient.prototype.get = function (url, options) {
return this.send(__assign({}, options, { method: "GET", url: url }));
};
HttpClient.prototype.post = function (url, options) {
return this.send(__assign({}, options, { method: "POST", url: url }));
};
HttpClient.prototype.delete = function (url, options) {
return this.send(__assign({}, options, { method: "DELETE", url: url }));
};
/** Gets all cookies that apply to the specified URL.
*
* @param url The URL that the cookies are valid for.
* @returns {string} A string containing all the key-value cookie pairs for the specified URL.
*/
// @ts-ignore
HttpClient.prototype.getCookieString = function (url) {
return "";
};
return HttpClient;
}());
exports.HttpClient = HttpClient;
//# sourceMappingURL=HttpClient.js.map
\ No newline at end of file
{"version":3,"file":"HttpClient.js","sourceRoot":"","sources":["../../src/HttpClient.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;;AA4B/G,mCAAmC;AACnC;IA6BI,sBACoB,UAAkB,EAClB,UAAmB,EACnB,OAA8B;QAF9B,eAAU,GAAV,UAAU,CAAQ;QAClB,eAAU,GAAV,UAAU,CAAS;QACnB,YAAO,GAAP,OAAO,CAAuB;IAClD,CAAC;IACL,mBAAC;AAAD,CAAC,AAlCD,IAkCC;AAlCY,oCAAY;AAoCzB;;;GAGG;AACH;IAAA;IAmFA,CAAC;IApEU,wBAAG,GAAV,UAAW,GAAW,EAAE,OAAqB;QACzC,OAAO,IAAI,CAAC,IAAI,cACT,OAAO,IACV,MAAM,EAAE,KAAK,EACb,GAAG,KAAA,IACL,CAAC;IACP,CAAC;IAgBM,yBAAI,GAAX,UAAY,GAAW,EAAE,OAAqB;QAC1C,OAAO,IAAI,CAAC,IAAI,cACT,OAAO,IACV,MAAM,EAAE,MAAM,EACd,GAAG,KAAA,IACL,CAAC;IACP,CAAC;IAgBM,2BAAM,GAAb,UAAc,GAAW,EAAE,OAAqB;QAC5C,OAAO,IAAI,CAAC,IAAI,cACT,OAAO,IACV,MAAM,EAAE,QAAQ,EAChB,GAAG,KAAA,IACL,CAAC;IACP,CAAC;IASD;;;;OAIG;IACH,aAAa;IACN,oCAAe,GAAtB,UAAuB,GAAW;QAC9B,OAAO,EAAE,CAAC;IACd,CAAC;IACL,iBAAC;AAAD,CAAC,AAnFD,IAmFC;AAnFqB,gCAAU","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\r\nimport { AbortSignal } from \"./AbortController\";\r\n\r\n/** Represents an HTTP request. */\r\nexport interface HttpRequest {\r\n /** The HTTP method to use for the request. */\r\n method?: string;\r\n\r\n /** The URL for the request. */\r\n url?: string;\r\n\r\n /** The body content for the request. May be a string or an ArrayBuffer (for binary data). */\r\n content?: string | ArrayBuffer;\r\n\r\n /** An object describing headers to apply to the request. */\r\n headers?: { [key: string]: string };\r\n\r\n /** The XMLHttpRequestResponseType to apply to the request. */\r\n responseType?: XMLHttpRequestResponseType;\r\n\r\n /** An AbortSignal that can be monitored for cancellation. */\r\n abortSignal?: AbortSignal;\r\n\r\n /** The time to wait for the request to complete before throwing a TimeoutError. Measured in milliseconds. */\r\n timeout?: number;\r\n}\r\n\r\n/** Represents an HTTP response. */\r\nexport class HttpResponse {\r\n /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n */\r\n constructor(statusCode: number);\r\n\r\n /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code and message.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n * @param {string} statusText The status message of the response.\r\n */\r\n constructor(statusCode: number, statusText: string);\r\n\r\n /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code, message and string content.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n * @param {string} statusText The status message of the response.\r\n * @param {string} content The content of the response.\r\n */\r\n constructor(statusCode: number, statusText: string, content: string);\r\n\r\n /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code, message and binary content.\r\n *\r\n * @param {number} statusCode The status code of the response.\r\n * @param {string} statusText The status message of the response.\r\n * @param {ArrayBuffer} content The content of the response.\r\n */\r\n constructor(statusCode: number, statusText: string, content: ArrayBuffer);\r\n constructor(\r\n public readonly statusCode: number,\r\n public readonly statusText?: string,\r\n public readonly content?: string | ArrayBuffer) {\r\n }\r\n}\r\n\r\n/** Abstraction over an HTTP client.\r\n *\r\n * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms.\r\n */\r\nexport abstract class HttpClient {\r\n /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @returns {Promise<HttpResponse>} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public get(url: string): Promise<HttpResponse>;\r\n\r\n /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter.\r\n * @returns {Promise<HttpResponse>} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public get(url: string, options: HttpRequest): Promise<HttpResponse>;\r\n public get(url: string, options?: HttpRequest): Promise<HttpResponse> {\r\n return this.send({\r\n ...options,\r\n method: \"GET\",\r\n url,\r\n });\r\n }\r\n\r\n /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @returns {Promise<HttpResponse>} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public post(url: string): Promise<HttpResponse>;\r\n\r\n /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter.\r\n * @returns {Promise<HttpResponse>} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public post(url: string, options: HttpRequest): Promise<HttpResponse>;\r\n public post(url: string, options?: HttpRequest): Promise<HttpResponse> {\r\n return this.send({\r\n ...options,\r\n method: \"POST\",\r\n url,\r\n });\r\n }\r\n\r\n /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @returns {Promise<HttpResponse>} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public delete(url: string): Promise<HttpResponse>;\r\n\r\n /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {string} url The URL for the request.\r\n * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter.\r\n * @returns {Promise<HttpResponse>} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public delete(url: string, options: HttpRequest): Promise<HttpResponse>;\r\n public delete(url: string, options?: HttpRequest): Promise<HttpResponse> {\r\n return this.send({\r\n ...options,\r\n method: \"DELETE\",\r\n url,\r\n });\r\n }\r\n\r\n /** Issues an HTTP request to the specified URL, returning a {@link Promise} that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result.\r\n *\r\n * @param {HttpRequest} request An {@link @aspnet/signalr.HttpRequest} describing the request to send.\r\n * @returns {Promise<HttpResponse>} A Promise that resolves with an HttpResponse describing the response, or rejects with an Error indicating a failure.\r\n */\r\n public abstract send(request: HttpRequest): Promise<HttpResponse>;\r\n\r\n /** Gets all cookies that apply to the specified URL.\r\n *\r\n * @param url The URL that the cookies are valid for.\r\n * @returns {string} A string containing all the key-value cookie pairs for the specified URL.\r\n */\r\n // @ts-ignore\r\n public getCookieString(url: string): string {\r\n return \"\";\r\n }\r\n}\r\n"]}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
var HttpConnection_1 = require("./HttpConnection");
var HubConnection_1 = require("./HubConnection");
var JsonHubProtocol_1 = require("./JsonHubProtocol");
var Loggers_1 = require("./Loggers");
var Utils_1 = require("./Utils");
/** A builder for configuring {@link @aspnet/signalr.HubConnection} instances. */
var HubConnectionBuilder = /** @class */ (function () {
function HubConnectionBuilder() {
}
HubConnectionBuilder.prototype.configureLogging = function (logging) {
Utils_1.Arg.isRequired(logging, "logging");
if (isLogger(logging)) {
this.logger = logging;
}
else {
this.logger = new Utils_1.ConsoleLogger(logging);
}
return this;
};
HubConnectionBuilder.prototype.withUrl = function (url, transportTypeOrOptions) {
Utils_1.Arg.isRequired(url, "url");
this.url = url;
// Flow-typing knows where it's at. Since HttpTransportType is a number and IHttpConnectionOptions is guaranteed
// to be an object, we know (as does TypeScript) this comparison is all we need to figure out which overload was called.
if (typeof transportTypeOrOptions === "object") {
this.httpConnectionOptions = transportTypeOrOptions;
}
else {
this.httpConnectionOptions = {
transport: transportTypeOrOptions,
};
}
return this;
};
/** Configures the {@link @aspnet/signalr.HubConnection} to use the specified Hub Protocol.
*
* @param {IHubProtocol} protocol The {@link @aspnet/signalr.IHubProtocol} implementation to use.
*/
HubConnectionBuilder.prototype.withHubProtocol = function (protocol) {
Utils_1.Arg.isRequired(protocol, "protocol");
this.protocol = protocol;
return this;
};
/** Creates a {@link @aspnet/signalr.HubConnection} from the configuration options specified in this builder.
*
* @returns {HubConnection} The configured {@link @aspnet/signalr.HubConnection}.
*/
HubConnectionBuilder.prototype.build = function () {
// If httpConnectionOptions has a logger, use it. Otherwise, override it with the one
// provided to configureLogger
var httpConnectionOptions = this.httpConnectionOptions || {};
// If it's 'null', the user **explicitly** asked for null, don't mess with it.
if (httpConnectionOptions.logger === undefined) {
// If our logger is undefined or null, that's OK, the HttpConnection constructor will handle it.
httpConnectionOptions.logger = this.logger;
}
// Now create the connection
if (!this.url) {
throw new Error("The 'HubConnectionBuilder.withUrl' method must be called before building the connection.");
}
var connection = new HttpConnection_1.HttpConnection(this.url, httpConnectionOptions);
return HubConnection_1.HubConnection.create(connection, this.logger || Loggers_1.NullLogger.instance, this.protocol || new JsonHubProtocol_1.JsonHubProtocol());
};
return HubConnectionBuilder;
}());
exports.HubConnectionBuilder = HubConnectionBuilder;
function isLogger(logger) {
return logger.log !== undefined;
}
//# sourceMappingURL=HubConnectionBuilder.js.map
\ No newline at end of file
{"version":3,"file":"HubConnectionBuilder.js","sourceRoot":"","sources":["../../src/HubConnectionBuilder.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,mDAAkD;AAClD,iDAAgD;AAKhD,qDAAoD;AACpD,qCAAuC;AACvC,iCAA6C;AAE7C,iFAAiF;AACjF;IAAA;IAwHA,CAAC;IA3FU,+CAAgB,GAAvB,UAAwB,OAA2B;QAC/C,WAAG,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAEnC,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAE;YACnB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;SACzB;aAAM;YACH,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAa,CAAC,OAAO,CAAC,CAAC;SAC5C;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IA0BM,sCAAO,GAAd,UAAe,GAAW,EAAE,sBAAmE;QAC3F,WAAG,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;QAE3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QAEf,gHAAgH;QAChH,wHAAwH;QACxH,IAAI,OAAO,sBAAsB,KAAK,QAAQ,EAAE;YAC5C,IAAI,CAAC,qBAAqB,GAAG,sBAAsB,CAAC;SACvD;aAAM;YACH,IAAI,CAAC,qBAAqB,GAAG;gBACzB,SAAS,EAAE,sBAAsB;aACpC,CAAC;SACL;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,8CAAe,GAAtB,UAAuB,QAAsB;QACzC,WAAG,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAErC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACI,oCAAK,GAAZ;QACI,qFAAqF;QACrF,8BAA8B;QAC9B,IAAM,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,IAAI,EAAE,CAAC;QAE/D,8EAA8E;QAC9E,IAAI,qBAAqB,CAAC,MAAM,KAAK,SAAS,EAAE;YAC5C,gGAAgG;YAChG,qBAAqB,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;SAC9C;QAED,4BAA4B;QAC5B,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE;YACX,MAAM,IAAI,KAAK,CAAC,0FAA0F,CAAC,CAAC;SAC/G;QACD,IAAM,UAAU,GAAG,IAAI,+BAAc,CAAC,IAAI,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAC;QAEvE,OAAO,6BAAa,CAAC,MAAM,CACvB,UAAU,EACV,IAAI,CAAC,MAAM,IAAI,oBAAU,CAAC,QAAQ,EAClC,IAAI,CAAC,QAAQ,IAAI,IAAI,iCAAe,EAAE,CAAC,CAAC;IAChD,CAAC;IACL,2BAAC;AAAD,CAAC,AAxHD,IAwHC;AAxHY,oDAAoB;AA0HjC,kBAAkB,MAAW;IACzB,OAAO,MAAM,CAAC,GAAG,KAAK,SAAS,CAAC;AACpC,CAAC","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\r\nimport { HttpConnection } from \"./HttpConnection\";\r\nimport { HubConnection } from \"./HubConnection\";\r\nimport { IHttpConnectionOptions } from \"./IHttpConnectionOptions\";\r\nimport { IHubProtocol } from \"./IHubProtocol\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { HttpTransportType } from \"./ITransport\";\r\nimport { JsonHubProtocol } from \"./JsonHubProtocol\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { Arg, ConsoleLogger } from \"./Utils\";\r\n\r\n/** A builder for configuring {@link @aspnet/signalr.HubConnection} instances. */\r\nexport class HubConnectionBuilder {\r\n /** @internal */\r\n public protocol?: IHubProtocol;\r\n /** @internal */\r\n public httpConnectionOptions?: IHttpConnectionOptions;\r\n /** @internal */\r\n public url?: string;\r\n /** @internal */\r\n public logger?: ILogger;\r\n\r\n /** Configures console logging for the {@link @aspnet/signalr.HubConnection}.\r\n *\r\n * @param {LogLevel} logLevel The minimum level of messages to log. Anything at this level, or a more severe level, will be logged.\r\n * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public configureLogging(logLevel: LogLevel): HubConnectionBuilder;\r\n\r\n /** Configures custom logging for the {@link @aspnet/signalr.HubConnection}.\r\n *\r\n * @param {ILogger} logger An object implementing the {@link @aspnet/signalr.ILogger} interface, which will be used to write all log messages.\r\n * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public configureLogging(logger: ILogger): HubConnectionBuilder;\r\n /** Configures custom logging for the {@link @aspnet/signalr.HubConnection}.\r\n *\r\n * @param {LogLevel | ILogger} logging An object implementing the {@link @aspnet/signalr.ILogger} interface or {@link @aspnet/signalr.LogLevel}.\r\n * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public configureLogging(logging: LogLevel | ILogger): HubConnectionBuilder;\r\n public configureLogging(logging: LogLevel | ILogger): HubConnectionBuilder {\r\n Arg.isRequired(logging, \"logging\");\r\n\r\n if (isLogger(logging)) {\r\n this.logger = logging;\r\n } else {\r\n this.logger = new ConsoleLogger(logging);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Configures the {@link @aspnet/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL.\r\n *\r\n * The transport will be selected automatically based on what the server and client support.\r\n *\r\n * @param {string} url The URL the connection will use.\r\n * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public withUrl(url: string): HubConnectionBuilder;\r\n\r\n /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified HTTP-based transport to connect to the specified URL.\r\n *\r\n * @param {string} url The URL the connection will use.\r\n * @param {HttpTransportType} transportType The specific transport to use.\r\n * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public withUrl(url: string, transportType: HttpTransportType): HubConnectionBuilder;\r\n\r\n /** Configures the {@link @aspnet/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL.\r\n *\r\n * @param {string} url The URL the connection will use.\r\n * @param {IHttpConnectionOptions} options An options object used to configure the connection.\r\n * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining.\r\n */\r\n public withUrl(url: string, options: IHttpConnectionOptions): HubConnectionBuilder;\r\n public withUrl(url: string, transportTypeOrOptions?: IHttpConnectionOptions | HttpTransportType): HubConnectionBuilder {\r\n Arg.isRequired(url, \"url\");\r\n\r\n this.url = url;\r\n\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 = transportTypeOrOptions;\r\n } else {\r\n this.httpConnectionOptions = {\r\n transport: transportTypeOrOptions,\r\n };\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified Hub Protocol.\r\n *\r\n * @param {IHubProtocol} protocol The {@link @aspnet/signalr.IHubProtocol} implementation to use.\r\n */\r\n public withHubProtocol(protocol: IHubProtocol): HubConnectionBuilder {\r\n Arg.isRequired(protocol, \"protocol\");\r\n\r\n this.protocol = protocol;\r\n return this;\r\n }\r\n\r\n /** Creates a {@link @aspnet/signalr.HubConnection} from the configuration options specified in this builder.\r\n *\r\n * @returns {HubConnection} The configured {@link @aspnet/signalr.HubConnection}.\r\n */\r\n public build(): HubConnection {\r\n // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one\r\n // provided to configureLogger\r\n const httpConnectionOptions = this.httpConnectionOptions || {};\r\n\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\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 const connection = new HttpConnection(this.url, httpConnectionOptions);\r\n\r\n return HubConnection.create(\r\n connection,\r\n this.logger || NullLogger.instance,\r\n this.protocol || new JsonHubProtocol());\r\n }\r\n}\r\n\r\nfunction isLogger(logger: any): logger is ILogger {\r\n return logger.log !== undefined;\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IConnection.js.map
\ No newline at end of file
{"version":3,"file":"IConnection.js","sourceRoot":"","sources":["../../src/IConnection.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G","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\r\nimport { TransferFormat } from \"./ITransport\";\r\n\r\n/** @private */\r\nexport interface IConnection {\r\n readonly features: any;\r\n\r\n start(transferFormat: TransferFormat): Promise<void>;\r\n send(data: string | ArrayBuffer): Promise<void>;\r\n stop(error?: Error): Promise<void>;\r\n\r\n onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n onclose: ((error?: Error) => void) | null;\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=IHttpConnectionOptions.js.map
\ No newline at end of file
{"version":3,"file":"IHttpConnectionOptions.js","sourceRoot":"","sources":["../../src/IHttpConnectionOptions.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G","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\r\nimport { HttpClient } from \"./HttpClient\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { HttpTransportType, ITransport } from \"./ITransport\";\r\nimport { EventSourceConstructor, WebSocketConstructor } from \"./Polyfills\";\r\n\r\n/** Options provided to the 'withUrl' method on {@link @aspnet/signalr.HubConnectionBuilder} to configure options for the HTTP-based transports. */\r\nexport interface IHttpConnectionOptions {\r\n /** An {@link @aspnet/signalr.HttpClient} that will be used to make HTTP requests. */\r\n httpClient?: HttpClient;\r\n\r\n /** An {@link @aspnet/signalr.HttpTransportType} value specifying the transport to use for the connection. */\r\n transport?: HttpTransportType | ITransport;\r\n\r\n /** Configures the logger used for logging.\r\n *\r\n * Provide an {@link @aspnet/signalr.ILogger} instance, and log messages will be logged via that instance. Alternatively, provide a value from\r\n * the {@link @aspnet/signalr.LogLevel} enumeration and a default logger which logs to the Console will be configured to log messages of the specified\r\n * level (or higher).\r\n */\r\n logger?: ILogger | LogLevel;\r\n\r\n /** A function that provides an access token required for HTTP Bearer authentication.\r\n *\r\n * @returns {string | Promise<string>} A string containing the access token, or a Promise that resolves to a string containing the access token.\r\n */\r\n accessTokenFactory?(): string | Promise<string>;\r\n\r\n /** A boolean indicating if message content should be logged.\r\n *\r\n * Message content can contain sensitive user data, so this is disabled by default.\r\n */\r\n logMessageContent?: boolean;\r\n\r\n /** A boolean indicating if negotiation should be skipped.\r\n *\r\n * Negotiation can only be skipped when the {@link @aspnet/signalr.IHttpConnectionOptions.transport} property is set to 'HttpTransportType.WebSockets'.\r\n */\r\n skipNegotiation?: boolean;\r\n\r\n // Used for unit testing and code spelunkers\r\n /** A constructor that can be used to create a WebSocket.\r\n *\r\n * @internal\r\n */\r\n WebSocket?: WebSocketConstructor;\r\n\r\n // Used for unit testing and code spelunkers\r\n /** A constructor that can be used to create an EventSource.\r\n *\r\n * @internal\r\n */\r\n EventSource?: EventSourceConstructor;\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
/** Defines the type of a Hub Message. */
var MessageType;
(function (MessageType) {
/** Indicates the message is an Invocation message and implements the {@link @aspnet/signalr.InvocationMessage} interface. */
MessageType[MessageType["Invocation"] = 1] = "Invocation";
/** Indicates the message is a StreamItem message and implements the {@link @aspnet/signalr.StreamItemMessage} interface. */
MessageType[MessageType["StreamItem"] = 2] = "StreamItem";
/** Indicates the message is a Completion message and implements the {@link @aspnet/signalr.CompletionMessage} interface. */
MessageType[MessageType["Completion"] = 3] = "Completion";
/** Indicates the message is a Stream Invocation message and implements the {@link @aspnet/signalr.StreamInvocationMessage} interface. */
MessageType[MessageType["StreamInvocation"] = 4] = "StreamInvocation";
/** Indicates the message is a Cancel Invocation message and implements the {@link @aspnet/signalr.CancelInvocationMessage} interface. */
MessageType[MessageType["CancelInvocation"] = 5] = "CancelInvocation";
/** Indicates the message is a Ping message and implements the {@link @aspnet/signalr.PingMessage} interface. */
MessageType[MessageType["Ping"] = 6] = "Ping";
/** Indicates the message is a Close message and implements the {@link @aspnet/signalr.CloseMessage} interface. */
MessageType[MessageType["Close"] = 7] = "Close";
})(MessageType = exports.MessageType || (exports.MessageType = {}));
//# sourceMappingURL=IHubProtocol.js.map
\ No newline at end of file
{"version":3,"file":"IHubProtocol.js","sourceRoot":"","sources":["../../src/IHubProtocol.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAK/G,yCAAyC;AACzC,IAAY,WAeX;AAfD,WAAY,WAAW;IACnB,6HAA6H;IAC7H,yDAAc,CAAA;IACd,4HAA4H;IAC5H,yDAAc,CAAA;IACd,4HAA4H;IAC5H,yDAAc,CAAA;IACd,yIAAyI;IACzI,qEAAoB,CAAA;IACpB,yIAAyI;IACzI,qEAAoB,CAAA;IACpB,gHAAgH;IAChH,6CAAQ,CAAA;IACR,kHAAkH;IAClH,+CAAS,CAAA;AACb,CAAC,EAfW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAetB","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\r\nimport { ILogger } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\n\r\n/** Defines the type of a Hub Message. */\r\nexport enum MessageType {\r\n /** Indicates the message is an Invocation message and implements the {@link @aspnet/signalr.InvocationMessage} interface. */\r\n Invocation = 1,\r\n /** Indicates the message is a StreamItem message and implements the {@link @aspnet/signalr.StreamItemMessage} interface. */\r\n StreamItem = 2,\r\n /** Indicates the message is a Completion message and implements the {@link @aspnet/signalr.CompletionMessage} interface. */\r\n Completion = 3,\r\n /** Indicates the message is a Stream Invocation message and implements the {@link @aspnet/signalr.StreamInvocationMessage} interface. */\r\n StreamInvocation = 4,\r\n /** Indicates the message is a Cancel Invocation message and implements the {@link @aspnet/signalr.CancelInvocationMessage} interface. */\r\n CancelInvocation = 5,\r\n /** Indicates the message is a Ping message and implements the {@link @aspnet/signalr.PingMessage} interface. */\r\n Ping = 6,\r\n /** Indicates the message is a Close message and implements the {@link @aspnet/signalr.CloseMessage} interface. */\r\n Close = 7,\r\n}\r\n\r\n/** Defines a dictionary of string keys and string values representing headers attached to a Hub message. */\r\nexport interface MessageHeaders {\r\n /** Gets or sets the header with the specified key. */\r\n [key: string]: string;\r\n}\r\n\r\n/** Union type of all known Hub messages. */\r\nexport type HubMessage =\r\n InvocationMessage |\r\n StreamInvocationMessage |\r\n StreamItemMessage |\r\n CompletionMessage |\r\n CancelInvocationMessage |\r\n PingMessage |\r\n CloseMessage;\r\n\r\n/** Defines properties common to all Hub messages. */\r\nexport interface HubMessageBase {\r\n /** A {@link @aspnet/signalr.MessageType} value indicating the type of this message. */\r\n readonly type: MessageType;\r\n}\r\n\r\n/** Defines properties common to all Hub messages relating to a specific invocation. */\r\nexport interface HubInvocationMessage extends HubMessageBase {\r\n /** A {@link @aspnet/signalr.MessageHeaders} dictionary containing headers attached to the message. */\r\n readonly headers?: MessageHeaders;\r\n /** The ID of the invocation relating to this message.\r\n *\r\n * This is expected to be present for {@link @aspnet/signalr.StreamInvocationMessage} and {@link @aspnet/signalr.CompletionMessage}. It may\r\n * be 'undefined' for an {@link @aspnet/signalr.InvocationMessage} if the sender does not expect a response.\r\n */\r\n readonly invocationId?: string;\r\n}\r\n\r\n/** A hub message representing a non-streaming invocation. */\r\nexport interface InvocationMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Invocation;\r\n /** The target method name. */\r\n readonly target: string;\r\n /** The target method arguments. */\r\n readonly arguments: any[];\r\n}\r\n\r\n/** A hub message representing a streaming invocation. */\r\nexport interface StreamInvocationMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.StreamInvocation;\r\n\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n /** The target method name. */\r\n readonly target: string;\r\n /** The target method arguments. */\r\n readonly arguments: any[];\r\n}\r\n\r\n/** A hub message representing a single item produced as part of a result stream. */\r\nexport interface StreamItemMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.StreamItem;\r\n\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n\r\n /** The item produced by the server. */\r\n readonly item?: any;\r\n}\r\n\r\n/** A hub message representing the result of an invocation. */\r\nexport interface CompletionMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Completion;\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n /** The error produced by the invocation, if any.\r\n *\r\n * Either {@link @aspnet/signalr.CompletionMessage.error} or {@link @aspnet/signalr.CompletionMessage.result} must be defined, but not both.\r\n */\r\n readonly error?: string;\r\n /** The result produced by the invocation, if any.\r\n *\r\n * Either {@link @aspnet/signalr.CompletionMessage.error} or {@link @aspnet/signalr.CompletionMessage.result} must be defined, but not both.\r\n */\r\n readonly result?: any;\r\n}\r\n\r\n/** A hub message indicating that the sender is still active. */\r\nexport interface PingMessage extends HubMessageBase {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Ping;\r\n}\r\n\r\n/** A hub message indicating that the sender is closing the connection.\r\n *\r\n * If {@link @aspnet/signalr.CloseMessage.error} is defined, the sender is closing the connection due to an error.\r\n */\r\nexport interface CloseMessage extends HubMessageBase {\r\n /** @inheritDoc */\r\n readonly type: MessageType.Close;\r\n /** The error that triggered the close, if any.\r\n *\r\n * If this property is undefined, the connection was closed normally and without error.\r\n */\r\n readonly error?: string;\r\n}\r\n\r\n/** A hub message sent to request that a streaming invocation be canceled. */\r\nexport interface CancelInvocationMessage extends HubInvocationMessage {\r\n /** @inheritDoc */\r\n readonly type: MessageType.CancelInvocation;\r\n /** The invocation ID. */\r\n readonly invocationId: string;\r\n}\r\n\r\n/** A protocol abstraction for communicating with SignalR Hubs. */\r\nexport interface IHubProtocol {\r\n /** The name of the protocol. This is used by SignalR to resolve the protocol between the client and server. */\r\n readonly name: string;\r\n /** The version of the protocol. */\r\n readonly version: number;\r\n /** The {@link @aspnet/signalr.TransferFormat} of the protocol. */\r\n readonly transferFormat: TransferFormat;\r\n\r\n /** Creates an array of {@link @aspnet/signalr.HubMessage} objects from the specified serialized representation.\r\n *\r\n * If {@link @aspnet/signalr.IHubProtocol.transferFormat} is 'Text', the `input` parameter must be a string, otherwise it must be an ArrayBuffer.\r\n *\r\n * @param {string | ArrayBuffer | Buffer} input A string, ArrayBuffer, or Buffer 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 parseMessages(input: string | ArrayBuffer | Buffer, logger: ILogger): HubMessage[];\r\n\r\n /** Writes the specified {@link @aspnet/signalr.HubMessage} to a string or ArrayBuffer and returns it.\r\n *\r\n * If {@link @aspnet/signalr.IHubProtocol.transferFormat} is 'Text', the result of this method will be a string, otherwise it will be an ArrayBuffer.\r\n *\r\n * @param {HubMessage} message The message to write.\r\n * @returns {string | ArrayBuffer} A string or ArrayBuffer containing the serialized representation of the message.\r\n */\r\n writeMessage(message: HubMessage): string | ArrayBuffer;\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
// These values are designed to match the ASP.NET Log Levels since that's the pattern we're emulating here.
/** Indicates the severity of a log message.
*
* Log Levels are ordered in increasing severity. So `Debug` is more severe than `Trace`, etc.
*/
var LogLevel;
(function (LogLevel) {
/** Log level for very low severity diagnostic messages. */
LogLevel[LogLevel["Trace"] = 0] = "Trace";
/** Log level for low severity diagnostic messages. */
LogLevel[LogLevel["Debug"] = 1] = "Debug";
/** Log level for informational diagnostic messages. */
LogLevel[LogLevel["Information"] = 2] = "Information";
/** Log level for diagnostic messages that indicate a non-fatal problem. */
LogLevel[LogLevel["Warning"] = 3] = "Warning";
/** Log level for diagnostic messages that indicate a failure in the current operation. */
LogLevel[LogLevel["Error"] = 4] = "Error";
/** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */
LogLevel[LogLevel["Critical"] = 5] = "Critical";
/** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */
LogLevel[LogLevel["None"] = 6] = "None";
})(LogLevel = exports.LogLevel || (exports.LogLevel = {}));
//# sourceMappingURL=ILogger.js.map
\ No newline at end of file
{"version":3,"file":"ILogger.js","sourceRoot":"","sources":["../../src/ILogger.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,2GAA2G;AAC3G;;;GAGG;AACH,IAAY,QAeX;AAfD,WAAY,QAAQ;IAChB,2DAA2D;IAC3D,yCAAS,CAAA;IACT,sDAAsD;IACtD,yCAAS,CAAA;IACT,uDAAuD;IACvD,qDAAe,CAAA;IACf,2EAA2E;IAC3E,6CAAW,CAAA;IACX,0FAA0F;IAC1F,yCAAS,CAAA;IACT,4GAA4G;IAC5G,+CAAY,CAAA;IACZ,wHAAwH;IACxH,uCAAQ,CAAA;AACZ,CAAC,EAfW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAenB","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\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 enum LogLevel {\r\n /** Log level for very low severity diagnostic messages. */\r\n Trace = 0,\r\n /** Log level for low severity diagnostic messages. */\r\n Debug = 1,\r\n /** Log level for informational diagnostic messages. */\r\n Information = 2,\r\n /** Log level for diagnostic messages that indicate a non-fatal problem. */\r\n Warning = 3,\r\n /** Log level for diagnostic messages that indicate a failure in the current operation. */\r\n Error = 4,\r\n /** Log level for diagnostic messages that indicate a failure that will terminate the entire application. */\r\n Critical = 5,\r\n /** The highest possible log level. Used when configuring logging to indicate that no log messages should be emitted. */\r\n None = 6,\r\n}\r\n\r\n/** An abstraction that provides a sink for diagnostic messages. */\r\nexport interface ILogger {\r\n /** Called by the framework to emit a diagnostic message.\r\n *\r\n * @param {LogLevel} logLevel The severity level of the message.\r\n * @param {string} message The message.\r\n */\r\n log(logLevel: LogLevel, message: string): void;\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
// This will be treated as a bit flag in the future, so we keep it using power-of-two values.
/** Specifies a specific HTTP transport type. */
var HttpTransportType;
(function (HttpTransportType) {
/** Specifies no transport preference. */
HttpTransportType[HttpTransportType["None"] = 0] = "None";
/** Specifies the WebSockets transport. */
HttpTransportType[HttpTransportType["WebSockets"] = 1] = "WebSockets";
/** Specifies the Server-Sent Events transport. */
HttpTransportType[HttpTransportType["ServerSentEvents"] = 2] = "ServerSentEvents";
/** Specifies the Long Polling transport. */
HttpTransportType[HttpTransportType["LongPolling"] = 4] = "LongPolling";
})(HttpTransportType = exports.HttpTransportType || (exports.HttpTransportType = {}));
/** Specifies the transfer format for a connection. */
var TransferFormat;
(function (TransferFormat) {
/** Specifies that only text data will be transmitted over the connection. */
TransferFormat[TransferFormat["Text"] = 1] = "Text";
/** Specifies that binary data will be transmitted over the connection. */
TransferFormat[TransferFormat["Binary"] = 2] = "Binary";
})(TransferFormat = exports.TransferFormat || (exports.TransferFormat = {}));
//# sourceMappingURL=ITransport.js.map
\ No newline at end of file
{"version":3,"file":"ITransport.js","sourceRoot":"","sources":["../../src/ITransport.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,6FAA6F;AAC7F,gDAAgD;AAChD,IAAY,iBASX;AATD,WAAY,iBAAiB;IACzB,yCAAyC;IACzC,yDAAQ,CAAA;IACR,0CAA0C;IAC1C,qEAAc,CAAA;IACd,kDAAkD;IAClD,iFAAoB,CAAA;IACpB,4CAA4C;IAC5C,uEAAe,CAAA;AACnB,CAAC,EATW,iBAAiB,GAAjB,yBAAiB,KAAjB,yBAAiB,QAS5B;AAED,sDAAsD;AACtD,IAAY,cAKX;AALD,WAAY,cAAc;IACtB,6EAA6E;IAC7E,mDAAQ,CAAA;IACR,0EAA0E;IAC1E,uDAAU,CAAA;AACd,CAAC,EALW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAKzB","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\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 enum HttpTransportType {\r\n /** Specifies no transport preference. */\r\n None = 0,\r\n /** Specifies the WebSockets transport. */\r\n WebSockets = 1,\r\n /** Specifies the Server-Sent Events transport. */\r\n ServerSentEvents = 2,\r\n /** Specifies the Long Polling transport. */\r\n LongPolling = 4,\r\n}\r\n\r\n/** Specifies the transfer format for a connection. */\r\nexport enum TransferFormat {\r\n /** Specifies that only text data will be transmitted over the connection. */\r\n Text = 1,\r\n /** Specifies that binary data will be transmitted over the connection. */\r\n Binary = 2,\r\n}\r\n\r\n/** An abstraction over the behavior of transports. This is designed to support the framework and not intended for use by applications. */\r\nexport interface ITransport {\r\n connect(url: string, transferFormat: TransferFormat): Promise<void>;\r\n send(data: any): Promise<void>;\r\n stop(): Promise<void>;\r\n onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n onclose: ((error?: Error) => void) | null;\r\n}\r\n"]}
\ No newline at end of file
此差异已折叠。
{"version":3,"file":"JsonHubProtocol.js","sourceRoot":"","sources":["../../src/JsonHubProtocol.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAE/G,+CAAgI;AAChI,qCAA8C;AAC9C,2CAA8C;AAC9C,qCAAuC;AACvC,yDAAwD;AAExD,IAAM,sBAAsB,GAAW,MAAM,CAAC;AAE9C,wCAAwC;AACxC;IAAA;QAEI,kBAAkB;QACF,SAAI,GAAW,sBAAsB,CAAC;QACtD,kBAAkB;QACF,YAAO,GAAW,CAAC,CAAC;QAEpC,kBAAkB;QACF,mBAAc,GAAmB,2BAAc,CAAC,IAAI,CAAC;IAmGzE,CAAC;IAjGG;;;;OAIG;IACI,uCAAa,GAApB,UAAqB,KAAa,EAAE,MAAe;QAC/C,2HAA2H;QAC3H,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;SAC9E;QAED,IAAI,CAAC,KAAK,EAAE;YACR,OAAO,EAAE,CAAC;SACb;QAED,IAAI,MAAM,KAAK,IAAI,EAAE;YACjB,MAAM,GAAG,oBAAU,CAAC,QAAQ,CAAC;SAChC;QAED,qBAAqB;QACrB,IAAM,QAAQ,GAAG,qCAAiB,CAAC,KAAK,CAAC,KA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C,OAAO,CAAC,MAAM,EAAE,yCAAyC,CAAC,CAAC;QAErF,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE;YACpC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,YAAY,EAAE,yCAAyC,CAAC,CAAC;SAC9F;IACL,CAAC;IAEO,6CAAmB,GAA3B,UAA4B,OAA0B;QAClD,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,YAAY,EAAE,yCAAyC,CAAC,CAAC;QAE3F,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE;YAC5B,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC9D;IACL,CAAC;IAEO,6CAAmB,GAA3B,UAA4B,OAA0B;QAClD,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC9D;QAED,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,KAAK,EAAE;YAClC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,KAAK,EAAE,yCAAyC,CAAC,CAAC;SACvF;QAED,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,YAAY,EAAE,yCAAyC,CAAC,CAAC;IAC/F,CAAC;IAEO,8CAAoB,GAA5B,UAA6B,KAAU,EAAE,YAAoB;QACzD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,EAAE;YAC3C,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;SACjC;IACL,CAAC;IACL,sBAAC;AAAD,CAAC,AA3GD,IA2GC;AA3GY,0CAAe","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\r\nimport { CompletionMessage, HubMessage, IHubProtocol, InvocationMessage, MessageType, StreamItemMessage } from \"./IHubProtocol\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { TransferFormat } from \"./ITransport\";\r\nimport { NullLogger } from \"./Loggers\";\r\nimport { TextMessageFormat } from \"./TextMessageFormat\";\r\n\r\nconst JSON_HUB_PROTOCOL_NAME: string = \"json\";\r\n\r\n/** Implements the JSON Hub Protocol. */\r\nexport class JsonHubProtocol implements IHubProtocol {\r\n\r\n /** @inheritDoc */\r\n public readonly name: string = JSON_HUB_PROTOCOL_NAME;\r\n /** @inheritDoc */\r\n public readonly version: number = 1;\r\n\r\n /** @inheritDoc */\r\n public readonly transferFormat: TransferFormat = TransferFormat.Text;\r\n\r\n /** Creates an array of {@link @aspnet/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 public parseMessages(input: string, logger: ILogger): HubMessage[] {\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\r\n if (!input) {\r\n return [];\r\n }\r\n\r\n if (logger === null) {\r\n logger = NullLogger.instance;\r\n }\r\n\r\n // Parse the messages\r\n const messages = TextMessageFormat.parse(input);\r\n\r\n const hubMessages = [];\r\n for (const message of messages) {\r\n const parsedMessage = JSON.parse(message) as HubMessage;\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\r\n return hubMessages;\r\n }\r\n\r\n /** Writes the specified {@link @aspnet/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 public writeMessage(message: HubMessage): string {\r\n return TextMessageFormat.write(JSON.stringify(message));\r\n }\r\n\r\n private isInvocationMessage(message: InvocationMessage): void {\r\n this.assertNotEmptyString(message.target, \"Invalid payload for Invocation message.\");\r\n\r\n if (message.invocationId !== undefined) {\r\n this.assertNotEmptyString(message.invocationId, \"Invalid payload for Invocation message.\");\r\n }\r\n }\r\n\r\n private isStreamItemMessage(message: StreamItemMessage): void {\r\n this.assertNotEmptyString(message.invocationId, \"Invalid payload for StreamItem message.\");\r\n\r\n if (message.item === undefined) {\r\n throw new Error(\"Invalid payload for StreamItem message.\");\r\n }\r\n }\r\n\r\n private isCompletionMessage(message: CompletionMessage): void {\r\n if (message.result && message.error) {\r\n throw new Error(\"Invalid payload for Completion message.\");\r\n }\r\n\r\n if (!message.result && message.error) {\r\n this.assertNotEmptyString(message.error, \"Invalid payload for Completion message.\");\r\n }\r\n\r\n this.assertNotEmptyString(message.invocationId, \"Invalid payload for Completion message.\");\r\n }\r\n\r\n private assertNotEmptyString(value: any, errorMessage: string): void {\r\n if (typeof value !== \"string\" || value === \"\") {\r\n throw new Error(errorMessage);\r\n }\r\n }\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
/** A logger that does nothing when log messages are sent to it. */
var NullLogger = /** @class */ (function () {
function NullLogger() {
}
/** @inheritDoc */
// tslint:disable-next-line
NullLogger.prototype.log = function (_logLevel, _message) {
};
/** The singleton instance of the {@link @aspnet/signalr.NullLogger}. */
NullLogger.instance = new NullLogger();
return NullLogger;
}());
exports.NullLogger = NullLogger;
//# sourceMappingURL=Loggers.js.map
\ No newline at end of file
{"version":3,"file":"Loggers.js","sourceRoot":"","sources":["../../src/Loggers.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;AAI/G,mEAAmE;AACnE;IAII;IAAuB,CAAC;IAExB,kBAAkB;IAClB,2BAA2B;IACpB,wBAAG,GAAV,UAAW,SAAmB,EAAE,QAAgB;IAChD,CAAC;IARD,wEAAwE;IAC1D,mBAAQ,GAAY,IAAI,UAAU,EAAE,CAAC;IAQvD,iBAAC;CAAA,AAVD,IAUC;AAVY,gCAAU","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\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\n\r\n/** A logger that does nothing when log messages are sent to it. */\r\nexport class NullLogger implements ILogger {\r\n /** The singleton instance of the {@link @aspnet/signalr.NullLogger}. */\r\n public static instance: ILogger = new NullLogger();\r\n\r\n private constructor() {}\r\n\r\n /** @inheritDoc */\r\n // tslint:disable-next-line\r\n public log(_logLevel: LogLevel, _message: string): void {\r\n }\r\n}\r\n"]}
\ No newline at end of file
{"version":3,"file":"LongPollingTransport.js","sourceRoot":"","sources":["../../src/LongPollingTransport.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE/G,qDAAoD;AACpD,mCAAmD;AAEnD,qCAA8C;AAC9C,2CAA0D;AAC1D,iCAA0D;AAE1D,oDAAoD;AACpD,eAAe;AACf;IAoBI,8BAAY,UAAsB,EAAE,kBAAgE,EAAE,MAAe,EAAE,iBAA0B;QAC7I,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;Q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,CAAC,KAAK,EAAE,wCAAwC,CAAC,CAAC;wBAE1E,+CAA+C;wBAC/C,sDAAsD;wBACtD,IAAI,CAAC,YAAY,EAAE,CAAC;;;;;;KAE3B;IAEO,2CAAY,GAApB;QACI,IAAI,IAAI,CAAC,OAAO,EAAE;YACd,IAAI,UAAU,GAAG,+CAA+C,CAAC;YACjE,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjB,UAAU,IAAI,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;aAC9C;YACD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,kBAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;YAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;IACL,CAAC;IACL,2BAAC;AAAD,CAAC,AAnND,IAmNC;AAnNY,oDAAoB","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\r\nimport { AbortController } from \"./AbortController\";\r\nimport { HttpError, TimeoutError } from \"./Errors\";\r\nimport { HttpClient, HttpRequest } from \"./HttpClient\";\r\nimport { ILogger, LogLevel } from \"./ILogger\";\r\nimport { ITransport, TransferFormat } from \"./ITransport\";\r\nimport { Arg, getDataDetail, sendMessage } from \"./Utils\";\r\n\r\n// Not exported from 'index', this type is internal.\r\n/** @private */\r\nexport class LongPollingTransport implements ITransport {\r\n private readonly httpClient: HttpClient;\r\n private readonly accessTokenFactory: (() => string | Promise<string>) | undefined;\r\n private readonly logger: ILogger;\r\n private readonly logMessageContent: boolean;\r\n private readonly pollAbort: AbortController;\r\n\r\n private url?: string;\r\n private running: boolean;\r\n private receiving?: Promise<void>;\r\n private closeError?: Error;\r\n\r\n public onreceive: ((data: string | ArrayBuffer) => void) | null;\r\n public onclose: ((error?: Error) => void) | null;\r\n\r\n // This is an internal type, not exported from 'index' so this is really just internal.\r\n public get pollAborted() {\r\n return this.pollAbort.aborted;\r\n }\r\n\r\n constructor(httpClient: HttpClient, accessTokenFactory: (() => string | Promise<string>) | undefined, logger: ILogger, logMessageContent: boolean) {\r\n this.httpClient = httpClient;\r\n this.accessTokenFactory = accessTokenFactory;\r\n this.logger = logger;\r\n this.pollAbort = new AbortController();\r\n this.logMessageContent = logMessageContent;\r\n\r\n this.running = false;\r\n\r\n this.onreceive = null;\r\n this.onclose = null;\r\n }\r\n\r\n public async connect(url: string, transferFormat: TransferFormat): Promise<void> {\r\n Arg.isRequired(url, \"url\");\r\n Arg.isRequired(transferFormat, \"transferFormat\");\r\n Arg.isIn(transferFormat, TransferFormat, \"transferFormat\");\r\n\r\n this.url = url;\r\n\r\n this.logger.log(LogLevel.Trace, \"(LongPolling transport) Connecting.\");\r\n\r\n // Allow binary format on Node and Browsers that support binary content (indicated by the presence of responseType property)\r\n if (transferFormat === TransferFormat.Binary &&\r\n (typeof XMLHttpRequest !== \"undefined\" && typeof new XMLHttpRequest().responseType !== \"string\")) {\r\n throw new Error(\"Binary protocols over XmlHttpRequest not implementing advanced features are not supported.\");\r\n }\r\n\r\n const pollOptions: HttpRequest = {\r\n abortSignal: this.pollAbort.signal,\r\n headers: {},\r\n timeout: 100000,\r\n };\r\n\r\n if (transferFormat === TransferFormat.Binary) {\r\n pollOptions.responseType = \"arraybuffer\";\r\n }\r\n\r\n const token = await this.getAccessToken();\r\n this.updateHeaderToken(pollOptions, token);\r\n\r\n // Make initial long polling request\r\n // Server uses first long polling request to finish initializing connection and it returns without data\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this.logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this.httpClient.get(pollUrl, pollOptions);\r\n if (response.statusCode !== 200) {\r\n this.logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n\r\n // Mark running as false so that the poll immediately ends and runs the close logic\r\n this.closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this.running = false;\r\n } else {\r\n this.running = true;\r\n }\r\n\r\n this.receiving = this.poll(this.url, pollOptions);\r\n }\r\n\r\n private async getAccessToken(): Promise<string | null> {\r\n if (this.accessTokenFactory) {\r\n return await this.accessTokenFactory();\r\n }\r\n\r\n return null;\r\n }\r\n\r\n private updateHeaderToken(request: HttpRequest, token: string | null) {\r\n if (!request.headers) {\r\n request.headers = {};\r\n }\r\n if (token) {\r\n // tslint:disable-next-line:no-string-literal\r\n request.headers[\"Authorization\"] = `Bearer ${token}`;\r\n return;\r\n }\r\n // tslint:disable-next-line:no-string-literal\r\n if (request.headers[\"Authorization\"]) {\r\n // tslint:disable-next-line:no-string-literal\r\n delete request.headers[\"Authorization\"];\r\n }\r\n }\r\n\r\n private async poll(url: string, pollOptions: HttpRequest): Promise<void> {\r\n try {\r\n while (this.running) {\r\n // We have to get the access token on each poll, in case it changes\r\n const token = await this.getAccessToken();\r\n this.updateHeaderToken(pollOptions, token);\r\n\r\n try {\r\n const pollUrl = `${url}&_=${Date.now()}`;\r\n this.logger.log(LogLevel.Trace, `(LongPolling transport) polling: ${pollUrl}.`);\r\n const response = await this.httpClient.get(pollUrl, pollOptions);\r\n\r\n if (response.statusCode === 204) {\r\n this.logger.log(LogLevel.Information, \"(LongPolling transport) Poll terminated by server.\");\r\n\r\n this.running = false;\r\n } else if (response.statusCode !== 200) {\r\n this.logger.log(LogLevel.Error, `(LongPolling transport) Unexpected response code: ${response.statusCode}.`);\r\n\r\n // Unexpected status code\r\n this.closeError = new HttpError(response.statusText || \"\", response.statusCode);\r\n this.running = false;\r\n } else {\r\n // Process the response\r\n if (response.content) {\r\n this.logger.log(LogLevel.Trace, `(LongPolling transport) data received. ${getDataDetail(response.content, this.logMessageContent)}.`);\r\n if (this.onreceive) {\r\n this.onreceive(response.content);\r\n }\r\n } else {\r\n // This is another way timeout manifest.\r\n this.logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n }\r\n }\r\n } catch (e) {\r\n if (!this.running) {\r\n // Log but disregard errors that occur after stopping\r\n this.logger.log(LogLevel.Trace, `(LongPolling transport) Poll errored after shutdown: ${e.message}`);\r\n } else {\r\n if (e instanceof TimeoutError) {\r\n // Ignore timeouts and reissue the poll.\r\n this.logger.log(LogLevel.Trace, \"(LongPolling transport) Poll timed out, reissuing.\");\r\n } else {\r\n // Close the connection with the error as the result.\r\n this.closeError = e;\r\n this.running = false;\r\n }\r\n }\r\n }\r\n }\r\n } finally {\r\n this.logger.log(LogLevel.Trace, \"(LongPolling transport) Polling complete.\");\r\n\r\n // We will reach here with pollAborted==false when the server returned a response causing the transport to stop.\r\n // If pollAborted==true then client initiated the stop and the stop method will raise the close event after DELETE is sent.\r\n if (!this.pollAborted) {\r\n this.raiseOnClose();\r\n }\r\n }\r\n }\r\n\r\n public async send(data: any): Promise<void> {\r\n if (!this.running) {\r\n return Promise.reject(new Error(\"Cannot send until the transport is connected\"));\r\n }\r\n return sendMessage(this.logger, \"LongPolling\", this.httpClient, this.url!, this.accessTokenFactory, data, this.logMessageContent);\r\n }\r\n\r\n public async stop(): Promise<void> {\r\n this.logger.log(LogLevel.Trace, \"(LongPolling transport) Stopping polling.\");\r\n\r\n // Tell receiving loop to stop, abort any current request, and then wait for it to finish\r\n this.running = false;\r\n this.pollAbort.abort();\r\n\r\n try {\r\n await this.receiving;\r\n\r\n // Send DELETE to clean up long polling on the server\r\n this.logger.log(LogLevel.Trace, `(LongPolling transport) sending DELETE request to ${this.url}.`);\r\n\r\n const deleteOptions: HttpRequest = {\r\n headers: {},\r\n };\r\n const token = await this.getAccessToken();\r\n this.updateHeaderToken(deleteOptions, token);\r\n await this.httpClient.delete(this.url!, deleteOptions);\r\n\r\n this.logger.log(LogLevel.Trace, \"(LongPolling transport) DELETE request sent.\");\r\n } finally {\r\n this.logger.log(LogLevel.Trace, \"(LongPolling transport) Stop finished.\");\r\n\r\n // Raise close event here instead of in polling\r\n // It needs to happen after the DELETE request is sent\r\n this.raiseOnClose();\r\n }\r\n }\r\n\r\n private raiseOnClose() {\r\n if (this.onclose) {\r\n let logMessage = \"(LongPolling transport) Firing onclose event.\";\r\n if (this.closeError) {\r\n logMessage += \" Error: \" + this.closeError;\r\n }\r\n this.logger.log(LogLevel.Trace, logMessage);\r\n this.onclose(this.closeError);\r\n }\r\n }\r\n}\r\n"]}
\ No newline at end of file
此差异已折叠。
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Polyfills.js.map
\ No newline at end of file
{"version":3,"file":"Polyfills.js","sourceRoot":"","sources":["../../src/Polyfills.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,+GAA+G","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\r\n// Not exported from index\r\n\r\nexport interface EventSourceConstructor {\r\n new(url: string, eventSourceInitDict?: EventSourceInit): EventSource;\r\n}\r\n\r\nexport interface WebSocketConstructor {\r\n new(url: string, protocols?: string | string[], options?: any): WebSocket;\r\n readonly CLOSED: number;\r\n readonly CLOSING: number;\r\n readonly CONNECTING: number;\r\n readonly OPEN: number;\r\n}\r\n"]}
\ No newline at end of file
"use strict";
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Stream.js.map
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
/** @private */
export declare class AbortController implements AbortSignal {
private isAborted;
onabort: (() => void) | null;
abort(): void;
readonly signal: AbortSignal;
readonly aborted: boolean;
}
/** Represents a signal that can be monitored to determine if a request has been aborted. */
export interface AbortSignal {
/** Indicates if the request has been aborted. */
aborted: boolean;
/** Set this to a handler that will be invoked when the request is aborted. */
onabort: (() => void) | null;
}
此差异已折叠。
import { HttpClient, HttpResponse } from "./HttpClient";
import { ILogger } from "./ILogger";
export declare class NodeHttpClient extends HttpClient {
constructor(logger: ILogger);
send(): Promise<HttpResponse>;
}
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
import { TransferFormat } from "./ITransport";
/** @private */
export interface IConnection {
readonly features: any;
start(transferFormat: TransferFormat): Promise<void>;
send(data: string | ArrayBuffer): Promise<void>;
stop(error?: Error): Promise<void>;
onreceive: ((data: string | ArrayBuffer) => void) | null;
onclose: ((error?: Error) => void) | null;
}
此差异已折叠。
此差异已折叠。
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
//# sourceMappingURL=IHttpConnectionOptions.js.map
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册