@kubun/plugin-p2p 0.10.0 → 0.11.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/lib/context/delegation.js +130 -1
- package/lib/context/group.js +1319 -1
- package/lib/context/hub.js +150 -1
- package/lib/context/join.js +80 -1
- package/lib/context/sync.js +19 -1
- package/lib/context/types.d.ts +12 -3
- package/lib/context/types.js +28 -1
- package/lib/groups/admin-roster.d.ts +130 -0
- package/lib/groups/admin-roster.js +184 -0
- package/lib/groups/broadcast-codec.js +6 -1
- package/lib/groups/broadcast.d.ts +122 -38
- package/lib/groups/broadcast.js +627 -1
- package/lib/groups/circle-projection.d.ts +122 -0
- package/lib/groups/circle-projection.js +288 -0
- package/lib/groups/circle-reducers.d.ts +178 -0
- package/lib/groups/circle-reducers.js +198 -0
- package/lib/groups/events.d.ts +7 -2
- package/lib/groups/events.js +10 -1
- package/lib/groups/group-anchor.d.ts +63 -0
- package/lib/groups/group-anchor.js +107 -0
- package/lib/groups/group-crypto.d.ts +19 -0
- package/lib/groups/group-crypto.js +85 -0
- package/lib/groups/group-handle-registry.d.ts +69 -2
- package/lib/groups/group-handle-registry.js +243 -1
- package/lib/groups/group-handlers.d.ts +29 -0
- package/lib/groups/group-handlers.js +92 -0
- package/lib/groups/group-health-monitor.d.ts +56 -0
- package/lib/groups/group-health-monitor.js +139 -0
- package/lib/groups/group-mls.d.ts +35 -0
- package/lib/groups/group-mls.js +164 -0
- package/lib/groups/group-peer-manager.d.ts +108 -0
- package/lib/groups/group-peer-manager.js +344 -0
- package/lib/groups/group-protocols.d.ts +297 -0
- package/lib/groups/group-protocols.js +174 -0
- package/lib/groups/invite-payload.d.ts +1 -1
- package/lib/groups/invite-payload.js +26 -1
- package/lib/groups/join-utils.d.ts +1 -0
- package/lib/groups/join-utils.js +104 -1
- package/lib/groups/ledger-affected-events.d.ts +15 -0
- package/lib/groups/ledger-affected-events.js +96 -0
- package/lib/groups/ledger-entry.d.ts +37 -0
- package/lib/groups/ledger-entry.js +56 -0
- package/lib/groups/ledger-fold.d.ts +56 -0
- package/lib/groups/ledger-fold.js +53 -0
- package/lib/groups/manager.d.ts +29 -71
- package/lib/groups/manager.js +281 -1
- package/lib/groups/mls-codec.d.ts +1 -1
- package/lib/groups/mls-codec.js +18 -1
- package/lib/groups/mls-encryptor.d.ts +2 -2
- package/lib/groups/mls-encryptor.js +30 -1
- package/lib/groups/mls-group-handle.d.ts +1 -1
- package/lib/groups/mls-group-handle.js +10 -1
- package/lib/groups/mls-json.js +17 -1
- package/lib/groups/mls-receive-errors.d.ts +29 -0
- package/lib/groups/mls-receive-errors.js +42 -0
- package/lib/groups/mls-state.d.ts +1 -1
- package/lib/groups/mls-state.js +56 -1
- package/lib/groups/store-received-grant.d.ts +4 -1
- package/lib/groups/store-received-grant.js +116 -1
- package/lib/groups/store-received-revocation.d.ts +3 -3
- package/lib/groups/store-received-revocation.js +82 -1
- package/lib/hub/ack-backoff.d.ts +22 -0
- package/lib/hub/ack-backoff.js +88 -0
- package/lib/hub/did-observing-transport.d.ts +13 -2
- package/lib/hub/did-observing-transport.js +126 -1
- package/lib/hub/errors.d.ts +4 -8
- package/lib/hub/errors.js +33 -1
- package/lib/hub/http-client.d.ts +28 -3
- package/lib/hub/http-client.js +32 -1
- package/lib/hub/hub-like.d.ts +24 -0
- package/lib/hub/hub-like.js +535 -0
- package/lib/hub/manager.d.ts +5 -4
- package/lib/hub/manager.js +198 -1
- package/lib/hub/wiring.d.ts +28 -41
- package/lib/hub/wiring.js +132 -1
- package/lib/index.d.ts +29 -13
- package/lib/index.js +392 -1
- package/lib/protocol.d.ts +8 -1
- package/lib/protocol.js +251 -1
- package/lib/schema.d.ts +2 -1
- package/lib/schema.js +471 -2
- package/lib/sync/authorize.d.ts +25 -0
- package/lib/sync/authorize.js +73 -0
- package/lib/sync/broadcast-queue.js +183 -1
- package/lib/sync/broadcast-sender.js +179 -1
- package/lib/sync/catalog-scope.js +68 -1
- package/lib/sync/errors.d.ts +12 -0
- package/lib/sync/errors.js +19 -0
- package/lib/sync/forwarder.js +277 -1
- package/lib/sync/handlers.d.ts +3 -22
- package/lib/sync/handlers.js +160 -1
- package/lib/sync/hub-tunnel-sync-listener.d.ts +9 -3
- package/lib/sync/hub-tunnel-sync-listener.js +172 -1
- package/lib/sync/hub-tunnel-sync-provider.d.ts +14 -14
- package/lib/sync/hub-tunnel-sync-provider.js +64 -1
- package/lib/sync/merkle-apply.d.ts +5 -0
- package/lib/sync/merkle-apply.js +194 -1
- package/lib/sync/merkle-channel.d.ts +19 -0
- package/lib/sync/merkle-channel.js +182 -1
- package/lib/sync/merkle-tree.js +120 -1
- package/lib/sync/peer-registry.d.ts +8 -1
- package/lib/sync/peer-registry.js +107 -1
- package/lib/sync/receive-access-gate.js +24 -1
- package/lib/sync/scope-resolver.js +41 -1
- package/lib/sync/sync-client.d.ts +5 -3
- package/lib/sync/sync-client.js +192 -1
- package/lib/sync/sync-manager.d.ts +2 -2
- package/lib/sync/sync-manager.js +272 -1
- package/lib/types.d.ts +41 -0
- package/lib/types.js +2 -1
- package/lib/util/mutex.js +10 -1
- package/lib/utils.d.ts +5 -0
- package/lib/utils.js +21 -0
- package/package.json +48 -41
- package/lib/groups/broadcast-service.d.ts +0 -189
- package/lib/groups/broadcast-service.js +0 -1
- package/lib/groups/wire-frame.d.ts +0 -32
- package/lib/groups/wire-frame.js +0 -1
- package/lib/hub/connection-pool.d.ts +0 -43
- package/lib/hub/connection-pool.js +0 -1
- package/lib/hub/forward-remote-broadcast.d.ts +0 -15
- package/lib/hub/forward-remote-broadcast.js +0 -1
- package/lib/hub/group-channel.d.ts +0 -67
- package/lib/hub/group-channel.js +0 -1
- package/lib/hub/hub-connection.d.ts +0 -96
- package/lib/hub/hub-connection.js +0 -1
- package/lib/hub/receive-handler.d.ts +0 -33
- package/lib/hub/receive-handler.js +0 -1
- package/lib/hub/relay-manager.d.ts +0 -127
- package/lib/hub/relay-manager.js +0 -1
- package/lib/hub/send-handler.d.ts +0 -40
- package/lib/hub/send-handler.js +0 -1
- package/lib/hub/tunnel-inbox.d.ts +0 -20
- package/lib/hub/tunnel-inbox.js +0 -1
- package/lib/hub/wait-for-gate.d.ts +0 -14
- package/lib/hub/wait-for-gate.js +0 -1
package/lib/protocol.js
CHANGED
|
@@ -1 +1,251 @@
|
|
|
1
|
-
export const syncProtocol=
|
|
1
|
+
export const syncProtocol = {
|
|
2
|
+
'sync/negotiate': {
|
|
3
|
+
type: 'request',
|
|
4
|
+
param: {
|
|
5
|
+
type: 'object',
|
|
6
|
+
properties: {
|
|
7
|
+
scopes: {
|
|
8
|
+
type: 'array',
|
|
9
|
+
items: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
modelID: {
|
|
13
|
+
type: 'string'
|
|
14
|
+
},
|
|
15
|
+
ownerDID: {
|
|
16
|
+
type: 'string'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
required: [
|
|
20
|
+
'modelID',
|
|
21
|
+
'ownerDID'
|
|
22
|
+
],
|
|
23
|
+
additionalProperties: false
|
|
24
|
+
},
|
|
25
|
+
description: 'Requested sync scopes as (model, owner) pairs'
|
|
26
|
+
},
|
|
27
|
+
delegationTokens: {
|
|
28
|
+
type: 'array',
|
|
29
|
+
items: {
|
|
30
|
+
type: 'string'
|
|
31
|
+
},
|
|
32
|
+
description: 'JWT delegation tokens for authorization'
|
|
33
|
+
},
|
|
34
|
+
catalogIDs: {
|
|
35
|
+
type: 'array',
|
|
36
|
+
items: {
|
|
37
|
+
type: 'string'
|
|
38
|
+
},
|
|
39
|
+
description: 'Catalog IDs to resolve sync scope from criteria'
|
|
40
|
+
},
|
|
41
|
+
knownModelIDs: {
|
|
42
|
+
type: 'array',
|
|
43
|
+
items: {
|
|
44
|
+
type: 'string'
|
|
45
|
+
},
|
|
46
|
+
description: 'Model IDs the requester already has — used to identify missing clusters'
|
|
47
|
+
},
|
|
48
|
+
direction: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
enum: [
|
|
51
|
+
'push',
|
|
52
|
+
'pull',
|
|
53
|
+
'both'
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
required: [
|
|
58
|
+
'delegationTokens'
|
|
59
|
+
],
|
|
60
|
+
additionalProperties: false
|
|
61
|
+
},
|
|
62
|
+
result: {
|
|
63
|
+
type: 'object',
|
|
64
|
+
properties: {
|
|
65
|
+
direction: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
enum: [
|
|
68
|
+
'push',
|
|
69
|
+
'pull',
|
|
70
|
+
'both'
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
acceptedScopes: {
|
|
74
|
+
type: 'array',
|
|
75
|
+
items: {
|
|
76
|
+
type: 'object',
|
|
77
|
+
properties: {
|
|
78
|
+
modelID: {
|
|
79
|
+
type: 'string'
|
|
80
|
+
},
|
|
81
|
+
ownerDID: {
|
|
82
|
+
type: 'string'
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
required: [
|
|
86
|
+
'modelID',
|
|
87
|
+
'ownerDID'
|
|
88
|
+
],
|
|
89
|
+
additionalProperties: false
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
excludedDocumentIDs: {
|
|
93
|
+
type: 'array',
|
|
94
|
+
items: {
|
|
95
|
+
type: 'string'
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
missingClusters: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
description: 'Cluster definitions for models the requester does not have yet',
|
|
101
|
+
additionalProperties: true
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
required: [
|
|
105
|
+
'acceptedScopes',
|
|
106
|
+
'excludedDocumentIDs'
|
|
107
|
+
],
|
|
108
|
+
additionalProperties: false
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
'sync/merkle-sync': {
|
|
112
|
+
type: 'channel',
|
|
113
|
+
param: {
|
|
114
|
+
type: 'object',
|
|
115
|
+
properties: {
|
|
116
|
+
scopes: {
|
|
117
|
+
type: 'array',
|
|
118
|
+
items: {
|
|
119
|
+
type: 'object',
|
|
120
|
+
properties: {
|
|
121
|
+
modelID: {
|
|
122
|
+
type: 'string'
|
|
123
|
+
},
|
|
124
|
+
ownerDID: {
|
|
125
|
+
type: 'string'
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
required: [
|
|
129
|
+
'modelID',
|
|
130
|
+
'ownerDID'
|
|
131
|
+
],
|
|
132
|
+
additionalProperties: false
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
excludedDocumentIDs: {
|
|
136
|
+
type: 'array',
|
|
137
|
+
items: {
|
|
138
|
+
type: 'string'
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
tree: {
|
|
142
|
+
type: 'object',
|
|
143
|
+
description: 'Merkle tree bucket hashes from requester',
|
|
144
|
+
additionalProperties: {
|
|
145
|
+
type: 'string'
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
direction: {
|
|
149
|
+
type: 'string',
|
|
150
|
+
enum: [
|
|
151
|
+
'push',
|
|
152
|
+
'pull',
|
|
153
|
+
'both'
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
delegationTokens: {
|
|
157
|
+
type: 'array',
|
|
158
|
+
items: {
|
|
159
|
+
type: 'string'
|
|
160
|
+
},
|
|
161
|
+
description: 'Delegation JWTs authorizing the caller for non-owned scopes'
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
required: [
|
|
165
|
+
'scopes',
|
|
166
|
+
'excludedDocumentIDs',
|
|
167
|
+
'tree',
|
|
168
|
+
'direction'
|
|
169
|
+
],
|
|
170
|
+
additionalProperties: false
|
|
171
|
+
},
|
|
172
|
+
send: {
|
|
173
|
+
type: 'object',
|
|
174
|
+
properties: {
|
|
175
|
+
type: {
|
|
176
|
+
type: 'string',
|
|
177
|
+
enum: [
|
|
178
|
+
'mutations',
|
|
179
|
+
'complete'
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
mutationJWTs: {
|
|
183
|
+
type: 'array',
|
|
184
|
+
items: {
|
|
185
|
+
type: 'string'
|
|
186
|
+
},
|
|
187
|
+
description: 'Signed mutation JWTs for divergent time buckets'
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
required: [
|
|
191
|
+
'type'
|
|
192
|
+
],
|
|
193
|
+
additionalProperties: false
|
|
194
|
+
},
|
|
195
|
+
receive: {
|
|
196
|
+
type: 'object',
|
|
197
|
+
properties: {
|
|
198
|
+
type: {
|
|
199
|
+
type: 'string',
|
|
200
|
+
enum: [
|
|
201
|
+
'tree',
|
|
202
|
+
'mutations',
|
|
203
|
+
'complete'
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
tree: {
|
|
207
|
+
type: 'object',
|
|
208
|
+
description: 'Responder merkle tree bucket hashes',
|
|
209
|
+
additionalProperties: {
|
|
210
|
+
type: 'string'
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
mutationJWTs: {
|
|
214
|
+
type: 'array',
|
|
215
|
+
items: {
|
|
216
|
+
type: 'string'
|
|
217
|
+
},
|
|
218
|
+
description: 'Signed mutation JWTs for divergent time buckets'
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
required: [
|
|
222
|
+
'type'
|
|
223
|
+
],
|
|
224
|
+
additionalProperties: false
|
|
225
|
+
},
|
|
226
|
+
result: {
|
|
227
|
+
type: 'object',
|
|
228
|
+
properties: {
|
|
229
|
+
success: {
|
|
230
|
+
type: 'boolean'
|
|
231
|
+
},
|
|
232
|
+
divergentBuckets: {
|
|
233
|
+
type: 'number'
|
|
234
|
+
},
|
|
235
|
+
mutationsSent: {
|
|
236
|
+
type: 'number'
|
|
237
|
+
},
|
|
238
|
+
mutationsReceived: {
|
|
239
|
+
type: 'number'
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
required: [
|
|
243
|
+
'success',
|
|
244
|
+
'divergentBuckets',
|
|
245
|
+
'mutationsSent',
|
|
246
|
+
'mutationsReceived'
|
|
247
|
+
],
|
|
248
|
+
additionalProperties: false
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
};
|
package/lib/schema.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { SchemaExtension } from '@kubun/engine';
|
|
2
|
+
import { type Logger } from '@kubun/logger';
|
|
2
3
|
import { type P2PEventEmitter } from './groups/events.js';
|
|
3
|
-
export declare function createP2PSchemaExtension(emitter: P2PEventEmitter): SchemaExtension;
|
|
4
|
+
export declare function createP2PSchemaExtension(emitter: P2PEventEmitter, logger?: Logger): SchemaExtension;
|