@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
package/dist/index.d.ts
CHANGED
|
@@ -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
|
*
|
package/dist/subduction.wasm
CHANGED
|
Binary file
|
|
@@ -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
|
*
|
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./subduction_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
AuthenticatedLongPoll, AuthenticatedTransport, AuthenticatedWebSocket, BatchSyncRequest, BatchSyncResponse, BlobMeta, CallError, CommitWithBlob, Depth, Digest, Fragment, FragmentRequested, FragmentWithBlob, FragmentsArray, HashMetric, LooseCommit, MemorySigner, MemoryStorage, MessagePortTransport, Nonce, PeerBatchSyncResult, PeerId, PeerResultMap, RequestId, Sedimentree, SedimentreeId, SedimentreeIdsArray, SignedFragment, SignedLooseCommit, Subduction, SubductionHttpLongPoll, SubductionLongPoll, SubductionWebSocket, SyncMessage, SyncStats, WebCryptoSigner, makeMessagePortTransport, start
|
|
8
|
+
AuthenticatedLongPoll, AuthenticatedTransport, AuthenticatedWebSocket, BatchSyncRequest, BatchSyncResponse, BlobMeta, CallError, CommitWithBlob, Depth, Digest, Fragment, FragmentRequested, FragmentWithBlob, FragmentsArray, HashMetric, LooseCommit, MemorySigner, MemoryStorage, MessagePortTransport, Nonce, PeerBatchSyncResult, PeerId, PeerResultMap, RequestId, Sedimentree, SedimentreeId, SedimentreeIdsArray, SignedFragment, SignedLooseCommit, Subduction, SubductionHttpLongPoll, SubductionLongPoll, SubductionWebSocket, SyncMessage, SyncStats, Topic, WebCryptoSigner, makeMessagePortTransport, start
|
|
9
9
|
} from "./subduction_wasm_bg.js";
|