@cero-base/cero 3.5.0 → 3.6.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/README.md +9 -9
- package/package.json +14 -2
- package/src/build/index.js +6 -1
- package/src/build/schemas.js +25 -0
- package/src/extensions/calls.js +911 -0
- package/src/extensions/index.js +3 -1
- package/src/extensions/pulse.js +33 -0
- package/src/handle/index.js +17 -9
- package/src/index.js +15 -11
- package/src/lib/line.js +28 -0
- package/src/lib/media.js +285 -0
- package/src/lib/operators.js +108 -7
- package/src/lib/pulse-ui.js +5 -0
- package/src/lib/pulse.js +505 -0
- package/src/lib/refs.js +3 -3
- package/src/push/firebase.js +1 -1
- package/src/push/index.js +25 -19
- package/src/rpc/client.js +214 -2
- package/src/rpc/server.js +30 -3
- package/types/build/schemas.d.ts +22 -0
- package/types/extensions/calls.d.ts +218 -0
- package/types/extensions/index.d.ts +15 -4
- package/types/extensions/pulse.d.ts +11 -0
- package/types/handle/index.d.ts +9 -0
- package/types/index.d.ts +9 -2
- package/types/lib/line.d.ts +20 -0
- package/types/lib/media.d.ts +156 -0
- package/types/lib/operators.d.ts +64 -7
- package/types/lib/pulse-ui.d.ts +1 -0
- package/types/lib/pulse.d.ts +11 -0
- package/types/lib/refs.d.ts +5 -5
- package/types/push/firebase.d.ts +1 -1
- package/types/push/index.d.ts +8 -6
- package/types/rpc/client.d.ts +20 -3
- package/types/rpc/server.d.ts +6 -0
package/README.md
CHANGED
|
@@ -67,15 +67,15 @@ That is a working, encrypted, offline-first, peer-to-peer app. Your phrase, `awa
|
|
|
67
67
|
|
|
68
68
|
## Exports
|
|
69
69
|
|
|
70
|
-
| Subpath | What it gives you
|
|
71
|
-
| ---------------------------- |
|
|
72
|
-
| `@cero-base/cero` | `cero`, `t`, `schema`, `restore`, `peek`, the
|
|
73
|
-
| `@cero-base/cero/build` | `build(specDir, schema, opts)`
|
|
74
|
-
| `@cero-base/cero/server` | `serve(ipc, spec, opts)` and `Server`, the worker that owns the data
|
|
75
|
-
| `@cero-base/cero/client` | `cero(ipc, spec)` (also `connect`), `Client`, `restore`, `t`, `schema` and every operator but `before`, `after` and `tx`, for a UI process
|
|
76
|
-
| `@cero-base/cero/extensions` | `profileSync`, `handleSync`, `bundled`, `extensionsOf`, and a light `cero` with `t`, `schema` and the operators, for extension modules
|
|
77
|
-
|
|
78
|
-
The
|
|
70
|
+
| Subpath | What it gives you |
|
|
71
|
+
| ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
72
|
+
| `@cero-base/cero` | `cero`, `t`, `schema`, `restore`, `peek`, the 30 operators, `Handle`, `Ref`, `Local` |
|
|
73
|
+
| `@cero-base/cero/build` | `build(specDir, schema, opts)` |
|
|
74
|
+
| `@cero-base/cero/server` | `serve(ipc, spec, opts)` and `Server`, the worker that owns the data |
|
|
75
|
+
| `@cero-base/cero/client` | `cero(ipc, spec)` (also `connect`), `Client`, `restore`, `t`, `schema` and every operator but `before`, `after` and `tx`, for a UI process |
|
|
76
|
+
| `@cero-base/cero/extensions` | `profileSync`, `handleSync`, `calls`, `bundled`, `extensionsOf`, and a light `cero` with `t`, `schema` and the operators, for extension modules |
|
|
77
|
+
|
|
78
|
+
The 30 operators, each also on the facade as `cero.put` and so on: `put`, `set`, `get`, `del`, `watch`, `call`, `open`, `tx`, `invite`, `revoke`, `rotate`, `accept`, `deny`, `leave`, `close`, `cancel`, `suspend`, `resume`, `activate`, `deactivate`, `phrase`, `nearby`, `before`, `after`, `dial`, `end`, `mute`, `unmute`, `share`, `unshare`.
|
|
79
79
|
|
|
80
80
|
Built on the [Pear](https://pears.com) stack: Hypercore, Autobee, HyperDB, Hyperblobs, Hyperjoin, blind-peering and Bare. Runs on Node and Bare, with TypeScript declarations.
|
|
81
81
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cero-base/cero",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
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,
|
|
@@ -52,6 +52,11 @@
|
|
|
52
52
|
"./push/firebase": {
|
|
53
53
|
"types": "./types/push/firebase.d.ts",
|
|
54
54
|
"default": "./src/push/firebase.js"
|
|
55
|
+
},
|
|
56
|
+
"./internal/pulse": {
|
|
57
|
+
"bare": "./src/lib/pulse.js",
|
|
58
|
+
"node": "./src/lib/pulse.js",
|
|
59
|
+
"default": "./src/lib/pulse-ui.js"
|
|
55
60
|
}
|
|
56
61
|
},
|
|
57
62
|
"typesVersions": {
|
|
@@ -100,6 +105,10 @@
|
|
|
100
105
|
"process": {
|
|
101
106
|
"bare": "bare-process",
|
|
102
107
|
"default": "process"
|
|
108
|
+
},
|
|
109
|
+
"child_process": {
|
|
110
|
+
"bare": "bare-subprocess",
|
|
111
|
+
"default": "child_process"
|
|
103
112
|
}
|
|
104
113
|
},
|
|
105
114
|
"scripts": {
|
|
@@ -113,7 +122,7 @@
|
|
|
113
122
|
"test:node": "find test -name '*.test.js' | sort | xargs -P4 -n1 brittle-node"
|
|
114
123
|
},
|
|
115
124
|
"dependencies": {
|
|
116
|
-
"@cero-base/core": "^3.
|
|
125
|
+
"@cero-base/core": "^3.6.0",
|
|
117
126
|
"b4a": "^1.9.0",
|
|
118
127
|
"bare-abort-controller": "^1.1.2",
|
|
119
128
|
"bare-crypto": "^1.16.1",
|
|
@@ -131,9 +140,11 @@
|
|
|
131
140
|
"hyperdb": "^6.11.2",
|
|
132
141
|
"hyperdispatch": "^1.6.0",
|
|
133
142
|
"hyperschema": "^1.26.2",
|
|
143
|
+
"hypertracker": "^2.4.4",
|
|
134
144
|
"protomux": "^3.13.1",
|
|
135
145
|
"ready-resource": "^1.2.0",
|
|
136
146
|
"safety-catch": "^1.0.3",
|
|
147
|
+
"sdp-transform": "^3.0.0",
|
|
137
148
|
"streamx": "^2.28.1",
|
|
138
149
|
"suspendify": "^1.7.2",
|
|
139
150
|
"z32": "^1.1.0"
|
|
@@ -143,6 +154,7 @@
|
|
|
143
154
|
"bare-events": "^2.9.2",
|
|
144
155
|
"bare-fetch": "^3.5.0",
|
|
145
156
|
"bare-process": "^4.5.1",
|
|
157
|
+
"bare-subprocess": "^6.2.3",
|
|
146
158
|
"bare-url": "^2.5.8",
|
|
147
159
|
"blind-peer": "^3.20.1",
|
|
148
160
|
"brittle": "^4.6.0",
|
package/src/build/index.js
CHANGED
|
@@ -60,7 +60,12 @@ export async function build(specDir, schema, { ns = NS, extensions } = {}) {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
fold(raw, defs, false)
|
|
63
|
-
for (const ext of exts)
|
|
63
|
+
for (const ext of exts) {
|
|
64
|
+
// a schema that is a function reaches the handle types the app has
|
|
65
|
+
const types = Object.keys(defs).filter((k) => k !== 'local' && isPlainHandle(defs[k]))
|
|
66
|
+
const schema = typeof ext.schema === 'function' ? ext.schema(types) : ext.schema
|
|
67
|
+
if (schema) fold(schema, defs, true)
|
|
68
|
+
}
|
|
64
69
|
|
|
65
70
|
const main = compile(splitMain(defs), ns, 'main', true)
|
|
66
71
|
const local = compile(defs.local || {}, ns, 'local')
|
package/src/build/schemas.js
CHANGED
|
@@ -235,6 +235,31 @@ export const main = {
|
|
|
235
235
|
by: string,
|
|
236
236
|
pass: required(bytes),
|
|
237
237
|
createdAt: uint
|
|
238
|
+
},
|
|
239
|
+
// another device on a call, as a line's `peers` gives it: computed on read, never stored
|
|
240
|
+
'line-peer': {
|
|
241
|
+
id: required(string),
|
|
242
|
+
member: string,
|
|
243
|
+
audio: bool,
|
|
244
|
+
video: bool,
|
|
245
|
+
sharing: bool,
|
|
246
|
+
connected: bool,
|
|
247
|
+
reconnecting: bool
|
|
248
|
+
},
|
|
249
|
+
// this device's microphone, camera and screen as its row shows them
|
|
250
|
+
'line-lanes': {
|
|
251
|
+
id: required(string),
|
|
252
|
+
audio: bool,
|
|
253
|
+
video: bool,
|
|
254
|
+
screen: bool
|
|
255
|
+
},
|
|
256
|
+
// for the UI's WebRTC: the local port a device's media crosses, and the description it sent last
|
|
257
|
+
'line-port': {
|
|
258
|
+
id: required(string),
|
|
259
|
+
port: required(uint),
|
|
260
|
+
seq: uint,
|
|
261
|
+
type: string,
|
|
262
|
+
sdp: string
|
|
238
263
|
}
|
|
239
264
|
}
|
|
240
265
|
|