From fc8979aecab257c1d837ccfab0f6694e4f2e9179 Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Tue, 7 Aug 2018 13:36:10 -0700 Subject: [PATCH] Update TS docs for docs.microsoft.com generation (#2605) --- clients/ts/signalr/src/AbortController.ts | 1 + clients/ts/signalr/src/Errors.ts | 4 +- clients/ts/signalr/src/HandshakeProtocol.ts | 3 ++ clients/ts/signalr/src/HttpClient.ts | 40 +++++++++---------- clients/ts/signalr/src/HttpConnection.ts | 4 ++ clients/ts/signalr/src/HubConnection.ts | 4 +- .../ts/signalr/src/HubConnectionBuilder.ts | 32 +++++++-------- clients/ts/signalr/src/IConnection.ts | 1 + .../ts/signalr/src/IHttpConnectionOptions.ts | 12 +++--- clients/ts/signalr/src/IHubProtocol.ts | 39 +++++++++--------- clients/ts/signalr/src/ITransport.ts | 2 +- clients/ts/signalr/src/JsonHubProtocol.ts | 4 +- clients/ts/signalr/src/Loggers.ts | 2 +- .../ts/signalr/src/LongPollingTransport.ts | 1 + .../signalr/src/ServerSentEventsTransport.ts | 1 + clients/ts/signalr/src/Stream.ts | 14 +++---- clients/ts/signalr/src/TextMessageFormat.ts | 1 + clients/ts/signalr/src/Utils.ts | 8 ++++ clients/ts/signalr/src/WebSocketTransport.ts | 1 + 19 files changed, 98 insertions(+), 76 deletions(-) diff --git a/clients/ts/signalr/src/AbortController.ts b/clients/ts/signalr/src/AbortController.ts index a5b9232f8a..bc6fb3df6c 100644 --- a/clients/ts/signalr/src/AbortController.ts +++ b/clients/ts/signalr/src/AbortController.ts @@ -6,6 +6,7 @@ // it's a very new API right now. // Not exported from index. +/** @private */ export class AbortController implements AbortSignal { private isAborted: boolean = false; public onabort: () => void; diff --git a/clients/ts/signalr/src/Errors.ts b/clients/ts/signalr/src/Errors.ts index 4bed501a61..89d74ca302 100644 --- a/clients/ts/signalr/src/Errors.ts +++ b/clients/ts/signalr/src/Errors.ts @@ -9,7 +9,7 @@ export class HttpError extends Error { /** The HTTP status code represented by this error. */ public statusCode: number; - /** Constructs a new instance of {@link HttpError}. + /** 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. @@ -30,7 +30,7 @@ export class TimeoutError extends Error { // tslint:disable-next-line:variable-name private __proto__: Error; - /** Constructs a new instance of {@link TimeoutError}. + /** Constructs a new instance of {@link @aspnet/signalr.TimeoutError}. * * @param {string} errorMessage A descriptive error message. */ diff --git a/clients/ts/signalr/src/HandshakeProtocol.ts b/clients/ts/signalr/src/HandshakeProtocol.ts index ba6906ef5f..200f084fd9 100644 --- a/clients/ts/signalr/src/HandshakeProtocol.ts +++ b/clients/ts/signalr/src/HandshakeProtocol.ts @@ -3,15 +3,18 @@ import { TextMessageFormat } from "./TextMessageFormat"; +/** @private */ export interface HandshakeRequestMessage { readonly protocol: string; readonly version: number; } +/** @private */ export interface HandshakeResponseMessage { readonly error: string; } +/** @private */ export class HandshakeProtocol { // Handshake request is always JSON public writeHandshakeRequest(handshakeRequest: HandshakeRequestMessage): string { diff --git a/clients/ts/signalr/src/HttpClient.ts b/clients/ts/signalr/src/HttpClient.ts index 7fb94fac0a..ac2c3a320f 100644 --- a/clients/ts/signalr/src/HttpClient.ts +++ b/clients/ts/signalr/src/HttpClient.ts @@ -31,20 +31,20 @@ export interface HttpRequest { /** Represents an HTTP response. */ export class HttpResponse { - /** Constructs a new instance of {@link HttpResponse} with the specified status code. + /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code. * * @param {number} statusCode The status code of the response. */ constructor(statusCode: number); - /** Constructs a new instance of {@link HttpResponse} with the specified status code and message. + /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code and message. * * @param {number} statusCode The status code of the response. * @param {string} statusText The status message of the response. */ constructor(statusCode: number, statusText: string); - /** Constructs a new instance of {@link HttpResponse} with the specified status code, message and string content. + /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code, message and string content. * * @param {number} statusCode The status code of the response. * @param {string} statusText The status message of the response. @@ -52,7 +52,7 @@ export class HttpResponse { */ constructor(statusCode: number, statusText: string, content: string); - /** Constructs a new instance of {@link HttpResponse} with the specified status code, message and binary content. + /** Constructs a new instance of {@link @aspnet/signalr.HttpResponse} with the specified status code, message and binary content. * * @param {number} statusCode The status code of the response. * @param {string} statusText The status message of the response. @@ -71,18 +71,18 @@ export class HttpResponse { * This class provides an abstraction over an HTTP client so that a different implementation can be provided on different platforms. */ export abstract class HttpClient { - /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link HttpResponse} representing the result. + /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result. * * @param {string} url The URL for the request. - * @returns {Promise} A Promise that resolves with an {@link HttpResponse} describing the response, or rejects with an Error indicating a failure. + * @returns {Promise} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure. */ public get(url: string): Promise; - /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link HttpResponse} representing the result. + /** Issues an HTTP GET request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result. * * @param {string} url The URL for the request. * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter. - * @returns {Promise} A Promise that resolves with an {@link HttpResponse} describing the response, or rejects with an Error indicating a failure. + * @returns {Promise} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure. */ public get(url: string, options: HttpRequest): Promise; public get(url: string, options?: HttpRequest): Promise { @@ -93,18 +93,18 @@ export abstract class HttpClient { }); } - /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link HttpResponse} representing the result. + /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result. * * @param {string} url The URL for the request. - * @returns {Promise} A Promise that resolves with an {@link HttpResponse} describing the response, or rejects with an Error indicating a failure. + * @returns {Promise} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure. */ public post(url: string): Promise; - /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link HttpResponse} representing the result. + /** Issues an HTTP POST request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result. * * @param {string} url The URL for the request. * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter. - * @returns {Promise} A Promise that resolves with an {@link HttpResponse} describing the response, or rejects with an Error indicating a failure. + * @returns {Promise} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure. */ public post(url: string, options: HttpRequest): Promise; public post(url: string, options?: HttpRequest): Promise { @@ -115,18 +115,18 @@ export abstract class HttpClient { }); } - /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link HttpResponse} representing the result. + /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result. * * @param {string} url The URL for the request. - * @returns {Promise} A Promise that resolves with an {@link HttpResponse} describing the response, or rejects with an Error indicating a failure. + * @returns {Promise} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure. */ public delete(url: string): Promise; - /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link HttpResponse} representing the result. + /** Issues an HTTP DELETE request to the specified URL, returning a Promise that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result. * * @param {string} url The URL for the request. * @param {HttpRequest} options Additional options to configure the request. The 'url' field in this object will be overridden by the url parameter. - * @returns {Promise} A Promise that resolves with an {@link HttpResponse} describing the response, or rejects with an Error indicating a failure. + * @returns {Promise} A Promise that resolves with an {@link @aspnet/signalr.HttpResponse} describing the response, or rejects with an Error indicating a failure. */ public delete(url: string, options: HttpRequest): Promise; public delete(url: string, options?: HttpRequest): Promise { @@ -137,19 +137,19 @@ export abstract class HttpClient { }); } - /** Issues an HTTP request to the specified URL, returning a {@link Promise} that resolves with an {@link HttpResponse} representing the result. + /** Issues an HTTP request to the specified URL, returning a {@link Promise} that resolves with an {@link @aspnet/signalr.HttpResponse} representing the result. * - * @param {HttpRequest} request An {@link HttpRequest} describing the request to send. + * @param {HttpRequest} request An {@link @aspnet/signalr.HttpRequest} describing the request to send. * @returns {Promise} A Promise that resolves with an HttpResponse describing the response, or rejects with an Error indicating a failure. */ public abstract send(request: HttpRequest): Promise; } -/** Default implementation of {@link HttpClient}. */ +/** Default implementation of {@link @aspnet/signalr.HttpClient}. */ export class DefaultHttpClient extends HttpClient { private readonly logger: ILogger; - /** Creates a new instance of the {@link DefaultHttpClient}, using the provided {@link ILogger} to log messages. */ + /** Creates a new instance of the {@link @aspnet/signalr.DefaultHttpClient}, using the provided {@link @aspnet/signalr.ILogger} to log messages. */ public constructor(logger: ILogger) { super(); this.logger = logger; diff --git a/clients/ts/signalr/src/HttpConnection.ts b/clients/ts/signalr/src/HttpConnection.ts index 5b337a3aa8..870b5591dd 100644 --- a/clients/ts/signalr/src/HttpConnection.ts +++ b/clients/ts/signalr/src/HttpConnection.ts @@ -11,12 +11,14 @@ import { ServerSentEventsTransport } from "./ServerSentEventsTransport"; import { Arg, createLogger } from "./Utils"; import { WebSocketTransport } from "./WebSocketTransport"; +/** @private */ const enum ConnectionState { Connecting, Connected, Disconnected, } +/** @private */ export interface INegotiateResponse { connectionId?: string; availableTransports?: IAvailableTransport[]; @@ -24,6 +26,7 @@ export interface INegotiateResponse { accessToken?: string; } +/** @private */ export interface IAvailableTransport { transport: keyof typeof HttpTransportType; transferFormats: Array; @@ -31,6 +34,7 @@ export interface IAvailableTransport { const MAX_REDIRECTS = 100; +/** @private */ export class HttpConnection implements IConnection { private connectionState: ConnectionState; private baseUrl: string; diff --git a/clients/ts/signalr/src/HubConnection.ts b/clients/ts/signalr/src/HubConnection.ts index 1c89a195b0..8091c02ac1 100644 --- a/clients/ts/signalr/src/HubConnection.ts +++ b/clients/ts/signalr/src/HubConnection.ts @@ -237,11 +237,11 @@ export class HubConnection { /** Removes the specified handler for the specified hub method. * - * You must pass the exact same Function instance as was previously passed to {@link on}. Passing a different instance (even if the function + * You must pass the exact same Function instance as was previously passed to {@link @aspnet/signalr.HubConnection.on}. Passing a different instance (even if the function * body is the same) will not remove the handler. * * @param {string} methodName The name of the method to remove handlers for. - * @param {Function} method The handler to remove. This must be the same Function instance as the one passed to {@link on}. + * @param {Function} method The handler to remove. This must be the same Function instance as the one passed to {@link @aspnet/signalr.HubConnection.on}. */ public off(methodName: string, method: (...args: any[]) => void): void; public off(methodName: string, method?: (...args: any[]) => void): void { diff --git a/clients/ts/signalr/src/HubConnectionBuilder.ts b/clients/ts/signalr/src/HubConnectionBuilder.ts index 2990f38714..af040eaa89 100644 --- a/clients/ts/signalr/src/HubConnectionBuilder.ts +++ b/clients/ts/signalr/src/HubConnectionBuilder.ts @@ -11,7 +11,7 @@ import { JsonHubProtocol } from "./JsonHubProtocol"; import { NullLogger } from "./Loggers"; import { Arg, ConsoleLogger } from "./Utils"; -/** A builder for configuring {@link HubConnection} instances. */ +/** A builder for configuring {@link @aspnet/signalr.HubConnection} instances. */ export class HubConnectionBuilder { /** @internal */ public protocol: IHubProtocol; @@ -22,17 +22,17 @@ export class HubConnectionBuilder { /** @internal */ public logger: ILogger; - /** Configures console logging for the {@link HubConnection}. + /** Configures console logging for the {@link @aspnet/signalr.HubConnection}. * * @param {LogLevel} logLevel The minimum level of messages to log. Anything at this level, or a more severe level, will be logged. - * @returns The {@link HubConnectionBuilder} instance, for chaining. + * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining. */ public configureLogging(logLevel: LogLevel): HubConnectionBuilder; - /** Configures custom logging for the {@link HubConnection}. + /** Configures custom logging for the {@link @aspnet/signalr.HubConnection}. * - * @param {ILogger} logger An object implementing the {@link ILogger} interface, which will be used to write all log messages. - * @returns The {@link HubConnectionBuilder} instance, for chaining. + * @param {ILogger} logger An object implementing the {@link @aspnet/signalr.ILogger} interface, which will be used to write all log messages. + * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining. */ public configureLogging(logger: ILogger): HubConnectionBuilder; public configureLogging(logging: LogLevel | ILogger): HubConnectionBuilder { @@ -47,28 +47,28 @@ export class HubConnectionBuilder { return this; } - /** Configures the {@link HubConnection} to use HTTP-based transports to connect to the specified URL. + /** Configures the {@link @aspnet/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL. * * The transport will be selected automatically based on what the server and client support. * * @param {string} url The URL the connection will use. - * @returns The {@link HubConnectionBuilder} instance, for chaining. + * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining. */ public withUrl(url: string): HubConnectionBuilder; - /** Configures the {@link HubConnection} to use the specified HTTP-based transport to connect to the specified URL. + /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified HTTP-based transport to connect to the specified URL. * * @param {string} url The URL the connection will use. * @param {HttpTransportType} transportType The specific transport to use. - * @returns The {@link HubConnectionBuilder} instance, for chaining. + * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining. */ public withUrl(url: string, transportType: HttpTransportType): HubConnectionBuilder; - /** Configures the {@link HubConnection} to use HTTP-based transports to connect to the specified URL. + /** Configures the {@link @aspnet/signalr.HubConnection} to use HTTP-based transports to connect to the specified URL. * * @param {string} url The URL the connection will use. * @param {IHttpConnectionOptions} options An options object used to configure the connection. - * @returns The {@link HubConnectionBuilder} instance, for chaining. + * @returns The {@link @aspnet/signalr.HubConnectionBuilder} instance, for chaining. */ public withUrl(url: string, options: IHttpConnectionOptions): HubConnectionBuilder; public withUrl(url: string, transportTypeOrOptions?: IHttpConnectionOptions | HttpTransportType): HubConnectionBuilder { @@ -89,9 +89,9 @@ export class HubConnectionBuilder { return this; } - /** Configures the {@link HubConnection} to use the specified Hub Protocol. + /** Configures the {@link @aspnet/signalr.HubConnection} to use the specified Hub Protocol. * - * @param {IHubProtocol} protocol The {@link IHubProtocol} implementation to use. + * @param {IHubProtocol} protocol The {@link @aspnet/signalr.IHubProtocol} implementation to use. */ public withHubProtocol(protocol: IHubProtocol): HubConnectionBuilder { Arg.isRequired(protocol, "protocol"); @@ -100,9 +100,9 @@ export class HubConnectionBuilder { return this; } - /** Creates a {@link HubConnection} from the configuration options specified in this builder. + /** Creates a {@link @aspnet/signalr.HubConnection} from the configuration options specified in this builder. * - * @returns {HubConnection} The configured {@link HubConnection}. + * @returns {HubConnection} The configured {@link @aspnet/signalr.HubConnection}. */ public build(): HubConnection { // If httpConnectionOptions has a logger, use it. Otherwise, override it with the one diff --git a/clients/ts/signalr/src/IConnection.ts b/clients/ts/signalr/src/IConnection.ts index 0b418f1471..3f85fbf1ce 100644 --- a/clients/ts/signalr/src/IConnection.ts +++ b/clients/ts/signalr/src/IConnection.ts @@ -3,6 +3,7 @@ import { TransferFormat } from "./ITransport"; +/** @private */ export interface IConnection { readonly features: any; diff --git a/clients/ts/signalr/src/IHttpConnectionOptions.ts b/clients/ts/signalr/src/IHttpConnectionOptions.ts index d6433d2def..ea1ad2818a 100644 --- a/clients/ts/signalr/src/IHttpConnectionOptions.ts +++ b/clients/ts/signalr/src/IHttpConnectionOptions.ts @@ -5,18 +5,18 @@ import { HttpClient } from "./HttpClient"; import { ILogger, LogLevel } from "./ILogger"; import { HttpTransportType, ITransport } from "./ITransport"; -/** Options provided to the 'withUrl' method on {@link HubConnectionBuilder} to configure options for the HTTP-based transports. */ +/** Options provided to the 'withUrl' method on {@link @aspnet/signalr.HubConnectionBuilder} to configure options for the HTTP-based transports. */ export interface IHttpConnectionOptions { - /** An {@link HttpClient} that will be used to make HTTP requests. */ + /** An {@link @aspnet/signalr.HttpClient} that will be used to make HTTP requests. */ httpClient?: HttpClient; - /** An {@link HttpTransportType} value specifying the transport to use for the connection. */ + /** An {@link @aspnet/signalr.HttpTransportType} value specifying the transport to use for the connection. */ transport?: HttpTransportType | ITransport; /** Configures the logger used for logging. * - * Provide an {@link ILogger} instance, and log messages will be logged via that instance. Alternatively, provide a value from - * the {@link LogLevel} enumeration and a default logger which logs to the Console will be configured to log messages of the specified + * Provide an {@link @aspnet/signalr.ILogger} instance, and log messages will be logged via that instance. Alternatively, provide a value from + * the {@link @aspnet/signalr.LogLevel} enumeration and a default logger which logs to the Console will be configured to log messages of the specified * level (or higher). */ logger?: ILogger | LogLevel; @@ -35,7 +35,7 @@ export interface IHttpConnectionOptions { /** A boolean indicating if negotiation should be skipped. * - * Negotiation can only be skipped when the {@link transport} property is set to 'HttpTransportType.WebSockets'. + * Negotiation can only be skipped when the {@link @aspnet/signalr.IHttpConnectionOptions.transport} property is set to 'HttpTransportType.WebSockets'. */ skipNegotiation?: boolean; } diff --git a/clients/ts/signalr/src/IHubProtocol.ts b/clients/ts/signalr/src/IHubProtocol.ts index 8293f87ca9..e771e399e1 100644 --- a/clients/ts/signalr/src/IHubProtocol.ts +++ b/clients/ts/signalr/src/IHubProtocol.ts @@ -6,19 +6,19 @@ import { TransferFormat } from "./ITransport"; /** Defines the type of a Hub Message. */ export enum MessageType { - /** Indicates the message is an Invocation message and implements the {@link InvocationMessage} interface. */ + /** Indicates the message is an Invocation message and implements the {@link @aspnet/signalr.InvocationMessage} interface. */ Invocation = 1, - /** Indicates the message is a StreamItem message and implements the {@link StreamItemMessage} interface. */ + /** Indicates the message is a StreamItem message and implements the {@link @aspnet/signalr.StreamItemMessage} interface. */ StreamItem = 2, - /** Indicates the message is a Completion message and implements the {@link CompletionMessage} interface. */ + /** Indicates the message is a Completion message and implements the {@link @aspnet/signalr.CompletionMessage} interface. */ Completion = 3, - /** Indicates the message is a Stream Invocation message and implements the {@link StreamInvocationMessage} interface. */ + /** Indicates the message is a Stream Invocation message and implements the {@link @aspnet/signalr.StreamInvocationMessage} interface. */ StreamInvocation = 4, - /** Indicates the message is a Cancel Invocation message and implements the {@link CancelInvocationMessage} interface. */ + /** Indicates the message is a Cancel Invocation message and implements the {@link @aspnet/signalr.CancelInvocationMessage} interface. */ CancelInvocation = 5, - /** Indicates the message is a Ping message and implements the {@link PingMessage} interface. */ + /** Indicates the message is a Ping message and implements the {@link @aspnet/signalr.PingMessage} interface. */ Ping = 6, - /** Indicates the message is a Close message and implements the {@link CloseMessage} interface. */ + /** Indicates the message is a Close message and implements the {@link @aspnet/signalr.CloseMessage} interface. */ Close = 7, } @@ -40,24 +40,25 @@ export type HubMessage = /** Defines properties common to all Hub messages. */ export interface HubMessageBase { - /** A {@link MessageType} value indicating the type of this message. */ + /** A {@link @aspnet/signalr.MessageType} value indicating the type of this message. */ readonly type: MessageType; } /** Defines properties common to all Hub messages relating to a specific invocation. */ export interface HubInvocationMessage extends HubMessageBase { - /** A {@link MessageHeaders} dictionary containing headers attached to the message. */ + /** A {@link @aspnet/signalr.MessageHeaders} dictionary containing headers attached to the message. */ readonly headers?: MessageHeaders; /** The ID of the invocation relating to this message. * - * This is expected to be present for {@link StreamInvocationMessage} and {@link CompletionMessage}. It may - * be 'undefined' for an {@link InvocationMessage} if the sender does not expect a response. + * This is expected to be present for {@link @aspnet/signalr.StreamInvocationMessage} and {@link @aspnet/signalr.CompletionMessage}. It may + * be 'undefined' for an {@link @aspnet/signalr.InvocationMessage} if the sender does not expect a response. */ readonly invocationId?: string; } /** A hub message representing a non-streaming invocation. */ export interface InvocationMessage extends HubInvocationMessage { + /** @inheritDoc */ readonly type: MessageType.Invocation; /** The target method name. */ readonly target: string; @@ -98,12 +99,12 @@ export interface CompletionMessage extends HubInvocationMessage { readonly invocationId: string; /** The error produced by the invocation, if any. * - * Either {@link error} or {@link result} must be defined, but not both. + * Either {@link @aspnet/signalr.CompletionMessage.error} or {@link @aspnet/signalr.CompletionMessage.result} must be defined, but not both. */ readonly error?: string; /** The result produced by the invocation, if any. * - * Either {@link error} or {@link result} must be defined, but not both. + * Either {@link @aspnet/signalr.CompletionMessage.error} or {@link @aspnet/signalr.CompletionMessage.result} must be defined, but not both. */ readonly result?: any; } @@ -116,7 +117,7 @@ export interface PingMessage extends HubMessageBase { /** A hub message indicating that the sender is closing the connection. * - * If {@link error} is defined, the sender is closing the connection due to an error. + * If {@link @aspnet/signalr.CloseMessage.error} is defined, the sender is closing the connection due to an error. */ export interface CloseMessage extends HubMessageBase { /** @inheritDoc */ @@ -142,21 +143,21 @@ export interface IHubProtocol { readonly name: string; /** The version of the protocol. */ readonly version: number; - /** The {@link TransferFormat} of the protocol. */ + /** The {@link @aspnet/signalr.TransferFormat} of the protocol. */ readonly transferFormat: TransferFormat; - /** Creates an array of {@link HubMessage} objects from the specified serialized representation. + /** Creates an array of {@link @aspnet/signalr.HubMessage} objects from the specified serialized representation. * - * If {@link transferFormat} is 'Text', the {@link input} parameter must be a string, otherwise it must be an ArrayBuffer. + * If {@link @aspnet/signalr.IHubProtocol.transferFormat} is 'Text', the `input` parameter must be a string, otherwise it must be an ArrayBuffer. * * @param {string | ArrayBuffer} input A string, or ArrayBuffer containing the serialized representation. * @param {ILogger} logger A logger that will be used to log messages that occur during parsing. */ parseMessages(input: string | ArrayBuffer, logger: ILogger): HubMessage[]; - /** Writes the specified {@link HubMessage} to a string or ArrayBuffer and returns it. + /** Writes the specified {@link @aspnet/signalr.HubMessage} to a string or ArrayBuffer and returns it. * - * If {@link transferFormat} is 'Text', the result of this method will be a string, otherwise it will be an ArrayBuffer. + * If {@link @aspnet/signalr.IHubProtocol.transferFormat} is 'Text', the result of this method will be a string, otherwise it will be an ArrayBuffer. * * @param {HubMessage} message The message to write. * @returns {string | ArrayBuffer} A string or ArrayBuffer containing the serialized representation of the message. diff --git a/clients/ts/signalr/src/ITransport.ts b/clients/ts/signalr/src/ITransport.ts index 936bcb420a..a362a1ce5b 100644 --- a/clients/ts/signalr/src/ITransport.ts +++ b/clients/ts/signalr/src/ITransport.ts @@ -19,7 +19,7 @@ export enum TransferFormat { /** Specifies that only text data will be transmitted over the connection. */ Text = 1, /** Specifies that binary data will be transmitted over the connection. */ - Binary, + Binary = 2, } /** An abstraction over the behavior of transports. This is designed to support the framework and not intended for use by applications. */ diff --git a/clients/ts/signalr/src/JsonHubProtocol.ts b/clients/ts/signalr/src/JsonHubProtocol.ts index c954c1f8c4..4be30e011d 100644 --- a/clients/ts/signalr/src/JsonHubProtocol.ts +++ b/clients/ts/signalr/src/JsonHubProtocol.ts @@ -20,7 +20,7 @@ export class JsonHubProtocol implements IHubProtocol { /** @inheritDoc */ public readonly transferFormat: TransferFormat = TransferFormat.Text; - /** Creates an array of {@link HubMessage} objects from the specified serialized representation. + /** Creates an array of {@link @aspnet/signalr.HubMessage} objects from the specified serialized representation. * * @param {string} input A string containing the serialized representation. * @param {ILogger} logger A logger that will be used to log messages that occur during parsing. @@ -75,7 +75,7 @@ export class JsonHubProtocol implements IHubProtocol { return hubMessages; } - /** Writes the specified {@link HubMessage} to a string and returns it. + /** Writes the specified {@link @aspnet/signalr.HubMessage} to a string and returns it. * * @param {HubMessage} message The message to write. * @returns {string} A string containing the serialized representation of the message. diff --git a/clients/ts/signalr/src/Loggers.ts b/clients/ts/signalr/src/Loggers.ts index 884cec297d..b224a6e144 100644 --- a/clients/ts/signalr/src/Loggers.ts +++ b/clients/ts/signalr/src/Loggers.ts @@ -5,7 +5,7 @@ import { ILogger, LogLevel } from "./ILogger"; /** A logger that does nothing when log messages are sent to it. */ export class NullLogger implements ILogger { - /** The singleton instance of the {@link NullLogger}. */ + /** The singleton instance of the {@link @aspnet/signalr.NullLogger}. */ public static instance: ILogger = new NullLogger(); private constructor() {} diff --git a/clients/ts/signalr/src/LongPollingTransport.ts b/clients/ts/signalr/src/LongPollingTransport.ts index 6fdc830320..456425d703 100644 --- a/clients/ts/signalr/src/LongPollingTransport.ts +++ b/clients/ts/signalr/src/LongPollingTransport.ts @@ -11,6 +11,7 @@ import { Arg, getDataDetail, sendMessage } from "./Utils"; const SHUTDOWN_TIMEOUT = 5 * 1000; // Not exported from 'index', this type is internal. +/** @private */ export class LongPollingTransport implements ITransport { private readonly httpClient: HttpClient; private readonly accessTokenFactory: () => string | Promise; diff --git a/clients/ts/signalr/src/ServerSentEventsTransport.ts b/clients/ts/signalr/src/ServerSentEventsTransport.ts index dff90c3469..e796cd799c 100644 --- a/clients/ts/signalr/src/ServerSentEventsTransport.ts +++ b/clients/ts/signalr/src/ServerSentEventsTransport.ts @@ -6,6 +6,7 @@ import { ILogger, LogLevel } from "./ILogger"; import { ITransport, TransferFormat } from "./ITransport"; import { Arg, getDataDetail, sendMessage } from "./Utils"; +/** @private */ export class ServerSentEventsTransport implements ITransport { private readonly httpClient: HttpClient; private readonly accessTokenFactory: () => string | Promise; diff --git a/clients/ts/signalr/src/Stream.ts b/clients/ts/signalr/src/Stream.ts index 8dca2fb526..2cb812fda6 100644 --- a/clients/ts/signalr/src/Stream.ts +++ b/clients/ts/signalr/src/Stream.ts @@ -12,18 +12,18 @@ * @typeparam T The type of the items being sent by the server. */ export interface IStreamSubscriber { - /** A boolean that will be set by the {@link IStreamResult} when the stream is closed. */ + /** A boolean that will be set by the {@link @aspnet/signalr.IStreamResult} when the stream is closed. */ closed?: boolean; /** Called by the framework when a new item is available. */ next(value: T): void; /** Called by the framework when an error has occurred. * - * After this method is called, no additional methods on the {@link IStreamSubscriber} will be called. + * After this method is called, no additional methods on the {@link @aspnet/signalr.IStreamSubscriber} will be called. */ error(err: any): void; /** Called by the framework when the end of the stream is reached. * - * After this method is called, no additional methods on the {@link IStreamSubscriber} will be called. + * After this method is called, no additional methods on the {@link @aspnet/signalr.IStreamSubscriber} will be called. */ complete(): void; } @@ -33,19 +33,19 @@ export interface IStreamSubscriber { * @typeparam T The type of the items being sent by the server. */ export interface IStreamResult { - /** Attaches a {@link IStreamSubscriber}, which will be invoked when new items are available from the stream. + /** Attaches a {@link @aspnet/signalr.IStreamSubscriber}, which will be invoked when new items are available from the stream. * * @param {IStreamSubscriber} observer The subscriber to attach. - * @returns {ISubscription} A subscription that can be disposed to terminate the stream and stop calling methods on the {@link IStreamSubscriber}. + * @returns {ISubscription} A subscription that can be disposed to terminate the stream and stop calling methods on the {@link @aspnet/signalr.IStreamSubscriber}. */ subscribe(subscriber: IStreamSubscriber): ISubscription; } -/** An interface that allows an {@link IStreamSubscriber} to be disconnected from a stream. +/** An interface that allows an {@link @aspnet/signalr.IStreamSubscriber} to be disconnected from a stream. * * @typeparam T The type of the items being sent by the server. */ export interface ISubscription { - /** Disconnects the {@link IStreamSubscriber} associated with this subscription from the stream. */ + /** Disconnects the {@link @aspnet/signalr.IStreamSubscriber} associated with this subscription from the stream. */ dispose(): void; } diff --git a/clients/ts/signalr/src/TextMessageFormat.ts b/clients/ts/signalr/src/TextMessageFormat.ts index 15868db650..12ec12b0cf 100644 --- a/clients/ts/signalr/src/TextMessageFormat.ts +++ b/clients/ts/signalr/src/TextMessageFormat.ts @@ -2,6 +2,7 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Not exported from index +/** @private */ export class TextMessageFormat { public static RecordSeparatorCode = 0x1e; public static RecordSeparator = String.fromCharCode(TextMessageFormat.RecordSeparatorCode); diff --git a/clients/ts/signalr/src/Utils.ts b/clients/ts/signalr/src/Utils.ts index f259857d19..178e285c47 100644 --- a/clients/ts/signalr/src/Utils.ts +++ b/clients/ts/signalr/src/Utils.ts @@ -6,6 +6,7 @@ import { ILogger, LogLevel } from "./ILogger"; import { NullLogger } from "./Loggers"; import { IStreamResult, IStreamSubscriber, ISubscription } from "./Stream"; +/** @private */ export class Arg { public static isRequired(val: any, name: string): void { if (val === null || val === undefined) { @@ -21,6 +22,7 @@ export class Arg { } } +/** @private */ export function getDataDetail(data: any, includeContent: boolean): string { let length: string = null; if (data instanceof ArrayBuffer) { @@ -37,6 +39,7 @@ export function getDataDetail(data: any, includeContent: boolean): string { return length; } +/** @private */ export function formatArrayBuffer(data: ArrayBuffer): string { const view = new Uint8Array(data); @@ -51,6 +54,7 @@ export function formatArrayBuffer(data: ArrayBuffer): string { return str.substr(0, str.length - 1); } +/** @private */ export async function sendMessage(logger: ILogger, transportName: string, httpClient: HttpClient, url: string, accessTokenFactory: () => string | Promise, content: string | ArrayBuffer, logMessageContent: boolean): Promise { let headers; const token = await accessTokenFactory(); @@ -70,6 +74,7 @@ export async function sendMessage(logger: ILogger, transportName: string, httpCl logger.log(LogLevel.Trace, `(${transportName} transport) request complete. Response status: ${response.statusCode}.`); } +/** @private */ export function createLogger(logger?: ILogger | LogLevel) { if (logger === undefined) { return new ConsoleLogger(LogLevel.Information); @@ -86,6 +91,7 @@ export function createLogger(logger?: ILogger | LogLevel) { return new ConsoleLogger(logger as LogLevel); } +/** @private */ export class Subject implements IStreamResult { public observers: Array>; public cancelCallback: () => Promise; @@ -123,6 +129,7 @@ export class Subject implements IStreamResult { } } +/** @private */ export class SubjectSubscription implements ISubscription { private subject: Subject; private observer: IStreamSubscriber; @@ -144,6 +151,7 @@ export class SubjectSubscription implements ISubscription { } } +/** @private */ export class ConsoleLogger implements ILogger { private readonly minimumLogLevel: LogLevel; diff --git a/clients/ts/signalr/src/WebSocketTransport.ts b/clients/ts/signalr/src/WebSocketTransport.ts index 6476b1f173..a77ac894ca 100644 --- a/clients/ts/signalr/src/WebSocketTransport.ts +++ b/clients/ts/signalr/src/WebSocketTransport.ts @@ -5,6 +5,7 @@ import { ILogger, LogLevel } from "./ILogger"; import { ITransport, TransferFormat } from "./ITransport"; import { Arg, getDataDetail } from "./Utils"; +/** @private */ export class WebSocketTransport implements ITransport { private readonly logger: ILogger; private readonly accessTokenFactory: () => string | Promise;