@cero-base/tools 1.16.1 → 1.18.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cero-base/tools",
3
- "version": "1.16.1",
3
+ "version": "1.18.0",
4
4
  "description": "Passive devtools for cero — observe data, events, and p2p/replication stats over a local out-of-band pipe.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -76,21 +76,21 @@
76
76
  "test:node": "ls test/*.test.js | xargs -P1 -n1 brittle-node"
77
77
  },
78
78
  "dependencies": {
79
- "@cero-base/cero": "^1.16.1",
79
+ "@cero-base/cero": "^1.18.0",
80
80
  "b4a": "^1.8.1",
81
81
  "bare-crypto": "^1.15.3",
82
82
  "bare-net": "^2.3.3",
83
83
  "bare-process": "^4.5.1",
84
- "streamx": "^2.28.0"
84
+ "streamx": "^2.28.1"
85
85
  },
86
86
  "devDependencies": {
87
87
  "@hyperswarm/testnet": "^3.1.4",
88
88
  "bare-abort-controller": "^1.1.2",
89
- "bare-fetch": "^3.2.0",
90
- "bare-fs": "^4.8.0",
91
- "bare-path": "^3.1.1",
92
- "bare-url": "^2.5.2",
93
- "brittle": "^4.1.0",
89
+ "bare-fetch": "^3.2.1",
90
+ "bare-fs": "^4.8.1",
91
+ "bare-path": "^3.1.2",
92
+ "bare-url": "^2.5.4",
93
+ "brittle": "^4.1.1",
94
94
  "typescript": "^5.9.3"
95
95
  },
96
96
  "license": "Apache-2.0",
package/src/connect.js CHANGED
@@ -30,22 +30,23 @@ export class Session {
30
30
  this.pending = new Map()
31
31
  this.streams = new Map()
32
32
  this.seq = 0
33
- this.wire = new Framed(stream, (msg) => this._onMessage(msg))
33
+ this.wire = new Framed(stream, (msg) => this._onmessage(msg))
34
34
  stream.on('error', () => {}) // a transport error shouldn't crash the consumer
35
- stream.on('close', () => this._onClose())
35
+ stream.on('close', () => this._onclose())
36
36
  }
37
37
 
38
38
  // The transport dropped — fail in-flight requests and end live streams instead
39
39
  // of leaving them hung and the maps leaking.
40
- _onClose() {
41
- for (const { reject } of this.pending.values())
40
+ _onclose() {
41
+ for (const { reject } of this.pending.values()) {
42
42
  reject(new TapError('connection closed', 'CLOSED'))
43
+ }
43
44
  this.pending.clear()
44
45
  for (const r of this.streams.values()) r.push(null)
45
46
  this.streams.clear()
46
47
  }
47
48
 
48
- _onMessage(msg) {
49
+ _onmessage(msg) {
49
50
  if ('frame' in msg || msg.end) {
50
51
  const r = this.streams.get(msg.id)
51
52
  if (!r) return
@@ -84,8 +85,9 @@ export class Session {
84
85
  const id = this._newId()
85
86
  const r = new Readable({
86
87
  destroy: (cb) => {
87
- if (this.streams.delete(id))
88
+ if (this.streams.delete(id)) {
88
89
  this._send({ id: this._newId(), method: 'cancel', cancelId: id })
90
+ }
89
91
  cb(null)
90
92
  }
91
93
  })
package/src/protocol.js CHANGED
@@ -36,10 +36,10 @@ export class Framed {
36
36
  this.stream = stream
37
37
  this.onMessage = onMessage
38
38
  this.buf = b4a.alloc(0)
39
- stream.on('data', (chunk) => this._onData(chunk))
39
+ stream.on('data', (chunk) => this._ondata(chunk))
40
40
  }
41
41
 
42
- _onData(chunk) {
42
+ _ondata(chunk) {
43
43
  this.buf = b4a.concat([this.buf, chunk])
44
44
  while (this.buf.length >= 4) {
45
45
  const len = new DataView(this.buf.buffer, this.buf.byteOffset, 4).getUint32(0, true)
@@ -30,8 +30,8 @@ export class Session {
30
30
  streams: Map<any, any>;
31
31
  seq: number;
32
32
  wire: Framed;
33
- _onClose(): void;
34
- _onMessage(msg: any): void;
33
+ _onclose(): void;
34
+ _onmessage(msg: any): void;
35
35
  _newId(): number;
36
36
  _send(frame: any): void;
37
37
  _request(method: any, fields: any): Promise<any>;
@@ -7,7 +7,7 @@ export class Framed {
7
7
  stream: any;
8
8
  onMessage: any;
9
9
  buf: any;
10
- _onData(chunk: any): void;
10
+ _ondata(chunk: any): void;
11
11
  /**
12
12
  * Encode `obj` to wire form and write it as one length-prefixed frame.
13
13
  * @param {object} obj - message to send