@cero-base/cero 1.9.0 → 1.10.1
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 +4 -4
- package/src/bluetooth.js +5 -1
- package/src/index.js +4 -1
- package/types/bluetooth.d.ts +4 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cero-base/cero",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "The ideal p2p API — everything is a handle, handles contain refs, refs contain rows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -95,11 +95,11 @@
|
|
|
95
95
|
"test:node": "ls test/*.test.js | xargs -P1 -n1 brittle-node"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@cero-base/core": "^1.
|
|
98
|
+
"@cero-base/core": "^1.10.1",
|
|
99
99
|
"b4a": "^1.8.1",
|
|
100
100
|
"bare-abort-controller": "^1.1.2",
|
|
101
101
|
"bare-crypto": "^1.15.3",
|
|
102
|
-
"bare-fs": "^4.
|
|
102
|
+
"bare-fs": "^4.8.0",
|
|
103
103
|
"bare-path": "^3.1.1",
|
|
104
104
|
"compact-encoding": "^3.3.0",
|
|
105
105
|
"corestore": "^7.12.0",
|
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
"bare-events": "^2.9.1",
|
|
121
121
|
"bare-fetch": "^3.2.0",
|
|
122
122
|
"bare-process": "^4.5.1",
|
|
123
|
-
"bare-url": "^2.
|
|
123
|
+
"bare-url": "^2.5.2",
|
|
124
124
|
"brittle": "^4.1.0",
|
|
125
125
|
"typescript": "^5.9.3"
|
|
126
126
|
},
|
package/src/bluetooth.js
CHANGED
|
@@ -43,8 +43,9 @@ export class Bluetooth extends ReadyResource {
|
|
|
43
43
|
* @param {boolean} [opts.autoStart] Start on handle open (from `cero({ bluetooth: true })`).
|
|
44
44
|
* @param {number} [opts.maxOutbound] Max concurrent outbound links; gossip covers the rest.
|
|
45
45
|
* @param {number} [opts.maxInbound] Max concurrent inbound sessions; newcomers past this are refused.
|
|
46
|
+
* @param {'l2cap' | 'gatt'} [opts.pipe] Data pipe — 'l2cap' (default, faster) or 'gatt'. Both peers must match.
|
|
46
47
|
*/
|
|
47
|
-
constructor(handle, { backend, autoStart, maxOutbound, maxInbound } = {}) {
|
|
48
|
+
constructor(handle, { backend, autoStart, maxOutbound, maxInbound, pipe } = {}) {
|
|
48
49
|
super()
|
|
49
50
|
this._handle = handle
|
|
50
51
|
// explicit null/false disables bluetooth; only an omitted backend lazy-loads
|
|
@@ -53,6 +54,7 @@ export class Bluetooth extends ReadyResource {
|
|
|
53
54
|
this._autoStart = autoStart === true
|
|
54
55
|
this._maxOutbound = maxOutbound
|
|
55
56
|
this._maxInbound = maxInbound
|
|
57
|
+
this._pipe = pipe
|
|
56
58
|
this._transport = null
|
|
57
59
|
this._name = null
|
|
58
60
|
this._announces = new Set()
|
|
@@ -83,6 +85,7 @@ export class Bluetooth extends ReadyResource {
|
|
|
83
85
|
uuid: topic,
|
|
84
86
|
nodeId: this._handle.identity.publicKey,
|
|
85
87
|
tag: 'cero-ble-invite',
|
|
88
|
+
pipe: this._pipe,
|
|
86
89
|
// the QR closing stops the rendezvous, not the just-established link —
|
|
87
90
|
// that link carries the joiner's initial replication
|
|
88
91
|
keepLinks: true
|
|
@@ -145,6 +148,7 @@ export class Bluetooth extends ReadyResource {
|
|
|
145
148
|
: handle.identity.publicKey,
|
|
146
149
|
nodeId: handle.identity.publicKey,
|
|
147
150
|
name: this._name || '',
|
|
151
|
+
pipe: this._pipe,
|
|
148
152
|
maxOutbound: this._maxOutbound,
|
|
149
153
|
maxInbound: this._maxInbound,
|
|
150
154
|
// Android scans in a battery-saver mode by default — too slow for a mesh
|
package/src/index.js
CHANGED
|
@@ -196,7 +196,10 @@ export async function cero(dir, spec, opts = {}) {
|
|
|
196
196
|
? { backend: opts.bluetooth }
|
|
197
197
|
: opts.bluetooth
|
|
198
198
|
me.bluetooth = new Bluetooth(me, {
|
|
199
|
-
backend:
|
|
199
|
+
// pass the backend through untouched: `|| null` turned an omitted
|
|
200
|
+
// backend (= lazy-load bare-bluetooth) into an explicit null
|
|
201
|
+
// (= disabled), leaving BLE 'unsupported' on every platform
|
|
202
|
+
backend: bt.backend,
|
|
200
203
|
autoStart: bt.autoStart !== false,
|
|
201
204
|
maxOutbound: bt.maxOutbound,
|
|
202
205
|
maxInbound: bt.maxInbound
|
package/types/bluetooth.d.ts
CHANGED
|
@@ -21,12 +21,14 @@ export class Bluetooth extends ReadyResource {
|
|
|
21
21
|
* @param {boolean} [opts.autoStart] Start on handle open (from `cero({ bluetooth: true })`).
|
|
22
22
|
* @param {number} [opts.maxOutbound] Max concurrent outbound links; gossip covers the rest.
|
|
23
23
|
* @param {number} [opts.maxInbound] Max concurrent inbound sessions; newcomers past this are refused.
|
|
24
|
+
* @param {'l2cap' | 'gatt'} [opts.pipe] Data pipe — 'l2cap' (default, faster) or 'gatt'. Both peers must match.
|
|
24
25
|
*/
|
|
25
|
-
constructor(handle: object, { backend, autoStart, maxOutbound, maxInbound }?: {
|
|
26
|
+
constructor(handle: object, { backend, autoStart, maxOutbound, maxInbound, pipe }?: {
|
|
26
27
|
backend?: any;
|
|
27
28
|
autoStart?: boolean;
|
|
28
29
|
maxOutbound?: number;
|
|
29
30
|
maxInbound?: number;
|
|
31
|
+
pipe?: "l2cap" | "gatt";
|
|
30
32
|
});
|
|
31
33
|
_handle: any;
|
|
32
34
|
_backend: any;
|
|
@@ -34,6 +36,7 @@ export class Bluetooth extends ReadyResource {
|
|
|
34
36
|
_autoStart: boolean;
|
|
35
37
|
_maxOutbound: number;
|
|
36
38
|
_maxInbound: number;
|
|
39
|
+
_pipe: "l2cap" | "gatt";
|
|
37
40
|
_transport: BLETransport;
|
|
38
41
|
_name: any;
|
|
39
42
|
_announces: Set<any>;
|