@xmtp/wasm-bindings 1.7.0-rc3 → 1.8.0-dev.8ab4077

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.
@@ -225,25 +225,6 @@ function makeMutClosure(arg0, arg1, dtor, f) {
225
225
  return real;
226
226
  }
227
227
 
228
- function takeFromExternrefTable0(idx) {
229
- const value = wasm.__wbindgen_externrefs.get(idx);
230
- wasm.__externref_table_dealloc(idx);
231
- return value;
232
- }
233
- /**
234
- * @param {string} signatureText
235
- * @param {Uint8Array} signatureBytes
236
- * @param {Uint8Array} publicKey
237
- */
238
- export function verifySignedWithPublicKey(signatureText, signatureBytes, publicKey) {
239
- const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
240
- const len0 = WASM_VECTOR_LEN;
241
- const ret = wasm.verifySignedWithPublicKey(ptr0, len0, signatureBytes, publicKey);
242
- if (ret[1]) {
243
- throw takeFromExternrefTable0(ret[0]);
244
- }
245
- }
246
-
247
228
  function passArrayJsValueToWasm0(array, malloc) {
248
229
  const ptr = malloc(array.length * 4, 4) >>> 0;
249
230
  for (let i = 0; i < array.length; i++) {
@@ -253,6 +234,12 @@ function passArrayJsValueToWasm0(array, malloc) {
253
234
  WASM_VECTOR_LEN = array.length;
254
235
  return ptr;
255
236
  }
237
+
238
+ function takeFromExternrefTable0(idx) {
239
+ const value = wasm.__wbindgen_externrefs.get(idx);
240
+ wasm.__externref_table_dealloc(idx);
241
+ return value;
242
+ }
256
243
  /**
257
244
  * @param {string} host
258
245
  * @param {string | null | undefined} gatewayHost
@@ -277,6 +264,20 @@ export function revokeInstallationsSignatureRequest(host, gatewayHost, recoveryI
277
264
  return SignatureRequestHandle.__wrap(ret[0]);
278
265
  }
279
266
 
267
+ /**
268
+ * @param {string} signatureText
269
+ * @param {Uint8Array} signatureBytes
270
+ * @param {Uint8Array} publicKey
271
+ */
272
+ export function verifySignedWithPublicKey(signatureText, signatureBytes, publicKey) {
273
+ const ptr0 = passStringToWasm0(signatureText, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
274
+ const len0 = WASM_VECTOR_LEN;
275
+ const ret = wasm.verifySignedWithPublicKey(ptr0, len0, signatureBytes, publicKey);
276
+ if (ret[1]) {
277
+ throw takeFromExternrefTable0(ret[0]);
278
+ }
279
+ }
280
+
280
281
  function _assertClass(instance, klass) {
281
282
  if (!(instance instanceof klass)) {
282
283
  throw new Error(`expected instance of ${klass.name}`);
@@ -299,48 +300,36 @@ export function applySignatureRequest(host, gatewayHost, signatureRequest) {
299
300
  }
300
301
 
301
302
  /**
302
- * @param {string} host
303
- * @param {string | null | undefined} gatewayHost
304
- * @param {string[]} inboxIds
305
- * @returns {Promise<InboxState[]>}
306
- */
307
- export function inboxStateFromInboxIds(host, gatewayHost, inboxIds) {
308
- const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
309
- const len0 = WASM_VECTOR_LEN;
310
- var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
311
- var len1 = WASM_VECTOR_LEN;
312
- const ptr2 = passArrayJsValueToWasm0(inboxIds, wasm.__wbindgen_malloc);
313
- const len2 = WASM_VECTOR_LEN;
314
- const ret = wasm.inboxStateFromInboxIds(ptr0, len0, ptr1, len1, ptr2, len2);
315
- return ret;
316
- }
317
-
318
- /**
319
- * @param {Attachment} attachment
320
- * @returns {EncodedContent}
303
+ * @param {MetadataField} field
304
+ * @returns {string}
321
305
  */
322
- export function encodeAttachment(attachment) {
323
- const ret = wasm.encodeAttachment(attachment);
324
- if (ret[2]) {
325
- throw takeFromExternrefTable0(ret[1]);
306
+ export function metadataFieldName(field) {
307
+ let deferred1_0;
308
+ let deferred1_1;
309
+ try {
310
+ const ret = wasm.metadataFieldName(field);
311
+ deferred1_0 = ret[0];
312
+ deferred1_1 = ret[1];
313
+ return getStringFromWasm0(ret[0], ret[1]);
314
+ } finally {
315
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
326
316
  }
327
- return takeFromExternrefTable0(ret[0]);
328
317
  }
329
318
 
330
319
  /**
331
320
  * @returns {ContentTypeId}
332
321
  */
333
- export function attachmentContentType() {
334
- const ret = wasm.attachmentContentType();
322
+ export function contentTypeAttachment() {
323
+ const ret = wasm.contentTypeAttachment();
335
324
  return ret;
336
325
  }
337
326
 
338
327
  /**
339
- * @param {ReadReceipt} read_receipt
328
+ * @param {Attachment} attachment
340
329
  * @returns {EncodedContent}
341
330
  */
342
- export function encodeReadReceipt(read_receipt) {
343
- const ret = wasm.encodeReadReceipt(read_receipt);
331
+ export function encodeAttachment(attachment) {
332
+ const ret = wasm.encodeAttachment(attachment);
344
333
  if (ret[2]) {
345
334
  throw takeFromExternrefTable0(ret[1]);
346
335
  }
@@ -350,43 +339,33 @@ export function encodeReadReceipt(read_receipt) {
350
339
  /**
351
340
  * @returns {ContentTypeId}
352
341
  */
353
- export function readReceiptContentType() {
354
- const ret = wasm.readReceiptContentType();
342
+ export function contentTypeGroupUpdated() {
343
+ const ret = wasm.contentTypeGroupUpdated();
355
344
  return ret;
356
345
  }
357
346
 
358
347
  /**
359
348
  * @returns {ContentTypeId}
360
349
  */
361
- export function groupUpdatedContentType() {
362
- const ret = wasm.groupUpdatedContentType();
350
+ export function contentTypeLeaveRequest() {
351
+ const ret = wasm.contentTypeLeaveRequest();
363
352
  return ret;
364
353
  }
365
354
 
366
355
  /**
367
356
  * @returns {ContentTypeId}
368
357
  */
369
- export function leaveRequestContentType() {
370
- const ret = wasm.leaveRequestContentType();
358
+ export function contentTypeMultiRemoteAttachment() {
359
+ const ret = wasm.contentTypeMultiRemoteAttachment();
371
360
  return ret;
372
361
  }
373
362
 
374
- function passArray8ToWasm0(arg, malloc) {
375
- const ptr = malloc(arg.length * 1, 1) >>> 0;
376
- getUint8ArrayMemory0().set(arg, ptr / 1);
377
- WASM_VECTOR_LEN = arg.length;
378
- return ptr;
379
- }
380
363
  /**
381
- * Decrypts an encrypted payload from a remote attachment.
382
- * @param {Uint8Array} encryptedBytes
383
- * @param {RemoteAttachment} remoteAttachment
384
- * @returns {Attachment}
364
+ * @param {MultiRemoteAttachment} multi_remote_attachment
365
+ * @returns {EncodedContent}
385
366
  */
386
- export function decryptAttachment(encryptedBytes, remoteAttachment) {
387
- const ptr0 = passArray8ToWasm0(encryptedBytes, wasm.__wbindgen_malloc);
388
- const len0 = WASM_VECTOR_LEN;
389
- const ret = wasm.decryptAttachment(ptr0, len0, remoteAttachment);
367
+ export function encodeMultiRemoteAttachment(multi_remote_attachment) {
368
+ const ret = wasm.encodeMultiRemoteAttachment(multi_remote_attachment);
390
369
  if (ret[2]) {
391
370
  throw takeFromExternrefTable0(ret[1]);
392
371
  }
@@ -396,30 +375,19 @@ export function decryptAttachment(encryptedBytes, remoteAttachment) {
396
375
  /**
397
376
  * @returns {ContentTypeId}
398
377
  */
399
- export function remoteAttachmentContentType() {
400
- const ret = wasm.remoteAttachmentContentType();
378
+ export function contentTypeText() {
379
+ const ret = wasm.contentTypeText();
401
380
  return ret;
402
381
  }
403
382
 
404
383
  /**
405
- * Encrypts an attachment for storage as a remote attachment.
406
- * @param {Attachment} attachment
407
- * @returns {EncryptedAttachment}
408
- */
409
- export function encryptAttachment(attachment) {
410
- const ret = wasm.encryptAttachment(attachment);
411
- if (ret[2]) {
412
- throw takeFromExternrefTable0(ret[1]);
413
- }
414
- return takeFromExternrefTable0(ret[0]);
415
- }
416
-
417
- /**
418
- * @param {RemoteAttachment} remote_attachment
384
+ * @param {string} text
419
385
  * @returns {EncodedContent}
420
386
  */
421
- export function encodeRemoteAttachment(remote_attachment) {
422
- const ret = wasm.encodeRemoteAttachment(remote_attachment);
387
+ export function encodeText(text) {
388
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
389
+ const len0 = WASM_VECTOR_LEN;
390
+ const ret = wasm.encodeText(ptr0, len0);
423
391
  if (ret[2]) {
424
392
  throw takeFromExternrefTable0(ret[1]);
425
393
  }
@@ -427,11 +395,11 @@ export function encodeRemoteAttachment(remote_attachment) {
427
395
  }
428
396
 
429
397
  /**
430
- * @param {WalletSendCalls} wallet_send_calls
398
+ * @param {Intent} intent
431
399
  * @returns {EncodedContent}
432
400
  */
433
- export function encodeWalletSendCalls(wallet_send_calls) {
434
- const ret = wasm.encodeWalletSendCalls(wallet_send_calls);
401
+ export function encodeIntent(intent) {
402
+ const ret = wasm.encodeIntent(intent);
435
403
  if (ret[2]) {
436
404
  throw takeFromExternrefTable0(ret[1]);
437
405
  }
@@ -441,17 +409,19 @@ export function encodeWalletSendCalls(wallet_send_calls) {
441
409
  /**
442
410
  * @returns {ContentTypeId}
443
411
  */
444
- export function walletSendCallsContentType() {
445
- const ret = wasm.walletSendCallsContentType();
412
+ export function contentTypeIntent() {
413
+ const ret = wasm.contentTypeIntent();
446
414
  return ret;
447
415
  }
448
416
 
449
417
  /**
450
- * @param {TransactionReference} transaction_reference
418
+ * @param {string} text
451
419
  * @returns {EncodedContent}
452
420
  */
453
- export function encodeTransactionReference(transaction_reference) {
454
- const ret = wasm.encodeTransactionReference(transaction_reference);
421
+ export function encodeMarkdown(text) {
422
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ const ret = wasm.encodeMarkdown(ptr0, len0);
455
425
  if (ret[2]) {
456
426
  throw takeFromExternrefTable0(ret[1]);
457
427
  }
@@ -461,17 +431,17 @@ export function encodeTransactionReference(transaction_reference) {
461
431
  /**
462
432
  * @returns {ContentTypeId}
463
433
  */
464
- export function transactionReferenceContentType() {
465
- const ret = wasm.transactionReferenceContentType();
434
+ export function contentTypeMarkdown() {
435
+ const ret = wasm.contentTypeMarkdown();
466
436
  return ret;
467
437
  }
468
438
 
469
439
  /**
470
- * @param {MultiRemoteAttachment} multi_remote_attachment
440
+ * @param {Reaction} reaction
471
441
  * @returns {EncodedContent}
472
442
  */
473
- export function encodeMultiRemoteAttachment(multi_remote_attachment) {
474
- const ret = wasm.encodeMultiRemoteAttachment(multi_remote_attachment);
443
+ export function encodeReaction(reaction) {
444
+ const ret = wasm.encodeReaction(reaction);
475
445
  if (ret[2]) {
476
446
  throw takeFromExternrefTable0(ret[1]);
477
447
  }
@@ -481,120 +451,152 @@ export function encodeMultiRemoteAttachment(multi_remote_attachment) {
481
451
  /**
482
452
  * @returns {ContentTypeId}
483
453
  */
484
- export function multiRemoteAttachmentContentType() {
485
- const ret = wasm.multiRemoteAttachmentContentType();
454
+ export function contentTypeReaction() {
455
+ const ret = wasm.contentTypeReaction();
486
456
  return ret;
487
457
  }
488
458
 
489
459
  /**
490
- * @param {string} text
491
- * @returns {EncodedContent}
460
+ * Import a database from a byte array into OPFS.
461
+ * This will overwrite any existing database with the same name.
462
+ * The byte array must contain a valid SQLite database.
463
+ * Note: Any existing database with the same name must be closed before importing.
464
+ * @param {string} filename
465
+ * @param {Uint8Array} data
466
+ * @returns {Promise<void>}
492
467
  */
493
- export function encodeText(text) {
494
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
468
+ export function opfsImportDb(filename, data) {
469
+ const ptr0 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
495
470
  const len0 = WASM_VECTOR_LEN;
496
- const ret = wasm.encodeText(ptr0, len0);
497
- if (ret[2]) {
498
- throw takeFromExternrefTable0(ret[1]);
499
- }
500
- return takeFromExternrefTable0(ret[0]);
471
+ const ret = wasm.opfsImportDb(ptr0, len0, data);
472
+ return ret;
501
473
  }
502
474
 
503
475
  /**
504
- * @returns {ContentTypeId}
476
+ * List all database files stored in OPFS.
477
+ * Returns an array of file names.
478
+ * @returns {Promise<string[]>}
505
479
  */
506
- export function textContentType() {
507
- const ret = wasm.textContentType();
480
+ export function opfsListFiles() {
481
+ const ret = wasm.opfsListFiles();
508
482
  return ret;
509
483
  }
510
484
 
511
485
  /**
512
- * @returns {ContentTypeId}
486
+ * Check if a database file exists in OPFS.
487
+ * @param {string} filename
488
+ * @returns {Promise<boolean>}
513
489
  */
514
- export function replyContentType() {
515
- const ret = wasm.replyContentType();
490
+ export function opfsFileExists(filename) {
491
+ const ptr0 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
492
+ const len0 = WASM_VECTOR_LEN;
493
+ const ret = wasm.opfsFileExists(ptr0, len0);
516
494
  return ret;
517
495
  }
518
496
 
519
497
  /**
520
- * @returns {ContentTypeId}
498
+ * Export a database file from OPFS as a byte array.
499
+ * This can be used to backup or transfer a database.
500
+ * Note: The database should be closed before exporting for consistency.
501
+ * @param {string} filename
502
+ * @returns {Promise<Uint8Array>}
521
503
  */
522
- export function intentContentType() {
523
- const ret = wasm.intentContentType();
504
+ export function opfsExportDb(filename) {
505
+ const ptr0 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
506
+ const len0 = WASM_VECTOR_LEN;
507
+ const ret = wasm.opfsExportDb(ptr0, len0);
524
508
  return ret;
525
509
  }
526
510
 
527
511
  /**
528
- * @param {Intent} intent
529
- * @returns {EncodedContent}
512
+ * Delete all database files from OPFS.
513
+ * Note: All databases must be closed before calling this function.
514
+ * @returns {Promise<void>}
530
515
  */
531
- export function encodeIntent(intent) {
532
- const ret = wasm.encodeIntent(intent);
533
- if (ret[2]) {
534
- throw takeFromExternrefTable0(ret[1]);
535
- }
536
- return takeFromExternrefTable0(ret[0]);
516
+ export function opfsClearAll() {
517
+ const ret = wasm.opfsClearAll();
518
+ return ret;
537
519
  }
538
520
 
539
521
  /**
540
- * @returns {ContentTypeId}
522
+ * Delete a specific database file from OPFS.
523
+ * Returns true if the file was deleted, false if it didn't exist.
524
+ * Note: The database must be closed before calling this function.
525
+ * @param {string} filename
526
+ * @returns {Promise<boolean>}
541
527
  */
542
- export function actionsContentType() {
543
- const ret = wasm.actionsContentType();
528
+ export function opfsDeleteFile(filename) {
529
+ const ptr0 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
530
+ const len0 = WASM_VECTOR_LEN;
531
+ const ret = wasm.opfsDeleteFile(ptr0, len0);
544
532
  return ret;
545
533
  }
546
534
 
547
535
  /**
548
- * @param {Actions} actions
549
- * @returns {EncodedContent}
536
+ * Get the current capacity of the OPFS file pool.
537
+ * @returns {Promise<number>}
550
538
  */
551
- export function encodeActions(actions) {
552
- const ret = wasm.encodeActions(actions);
553
- if (ret[2]) {
554
- throw takeFromExternrefTable0(ret[1]);
555
- }
556
- return takeFromExternrefTable0(ret[0]);
539
+ export function opfsPoolCapacity() {
540
+ const ret = wasm.opfsPoolCapacity();
541
+ return ret;
557
542
  }
558
543
 
559
544
  /**
560
- * @param {string} text
561
- * @returns {EncodedContent}
545
+ * Initialize the OPFS SQLite VFS if not already initialized.
546
+ * This must be called before using other OPFS functions.
547
+ * @returns {Promise<void>}
562
548
  */
563
- export function encodeMarkdown(text) {
564
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
565
- const len0 = WASM_VECTOR_LEN;
566
- const ret = wasm.encodeMarkdown(ptr0, len0);
567
- if (ret[2]) {
568
- throw takeFromExternrefTable0(ret[1]);
569
- }
570
- return takeFromExternrefTable0(ret[0]);
549
+ export function opfsInit() {
550
+ const ret = wasm.opfsInit();
551
+ return ret;
571
552
  }
572
553
 
573
554
  /**
574
- * @returns {ContentTypeId}
555
+ * Get the number of database files stored in OPFS.
556
+ * @returns {Promise<number>}
575
557
  */
576
- export function markdownContentType() {
577
- const ret = wasm.markdownContentType();
558
+ export function opfsFileCount() {
559
+ const ret = wasm.opfsFileCount();
578
560
  return ret;
579
561
  }
580
562
 
581
563
  /**
582
- * @param {Reaction} reaction
583
- * @returns {EncodedContent}
564
+ * @param {Identifier} accountIdentifier
565
+ * @param {bigint | null} [nonce]
566
+ * @returns {string}
584
567
  */
585
- export function encodeReaction(reaction) {
586
- const ret = wasm.encodeReaction(reaction);
587
- if (ret[2]) {
588
- throw takeFromExternrefTable0(ret[1]);
568
+ export function generateInboxId(accountIdentifier, nonce) {
569
+ let deferred2_0;
570
+ let deferred2_1;
571
+ try {
572
+ const ret = wasm.generateInboxId(accountIdentifier, !isLikeNone(nonce), isLikeNone(nonce) ? BigInt(0) : nonce);
573
+ var ptr1 = ret[0];
574
+ var len1 = ret[1];
575
+ if (ret[3]) {
576
+ ptr1 = 0; len1 = 0;
577
+ throw takeFromExternrefTable0(ret[2]);
578
+ }
579
+ deferred2_0 = ptr1;
580
+ deferred2_1 = len1;
581
+ return getStringFromWasm0(ptr1, len1);
582
+ } finally {
583
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
589
584
  }
590
- return takeFromExternrefTable0(ret[0]);
591
585
  }
592
586
 
593
587
  /**
594
- * @returns {ContentTypeId}
588
+ * @param {string} host
589
+ * @param {string | null | undefined} gatewayHost
590
+ * @param {boolean} isSecure
591
+ * @param {Identifier} accountIdentifier
592
+ * @returns {Promise<string | undefined>}
595
593
  */
596
- export function reactionContentType() {
597
- const ret = wasm.reactionContentType();
594
+ export function getInboxIdForIdentifier(host, gatewayHost, isSecure, accountIdentifier) {
595
+ const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
596
+ const len0 = WASM_VECTOR_LEN;
597
+ var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
598
+ var len1 = WASM_VECTOR_LEN;
599
+ const ret = wasm.getInboxIdForIdentifier(ptr0, len0, ptr1, len1, isSecure, accountIdentifier);
598
600
  return ret;
599
601
  }
600
602
 
@@ -634,46 +636,167 @@ export function createClient(host, inboxId, accountIdentifier, dbPath, encryptio
634
636
  _assertClass(authHandle, AuthHandle);
635
637
  ptr6 = authHandle.__destroy_into_raw();
636
638
  }
637
- const ret = wasm.createClient(ptr0, len0, ptr1, len1, accountIdentifier, ptr2, len2, isLikeNone(encryptionKey) ? 0 : addToExternrefTable0(encryptionKey), ptr3, len3, isLikeNone(deviceSyncWorkerMode) ? 0 : addToExternrefTable0(deviceSyncWorkerMode), isLikeNone(logOptions) ? 0 : addToExternrefTable0(logOptions), isLikeNone(allowOffline) ? 0xFFFFFF : allowOffline ? 1 : 0, ptr4, len4, ptr5, len5, !isLikeNone(nonce), isLikeNone(nonce) ? BigInt(0) : nonce, isLikeNone(authCallback) ? 0 : addToExternrefTable0(authCallback), ptr6, isLikeNone(clientMode) ? 0 : addToExternrefTable0(clientMode));
639
+ const ret = wasm.createClient(ptr0, len0, ptr1, len1, accountIdentifier, ptr2, len2, isLikeNone(encryptionKey) ? 0 : addToExternrefTable0(encryptionKey), ptr3, len3, isLikeNone(deviceSyncWorkerMode) ? 2 : deviceSyncWorkerMode, isLikeNone(logOptions) ? 0 : addToExternrefTable0(logOptions), isLikeNone(allowOffline) ? 0xFFFFFF : allowOffline ? 1 : 0, ptr4, len4, ptr5, len5, !isLikeNone(nonce), isLikeNone(nonce) ? BigInt(0) : nonce, isLikeNone(authCallback) ? 0 : addToExternrefTable0(authCallback), ptr6, isLikeNone(clientMode) ? 2 : clientMode);
638
640
  return ret;
639
641
  }
640
642
 
641
643
  /**
642
- * @param {Identifier} accountIdentifier
643
- * @param {bigint | null} [nonce]
644
- * @returns {string}
644
+ * @param {ReadReceipt} read_receipt
645
+ * @returns {EncodedContent}
645
646
  */
646
- export function generateInboxId(accountIdentifier, nonce) {
647
- let deferred2_0;
648
- let deferred2_1;
649
- try {
650
- const ret = wasm.generateInboxId(accountIdentifier, !isLikeNone(nonce), isLikeNone(nonce) ? BigInt(0) : nonce);
651
- var ptr1 = ret[0];
652
- var len1 = ret[1];
653
- if (ret[3]) {
654
- ptr1 = 0; len1 = 0;
655
- throw takeFromExternrefTable0(ret[2]);
656
- }
657
- deferred2_0 = ptr1;
658
- deferred2_1 = len1;
659
- return getStringFromWasm0(ptr1, len1);
660
- } finally {
661
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
647
+ export function encodeReadReceipt(read_receipt) {
648
+ const ret = wasm.encodeReadReceipt(read_receipt);
649
+ if (ret[2]) {
650
+ throw takeFromExternrefTable0(ret[1]);
651
+ }
652
+ return takeFromExternrefTable0(ret[0]);
653
+ }
654
+
655
+ /**
656
+ * @returns {ContentTypeId}
657
+ */
658
+ export function contentTypeReadReceipt() {
659
+ const ret = wasm.contentTypeReadReceipt();
660
+ return ret;
661
+ }
662
+
663
+ /**
664
+ * @returns {ContentTypeId}
665
+ */
666
+ export function contentTypeRemoteAttachment() {
667
+ const ret = wasm.contentTypeRemoteAttachment();
668
+ return ret;
669
+ }
670
+
671
+ function passArray8ToWasm0(arg, malloc) {
672
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
673
+ getUint8ArrayMemory0().set(arg, ptr / 1);
674
+ WASM_VECTOR_LEN = arg.length;
675
+ return ptr;
676
+ }
677
+ /**
678
+ * Decrypts an encrypted payload from a remote attachment.
679
+ * @param {Uint8Array} encryptedBytes
680
+ * @param {RemoteAttachment} remoteAttachment
681
+ * @returns {Attachment}
682
+ */
683
+ export function decryptAttachment(encryptedBytes, remoteAttachment) {
684
+ const ptr0 = passArray8ToWasm0(encryptedBytes, wasm.__wbindgen_malloc);
685
+ const len0 = WASM_VECTOR_LEN;
686
+ const ret = wasm.decryptAttachment(ptr0, len0, remoteAttachment);
687
+ if (ret[2]) {
688
+ throw takeFromExternrefTable0(ret[1]);
689
+ }
690
+ return takeFromExternrefTable0(ret[0]);
691
+ }
692
+
693
+ /**
694
+ * @param {RemoteAttachment} remote_attachment
695
+ * @returns {EncodedContent}
696
+ */
697
+ export function encodeRemoteAttachment(remote_attachment) {
698
+ const ret = wasm.encodeRemoteAttachment(remote_attachment);
699
+ if (ret[2]) {
700
+ throw takeFromExternrefTable0(ret[1]);
701
+ }
702
+ return takeFromExternrefTable0(ret[0]);
703
+ }
704
+
705
+ /**
706
+ * Encrypts an attachment for storage as a remote attachment.
707
+ * @param {Attachment} attachment
708
+ * @returns {EncryptedAttachment}
709
+ */
710
+ export function encryptAttachment(attachment) {
711
+ const ret = wasm.encryptAttachment(attachment);
712
+ if (ret[2]) {
713
+ throw takeFromExternrefTable0(ret[1]);
714
+ }
715
+ return takeFromExternrefTable0(ret[0]);
716
+ }
717
+
718
+ /**
719
+ * @param {WalletSendCalls} wallet_send_calls
720
+ * @returns {EncodedContent}
721
+ */
722
+ export function encodeWalletSendCalls(wallet_send_calls) {
723
+ const ret = wasm.encodeWalletSendCalls(wallet_send_calls);
724
+ if (ret[2]) {
725
+ throw takeFromExternrefTable0(ret[1]);
726
+ }
727
+ return takeFromExternrefTable0(ret[0]);
728
+ }
729
+
730
+ /**
731
+ * @returns {ContentTypeId}
732
+ */
733
+ export function contentTypeWalletSendCalls() {
734
+ const ret = wasm.contentTypeWalletSendCalls();
735
+ return ret;
736
+ }
737
+
738
+ /**
739
+ * @param {TransactionReference} transaction_reference
740
+ * @returns {EncodedContent}
741
+ */
742
+ export function encodeTransactionReference(transaction_reference) {
743
+ const ret = wasm.encodeTransactionReference(transaction_reference);
744
+ if (ret[2]) {
745
+ throw takeFromExternrefTable0(ret[1]);
662
746
  }
747
+ return takeFromExternrefTable0(ret[0]);
748
+ }
749
+
750
+ /**
751
+ * @returns {ContentTypeId}
752
+ */
753
+ export function contentTypeTransactionReference() {
754
+ const ret = wasm.contentTypeTransactionReference();
755
+ return ret;
756
+ }
757
+
758
+ /**
759
+ * @returns {ContentTypeId}
760
+ */
761
+ export function contentTypeReply() {
762
+ const ret = wasm.contentTypeReply();
763
+ return ret;
764
+ }
765
+
766
+ /**
767
+ * @param {Actions} actions
768
+ * @returns {EncodedContent}
769
+ */
770
+ export function encodeActions(actions) {
771
+ const ret = wasm.encodeActions(actions);
772
+ if (ret[2]) {
773
+ throw takeFromExternrefTable0(ret[1]);
774
+ }
775
+ return takeFromExternrefTable0(ret[0]);
776
+ }
777
+
778
+ /**
779
+ * @returns {ContentTypeId}
780
+ */
781
+ export function contentTypeActions() {
782
+ const ret = wasm.contentTypeActions();
783
+ return ret;
663
784
  }
664
785
 
665
786
  /**
666
787
  * @param {string} host
667
788
  * @param {string | null | undefined} gatewayHost
668
- * @param {Identifier} accountIdentifier
669
- * @returns {Promise<string | undefined>}
789
+ * @param {string[]} inboxIds
790
+ * @returns {Promise<InboxState[]>}
670
791
  */
671
- export function getInboxIdForIdentifier(host, gatewayHost, accountIdentifier) {
792
+ export function inboxStateFromInboxIds(host, gatewayHost, inboxIds) {
672
793
  const ptr0 = passStringToWasm0(host, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
673
794
  const len0 = WASM_VECTOR_LEN;
674
795
  var ptr1 = isLikeNone(gatewayHost) ? 0 : passStringToWasm0(gatewayHost, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
675
796
  var len1 = WASM_VECTOR_LEN;
676
- const ret = wasm.getInboxIdForIdentifier(ptr0, len0, ptr1, len1, accountIdentifier);
797
+ const ptr2 = passArrayJsValueToWasm0(inboxIds, wasm.__wbindgen_malloc);
798
+ const len2 = WASM_VECTOR_LEN;
799
+ const ret = wasm.inboxStateFromInboxIds(ptr0, len0, ptr1, len1, ptr2, len2);
677
800
  return ret;
678
801
  }
679
802
 
@@ -688,6 +811,10 @@ export function task_worker_entry_point(ptr) {
688
811
  }
689
812
  }
690
813
 
814
+ function wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1) {
815
+ wasm.wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1);
816
+ }
817
+
691
818
  function wasm_bindgen__convert__closures_____invoke__hceddd2b8fc291040(arg0, arg1) {
692
819
  wasm.wasm_bindgen__convert__closures_____invoke__hceddd2b8fc291040(arg0, arg1);
693
820
  }
@@ -700,14 +827,214 @@ function wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1(arg0, arg
700
827
  wasm.wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1(arg0, arg1);
701
828
  }
702
829
 
703
- function wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1) {
704
- wasm.wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005(arg0, arg1);
705
- }
706
-
707
830
  function wasm_bindgen__convert__closures_____invoke__h47a8fb56fc48c5fb(arg0, arg1, arg2, arg3) {
708
831
  wasm.wasm_bindgen__convert__closures_____invoke__h47a8fb56fc48c5fb(arg0, arg1, arg2, arg3);
709
832
  }
710
833
 
834
+ /**
835
+ * @enum {0 | 1 | 2}
836
+ */
837
+ export const ActionStyle = Object.freeze({
838
+ Primary: 0, "0": "Primary",
839
+ Secondary: 1, "1": "Secondary",
840
+ Danger: 2, "2": "Danger",
841
+ });
842
+ /**
843
+ * @enum {0 | 1}
844
+ */
845
+ export const ClientMode = Object.freeze({
846
+ Default: 0, "0": "Default",
847
+ Notification: 1, "1": "Notification",
848
+ });
849
+ /**
850
+ * @enum {0 | 1}
851
+ */
852
+ export const ConsentEntityType = Object.freeze({
853
+ GroupId: 0, "0": "GroupId",
854
+ InboxId: 1, "1": "InboxId",
855
+ });
856
+ /**
857
+ * @enum {0 | 1 | 2}
858
+ */
859
+ export const ConsentState = Object.freeze({
860
+ Unknown: 0, "0": "Unknown",
861
+ Allowed: 1, "1": "Allowed",
862
+ Denied: 2, "2": "Denied",
863
+ });
864
+ /**
865
+ * @enum {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15}
866
+ */
867
+ export const ContentType = Object.freeze({
868
+ Actions: 0, "0": "Actions",
869
+ Attachment: 1, "1": "Attachment",
870
+ Custom: 2, "2": "Custom",
871
+ GroupMembershipChange: 3, "3": "GroupMembershipChange",
872
+ GroupUpdated: 4, "4": "GroupUpdated",
873
+ Intent: 5, "5": "Intent",
874
+ LeaveRequest: 6, "6": "LeaveRequest",
875
+ Markdown: 7, "7": "Markdown",
876
+ MultiRemoteAttachment: 8, "8": "MultiRemoteAttachment",
877
+ Reaction: 9, "9": "Reaction",
878
+ ReadReceipt: 10, "10": "ReadReceipt",
879
+ RemoteAttachment: 11, "11": "RemoteAttachment",
880
+ Reply: 12, "12": "Reply",
881
+ Text: 13, "13": "Text",
882
+ TransactionReference: 14, "14": "TransactionReference",
883
+ WalletSendCalls: 15, "15": "WalletSendCalls",
884
+ });
885
+ /**
886
+ * @enum {0 | 1 | 2 | 3}
887
+ */
888
+ export const ConversationType = Object.freeze({
889
+ Dm: 0, "0": "Dm",
890
+ Group: 1, "1": "Group",
891
+ Sync: 2, "2": "Sync",
892
+ Oneshot: 3, "3": "Oneshot",
893
+ });
894
+ /**
895
+ * @enum {0 | 1}
896
+ */
897
+ export const DeletedBy = Object.freeze({
898
+ Sender: 0, "0": "Sender",
899
+ Admin: 1, "1": "Admin",
900
+ });
901
+ /**
902
+ * @enum {0 | 1 | 2}
903
+ */
904
+ export const DeliveryStatus = Object.freeze({
905
+ Unpublished: 0, "0": "Unpublished",
906
+ Published: 1, "1": "Published",
907
+ Failed: 2, "2": "Failed",
908
+ });
909
+ /**
910
+ * @enum {0 | 1}
911
+ */
912
+ export const DeviceSyncWorkerMode = Object.freeze({
913
+ Enabled: 0, "0": "Enabled",
914
+ Disabled: 1, "1": "Disabled",
915
+ });
916
+ /**
917
+ * @enum {0 | 1 | 2 | 3 | 4}
918
+ */
919
+ export const GroupMembershipState = Object.freeze({
920
+ Allowed: 0, "0": "Allowed",
921
+ Rejected: 1, "1": "Rejected",
922
+ Pending: 2, "2": "Pending",
923
+ Restored: 3, "3": "Restored",
924
+ PendingRemove: 4, "4": "PendingRemove",
925
+ });
926
+ /**
927
+ * @enum {0 | 1}
928
+ */
929
+ export const GroupMessageKind = Object.freeze({
930
+ Application: 0, "0": "Application",
931
+ MembershipChange: 1, "1": "MembershipChange",
932
+ });
933
+ /**
934
+ * @enum {0 | 1 | 2}
935
+ */
936
+ export const GroupPermissionsOptions = Object.freeze({
937
+ Default: 0, "0": "Default",
938
+ AdminOnly: 1, "1": "AdminOnly",
939
+ CustomPolicy: 2, "2": "CustomPolicy",
940
+ });
941
+ /**
942
+ * @enum {0 | 1}
943
+ */
944
+ export const IdentifierKind = Object.freeze({
945
+ Ethereum: 0, "0": "Ethereum",
946
+ Passkey: 1, "1": "Passkey",
947
+ });
948
+ /**
949
+ * @enum {0 | 1}
950
+ */
951
+ export const ListConversationsOrderBy = Object.freeze({
952
+ CreatedAt: 0, "0": "CreatedAt",
953
+ LastActivity: 1, "1": "LastActivity",
954
+ });
955
+ /**
956
+ * @enum {0 | 1 | 2 | 3 | 4 | 5}
957
+ */
958
+ export const LogLevel = Object.freeze({
959
+ Off: 0, "0": "Off",
960
+ Error: 1, "1": "Error",
961
+ Warn: 2, "2": "Warn",
962
+ Info: 3, "3": "Info",
963
+ Debug: 4, "4": "Debug",
964
+ Trace: 5, "5": "Trace",
965
+ });
966
+ /**
967
+ * @enum {0 | 1}
968
+ */
969
+ export const MessageSortBy = Object.freeze({
970
+ SentAt: 0, "0": "SentAt",
971
+ InsertedAt: 1, "1": "InsertedAt",
972
+ });
973
+ /**
974
+ * @enum {0 | 1 | 2 | 3 | 4 | 5}
975
+ */
976
+ export const MetadataField = Object.freeze({
977
+ AppData: 0, "0": "AppData",
978
+ Description: 1, "1": "Description",
979
+ GroupName: 2, "2": "GroupName",
980
+ GroupImageUrlSquare: 3, "3": "GroupImageUrlSquare",
981
+ MessageExpirationFromNs: 4, "4": "MessageExpirationFromNs",
982
+ MessageExpirationInNs: 5, "5": "MessageExpirationInNs",
983
+ });
984
+ /**
985
+ * @enum {0 | 1 | 2}
986
+ */
987
+ export const PermissionLevel = Object.freeze({
988
+ Member: 0, "0": "Member",
989
+ Admin: 1, "1": "Admin",
990
+ SuperAdmin: 2, "2": "SuperAdmin",
991
+ });
992
+ /**
993
+ * @enum {0 | 1 | 2 | 3 | 4 | 5}
994
+ */
995
+ export const PermissionPolicy = Object.freeze({
996
+ Allow: 0, "0": "Allow",
997
+ Deny: 1, "1": "Deny",
998
+ Admin: 2, "2": "Admin",
999
+ SuperAdmin: 3, "3": "SuperAdmin",
1000
+ DoesNotExist: 4, "4": "DoesNotExist",
1001
+ Other: 5, "5": "Other",
1002
+ });
1003
+ /**
1004
+ * @enum {0 | 1 | 2 | 3 | 4}
1005
+ */
1006
+ export const PermissionUpdateType = Object.freeze({
1007
+ AddMember: 0, "0": "AddMember",
1008
+ RemoveMember: 1, "1": "RemoveMember",
1009
+ AddAdmin: 2, "2": "AddAdmin",
1010
+ RemoveAdmin: 3, "3": "RemoveAdmin",
1011
+ UpdateMetadata: 4, "4": "UpdateMetadata",
1012
+ });
1013
+ /**
1014
+ * @enum {0 | 1 | 2}
1015
+ */
1016
+ export const ReactionAction = Object.freeze({
1017
+ Unknown: 0, "0": "Unknown",
1018
+ Added: 1, "1": "Added",
1019
+ Removed: 2, "2": "Removed",
1020
+ });
1021
+ /**
1022
+ * @enum {0 | 1 | 2 | 3}
1023
+ */
1024
+ export const ReactionSchema = Object.freeze({
1025
+ Unknown: 0, "0": "Unknown",
1026
+ Unicode: 1, "1": "Unicode",
1027
+ Shortcode: 2, "2": "Shortcode",
1028
+ Custom: 3, "3": "Custom",
1029
+ });
1030
+ /**
1031
+ * @enum {0 | 1}
1032
+ */
1033
+ export const SortDirection = Object.freeze({
1034
+ Ascending: 0, "0": "Ascending",
1035
+ Descending: 1, "1": "Descending",
1036
+ });
1037
+
711
1038
  const __wbindgen_enum_ReadableStreamType = ["bytes"];
712
1039
 
713
1040
  const __wbindgen_enum_ReferrerPolicy = ["", "no-referrer", "no-referrer-when-downgrade", "origin", "origin-when-cross-origin", "unsafe-url", "same-origin", "strict-origin", "strict-origin-when-cross-origin"];
@@ -882,42 +1209,24 @@ export class Client {
882
1209
  return ret;
883
1210
  }
884
1211
  /**
885
- *
886
- * * Get the client's inbox state.
887
- * *
888
- * * If `refresh_from_network` is true, the client will go to the network first to refresh the state.
889
- * * Otherwise, the state will be read from the local database.
890
- *
891
- * @param {boolean} refreshFromNetwork
892
- * @returns {Promise<InboxState>}
893
- */
894
- inboxState(refreshFromNetwork) {
895
- const ret = wasm.client_inboxState(this.__wbg_ptr, refreshFromNetwork);
896
- return ret;
897
- }
898
- /**
899
- * @param {string} inboxId
900
- * @returns {Promise<InboxState>}
1212
+ * @param {ConsentEntityType} entityType
1213
+ * @param {string} entity
1214
+ * @returns {Promise<ConsentState>}
901
1215
  */
902
- getLatestInboxState(inboxId) {
903
- const ptr0 = passStringToWasm0(inboxId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1216
+ getConsentState(entityType, entity) {
1217
+ const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
904
1218
  const len0 = WASM_VECTOR_LEN;
905
- const ret = wasm.client_getLatestInboxState(this.__wbg_ptr, ptr0, len0);
1219
+ const ret = wasm.client_getConsentState(this.__wbg_ptr, entityType, ptr0, len0);
906
1220
  return ret;
907
1221
  }
908
1222
  /**
909
- *
910
- * * Get key package statuses for a list of installation IDs.
911
- * *
912
- * * Returns a JavaScript object mapping installation ID strings to KeyPackageStatus objects.
913
- *
914
- * @param {string[]} installationIds
915
- * @returns {Promise<any>}
1223
+ * @param {Consent[]} records
1224
+ * @returns {Promise<void>}
916
1225
  */
917
- getKeyPackageStatusesForInstallationIds(installationIds) {
918
- const ptr0 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
1226
+ setConsentStates(records) {
1227
+ const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
919
1228
  const len0 = WASM_VECTOR_LEN;
920
- const ret = wasm.client_getKeyPackageStatusesForInstallationIds(this.__wbg_ptr, ptr0, len0);
1229
+ const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
921
1230
  return ret;
922
1231
  }
923
1232
  /**
@@ -1085,24 +1394,42 @@ export class Client {
1085
1394
  }
1086
1395
  }
1087
1396
  /**
1088
- * @param {ConsentEntityType} entityType
1089
- * @param {string} entity
1090
- * @returns {Promise<ConsentState>}
1397
+ *
1398
+ * * Get the client's inbox state.
1399
+ * *
1400
+ * * If `refresh_from_network` is true, the client will go to the network first to refresh the state.
1401
+ * * Otherwise, the state will be read from the local database.
1402
+ *
1403
+ * @param {boolean} refreshFromNetwork
1404
+ * @returns {Promise<InboxState>}
1091
1405
  */
1092
- getConsentState(entityType, entity) {
1093
- const ptr0 = passStringToWasm0(entity, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1406
+ inboxState(refreshFromNetwork) {
1407
+ const ret = wasm.client_inboxState(this.__wbg_ptr, refreshFromNetwork);
1408
+ return ret;
1409
+ }
1410
+ /**
1411
+ * @param {string} inboxId
1412
+ * @returns {Promise<InboxState>}
1413
+ */
1414
+ getLatestInboxState(inboxId) {
1415
+ const ptr0 = passStringToWasm0(inboxId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1094
1416
  const len0 = WASM_VECTOR_LEN;
1095
- const ret = wasm.client_getConsentState(this.__wbg_ptr, entityType, ptr0, len0);
1417
+ const ret = wasm.client_getLatestInboxState(this.__wbg_ptr, ptr0, len0);
1096
1418
  return ret;
1097
1419
  }
1098
1420
  /**
1099
- * @param {Consent[]} records
1100
- * @returns {Promise<void>}
1421
+ *
1422
+ * * Get key package statuses for a list of installation IDs.
1423
+ * *
1424
+ * * Returns a JavaScript object mapping installation ID strings to KeyPackageStatus objects.
1425
+ *
1426
+ * @param {string[]} installationIds
1427
+ * @returns {Promise<any>}
1101
1428
  */
1102
- setConsentStates(records) {
1103
- const ptr0 = passArrayJsValueToWasm0(records, wasm.__wbindgen_malloc);
1429
+ getKeyPackageStatusesForInstallationIds(installationIds) {
1430
+ const ptr0 = passArrayJsValueToWasm0(installationIds, wasm.__wbindgen_malloc);
1104
1431
  const len0 = WASM_VECTOR_LEN;
1105
- const ret = wasm.client_setConsentStates(this.__wbg_ptr, ptr0, len0);
1432
+ const ret = wasm.client_getKeyPackageStatusesForInstallationIds(this.__wbg_ptr, ptr0, len0);
1106
1433
  return ret;
1107
1434
  }
1108
1435
  }
@@ -1328,25 +1655,17 @@ export class Conversation {
1328
1655
  return ret;
1329
1656
  }
1330
1657
  /**
1331
- * @param {Attachment} attachment
1332
- * @param {boolean | null} [optimistic]
1333
- * @returns {Promise<string>}
1334
- */
1335
- sendAttachment(attachment, optimistic) {
1336
- const ret = wasm.conversation_sendAttachment(this.__wbg_ptr, attachment, isLikeNone(optimistic) ? 0xFFFFFF : optimistic ? 1 : 0);
1337
- return ret;
1338
- }
1339
- /**
1340
- * send a message without immediately publishing to the delivery service.
1658
+ * Prepare a message for later publishing.
1659
+ * Stores the message locally without publishing. Returns the message ID.
1341
1660
  * @param {EncodedContent} encodedContent
1342
- * @param {SendMessageOpts} opts
1661
+ * @param {boolean} shouldPush
1343
1662
  * @returns {string}
1344
1663
  */
1345
- sendOptimistic(encodedContent, opts) {
1664
+ prepareMessage(encodedContent, shouldPush) {
1346
1665
  let deferred2_0;
1347
1666
  let deferred2_1;
1348
1667
  try {
1349
- const ret = wasm.conversation_sendOptimistic(this.__wbg_ptr, encodedContent, opts);
1668
+ const ret = wasm.conversation_prepareMessage(this.__wbg_ptr, encodedContent, shouldPush);
1350
1669
  var ptr1 = ret[0];
1351
1670
  var len1 = ret[1];
1352
1671
  if (ret[3]) {
@@ -1360,6 +1679,15 @@ export class Conversation {
1360
1679
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1361
1680
  }
1362
1681
  }
1682
+ /**
1683
+ * @param {Attachment} attachment
1684
+ * @param {boolean | null} [optimistic]
1685
+ * @returns {Promise<string>}
1686
+ */
1687
+ sendAttachment(attachment, optimistic) {
1688
+ const ret = wasm.conversation_sendAttachment(this.__wbg_ptr, attachment, isLikeNone(optimistic) ? 0xFFFFFF : optimistic ? 1 : 0);
1689
+ return ret;
1690
+ }
1363
1691
  /**
1364
1692
  * @param {string} appData
1365
1693
  * @returns {Promise<void>}
@@ -1399,7 +1727,7 @@ export class Conversation {
1399
1727
  if (ret[2]) {
1400
1728
  throw takeFromExternrefTable0(ret[1]);
1401
1729
  }
1402
- return takeFromExternrefTable0(ret[0]);
1730
+ return ret[0];
1403
1731
  }
1404
1732
  /**
1405
1733
  * Publish all unpublished messages
@@ -1559,6 +1887,17 @@ export class Conversation {
1559
1887
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
1560
1888
  }
1561
1889
  }
1890
+ /**
1891
+ * Publish a previously prepared message by ID.
1892
+ * @param {string} messageId
1893
+ * @returns {Promise<void>}
1894
+ */
1895
+ publishStoredMessage(messageId) {
1896
+ const ptr0 = passStringToWasm0(messageId, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1897
+ const len0 = WASM_VECTOR_LEN;
1898
+ const ret = wasm.conversation_publishStoredMessage(this.__wbg_ptr, ptr0, len0);
1899
+ return ret;
1900
+ }
1562
1901
  /**
1563
1902
  * @param {RemoteAttachment} remoteAttachment
1564
1903
  * @param {boolean | null} [optimistic]
@@ -1604,7 +1943,7 @@ export class Conversation {
1604
1943
  * @returns {Promise<void>}
1605
1944
  */
1606
1945
  updatePermissionPolicy(permissionUpdateType, permissionPolicyOption, metadataField) {
1607
- const ret = wasm.conversation_updatePermissionPolicy(this.__wbg_ptr, permissionUpdateType, permissionPolicyOption, isLikeNone(metadataField) ? 0 : addToExternrefTable0(metadataField));
1946
+ const ret = wasm.conversation_updatePermissionPolicy(this.__wbg_ptr, permissionUpdateType, permissionPolicyOption, isLikeNone(metadataField) ? 6 : metadataField);
1608
1947
  return ret;
1609
1948
  }
1610
1949
  /**
@@ -1626,14 +1965,6 @@ export class Conversation {
1626
1965
  const ret = wasm.conversation_sendTransactionReference(this.__wbg_ptr, transactionReference, isLikeNone(optimistic) ? 0xFFFFFF : optimistic ? 1 : 0);
1627
1966
  return ret;
1628
1967
  }
1629
- /**
1630
- * @param {ListMessagesOptions | null} [opts]
1631
- * @returns {Promise<MessageWithReactions[]>}
1632
- */
1633
- findMessagesWithReactions(opts) {
1634
- const ret = wasm.conversation_findMessagesWithReactions(this.__wbg_ptr, isLikeNone(opts) ? 0 : addToExternrefTable0(opts));
1635
- return ret;
1636
- }
1637
1968
  /**
1638
1969
  * @param {MultiRemoteAttachment} multiRemoteAttachment
1639
1970
  * @param {boolean | null} [optimistic]
@@ -1811,7 +2142,7 @@ export class Conversation {
1811
2142
  if (ret[2]) {
1812
2143
  throw takeFromExternrefTable0(ret[1]);
1813
2144
  }
1814
- return takeFromExternrefTable0(ret[0]);
2145
+ return ret[0];
1815
2146
  }
1816
2147
  /**
1817
2148
  * @param {ConsentState} state
@@ -1979,7 +2310,7 @@ export class Conversations {
1979
2310
  }
1980
2311
  /**
1981
2312
  * @param {Identifier} accountIdentifier
1982
- * @param {CreateDMOptions | null} [options]
2313
+ * @param {CreateDmOptions | null} [options]
1983
2314
  * @returns {Promise<Conversation>}
1984
2315
  */
1985
2316
  createDm(accountIdentifier, options) {
@@ -2013,13 +2344,13 @@ export class Conversations {
2013
2344
  /**
2014
2345
  * @param {any} callback
2015
2346
  * @param {ConversationType | null} [conversationType]
2016
- * @param {ConsentState[] | null} [consentStates]
2347
+ * @param {any[] | null} [consentStates]
2017
2348
  * @returns {StreamCloser}
2018
2349
  */
2019
2350
  streamAllMessages(callback, conversationType, consentStates) {
2020
2351
  var ptr0 = isLikeNone(consentStates) ? 0 : passArrayJsValueToWasm0(consentStates, wasm.__wbindgen_malloc);
2021
2352
  var len0 = WASM_VECTOR_LEN;
2022
- const ret = wasm.conversations_streamAllMessages(this.__wbg_ptr, callback, isLikeNone(conversationType) ? 0 : addToExternrefTable0(conversationType), ptr0, len0);
2353
+ const ret = wasm.conversations_streamAllMessages(this.__wbg_ptr, callback, isLikeNone(conversationType) ? 4 : conversationType, ptr0, len0);
2023
2354
  if (ret[2]) {
2024
2355
  throw takeFromExternrefTable0(ret[1]);
2025
2356
  }
@@ -2039,7 +2370,7 @@ export class Conversations {
2039
2370
  return ret[0] >>> 0;
2040
2371
  }
2041
2372
  /**
2042
- * @param {ConsentState[] | null} [consentStates]
2373
+ * @param {any[] | null} [consentStates]
2043
2374
  * @returns {Promise<GroupSyncSummary>}
2044
2375
  */
2045
2376
  syncAllConversations(consentStates) {
@@ -2100,7 +2431,7 @@ export class Conversations {
2100
2431
  * @returns {Promise<ReadableStream>}
2101
2432
  */
2102
2433
  streamLocal(conversationType) {
2103
- const ret = wasm.conversations_streamLocal(this.__wbg_ptr, isLikeNone(conversationType) ? 0 : addToExternrefTable0(conversationType));
2434
+ const ret = wasm.conversations_streamLocal(this.__wbg_ptr, isLikeNone(conversationType) ? 4 : conversationType);
2104
2435
  return ret;
2105
2436
  }
2106
2437
  /**
@@ -2115,7 +2446,7 @@ export class Conversations {
2115
2446
  }
2116
2447
  /**
2117
2448
  * @param {string} inboxId
2118
- * @param {CreateDMOptions | null} [options]
2449
+ * @param {CreateDmOptions | null} [options]
2119
2450
  * @returns {Promise<Conversation>}
2120
2451
  */
2121
2452
  createDmByInboxId(inboxId, options) {
@@ -2148,7 +2479,7 @@ export class Conversations {
2148
2479
  * @returns {StreamCloser}
2149
2480
  */
2150
2481
  stream(callback, conversationType) {
2151
- const ret = wasm.conversations_stream(this.__wbg_ptr, callback, isLikeNone(conversationType) ? 0 : addToExternrefTable0(conversationType));
2482
+ const ret = wasm.conversations_stream(this.__wbg_ptr, callback, isLikeNone(conversationType) ? 4 : conversationType);
2152
2483
  if (ret[2]) {
2153
2484
  throw takeFromExternrefTable0(ret[1]);
2154
2485
  }
@@ -2157,6 +2488,59 @@ export class Conversations {
2157
2488
  }
2158
2489
  if (Symbol.dispose) Conversations.prototype[Symbol.dispose] = Conversations.prototype.free;
2159
2490
 
2491
+ const DeletedMessageFinalization = (typeof FinalizationRegistry === 'undefined')
2492
+ ? { register: () => {}, unregister: () => {} }
2493
+ : new FinalizationRegistry(ptr => wasm.__wbg_deletedmessage_free(ptr >>> 0, 1));
2494
+
2495
+ export class DeletedMessage {
2496
+
2497
+ __destroy_into_raw() {
2498
+ const ptr = this.__wbg_ptr;
2499
+ this.__wbg_ptr = 0;
2500
+ DeletedMessageFinalization.unregister(this);
2501
+ return ptr;
2502
+ }
2503
+
2504
+ free() {
2505
+ const ptr = this.__destroy_into_raw();
2506
+ wasm.__wbg_deletedmessage_free(ptr, 0);
2507
+ }
2508
+ /**
2509
+ * @returns {DeletedBy}
2510
+ */
2511
+ get deletedBy() {
2512
+ const ret = wasm.__wbg_get_deletedmessage_deletedBy(this.__wbg_ptr);
2513
+ return ret;
2514
+ }
2515
+ /**
2516
+ * @param {DeletedBy} arg0
2517
+ */
2518
+ set deletedBy(arg0) {
2519
+ wasm.__wbg_set_deletedmessage_deletedBy(this.__wbg_ptr, arg0);
2520
+ }
2521
+ /**
2522
+ * @returns {string | undefined}
2523
+ */
2524
+ get adminInboxId() {
2525
+ const ret = wasm.__wbg_get_deletedmessage_adminInboxId(this.__wbg_ptr);
2526
+ let v1;
2527
+ if (ret[0] !== 0) {
2528
+ v1 = getStringFromWasm0(ret[0], ret[1]).slice();
2529
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
2530
+ }
2531
+ return v1;
2532
+ }
2533
+ /**
2534
+ * @param {string | null} [arg0]
2535
+ */
2536
+ set adminInboxId(arg0) {
2537
+ var ptr0 = isLikeNone(arg0) ? 0 : passStringToWasm0(arg0, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2538
+ var len0 = WASM_VECTOR_LEN;
2539
+ wasm.__wbg_set_deletedmessage_adminInboxId(this.__wbg_ptr, ptr0, len0);
2540
+ }
2541
+ }
2542
+ if (Symbol.dispose) DeletedMessage.prototype[Symbol.dispose] = DeletedMessage.prototype.free;
2543
+
2160
2544
  const IntoUnderlyingByteSourceFinalization = (typeof FinalizationRegistry === 'undefined')
2161
2545
  ? { register: () => {}, unregister: () => {} }
2162
2546
  : new FinalizationRegistry(ptr => wasm.__wbg_intounderlyingbytesource_free(ptr >>> 0, 1));
@@ -2537,6 +2921,12 @@ function __wbg_get_imports() {
2537
2921
  imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
2538
2922
  throw new Error(getStringFromWasm0(arg0, arg1));
2539
2923
  };
2924
+ imports.wbg.__wbg___wbindgen_try_into_number_e60ef6e208abc399 = function(arg0) {
2925
+ let result;
2926
+ try { result = +arg0 } catch (e) { result = e }
2927
+ const ret = result;
2928
+ return ret;
2929
+ };
2540
2930
  imports.wbg.__wbg__wbg_cb_unref_2454a539ea5790d9 = function(arg0) {
2541
2931
  arg0._wbg_cb_unref();
2542
2932
  };
@@ -2615,6 +3005,9 @@ function __wbg_get_imports() {
2615
3005
  imports.wbg.__wbg_close_6956df845478561a = function() { return handleError(function (arg0) {
2616
3006
  arg0.close();
2617
3007
  }, arguments) };
3008
+ imports.wbg.__wbg_close_6b987dbb02427741 = function(arg0) {
3009
+ arg0.close();
3010
+ };
2618
3011
  imports.wbg.__wbg_code_218f5fdf8c7fcabd = function(arg0) {
2619
3012
  const ret = arg0.code;
2620
3013
  return ret;
@@ -3046,37 +3439,29 @@ function __wbg_get_imports() {
3046
3439
  const ret = Date.now();
3047
3440
  return ret;
3048
3441
  };
3049
- imports.wbg.__wbg_on_auth_required_4d27971fad5718ff = function() { return handleError(function (arg0) {
3442
+ imports.wbg.__wbg_on_auth_required_975519af8ba0af3b = function() { return handleError(function (arg0) {
3050
3443
  const ret = arg0.on_auth_required();
3051
3444
  return ret;
3052
3445
  }, arguments) };
3053
- imports.wbg.__wbg_on_close_14821f03bb5ede2f = function(arg0) {
3446
+ imports.wbg.__wbg_on_close_01e7d08665451df5 = function(arg0) {
3054
3447
  arg0.on_close();
3055
3448
  };
3056
- imports.wbg.__wbg_on_consent_update_dc96dde83bbb726e = function(arg0, arg1) {
3449
+ imports.wbg.__wbg_on_consent_update_6bf5ca12f36a50e4 = function(arg0, arg1) {
3057
3450
  arg0.on_consent_update(arg1);
3058
3451
  };
3059
- imports.wbg.__wbg_on_conversation_d996b7e46a9c857e = function(arg0, arg1) {
3452
+ imports.wbg.__wbg_on_conversation_3cbfe1b8e7235c0d = function(arg0, arg1) {
3060
3453
  arg0.on_conversation(Conversation.__wrap(arg1));
3061
3454
  };
3062
- imports.wbg.__wbg_on_error_718c5bce4272e57a = function(arg0, arg1) {
3455
+ imports.wbg.__wbg_on_error_56204a0c937c5bf5 = function(arg0, arg1) {
3063
3456
  arg0.on_error(arg1);
3064
3457
  };
3065
- imports.wbg.__wbg_on_message_d08be52589042a46 = function(arg0, arg1) {
3066
- arg0.on_message(arg1);
3458
+ imports.wbg.__wbg_on_message_deleted_4820d2dc739612d0 = function(arg0, arg1) {
3459
+ arg0.on_message_deleted(arg1);
3067
3460
  };
3068
- imports.wbg.__wbg_on_message_deleted_48a1c63e2869646f = function(arg0, arg1, arg2) {
3069
- let deferred0_0;
3070
- let deferred0_1;
3071
- try {
3072
- deferred0_0 = arg1;
3073
- deferred0_1 = arg2;
3074
- arg0.on_message_deleted(getStringFromWasm0(arg1, arg2));
3075
- } finally {
3076
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
3077
- }
3461
+ imports.wbg.__wbg_on_message_ea0e4641a0595363 = function(arg0, arg1) {
3462
+ arg0.on_message(arg1);
3078
3463
  };
3079
- imports.wbg.__wbg_on_user_preference_update_5ece44a4cfcd5994 = function(arg0, arg1, arg2) {
3464
+ imports.wbg.__wbg_on_user_preference_update_6fc82e48172502df = function(arg0, arg1, arg2) {
3080
3465
  var v0 = getArrayJsValueFromWasm0(arg1, arg2).slice();
3081
3466
  wasm.__wbindgen_free(arg1, arg2 * 4, 4);
3082
3467
  arg0.on_user_preference_update(v0);
@@ -3340,16 +3725,23 @@ function __wbg_get_imports() {
3340
3725
  const ret = arg0.write(arg1, arg2);
3341
3726
  return ret;
3342
3727
  }, arguments) };
3343
- imports.wbg.__wbindgen_cast_072c4209cbb41c0f = function(arg0, arg1) {
3344
- // Cast intrinsic for `Closure(Closure { dtor_idx: 6914, function: Function { arguments: [], shim_idx: 6915, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3345
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he7b712e0eb1b5ac1, wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1);
3346
- return ret;
3347
- };
3348
3728
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
3349
3729
  // Cast intrinsic for `Ref(String) -> Externref`.
3350
3730
  const ret = getStringFromWasm0(arg0, arg1);
3351
3731
  return ret;
3352
3732
  };
3733
+ imports.wbg.__wbindgen_cast_25a0a844437d0e92 = function(arg0, arg1) {
3734
+ var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3735
+ wasm.__wbindgen_free(arg0, arg1 * 4, 4);
3736
+ // Cast intrinsic for `Vector(NamedExternref("string")) -> Externref`.
3737
+ const ret = v0;
3738
+ return ret;
3739
+ };
3740
+ imports.wbg.__wbindgen_cast_30e1c5c34bba5e02 = function(arg0, arg1) {
3741
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7207, function: Function { arguments: [], shim_idx: 7208, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3742
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hfbd660e60d498df9, wasm_bindgen__convert__closures_____invoke__hceddd2b8fc291040);
3743
+ return ret;
3744
+ };
3353
3745
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
3354
3746
  // Cast intrinsic for `U64 -> Externref`.
3355
3747
  const ret = BigInt.asUintN(64, arg0);
@@ -3362,17 +3754,15 @@ function __wbg_get_imports() {
3362
3754
  const ret = v0;
3363
3755
  return ret;
3364
3756
  };
3365
- imports.wbg.__wbindgen_cast_8e37b4ad2f2ba653 = function(arg0, arg1) {
3366
- var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3367
- wasm.__wbindgen_free(arg0, arg1 * 4, 4);
3368
- // Cast intrinsic for `Vector(NamedExternref("Conversation")) -> Externref`.
3369
- const ret = v0;
3757
+ imports.wbg.__wbindgen_cast_565992b11e0ca2e1 = function(arg0, arg1) {
3758
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7363, function: Function { arguments: [], shim_idx: 7364, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3759
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3c5639ee43c80f22, wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005);
3370
3760
  return ret;
3371
3761
  };
3372
- imports.wbg.__wbindgen_cast_998222446b91a002 = function(arg0, arg1) {
3762
+ imports.wbg.__wbindgen_cast_8e37b4ad2f2ba653 = function(arg0, arg1) {
3373
3763
  var v0 = getArrayJsValueFromWasm0(arg0, arg1).slice();
3374
3764
  wasm.__wbindgen_free(arg0, arg1 * 4, 4);
3375
- // Cast intrinsic for `Vector(NamedExternref("MessageWithReactions")) -> Externref`.
3765
+ // Cast intrinsic for `Vector(NamedExternref("Conversation")) -> Externref`.
3376
3766
  const ret = v0;
3377
3767
  return ret;
3378
3768
  };
@@ -3381,16 +3771,16 @@ function __wbg_get_imports() {
3381
3771
  const ret = arg0;
3382
3772
  return ret;
3383
3773
  };
3774
+ imports.wbg.__wbindgen_cast_ad8b0e06693e980a = function(arg0, arg1) {
3775
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 6994, function: Function { arguments: [], shim_idx: 6995, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3776
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__he7b712e0eb1b5ac1, wasm_bindgen__convert__closures_____invoke__h6af3cd86eb56f4b1);
3777
+ return ret;
3778
+ };
3384
3779
  imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
3385
3780
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
3386
3781
  const ret = getArrayU8FromWasm0(arg0, arg1);
3387
3782
  return ret;
3388
3783
  };
3389
- imports.wbg.__wbindgen_cast_ccc31394da4c983b = function(arg0, arg1) {
3390
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7323, function: Function { arguments: [Externref], shim_idx: 7324, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3391
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hed8af60076250245, wasm_bindgen__convert__closures_____invoke__hdff293b41f2cecc6);
3392
- return ret;
3393
- };
3394
3784
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
3395
3785
  // Cast intrinsic for `F64 -> Externref`.
3396
3786
  const ret = arg0;
@@ -3403,9 +3793,9 @@ function __wbg_get_imports() {
3403
3793
  const ret = v0;
3404
3794
  return ret;
3405
3795
  };
3406
- imports.wbg.__wbindgen_cast_ee75496ec5e2c856 = function(arg0, arg1) {
3407
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7290, function: Function { arguments: [], shim_idx: 7291, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3408
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h3c5639ee43c80f22, wasm_bindgen__convert__closures_____invoke__h956b60152b2cf005);
3796
+ imports.wbg.__wbindgen_cast_f0f770d7ae28c6c6 = function(arg0, arg1) {
3797
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 7396, function: Function { arguments: [Externref], shim_idx: 7397, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3798
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hed8af60076250245, wasm_bindgen__convert__closures_____invoke__hdff293b41f2cecc6);
3409
3799
  return ret;
3410
3800
  };
3411
3801
  imports.wbg.__wbindgen_cast_f20a506f31063fd0 = function(arg0, arg1) {
@@ -3415,11 +3805,6 @@ function __wbg_get_imports() {
3415
3805
  const ret = v0;
3416
3806
  return ret;
3417
3807
  };
3418
- imports.wbg.__wbindgen_cast_f8f15095990b7349 = function(arg0, arg1) {
3419
- // Cast intrinsic for `Closure(Closure { dtor_idx: 7131, function: Function { arguments: [], shim_idx: 7132, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
3420
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hfbd660e60d498df9, wasm_bindgen__convert__closures_____invoke__hceddd2b8fc291040);
3421
- return ret;
3422
- };
3423
3808
  imports.wbg.__wbindgen_init_externref_table = function() {
3424
3809
  const table = wasm.__wbindgen_externrefs;
3425
3810
  const offset = table.grow(4);