botframework-streaming
Advanced tools
@@ -25,14 +25,54 @@ /** | ||
private readonly _utf; | ||
/** | ||
* Initializes a new instance of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param params Parameters for a streaming assembler. | ||
*/ | ||
constructor(streamManager: StreamManager, params: IAssemblerParams); | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
getPayloadStream(): SubscribableStream; | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param stream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
onReceive(header: IHeader, stream: SubscribableStream, contentLength: number): void; | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
close(): void; | ||
/** | ||
* Creates a new [SubscribableStream](xref:botframework-streaming.SubscribableStream) instance. | ||
* @returns The new stream ready for consumption. | ||
*/ | ||
private createPayloadStream; | ||
/** | ||
* @private | ||
*/ | ||
private payloadFromJson; | ||
/** | ||
* @private | ||
*/ | ||
private stripBOM; | ||
/** | ||
* @private | ||
*/ | ||
private process; | ||
/** | ||
* @private | ||
*/ | ||
private processResponse; | ||
/** | ||
* @private | ||
*/ | ||
private processRequest; | ||
/** | ||
* @private | ||
*/ | ||
private processStreams; | ||
} | ||
//# sourceMappingURL=payloadAssembler.d.ts.map |
@@ -52,2 +52,7 @@ "use strict"; | ||
var PayloadAssembler = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param params Parameters for a streaming assembler. | ||
*/ | ||
function PayloadAssembler(streamManager, params) { | ||
@@ -71,2 +76,6 @@ this._byteOrderMark = 0xfeff; | ||
} | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
PayloadAssembler.prototype.getPayloadStream = function () { | ||
@@ -78,2 +87,8 @@ if (!this.stream) { | ||
}; | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param stream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
PayloadAssembler.prototype.onReceive = function (header, stream, contentLength) { | ||
@@ -88,14 +103,30 @@ this.end = header.end; | ||
}; | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
PayloadAssembler.prototype.close = function () { | ||
this._streamManager.closeStream(this.id); | ||
}; | ||
/** | ||
* Creates a new [SubscribableStream](xref:botframework-streaming.SubscribableStream) instance. | ||
* @returns The new stream ready for consumption. | ||
*/ | ||
PayloadAssembler.prototype.createPayloadStream = function () { | ||
return new subscribableStream_1.SubscribableStream(); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadAssembler.prototype.payloadFromJson = function (json) { | ||
return JSON.parse(json.charCodeAt(0) === this._byteOrderMark ? json.slice(1) : json); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadAssembler.prototype.stripBOM = function (input) { | ||
return input.charCodeAt(0) === this._byteOrderMark ? input.slice(1) : input; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadAssembler.prototype.process = function (stream) { | ||
@@ -128,2 +159,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadAssembler.prototype.processResponse = function (streamDataAsString) { | ||
@@ -145,2 +179,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadAssembler.prototype.processRequest = function (streamDataAsString) { | ||
@@ -162,2 +199,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadAssembler.prototype.processStreams = function (responsePayload, receiveResponse) { | ||
@@ -164,0 +204,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -10,2 +10,5 @@ /** | ||
import { PayloadAssembler } from './assemblers'; | ||
/** | ||
* A stream of fixed or infinite length containing content to be decoded. | ||
*/ | ||
export declare class ContentStream { | ||
@@ -15,11 +18,39 @@ id: string; | ||
private stream; | ||
/** | ||
* Initializes a new instance of the [ContentStream](xref:botframework-streaming.ContentStream) class. | ||
* @param id The ID assigned to this instance. | ||
* @param assembler The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to this instance. | ||
*/ | ||
constructor(id: string, assembler: PayloadAssembler); | ||
/** | ||
* Gets the name of the type of the object contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
readonly contentType: string; | ||
/** | ||
* Gets the length of this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
readonly length: number; | ||
/** | ||
* Gets the data contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
getStream(): SubscribableStream; | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
cancel(): void; | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a string. | ||
* @returns A string Promise with [SubscribableStream](xref:botframework-streaming.SubscribableStream) content. | ||
*/ | ||
readAsString(): Promise<string>; | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a typed JSON object. | ||
* @returns A typed object Promise with `SubscribableStream` content. | ||
*/ | ||
readAsJson<T>(): Promise<T>; | ||
/** | ||
* @private | ||
*/ | ||
private readAll; | ||
} | ||
//# sourceMappingURL=contentStream.d.ts.map |
@@ -38,3 +38,11 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* A stream of fixed or infinite length containing content to be decoded. | ||
*/ | ||
var ContentStream = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [ContentStream](xref:botframework-streaming.ContentStream) class. | ||
* @param id The ID assigned to this instance. | ||
* @param assembler The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to this instance. | ||
*/ | ||
function ContentStream(id, assembler) { | ||
@@ -48,2 +56,5 @@ if (!assembler) { | ||
Object.defineProperty(ContentStream.prototype, "contentType", { | ||
/** | ||
* Gets the name of the type of the object contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
get: function () { | ||
@@ -56,2 +67,5 @@ return this.assembler.payloadType; | ||
Object.defineProperty(ContentStream.prototype, "length", { | ||
/** | ||
* Gets the length of this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
get: function () { | ||
@@ -63,2 +77,5 @@ return this.assembler.contentLength; | ||
}); | ||
/** | ||
* Gets the data contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
ContentStream.prototype.getStream = function () { | ||
@@ -70,5 +87,12 @@ if (!this.stream) { | ||
}; | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
ContentStream.prototype.cancel = function () { | ||
this.assembler.close(); | ||
}; | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a string. | ||
* @returns A string Promise with [SubscribableStream](xref:botframework-streaming.SubscribableStream) content. | ||
*/ | ||
ContentStream.prototype.readAsString = function () { | ||
@@ -87,2 +111,6 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a typed JSON object. | ||
* @returns A typed object Promise with `SubscribableStream` content. | ||
*/ | ||
ContentStream.prototype.readAsJson = function () { | ||
@@ -107,2 +135,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
ContentStream.prototype.readAll = function () { | ||
@@ -109,0 +140,0 @@ return __awaiter(this, void 0, void 0, function () { |
import { PayloadTypes } from '../payloads/payloadTypes'; | ||
import { PayloadSender } from '../payloadTransport/payloadSender'; | ||
/** | ||
* Streaming cancel disassembler. | ||
*/ | ||
export declare class CancelDisassembler { | ||
@@ -7,5 +10,14 @@ private readonly sender; | ||
private readonly payloadType; | ||
/** | ||
* Initializes a new instance of the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) that this Cancel request will be sent by. | ||
* @param id The ID of the Stream to cancel. | ||
* @param payloadType The type of the Stream that is being cancelled. | ||
*/ | ||
constructor(sender: PayloadSender, id: string, payloadType: PayloadTypes); | ||
/** | ||
* Initiates the process of disassembling the request and signals the [PayloadSender](xref:botframework-streaming.PayloadSender) to begin sending. | ||
*/ | ||
disassemble(): void; | ||
} | ||
//# sourceMappingURL=cancelDisassembler.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Streaming cancel disassembler. | ||
*/ | ||
var CancelDisassembler = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) that this Cancel request will be sent by. | ||
* @param id The ID of the Stream to cancel. | ||
* @param payloadType The type of the Stream that is being cancelled. | ||
*/ | ||
function CancelDisassembler(sender, id, payloadType) { | ||
@@ -9,2 +18,5 @@ this.sender = sender; | ||
} | ||
/** | ||
* Initiates the process of disassembling the request and signals the [PayloadSender](xref:botframework-streaming.PayloadSender) to begin sending. | ||
*/ | ||
CancelDisassembler.prototype.disassemble = function () { | ||
@@ -11,0 +23,0 @@ var header = { payloadType: this.payloadType, payloadLength: 0, id: this.id, end: true }; |
@@ -19,5 +19,14 @@ /** | ||
payloadType: PayloadTypes; | ||
/** | ||
* Initializes a new instance of the [HttpContentStreamDisassembler](xref:botframework-streaming.HttpContentStreamDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param contentStream The [HttpContentStream](xref:botframework-streaming.HttpContentStream) to be disassembled. | ||
*/ | ||
constructor(sender: PayloadSender, contentStream: HttpContentStream); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Strea. | ||
*/ | ||
getStream(): Promise<IStreamWrapper>; | ||
} | ||
//# sourceMappingURL=httpContentStreamDisassembler.d.ts.map |
@@ -58,2 +58,7 @@ "use strict"; | ||
__extends(HttpContentStreamDisassembler, _super); | ||
/** | ||
* Initializes a new instance of the [HttpContentStreamDisassembler](xref:botframework-streaming.HttpContentStreamDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param contentStream The [HttpContentStream](xref:botframework-streaming.HttpContentStream) to be disassembled. | ||
*/ | ||
function HttpContentStreamDisassembler(sender, contentStream) { | ||
@@ -65,2 +70,6 @@ var _this = _super.call(this, sender, contentStream.id) || this; | ||
} | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Strea. | ||
*/ | ||
HttpContentStreamDisassembler.prototype.getStream = function () { | ||
@@ -67,0 +76,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -13,8 +13,27 @@ import { PayloadTypes } from '../payloads/payloadTypes'; | ||
private readonly id; | ||
/** | ||
* Initializes a new instance of the [PayloadDisassembler](xref:botframework-streaming.PayloadDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) used to send the disassembled payload chunks. | ||
* @param id The ID of this disassembler. | ||
*/ | ||
constructor(sender: PayloadSender, id: string); | ||
/** | ||
* Serializes the item into the [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) that exposes the stream and length of the result. | ||
* @param item The item to be serialized. | ||
*/ | ||
protected static serialize<T>(item: T): IStreamWrapper; | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
abstract getStream(): Promise<IStreamWrapper>; | ||
/** | ||
* Begins the process of disassembling a payload and sending the resulting chunks to the [PayloadSender](xref:botframework-streaming.PayloadSender) to dispatch over the transport. | ||
*/ | ||
disassemble(): Promise<void>; | ||
/** | ||
* Begins the process of disassembling a payload and signals the [PayloadSender](xref:botframework-streaming.PayloadSender). | ||
*/ | ||
private send; | ||
} | ||
//# sourceMappingURL=payloadDisassembler.d.ts.map |
@@ -43,2 +43,7 @@ "use strict"; | ||
var PayloadDisassembler = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [PayloadDisassembler](xref:botframework-streaming.PayloadDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) used to send the disassembled payload chunks. | ||
* @param id The ID of this disassembler. | ||
*/ | ||
function PayloadDisassembler(sender, id) { | ||
@@ -48,2 +53,6 @@ this.sender = sender; | ||
} | ||
/** | ||
* Serializes the item into the [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) that exposes the stream and length of the result. | ||
* @param item The item to be serialized. | ||
*/ | ||
PayloadDisassembler.serialize = function (item) { | ||
@@ -55,2 +64,5 @@ var stream = new subscribableStream_1.SubscribableStream(); | ||
}; | ||
/** | ||
* Begins the process of disassembling a payload and sending the resulting chunks to the [PayloadSender](xref:botframework-streaming.PayloadSender) to dispatch over the transport. | ||
*/ | ||
PayloadDisassembler.prototype.disassemble = function () { | ||
@@ -71,2 +83,5 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* Begins the process of disassembling a payload and signals the [PayloadSender](xref:botframework-streaming.PayloadSender). | ||
*/ | ||
PayloadDisassembler.prototype.send = function () { | ||
@@ -73,0 +88,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -19,5 +19,15 @@ /** | ||
payloadType: PayloadTypes; | ||
/** | ||
* Initializes a new instance of the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param request The request to be disassembled. | ||
*/ | ||
constructor(sender: PayloadSender, id: string, request?: StreamingRequest); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
getStream(): Promise<IStreamWrapper>; | ||
} | ||
//# sourceMappingURL=requestDisassembler.d.ts.map |
@@ -65,2 +65,8 @@ "use strict"; | ||
__extends(RequestDisassembler, _super); | ||
/** | ||
* Initializes a new instance of the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param request The request to be disassembled. | ||
*/ | ||
function RequestDisassembler(sender, id, request) { | ||
@@ -72,2 +78,6 @@ var _this = _super.call(this, sender, id) || this; | ||
} | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
RequestDisassembler.prototype.getStream = function () { | ||
@@ -74,0 +84,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -19,5 +19,15 @@ /** | ||
readonly payloadType: PayloadTypes; | ||
/** | ||
* Initializes a new instance of the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param response The response to be disassembled. | ||
*/ | ||
constructor(sender: PayloadSender, id: string, response: StreamingResponse); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
getStream(): Promise<IStreamWrapper>; | ||
} | ||
//# sourceMappingURL=responseDisassembler.d.ts.map |
@@ -65,2 +65,8 @@ "use strict"; | ||
__extends(ResponseDisassembler, _super); | ||
/** | ||
* Initializes a new instance of the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param response The response to be disassembled. | ||
*/ | ||
function ResponseDisassembler(sender, id, response) { | ||
@@ -72,2 +78,6 @@ var _this = _super.call(this, sender, id) || this; | ||
} | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
ResponseDisassembler.prototype.getStream = function () { | ||
@@ -74,0 +84,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -10,2 +10,6 @@ /** | ||
import { IHttpContentHeaders } from './interfaces/IHttpContentHeaders'; | ||
/** | ||
* An attachment contained within a StreamingRequest's stream collection, | ||
* which itself contains any form of media item. | ||
*/ | ||
export declare class HttpContentStream { | ||
@@ -19,10 +23,25 @@ readonly id: string; | ||
}; | ||
/** | ||
* Initializes a new instance of the [HttpContentStream](xref:botframework-streaming.HttpContentStream) class. | ||
* @param content The [HttpContent](xref:botframework-streaming.HttpContent) to assign to the [HttpContentStream](xref:botframework-streaming.HttpContentStream). | ||
*/ | ||
constructor(content: HttpContent); | ||
} | ||
/** | ||
* The HttpContent class that contains a [SubscribableStream](xref:botframework-streaming.SubscribableStream). | ||
*/ | ||
export declare class HttpContent { | ||
headers: IHttpContentHeaders; | ||
private readonly stream; | ||
/** | ||
* Initializes a new instance of the [HttpContent](xref:botframework-streaming.HttpContent) class. | ||
* @param headers The Streaming Http content header definition. | ||
* @param stream The stream of buffered data. | ||
*/ | ||
constructor(headers: IHttpContentHeaders, stream: SubscribableStream); | ||
/** | ||
* Gets the data contained within this [HttpContent](xref:botframework-streaming.HttpContent). | ||
*/ | ||
getStream(): SubscribableStream; | ||
} | ||
//# sourceMappingURL=httpContentStream.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var protocol_base_1 = require("./utilities/protocol-base"); | ||
/** | ||
* An attachment contained within a StreamingRequest's stream collection, | ||
* which itself contains any form of media item. | ||
*/ | ||
var HttpContentStream = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [HttpContentStream](xref:botframework-streaming.HttpContentStream) class. | ||
* @param content The [HttpContent](xref:botframework-streaming.HttpContent) to assign to the [HttpContentStream](xref:botframework-streaming.HttpContentStream). | ||
*/ | ||
function HttpContentStream(content) { | ||
@@ -17,3 +25,11 @@ this.id = protocol_base_1.generateGuid(); | ||
exports.HttpContentStream = HttpContentStream; | ||
/** | ||
* The HttpContent class that contains a [SubscribableStream](xref:botframework-streaming.SubscribableStream). | ||
*/ | ||
var HttpContent = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [HttpContent](xref:botframework-streaming.HttpContent) class. | ||
* @param headers The Streaming Http content header definition. | ||
* @param stream The stream of buffered data. | ||
*/ | ||
function HttpContent(headers, stream) { | ||
@@ -23,2 +39,5 @@ this.headers = headers; | ||
} | ||
/** | ||
* Gets the data contained within this [HttpContent](xref:botframework-streaming.HttpContent). | ||
*/ | ||
HttpContent.prototype.getStream = function () { | ||
@@ -25,0 +44,0 @@ return this.stream; |
@@ -43,4 +43,10 @@ /** | ||
static deserialize(buffer: INodeBuffer): IHeader; | ||
/** | ||
* Creates a padded string based on a length and character to be padded to. | ||
* @param lengthValue The value to be assingned on the result. | ||
* @param totalLength The length of the padded string result. | ||
* @param padChar The character value to use as filling. | ||
*/ | ||
static headerLengthPadder(lengthValue: number, totalLength: number, padChar: string): string; | ||
} | ||
//# sourceMappingURL=headerSerializer.d.ts.map |
@@ -59,2 +59,8 @@ "use strict"; | ||
}; | ||
/** | ||
* Creates a padded string based on a length and character to be padded to. | ||
* @param lengthValue The value to be assingned on the result. | ||
* @param totalLength The length of the padded string result. | ||
* @param padChar The character value to use as filling. | ||
*/ | ||
HeaderSerializer.headerLengthPadder = function (lengthValue, totalLength, padChar) { | ||
@@ -61,0 +67,0 @@ var result = Array(totalLength + 1).join(padChar); |
@@ -19,7 +19,27 @@ /** | ||
private readonly activeAssemblers; | ||
/** | ||
* Initializes a new instance of the [PayloadAssemblerManager](xref:botframework-streaming.PayloadAssemblerManager) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param onReceiveResponse Function that executes when new bytes are received on a `response` stream. | ||
* @param onReceiveRequest Function that executes when new bytes are received on a `request` stream. | ||
*/ | ||
constructor(streamManager: StreamManager, onReceiveResponse: Function, onReceiveRequest: Function); | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @param header The Header of the Stream to retrieve. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
getPayloadStream(header: IHeader): SubscribableStream; | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param contentStream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
onReceive(header: IHeader, contentStream: SubscribableStream, contentLength: number): void; | ||
/** | ||
* @private | ||
*/ | ||
private createPayloadAssembler; | ||
} | ||
//# sourceMappingURL=payloadAssemblerManager.d.ts.map |
@@ -9,2 +9,8 @@ "use strict"; | ||
var PayloadAssemblerManager = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [PayloadAssemblerManager](xref:botframework-streaming.PayloadAssemblerManager) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param onReceiveResponse Function that executes when new bytes are received on a `response` stream. | ||
* @param onReceiveRequest Function that executes when new bytes are received on a `request` stream. | ||
*/ | ||
function PayloadAssemblerManager(streamManager, onReceiveResponse, onReceiveRequest) { | ||
@@ -16,2 +22,7 @@ this.activeAssemblers = {}; | ||
} | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @param header The Header of the Stream to retrieve. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
PayloadAssemblerManager.prototype.getPayloadStream = function (header) { | ||
@@ -29,2 +40,8 @@ if (header.payloadType === payloadTypes_1.PayloadTypes.stream) { | ||
}; | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param contentStream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
PayloadAssemblerManager.prototype.onReceive = function (header, contentStream, contentLength) { | ||
@@ -44,2 +61,5 @@ if (header.payloadType === payloadTypes_1.PayloadTypes.stream) { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadAssemblerManager.prototype.createPayloadAssembler = function (header) { | ||
@@ -46,0 +66,0 @@ if (header.payloadType === payloadTypes_1.PayloadTypes.request) { |
@@ -14,6 +14,20 @@ /** | ||
private readonly _pendingRequests; | ||
/** | ||
* Gets the count of the pending requests. | ||
* @returns Number with the pending requests count. | ||
*/ | ||
pendingRequestCount(): number; | ||
/** | ||
* Signal fired when all response tasks have completed. | ||
* @param requestId The ID of the StreamingRequest. | ||
* @param response The [IReceiveResponse](xref:botframework-streaming.IReceiveResponse) in response to the request. | ||
*/ | ||
signalResponse(requestId: string, response: IReceiveResponse): Promise<boolean>; | ||
/** | ||
* Constructs and returns a response for this request. | ||
* @param requestId The ID of the StreamingRequest being responded to. | ||
* @returns The response to the specified request. | ||
*/ | ||
getResponse(requestId: string): Promise<IReceiveResponse>; | ||
} | ||
//# sourceMappingURL=requestManager.d.ts.map |
@@ -53,5 +53,14 @@ "use strict"; | ||
} | ||
/** | ||
* Gets the count of the pending requests. | ||
* @returns Number with the pending requests count. | ||
*/ | ||
RequestManager.prototype.pendingRequestCount = function () { | ||
return Object.keys(this._pendingRequests).length; | ||
}; | ||
/** | ||
* Signal fired when all response tasks have completed. | ||
* @param requestId The ID of the StreamingRequest. | ||
* @param response The [IReceiveResponse](xref:botframework-streaming.IReceiveResponse) in response to the request. | ||
*/ | ||
RequestManager.prototype.signalResponse = function (requestId, response) { | ||
@@ -71,2 +80,7 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* Constructs and returns a response for this request. | ||
* @param requestId The ID of the StreamingRequest being responded to. | ||
* @returns The response to the specified request. | ||
*/ | ||
RequestManager.prototype.getResponse = function (requestId) { | ||
@@ -73,0 +87,0 @@ var pendingRequest = this._pendingRequests[requestId]; |
@@ -16,7 +16,25 @@ /** | ||
private readonly payloadSender; | ||
/** | ||
* Initializes a new instance of the [SendOperations](xref:botframework-streaming.SendOperations) class. | ||
* @param payloadSender The [PayloadSender](xref:botframework-streaming.PayloadSender) that will send the disassembled data from all of this instance's send operations. | ||
*/ | ||
constructor(payloadSender: PayloadSender); | ||
/** | ||
* The send operation used to send a [StreamingRequest](xref:botframework-streaming.StreamingRequest). | ||
* @param id The ID to assign to the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) used by this operation. | ||
* @param request The request to send. | ||
*/ | ||
sendRequest(id: string, request: StreamingRequest): Promise<void>; | ||
/** | ||
* The send operation used to send a [PayloadTypes.response](xref:botframework-streaming.PayloadTypes.response). | ||
* @param id The ID to assign to the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) used by this operation. | ||
* @param response The response to send. | ||
*/ | ||
sendResponse(id: string, response: StreamingResponse): Promise<void>; | ||
/** | ||
* The send operation used to send a [PayloadTypes.cancelStream](xref:botframework-streaming.PayloadTypes.cancelStream). | ||
* @param id The ID to assign to the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) used by this operation. | ||
*/ | ||
sendCancelStream(id: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=sendOperations.d.ts.map |
@@ -47,5 +47,14 @@ "use strict"; | ||
var SendOperations = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [SendOperations](xref:botframework-streaming.SendOperations) class. | ||
* @param payloadSender The [PayloadSender](xref:botframework-streaming.PayloadSender) that will send the disassembled data from all of this instance's send operations. | ||
*/ | ||
function SendOperations(payloadSender) { | ||
this.payloadSender = payloadSender; | ||
} | ||
/** | ||
* The send operation used to send a [StreamingRequest](xref:botframework-streaming.StreamingRequest). | ||
* @param id The ID to assign to the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) used by this operation. | ||
* @param request The request to send. | ||
*/ | ||
SendOperations.prototype.sendRequest = function (id, request) { | ||
@@ -79,2 +88,7 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* The send operation used to send a [PayloadTypes.response](xref:botframework-streaming.PayloadTypes.response). | ||
* @param id The ID to assign to the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) used by this operation. | ||
* @param response The response to send. | ||
*/ | ||
SendOperations.prototype.sendResponse = function (id, response) { | ||
@@ -108,2 +122,6 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/** | ||
* The send operation used to send a [PayloadTypes.cancelStream](xref:botframework-streaming.PayloadTypes.cancelStream). | ||
* @param id The ID to assign to the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) used by this operation. | ||
*/ | ||
SendOperations.prototype.sendCancelStream = function (id) { | ||
@@ -110,0 +128,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -17,8 +17,32 @@ /** | ||
private readonly onCancelStream; | ||
/** | ||
* Initializes a new instance of the [StreamManager](xref:botframework-streaming.StreamManager) class. | ||
* @param onCancelStream Function to trigger if the managed stream is cancelled. | ||
*/ | ||
constructor(onCancelStream: Function); | ||
/** | ||
* Retrieves a [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID if one exists, otherwise a new instance is created and assigned the given ID. | ||
* @param id The ID of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) to retrieve or create. | ||
* @returns The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID. | ||
*/ | ||
getPayloadAssembler(id: string): PayloadAssembler; | ||
/** | ||
* Retrieves the [SubscribableStream](xref:botframework-streaming.SubscribableStream) from the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) this manager manages. | ||
* @param header The Header of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to retrieve. | ||
* @returns The [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given header. | ||
*/ | ||
getPayloadStream(header: IHeader): SubscribableStream; | ||
/** | ||
* Used to set the behavior of the managed [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) when data is received. | ||
* @param header The Header of the stream. | ||
* @param contentStream The [SubscribableStream](xref:botframework-streaming.SubscribableStream) to write incoming data to. | ||
* @param contentLength The amount of data to write to the contentStream. | ||
*/ | ||
onReceive(header: IHeader, contentStream: SubscribableStream, contentLength: number): void; | ||
/** | ||
* Closes the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to the [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given ID. | ||
* @param id The ID of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to close. | ||
*/ | ||
closeStream(id: string): void; | ||
} | ||
//# sourceMappingURL=streamManager.d.ts.map |
@@ -8,2 +8,6 @@ "use strict"; | ||
var StreamManager = /** @class */ (function () { | ||
/** | ||
* Initializes a new instance of the [StreamManager](xref:botframework-streaming.StreamManager) class. | ||
* @param onCancelStream Function to trigger if the managed stream is cancelled. | ||
*/ | ||
function StreamManager(onCancelStream) { | ||
@@ -13,2 +17,7 @@ this.activeAssemblers = []; | ||
} | ||
/** | ||
* Retrieves a [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID if one exists, otherwise a new instance is created and assigned the given ID. | ||
* @param id The ID of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) to retrieve or create. | ||
* @returns The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID. | ||
*/ | ||
StreamManager.prototype.getPayloadAssembler = function (id) { | ||
@@ -25,2 +34,7 @@ if (!this.activeAssemblers[id]) { | ||
}; | ||
/** | ||
* Retrieves the [SubscribableStream](xref:botframework-streaming.SubscribableStream) from the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) this manager manages. | ||
* @param header The Header of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to retrieve. | ||
* @returns The [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given header. | ||
*/ | ||
StreamManager.prototype.getPayloadStream = function (header) { | ||
@@ -30,2 +44,8 @@ var assembler = this.getPayloadAssembler(header.id); | ||
}; | ||
/** | ||
* Used to set the behavior of the managed [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) when data is received. | ||
* @param header The Header of the stream. | ||
* @param contentStream The [SubscribableStream](xref:botframework-streaming.SubscribableStream) to write incoming data to. | ||
* @param contentLength The amount of data to write to the contentStream. | ||
*/ | ||
StreamManager.prototype.onReceive = function (header, contentStream, contentLength) { | ||
@@ -37,2 +57,6 @@ if (!this.activeAssemblers[header.id]) { | ||
}; | ||
/** | ||
* Closes the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to the [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given ID. | ||
* @param id The ID of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to close. | ||
*/ | ||
StreamManager.prototype.closeStream = function (id) { | ||
@@ -39,0 +63,0 @@ if (!this.activeAssemblers[id]) { |
@@ -43,5 +43,11 @@ /** | ||
disconnect(e?: TransportDisconnectedEvent): void; | ||
/** | ||
* @private | ||
*/ | ||
private runReceive; | ||
/** | ||
* @private | ||
*/ | ||
private receivePackets; | ||
} | ||
//# sourceMappingURL=payloadReceiver.d.ts.map |
@@ -98,5 +98,11 @@ "use strict"; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadReceiver.prototype.runReceive = function () { | ||
this.receivePackets().catch(); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadReceiver.prototype.receivePackets = function () { | ||
@@ -103,0 +109,0 @@ return __awaiter(this, void 0, void 0, function () { |
@@ -45,4 +45,7 @@ /** | ||
disconnect(e?: TransportDisconnectedEvent): void; | ||
/** | ||
* @private | ||
*/ | ||
private writePacket; | ||
} | ||
//# sourceMappingURL=payloadSender.d.ts.map |
@@ -64,2 +64,5 @@ "use strict"; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
PayloadSender.prototype.writePacket = function (packet) { | ||
@@ -66,0 +69,0 @@ try { |
@@ -8,2 +8,5 @@ /** | ||
*/ | ||
/** | ||
* Event to be included when disconnection events are fired. | ||
*/ | ||
export declare class TransportDisconnectedEvent { | ||
@@ -10,0 +13,0 @@ /** |
@@ -10,2 +10,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Event to be included when disconnection events are fired. | ||
*/ | ||
var TransportDisconnectedEvent = /** @class */ (function () { | ||
@@ -12,0 +15,0 @@ /** |
@@ -15,2 +15,5 @@ /** | ||
import { IReceiveResponse, IReceiveRequest } from './interfaces'; | ||
/** | ||
* Creates a protocol adapter for Streaming. | ||
*/ | ||
export declare class ProtocolAdapter { | ||
@@ -25,7 +28,26 @@ private readonly requestHandler; | ||
constructor(requestHandler: RequestHandler, requestManager: RequestManager, sender: PayloadSender, receiver: PayloadReceiver); | ||
/** | ||
* Sends a request over the attached request manager. | ||
* @param request The outgoing request to send. | ||
* @returns The response to the specified request. | ||
*/ | ||
sendRequest(request: StreamingRequest): Promise<IReceiveResponse>; | ||
/** | ||
* Executes the receive pipeline when a request comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param request The incoming request to process. | ||
*/ | ||
onReceiveRequest(id: string, request: IReceiveRequest): Promise<void>; | ||
/** | ||
* Executes the receive pipeline when a response comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param response The incoming response to process. | ||
*/ | ||
onReceiveResponse(id: string, response: IReceiveResponse): Promise<void>; | ||
/** | ||
* Executes the receive pipeline when a cancellation comes in. | ||
* @param contentStreamAssembler The payload assembler processing the incoming data that this cancellation request targets. | ||
*/ | ||
onCancelStream(contentStreamAssembler: PayloadAssembler): void; | ||
} | ||
//# sourceMappingURL=protocolAdapter.d.ts.map |
@@ -42,2 +42,5 @@ "use strict"; | ||
var protocol_base_1 = require("./utilities/protocol-base"); | ||
/** | ||
* Creates a protocol adapter for Streaming. | ||
*/ | ||
var ProtocolAdapter = /** @class */ (function () { | ||
@@ -64,7 +67,7 @@ /// <summary> | ||
} | ||
/// <summary> | ||
/// Sends a request over the attached request manager. | ||
/// </summary> | ||
/// <param name="request">The outgoing request to send.</param> | ||
/// <param name="cancellationToken">Optional cancellation token.</param> | ||
/** | ||
* Sends a request over the attached request manager. | ||
* @param request The outgoing request to send. | ||
* @returns The response to the specified request. | ||
*/ | ||
ProtocolAdapter.prototype.sendRequest = function (request) { | ||
@@ -85,7 +88,7 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/// <summary> | ||
/// Executes the receive pipeline when a request comes in. | ||
/// </summary> | ||
/// <param name="id">The id the resources created for the response will be assigned.</param> | ||
/// <param name="request">The incoming request to process.</param> | ||
/** | ||
* Executes the receive pipeline when a request comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param request The incoming request to process. | ||
*/ | ||
ProtocolAdapter.prototype.onReceiveRequest = function (id, request) { | ||
@@ -111,7 +114,7 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/// <summary> | ||
/// Executes the receive pipeline when a response comes in. | ||
/// </summary> | ||
/// <param name="id">The id the resources created for the response will be assigned.</param> | ||
/// <param name="response">The incoming response to process.</param> | ||
/** | ||
* Executes the receive pipeline when a response comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param response The incoming response to process. | ||
*/ | ||
ProtocolAdapter.prototype.onReceiveResponse = function (id, response) { | ||
@@ -129,9 +132,6 @@ return __awaiter(this, void 0, void 0, function () { | ||
}; | ||
/// <summary> | ||
/// Executes the receive pipeline when a cancellation comes in. | ||
/// </summary> | ||
/// <param name="contentStreamAssembler"> | ||
/// The payload assembler processing the incoming data that this | ||
/// cancellation request targets. | ||
/// </param> | ||
/** | ||
* Executes the receive pipeline when a cancellation comes in. | ||
* @param contentStreamAssembler The payload assembler processing the incoming data that this cancellation request targets. | ||
*/ | ||
ProtocolAdapter.prototype.onCancelStream = function (contentStreamAssembler) { | ||
@@ -138,0 +138,0 @@ this.sendOperations.sendCancelStream(contentStreamAssembler.id).catch(); |
@@ -9,2 +9,5 @@ /** | ||
import { HttpContent, HttpContentStream } from './httpContentStream'; | ||
/** | ||
* The basic request type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP request messages. | ||
*/ | ||
export declare class StreamingRequest { | ||
@@ -11,0 +14,0 @@ /** |
@@ -12,2 +12,5 @@ "use strict"; | ||
var subscribableStream_1 = require("./subscribableStream"); | ||
/** | ||
* The basic request type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP request messages. | ||
*/ | ||
var StreamingRequest = /** @class */ (function () { | ||
@@ -14,0 +17,0 @@ function StreamingRequest() { |
@@ -9,2 +9,5 @@ /** | ||
import { HttpContent, HttpContentStream } from './httpContentStream'; | ||
/** | ||
* The basic response type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP response messages. | ||
*/ | ||
export declare class StreamingResponse { | ||
@@ -11,0 +14,0 @@ statusCode: number; |
@@ -12,2 +12,5 @@ "use strict"; | ||
var subscribableStream_1 = require("./subscribableStream"); | ||
/** | ||
* The basic response type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP response messages. | ||
*/ | ||
var StreamingResponse = /** @class */ (function () { | ||
@@ -14,0 +17,0 @@ function StreamingResponse() { |
@@ -10,2 +10,5 @@ /// <reference types="node" /> | ||
import { Duplex, DuplexOptions } from 'stream'; | ||
/** | ||
* An extension of `Duplex` that operates in conjunction with a `PayloadAssembler` to convert raw bytes into a consumable form. | ||
*/ | ||
export declare class SubscribableStream extends Duplex { | ||
@@ -15,7 +18,28 @@ length: number; | ||
private _onData; | ||
/** | ||
* Initializes a new instance of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) class. | ||
* @param options The `DuplexOptions` to use when constructing this stream. | ||
*/ | ||
constructor(options?: DuplexOptions); | ||
/** | ||
* Writes data to the buffered list. | ||
* All calls to writable.write() that occur between the time writable._write() is called and the callback is called will cause the written data to be buffered. | ||
* @param chunk The Buffer to be written. | ||
* @param encoding The encoding. | ||
* @param callback Callback for when this chunk of data is flushed. | ||
*/ | ||
_write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; | ||
/** | ||
* Reads the buffered list. | ||
* Once the readable._read() method has been called, it will not be called again until more data is pushed through the readable.push() method. | ||
* Empty data such as empty buffers and strings will not cause readable._read() to be called. | ||
* @param size Number of bytes to read. | ||
*/ | ||
_read(size: number): void; | ||
/** | ||
* Subscribes to the stream when receives data. | ||
* @param onData Callback to be called when onData is executed. | ||
*/ | ||
subscribe(onData: (chunk: any) => void): void; | ||
} | ||
//# sourceMappingURL=subscribableStream.d.ts.map |
@@ -24,4 +24,11 @@ "use strict"; | ||
var stream_1 = require("stream"); | ||
/** | ||
* An extension of `Duplex` that operates in conjunction with a `PayloadAssembler` to convert raw bytes into a consumable form. | ||
*/ | ||
var SubscribableStream = /** @class */ (function (_super) { | ||
__extends(SubscribableStream, _super); | ||
/** | ||
* Initializes a new instance of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) class. | ||
* @param options The `DuplexOptions` to use when constructing this stream. | ||
*/ | ||
function SubscribableStream(options) { | ||
@@ -33,2 +40,9 @@ var _this = _super.call(this, options) || this; | ||
} | ||
/** | ||
* Writes data to the buffered list. | ||
* All calls to writable.write() that occur between the time writable._write() is called and the callback is called will cause the written data to be buffered. | ||
* @param chunk The Buffer to be written. | ||
* @param encoding The encoding. | ||
* @param callback Callback for when this chunk of data is flushed. | ||
*/ | ||
SubscribableStream.prototype._write = function (chunk, encoding, callback) { | ||
@@ -43,2 +57,8 @@ var buffer = Buffer.from(chunk); | ||
}; | ||
/** | ||
* Reads the buffered list. | ||
* Once the readable._read() method has been called, it will not be called again until more data is pushed through the readable.push() method. | ||
* Empty data such as empty buffers and strings will not cause readable._read() to be called. | ||
* @param size Number of bytes to read. | ||
*/ | ||
SubscribableStream.prototype._read = function (size) { | ||
@@ -59,2 +79,6 @@ if (this.bufferList.length === 0) { | ||
}; | ||
/** | ||
* Subscribes to the stream when receives data. | ||
* @param onData Callback to be called when onData is executed. | ||
*/ | ||
SubscribableStream.prototype.subscribe = function (onData) { | ||
@@ -61,0 +85,0 @@ this._onData = onData; |
@@ -0,2 +1,6 @@ | ||
/** | ||
* Generates an uuid v4 string. | ||
* @returns An uuidv4 string. | ||
*/ | ||
export declare function generateGuid(): string; | ||
//# sourceMappingURL=protocol-base.d.ts.map |
@@ -11,2 +11,6 @@ "use strict"; | ||
var uuidv4 = require("uuid/v4"); | ||
/** | ||
* Generates an uuid v4 string. | ||
* @returns An uuidv4 string. | ||
*/ | ||
function generateGuid() { | ||
@@ -13,0 +17,0 @@ return uuidv4(); |
@@ -9,2 +9,5 @@ /** | ||
import { IBrowserWebSocket, ISocket, INodeBuffer } from '../interfaces'; | ||
/** | ||
* Represents a WebSocket that implements [ISocket](xref:botframework-streaming.ISocket). | ||
*/ | ||
export declare class BrowserWebSocket implements ISocket { | ||
@@ -11,0 +14,0 @@ private webSocket; |
@@ -38,2 +38,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Represents a WebSocket that implements [ISocket](xref:botframework-streaming.ISocket). | ||
*/ | ||
var BrowserWebSocket = /** @class */ (function () { | ||
@@ -40,0 +43,0 @@ /** |
@@ -50,4 +50,7 @@ /** | ||
send(request: StreamingRequest): Promise<IReceiveResponse>; | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected; | ||
} | ||
//# sourceMappingURL=browserWebSocketClient.d.ts.map |
@@ -116,2 +116,5 @@ "use strict"; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
WebSocketClient.prototype.onConnectionDisconnected = function (sender, args) { | ||
@@ -118,0 +121,0 @@ if (this._disconnectionHandler != null) { |
@@ -56,6 +56,15 @@ /** | ||
onReceive(data: INodeBuffer): void; | ||
/** | ||
* @private | ||
*/ | ||
private onClose; | ||
/** | ||
* @private | ||
*/ | ||
private onError; | ||
/** | ||
* @private | ||
*/ | ||
private trySignalData; | ||
} | ||
//# sourceMappingURL=webSocketTransport.d.ts.map |
@@ -128,2 +128,5 @@ "use strict"; | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
WebSocketTransport.prototype.onClose = function () { | ||
@@ -140,2 +143,5 @@ if (this._activeReceiveReject) { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
WebSocketTransport.prototype.onError = function (err) { | ||
@@ -147,2 +153,5 @@ if (this._activeReceiveReject) { | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
WebSocketTransport.prototype.trySignalData = function () { | ||
@@ -149,0 +158,0 @@ if (this._activeReceiveResolve) { |
@@ -25,14 +25,54 @@ /** | ||
private readonly _utf; | ||
/** | ||
* Initializes a new instance of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param params Parameters for a streaming assembler. | ||
*/ | ||
constructor(streamManager: StreamManager, params: IAssemblerParams); | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
getPayloadStream(): SubscribableStream; | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param stream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
onReceive(header: IHeader, stream: SubscribableStream, contentLength: number): void; | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
close(): void; | ||
/** | ||
* Creates a new [SubscribableStream](xref:botframework-streaming.SubscribableStream) instance. | ||
* @returns The new stream ready for consumption. | ||
*/ | ||
private createPayloadStream; | ||
/** | ||
* @private | ||
*/ | ||
private payloadFromJson; | ||
/** | ||
* @private | ||
*/ | ||
private stripBOM; | ||
/** | ||
* @private | ||
*/ | ||
private process; | ||
/** | ||
* @private | ||
*/ | ||
private processResponse; | ||
/** | ||
* @private | ||
*/ | ||
private processRequest; | ||
/** | ||
* @private | ||
*/ | ||
private processStreams; | ||
} | ||
//# sourceMappingURL=payloadAssembler.d.ts.map |
@@ -25,2 +25,7 @@ "use strict"; | ||
class PayloadAssembler { | ||
/** | ||
* Initializes a new instance of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param params Parameters for a streaming assembler. | ||
*/ | ||
constructor(streamManager, params) { | ||
@@ -44,2 +49,6 @@ this._byteOrderMark = 0xfeff; | ||
} | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
getPayloadStream() { | ||
@@ -51,2 +60,8 @@ if (!this.stream) { | ||
} | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param stream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
onReceive(header, stream, contentLength) { | ||
@@ -61,14 +76,30 @@ this.end = header.end; | ||
} | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
close() { | ||
this._streamManager.closeStream(this.id); | ||
} | ||
/** | ||
* Creates a new [SubscribableStream](xref:botframework-streaming.SubscribableStream) instance. | ||
* @returns The new stream ready for consumption. | ||
*/ | ||
createPayloadStream() { | ||
return new subscribableStream_1.SubscribableStream(); | ||
} | ||
/** | ||
* @private | ||
*/ | ||
payloadFromJson(json) { | ||
return JSON.parse(json.charCodeAt(0) === this._byteOrderMark ? json.slice(1) : json); | ||
} | ||
/** | ||
* @private | ||
*/ | ||
stripBOM(input) { | ||
return input.charCodeAt(0) === this._byteOrderMark ? input.slice(1) : input; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
process(stream) { | ||
@@ -89,2 +120,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
processResponse(streamDataAsString) { | ||
@@ -97,2 +131,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
processRequest(streamDataAsString) { | ||
@@ -105,2 +142,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
processStreams(responsePayload, receiveResponse) { | ||
@@ -107,0 +147,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -10,2 +10,5 @@ /** | ||
import { PayloadAssembler } from './assemblers'; | ||
/** | ||
* A stream of fixed or infinite length containing content to be decoded. | ||
*/ | ||
export declare class ContentStream { | ||
@@ -15,11 +18,39 @@ id: string; | ||
private stream; | ||
/** | ||
* Initializes a new instance of the [ContentStream](xref:botframework-streaming.ContentStream) class. | ||
* @param id The ID assigned to this instance. | ||
* @param assembler The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to this instance. | ||
*/ | ||
constructor(id: string, assembler: PayloadAssembler); | ||
/** | ||
* Gets the name of the type of the object contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
readonly contentType: string; | ||
/** | ||
* Gets the length of this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
readonly length: number; | ||
/** | ||
* Gets the data contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
getStream(): SubscribableStream; | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
cancel(): void; | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a string. | ||
* @returns A string Promise with [SubscribableStream](xref:botframework-streaming.SubscribableStream) content. | ||
*/ | ||
readAsString(): Promise<string>; | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a typed JSON object. | ||
* @returns A typed object Promise with `SubscribableStream` content. | ||
*/ | ||
readAsJson<T>(): Promise<T>; | ||
/** | ||
* @private | ||
*/ | ||
private readAll; | ||
} | ||
//# sourceMappingURL=contentStream.d.ts.map |
@@ -11,3 +11,11 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* A stream of fixed or infinite length containing content to be decoded. | ||
*/ | ||
class ContentStream { | ||
/** | ||
* Initializes a new instance of the [ContentStream](xref:botframework-streaming.ContentStream) class. | ||
* @param id The ID assigned to this instance. | ||
* @param assembler The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to this instance. | ||
*/ | ||
constructor(id, assembler) { | ||
@@ -20,8 +28,17 @@ if (!assembler) { | ||
} | ||
/** | ||
* Gets the name of the type of the object contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
get contentType() { | ||
return this.assembler.payloadType; | ||
} | ||
/** | ||
* Gets the length of this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
get length() { | ||
return this.assembler.contentLength; | ||
} | ||
/** | ||
* Gets the data contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
getStream() { | ||
@@ -33,5 +50,12 @@ if (!this.stream) { | ||
} | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
cancel() { | ||
this.assembler.close(); | ||
} | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a string. | ||
* @returns A string Promise with [SubscribableStream](xref:botframework-streaming.SubscribableStream) content. | ||
*/ | ||
readAsString() { | ||
@@ -43,2 +67,6 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a typed JSON object. | ||
* @returns A typed object Promise with `SubscribableStream` content. | ||
*/ | ||
readAsJson() { | ||
@@ -55,2 +83,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
readAll() { | ||
@@ -57,0 +88,0 @@ return __awaiter(this, void 0, void 0, function* () { |
import { PayloadTypes } from '../payloads/payloadTypes'; | ||
import { PayloadSender } from '../payloadTransport/payloadSender'; | ||
/** | ||
* Streaming cancel disassembler. | ||
*/ | ||
export declare class CancelDisassembler { | ||
@@ -7,5 +10,14 @@ private readonly sender; | ||
private readonly payloadType; | ||
/** | ||
* Initializes a new instance of the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) that this Cancel request will be sent by. | ||
* @param id The ID of the Stream to cancel. | ||
* @param payloadType The type of the Stream that is being cancelled. | ||
*/ | ||
constructor(sender: PayloadSender, id: string, payloadType: PayloadTypes); | ||
/** | ||
* Initiates the process of disassembling the request and signals the [PayloadSender](xref:botframework-streaming.PayloadSender) to begin sending. | ||
*/ | ||
disassemble(): void; | ||
} | ||
//# sourceMappingURL=cancelDisassembler.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Streaming cancel disassembler. | ||
*/ | ||
class CancelDisassembler { | ||
/** | ||
* Initializes a new instance of the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) that this Cancel request will be sent by. | ||
* @param id The ID of the Stream to cancel. | ||
* @param payloadType The type of the Stream that is being cancelled. | ||
*/ | ||
constructor(sender, id, payloadType) { | ||
@@ -9,2 +18,5 @@ this.sender = sender; | ||
} | ||
/** | ||
* Initiates the process of disassembling the request and signals the [PayloadSender](xref:botframework-streaming.PayloadSender) to begin sending. | ||
*/ | ||
disassemble() { | ||
@@ -11,0 +23,0 @@ const header = { payloadType: this.payloadType, payloadLength: 0, id: this.id, end: true }; |
@@ -19,5 +19,14 @@ /** | ||
payloadType: PayloadTypes; | ||
/** | ||
* Initializes a new instance of the [HttpContentStreamDisassembler](xref:botframework-streaming.HttpContentStreamDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param contentStream The [HttpContentStream](xref:botframework-streaming.HttpContentStream) to be disassembled. | ||
*/ | ||
constructor(sender: PayloadSender, contentStream: HttpContentStream); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Strea. | ||
*/ | ||
getStream(): Promise<IStreamWrapper>; | ||
} | ||
//# sourceMappingURL=httpContentStreamDisassembler.d.ts.map |
@@ -17,2 +17,7 @@ "use strict"; | ||
class HttpContentStreamDisassembler extends payloadDisassembler_1.PayloadDisassembler { | ||
/** | ||
* Initializes a new instance of the [HttpContentStreamDisassembler](xref:botframework-streaming.HttpContentStreamDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param contentStream The [HttpContentStream](xref:botframework-streaming.HttpContentStream) to be disassembled. | ||
*/ | ||
constructor(sender, contentStream) { | ||
@@ -23,2 +28,6 @@ super(sender, contentStream.id); | ||
} | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Strea. | ||
*/ | ||
getStream() { | ||
@@ -25,0 +34,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -13,8 +13,27 @@ import { PayloadTypes } from '../payloads/payloadTypes'; | ||
private readonly id; | ||
/** | ||
* Initializes a new instance of the [PayloadDisassembler](xref:botframework-streaming.PayloadDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) used to send the disassembled payload chunks. | ||
* @param id The ID of this disassembler. | ||
*/ | ||
constructor(sender: PayloadSender, id: string); | ||
/** | ||
* Serializes the item into the [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) that exposes the stream and length of the result. | ||
* @param item The item to be serialized. | ||
*/ | ||
protected static serialize<T>(item: T): IStreamWrapper; | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
abstract getStream(): Promise<IStreamWrapper>; | ||
/** | ||
* Begins the process of disassembling a payload and sending the resulting chunks to the [PayloadSender](xref:botframework-streaming.PayloadSender) to dispatch over the transport. | ||
*/ | ||
disassemble(): Promise<void>; | ||
/** | ||
* Begins the process of disassembling a payload and signals the [PayloadSender](xref:botframework-streaming.PayloadSender). | ||
*/ | ||
private send; | ||
} | ||
//# sourceMappingURL=payloadDisassembler.d.ts.map |
@@ -16,2 +16,7 @@ "use strict"; | ||
class PayloadDisassembler { | ||
/** | ||
* Initializes a new instance of the [PayloadDisassembler](xref:botframework-streaming.PayloadDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) used to send the disassembled payload chunks. | ||
* @param id The ID of this disassembler. | ||
*/ | ||
constructor(sender, id) { | ||
@@ -21,2 +26,6 @@ this.sender = sender; | ||
} | ||
/** | ||
* Serializes the item into the [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) that exposes the stream and length of the result. | ||
* @param item The item to be serialized. | ||
*/ | ||
static serialize(item) { | ||
@@ -28,2 +37,5 @@ const stream = new subscribableStream_1.SubscribableStream(); | ||
} | ||
/** | ||
* Begins the process of disassembling a payload and sending the resulting chunks to the [PayloadSender](xref:botframework-streaming.PayloadSender) to dispatch over the transport. | ||
*/ | ||
disassemble() { | ||
@@ -37,2 +49,5 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* Begins the process of disassembling a payload and signals the [PayloadSender](xref:botframework-streaming.PayloadSender). | ||
*/ | ||
send() { | ||
@@ -39,0 +54,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -19,5 +19,15 @@ /** | ||
payloadType: PayloadTypes; | ||
/** | ||
* Initializes a new instance of the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param request The request to be disassembled. | ||
*/ | ||
constructor(sender: PayloadSender, id: string, request?: StreamingRequest); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
getStream(): Promise<IStreamWrapper>; | ||
} | ||
//# sourceMappingURL=requestDisassembler.d.ts.map |
@@ -24,2 +24,8 @@ "use strict"; | ||
class RequestDisassembler extends payloadDisassembler_1.PayloadDisassembler { | ||
/** | ||
* Initializes a new instance of the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param request The request to be disassembled. | ||
*/ | ||
constructor(sender, id, request) { | ||
@@ -30,2 +36,6 @@ super(sender, id); | ||
} | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
getStream() { | ||
@@ -32,0 +42,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -19,5 +19,15 @@ /** | ||
readonly payloadType: PayloadTypes; | ||
/** | ||
* Initializes a new instance of the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param response The response to be disassembled. | ||
*/ | ||
constructor(sender: PayloadSender, id: string, response: StreamingResponse); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
getStream(): Promise<IStreamWrapper>; | ||
} | ||
//# sourceMappingURL=responseDisassembler.d.ts.map |
@@ -24,2 +24,8 @@ "use strict"; | ||
class ResponseDisassembler extends payloadDisassembler_1.PayloadDisassembler { | ||
/** | ||
* Initializes a new instance of the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param response The response to be disassembled. | ||
*/ | ||
constructor(sender, id, response) { | ||
@@ -30,2 +36,6 @@ super(sender, id); | ||
} | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
getStream() { | ||
@@ -32,0 +42,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -10,2 +10,6 @@ /** | ||
import { IHttpContentHeaders } from './interfaces/IHttpContentHeaders'; | ||
/** | ||
* An attachment contained within a StreamingRequest's stream collection, | ||
* which itself contains any form of media item. | ||
*/ | ||
export declare class HttpContentStream { | ||
@@ -19,10 +23,25 @@ readonly id: string; | ||
}; | ||
/** | ||
* Initializes a new instance of the [HttpContentStream](xref:botframework-streaming.HttpContentStream) class. | ||
* @param content The [HttpContent](xref:botframework-streaming.HttpContent) to assign to the [HttpContentStream](xref:botframework-streaming.HttpContentStream). | ||
*/ | ||
constructor(content: HttpContent); | ||
} | ||
/** | ||
* The HttpContent class that contains a [SubscribableStream](xref:botframework-streaming.SubscribableStream). | ||
*/ | ||
export declare class HttpContent { | ||
headers: IHttpContentHeaders; | ||
private readonly stream; | ||
/** | ||
* Initializes a new instance of the [HttpContent](xref:botframework-streaming.HttpContent) class. | ||
* @param headers The Streaming Http content header definition. | ||
* @param stream The stream of buffered data. | ||
*/ | ||
constructor(headers: IHttpContentHeaders, stream: SubscribableStream); | ||
/** | ||
* Gets the data contained within this [HttpContent](xref:botframework-streaming.HttpContent). | ||
*/ | ||
getStream(): SubscribableStream; | ||
} | ||
//# sourceMappingURL=httpContentStream.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const protocol_base_1 = require("./utilities/protocol-base"); | ||
/** | ||
* An attachment contained within a StreamingRequest's stream collection, | ||
* which itself contains any form of media item. | ||
*/ | ||
class HttpContentStream { | ||
/** | ||
* Initializes a new instance of the [HttpContentStream](xref:botframework-streaming.HttpContentStream) class. | ||
* @param content The [HttpContent](xref:botframework-streaming.HttpContent) to assign to the [HttpContentStream](xref:botframework-streaming.HttpContentStream). | ||
*/ | ||
constructor(content) { | ||
@@ -16,3 +24,11 @@ this.id = protocol_base_1.generateGuid(); | ||
exports.HttpContentStream = HttpContentStream; | ||
/** | ||
* The HttpContent class that contains a [SubscribableStream](xref:botframework-streaming.SubscribableStream). | ||
*/ | ||
class HttpContent { | ||
/** | ||
* Initializes a new instance of the [HttpContent](xref:botframework-streaming.HttpContent) class. | ||
* @param headers The Streaming Http content header definition. | ||
* @param stream The stream of buffered data. | ||
*/ | ||
constructor(headers, stream) { | ||
@@ -22,2 +38,5 @@ this.headers = headers; | ||
} | ||
/** | ||
* Gets the data contained within this [HttpContent](xref:botframework-streaming.HttpContent). | ||
*/ | ||
getStream() { | ||
@@ -24,0 +43,0 @@ return this.stream; |
@@ -39,4 +39,7 @@ import { RequestHandler } from '../requestHandler'; | ||
send(request: StreamingRequest): Promise<IReceiveResponse>; | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected; | ||
} | ||
//# sourceMappingURL=namedPipeClient.d.ts.map |
@@ -76,2 +76,5 @@ "use strict"; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
onConnectionDisconnected(sender, args) { | ||
@@ -78,0 +81,0 @@ if (!this._isDisconnecting) { |
@@ -47,4 +47,7 @@ import { RequestHandler } from '../requestHandler'; | ||
send(request: StreamingRequest): Promise<IReceiveResponse>; | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected; | ||
} | ||
//# sourceMappingURL=namedPipeServer.d.ts.map |
@@ -115,2 +115,5 @@ "use strict"; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
onConnectionDisconnected() { | ||
@@ -117,0 +120,0 @@ if (!this._isDisconnecting) { |
@@ -50,7 +50,19 @@ /** | ||
receive(count: number): Promise<INodeBuffer>; | ||
/** | ||
* @private | ||
*/ | ||
private socketReceive; | ||
/** | ||
* @private | ||
*/ | ||
private socketClose; | ||
/** | ||
* @private | ||
*/ | ||
private socketError; | ||
/** | ||
* @private | ||
*/ | ||
private trySignalData; | ||
} | ||
//# sourceMappingURL=namedPipeTransport.d.ts.map |
@@ -71,2 +71,5 @@ "use strict"; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
socketReceive(data) { | ||
@@ -78,2 +81,5 @@ if (this._queue && data && data.length > 0) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
socketClose() { | ||
@@ -90,2 +96,5 @@ if (this._activeReceiveReject) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
socketError(err) { | ||
@@ -97,2 +106,5 @@ if (this._activeReceiveReject) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
trySignalData() { | ||
@@ -99,0 +111,0 @@ if (this._activeReceiveResolve) { |
@@ -43,4 +43,10 @@ /** | ||
static deserialize(buffer: INodeBuffer): IHeader; | ||
/** | ||
* Creates a padded string based on a length and character to be padded to. | ||
* @param lengthValue The value to be assingned on the result. | ||
* @param totalLength The length of the padded string result. | ||
* @param padChar The character value to use as filling. | ||
*/ | ||
static headerLengthPadder(lengthValue: number, totalLength: number, padChar: string): string; | ||
} | ||
//# sourceMappingURL=headerSerializer.d.ts.map |
@@ -57,2 +57,8 @@ "use strict"; | ||
} | ||
/** | ||
* Creates a padded string based on a length and character to be padded to. | ||
* @param lengthValue The value to be assingned on the result. | ||
* @param totalLength The length of the padded string result. | ||
* @param padChar The character value to use as filling. | ||
*/ | ||
static headerLengthPadder(lengthValue, totalLength, padChar) { | ||
@@ -59,0 +65,0 @@ const result = Array(totalLength + 1).join(padChar); |
@@ -19,7 +19,27 @@ /** | ||
private readonly activeAssemblers; | ||
/** | ||
* Initializes a new instance of the [PayloadAssemblerManager](xref:botframework-streaming.PayloadAssemblerManager) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param onReceiveResponse Function that executes when new bytes are received on a `response` stream. | ||
* @param onReceiveRequest Function that executes when new bytes are received on a `request` stream. | ||
*/ | ||
constructor(streamManager: StreamManager, onReceiveResponse: Function, onReceiveRequest: Function); | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @param header The Header of the Stream to retrieve. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
getPayloadStream(header: IHeader): SubscribableStream; | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param contentStream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
onReceive(header: IHeader, contentStream: SubscribableStream, contentLength: number): void; | ||
/** | ||
* @private | ||
*/ | ||
private createPayloadAssembler; | ||
} | ||
//# sourceMappingURL=payloadAssemblerManager.d.ts.map |
@@ -9,2 +9,8 @@ "use strict"; | ||
class PayloadAssemblerManager { | ||
/** | ||
* Initializes a new instance of the [PayloadAssemblerManager](xref:botframework-streaming.PayloadAssemblerManager) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param onReceiveResponse Function that executes when new bytes are received on a `response` stream. | ||
* @param onReceiveRequest Function that executes when new bytes are received on a `request` stream. | ||
*/ | ||
constructor(streamManager, onReceiveResponse, onReceiveRequest) { | ||
@@ -16,2 +22,7 @@ this.activeAssemblers = {}; | ||
} | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @param header The Header of the Stream to retrieve. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
getPayloadStream(header) { | ||
@@ -29,2 +40,8 @@ if (header.payloadType === payloadTypes_1.PayloadTypes.stream) { | ||
} | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param contentStream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
onReceive(header, contentStream, contentLength) { | ||
@@ -44,2 +61,5 @@ if (header.payloadType === payloadTypes_1.PayloadTypes.stream) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
createPayloadAssembler(header) { | ||
@@ -46,0 +66,0 @@ if (header.payloadType === payloadTypes_1.PayloadTypes.request) { |
@@ -14,6 +14,20 @@ /** | ||
private readonly _pendingRequests; | ||
/** | ||
* Gets the count of the pending requests. | ||
* @returns Number with the pending requests count. | ||
*/ | ||
pendingRequestCount(): number; | ||
/** | ||
* Signal fired when all response tasks have completed. | ||
* @param requestId The ID of the StreamingRequest. | ||
* @param response The [IReceiveResponse](xref:botframework-streaming.IReceiveResponse) in response to the request. | ||
*/ | ||
signalResponse(requestId: string, response: IReceiveResponse): Promise<boolean>; | ||
/** | ||
* Constructs and returns a response for this request. | ||
* @param requestId The ID of the StreamingRequest being responded to. | ||
* @returns The response to the specified request. | ||
*/ | ||
getResponse(requestId: string): Promise<IReceiveResponse>; | ||
} | ||
//# sourceMappingURL=requestManager.d.ts.map |
@@ -23,5 +23,14 @@ "use strict"; | ||
} | ||
/** | ||
* Gets the count of the pending requests. | ||
* @returns Number with the pending requests count. | ||
*/ | ||
pendingRequestCount() { | ||
return Object.keys(this._pendingRequests).length; | ||
} | ||
/** | ||
* Signal fired when all response tasks have completed. | ||
* @param requestId The ID of the StreamingRequest. | ||
* @param response The [IReceiveResponse](xref:botframework-streaming.IReceiveResponse) in response to the request. | ||
*/ | ||
signalResponse(requestId, response) { | ||
@@ -38,2 +47,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* Constructs and returns a response for this request. | ||
* @param requestId The ID of the StreamingRequest being responded to. | ||
* @returns The response to the specified request. | ||
*/ | ||
getResponse(requestId) { | ||
@@ -40,0 +54,0 @@ let pendingRequest = this._pendingRequests[requestId]; |
@@ -16,7 +16,25 @@ /** | ||
private readonly payloadSender; | ||
/** | ||
* Initializes a new instance of the [SendOperations](xref:botframework-streaming.SendOperations) class. | ||
* @param payloadSender The [PayloadSender](xref:botframework-streaming.PayloadSender) that will send the disassembled data from all of this instance's send operations. | ||
*/ | ||
constructor(payloadSender: PayloadSender); | ||
/** | ||
* The send operation used to send a [StreamingRequest](xref:botframework-streaming.StreamingRequest). | ||
* @param id The ID to assign to the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) used by this operation. | ||
* @param request The request to send. | ||
*/ | ||
sendRequest(id: string, request: StreamingRequest): Promise<void>; | ||
/** | ||
* The send operation used to send a [PayloadTypes.response](xref:botframework-streaming.PayloadTypes.response). | ||
* @param id The ID to assign to the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) used by this operation. | ||
* @param response The response to send. | ||
*/ | ||
sendResponse(id: string, response: StreamingResponse): Promise<void>; | ||
/** | ||
* The send operation used to send a [PayloadTypes.cancelStream](xref:botframework-streaming.PayloadTypes.cancelStream). | ||
* @param id The ID to assign to the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) used by this operation. | ||
*/ | ||
sendCancelStream(id: string): Promise<void>; | ||
} | ||
//# sourceMappingURL=sendOperations.d.ts.map |
@@ -20,5 +20,14 @@ "use strict"; | ||
class SendOperations { | ||
/** | ||
* Initializes a new instance of the [SendOperations](xref:botframework-streaming.SendOperations) class. | ||
* @param payloadSender The [PayloadSender](xref:botframework-streaming.PayloadSender) that will send the disassembled data from all of this instance's send operations. | ||
*/ | ||
constructor(payloadSender) { | ||
this.payloadSender = payloadSender; | ||
} | ||
/** | ||
* The send operation used to send a [StreamingRequest](xref:botframework-streaming.StreamingRequest). | ||
* @param id The ID to assign to the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) used by this operation. | ||
* @param request The request to send. | ||
*/ | ||
sendRequest(id, request) { | ||
@@ -35,2 +44,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* The send operation used to send a [PayloadTypes.response](xref:botframework-streaming.PayloadTypes.response). | ||
* @param id The ID to assign to the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) used by this operation. | ||
* @param response The response to send. | ||
*/ | ||
sendResponse(id, response) { | ||
@@ -47,2 +61,6 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/** | ||
* The send operation used to send a [PayloadTypes.cancelStream](xref:botframework-streaming.PayloadTypes.cancelStream). | ||
* @param id The ID to assign to the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) used by this operation. | ||
*/ | ||
sendCancelStream(id) { | ||
@@ -49,0 +67,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -17,8 +17,32 @@ /** | ||
private readonly onCancelStream; | ||
/** | ||
* Initializes a new instance of the [StreamManager](xref:botframework-streaming.StreamManager) class. | ||
* @param onCancelStream Function to trigger if the managed stream is cancelled. | ||
*/ | ||
constructor(onCancelStream: Function); | ||
/** | ||
* Retrieves a [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID if one exists, otherwise a new instance is created and assigned the given ID. | ||
* @param id The ID of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) to retrieve or create. | ||
* @returns The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID. | ||
*/ | ||
getPayloadAssembler(id: string): PayloadAssembler; | ||
/** | ||
* Retrieves the [SubscribableStream](xref:botframework-streaming.SubscribableStream) from the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) this manager manages. | ||
* @param header The Header of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to retrieve. | ||
* @returns The [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given header. | ||
*/ | ||
getPayloadStream(header: IHeader): SubscribableStream; | ||
/** | ||
* Used to set the behavior of the managed [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) when data is received. | ||
* @param header The Header of the stream. | ||
* @param contentStream The [SubscribableStream](xref:botframework-streaming.SubscribableStream) to write incoming data to. | ||
* @param contentLength The amount of data to write to the contentStream. | ||
*/ | ||
onReceive(header: IHeader, contentStream: SubscribableStream, contentLength: number): void; | ||
/** | ||
* Closes the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to the [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given ID. | ||
* @param id The ID of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to close. | ||
*/ | ||
closeStream(id: string): void; | ||
} | ||
//# sourceMappingURL=streamManager.d.ts.map |
@@ -8,2 +8,6 @@ "use strict"; | ||
class StreamManager { | ||
/** | ||
* Initializes a new instance of the [StreamManager](xref:botframework-streaming.StreamManager) class. | ||
* @param onCancelStream Function to trigger if the managed stream is cancelled. | ||
*/ | ||
constructor(onCancelStream) { | ||
@@ -13,2 +17,7 @@ this.activeAssemblers = []; | ||
} | ||
/** | ||
* Retrieves a [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID if one exists, otherwise a new instance is created and assigned the given ID. | ||
* @param id The ID of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) to retrieve or create. | ||
* @returns The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID. | ||
*/ | ||
getPayloadAssembler(id) { | ||
@@ -25,2 +34,7 @@ if (!this.activeAssemblers[id]) { | ||
} | ||
/** | ||
* Retrieves the [SubscribableStream](xref:botframework-streaming.SubscribableStream) from the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) this manager manages. | ||
* @param header The Header of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to retrieve. | ||
* @returns The [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given header. | ||
*/ | ||
getPayloadStream(header) { | ||
@@ -30,2 +44,8 @@ const assembler = this.getPayloadAssembler(header.id); | ||
} | ||
/** | ||
* Used to set the behavior of the managed [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) when data is received. | ||
* @param header The Header of the stream. | ||
* @param contentStream The [SubscribableStream](xref:botframework-streaming.SubscribableStream) to write incoming data to. | ||
* @param contentLength The amount of data to write to the contentStream. | ||
*/ | ||
onReceive(header, contentStream, contentLength) { | ||
@@ -37,2 +57,6 @@ if (!this.activeAssemblers[header.id]) { | ||
} | ||
/** | ||
* Closes the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to the [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given ID. | ||
* @param id The ID of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to close. | ||
*/ | ||
closeStream(id) { | ||
@@ -39,0 +63,0 @@ if (!this.activeAssemblers[id]) { |
@@ -43,5 +43,11 @@ /** | ||
disconnect(e?: TransportDisconnectedEvent): void; | ||
/** | ||
* @private | ||
*/ | ||
private runReceive; | ||
/** | ||
* @private | ||
*/ | ||
private receivePackets; | ||
} | ||
//# sourceMappingURL=payloadReceiver.d.ts.map |
@@ -71,5 +71,11 @@ "use strict"; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
runReceive() { | ||
this.receivePackets().catch(); | ||
} | ||
/** | ||
* @private | ||
*/ | ||
receivePackets() { | ||
@@ -76,0 +82,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -45,4 +45,7 @@ /** | ||
disconnect(e?: TransportDisconnectedEvent): void; | ||
/** | ||
* @private | ||
*/ | ||
private writePacket; | ||
} | ||
//# sourceMappingURL=payloadSender.d.ts.map |
@@ -58,2 +58,5 @@ "use strict"; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
writePacket(packet) { | ||
@@ -60,0 +63,0 @@ try { |
@@ -8,2 +8,5 @@ /** | ||
*/ | ||
/** | ||
* Event to be included when disconnection events are fired. | ||
*/ | ||
export declare class TransportDisconnectedEvent { | ||
@@ -10,0 +13,0 @@ /** |
@@ -10,2 +10,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Event to be included when disconnection events are fired. | ||
*/ | ||
class TransportDisconnectedEvent { | ||
@@ -12,0 +15,0 @@ /** |
@@ -15,2 +15,5 @@ /** | ||
import { IReceiveResponse, IReceiveRequest } from './interfaces'; | ||
/** | ||
* Creates a protocol adapter for Streaming. | ||
*/ | ||
export declare class ProtocolAdapter { | ||
@@ -25,7 +28,26 @@ private readonly requestHandler; | ||
constructor(requestHandler: RequestHandler, requestManager: RequestManager, sender: PayloadSender, receiver: PayloadReceiver); | ||
/** | ||
* Sends a request over the attached request manager. | ||
* @param request The outgoing request to send. | ||
* @returns The response to the specified request. | ||
*/ | ||
sendRequest(request: StreamingRequest): Promise<IReceiveResponse>; | ||
/** | ||
* Executes the receive pipeline when a request comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param request The incoming request to process. | ||
*/ | ||
onReceiveRequest(id: string, request: IReceiveRequest): Promise<void>; | ||
/** | ||
* Executes the receive pipeline when a response comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param response The incoming response to process. | ||
*/ | ||
onReceiveResponse(id: string, response: IReceiveResponse): Promise<void>; | ||
/** | ||
* Executes the receive pipeline when a cancellation comes in. | ||
* @param contentStreamAssembler The payload assembler processing the incoming data that this cancellation request targets. | ||
*/ | ||
onCancelStream(contentStreamAssembler: PayloadAssembler): void; | ||
} | ||
//# sourceMappingURL=protocolAdapter.d.ts.map |
@@ -15,2 +15,5 @@ "use strict"; | ||
const protocol_base_1 = require("./utilities/protocol-base"); | ||
/** | ||
* Creates a protocol adapter for Streaming. | ||
*/ | ||
class ProtocolAdapter { | ||
@@ -34,7 +37,7 @@ /// <summary> | ||
} | ||
/// <summary> | ||
/// Sends a request over the attached request manager. | ||
/// </summary> | ||
/// <param name="request">The outgoing request to send.</param> | ||
/// <param name="cancellationToken">Optional cancellation token.</param> | ||
/** | ||
* Sends a request over the attached request manager. | ||
* @param request The outgoing request to send. | ||
* @returns The response to the specified request. | ||
*/ | ||
sendRequest(request) { | ||
@@ -47,7 +50,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/// <summary> | ||
/// Executes the receive pipeline when a request comes in. | ||
/// </summary> | ||
/// <param name="id">The id the resources created for the response will be assigned.</param> | ||
/// <param name="request">The incoming request to process.</param> | ||
/** | ||
* Executes the receive pipeline when a request comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param request The incoming request to process. | ||
*/ | ||
onReceiveRequest(id, request) { | ||
@@ -63,7 +66,7 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/// <summary> | ||
/// Executes the receive pipeline when a response comes in. | ||
/// </summary> | ||
/// <param name="id">The id the resources created for the response will be assigned.</param> | ||
/// <param name="response">The incoming response to process.</param> | ||
/** | ||
* Executes the receive pipeline when a response comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param response The incoming response to process. | ||
*/ | ||
onReceiveResponse(id, response) { | ||
@@ -74,9 +77,6 @@ return __awaiter(this, void 0, void 0, function* () { | ||
} | ||
/// <summary> | ||
/// Executes the receive pipeline when a cancellation comes in. | ||
/// </summary> | ||
/// <param name="contentStreamAssembler"> | ||
/// The payload assembler processing the incoming data that this | ||
/// cancellation request targets. | ||
/// </param> | ||
/** | ||
* Executes the receive pipeline when a cancellation comes in. | ||
* @param contentStreamAssembler The payload assembler processing the incoming data that this cancellation request targets. | ||
*/ | ||
onCancelStream(contentStreamAssembler) { | ||
@@ -83,0 +83,0 @@ this.sendOperations.sendCancelStream(contentStreamAssembler.id).catch(); |
@@ -9,2 +9,5 @@ /** | ||
import { HttpContent, HttpContentStream } from './httpContentStream'; | ||
/** | ||
* The basic request type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP request messages. | ||
*/ | ||
export declare class StreamingRequest { | ||
@@ -11,0 +14,0 @@ /** |
@@ -12,2 +12,5 @@ "use strict"; | ||
const subscribableStream_1 = require("./subscribableStream"); | ||
/** | ||
* The basic request type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP request messages. | ||
*/ | ||
class StreamingRequest { | ||
@@ -14,0 +17,0 @@ constructor() { |
@@ -9,2 +9,5 @@ /** | ||
import { HttpContent, HttpContentStream } from './httpContentStream'; | ||
/** | ||
* The basic response type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP response messages. | ||
*/ | ||
export declare class StreamingResponse { | ||
@@ -11,0 +14,0 @@ statusCode: number; |
@@ -12,2 +12,5 @@ "use strict"; | ||
const subscribableStream_1 = require("./subscribableStream"); | ||
/** | ||
* The basic response type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP response messages. | ||
*/ | ||
class StreamingResponse { | ||
@@ -14,0 +17,0 @@ constructor() { |
@@ -10,2 +10,5 @@ /// <reference types="node" /> | ||
import { Duplex, DuplexOptions } from 'stream'; | ||
/** | ||
* An extension of `Duplex` that operates in conjunction with a `PayloadAssembler` to convert raw bytes into a consumable form. | ||
*/ | ||
export declare class SubscribableStream extends Duplex { | ||
@@ -15,7 +18,28 @@ length: number; | ||
private _onData; | ||
/** | ||
* Initializes a new instance of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) class. | ||
* @param options The `DuplexOptions` to use when constructing this stream. | ||
*/ | ||
constructor(options?: DuplexOptions); | ||
/** | ||
* Writes data to the buffered list. | ||
* All calls to writable.write() that occur between the time writable._write() is called and the callback is called will cause the written data to be buffered. | ||
* @param chunk The Buffer to be written. | ||
* @param encoding The encoding. | ||
* @param callback Callback for when this chunk of data is flushed. | ||
*/ | ||
_write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; | ||
/** | ||
* Reads the buffered list. | ||
* Once the readable._read() method has been called, it will not be called again until more data is pushed through the readable.push() method. | ||
* Empty data such as empty buffers and strings will not cause readable._read() to be called. | ||
* @param size Number of bytes to read. | ||
*/ | ||
_read(size: number): void; | ||
/** | ||
* Subscribes to the stream when receives data. | ||
* @param onData Callback to be called when onData is executed. | ||
*/ | ||
subscribe(onData: (chunk: any) => void): void; | ||
} | ||
//# sourceMappingURL=subscribableStream.d.ts.map |
@@ -11,3 +11,10 @@ "use strict"; | ||
const stream_1 = require("stream"); | ||
/** | ||
* An extension of `Duplex` that operates in conjunction with a `PayloadAssembler` to convert raw bytes into a consumable form. | ||
*/ | ||
class SubscribableStream extends stream_1.Duplex { | ||
/** | ||
* Initializes a new instance of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) class. | ||
* @param options The `DuplexOptions` to use when constructing this stream. | ||
*/ | ||
constructor(options) { | ||
@@ -18,2 +25,9 @@ super(options); | ||
} | ||
/** | ||
* Writes data to the buffered list. | ||
* All calls to writable.write() that occur between the time writable._write() is called and the callback is called will cause the written data to be buffered. | ||
* @param chunk The Buffer to be written. | ||
* @param encoding The encoding. | ||
* @param callback Callback for when this chunk of data is flushed. | ||
*/ | ||
_write(chunk, encoding, callback) { | ||
@@ -28,2 +42,8 @@ const buffer = Buffer.from(chunk); | ||
} | ||
/** | ||
* Reads the buffered list. | ||
* Once the readable._read() method has been called, it will not be called again until more data is pushed through the readable.push() method. | ||
* Empty data such as empty buffers and strings will not cause readable._read() to be called. | ||
* @param size Number of bytes to read. | ||
*/ | ||
_read(size) { | ||
@@ -44,2 +64,6 @@ if (this.bufferList.length === 0) { | ||
} | ||
/** | ||
* Subscribes to the stream when receives data. | ||
* @param onData Callback to be called when onData is executed. | ||
*/ | ||
subscribe(onData) { | ||
@@ -46,0 +70,0 @@ this._onData = onData; |
@@ -0,2 +1,6 @@ | ||
/** | ||
* Generates an uuid v4 string. | ||
* @returns An uuidv4 string. | ||
*/ | ||
export declare function generateGuid(): string; | ||
//# sourceMappingURL=protocol-base.d.ts.map |
@@ -11,2 +11,6 @@ "use strict"; | ||
const uuidv4 = require("uuid/v4"); | ||
/** | ||
* Generates an uuid v4 string. | ||
* @returns An uuidv4 string. | ||
*/ | ||
function generateGuid() { | ||
@@ -13,0 +17,0 @@ return uuidv4(); |
@@ -11,6 +11,12 @@ /** | ||
import { NodeWebSocketFactoryBase } from './nodeWebSocketFactoryBase'; | ||
/** | ||
* Represents a NodeWebSocketFactory to create a WebSocket server. | ||
*/ | ||
export declare class NodeWebSocketFactory extends NodeWebSocketFactoryBase { | ||
/** | ||
* Initializes a new instance of the [NodeWebSocketFactory](xref:botframework-streaming.NodeWebSocketFactory) class. | ||
*/ | ||
constructor(); | ||
/** | ||
* Creates a NodeWebSocket instance. | ||
* Creates a [NodeWebSocket](xref:botframework-streaming.NodeWebSocket) instance. | ||
* @remarks | ||
@@ -17,0 +23,0 @@ * The parameters for this method should be associated with an 'upgrade' event off of a Node.js HTTP Server. |
@@ -20,3 +20,9 @@ "use strict"; | ||
const nodeWebSocketFactoryBase_1 = require("./nodeWebSocketFactoryBase"); | ||
/** | ||
* Represents a NodeWebSocketFactory to create a WebSocket server. | ||
*/ | ||
class NodeWebSocketFactory extends nodeWebSocketFactoryBase_1.NodeWebSocketFactoryBase { | ||
/** | ||
* Initializes a new instance of the [NodeWebSocketFactory](xref:botframework-streaming.NodeWebSocketFactory) class. | ||
*/ | ||
constructor() { | ||
@@ -26,3 +32,3 @@ super(); | ||
/** | ||
* Creates a NodeWebSocket instance. | ||
* Creates a [NodeWebSocket](xref:botframework-streaming.NodeWebSocket) instance. | ||
* @remarks | ||
@@ -29,0 +35,0 @@ * The parameters for this method should be associated with an 'upgrade' event off of a Node.js HTTP Server. |
@@ -9,2 +9,5 @@ /** | ||
import { INodeIncomingMessage, INodeBuffer, INodeSocket, ISocket } from '../../interfaces'; | ||
/** | ||
* Represents an abstract NodeWebSocketFactoryBase class to create a WebSocket. | ||
*/ | ||
export declare abstract class NodeWebSocketFactoryBase { | ||
@@ -11,0 +14,0 @@ abstract createWebSocket(req: INodeIncomingMessage, socket: INodeSocket, head: INodeBuffer): Promise<ISocket>; |
@@ -10,2 +10,5 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Represents an abstract NodeWebSocketFactoryBase class to create a WebSocket. | ||
*/ | ||
class NodeWebSocketFactoryBase { | ||
@@ -12,0 +15,0 @@ } |
@@ -10,2 +10,5 @@ /** | ||
import { INodeIncomingMessage, INodeBuffer, INodeSocket, ISocket } from '../interfaces'; | ||
/** | ||
* An implementation of [ISocket](xref:botframework-streaming.ISocket) to use with a [NodeWebSocketFactory](xref:botframework-streaming.NodeWebSocketFactory) to create a WebSocket server. | ||
*/ | ||
export declare class NodeWebSocket implements ISocket { | ||
@@ -12,0 +15,0 @@ private wsSocket; |
@@ -22,2 +22,5 @@ "use strict"; | ||
const NONCE_LENGTH = 16; | ||
/** | ||
* An implementation of [ISocket](xref:botframework-streaming.ISocket) to use with a [NodeWebSocketFactory](xref:botframework-streaming.NodeWebSocketFactory) to create a WebSocket server. | ||
*/ | ||
class NodeWebSocket { | ||
@@ -24,0 +27,0 @@ /** |
@@ -50,4 +50,7 @@ /** | ||
send(request: StreamingRequest): Promise<IReceiveResponse>; | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected; | ||
} | ||
//# sourceMappingURL=nodeWebSocketClient.d.ts.map |
@@ -82,2 +82,5 @@ "use strict"; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
onConnectionDisconnected(sender, args) { | ||
@@ -84,0 +87,0 @@ if (this._disconnectionHandler != null) { |
@@ -56,6 +56,15 @@ /** | ||
onReceive(data: INodeBuffer): void; | ||
/** | ||
* @private | ||
*/ | ||
private onClose; | ||
/** | ||
* @private | ||
*/ | ||
private onError; | ||
/** | ||
* @private | ||
*/ | ||
private trySignalData; | ||
} | ||
//# sourceMappingURL=webSocketTransport.d.ts.map |
@@ -92,2 +92,5 @@ "use strict"; | ||
} | ||
/** | ||
* @private | ||
*/ | ||
onClose() { | ||
@@ -104,2 +107,5 @@ if (this._activeReceiveReject) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
onError(err) { | ||
@@ -111,2 +117,5 @@ if (this._activeReceiveReject) { | ||
} | ||
/** | ||
* @private | ||
*/ | ||
trySignalData() { | ||
@@ -113,0 +122,0 @@ if (this._activeReceiveResolve) { |
@@ -5,3 +5,3 @@ { | ||
"description": "Streaming library for the Microsoft Bot Framework", | ||
"version": "4.11.0-dev.20201019.3446d04", | ||
"version": "4.11.0-dev.20201020.addb9cb", | ||
"license": "MIT", | ||
@@ -46,3 +46,3 @@ "keywords": [ | ||
"clean": "rmdir /q /s lib browser", | ||
"set-version": "npm version --allow-same-version 4.11.0-dev.20201019.3446d04", | ||
"set-version": "npm version --allow-same-version 4.11.0-dev.20201020.addb9cb", | ||
"test": "npm run build && nyc mocha tests/", | ||
@@ -49,0 +49,0 @@ "test:compat": "api-extractor run --verbose" |
@@ -31,2 +31,7 @@ /** | ||
/** | ||
* Initializes a new instance of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param params Parameters for a streaming assembler. | ||
*/ | ||
public constructor(streamManager: StreamManager, params: IAssemblerParams) { | ||
@@ -50,2 +55,6 @@ if (params.header) { | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
public getPayloadStream(): SubscribableStream { | ||
@@ -59,2 +68,8 @@ if (!this.stream) { | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param stream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
public onReceive(header: IHeader, stream: SubscribableStream, contentLength: number): void { | ||
@@ -70,2 +85,5 @@ this.end = header.end; | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
public close(): void { | ||
@@ -75,2 +93,6 @@ this._streamManager.closeStream(this.id); | ||
/** | ||
* Creates a new [SubscribableStream](xref:botframework-streaming.SubscribableStream) instance. | ||
* @returns The new stream ready for consumption. | ||
*/ | ||
private createPayloadStream(): SubscribableStream { | ||
@@ -80,2 +102,5 @@ return new SubscribableStream(); | ||
/** | ||
* @private | ||
*/ | ||
private payloadFromJson<T>(json: string): T { | ||
@@ -85,2 +110,5 @@ return JSON.parse(json.charCodeAt(0) === this._byteOrderMark ? json.slice(1) : json) as T; | ||
/** | ||
* @private | ||
*/ | ||
private stripBOM(input: string): string { | ||
@@ -90,2 +118,5 @@ return input.charCodeAt(0) === this._byteOrderMark ? input.slice(1) : input; | ||
/** | ||
* @private | ||
*/ | ||
private async process(stream: SubscribableStream): Promise<void> { | ||
@@ -106,2 +137,5 @@ const streamData: Buffer = stream.read(stream.length) as Buffer; | ||
/** | ||
* @private | ||
*/ | ||
private async processResponse(streamDataAsString: string): Promise<void> { | ||
@@ -114,2 +148,5 @@ const responsePayload: IResponsePayload = this.payloadFromJson(this.stripBOM(streamDataAsString)); | ||
/** | ||
* @private | ||
*/ | ||
private async processRequest(streamDataAsString: string): Promise<void> { | ||
@@ -122,2 +159,5 @@ const requestPayload: IRequestPayload = this.payloadFromJson(streamDataAsString); | ||
/** | ||
* @private | ||
*/ | ||
private async processStreams(responsePayload: any, receiveResponse: any) { | ||
@@ -124,0 +164,0 @@ if (responsePayload.streams) { |
@@ -12,2 +12,5 @@ /** | ||
/** | ||
* A stream of fixed or infinite length containing content to be decoded. | ||
*/ | ||
export class ContentStream { | ||
@@ -18,2 +21,7 @@ public id: string; | ||
/** | ||
* Initializes a new instance of the [ContentStream](xref:botframework-streaming.ContentStream) class. | ||
* @param id The ID assigned to this instance. | ||
* @param assembler The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to this instance. | ||
*/ | ||
public constructor(id: string, assembler: PayloadAssembler) { | ||
@@ -27,2 +35,5 @@ if (!assembler) { | ||
/** | ||
* Gets the name of the type of the object contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
public get contentType(): string { | ||
@@ -32,2 +43,5 @@ return this.assembler.payloadType; | ||
/** | ||
* Gets the length of this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
public get length(): number { | ||
@@ -37,2 +51,5 @@ return this.assembler.contentLength; | ||
/** | ||
* Gets the data contained within this [ContentStream](xref:botframework-streaming.ContentStream). | ||
*/ | ||
public getStream(): SubscribableStream { | ||
@@ -46,2 +63,5 @@ if (!this.stream) { | ||
/** | ||
* Closes the assembler. | ||
*/ | ||
public cancel(): void { | ||
@@ -51,2 +71,6 @@ this.assembler.close(); | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a string. | ||
* @returns A string Promise with [SubscribableStream](xref:botframework-streaming.SubscribableStream) content. | ||
*/ | ||
public async readAsString(): Promise<string> { | ||
@@ -57,2 +81,6 @@ const { bufferArray } = await this.readAll(); | ||
/** | ||
* Gets the [SubscribableStream](xref:botframework-streaming.SubscribableStream) content as a typed JSON object. | ||
* @returns A typed object Promise with `SubscribableStream` content. | ||
*/ | ||
public async readAsJson<T>(): Promise<T> { | ||
@@ -67,2 +95,5 @@ const stringToParse = await this.readAsString(); | ||
/** | ||
* @private | ||
*/ | ||
private async readAll(): Promise<Record<string, any>> { | ||
@@ -69,0 +100,0 @@ // do a read-all |
@@ -12,2 +12,5 @@ /** | ||
/** | ||
* Streaming cancel disassembler. | ||
*/ | ||
export class CancelDisassembler { | ||
@@ -18,2 +21,8 @@ private readonly sender: PayloadSender; | ||
/** | ||
* Initializes a new instance of the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) that this Cancel request will be sent by. | ||
* @param id The ID of the Stream to cancel. | ||
* @param payloadType The type of the Stream that is being cancelled. | ||
*/ | ||
public constructor(sender: PayloadSender, id: string, payloadType: PayloadTypes) { | ||
@@ -25,2 +34,5 @@ this.sender = sender; | ||
/** | ||
* Initiates the process of disassembling the request and signals the [PayloadSender](xref:botframework-streaming.PayloadSender) to begin sending. | ||
*/ | ||
public disassemble(): void { | ||
@@ -27,0 +39,0 @@ const header: IHeader = { payloadType: this.payloadType, payloadLength: 0, id: this.id, end: true }; |
@@ -22,2 +22,7 @@ /** | ||
/** | ||
* Initializes a new instance of the [HttpContentStreamDisassembler](xref:botframework-streaming.HttpContentStreamDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param contentStream The [HttpContentStream](xref:botframework-streaming.HttpContentStream) to be disassembled. | ||
*/ | ||
public constructor(sender: PayloadSender, contentStream: HttpContentStream) { | ||
@@ -28,2 +33,6 @@ super(sender, contentStream.id); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Strea. | ||
*/ | ||
public async getStream(): Promise<IStreamWrapper> { | ||
@@ -30,0 +39,0 @@ const stream: SubscribableStream = this.contentStream.content.getStream(); |
@@ -24,2 +24,7 @@ /** | ||
/** | ||
* Initializes a new instance of the [PayloadDisassembler](xref:botframework-streaming.PayloadDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) used to send the disassembled payload chunks. | ||
* @param id The ID of this disassembler. | ||
*/ | ||
public constructor(sender: PayloadSender, id: string) { | ||
@@ -30,2 +35,6 @@ this.sender = sender; | ||
/** | ||
* Serializes the item into the [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) that exposes the stream and length of the result. | ||
* @param item The item to be serialized. | ||
*/ | ||
protected static serialize<T>(item: T): IStreamWrapper { | ||
@@ -40,4 +49,11 @@ const stream: SubscribableStream = new SubscribableStream(); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
public abstract async getStream(): Promise<IStreamWrapper>; | ||
/** | ||
* Begins the process of disassembling a payload and sending the resulting chunks to the [PayloadSender](xref:botframework-streaming.PayloadSender) to dispatch over the transport. | ||
*/ | ||
public async disassemble(): Promise<void> { | ||
@@ -52,2 +68,5 @@ const { stream, streamLength }: IStreamWrapper = await this.getStream(); | ||
/** | ||
* Begins the process of disassembling a payload and signals the [PayloadSender](xref:botframework-streaming.PayloadSender). | ||
*/ | ||
private async send(): Promise<void> { | ||
@@ -54,0 +73,0 @@ const header: IHeader = { |
@@ -22,2 +22,8 @@ /** | ||
/** | ||
* Initializes a new instance of the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param request The request to be disassembled. | ||
*/ | ||
public constructor(sender: PayloadSender, id: string, request?: StreamingRequest) { | ||
@@ -28,2 +34,6 @@ super(sender, id); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
public async getStream(): Promise<IStreamWrapper> { | ||
@@ -30,0 +40,0 @@ const payload: IRequestPayload = { verb: this.request.verb, path: this.request.path, streams: [] }; |
@@ -22,2 +22,8 @@ /** | ||
/** | ||
* Initializes a new instance of the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) class. | ||
* @param sender The [PayloadSender](xref:botframework-streaming.PayloadSender) to send the disassembled data to. | ||
* @param id The ID of this disassembler. | ||
* @param response The response to be disassembled. | ||
*/ | ||
public constructor(sender: PayloadSender, id: string, response: StreamingResponse) { | ||
@@ -28,2 +34,6 @@ super(sender, id); | ||
/** | ||
* Gets the stream this disassembler is operating on. | ||
* @returns An [IStreamWrapper](xref:botframework-streaming.IStreamWrapper) with a Subscribable Stream. | ||
*/ | ||
public async getStream(): Promise<IStreamWrapper> { | ||
@@ -30,0 +40,0 @@ const payload: IResponsePayload = { statusCode: this.response.statusCode, streams: [] }; |
@@ -12,2 +12,6 @@ /** | ||
/** | ||
* An attachment contained within a StreamingRequest's stream collection, | ||
* which itself contains any form of media item. | ||
*/ | ||
export class HttpContentStream { | ||
@@ -18,2 +22,6 @@ public readonly id: string; | ||
/** | ||
* Initializes a new instance of the [HttpContentStream](xref:botframework-streaming.HttpContentStream) class. | ||
* @param content The [HttpContent](xref:botframework-streaming.HttpContent) to assign to the [HttpContentStream](xref:botframework-streaming.HttpContentStream). | ||
*/ | ||
public constructor(content: HttpContent) { | ||
@@ -30,2 +38,5 @@ this.id = generateGuid(); | ||
/** | ||
* The HttpContent class that contains a [SubscribableStream](xref:botframework-streaming.SubscribableStream). | ||
*/ | ||
export class HttpContent { | ||
@@ -35,2 +46,7 @@ public headers: IHttpContentHeaders; | ||
/** | ||
* Initializes a new instance of the [HttpContent](xref:botframework-streaming.HttpContent) class. | ||
* @param headers The Streaming Http content header definition. | ||
* @param stream The stream of buffered data. | ||
*/ | ||
public constructor(headers: IHttpContentHeaders, stream: SubscribableStream) { | ||
@@ -41,2 +57,5 @@ this.headers = headers; | ||
/** | ||
* Gets the data contained within this [HttpContent](xref:botframework-streaming.HttpContent). | ||
*/ | ||
public getStream(): SubscribableStream { | ||
@@ -43,0 +62,0 @@ return this.stream; |
@@ -86,2 +86,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected(sender: object, args: any): void { | ||
@@ -88,0 +91,0 @@ if (!this._isDisconnecting) { |
@@ -135,2 +135,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected(): void { | ||
@@ -137,0 +140,0 @@ if (!this._isDisconnecting) { |
@@ -104,2 +104,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private socketReceive(data: INodeBuffer): void { | ||
@@ -112,2 +115,5 @@ if (this._queue && data && data.length > 0) { | ||
/** | ||
* @private | ||
*/ | ||
private socketClose(): void { | ||
@@ -126,2 +132,5 @@ if (this._activeReceiveReject) { | ||
/** | ||
* @private | ||
*/ | ||
private socketError(err: Error): void { | ||
@@ -134,2 +143,5 @@ if (this._activeReceiveReject) { | ||
/** | ||
* @private | ||
*/ | ||
private trySignalData(): void { | ||
@@ -136,0 +148,0 @@ if (this._activeReceiveResolve) { |
@@ -103,2 +103,8 @@ /** | ||
/** | ||
* Creates a padded string based on a length and character to be padded to. | ||
* @param lengthValue The value to be assingned on the result. | ||
* @param totalLength The length of the padded string result. | ||
* @param padChar The character value to use as filling. | ||
*/ | ||
public static headerLengthPadder(lengthValue: number, totalLength: number, padChar: string): string { | ||
@@ -105,0 +111,0 @@ const result = Array(totalLength + 1).join(padChar); |
@@ -23,2 +23,8 @@ /** | ||
/** | ||
* Initializes a new instance of the [PayloadAssemblerManager](xref:botframework-streaming.PayloadAssemblerManager) class. | ||
* @param streamManager The [StreamManager](xref:botframework-streaming.StreamManager) managing the stream being assembled. | ||
* @param onReceiveResponse Function that executes when new bytes are received on a `response` stream. | ||
* @param onReceiveRequest Function that executes when new bytes are received on a `request` stream. | ||
*/ | ||
public constructor(streamManager: StreamManager, onReceiveResponse: Function, onReceiveRequest: Function) { | ||
@@ -30,2 +36,7 @@ this.streamManager = streamManager; | ||
/** | ||
* Retrieves the assembler's payload as a stream. | ||
* @param header The Header of the Stream to retrieve. | ||
* @returns A [SubscribableStream](xref:botframework-streaming.SubscribableStream) of the assembler's payload. | ||
*/ | ||
public getPayloadStream(header: IHeader): SubscribableStream { | ||
@@ -44,2 +55,8 @@ if (header.payloadType === PayloadTypes.stream) { | ||
/** | ||
* The action the assembler executes when new bytes are received on the incoming stream. | ||
* @param header The stream's Header. | ||
* @param contentStream The incoming stream being assembled. | ||
* @param contentLength The length of the stream, if finite. | ||
*/ | ||
public onReceive(header: IHeader, contentStream: SubscribableStream, contentLength: number): void { | ||
@@ -59,2 +76,5 @@ if (header.payloadType === PayloadTypes.stream) { | ||
/** | ||
* @private | ||
*/ | ||
private createPayloadAssembler(header: IHeader): PayloadAssembler { | ||
@@ -61,0 +81,0 @@ if (header.payloadType === PayloadTypes.request) { |
@@ -25,2 +25,6 @@ /** | ||
/** | ||
* Gets the count of the pending requests. | ||
* @returns Number with the pending requests count. | ||
*/ | ||
public pendingRequestCount(): number { | ||
@@ -30,2 +34,7 @@ return Object.keys(this._pendingRequests).length; | ||
/** | ||
* Signal fired when all response tasks have completed. | ||
* @param requestId The ID of the StreamingRequest. | ||
* @param response The [IReceiveResponse](xref:botframework-streaming.IReceiveResponse) in response to the request. | ||
*/ | ||
public async signalResponse(requestId: string, response: IReceiveResponse): Promise<boolean> { | ||
@@ -44,2 +53,7 @@ const pendingRequest = this._pendingRequests[requestId]; | ||
/** | ||
* Constructs and returns a response for this request. | ||
* @param requestId The ID of the StreamingRequest being responded to. | ||
* @returns The response to the specified request. | ||
*/ | ||
public getResponse(requestId: string): Promise<IReceiveResponse> { | ||
@@ -46,0 +60,0 @@ let pendingRequest = this._pendingRequests[requestId]; |
@@ -23,2 +23,6 @@ /** | ||
/** | ||
* Initializes a new instance of the [SendOperations](xref:botframework-streaming.SendOperations) class. | ||
* @param payloadSender The [PayloadSender](xref:botframework-streaming.PayloadSender) that will send the disassembled data from all of this instance's send operations. | ||
*/ | ||
public constructor(payloadSender: PayloadSender) { | ||
@@ -28,2 +32,7 @@ this.payloadSender = payloadSender; | ||
/** | ||
* The send operation used to send a [StreamingRequest](xref:botframework-streaming.StreamingRequest). | ||
* @param id The ID to assign to the [RequestDisassembler](xref:botframework-streaming.RequestDisassembler) used by this operation. | ||
* @param request The request to send. | ||
*/ | ||
public async sendRequest(id: string, request: StreamingRequest): Promise<void> { | ||
@@ -43,2 +52,7 @@ const disassembler = new RequestDisassembler(this.payloadSender, id, request); | ||
/** | ||
* The send operation used to send a [PayloadTypes.response](xref:botframework-streaming.PayloadTypes.response). | ||
* @param id The ID to assign to the [ResponseDisassembler](xref:botframework-streaming.ResponseDisassembler) used by this operation. | ||
* @param response The response to send. | ||
*/ | ||
public async sendResponse(id: string, response: StreamingResponse): Promise<void> { | ||
@@ -58,2 +72,6 @@ const disassembler = new ResponseDisassembler(this.payloadSender, id, response); | ||
/** | ||
* The send operation used to send a [PayloadTypes.cancelStream](xref:botframework-streaming.PayloadTypes.cancelStream). | ||
* @param id The ID to assign to the [CancelDisassembler](xref:botframework-streaming.CancelDisassembler) used by this operation. | ||
*/ | ||
public async sendCancelStream(id: string): Promise<void> { | ||
@@ -60,0 +78,0 @@ const disassembler = new CancelDisassembler(this.payloadSender, id, PayloadTypes.cancelStream); |
@@ -19,2 +19,6 @@ /** | ||
/** | ||
* Initializes a new instance of the [StreamManager](xref:botframework-streaming.StreamManager) class. | ||
* @param onCancelStream Function to trigger if the managed stream is cancelled. | ||
*/ | ||
public constructor(onCancelStream: Function) { | ||
@@ -24,2 +28,7 @@ this.onCancelStream = onCancelStream; | ||
/** | ||
* Retrieves a [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID if one exists, otherwise a new instance is created and assigned the given ID. | ||
* @param id The ID of the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) to retrieve or create. | ||
* @returns The [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) with the given ID. | ||
*/ | ||
public getPayloadAssembler(id: string): PayloadAssembler { | ||
@@ -37,2 +46,7 @@ if (!this.activeAssemblers[id]) { | ||
/** | ||
* Retrieves the [SubscribableStream](xref:botframework-streaming.SubscribableStream) from the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) this manager manages. | ||
* @param header The Header of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to retrieve. | ||
* @returns The [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given header. | ||
*/ | ||
public getPayloadStream(header: IHeader): SubscribableStream { | ||
@@ -44,2 +58,8 @@ const assembler = this.getPayloadAssembler(header.id); | ||
/** | ||
* Used to set the behavior of the managed [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) when data is received. | ||
* @param header The Header of the stream. | ||
* @param contentStream The [SubscribableStream](xref:botframework-streaming.SubscribableStream) to write incoming data to. | ||
* @param contentLength The amount of data to write to the contentStream. | ||
*/ | ||
public onReceive(header: IHeader, contentStream: SubscribableStream, contentLength: number): void { | ||
@@ -52,2 +72,6 @@ if (!this.activeAssemblers[header.id]) { | ||
/** | ||
* Closes the [PayloadAssembler](xref:botframework-streaming.PayloadAssembler) assigned to the [SubscribableStream](xref:botframework-streaming.SubscribableStream) with the given ID. | ||
* @param id The ID of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) to close. | ||
*/ | ||
public closeStream(id: string): void { | ||
@@ -54,0 +78,0 @@ if (!this.activeAssemblers[id]) { |
@@ -84,2 +84,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private runReceive(): void { | ||
@@ -89,2 +92,5 @@ this.receivePackets().catch(); | ||
/** | ||
* @private | ||
*/ | ||
private async receivePackets(): Promise<void> { | ||
@@ -91,0 +97,0 @@ let isClosed; |
@@ -71,2 +71,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private writePacket(packet: ISendPacket): void { | ||
@@ -81,3 +84,2 @@ try { | ||
const chunk = packet.payload.read(count); | ||
const header = packet.header; | ||
@@ -84,0 +86,0 @@ header.payloadLength = count; |
@@ -9,2 +9,5 @@ /** | ||
/** | ||
* Event to be included when disconnection events are fired. | ||
*/ | ||
export class TransportDisconnectedEvent { | ||
@@ -11,0 +14,0 @@ /** |
@@ -22,2 +22,5 @@ /** | ||
/** | ||
* Creates a protocol adapter for Streaming. | ||
*/ | ||
export class ProtocolAdapter { | ||
@@ -63,7 +66,7 @@ private readonly requestHandler: RequestHandler; | ||
/// <summary> | ||
/// Sends a request over the attached request manager. | ||
/// </summary> | ||
/// <param name="request">The outgoing request to send.</param> | ||
/// <param name="cancellationToken">Optional cancellation token.</param> | ||
/** | ||
* Sends a request over the attached request manager. | ||
* @param request The outgoing request to send. | ||
* @returns The response to the specified request. | ||
*/ | ||
public async sendRequest(request: StreamingRequest): Promise<IReceiveResponse> { | ||
@@ -76,7 +79,7 @@ const requestId: string = generateGuid(); | ||
/// <summary> | ||
/// Executes the receive pipeline when a request comes in. | ||
/// </summary> | ||
/// <param name="id">The id the resources created for the response will be assigned.</param> | ||
/// <param name="request">The incoming request to process.</param> | ||
/** | ||
* Executes the receive pipeline when a request comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param request The incoming request to process. | ||
*/ | ||
public async onReceiveRequest(id: string, request: IReceiveRequest): Promise<void> { | ||
@@ -92,7 +95,7 @@ if (this.requestHandler) { | ||
/// <summary> | ||
/// Executes the receive pipeline when a response comes in. | ||
/// </summary> | ||
/// <param name="id">The id the resources created for the response will be assigned.</param> | ||
/// <param name="response">The incoming response to process.</param> | ||
/** | ||
* Executes the receive pipeline when a response comes in. | ||
* @param id The id the resources created for the response will be assigned. | ||
* @param response The incoming response to process. | ||
*/ | ||
public async onReceiveResponse(id: string, response: IReceiveResponse): Promise<void> { | ||
@@ -102,9 +105,6 @@ await this.requestManager.signalResponse(id, response); | ||
/// <summary> | ||
/// Executes the receive pipeline when a cancellation comes in. | ||
/// </summary> | ||
/// <param name="contentStreamAssembler"> | ||
/// The payload assembler processing the incoming data that this | ||
/// cancellation request targets. | ||
/// </param> | ||
/** | ||
* Executes the receive pipeline when a cancellation comes in. | ||
* @param contentStreamAssembler The payload assembler processing the incoming data that this cancellation request targets. | ||
*/ | ||
public onCancelStream(contentStreamAssembler: PayloadAssembler): void { | ||
@@ -111,0 +111,0 @@ this.sendOperations.sendCancelStream(contentStreamAssembler.id).catch(); |
@@ -11,2 +11,5 @@ /** | ||
/** | ||
* The basic request type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP request messages. | ||
*/ | ||
export class StreamingRequest { | ||
@@ -13,0 +16,0 @@ /** |
@@ -11,2 +11,5 @@ /** | ||
/** | ||
* The basic response type sent over Bot Framework Protocol 3 with Streaming Extensions transports, equivalent to HTTP response messages. | ||
*/ | ||
export class StreamingResponse { | ||
@@ -13,0 +16,0 @@ public statusCode: number; |
@@ -10,2 +10,5 @@ /** | ||
/** | ||
* An extension of `Duplex` that operates in conjunction with a `PayloadAssembler` to convert raw bytes into a consumable form. | ||
*/ | ||
export class SubscribableStream extends Duplex { | ||
@@ -17,2 +20,6 @@ public length = 0; | ||
/** | ||
* Initializes a new instance of the [SubscribableStream](xref:botframework-streaming.SubscribableStream) class. | ||
* @param options The `DuplexOptions` to use when constructing this stream. | ||
*/ | ||
public constructor(options?: DuplexOptions) { | ||
@@ -22,2 +29,9 @@ super(options); | ||
/** | ||
* Writes data to the buffered list. | ||
* All calls to writable.write() that occur between the time writable._write() is called and the callback is called will cause the written data to be buffered. | ||
* @param chunk The Buffer to be written. | ||
* @param encoding The encoding. | ||
* @param callback Callback for when this chunk of data is flushed. | ||
*/ | ||
public _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void { | ||
@@ -33,2 +47,8 @@ const buffer = Buffer.from(chunk); | ||
/** | ||
* Reads the buffered list. | ||
* Once the readable._read() method has been called, it will not be called again until more data is pushed through the readable.push() method. | ||
* Empty data such as empty buffers and strings will not cause readable._read() to be called. | ||
* @param size Number of bytes to read. | ||
*/ | ||
public _read(size: number): void { | ||
@@ -49,2 +69,6 @@ if (this.bufferList.length === 0) { | ||
/** | ||
* Subscribes to the stream when receives data. | ||
* @param onData Callback to be called when onData is executed. | ||
*/ | ||
public subscribe(onData: (chunk: any) => void): void { | ||
@@ -51,0 +75,0 @@ this._onData = onData; |
@@ -10,4 +10,8 @@ /** | ||
/** | ||
* Generates an uuid v4 string. | ||
* @returns An uuidv4 string. | ||
*/ | ||
export function generateGuid(): string { | ||
return uuidv4(); | ||
} |
@@ -10,2 +10,5 @@ /** | ||
/** | ||
* Represents a WebSocket that implements [ISocket](xref:botframework-streaming.ISocket). | ||
*/ | ||
export class BrowserWebSocket implements ISocket { | ||
@@ -12,0 +15,0 @@ private webSocket: IBrowserWebSocket; |
@@ -88,2 +88,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected(sender: object, args: any): void { | ||
@@ -90,0 +93,0 @@ if (this._disconnectionHandler != null) { |
@@ -13,3 +13,10 @@ /** | ||
/** | ||
* Represents a NodeWebSocketFactory to create a WebSocket server. | ||
*/ | ||
export class NodeWebSocketFactory extends NodeWebSocketFactoryBase { | ||
/** | ||
* Initializes a new instance of the [NodeWebSocketFactory](xref:botframework-streaming.NodeWebSocketFactory) class. | ||
*/ | ||
constructor() { | ||
@@ -20,3 +27,3 @@ super(); | ||
/** | ||
* Creates a NodeWebSocket instance. | ||
* Creates a [NodeWebSocket](xref:botframework-streaming.NodeWebSocket) instance. | ||
* @remarks | ||
@@ -23,0 +30,0 @@ * The parameters for this method should be associated with an 'upgrade' event off of a Node.js HTTP Server. |
@@ -11,2 +11,5 @@ /** | ||
/** | ||
* Represents an abstract NodeWebSocketFactoryBase class to create a WebSocket. | ||
*/ | ||
export abstract class NodeWebSocketFactoryBase { | ||
@@ -13,0 +16,0 @@ public abstract createWebSocket( |
@@ -16,2 +16,5 @@ /** | ||
/** | ||
* An implementation of [ISocket](xref:botframework-streaming.ISocket) to use with a [NodeWebSocketFactory](xref:botframework-streaming.NodeWebSocketFactory) to create a WebSocket server. | ||
*/ | ||
export class NodeWebSocket implements ISocket { | ||
@@ -18,0 +21,0 @@ private wsSocket: WebSocket; |
@@ -92,2 +92,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private onConnectionDisconnected(sender: object, args: any): void { | ||
@@ -94,0 +97,0 @@ if (this._disconnectionHandler != null) { |
@@ -112,2 +112,5 @@ /** | ||
/** | ||
* @private | ||
*/ | ||
private onClose(): void { | ||
@@ -126,2 +129,5 @@ if (this._activeReceiveReject) { | ||
/** | ||
* @private | ||
*/ | ||
private onError(err: Error): void { | ||
@@ -134,2 +140,5 @@ if (this._activeReceiveReject) { | ||
/** | ||
* @private | ||
*/ | ||
private trySignalData(): void { | ||
@@ -136,0 +145,0 @@ if (this._activeReceiveResolve) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
726265
11.34%13004
13.91%