@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.
Files changed (36) hide show
  1. package/dist/cjs/wasm-base64.cjs +1 -1
  2. package/dist/cjs/web-bindings.cjs +232 -85
  3. package/dist/cjs/web.cjs +233 -86
  4. package/dist/esm/wasm-base64.js +1 -1
  5. package/dist/iife/index.js +232 -86
  6. package/dist/index.d.ts +83 -11
  7. package/dist/subduction.wasm +0 -0
  8. package/dist/wasm_bindgen/bundler/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
  9. package/dist/wasm_bindgen/bundler/subduction_wasm.d.ts +83 -11
  10. package/dist/wasm_bindgen/bundler/subduction_wasm.js +1 -1
  11. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.js +212 -83
  12. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm +0 -0
  13. package/dist/wasm_bindgen/bundler/subduction_wasm_bg.wasm.d.ts +17 -13
  14. package/dist/wasm_bindgen/nodejs/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
  15. package/dist/wasm_bindgen/nodejs/subduction_wasm.cjs +217 -85
  16. package/dist/wasm_bindgen/nodejs/subduction_wasm.d.ts +83 -11
  17. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm +0 -0
  18. package/dist/wasm_bindgen/nodejs/subduction_wasm_bg.wasm.d.ts +17 -13
  19. package/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js +8 -0
  20. package/dist/wasm_bindgen/web/subduction_wasm.d.ts +100 -24
  21. package/dist/wasm_bindgen/web/subduction_wasm.js +216 -85
  22. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm +0 -0
  23. package/dist/wasm_bindgen/web/subduction_wasm_bg.wasm.d.ts +17 -13
  24. package/package.json +3 -2
  25. /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline0.js +0 -0
  26. /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline1.js +0 -0
  27. /package/dist/wasm_bindgen/bundler/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline2.js +0 -0
  28. /package/dist/wasm_bindgen/bundler/snippets/{subduction_wasm-0ed7fd66cebca59f/inline0.js → subduction_wasm-ec51bcf335db35bd/inline1.js} +0 -0
  29. /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline0.js +0 -0
  30. /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline1.js +0 -0
  31. /package/dist/wasm_bindgen/nodejs/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline2.js +0 -0
  32. /package/dist/wasm_bindgen/nodejs/snippets/{subduction_wasm-0ed7fd66cebca59f/inline0.js → subduction_wasm-ec51bcf335db35bd/inline1.js} +0 -0
  33. /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline0.js +0 -0
  34. /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline1.js +0 -0
  35. /package/dist/wasm_bindgen/web/snippets/{sedimentree_wasm-1de4a01519b0f11f → sedimentree_wasm-75027ecce41278de}/inline2.js +0 -0
  36. /package/dist/wasm_bindgen/web/snippets/{subduction_wasm-0ed7fd66cebca59f/inline0.js → subduction_wasm-ec51bcf335db35bd/inline1.js} +0 -0
@@ -54,6 +54,7 @@ __export(subduction_wasm_exports, {
54
54
  SubductionWebSocket: () => SubductionWebSocket,
55
55
  SyncMessage: () => SyncMessage,
56
56
  SyncStats: () => SyncStats,
57
+ Topic: () => Topic,
57
58
  WebCryptoSigner: () => WebCryptoSigner,
58
59
  __wbg_set_wasm: () => __wbg_set_wasm,
59
60
  default: () => __wbg_init,
@@ -63,14 +64,33 @@ __export(subduction_wasm_exports, {
63
64
  });
64
65
  module.exports = __toCommonJS(subduction_wasm_exports);
65
66
 
66
- // subduction_wasm/dist/wasm_bindgen/web/snippets/sedimentree_wasm-1de4a01519b0f11f/inline2.js
67
+ // subduction_wasm/dist/wasm_bindgen/web/snippets/sedimentree_wasm-75027ecce41278de/inline2.js
67
68
  function tryIntoJsSedimentreeIdsArray(xs) {
68
69
  return xs;
69
70
  }
70
71
 
71
- // subduction_wasm/dist/wasm_bindgen/web/snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js
72
+ // subduction_wasm/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline0.js
72
73
  var inline0_exports = {};
73
74
  __export(inline0_exports, {
75
+ makeOpenEphemeralPolicy: () => makeOpenEphemeralPolicy
76
+ });
77
+ function makeOpenEphemeralPolicy() {
78
+ return {
79
+ authorizeSubscribe() {
80
+ return Promise.resolve();
81
+ },
82
+ authorizePublish() {
83
+ return Promise.resolve();
84
+ },
85
+ filterAuthorizedSubscribers(_topic, peers) {
86
+ return Promise.resolve(peers);
87
+ }
88
+ };
89
+ }
90
+
91
+ // subduction_wasm/dist/wasm_bindgen/web/snippets/subduction_wasm-ec51bcf335db35bd/inline1.js
92
+ var inline1_exports = {};
93
+ __export(inline1_exports, {
74
94
  makeOpenPolicy: () => makeOpenPolicy
75
95
  });
76
96
  function makeOpenPolicy() {
@@ -2320,6 +2340,10 @@ var Subduction = class _Subduction {
2320
2340
  * When set, clients can connect without knowing the server's peer ID.
2321
2341
  * * `hash_metric_override` - Optional custom depth metric function
2322
2342
  * * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
2343
+ * * `policy` - Optional connection/storage authorization policy.
2344
+ * Defaults to allow-all.
2345
+ * * `ephemeral_policy` - Optional ephemeral message authorization policy.
2346
+ * Defaults to allow-all.
2323
2347
  *
2324
2348
  * # Panics
2325
2349
  *
@@ -2334,15 +2358,16 @@ var Subduction = class _Subduction {
2334
2358
  * @param {string | null} [service_name]
2335
2359
  * @param {(digest: Digest) => Depth | null} [hash_metric_override]
2336
2360
  * @param {number | null} [max_pending_blob_requests]
2337
- * @param {any | null} [policy]
2361
+ * @param {Policy | null} [policy]
2362
+ * @param {EphemeralPolicy | null} [ephemeral_policy]
2338
2363
  * @param {Function | null} [on_remote_heads]
2339
2364
  * @param {Function | null} [on_ephemeral]
2340
2365
  * @returns {Promise<Subduction>}
2341
2366
  */
2342
- static hydrate(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
2367
+ static hydrate(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, ephemeral_policy, on_remote_heads, on_ephemeral) {
2343
2368
  var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2344
2369
  var len0 = WASM_VECTOR_LEN;
2345
- const ret = wasm.subduction_hydrate(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2370
+ const ret = wasm.subduction_hydrate(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(ephemeral_policy) ? 0 : addToExternrefTable0(ephemeral_policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2346
2371
  return ret;
2347
2372
  }
2348
2373
  /**
@@ -2377,9 +2402,10 @@ var Subduction = class _Subduction {
2377
2402
  * When set, clients can connect without knowing the server's peer ID.
2378
2403
  * * `hash_metric_override` - Optional custom depth metric function
2379
2404
  * * `max_pending_blob_requests` - Optional maximum number of pending blob requests (default: 10,000)
2380
- * * `policy` - Optional JS object implementing authorization.
2381
- * Must have `authorizeConnect(...)`, `authorizeFetch(...)`, `authorizePut(...)`,
2382
- * `filterAuthorizedFetch(...)`. Defaults to allow-all.
2405
+ * * `policy` - Optional connection/storage authorization policy.
2406
+ * Defaults to allow-all.
2407
+ * * `ephemeral_policy` - Optional ephemeral message authorization policy.
2408
+ * Defaults to allow-all.
2383
2409
  *
2384
2410
  * # Panics
2385
2411
  *
@@ -2390,32 +2416,37 @@ var Subduction = class _Subduction {
2390
2416
  * @param {string | null} [service_name]
2391
2417
  * @param {(digest: Digest) => Depth | null} [hash_metric_override]
2392
2418
  * @param {number | null} [max_pending_blob_requests]
2393
- * @param {any | null} [policy]
2419
+ * @param {Policy | null} [policy]
2420
+ * @param {EphemeralPolicy | null} [ephemeral_policy]
2394
2421
  * @param {Function | null} [on_remote_heads]
2395
2422
  * @param {Function | null} [on_ephemeral]
2396
2423
  */
2397
- constructor(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, on_remote_heads, on_ephemeral) {
2424
+ constructor(signer, storage, service_name, hash_metric_override, max_pending_blob_requests, policy, ephemeral_policy, on_remote_heads, on_ephemeral) {
2398
2425
  var ptr0 = isLikeNone(service_name) ? 0 : passStringToWasm0(service_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2399
2426
  var len0 = WASM_VECTOR_LEN;
2400
- const ret = wasm.subduction_new(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2427
+ const ret = wasm.subduction_new(signer, storage, ptr0, len0, isLikeNone(hash_metric_override) ? 0 : addToExternrefTable0(hash_metric_override), isLikeNone(max_pending_blob_requests) ? 4294967297 : max_pending_blob_requests >>> 0, isLikeNone(policy) ? 0 : addToExternrefTable0(policy), isLikeNone(ephemeral_policy) ? 0 : addToExternrefTable0(ephemeral_policy), isLikeNone(on_remote_heads) ? 0 : addToExternrefTable0(on_remote_heads), isLikeNone(on_ephemeral) ? 0 : addToExternrefTable0(on_ephemeral));
2401
2428
  this.__wbg_ptr = ret >>> 0;
2402
2429
  SubductionFinalization.register(this, this.__wbg_ptr, this);
2403
2430
  return this;
2404
2431
  }
2405
2432
  /**
2406
- * Publish an ephemeral message to all subscribers of a sedimentree.
2433
+ * Publish an ephemeral message to all subscribers of a topic.
2407
2434
  *
2408
2435
  * The payload is opaque bytes — encoding is the caller's responsibility.
2409
2436
  * Messages are fire-and-forget; delivery is best-effort.
2410
- * @param {SedimentreeId} id
2437
+ *
2438
+ * # Panics
2439
+ *
2440
+ * Panics if the platform's random number generator fails.
2441
+ * @param {Topic} topic
2411
2442
  * @param {Uint8Array} payload
2412
2443
  * @returns {Promise<void>}
2413
2444
  */
2414
- publishEphemeral(id, payload) {
2415
- _assertClass(id, SedimentreeId);
2445
+ publishEphemeral(topic, payload) {
2446
+ _assertClass(topic, Topic);
2416
2447
  const ptr0 = passArray8ToWasm0(payload, wasm.__wbindgen_export);
2417
2448
  const len0 = WASM_VECTOR_LEN;
2418
- const ret = wasm.subduction_publishEphemeral(this.__wbg_ptr, id.__wbg_ptr, ptr0, len0);
2449
+ const ret = wasm.subduction_publishEphemeral(this.__wbg_ptr, topic.__wbg_ptr, ptr0, len0);
2419
2450
  return ret;
2420
2451
  }
2421
2452
  /**
@@ -2462,13 +2493,13 @@ var Subduction = class _Subduction {
2462
2493
  return ret;
2463
2494
  }
2464
2495
  /**
2465
- * Subscribe to ephemeral messages for the given sedimentree IDs
2496
+ * Subscribe to ephemeral messages for the given topics
2466
2497
  * from all connected peers.
2467
- * @param {SedimentreeId[]} ids
2498
+ * @param {Topic[]} topics
2468
2499
  * @returns {Promise<void>}
2469
2500
  */
2470
- subscribeEphemeral(ids) {
2471
- const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
2501
+ subscribeEphemeral(topics) {
2502
+ const ptr0 = passArrayJsValueToWasm0(topics, wasm.__wbindgen_export);
2472
2503
  const len0 = WASM_VECTOR_LEN;
2473
2504
  const ret = wasm.subduction_subscribeEphemeral(this.__wbg_ptr, ptr0, len0);
2474
2505
  return ret;
@@ -2521,13 +2552,13 @@ var Subduction = class _Subduction {
2521
2552
  return ret;
2522
2553
  }
2523
2554
  /**
2524
- * Unsubscribe from ephemeral messages for the given sedimentree IDs
2555
+ * Unsubscribe from ephemeral messages for the given topics
2525
2556
  * from all connected peers.
2526
- * @param {SedimentreeId[]} ids
2557
+ * @param {Topic[]} topics
2527
2558
  * @returns {Promise<void>}
2528
2559
  */
2529
- unsubscribeEphemeral(ids) {
2530
- const ptr0 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
2560
+ unsubscribeEphemeral(topics) {
2561
+ const ptr0 = passArrayJsValueToWasm0(topics, wasm.__wbindgen_export);
2531
2562
  const len0 = WASM_VECTOR_LEN;
2532
2563
  const ret = wasm.subduction_unsubscribeEphemeral(this.__wbg_ptr, ptr0, len0);
2533
2564
  return ret;
@@ -3108,6 +3139,76 @@ var SyncStats = class _SyncStats {
3108
3139
  }
3109
3140
  };
3110
3141
  if (Symbol.dispose) SyncStats.prototype[Symbol.dispose] = SyncStats.prototype.free;
3142
+ var Topic = class _Topic {
3143
+ static __wrap(ptr) {
3144
+ ptr = ptr >>> 0;
3145
+ const obj = Object.create(_Topic.prototype);
3146
+ obj.__wbg_ptr = ptr;
3147
+ TopicFinalization.register(obj, obj.__wbg_ptr, obj);
3148
+ return obj;
3149
+ }
3150
+ static __unwrap(jsValue) {
3151
+ if (!(jsValue instanceof _Topic)) {
3152
+ return 0;
3153
+ }
3154
+ return jsValue.__destroy_into_raw();
3155
+ }
3156
+ __destroy_into_raw() {
3157
+ const ptr = this.__wbg_ptr;
3158
+ this.__wbg_ptr = 0;
3159
+ TopicFinalization.unregister(this);
3160
+ return ptr;
3161
+ }
3162
+ free() {
3163
+ const ptr = this.__destroy_into_raw();
3164
+ wasm.__wbg_topic_free(ptr, 0);
3165
+ }
3166
+ /**
3167
+ * Create a topic from a 32-byte array.
3168
+ *
3169
+ * # Errors
3170
+ *
3171
+ * Returns an error if the provided byte array is not exactly 32 bytes.
3172
+ * @param {Uint8Array} bytes
3173
+ * @returns {Topic}
3174
+ */
3175
+ static fromBytes(bytes) {
3176
+ const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
3177
+ const len0 = WASM_VECTOR_LEN;
3178
+ const ret = wasm.topic_fromBytes(ptr0, len0);
3179
+ if (ret[2]) {
3180
+ throw takeFromExternrefTable0(ret[1]);
3181
+ }
3182
+ return _Topic.__wrap(ret[0]);
3183
+ }
3184
+ /**
3185
+ * Returns the raw 32 bytes of this topic.
3186
+ * @returns {Uint8Array}
3187
+ */
3188
+ toBytes() {
3189
+ const ret = wasm.topic_toBytes(this.__wbg_ptr);
3190
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
3191
+ wasm.__wbindgen_export5(ret[0], ret[1] * 1, 1);
3192
+ return v1;
3193
+ }
3194
+ /**
3195
+ * Returns a shortened hex prefix representation (first 4 bytes + `…`).
3196
+ * @returns {string}
3197
+ */
3198
+ toString() {
3199
+ let deferred1_0;
3200
+ let deferred1_1;
3201
+ try {
3202
+ const ret = wasm.topic_toString(this.__wbg_ptr);
3203
+ deferred1_0 = ret[0];
3204
+ deferred1_1 = ret[1];
3205
+ return getStringFromWasm0(ret[0], ret[1]);
3206
+ } finally {
3207
+ wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
3208
+ }
3209
+ }
3210
+ };
3211
+ if (Symbol.dispose) Topic.prototype[Symbol.dispose] = Topic.prototype.free;
3111
3212
  var WebCryptoSigner = class _WebCryptoSigner {
3112
3213
  static __wrap(ptr) {
3113
3214
  ptr = ptr >>> 0;
@@ -3185,37 +3286,37 @@ function start() {
3185
3286
  function __wbg_get_imports() {
3186
3287
  const import0 = {
3187
3288
  __proto__: null,
3188
- __wbg___wasm_refgen_toWasmCommitWithBlob_4c1dc5cc453af7eb: function(arg0) {
3289
+ __wbg___wasm_refgen_toWasmCommitWithBlob_fcbd230cf952f128: function(arg0) {
3189
3290
  const ret = arg0.__wasm_refgen_toWasmCommitWithBlob();
3190
3291
  _assertClass(ret, CommitWithBlob);
3191
3292
  var ptr1 = ret.__destroy_into_raw();
3192
3293
  return ptr1;
3193
3294
  },
3194
- __wbg___wasm_refgen_toWasmDepth_e11bce6176c8257e: function(arg0) {
3295
+ __wbg___wasm_refgen_toWasmDepth_4f8de5b877457c3d: function(arg0) {
3195
3296
  const ret = arg0.__wasm_refgen_toWasmDepth();
3196
3297
  _assertClass(ret, Depth);
3197
3298
  var ptr1 = ret.__destroy_into_raw();
3198
3299
  return ptr1;
3199
3300
  },
3200
- __wbg___wasm_refgen_toWasmDigest_86d449f5dc99fc6a: function(arg0) {
3301
+ __wbg___wasm_refgen_toWasmDigest_d0fbca90d003e5b2: function(arg0) {
3201
3302
  const ret = arg0.__wasm_refgen_toWasmDigest();
3202
3303
  _assertClass(ret, Digest);
3203
3304
  var ptr1 = ret.__destroy_into_raw();
3204
3305
  return ptr1;
3205
3306
  },
3206
- __wbg___wasm_refgen_toWasmFragmentWithBlob_d7450dc251166eea: function(arg0) {
3307
+ __wbg___wasm_refgen_toWasmFragmentWithBlob_814bb2b3d862ac90: function(arg0) {
3207
3308
  const ret = arg0.__wasm_refgen_toWasmFragmentWithBlob();
3208
3309
  _assertClass(ret, FragmentWithBlob);
3209
3310
  var ptr1 = ret.__destroy_into_raw();
3210
3311
  return ptr1;
3211
3312
  },
3212
- __wbg___wasm_refgen_toWasmFragment_03b5e19d20693b4f: function(arg0) {
3313
+ __wbg___wasm_refgen_toWasmFragment_32ab33a0a1cf967b: function(arg0) {
3213
3314
  const ret = arg0.__wasm_refgen_toWasmFragment();
3214
3315
  _assertClass(ret, Fragment);
3215
3316
  var ptr1 = ret.__destroy_into_raw();
3216
3317
  return ptr1;
3217
3318
  },
3218
- __wbg___wasm_refgen_toWasmLooseCommit_bc6f015053af2dd7: function(arg0) {
3319
+ __wbg___wasm_refgen_toWasmLooseCommit_6deda612421ca7e6: function(arg0) {
3219
3320
  const ret = arg0.__wasm_refgen_toWasmLooseCommit();
3220
3321
  _assertClass(ret, LooseCommit);
3221
3322
  var ptr1 = ret.__destroy_into_raw();
@@ -3291,21 +3392,33 @@ function __wbg_get_imports() {
3291
3392
  const ret = AuthenticatedWebSocket.__wrap(arg0);
3292
3393
  return ret;
3293
3394
  },
3294
- __wbg_authorizeConnect_0e61e98d289a37c9: function() {
3395
+ __wbg_authorizeConnect_8e2609308bbbbcfd: function() {
3295
3396
  return handleError(function(arg0, arg1) {
3296
- const ret = arg0.authorizeConnect(arg1);
3397
+ const ret = arg0.authorizeConnect(PeerId.__wrap(arg1));
3398
+ return ret;
3399
+ }, arguments);
3400
+ },
3401
+ __wbg_authorizeFetch_b7bcc4e437112c73: function() {
3402
+ return handleError(function(arg0, arg1, arg2) {
3403
+ const ret = arg0.authorizeFetch(PeerId.__wrap(arg1), SedimentreeId.__wrap(arg2));
3297
3404
  return ret;
3298
3405
  }, arguments);
3299
3406
  },
3300
- __wbg_authorizeFetch_88703389e9c295d0: function() {
3407
+ __wbg_authorizePublish_7e546fc3d8103532: function() {
3301
3408
  return handleError(function(arg0, arg1, arg2) {
3302
- const ret = arg0.authorizeFetch(arg1, arg2);
3409
+ const ret = arg0.authorizePublish(PeerId.__wrap(arg1), Topic.__wrap(arg2));
3303
3410
  return ret;
3304
3411
  }, arguments);
3305
3412
  },
3306
- __wbg_authorizePut_dab9270462803778: function() {
3413
+ __wbg_authorizePut_ba5a5e36c9e9bbfa: function() {
3307
3414
  return handleError(function(arg0, arg1, arg2, arg3) {
3308
- const ret = arg0.authorizePut(arg1, arg2, arg3);
3415
+ const ret = arg0.authorizePut(PeerId.__wrap(arg1), PeerId.__wrap(arg2), SedimentreeId.__wrap(arg3));
3416
+ return ret;
3417
+ }, arguments);
3418
+ },
3419
+ __wbg_authorizeSubscribe_34f5ba6f23bab853: function() {
3420
+ return handleError(function(arg0, arg1, arg2) {
3421
+ const ret = arg0.authorizeSubscribe(PeerId.__wrap(arg1), Topic.__wrap(arg2));
3309
3422
  return ret;
3310
3423
  }, arguments);
3311
3424
  },
@@ -3331,9 +3444,6 @@ function __wbg_get_imports() {
3331
3444
  return ret;
3332
3445
  }, arguments);
3333
3446
  },
3334
- __wbg_close_574e2788efd7bb53: function(arg0) {
3335
- arg0.close();
3336
- },
3337
3447
  __wbg_close_af26905c832a88cb: function() {
3338
3448
  return handleError(function(arg0) {
3339
3449
  arg0.close();
@@ -3342,6 +3452,9 @@ function __wbg_get_imports() {
3342
3452
  __wbg_close_cbf870bdad0aad99: function(arg0) {
3343
3453
  arg0.close();
3344
3454
  },
3455
+ __wbg_close_f85b3643ad9ed8d4: function(arg0) {
3456
+ arg0.close();
3457
+ },
3345
3458
  __wbg_commitwithblob_new: function(arg0) {
3346
3459
  const ret = CommitWithBlob.__wrap(arg0);
3347
3460
  return ret;
@@ -3364,11 +3477,11 @@ function __wbg_get_imports() {
3364
3477
  const ret = arg0.data;
3365
3478
  return ret;
3366
3479
  },
3367
- __wbg_deleteAllCommits_b0197e590f7fce60: function(arg0, arg1) {
3480
+ __wbg_deleteAllCommits_87e95e34aba169ea: function(arg0, arg1) {
3368
3481
  const ret = arg0.deleteAllCommits(arg1);
3369
3482
  return ret;
3370
3483
  },
3371
- __wbg_deleteAllFragments_f884845698f5afb7: function(arg0, arg1) {
3484
+ __wbg_deleteAllFragments_b5a40f8b94689ee5: function(arg0, arg1) {
3372
3485
  const ret = arg0.deleteAllFragments(arg1);
3373
3486
  return ret;
3374
3487
  },
@@ -3380,7 +3493,7 @@ function __wbg_get_imports() {
3380
3493
  const ret = Digest.__unwrap(arg0);
3381
3494
  return ret;
3382
3495
  },
3383
- __wbg_disconnect_849aae59f5879e45: function(arg0) {
3496
+ __wbg_disconnect_91312bb506e834b1: function(arg0) {
3384
3497
  const ret = arg0.disconnect();
3385
3498
  return ret;
3386
3499
  },
@@ -3409,9 +3522,19 @@ function __wbg_get_imports() {
3409
3522
  const ret = arg0.fetch(arg1);
3410
3523
  return ret;
3411
3524
  },
3412
- __wbg_filterAuthorizedFetch_0d6450fa919b271d: function() {
3413
- return handleError(function(arg0, arg1, arg2) {
3414
- const ret = arg0.filterAuthorizedFetch(arg1, arg2);
3525
+ __wbg_filterAuthorizedFetch_a647f13dc33948f1: function() {
3526
+ return handleError(function(arg0, arg1, arg2, arg3) {
3527
+ var v0 = getArrayJsValueFromWasm0(arg2, arg3).slice();
3528
+ wasm.__wbindgen_export5(arg2, arg3 * 4, 4);
3529
+ const ret = arg0.filterAuthorizedFetch(PeerId.__wrap(arg1), v0);
3530
+ return ret;
3531
+ }, arguments);
3532
+ },
3533
+ __wbg_filterAuthorizedSubscribers_34bdeaaac0eb31a5: function() {
3534
+ return handleError(function(arg0, arg1, arg2, arg3) {
3535
+ var v0 = getArrayJsValueFromWasm0(arg2, arg3).slice();
3536
+ wasm.__wbindgen_export5(arg2, arg3 * 4, 4);
3537
+ const ret = arg0.filterAuthorizedSubscribers(Topic.__wrap(arg1), v0);
3415
3538
  return ret;
3416
3539
  }, arguments);
3417
3540
  },
@@ -3617,15 +3740,15 @@ function __wbg_get_imports() {
3617
3740
  const ret = arg0.length;
3618
3741
  return ret;
3619
3742
  },
3620
- __wbg_loadAllCommits_0e97df07ed213aa0: function(arg0, arg1) {
3743
+ __wbg_loadAllCommits_1b040f2bd61f63de: function(arg0, arg1) {
3621
3744
  const ret = arg0.loadAllCommits(arg1);
3622
3745
  return ret;
3623
3746
  },
3624
- __wbg_loadAllFragments_12ecf8f9bd0e0b58: function(arg0, arg1) {
3747
+ __wbg_loadAllFragments_cf081afbfee53965: function(arg0, arg1) {
3625
3748
  const ret = arg0.loadAllFragments(arg1);
3626
3749
  return ret;
3627
3750
  },
3628
- __wbg_loadAllSedimentreeIds_1a18451ef1f8e795: function(arg0) {
3751
+ __wbg_loadAllSedimentreeIds_a9046bfade082517: function(arg0) {
3629
3752
  const ret = arg0.loadAllSedimentreeIds();
3630
3753
  return ret;
3631
3754
  },
@@ -3670,7 +3793,7 @@ function __wbg_get_imports() {
3670
3793
  const a = state0.a;
3671
3794
  state0.a = 0;
3672
3795
  try {
3673
- return __wasm_bindgen_func_elem_1605_191(a, state0.b, arg02, arg12);
3796
+ return __wasm_bindgen_func_elem_1651_194(a, state0.b, arg02, arg12);
3674
3797
  } finally {
3675
3798
  state0.a = a;
3676
3799
  }
@@ -3708,7 +3831,7 @@ function __wbg_get_imports() {
3708
3831
  const a = state0.a;
3709
3832
  state0.a = 0;
3710
3833
  try {
3711
- return __wasm_bindgen_func_elem_1605_192(a, state0.b, arg02, arg12);
3834
+ return __wasm_bindgen_func_elem_1651_195(a, state0.b, arg02, arg12);
3712
3835
  } finally {
3713
3836
  state0.a = a;
3714
3837
  }
@@ -3723,6 +3846,10 @@ function __wbg_get_imports() {
3723
3846
  const ret = new Array();
3724
3847
  return ret;
3725
3848
  },
3849
+ __wbg_new_with_length_3259a525196bd8cc: function(arg0) {
3850
+ const ret = new Array(arg0 >>> 0);
3851
+ return ret;
3852
+ },
3726
3853
  __wbg_new_with_length_825018a1616e9e55: function(arg0) {
3727
3854
  const ret = new Uint8Array(arg0 >>> 0);
3728
3855
  return ret;
@@ -3759,7 +3886,7 @@ function __wbg_get_imports() {
3759
3886
  const ret = Array.of(arg0, arg1);
3760
3887
  return ret;
3761
3888
  },
3762
- __wbg_onDisconnect_12d6884490508121: function(arg0, arg1) {
3889
+ __wbg_onDisconnect_a24437def131c941: function(arg0, arg1) {
3763
3890
  arg0.onDisconnect(arg1);
3764
3891
  },
3765
3892
  __wbg_open_e7a9d3d6344572f6: function() {
@@ -3788,7 +3915,7 @@ function __wbg_get_imports() {
3788
3915
  const ret = arg0.port2;
3789
3916
  return ret;
3790
3917
  },
3791
- __wbg_postMessage_0541d6c31330afe3: function(arg0, arg1) {
3918
+ __wbg_postMessage_fb1c205fdbbf796d: function(arg0, arg1) {
3792
3919
  arg0.postMessage(arg1);
3793
3920
  },
3794
3921
  __wbg_process_44c7a14e11e9f69e: function(arg0) {
@@ -3824,7 +3951,7 @@ function __wbg_get_imports() {
3824
3951
  const ret = arg0.readyState;
3825
3952
  return ret;
3826
3953
  },
3827
- __wbg_recvBytes_c85b12fb48cd7a35: function(arg0) {
3954
+ __wbg_recvBytes_e13f381294da16db: function(arg0) {
3828
3955
  const ret = arg0.recvBytes();
3829
3956
  return ret;
3830
3957
  },
@@ -3844,15 +3971,19 @@ function __wbg_get_imports() {
3844
3971
  return ret;
3845
3972
  }, arguments);
3846
3973
  },
3847
- __wbg_saveCommit_02f095436fc502e0: function(arg0, arg1, arg2, arg3, arg4) {
3974
+ __wbg_saveBatchAll_b9359532f5a65936: function(arg0, arg1, arg2, arg3) {
3975
+ const ret = arg0.saveBatchAll(arg1, arg2, arg3);
3976
+ return ret;
3977
+ },
3978
+ __wbg_saveCommit_f6c4180a159edfdf: function(arg0, arg1, arg2, arg3, arg4) {
3848
3979
  const ret = arg0.saveCommit(arg1, arg2, arg3, arg4);
3849
3980
  return ret;
3850
3981
  },
3851
- __wbg_saveFragment_7681b2171b8cfb35: function(arg0, arg1, arg2, arg3, arg4) {
3982
+ __wbg_saveFragment_49505af74bd5abe3: function(arg0, arg1, arg2, arg3, arg4) {
3852
3983
  const ret = arg0.saveFragment(arg1, arg2, arg3, arg4);
3853
3984
  return ret;
3854
3985
  },
3855
- __wbg_saveSedimentreeId_c265aaeef5af34b6: function(arg0, arg1) {
3986
+ __wbg_saveSedimentreeId_7b6b4310628fe78c: function(arg0, arg1) {
3856
3987
  const ret = arg0.saveSedimentreeId(arg1);
3857
3988
  return ret;
3858
3989
  },
@@ -3864,7 +3995,7 @@ function __wbg_get_imports() {
3864
3995
  const ret = SedimentreeId.__unwrap(arg0);
3865
3996
  return ret;
3866
3997
  },
3867
- __wbg_sendBytes_e6262dd74f1c260a: function(arg0, arg1) {
3998
+ __wbg_sendBytes_9a00cdaf7c891eff: function(arg0, arg1) {
3868
3999
  const ret = arg0.sendBytes(arg1);
3869
4000
  return ret;
3870
4001
  },
@@ -3873,10 +4004,13 @@ function __wbg_get_imports() {
3873
4004
  arg0.send(getArrayU8FromWasm0(arg1, arg2));
3874
4005
  }, arguments);
3875
4006
  },
3876
- __wbg_setTimeout_7829585928963a1f: function(arg0, arg1) {
4007
+ __wbg_setTimeout_43db2c2050a4d3d2: function(arg0, arg1) {
3877
4008
  const ret = setTimeout(arg0, arg1);
3878
4009
  return ret;
3879
4010
  },
4011
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
4012
+ arg0[arg1 >>> 0] = arg2;
4013
+ },
3880
4014
  __wbg_set_7eaa4f96924fd6b3: function() {
3881
4015
  return handleError(function(arg0, arg1, arg2) {
3882
4016
  const ret = Reflect.set(arg0, arg1, arg2);
@@ -3915,7 +4049,7 @@ function __wbg_get_imports() {
3915
4049
  __wbg_set_onerror_901ca711f94a5bbb: function(arg0, arg1) {
3916
4050
  arg0.onerror = arg1;
3917
4051
  },
3918
- __wbg_set_onmessage_29558b29aee9a78a: function(arg0, arg1) {
4052
+ __wbg_set_onmessage_284248c97c42cb93: function(arg0, arg1) {
3919
4053
  arg0.onmessage = arg1;
3920
4054
  },
3921
4055
  __wbg_set_onmessage_6f80ab771bf151aa: function(arg0, arg1) {
@@ -3936,7 +4070,7 @@ function __wbg_get_imports() {
3936
4070
  return ret;
3937
4071
  }, arguments);
3938
4072
  },
3939
- __wbg_sign_d03455abc6736428: function(arg0, arg1) {
4073
+ __wbg_sign_e6fa76bd4ef9c75a: function(arg0, arg1) {
3940
4074
  const ret = arg0.sign(arg1);
3941
4075
  return ret;
3942
4076
  },
@@ -4010,6 +4144,14 @@ function __wbg_get_imports() {
4010
4144
  const ret = arg0.then(arg1, arg2);
4011
4145
  return ret;
4012
4146
  },
4147
+ __wbg_topic_new: function(arg0) {
4148
+ const ret = Topic.__wrap(arg0);
4149
+ return ret;
4150
+ },
4151
+ __wbg_topic_unwrap: function(arg0) {
4152
+ const ret = Topic.__unwrap(arg0);
4153
+ return ret;
4154
+ },
4013
4155
  __wbg_transaction_1309b463c399d2b3: function() {
4014
4156
  return handleError(function(arg0, arg1, arg2, arg3) {
4015
4157
  const ret = arg0.transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
@@ -4022,7 +4164,7 @@ function __wbg_get_imports() {
4022
4164
  return ret;
4023
4165
  }, arguments);
4024
4166
  },
4025
- __wbg_tryIntoJsSedimentreeIdsArray_d6337c0aa0f28604: function() {
4167
+ __wbg_tryIntoJsSedimentreeIdsArray_6803cc05ac20ff4f: function() {
4026
4168
  return handleError(function(arg0, arg1) {
4027
4169
  const ret = tryIntoJsSedimentreeIdsArray(arg1);
4028
4170
  const ptr1 = passArrayJsValueToWasm0(ret, wasm.__wbindgen_export);
@@ -4031,7 +4173,7 @@ function __wbg_get_imports() {
4031
4173
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
4032
4174
  }, arguments);
4033
4175
  },
4034
- __wbg_verifyingKey_29533740d75f8cdb: function(arg0) {
4176
+ __wbg_verifyingKey_28c38fc6525caed5: function(arg0) {
4035
4177
  const ret = arg0.verifyingKey();
4036
4178
  return ret;
4037
4179
  },
@@ -4044,27 +4186,27 @@ function __wbg_get_imports() {
4044
4186
  return ret;
4045
4187
  },
4046
4188
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
4047
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590);
4189
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_285, __wasm_bindgen_func_elem_638);
4048
4190
  return ret;
4049
4191
  },
4050
4192
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
4051
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_1);
4193
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_285, __wasm_bindgen_func_elem_638_1);
4052
4194
  return ret;
4053
4195
  },
4054
4196
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
4055
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_2);
4197
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_285, __wasm_bindgen_func_elem_638_2);
4056
4198
  return ret;
4057
4199
  },
4058
4200
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
4059
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_590_3);
4201
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_285, __wasm_bindgen_func_elem_638_3);
4060
4202
  return ret;
4061
4203
  },
4062
4204
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
4063
- const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_589);
4205
+ const ret = makeClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_285, __wasm_bindgen_func_elem_637);
4064
4206
  return ret;
4065
4207
  },
4066
4208
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
4067
- const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_274, __wasm_bindgen_func_elem_1605);
4209
+ const ret = makeMutClosure(arg0, arg1, wasm.__wasm_bindgen_func_elem_285, __wasm_bindgen_func_elem_1651);
4068
4210
  return ret;
4069
4211
  },
4070
4212
  __wbindgen_cast_0000000000000007: function(arg0) {
@@ -4122,35 +4264,36 @@ function __wbg_get_imports() {
4122
4264
  return {
4123
4265
  __proto__: null,
4124
4266
  "./subduction_wasm_bg.js": import0,
4125
- "./snippets/subduction_wasm-0ed7fd66cebca59f/inline0.js": inline0_exports
4267
+ "./snippets/subduction_wasm-ec51bcf335db35bd/inline0.js": inline0_exports,
4268
+ "./snippets/subduction_wasm-ec51bcf335db35bd/inline1.js": inline1_exports
4126
4269
  };
4127
4270
  }
4128
- function __wasm_bindgen_func_elem_589(arg0, arg1) {
4129
- wasm.__wasm_bindgen_func_elem_589(arg0, arg1);
4271
+ function __wasm_bindgen_func_elem_637(arg0, arg1) {
4272
+ wasm.__wasm_bindgen_func_elem_637(arg0, arg1);
4130
4273
  }
4131
- function __wasm_bindgen_func_elem_590(arg0, arg1, arg2) {
4132
- wasm.__wasm_bindgen_func_elem_590(arg0, arg1, arg2);
4274
+ function __wasm_bindgen_func_elem_638(arg0, arg1, arg2) {
4275
+ wasm.__wasm_bindgen_func_elem_638(arg0, arg1, arg2);
4133
4276
  }
4134
- function __wasm_bindgen_func_elem_590_1(arg0, arg1, arg2) {
4135
- wasm.__wasm_bindgen_func_elem_590_1(arg0, arg1, arg2);
4277
+ function __wasm_bindgen_func_elem_638_1(arg0, arg1, arg2) {
4278
+ wasm.__wasm_bindgen_func_elem_638_1(arg0, arg1, arg2);
4136
4279
  }
4137
- function __wasm_bindgen_func_elem_590_2(arg0, arg1, arg2) {
4138
- wasm.__wasm_bindgen_func_elem_590_2(arg0, arg1, arg2);
4280
+ function __wasm_bindgen_func_elem_638_2(arg0, arg1, arg2) {
4281
+ wasm.__wasm_bindgen_func_elem_638_2(arg0, arg1, arg2);
4139
4282
  }
4140
- function __wasm_bindgen_func_elem_590_3(arg0, arg1, arg2) {
4141
- wasm.__wasm_bindgen_func_elem_590_3(arg0, arg1, arg2);
4283
+ function __wasm_bindgen_func_elem_638_3(arg0, arg1, arg2) {
4284
+ wasm.__wasm_bindgen_func_elem_638_3(arg0, arg1, arg2);
4142
4285
  }
4143
- function __wasm_bindgen_func_elem_1605(arg0, arg1, arg2) {
4144
- const ret = wasm.__wasm_bindgen_func_elem_1605(arg0, arg1, arg2);
4286
+ function __wasm_bindgen_func_elem_1651(arg0, arg1, arg2) {
4287
+ const ret = wasm.__wasm_bindgen_func_elem_1651(arg0, arg1, arg2);
4145
4288
  if (ret[1]) {
4146
4289
  throw takeFromExternrefTable0(ret[0]);
4147
4290
  }
4148
4291
  }
4149
- function __wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3) {
4150
- wasm.__wasm_bindgen_func_elem_1605_191(arg0, arg1, arg2, arg3);
4292
+ function __wasm_bindgen_func_elem_1651_194(arg0, arg1, arg2, arg3) {
4293
+ wasm.__wasm_bindgen_func_elem_1651_194(arg0, arg1, arg2, arg3);
4151
4294
  }
4152
- function __wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3) {
4153
- wasm.__wasm_bindgen_func_elem_1605_192(arg0, arg1, arg2, arg3);
4295
+ function __wasm_bindgen_func_elem_1651_195(arg0, arg1, arg2, arg3) {
4296
+ wasm.__wasm_bindgen_func_elem_1651_195(arg0, arg1, arg2, arg3);
4154
4297
  }
4155
4298
  var __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
4156
4299
  var __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
@@ -4257,6 +4400,9 @@ var SubductionFinalization = typeof FinalizationRegistry === "undefined" ? { reg
4257
4400
  var SyncStatsFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4258
4401
  }, unregister: () => {
4259
4402
  } } : new FinalizationRegistry((ptr) => wasm.__wbg_syncstats_free(ptr >>> 0, 1));
4403
+ var TopicFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4404
+ }, unregister: () => {
4405
+ } } : new FinalizationRegistry((ptr) => wasm.__wbg_topic_free(ptr >>> 0, 1));
4260
4406
  var SubductionWebSocketFinalization = typeof FinalizationRegistry === "undefined" ? { register: () => {
4261
4407
  }, unregister: () => {
4262
4408
  } } : new FinalizationRegistry((ptr) => wasm.__wbg_subductionwebsocket_free(ptr >>> 0, 1));
@@ -4613,6 +4759,7 @@ function __wbg_set_wasm(val) {
4613
4759
  SubductionWebSocket,
4614
4760
  SyncMessage,
4615
4761
  SyncStats,
4762
+ Topic,
4616
4763
  WebCryptoSigner,
4617
4764
  __wbg_set_wasm,
4618
4765
  initSync,