@kubun/store-p2p 0.18.1 → 0.20.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/api.d.ts +5 -2
- package/lib/api.js +10 -6
- package/lib/definition.d.ts +6 -1
- package/lib/definition.js +37 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/migrations.js +90 -90
- package/lib/ops/app-lane.d.ts +1 -1
- package/lib/ops/app-lane.js +18 -12
- package/lib/ops/app-outbox.d.ts +4 -2
- package/lib/ops/app-outbox.js +33 -33
- package/lib/ops/catalog-offers.d.ts +1 -1
- package/lib/ops/catalog-offers.js +9 -10
- package/lib/ops/catalog-routes.js +9 -9
- package/lib/ops/catalog-sync.d.ts +2 -1
- package/lib/ops/catalog-sync.js +39 -42
- package/lib/ops/circles.js +33 -33
- package/lib/ops/control.d.ts +1 -1
- package/lib/ops/control.js +12 -10
- package/lib/ops/delegations.d.ts +2 -1
- package/lib/ops/delegations.js +17 -25
- package/lib/ops/discovery.d.ts +1 -1
- package/lib/ops/discovery.js +23 -10
- package/lib/ops/document-sweep.js +5 -5
- package/lib/ops/groups.d.ts +3 -2
- package/lib/ops/groups.js +60 -62
- package/lib/ops/hubs.js +38 -57
- package/lib/ops/log-handler-completion.js +3 -3
- package/lib/ops/mls.d.ts +1 -1
- package/lib/ops/mls.js +36 -26
- package/lib/ops/own-agents.d.ts +3 -3
- package/lib/ops/own-agents.js +128 -72
- package/lib/ops/sync.d.ts +1 -1
- package/lib/ops/sync.js +17 -8
- package/lib/scope.d.ts +8 -0
- package/lib/scope.js +8 -0
- package/lib/tables.d.ts +52 -42
- package/package.json +14 -13
package/lib/scope.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { withKeyLocks } from '@kubun/db';
|
|
2
|
+
export const runP2PScope = Symbol('runP2PScope');
|
|
3
|
+
export async function withP2PKeyLocks(context, table, keys, run) {
|
|
4
|
+
return await withKeyLocks(context.provider, table, keys, async (provider)=>{
|
|
5
|
+
const store = await provider.getStore('p2p');
|
|
6
|
+
return await store[runP2PScope](run);
|
|
7
|
+
});
|
|
8
|
+
}
|
package/lib/tables.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CreatedAtColumn, UpdatedAtColumn } from '@kubun/db-adapter';
|
|
2
2
|
import type { AnchorSlot, AppOutboxEntry, CommitCursor } from '@kumiai/rpc';
|
|
3
3
|
import type { ColumnType, Insertable, Selectable, Updateable } from 'kysely';
|
|
4
|
+
import type { CatalogCursorBounds } from './ops/catalog-sync.js';
|
|
4
5
|
type DefaultedStringColumn = ColumnType<string, string | undefined, string>;
|
|
5
6
|
type DefaultedNumberColumn = ColumnType<number, number | undefined, number>;
|
|
6
7
|
type NullableStringColumn = ColumnType<string | null, string | null | undefined, string | null>;
|
|
@@ -86,7 +87,7 @@ export type CatalogCursorTable = {
|
|
|
86
87
|
last_token: NullableStringColumn;
|
|
87
88
|
cycle_clear: DefaultedNumberColumn;
|
|
88
89
|
/** JSON object: bound-free rule key to its absolute `{ from, to }`. */
|
|
89
|
-
bounds: string
|
|
90
|
+
bounds: JSONValueColumn<Record<string, CatalogCursorBounds>>;
|
|
90
91
|
};
|
|
91
92
|
export type DocumentRepairTable = {
|
|
92
93
|
group_id: string;
|
|
@@ -157,7 +158,7 @@ export type GroupMLSStateTable = {
|
|
|
157
158
|
group_id: string;
|
|
158
159
|
device_id: string;
|
|
159
160
|
mls_state: Uint8Array;
|
|
160
|
-
credential:
|
|
161
|
+
credential: JSONValueColumn<unknown>;
|
|
161
162
|
epoch: number;
|
|
162
163
|
/** Orders secret-tree mutations within one MLS epoch. */
|
|
163
164
|
state_version: DefaultedNumberColumn;
|
|
@@ -171,12 +172,21 @@ export type GroupMLSStateTable = {
|
|
|
171
172
|
* held before: without them the fold reverts to the genesis anchor alone and
|
|
172
173
|
* every admin but the creator loses authority across a restart.
|
|
173
174
|
*/
|
|
174
|
-
ledger_entries:
|
|
175
|
+
ledger_entries: JSONArrayColumn<string>;
|
|
175
176
|
updated_at: UpdatedAtColumn;
|
|
176
177
|
};
|
|
177
|
-
export type GroupMLSState = Selectable<GroupMLSStateTable
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
export type GroupMLSState = Omit<Selectable<GroupMLSStateTable>, 'credential' | 'ledger_entries'> & {
|
|
179
|
+
credential: unknown;
|
|
180
|
+
ledger_entries: Array<string>;
|
|
181
|
+
};
|
|
182
|
+
export type InsertGroupMLSState = Omit<Insertable<GroupMLSStateTable>, 'credential' | 'ledger_entries'> & {
|
|
183
|
+
credential: string;
|
|
184
|
+
ledger_entries?: string;
|
|
185
|
+
};
|
|
186
|
+
export type UpdateGroupMLSState = Omit<Updateable<GroupMLSStateTable>, 'credential' | 'ledger_entries'> & {
|
|
187
|
+
credential?: string;
|
|
188
|
+
ledger_entries?: string;
|
|
189
|
+
};
|
|
180
190
|
export type SyncPeerTable = {
|
|
181
191
|
id: string;
|
|
182
192
|
peer_did: string;
|
|
@@ -390,44 +400,44 @@ export type BindingEvidenceTable = {
|
|
|
390
400
|
first_seen_at: CreatedAtColumn;
|
|
391
401
|
};
|
|
392
402
|
export type P2PStoreTables = {
|
|
393
|
-
|
|
403
|
+
p2p_access_default_revocations: {
|
|
394
404
|
controller_did: string;
|
|
395
405
|
device_did: string;
|
|
396
406
|
};
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
407
|
+
p2p_binding_evidence: BindingEvidenceTable;
|
|
408
|
+
p2p_own_agents_records: OwnAgentsRecordTable;
|
|
409
|
+
p2p_own_agents_grants: OwnAgentsGrantTable;
|
|
410
|
+
p2p_own_agents_join_capabilities: OwnAgentsJoinCapabilityTable;
|
|
411
|
+
p2p_groups: GroupTable;
|
|
412
|
+
p2p_group_members: GroupMemberTable;
|
|
413
|
+
p2p_catalog_offers: CatalogOfferTable;
|
|
414
|
+
p2p_catalog_routes: CatalogRouteTable;
|
|
415
|
+
p2p_unserved_groups: UnservedGroupTable;
|
|
416
|
+
p2p_catalog_cursors: CatalogCursorTable;
|
|
417
|
+
p2p_document_repairs: DocumentRepairTable;
|
|
418
|
+
p2p_document_repair_answers: DocumentRepairAnswerTable;
|
|
419
|
+
p2p_observation_repairs: ObservationRepairScheduleTable;
|
|
420
|
+
p2p_observation_repair_peers: ObservationRepairPeerTable;
|
|
421
|
+
p2p_group_leave_requests: GroupLeaveRequestTable;
|
|
422
|
+
p2p_circles: CircleTable;
|
|
423
|
+
p2p_circle_members: CircleMemberTable;
|
|
424
|
+
p2p_group_delegation: GroupDelegationTable;
|
|
425
|
+
p2p_group_mls_state: GroupMLSStateTable;
|
|
426
|
+
p2p_sync_peers: SyncPeerTable;
|
|
427
|
+
p2p_sync_checkpoints: SyncCheckpointTable;
|
|
428
|
+
p2p_broadcast_log: BroadcastLogTable;
|
|
429
|
+
p2p_log_handler_completion: LogHandlerCompletionTable;
|
|
430
|
+
p2p_control_requests: ControlRequestTable;
|
|
431
|
+
p2p_commit_journal: CommitJournalEntryTable;
|
|
432
|
+
p2p_group_anchor: GroupAnchorTable;
|
|
433
|
+
p2p_app_outbox: AppOutboxTable;
|
|
434
|
+
p2p_app_outbox_state: AppOutboxStateTable;
|
|
435
|
+
p2p_app_cursor: AppCursorTable;
|
|
436
|
+
p2p_app_pending: PendingAppFrameTable;
|
|
437
|
+
p2p_hubs: HubTable;
|
|
438
|
+
p2p_group_hubs: GroupHubTable;
|
|
439
|
+
p2p_peer_announcements: PeerAnnouncementTable;
|
|
440
|
+
p2p_local_peer_profile: LocalPeerProfileTable;
|
|
441
|
+
p2p_pending_join_requests: PendingJoinRequestTable;
|
|
432
442
|
};
|
|
433
443
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/store-p2p",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "see LICENSE.md",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,22 +15,23 @@
|
|
|
15
15
|
"LICENSE.md"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@kokuin/capability": "^0.
|
|
19
|
-
"@kokuin/controller": "^0.
|
|
20
|
-
"@kokuin/
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"@kubun/
|
|
24
|
-
"@kubun/
|
|
25
|
-
"@
|
|
18
|
+
"@kokuin/capability": "^0.7.0",
|
|
19
|
+
"@kokuin/controller": "^0.7.0",
|
|
20
|
+
"@kokuin/crypto": "^0.7.0",
|
|
21
|
+
"@kokuin/records": "^0.7.1",
|
|
22
|
+
"@kokuin/token": "^0.7.0",
|
|
23
|
+
"@kubun/db": "^0.20.0",
|
|
24
|
+
"@kubun/db-adapter": "^0.20.0",
|
|
25
|
+
"@kubun/logger": "^0.20.0",
|
|
26
|
+
"@kumiai/rpc": "^0.13.1",
|
|
26
27
|
"@noble/ciphers": "^2.4.0",
|
|
27
28
|
"@sozai/runtime": "^0.1.0",
|
|
28
|
-
"kysely": "^0.29.
|
|
29
|
+
"kysely": "^0.29.8"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
32
|
+
"@hozon/node-sqlite": "^0.3.0",
|
|
33
|
+
"@hozon/postgres": "^0.2.1",
|
|
34
|
+
"@sozai/hlc": "^0.1.0",
|
|
34
35
|
"@testcontainers/postgresql": "^12.2.1"
|
|
35
36
|
},
|
|
36
37
|
"publishConfig": {
|