From 5d25c121becf03c1ab522a87468b69d69f2b82d3 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Tue, 21 Dec 2021 18:46:16 +0100 Subject: [PATCH] fix: types again Make duplex streams accept buffer lists as well as uint8arrays and fix final few uses of AbortOptions. --- src/handle.js | 2 +- src/index.js | 12 +++++------- src/ls.js | 2 +- src/select.js | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/handle.js b/src/handle.js index ca4484c..75aa537 100644 --- a/src/handle.js +++ b/src/handle.js @@ -12,7 +12,7 @@ const log = Object.assign(debug('mss:handle'), { }) /** - * @typedef {import('./types').DuplexStream} DuplexStream + * @typedef {import('./types').DuplexStream} DuplexStream * @typedef {import('./types').AbortOptions} AbortOptions */ diff --git a/src/index.js b/src/index.js index 3da0958..93c2b14 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,8 @@ const { PROTOCOL_ID } = require('./constants') exports.PROTOCOL_ID = PROTOCOL_ID /** - * @typedef {import('./types').DuplexStream} DuplexStream + * @typedef {import('bl/BufferList')} BufferList + * @typedef {import('./types').DuplexStream} DuplexStream * @typedef {import('./types').AbortOptions} AbortOptions */ @@ -24,8 +25,7 @@ class MultistreamSelect { /** * Perform the multistream-select handshake * - * @param {object} [options] - * @param {AbortSignal} options.signal + * @param {AbortOptions} [options] */ async _handshake (options) { if (this._shaken) return @@ -38,16 +38,14 @@ class MultistreamSelect { class Dialer extends MultistreamSelect { /** * @param {string | string[]} protocols - * @param {object} [options] - * @param {AbortSignal} options.signal + * @param {AbortOptions} [options] */ select (protocols, options) { return select(this._stream, protocols, this._shaken ? undefined : PROTOCOL_ID, options) } /** - * @param {object} [options] - * @param {AbortSignal} options.signal + * @param {AbortOptions} [options] */ async ls (options) { await this._handshake(options) diff --git a/src/ls.js b/src/ls.js index 720e179..53511b8 100644 --- a/src/ls.js +++ b/src/ls.js @@ -14,8 +14,8 @@ const log = Object.assign(debug('mss:ls'), { }) /** - * @typedef {import('./types').DuplexStream} DuplexStream * @typedef {import('bl/BufferList')} BufferList + * @typedef {import('./types').DuplexStream} DuplexStream * @typedef {import('./types').AbortOptions} AbortOptions */ diff --git a/src/select.js b/src/select.js index 57e9037..0a1dc5e 100644 --- a/src/select.js +++ b/src/select.js @@ -11,8 +11,8 @@ const log = Object.assign(debug('mss:select'), { }) /** - * @typedef {import('./types').DuplexStream} DuplexStream * @typedef {import('bl/BufferList')} BufferList + * @typedef {import('./types').DuplexStream} DuplexStream * @typedef {import('./types').AbortOptions} AbortOptions */