@automerge/subduction 0.9.0 → 0.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/dist/cjs/wasm-base64.cjs +1 -1
- package/dist/cjs/web-bindings.cjs +232 -85
- package/dist/cjs/web.cjs +233 -86
- package/dist/esm/wasm-base64.js +1 -1
- package/dist/iife/index.js +232 -86
- package/dist/index.d.ts +83 -11
- package/dist/subduction.wasm +0 -0
- package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +83 -11
- package/dist/wasm_bindgen/bundler/subduction_wasm.js +1 -1
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +212 -83
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +17 -13
- package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +217 -85
- package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +83 -11
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +17 -13
- package/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
- package/dist/wasm_bindgen/web/subduction_wasm.d.ts +100 -24
- package/dist/wasm_bindgen/web/subduction_wasm.js +216 -85
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
- package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +17 -13
- package/package.json +3 -2
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline0.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline1.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline2.js +0 -0
- /package/dist/wasm_bindgen/bundler/snippets/{subduction_wasm-0ed7fd66cebca59f/inline0.js → subduction_wasm-ec51bcf335db35bd/inline1.js} +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline0.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline1.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline2.js +0 -0
- /package/dist/wasm_bindgen/nodejs/snippets/{subduction_wasm-0ed7fd66cebca59f/inline0.js → subduction_wasm-ec51bcf335db35bd/inline1.js} +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline0.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline1.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline2.js +0 -0
- /package/dist/wasm_bindgen/web/snippets/{subduction_wasm-0ed7fd66cebca59f/inline0.js → subduction_wasm-ec51bcf335db35bd/inline1.js} +0 -0
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Connection and storage authorization policy.
|
|
6
|
+
*
|
|
7
|
+
* Throwing (or returning a rejected promise) denies the operation.
|
|
8
|
+
* Resolving allows it.
|
|
9
|
+
*/
|
|
10
|
+
export interface Policy {
|
|
11
|
+
authorizeConnect(peerId: PeerId): Promise<void>;
|
|
12
|
+
authorizeFetch(peerId: PeerId, sedimentreeId: SedimentreeId): Promise<void>;
|
|
13
|
+
authorizePut(requestor: PeerId, author: PeerId, sedimentreeId: SedimentreeId): Promise<void>;
|
|
14
|
+
filterAuthorizedFetch(peerId: PeerId, ids: SedimentreeId[]): Promise<SedimentreeId[]>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Ephemeral message authorization policy.
|
|
21
|
+
*
|
|
22
|
+
* Throwing (or returning a rejected promise) denies the operation.
|
|
23
|
+
* Resolving allows it.
|
|
24
|
+
*/
|
|
25
|
+
export interface EphemeralPolicy {
|
|
26
|
+
authorizeSubscribe(peerId: PeerId, topic: Topic): Promise<void>;
|
|
27
|
+
authorizePublish(peerId: PeerId, topic: Topic): Promise<void>;
|
|
28
|
+
filterAuthorizedSubscribers(topic: Topic, peers: PeerId[]): Promise<PeerId[]>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
4
33
|
export interface SedimentreeStorage {
|
|
5
34
|
saveSedimentreeId(sedimentreeId: SedimentreeId): Promise<void>;
|
|
6
35
|
deleteSedimentreeId(sedimentreeId: SedimentreeId): Promise<void>;
|
|
@@ -21,6 +50,9 @@ export interface SedimentreeStorage {
|
|
|
21
50
|
loadAllFragments(sedimentreeId: SedimentreeId): Promise<FragmentWithBlob[]>;
|
|
22
51
|
deleteFragment(sedimentreeId: SedimentreeId, digest: Digest): Promise<void>;
|
|
23
52
|
deleteAllFragments(sedimentreeId: SedimentreeId): Promise<void>;
|
|
53
|
+
|
|
54
|
+
// Batch save: write all commits + fragments in a single storage transaction.
|
|
55
|
+
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{digest: Digest, signedCommit: SignedLooseCommit, blob: Uint8Array}>, fragments: Array<{digest: Digest, signedFragment: SignedFragment, blob: Uint8Array}>): Promise<number>;
|
|
24
56
|
}
|
|
25
57
|
|
|
26
58
|
|
|
@@ -1141,6 +1173,10 @@ export class Subduction {
|
|
|
1141
1173
|
* When set, clients can connect without knowing the server's peer ID.
|
|
1142
1174
|
* * `hash_metric_override` - Optional custom depth metric function
|
|
1143
1175
|
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
1176
|
+
* * `policy` - Optional connection/storage authorization policy.
|
|
1177
|
+
* Defaults to allow-all.
|
|
1178
|
+
* * `ephemeral_policy` - Optional ephemeral message authorization policy.
|
|
1179
|
+
* Defaults to allow-all.
|
|
1144
1180
|
*
|
|
1145
1181
|
* # Panics
|
|
1146
1182
|
*
|
|
@@ -1151,7 +1187,7 @@ export class Subduction {
|
|
|
1151
1187
|
*
|
|
1152
1188
|
* Returns [`WasmHydrationError`] if hydration fails.
|
|
1153
1189
|
*/
|
|
1154
|
-
static hydrate(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?:
|
|
1190
|
+
static hydrate(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?: Policy | null, ephemeral_policy?: EphemeralPolicy | null, on_remote_heads?: Function | null, on_ephemeral?: Function | null): Promise<Subduction>;
|
|
1155
1191
|
/**
|
|
1156
1192
|
* Link two local [`Subduction`](WasmSubduction) instances over a
|
|
1157
1193
|
* [`MessageChannel`](web_sys::MessageChannel).
|
|
@@ -1176,23 +1212,28 @@ export class Subduction {
|
|
|
1176
1212
|
* When set, clients can connect without knowing the server's peer ID.
|
|
1177
1213
|
* * `hash_metric_override` - Optional custom depth metric function
|
|
1178
1214
|
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
1179
|
-
* * `policy` - Optional
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1215
|
+
* * `policy` - Optional connection/storage authorization policy.
|
|
1216
|
+
* Defaults to allow-all.
|
|
1217
|
+
* * `ephemeral_policy` - Optional ephemeral message authorization policy.
|
|
1218
|
+
* Defaults to allow-all.
|
|
1182
1219
|
*
|
|
1183
1220
|
* # Panics
|
|
1184
1221
|
*
|
|
1185
1222
|
* Panics if `hash_metric_override` is `Some` but the underlying JS value
|
|
1186
1223
|
* cannot be cast to a `Function`.
|
|
1187
1224
|
*/
|
|
1188
|
-
constructor(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?:
|
|
1225
|
+
constructor(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?: Policy | null, ephemeral_policy?: EphemeralPolicy | null, on_remote_heads?: Function | null, on_ephemeral?: Function | null);
|
|
1189
1226
|
/**
|
|
1190
|
-
* Publish an ephemeral message to all subscribers of a
|
|
1227
|
+
* Publish an ephemeral message to all subscribers of a topic.
|
|
1191
1228
|
*
|
|
1192
1229
|
* The payload is opaque bytes — encoding is the caller's responsibility.
|
|
1193
1230
|
* Messages are fire-and-forget; delivery is best-effort.
|
|
1231
|
+
*
|
|
1232
|
+
* # Panics
|
|
1233
|
+
*
|
|
1234
|
+
* Panics if the platform's random number generator fails.
|
|
1194
1235
|
*/
|
|
1195
|
-
publishEphemeral(
|
|
1236
|
+
publishEphemeral(topic: Topic, payload: Uint8Array): Promise<void>;
|
|
1196
1237
|
/**
|
|
1197
1238
|
* Remove a Sedimentree and all associated data.
|
|
1198
1239
|
*
|
|
@@ -1210,10 +1251,10 @@ export class Subduction {
|
|
|
1210
1251
|
*/
|
|
1211
1252
|
sedimentreeIds(): Promise<SedimentreeId[]>;
|
|
1212
1253
|
/**
|
|
1213
|
-
* Subscribe to ephemeral messages for the given
|
|
1254
|
+
* Subscribe to ephemeral messages for the given topics
|
|
1214
1255
|
* from all connected peers.
|
|
1215
1256
|
*/
|
|
1216
|
-
subscribeEphemeral(
|
|
1257
|
+
subscribeEphemeral(topics: Topic[]): Promise<void>;
|
|
1217
1258
|
/**
|
|
1218
1259
|
* Request batch sync for a given Sedimentree ID from all connected peers.
|
|
1219
1260
|
*
|
|
@@ -1244,10 +1285,10 @@ export class Subduction {
|
|
|
1244
1285
|
*/
|
|
1245
1286
|
syncWithPeer(to_ask: PeerId, id: SedimentreeId, subscribe: boolean, timeout_milliseconds?: bigint | null): Promise<PeerBatchSyncResult>;
|
|
1246
1287
|
/**
|
|
1247
|
-
* Unsubscribe from ephemeral messages for the given
|
|
1288
|
+
* Unsubscribe from ephemeral messages for the given topics
|
|
1248
1289
|
* from all connected peers.
|
|
1249
1290
|
*/
|
|
1250
|
-
unsubscribeEphemeral(
|
|
1291
|
+
unsubscribeEphemeral(topics: Topic[]): Promise<void>;
|
|
1251
1292
|
/**
|
|
1252
1293
|
* Get the backing storage.
|
|
1253
1294
|
*/
|
|
@@ -1568,6 +1609,37 @@ export class SyncStats {
|
|
|
1568
1609
|
readonly totalSent: number;
|
|
1569
1610
|
}
|
|
1570
1611
|
|
|
1612
|
+
/**
|
|
1613
|
+
* A Wasm wrapper around the ephemeral [`Topic`] type.
|
|
1614
|
+
*
|
|
1615
|
+
* Topics are opaque 32-byte identifiers for ephemeral pubsub channels.
|
|
1616
|
+
* A [`SedimentreeId`] can be used as a topic, but topics are not
|
|
1617
|
+
* limited to sedimentrees.
|
|
1618
|
+
*
|
|
1619
|
+
* [`SedimentreeId`]: sedimentree_core::id::SedimentreeId
|
|
1620
|
+
*/
|
|
1621
|
+
export class Topic {
|
|
1622
|
+
private constructor();
|
|
1623
|
+
free(): void;
|
|
1624
|
+
[Symbol.dispose](): void;
|
|
1625
|
+
/**
|
|
1626
|
+
* Create a topic from a 32-byte array.
|
|
1627
|
+
*
|
|
1628
|
+
* # Errors
|
|
1629
|
+
*
|
|
1630
|
+
* Returns an error if the provided byte array is not exactly 32 bytes.
|
|
1631
|
+
*/
|
|
1632
|
+
static fromBytes(bytes: Uint8Array): Topic;
|
|
1633
|
+
/**
|
|
1634
|
+
* Returns the raw 32 bytes of this topic.
|
|
1635
|
+
*/
|
|
1636
|
+
toBytes(): Uint8Array;
|
|
1637
|
+
/**
|
|
1638
|
+
* Returns a shortened hex prefix representation (first 4 bytes + `…`).
|
|
1639
|
+
*/
|
|
1640
|
+
toString(): string;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1571
1643
|
/**
|
|
1572
1644
|
* An Ed25519 signer using the browser's `WebCrypto` API.
|
|
1573
1645
|
*
|
|
Binary file
|
|
@@ -21,8 +21,8 @@ export const webcryptosigner_sign: (a: number, b: number, c: number) => any;
|
|
|
21
21
|
export const webcryptosigner_verifyingKey: (a: number) => any;
|
|
22
22
|
export const webcryptosigner_peerId: (a: number) => number;
|
|
23
23
|
export const __wbg_subduction_free: (a: number, b: number) => void;
|
|
24
|
-
export const subduction_new: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
25
|
-
export const subduction_hydrate: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
|
|
24
|
+
export const subduction_new: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
|
|
25
|
+
export const subduction_hydrate: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => any;
|
|
26
26
|
export const subduction_addSedimentree: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
27
27
|
export const subduction_removeSedimentree: (a: number, b: number) => any;
|
|
28
28
|
export const subduction_connect: (a: number, b: any, c: number) => any;
|
|
@@ -72,6 +72,8 @@ export const syncstats_totalReceived: (a: number) => number;
|
|
|
72
72
|
export const syncstats_totalSent: (a: number) => number;
|
|
73
73
|
export const syncstats_isEmpty: (a: number) => number;
|
|
74
74
|
export const syncstats_remoteHeads: (a: number) => [number, number];
|
|
75
|
+
export const topic_fromBytes: (a: number, b: number) => [number, number, number];
|
|
76
|
+
export const topic_toString: (a: number) => [number, number];
|
|
75
77
|
export const __wbg_authenticatedtransport_free: (a: number, b: number) => void;
|
|
76
78
|
export const authenticatedtransport_setup: (a: any, b: any, c: number, d: number) => any;
|
|
77
79
|
export const authenticatedtransport_setupDiscover: (a: any, b: any, c: number, d: number, e: number) => any;
|
|
@@ -142,7 +144,9 @@ export const batchsyncresponse_request_id: (a: number) => number;
|
|
|
142
144
|
export const batchsyncresponse___wasm_refgen_toWasmBatchSyncResponse: (a: number) => number;
|
|
143
145
|
export const memorysigner_new: () => number;
|
|
144
146
|
export const messageporttransport_new: (a: any) => number;
|
|
147
|
+
export const __wbg_topic_free: (a: number, b: number) => void;
|
|
145
148
|
export const __wbg_webcryptosigner_free: (a: number, b: number) => void;
|
|
149
|
+
export const topic_toBytes: (a: number) => [number, number];
|
|
146
150
|
export const __wbg_depth_free: (a: number, b: number) => void;
|
|
147
151
|
export const depth_new: (a: any) => [number, number, number];
|
|
148
152
|
export const depth_value: (a: number) => number;
|
|
@@ -217,20 +221,20 @@ export const memorystorage_deleteAllFragments: (a: number, b: number) => any;
|
|
|
217
221
|
export const depth___wasm_refgen_toWasmDepth: (a: number) => number;
|
|
218
222
|
export const fragmentwithblob_new: (a: number, b: any) => number;
|
|
219
223
|
export const __wbg_sedimentreeid_free: (a: number, b: number) => void;
|
|
220
|
-
export const __wbg_fragmentwithblob_free: (a: number, b: number) => void;
|
|
221
224
|
export const __wbg_signedloosecommit_free: (a: number, b: number) => void;
|
|
222
|
-
export const
|
|
225
|
+
export const __wbg_fragmentwithblob_free: (a: number, b: number) => void;
|
|
223
226
|
export const sedimentreeid_toBytes: (a: number) => [number, number];
|
|
227
|
+
export const sedimentreeid___wasm_refgen_toWasmSedimentreeId: (a: number) => number;
|
|
224
228
|
export const fragmentwithblob_blob: (a: number) => any;
|
|
225
|
-
export const
|
|
226
|
-
export const
|
|
227
|
-
export const
|
|
228
|
-
export const
|
|
229
|
-
export const
|
|
230
|
-
export const
|
|
231
|
-
export const
|
|
232
|
-
export const
|
|
233
|
-
export const
|
|
229
|
+
export const __wasm_bindgen_func_elem_285: (a: number, b: number) => void;
|
|
230
|
+
export const __wasm_bindgen_func_elem_1651: (a: number, b: number, c: any) => [number, number];
|
|
231
|
+
export const __wasm_bindgen_func_elem_1651_194: (a: number, b: number, c: any, d: any) => void;
|
|
232
|
+
export const __wasm_bindgen_func_elem_1651_195: (a: number, b: number, c: any, d: any) => void;
|
|
233
|
+
export const __wasm_bindgen_func_elem_638: (a: number, b: number, c: any) => void;
|
|
234
|
+
export const __wasm_bindgen_func_elem_638_1: (a: number, b: number, c: any) => void;
|
|
235
|
+
export const __wasm_bindgen_func_elem_638_2: (a: number, b: number, c: any) => void;
|
|
236
|
+
export const __wasm_bindgen_func_elem_638_3: (a: number, b: number, c: any) => void;
|
|
237
|
+
export const __wasm_bindgen_func_elem_637: (a: number, b: number) => void;
|
|
234
238
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
235
239
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
236
240
|
export const __wbindgen_export3: (a: number) => void;
|
|
@@ -1,6 +1,35 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Connection and storage authorization policy.
|
|
6
|
+
*
|
|
7
|
+
* Throwing (or returning a rejected promise) denies the operation.
|
|
8
|
+
* Resolving allows it.
|
|
9
|
+
*/
|
|
10
|
+
export interface Policy {
|
|
11
|
+
authorizeConnect(peerId: PeerId): Promise<void>;
|
|
12
|
+
authorizeFetch(peerId: PeerId, sedimentreeId: SedimentreeId): Promise<void>;
|
|
13
|
+
authorizePut(requestor: PeerId, author: PeerId, sedimentreeId: SedimentreeId): Promise<void>;
|
|
14
|
+
filterAuthorizedFetch(peerId: PeerId, ids: SedimentreeId[]): Promise<SedimentreeId[]>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Ephemeral message authorization policy.
|
|
21
|
+
*
|
|
22
|
+
* Throwing (or returning a rejected promise) denies the operation.
|
|
23
|
+
* Resolving allows it.
|
|
24
|
+
*/
|
|
25
|
+
export interface EphemeralPolicy {
|
|
26
|
+
authorizeSubscribe(peerId: PeerId, topic: Topic): Promise<void>;
|
|
27
|
+
authorizePublish(peerId: PeerId, topic: Topic): Promise<void>;
|
|
28
|
+
filterAuthorizedSubscribers(topic: Topic, peers: PeerId[]): Promise<PeerId[]>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
4
33
|
export interface SedimentreeStorage {
|
|
5
34
|
saveSedimentreeId(sedimentreeId: SedimentreeId): Promise<void>;
|
|
6
35
|
deleteSedimentreeId(sedimentreeId: SedimentreeId): Promise<void>;
|
|
@@ -21,6 +50,9 @@ export interface SedimentreeStorage {
|
|
|
21
50
|
loadAllFragments(sedimentreeId: SedimentreeId): Promise<FragmentWithBlob[]>;
|
|
22
51
|
deleteFragment(sedimentreeId: SedimentreeId, digest: Digest): Promise<void>;
|
|
23
52
|
deleteAllFragments(sedimentreeId: SedimentreeId): Promise<void>;
|
|
53
|
+
|
|
54
|
+
// Batch save: write all commits + fragments in a single storage transaction.
|
|
55
|
+
saveBatchAll(sedimentreeId: SedimentreeId, commits: Array<{digest: Digest, signedCommit: SignedLooseCommit, blob: Uint8Array}>, fragments: Array<{digest: Digest, signedFragment: SignedFragment, blob: Uint8Array}>): Promise<number>;
|
|
24
56
|
}
|
|
25
57
|
|
|
26
58
|
|
|
@@ -1141,6 +1173,10 @@ export class Subduction {
|
|
|
1141
1173
|
* When set, clients can connect without knowing the server's peer ID.
|
|
1142
1174
|
* * `hash_metric_override` - Optional custom depth metric function
|
|
1143
1175
|
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
1176
|
+
* * `policy` - Optional connection/storage authorization policy.
|
|
1177
|
+
* Defaults to allow-all.
|
|
1178
|
+
* * `ephemeral_policy` - Optional ephemeral message authorization policy.
|
|
1179
|
+
* Defaults to allow-all.
|
|
1144
1180
|
*
|
|
1145
1181
|
* # Panics
|
|
1146
1182
|
*
|
|
@@ -1151,7 +1187,7 @@ export class Subduction {
|
|
|
1151
1187
|
*
|
|
1152
1188
|
* Returns [`WasmHydrationError`] if hydration fails.
|
|
1153
1189
|
*/
|
|
1154
|
-
static hydrate(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?:
|
|
1190
|
+
static hydrate(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?: Policy | null, ephemeral_policy?: EphemeralPolicy | null, on_remote_heads?: Function | null, on_ephemeral?: Function | null): Promise<Subduction>;
|
|
1155
1191
|
/**
|
|
1156
1192
|
* Link two local [`Subduction`](WasmSubduction) instances over a
|
|
1157
1193
|
* [`MessageChannel`](web_sys::MessageChannel).
|
|
@@ -1176,23 +1212,28 @@ export class Subduction {
|
|
|
1176
1212
|
* When set, clients can connect without knowing the server's peer ID.
|
|
1177
1213
|
* * `hash_metric_override` - Optional custom depth metric function
|
|
1178
1214
|
* * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
|
|
1179
|
-
* * `policy` - Optional
|
|
1180
|
-
*
|
|
1181
|
-
*
|
|
1215
|
+
* * `policy` - Optional connection/storage authorization policy.
|
|
1216
|
+
* Defaults to allow-all.
|
|
1217
|
+
* * `ephemeral_policy` - Optional ephemeral message authorization policy.
|
|
1218
|
+
* Defaults to allow-all.
|
|
1182
1219
|
*
|
|
1183
1220
|
* # Panics
|
|
1184
1221
|
*
|
|
1185
1222
|
* Panics if `hash_metric_override` is `Some` but the underlying JS value
|
|
1186
1223
|
* cannot be cast to a `Function`.
|
|
1187
1224
|
*/
|
|
1188
|
-
constructor(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?:
|
|
1225
|
+
constructor(signer: any, storage: SedimentreeStorage, service_name?: string | null, hash_metric_override?: (digest: Digest) => Depth | null, max_pending_blob_requests?: number | null, policy?: Policy | null, ephemeral_policy?: EphemeralPolicy | null, on_remote_heads?: Function | null, on_ephemeral?: Function | null);
|
|
1189
1226
|
/**
|
|
1190
|
-
* Publish an ephemeral message to all subscribers of a
|
|
1227
|
+
* Publish an ephemeral message to all subscribers of a topic.
|
|
1191
1228
|
*
|
|
1192
1229
|
* The payload is opaque bytes — encoding is the caller's responsibility.
|
|
1193
1230
|
* Messages are fire-and-forget; delivery is best-effort.
|
|
1231
|
+
*
|
|
1232
|
+
* # Panics
|
|
1233
|
+
*
|
|
1234
|
+
* Panics if the platform's random number generator fails.
|
|
1194
1235
|
*/
|
|
1195
|
-
publishEphemeral(
|
|
1236
|
+
publishEphemeral(topic: Topic, payload: Uint8Array): Promise<void>;
|
|
1196
1237
|
/**
|
|
1197
1238
|
* Remove a Sedimentree and all associated data.
|
|
1198
1239
|
*
|
|
@@ -1210,10 +1251,10 @@ export class Subduction {
|
|
|
1210
1251
|
*/
|
|
1211
1252
|
sedimentreeIds(): Promise<SedimentreeId[]>;
|
|
1212
1253
|
/**
|
|
1213
|
-
* Subscribe to ephemeral messages for the given
|
|
1254
|
+
* Subscribe to ephemeral messages for the given topics
|
|
1214
1255
|
* from all connected peers.
|
|
1215
1256
|
*/
|
|
1216
|
-
subscribeEphemeral(
|
|
1257
|
+
subscribeEphemeral(topics: Topic[]): Promise<void>;
|
|
1217
1258
|
/**
|
|
1218
1259
|
* Request batch sync for a given Sedimentree ID from all connected peers.
|
|
1219
1260
|
*
|
|
@@ -1244,10 +1285,10 @@ export class Subduction {
|
|
|
1244
1285
|
*/
|
|
1245
1286
|
syncWithPeer(to_ask: PeerId, id: SedimentreeId, subscribe: boolean, timeout_milliseconds?: bigint | null): Promise<PeerBatchSyncResult>;
|
|
1246
1287
|
/**
|
|
1247
|
-
* Unsubscribe from ephemeral messages for the given
|
|
1288
|
+
* Unsubscribe from ephemeral messages for the given topics
|
|
1248
1289
|
* from all connected peers.
|
|
1249
1290
|
*/
|
|
1250
|
-
unsubscribeEphemeral(
|
|
1291
|
+
unsubscribeEphemeral(topics: Topic[]): Promise<void>;
|
|
1251
1292
|
/**
|
|
1252
1293
|
* Get the backing storage.
|
|
1253
1294
|
*/
|
|
@@ -1568,6 +1609,37 @@ export class SyncStats {
|
|
|
1568
1609
|
readonly totalSent: number;
|
|
1569
1610
|
}
|
|
1570
1611
|
|
|
1612
|
+
/**
|
|
1613
|
+
* A Wasm wrapper around the ephemeral [`Topic`] type.
|
|
1614
|
+
*
|
|
1615
|
+
* Topics are opaque 32-byte identifiers for ephemeral pubsub channels.
|
|
1616
|
+
* A [`SedimentreeId`] can be used as a topic, but topics are not
|
|
1617
|
+
* limited to sedimentrees.
|
|
1618
|
+
*
|
|
1619
|
+
* [`SedimentreeId`]: sedimentree_core::id::SedimentreeId
|
|
1620
|
+
*/
|
|
1621
|
+
export class Topic {
|
|
1622
|
+
private constructor();
|
|
1623
|
+
free(): void;
|
|
1624
|
+
[Symbol.dispose](): void;
|
|
1625
|
+
/**
|
|
1626
|
+
* Create a topic from a 32-byte array.
|
|
1627
|
+
*
|
|
1628
|
+
* # Errors
|
|
1629
|
+
*
|
|
1630
|
+
* Returns an error if the provided byte array is not exactly 32 bytes.
|
|
1631
|
+
*/
|
|
1632
|
+
static fromBytes(bytes: Uint8Array): Topic;
|
|
1633
|
+
/**
|
|
1634
|
+
* Returns the raw 32 bytes of this topic.
|
|
1635
|
+
*/
|
|
1636
|
+
toBytes(): Uint8Array;
|
|
1637
|
+
/**
|
|
1638
|
+
* Returns a shortened hex prefix representation (first 4 bytes + `…`).
|
|
1639
|
+
*/
|
|
1640
|
+
toString(): string;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1571
1643
|
/**
|
|
1572
1644
|
* An Ed25519 signer using the browser's `WebCrypto` API.
|
|
1573
1645
|
*
|
|
@@ -1657,8 +1729,8 @@ export interface InitOutput {
|
|
|
1657
1729
|
readonly webcryptosigner_verifyingKey: (a: number) => any;
|
|
1658
1730
|
readonly webcryptosigner_peerId: (a: number) => number;
|
|
1659
1731
|
readonly __wbg_subduction_free: (a: number, b: number) => void;
|
|
1660
|
-
readonly subduction_new: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => number;
|
|
1661
|
-
readonly subduction_hydrate: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => any;
|
|
1732
|
+
readonly subduction_new: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => number;
|
|
1733
|
+
readonly subduction_hydrate: (a: any, b: any, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => any;
|
|
1662
1734
|
readonly subduction_addSedimentree: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
1663
1735
|
readonly subduction_removeSedimentree: (a: number, b: number) => any;
|
|
1664
1736
|
readonly subduction_connect: (a: number, b: any, c: number) => any;
|
|
@@ -1708,6 +1780,8 @@ export interface InitOutput {
|
|
|
1708
1780
|
readonly syncstats_totalSent: (a: number) => number;
|
|
1709
1781
|
readonly syncstats_isEmpty: (a: number) => number;
|
|
1710
1782
|
readonly syncstats_remoteHeads: (a: number) => [number, number];
|
|
1783
|
+
readonly topic_fromBytes: (a: number, b: number) => [number, number, number];
|
|
1784
|
+
readonly topic_toString: (a: number) => [number, number];
|
|
1711
1785
|
readonly __wbg_authenticatedtransport_free: (a: number, b: number) => void;
|
|
1712
1786
|
readonly authenticatedtransport_setup: (a: any, b: any, c: number, d: number) => any;
|
|
1713
1787
|
readonly authenticatedtransport_setupDiscover: (a: any, b: any, c: number, d: number, e: number) => any;
|
|
@@ -1778,7 +1852,9 @@ export interface InitOutput {
|
|
|
1778
1852
|
readonly batchsyncresponse___wasm_refgen_toWasmBatchSyncResponse: (a: number) => number;
|
|
1779
1853
|
readonly memorysigner_new: () => number;
|
|
1780
1854
|
readonly messageporttransport_new: (a: any) => number;
|
|
1855
|
+
readonly __wbg_topic_free: (a: number, b: number) => void;
|
|
1781
1856
|
readonly __wbg_webcryptosigner_free: (a: number, b: number) => void;
|
|
1857
|
+
readonly topic_toBytes: (a: number) => [number, number];
|
|
1782
1858
|
readonly __wbg_depth_free: (a: number, b: number) => void;
|
|
1783
1859
|
readonly depth_new: (a: any) => [number, number, number];
|
|
1784
1860
|
readonly depth_value: (a: number) => number;
|
|
@@ -1853,20 +1929,20 @@ export interface InitOutput {
|
|
|
1853
1929
|
readonly depth___wasm_refgen_toWasmDepth: (a: number) => number;
|
|
1854
1930
|
readonly fragmentwithblob_new: (a: number, b: any) => number;
|
|
1855
1931
|
readonly __wbg_sedimentreeid_free: (a: number, b: number) => void;
|
|
1856
|
-
readonly __wbg_fragmentwithblob_free: (a: number, b: number) => void;
|
|
1857
1932
|
readonly __wbg_signedloosecommit_free: (a: number, b: number) => void;
|
|
1858
|
-
readonly
|
|
1933
|
+
readonly __wbg_fragmentwithblob_free: (a: number, b: number) => void;
|
|
1859
1934
|
readonly sedimentreeid_toBytes: (a: number) => [number, number];
|
|
1935
|
+
readonly sedimentreeid___wasm_refgen_toWasmSedimentreeId: (a: number) => number;
|
|
1860
1936
|
readonly fragmentwithblob_blob: (a: number) => any;
|
|
1861
|
-
readonly
|
|
1862
|
-
readonly
|
|
1863
|
-
readonly
|
|
1864
|
-
readonly
|
|
1865
|
-
readonly
|
|
1866
|
-
readonly
|
|
1867
|
-
readonly
|
|
1868
|
-
readonly
|
|
1869
|
-
readonly
|
|
1937
|
+
readonly __wasm_bindgen_func_elem_285: (a: number, b: number) => void;
|
|
1938
|
+
readonly __wasm_bindgen_func_elem_1651: (a: number, b: number, c: any) => [number, number];
|
|
1939
|
+
readonly __wasm_bindgen_func_elem_1651_194: (a: number, b: number, c: any, d: any) => void;
|
|
1940
|
+
readonly __wasm_bindgen_func_elem_1651_195: (a: number, b: number, c: any, d: any) => void;
|
|
1941
|
+
readonly __wasm_bindgen_func_elem_638: (a: number, b: number, c: any) => void;
|
|
1942
|
+
readonly __wasm_bindgen_func_elem_638_1: (a: number, b: number, c: any) => void;
|
|
1943
|
+
readonly __wasm_bindgen_func_elem_638_2: (a: number, b: number, c: any) => void;
|
|
1944
|
+
readonly __wasm_bindgen_func_elem_638_3: (a: number, b: number, c: any) => void;
|
|
1945
|
+
readonly __wasm_bindgen_func_elem_637: (a: number, b: number) => void;
|
|
1870
1946
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
1871
1947
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
1872
1948
|
readonly __wbindgen_export3: (a: number) => void;
|