@libp2p/mplex 8.0.2 → 8.0.4-05abd49f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.min.js +5 -5
- package/dist/src/index.d.ts +1 -1
- package/dist/src/mplex.d.ts +2 -2
- package/dist/src/mplex.js +1 -1
- package/dist/src/mplex.js.map +1 -1
- package/dist/src/stream.d.ts +20 -1
- package/dist/src/stream.d.ts.map +1 -1
- package/dist/src/stream.js +37 -189
- package/dist/src/stream.js.map +1 -1
- package/package.json +22 -112
- package/src/index.ts +1 -1
- package/src/mplex.ts +3 -3
- package/src/stream.ts +42 -224
- package/dist/typedoc-urls.json +0 -4
package/dist/src/stream.d.ts.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,kBAAkB,EAAE,MAAM,uCAAuC,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAI/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAEjD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,KAAK,KAAK,IAAI,CAAA;IAC7B,IAAI,CAAC,EAAE,WAAW,GAAG,UAAU,CAAA;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,UAAU,eAAgB,SAAQ,kBAAkB;IAClD,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAA;CAC7B;AAED,cAAM,WAAY,SAAQ,cAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAQ;IAC7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAwB;IAC7C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAwB;gBAEjC,IAAI,EAAE,eAAe;IASlC,aAAa,IAAK,IAAI;IAItB,QAAQ,CAAE,IAAI,EAAE,cAAc,GAAG,IAAI;IAIrC,SAAS,IAAK,IAAI;IAIlB,cAAc,IAAK,IAAI;IAIvB,aAAa,IAAK,IAAI;CAGvB;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,OAAO,GAAG,WAAW,CAY3D"}
|
package/dist/src/stream.js
CHANGED
@@ -1,198 +1,46 @@
|
|
1
|
-
import {
|
2
|
-
import { logger } from '@libp2p/logger';
|
3
|
-
import { abortableSource } from 'abortable-iterator';
|
4
|
-
import { anySignal } from 'any-signal';
|
5
|
-
import { pushable } from 'it-pushable';
|
1
|
+
import { AbstractStream } from '@libp2p/interface/stream-muxer/stream';
|
6
2
|
import { Uint8ArrayList } from 'uint8arraylist';
|
7
3
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
8
4
|
import { MAX_MSG_SIZE } from './decode.js';
|
9
5
|
import { InitiatorMessageTypes, ReceiverMessageTypes } from './message-types.js';
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
6
|
+
class MplexStream extends AbstractStream {
|
7
|
+
name;
|
8
|
+
streamId;
|
9
|
+
send;
|
10
|
+
types;
|
11
|
+
constructor(init) {
|
12
|
+
super(init);
|
13
|
+
this.types = init.direction === 'outbound' ? InitiatorMessageTypes : ReceiverMessageTypes;
|
14
|
+
this.send = init.send;
|
15
|
+
this.name = init.name;
|
16
|
+
this.streamId = init.streamId;
|
17
|
+
}
|
18
|
+
sendNewStream() {
|
19
|
+
this.send({ id: this.streamId, type: InitiatorMessageTypes.NEW_STREAM, data: new Uint8ArrayList(uint8ArrayFromString(this.name)) });
|
20
|
+
}
|
21
|
+
sendData(data) {
|
22
|
+
this.send({ id: this.streamId, type: this.types.MESSAGE, data });
|
23
|
+
}
|
24
|
+
sendReset() {
|
25
|
+
this.send({ id: this.streamId, type: this.types.RESET });
|
26
|
+
}
|
27
|
+
sendCloseWrite() {
|
28
|
+
this.send({ id: this.streamId, type: this.types.CLOSE });
|
29
|
+
}
|
30
|
+
sendCloseRead() {
|
31
|
+
// mplex does not support close read, only close write
|
32
|
+
}
|
33
|
+
}
|
15
34
|
export function createStream(options) {
|
16
35
|
const { id, name, send, onEnd, type = 'initiator', maxMsgSize = MAX_MSG_SIZE } = options;
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
let sinkSunk = false;
|
26
|
-
let endErr;
|
27
|
-
const timeline = {
|
28
|
-
open: Date.now()
|
29
|
-
};
|
30
|
-
const onSourceEnd = (err) => {
|
31
|
-
if (sourceEnded) {
|
32
|
-
return;
|
33
|
-
}
|
34
|
-
sourceEnded = true;
|
35
|
-
log.trace('%s stream %s source end - err: %o', type, streamName, err);
|
36
|
-
if (err != null && endErr == null) {
|
37
|
-
endErr = err;
|
38
|
-
}
|
39
|
-
if (sinkEnded) {
|
40
|
-
stream.stat.timeline.close = Date.now();
|
41
|
-
if (onEnd != null) {
|
42
|
-
onEnd(endErr);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
};
|
46
|
-
const onSinkEnd = (err) => {
|
47
|
-
if (sinkEnded) {
|
48
|
-
return;
|
49
|
-
}
|
50
|
-
sinkEnded = true;
|
51
|
-
log.trace('%s stream %s sink end - err: %o', type, streamName, err);
|
52
|
-
if (err != null && endErr == null) {
|
53
|
-
endErr = err;
|
54
|
-
}
|
55
|
-
if (sourceEnded) {
|
56
|
-
timeline.close = Date.now();
|
57
|
-
if (onEnd != null) {
|
58
|
-
onEnd(endErr);
|
59
|
-
}
|
60
|
-
}
|
61
|
-
};
|
62
|
-
const streamSource = pushable({
|
63
|
-
onEnd: onSourceEnd
|
36
|
+
return new MplexStream({
|
37
|
+
id: type === 'initiator' ? (`i${id}`) : `r${id}`,
|
38
|
+
streamId: id,
|
39
|
+
name: `${name == null ? id : name}`,
|
40
|
+
direction: type === 'initiator' ? 'outbound' : 'inbound',
|
41
|
+
maxDataSize: maxMsgSize,
|
42
|
+
onEnd,
|
43
|
+
send
|
64
44
|
});
|
65
|
-
const stream = {
|
66
|
-
// Close for both Reading and Writing
|
67
|
-
close: () => {
|
68
|
-
log.trace('%s stream %s close', type, streamName);
|
69
|
-
stream.closeRead();
|
70
|
-
stream.closeWrite();
|
71
|
-
},
|
72
|
-
// Close for reading
|
73
|
-
closeRead: () => {
|
74
|
-
log.trace('%s stream %s closeRead', type, streamName);
|
75
|
-
if (sourceEnded) {
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
streamSource.end();
|
79
|
-
},
|
80
|
-
// Close for writing
|
81
|
-
closeWrite: () => {
|
82
|
-
log.trace('%s stream %s closeWrite', type, streamName);
|
83
|
-
if (sinkEnded) {
|
84
|
-
return;
|
85
|
-
}
|
86
|
-
closeController.abort();
|
87
|
-
try {
|
88
|
-
send({ id, type: Types.CLOSE });
|
89
|
-
}
|
90
|
-
catch (err) {
|
91
|
-
log.trace('%s stream %s error sending close', type, name, err);
|
92
|
-
}
|
93
|
-
onSinkEnd();
|
94
|
-
},
|
95
|
-
// Close for reading and writing (local error)
|
96
|
-
abort: (err) => {
|
97
|
-
log.trace('%s stream %s abort', type, streamName, err);
|
98
|
-
// End the source with the passed error
|
99
|
-
streamSource.end(err);
|
100
|
-
abortController.abort();
|
101
|
-
onSinkEnd(err);
|
102
|
-
},
|
103
|
-
// Close immediately for reading and writing (remote error)
|
104
|
-
reset: () => {
|
105
|
-
const err = new CodeError('stream reset', ERR_STREAM_RESET);
|
106
|
-
resetController.abort();
|
107
|
-
streamSource.end(err);
|
108
|
-
onSinkEnd(err);
|
109
|
-
},
|
110
|
-
sink: async (source) => {
|
111
|
-
if (sinkSunk) {
|
112
|
-
throw new CodeError('sink already called on stream', ERR_DOUBLE_SINK);
|
113
|
-
}
|
114
|
-
sinkSunk = true;
|
115
|
-
if (sinkEnded) {
|
116
|
-
throw new CodeError('stream closed for writing', ERR_SINK_ENDED);
|
117
|
-
}
|
118
|
-
const signal = anySignal([
|
119
|
-
abortController.signal,
|
120
|
-
resetController.signal,
|
121
|
-
closeController.signal
|
122
|
-
]);
|
123
|
-
try {
|
124
|
-
source = abortableSource(source, signal);
|
125
|
-
if (type === 'initiator') { // If initiator, open a new stream
|
126
|
-
send({ id, type: InitiatorMessageTypes.NEW_STREAM, data: new Uint8ArrayList(uint8ArrayFromString(streamName)) });
|
127
|
-
}
|
128
|
-
for await (let data of source) {
|
129
|
-
while (data.length > 0) {
|
130
|
-
if (data.length <= maxMsgSize) {
|
131
|
-
send({ id, type: Types.MESSAGE, data: data instanceof Uint8Array ? new Uint8ArrayList(data) : data });
|
132
|
-
break;
|
133
|
-
}
|
134
|
-
data = data instanceof Uint8Array ? new Uint8ArrayList(data) : data;
|
135
|
-
send({ id, type: Types.MESSAGE, data: data.sublist(0, maxMsgSize) });
|
136
|
-
data.consume(maxMsgSize);
|
137
|
-
}
|
138
|
-
}
|
139
|
-
}
|
140
|
-
catch (err) {
|
141
|
-
if (err.type === 'aborted' && err.message === 'The operation was aborted') {
|
142
|
-
if (closeController.signal.aborted) {
|
143
|
-
return;
|
144
|
-
}
|
145
|
-
if (resetController.signal.aborted) {
|
146
|
-
err.message = 'stream reset';
|
147
|
-
err.code = ERR_STREAM_RESET;
|
148
|
-
}
|
149
|
-
if (abortController.signal.aborted) {
|
150
|
-
err.message = 'stream aborted';
|
151
|
-
err.code = ERR_STREAM_ABORT;
|
152
|
-
}
|
153
|
-
}
|
154
|
-
// Send no more data if this stream was remotely reset
|
155
|
-
if (err.code === ERR_STREAM_RESET) {
|
156
|
-
log.trace('%s stream %s reset', type, name);
|
157
|
-
}
|
158
|
-
else {
|
159
|
-
log.trace('%s stream %s error', type, name, err);
|
160
|
-
try {
|
161
|
-
send({ id, type: Types.RESET });
|
162
|
-
}
|
163
|
-
catch (err) {
|
164
|
-
log.trace('%s stream %s error sending reset', type, name, err);
|
165
|
-
}
|
166
|
-
}
|
167
|
-
streamSource.end(err);
|
168
|
-
onSinkEnd(err);
|
169
|
-
return;
|
170
|
-
}
|
171
|
-
finally {
|
172
|
-
signal.clear();
|
173
|
-
}
|
174
|
-
try {
|
175
|
-
send({ id, type: Types.CLOSE });
|
176
|
-
}
|
177
|
-
catch (err) {
|
178
|
-
log.trace('%s stream %s error sending close', type, name, err);
|
179
|
-
}
|
180
|
-
onSinkEnd();
|
181
|
-
},
|
182
|
-
source: streamSource,
|
183
|
-
sourcePush: (data) => {
|
184
|
-
streamSource.push(data);
|
185
|
-
},
|
186
|
-
sourceReadableLength() {
|
187
|
-
return streamSource.readableLength;
|
188
|
-
},
|
189
|
-
stat: {
|
190
|
-
direction: type === 'initiator' ? 'outbound' : 'inbound',
|
191
|
-
timeline
|
192
|
-
},
|
193
|
-
metadata: {},
|
194
|
-
id: externalId
|
195
|
-
};
|
196
|
-
return stream;
|
197
45
|
}
|
198
46
|
//# sourceMappingURL=stream.js.map
|
package/dist/src/stream.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2B,MAAM,uCAAuC,CAAA;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,UAAU,IAAI,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC1C,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAA;AAkBhF,MAAM,WAAY,SAAQ,cAAc;IACrB,IAAI,CAAQ;IACZ,QAAQ,CAAQ;IAChB,IAAI,CAAwB;IAC5B,KAAK,CAAwB;IAE9C,YAAa,IAAqB;QAChC,KAAK,CAAC,IAAI,CAAC,CAAA;QAEX,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,oBAAoB,CAAA;QACzF,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;QACrB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAA;IAC/B,CAAC;IAED,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,qBAAqB,CAAC,UAAU,EAAE,IAAI,EAAE,IAAI,cAAc,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAA;IACrI,CAAC;IAED,QAAQ,CAAE,IAAoB;QAC5B,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;IAClE,CAAC;IAED,SAAS;QACP,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,cAAc;QACZ,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;IAC1D,CAAC;IAED,aAAa;QACX,sDAAsD;IACxD,CAAC;CACF;AAED,MAAM,UAAU,YAAY,CAAE,OAAgB;IAC5C,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,GAAG,WAAW,EAAE,UAAU,GAAG,YAAY,EAAE,GAAG,OAAO,CAAA;IAExF,OAAO,IAAI,WAAW,CAAC;QACrB,EAAE,EAAE,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE;QAChD,QAAQ,EAAE,EAAE;QACZ,IAAI,EAAE,GAAG,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;QACnC,SAAS,EAAE,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;QACxD,WAAW,EAAE,UAAU;QACvB,KAAK;QACL,IAAI;KACL,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "@libp2p/mplex",
|
3
|
-
"version": "8.0.
|
3
|
+
"version": "8.0.4-05abd49f",
|
4
4
|
"description": "JavaScript implementation of https://github.com/libp2p/mplex",
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p-mplex#readme",
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/stream-multiplexer-mplex#readme",
|
7
7
|
"repository": {
|
8
8
|
"type": "git",
|
9
|
-
"url": "git+https://github.com/libp2p/js-libp2p
|
9
|
+
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
10
10
|
},
|
11
11
|
"bugs": {
|
12
|
-
"url": "https://github.com/libp2p/js-libp2p
|
12
|
+
"url": "https://github.com/libp2p/js-libp2p/issues"
|
13
13
|
},
|
14
14
|
"keywords": [
|
15
15
|
"IPFS",
|
@@ -21,10 +21,6 @@
|
|
21
21
|
"muxer",
|
22
22
|
"stream"
|
23
23
|
],
|
24
|
-
"engines": {
|
25
|
-
"node": ">=16.0.0",
|
26
|
-
"npm": ">=7.0.0"
|
27
|
-
},
|
28
24
|
"type": "module",
|
29
25
|
"types": "./dist/src/index.d.ts",
|
30
26
|
"files": [
|
@@ -45,91 +41,6 @@
|
|
45
41
|
"sourceType": "module"
|
46
42
|
}
|
47
43
|
},
|
48
|
-
"release": {
|
49
|
-
"branches": [
|
50
|
-
"master"
|
51
|
-
],
|
52
|
-
"plugins": [
|
53
|
-
[
|
54
|
-
"@semantic-release/commit-analyzer",
|
55
|
-
{
|
56
|
-
"preset": "conventionalcommits",
|
57
|
-
"releaseRules": [
|
58
|
-
{
|
59
|
-
"breaking": true,
|
60
|
-
"release": "major"
|
61
|
-
},
|
62
|
-
{
|
63
|
-
"revert": true,
|
64
|
-
"release": "patch"
|
65
|
-
},
|
66
|
-
{
|
67
|
-
"type": "feat",
|
68
|
-
"release": "minor"
|
69
|
-
},
|
70
|
-
{
|
71
|
-
"type": "fix",
|
72
|
-
"release": "patch"
|
73
|
-
},
|
74
|
-
{
|
75
|
-
"type": "docs",
|
76
|
-
"release": "patch"
|
77
|
-
},
|
78
|
-
{
|
79
|
-
"type": "test",
|
80
|
-
"release": "patch"
|
81
|
-
},
|
82
|
-
{
|
83
|
-
"type": "deps",
|
84
|
-
"release": "patch"
|
85
|
-
},
|
86
|
-
{
|
87
|
-
"scope": "no-release",
|
88
|
-
"release": false
|
89
|
-
}
|
90
|
-
]
|
91
|
-
}
|
92
|
-
],
|
93
|
-
[
|
94
|
-
"@semantic-release/release-notes-generator",
|
95
|
-
{
|
96
|
-
"preset": "conventionalcommits",
|
97
|
-
"presetConfig": {
|
98
|
-
"types": [
|
99
|
-
{
|
100
|
-
"type": "feat",
|
101
|
-
"section": "Features"
|
102
|
-
},
|
103
|
-
{
|
104
|
-
"type": "fix",
|
105
|
-
"section": "Bug Fixes"
|
106
|
-
},
|
107
|
-
{
|
108
|
-
"type": "chore",
|
109
|
-
"section": "Trivial Changes"
|
110
|
-
},
|
111
|
-
{
|
112
|
-
"type": "docs",
|
113
|
-
"section": "Documentation"
|
114
|
-
},
|
115
|
-
{
|
116
|
-
"type": "deps",
|
117
|
-
"section": "Dependencies"
|
118
|
-
},
|
119
|
-
{
|
120
|
-
"type": "test",
|
121
|
-
"section": "Tests"
|
122
|
-
}
|
123
|
-
]
|
124
|
-
}
|
125
|
-
}
|
126
|
-
],
|
127
|
-
"@semantic-release/changelog",
|
128
|
-
"@semantic-release/npm",
|
129
|
-
"@semantic-release/github",
|
130
|
-
"@semantic-release/git"
|
131
|
-
]
|
132
|
-
},
|
133
44
|
"scripts": {
|
134
45
|
"clean": "aegir clean",
|
135
46
|
"lint": "aegir lint",
|
@@ -142,37 +53,33 @@
|
|
142
53
|
"test:firefox": "aegir test -t browser -- --browser firefox",
|
143
54
|
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
|
144
55
|
"test:node": "aegir test -t node --cov",
|
145
|
-
"test:electron-main": "aegir test -t electron-main"
|
146
|
-
"release": "aegir release",
|
147
|
-
"docs": "aegir docs"
|
56
|
+
"test:electron-main": "aegir test -t electron-main"
|
148
57
|
},
|
149
58
|
"dependencies": {
|
150
|
-
"@libp2p/interface
|
151
|
-
"@libp2p/
|
152
|
-
"
|
153
|
-
"
|
154
|
-
"abortable-iterator": "^5.0.0",
|
155
|
-
"any-signal": "^4.0.1",
|
59
|
+
"@libp2p/interface": "0.0.1-05abd49f",
|
60
|
+
"@libp2p/logger": "2.1.1-05abd49f",
|
61
|
+
"abortable-iterator": "^5.0.1",
|
62
|
+
"any-signal": "^4.1.1",
|
156
63
|
"benchmark": "^2.1.4",
|
157
64
|
"it-batched-bytes": "^2.0.2",
|
158
|
-
"it-pushable": "^3.1.
|
65
|
+
"it-pushable": "^3.1.3",
|
159
66
|
"it-stream-types": "^2.0.1",
|
160
|
-
"rate-limiter-flexible": "^2.3.
|
161
|
-
"uint8arraylist": "^2.
|
162
|
-
"uint8arrays": "^4.0.
|
67
|
+
"rate-limiter-flexible": "^2.3.11",
|
68
|
+
"uint8arraylist": "^2.4.3",
|
69
|
+
"uint8arrays": "^4.0.4",
|
163
70
|
"varint": "^6.0.0"
|
164
71
|
},
|
165
72
|
"devDependencies": {
|
166
|
-
"@libp2p/interface-
|
73
|
+
"@libp2p/interface-compliance-tests": "3.0.7-05abd49f",
|
167
74
|
"@types/varint": "^6.0.0",
|
168
|
-
"aegir": "^39.0.
|
169
|
-
"cborg": "^
|
170
|
-
"delay": "^
|
75
|
+
"aegir": "^39.0.10",
|
76
|
+
"cborg": "^2.0.1",
|
77
|
+
"delay": "^6.0.0",
|
171
78
|
"iso-random-stream": "^2.0.2",
|
172
79
|
"it-all": "^3.0.1",
|
173
|
-
"it-drain": "^3.0.
|
80
|
+
"it-drain": "^3.0.2",
|
174
81
|
"it-foreach": "^2.0.2",
|
175
|
-
"it-map": "^3.0.
|
82
|
+
"it-map": "^3.0.3",
|
176
83
|
"it-pipe": "^3.0.1",
|
177
84
|
"it-to-buffer": "^4.0.1",
|
178
85
|
"p-defer": "^4.0.0",
|
@@ -180,5 +87,8 @@
|
|
180
87
|
},
|
181
88
|
"browser": {
|
182
89
|
"./dist/src/alloc-unsafe.js": "./dist/src/alloc-unsafe-browser.js"
|
90
|
+
},
|
91
|
+
"typedoc": {
|
92
|
+
"entryPoint": "./src/index.ts"
|
183
93
|
}
|
184
94
|
}
|
package/src/index.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { MplexStreamMuxer } from './mplex.js'
|
2
|
-
import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface
|
2
|
+
import type { StreamMuxer, StreamMuxerFactory, StreamMuxerInit } from '@libp2p/interface/stream-muxer'
|
3
3
|
|
4
4
|
export interface MplexInit {
|
5
5
|
/**
|
package/src/mplex.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import { CodeError } from '@libp2p/
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
2
2
|
import { logger } from '@libp2p/logger'
|
3
3
|
import { abortableSource } from 'abortable-iterator'
|
4
4
|
import { anySignal } from 'any-signal'
|
@@ -10,8 +10,8 @@ import { encode } from './encode.js'
|
|
10
10
|
import { MessageTypes, MessageTypeNames, type Message } from './message-types.js'
|
11
11
|
import { createStream } from './stream.js'
|
12
12
|
import type { MplexInit } from './index.js'
|
13
|
-
import type { Stream } from '@libp2p/interface
|
14
|
-
import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface
|
13
|
+
import type { Stream } from '@libp2p/interface/connection'
|
14
|
+
import type { StreamMuxer, StreamMuxerInit } from '@libp2p/interface/stream-muxer'
|
15
15
|
import type { Sink, Source } from 'it-stream-types'
|
16
16
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
17
17
|
|