simplex-chat 7.1.0-beta.2 → 7.1.0-beta.4

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 (56) hide show
  1. package/binding.gyp +2 -0
  2. package/cpp/simplex.cc +265 -29
  3. package/cpp/simplex.h +2 -0
  4. package/dist/api.d.ts +3 -64
  5. package/dist/api.js +10 -108
  6. package/dist/api.js.map +1 -1
  7. package/dist/bot.d.ts +4 -2
  8. package/dist/bot.js +1 -1
  9. package/dist/bot.js.map +1 -1
  10. package/dist/util.js +1 -1
  11. package/dist/util.js.map +1 -1
  12. package/docs/Namespace.bot.md +1 -0
  13. package/docs/api.Class.ChatApi.md +122 -78
  14. package/docs/bot.Function.run.md +1 -1
  15. package/docs/bot.Function.subscribeChatItems.md +27 -0
  16. package/docs/bot.Interface.BotConfig.md +7 -7
  17. package/docs/bot.Interface.BotOptions.md +10 -10
  18. package/docs/bot.TypeAlias.BotDbOpts.md +4 -0
  19. package/docs/core.Class.ChatAPIError.md +4 -4
  20. package/docs/core.Class.ChatInitError.md +4 -4
  21. package/docs/core.DBMigrationError.Interface.ErrorMigration.md +4 -4
  22. package/docs/core.DBMigrationError.Interface.ErrorNotADatabase.md +3 -3
  23. package/docs/core.DBMigrationError.Interface.ErrorSQL.md +4 -4
  24. package/docs/core.DBMigrationError.Interface.InvalidConfirmation.md +2 -2
  25. package/docs/core.DBMigrationError.Interface.InvalidQueueSize.md +25 -0
  26. package/docs/core.DBMigrationError.TypeAlias.Tag.md +2 -2
  27. package/docs/core.Enumeration.MigrationConfirmation.md +5 -5
  28. package/docs/core.Function.chatCloseStore.md +1 -1
  29. package/docs/core.Function.chatDecryptFile.md +1 -1
  30. package/docs/core.Function.chatEncryptFile.md +1 -1
  31. package/docs/core.Function.chatMigrateInit.md +8 -2
  32. package/docs/core.Function.chatReadFile.md +3 -3
  33. package/docs/core.Function.chatRecvMsgWait.md +1 -1
  34. package/docs/core.Function.chatSendCmd.md +1 -1
  35. package/docs/core.Function.chatWriteFile.md +2 -2
  36. package/docs/core.Interface.APIResult.md +3 -3
  37. package/docs/core.Interface.CryptoArgs.md +3 -3
  38. package/docs/core.Interface.UpMigration.md +3 -3
  39. package/docs/core.MTRError.Interface.MTREDifferent.md +3 -3
  40. package/docs/core.MTRError.Interface.MTRENoDown.md +10 -10
  41. package/docs/core.MTRError.TypeAlias.Tag.md +1 -1
  42. package/docs/core.MigrationError.Interface.MEDowngrade.md +3 -3
  43. package/docs/core.MigrationError.Interface.MEUpgrade.md +4 -4
  44. package/docs/core.MigrationError.Interface.MigrationError.md +3 -3
  45. package/docs/core.MigrationError.TypeAlias.Tag.md +1 -1
  46. package/docs/core.Namespace.DBMigrationError.md +1 -0
  47. package/docs/core.TypeAlias.DBMigrationError.md +2 -2
  48. package/docs/core.TypeAlias.MTRError.md +1 -1
  49. package/docs/core.TypeAlias.MigrationError.md +1 -1
  50. package/package.json +2 -2
  51. package/src/api.ts +39 -21
  52. package/src/bot.ts +17 -30
  53. package/src/core.ts +15 -7
  54. package/src/download-libs.js +28 -1
  55. package/src/simplex.d.ts +3 -2
  56. package/src/util.ts +1 -1
@@ -26,7 +26,7 @@ Defined in: [src/api.ts:103](../src/api.ts#L103)
26
26
 
27
27
  > **get** **ctrl**(): `bigint`
28
28
 
29
- Defined in: [src/api.ts:329](../src/api.ts#L329)
29
+ Defined in: [src/api.ts:344](../src/api.ts#L344)
30
30
 
31
31
  Chat controller reference
32
32
 
@@ -42,7 +42,7 @@ Chat controller reference
42
42
 
43
43
  > **get** **initialized**(): `boolean`
44
44
 
45
- Defined in: [src/api.ts:315](../src/api.ts#L315)
45
+ Defined in: [src/api.ts:330](../src/api.ts#L330)
46
46
 
47
47
  Chat controller is initialized
48
48
 
@@ -58,7 +58,7 @@ Chat controller is initialized
58
58
 
59
59
  > **get** **started**(): `boolean`
60
60
 
61
- Defined in: [src/api.ts:322](../src/api.ts#L322)
61
+ Defined in: [src/api.ts:337](../src/api.ts#L337)
62
62
 
63
63
  Chat controller is started
64
64
 
@@ -72,7 +72,7 @@ Chat controller is started
72
72
 
73
73
  > **apiAcceptContactRequest**(`contactReqId`): `Promise`\<`Contact`\>
74
74
 
75
- Defined in: [src/api.ts:731](../src/api.ts#L731)
75
+ Defined in: [src/api.ts:750](../src/api.ts#L750)
76
76
 
77
77
  Accept contact request.
78
78
  Network usage: interactive.
@@ -93,7 +93,7 @@ Network usage: interactive.
93
93
 
94
94
  > **apiAcceptMember**(`groupId`, `groupMemberId`, `memberRole`): `Promise`\<`GroupMember`\>
95
95
 
96
- Defined in: [src/api.ts:551](../src/api.ts#L551)
96
+ Defined in: [src/api.ts:570](../src/api.ts#L570)
97
97
 
98
98
  Accept group member. Requires Admin role.
99
99
  Network usage: background.
@@ -122,7 +122,7 @@ Network usage: background.
122
122
 
123
123
  > **apiAddMember**(`groupId`, `contactId`, `memberRole`): `Promise`\<`GroupMember`\>
124
124
 
125
- Defined in: [src/api.ts:531](../src/api.ts#L531)
125
+ Defined in: [src/api.ts:550](../src/api.ts#L550)
126
126
 
127
127
  Add contact to group. Requires bot to have Admin role.
128
128
  Network usage: interactive.
@@ -151,7 +151,7 @@ Network usage: interactive.
151
151
 
152
152
  > **apiBlockMembersForAll**(`groupId`, `groupMemberIds`, `blocked`): `Promise`\<`void`\>
153
153
 
154
- Defined in: [src/api.ts:571](../src/api.ts#L571)
154
+ Defined in: [src/api.ts:590](../src/api.ts#L590)
155
155
 
156
156
  Block members. Requires Moderator role.
157
157
  Network usage: background.
@@ -180,7 +180,7 @@ Network usage: background.
180
180
 
181
181
  > **apiCancelFile**(`fileId`): `Promise`\<`void`\>
182
182
 
183
- Defined in: [src/api.ts:521](../src/api.ts#L521)
183
+ Defined in: [src/api.ts:540](../src/api.ts#L540)
184
184
 
185
185
  Cancel file.
186
186
  Network usage: background.
@@ -199,9 +199,9 @@ Network usage: background.
199
199
 
200
200
  ### apiChatItemReaction()
201
201
 
202
- > **apiChatItemReaction**(`chatType`, `chatId`, `chatItemId`, `add`, `reaction`): `Promise`\<`ChatItemDeletion`[]\>
202
+ > **apiChatItemReaction**(`chatType`, `chatId`, `chatItemId`, `add`, `reaction`): `Promise`\<`ACIReaction`\>
203
203
 
204
- Defined in: [src/api.ts:495](../src/api.ts#L495)
204
+ Defined in: [src/api.ts:513](../src/api.ts#L513)
205
205
 
206
206
  Add/remove message reaction.
207
207
  Network usage: background.
@@ -230,15 +230,15 @@ Network usage: background.
230
230
 
231
231
  #### Returns
232
232
 
233
- `Promise`\<`ChatItemDeletion`[]\>
233
+ `Promise`\<`ACIReaction`\>
234
234
 
235
235
  ***
236
236
 
237
237
  ### apiConnect()
238
238
 
239
- > **apiConnect**(`userId`, `incognito`, `preparedLink?`): `Promise`\<[`ConnReqType`](api.Enumeration.ConnReqType.md)\>
239
+ > **apiConnect**(`userId`, `incognito`, `preparedLink`): `Promise`\<[`ConnReqType`](api.Enumeration.ConnReqType.md)\>
240
240
 
241
- Defined in: [src/api.ts:700](../src/api.ts#L700)
241
+ Defined in: [src/api.ts:719](../src/api.ts#L719)
242
242
 
243
243
  Connect via prepared SimpleX link. The link can be 1-time invitation link, contact address or group link
244
244
  Network usage: interactive.
@@ -253,7 +253,7 @@ Network usage: interactive.
253
253
 
254
254
  `boolean`
255
255
 
256
- ##### preparedLink?
256
+ ##### preparedLink
257
257
 
258
258
  `CreatedConnLink`
259
259
 
@@ -267,7 +267,7 @@ Network usage: interactive.
267
267
 
268
268
  > **apiConnectActiveUser**(`connLink`): `Promise`\<[`ConnReqType`](api.Enumeration.ConnReqType.md)\>
269
269
 
270
- Defined in: [src/api.ts:709](../src/api.ts#L709)
270
+ Defined in: [src/api.ts:728](../src/api.ts#L728)
271
271
 
272
272
  Connect via SimpleX link as string in the active user profile.
273
273
  Network usage: interactive.
@@ -288,7 +288,7 @@ Network usage: interactive.
288
288
 
289
289
  > **apiConnectPlan**(`userId`, `connectionLink`): `Promise`\<\[`ConnectionPlan`, `CreatedConnLink`\]\>
290
290
 
291
- Defined in: [src/api.ts:690](../src/api.ts#L690)
291
+ Defined in: [src/api.ts:709](../src/api.ts#L709)
292
292
 
293
293
  Determine SimpleX link type and if the bot is already connected via this link.
294
294
  Network usage: interactive.
@@ -313,7 +313,7 @@ Network usage: interactive.
313
313
 
314
314
  > **apiCreateActiveUser**(`profile?`): `Promise`\<`User`\>
315
315
 
316
- Defined in: [src/api.ts:849](../src/api.ts#L849)
316
+ Defined in: [src/api.ts:887](../src/api.ts#L887)
317
317
 
318
318
  Create new user profile
319
319
  Network usage: no.
@@ -334,7 +334,7 @@ Network usage: no.
334
334
 
335
335
  > **apiCreateGroupLink**(`groupId`, `memberRole`): `Promise`\<`string`\>
336
336
 
337
- Defined in: [src/api.ts:631](../src/api.ts#L631)
337
+ Defined in: [src/api.ts:650](../src/api.ts#L650)
338
338
 
339
339
  Create group link.
340
340
  Network usage: interactive.
@@ -359,7 +359,7 @@ Network usage: interactive.
359
359
 
360
360
  > **apiCreateLink**(`userId`): `Promise`\<`string`\>
361
361
 
362
- Defined in: [src/api.ts:677](../src/api.ts#L677)
362
+ Defined in: [src/api.ts:696](../src/api.ts#L696)
363
363
 
364
364
  Create 1-time invitation link.
365
365
  Network usage: interactive.
@@ -380,7 +380,7 @@ Network usage: interactive.
380
380
 
381
381
  > **apiCreateMemberContact**(`groupId`, `groupMemberId`): `Promise`\<`Contact`\>
382
382
 
383
- Defined in: [src/api.ts:915](../src/api.ts#L915)
383
+ Defined in: [src/api.ts:953](../src/api.ts#L953)
384
384
 
385
385
  Create a direct message contact with a group member.
386
386
  Returns the created contact.
@@ -406,7 +406,7 @@ Network usage: interactive.
406
406
 
407
407
  > **apiCreateUserAddress**(`userId`): `Promise`\<`CreatedConnLink`\>
408
408
 
409
- Defined in: [src/api.ts:346](../src/api.ts#L346)
409
+ Defined in: [src/api.ts:361](../src/api.ts#L361)
410
410
 
411
411
  Create bot address.
412
412
  Network usage: interactive.
@@ -427,7 +427,7 @@ Network usage: interactive.
427
427
 
428
428
  > **apiDeleteChat**(`chatType`, `chatId`, `deleteMode?`): `Promise`\<`void`\>
429
429
 
430
- Defined in: [src/api.ts:771](../src/api.ts#L771)
430
+ Defined in: [src/api.ts:809](../src/api.ts#L809)
431
431
 
432
432
  Delete chat.
433
433
  Network usage: background.
@@ -456,7 +456,7 @@ Network usage: background.
456
456
 
457
457
  > **apiDeleteChatItems**(`chatType`, `chatId`, `chatItemIds`, `deleteMode`): `Promise`\<`ChatItemDeletion`[]\>
458
458
 
459
- Defined in: [src/api.ts:470](../src/api.ts#L470)
459
+ Defined in: [src/api.ts:488](../src/api.ts#L488)
460
460
 
461
461
  Delete message.
462
462
  Network usage: background.
@@ -489,7 +489,7 @@ Network usage: background.
489
489
 
490
490
  > **apiDeleteGroupLink**(`groupId`): `Promise`\<`void`\>
491
491
 
492
- Defined in: [src/api.ts:653](../src/api.ts#L653)
492
+ Defined in: [src/api.ts:672](../src/api.ts#L672)
493
493
 
494
494
  Delete group link.
495
495
  Network usage: background.
@@ -510,7 +510,7 @@ Network usage: background.
510
510
 
511
511
  > **apiDeleteMemberChatItem**(`groupId`, `chatItemIds`): `Promise`\<`ChatItemDeletion`[]\>
512
512
 
513
- Defined in: [src/api.ts:485](../src/api.ts#L485)
513
+ Defined in: [src/api.ts:503](../src/api.ts#L503)
514
514
 
515
515
  Moderate message. Requires Moderator role (and higher than message author's).
516
516
  Network usage: background.
@@ -535,7 +535,7 @@ Network usage: background.
535
535
 
536
536
  > **apiDeleteUser**(`userId`, `delSMPQueues`, `viewPwd?`): `Promise`\<`void`\>
537
537
 
538
- Defined in: [src/api.ts:879](../src/api.ts#L879)
538
+ Defined in: [src/api.ts:917](../src/api.ts#L917)
539
539
 
540
540
  Delete user profile.
541
541
  Network usage: background.
@@ -564,7 +564,7 @@ Network usage: background.
564
564
 
565
565
  > **apiDeleteUserAddress**(`userId`): `Promise`\<`void`\>
566
566
 
567
- Defined in: [src/api.ts:356](../src/api.ts#L356)
567
+ Defined in: [src/api.ts:371](../src/api.ts#L371)
568
568
 
569
569
  Deletes a user address.
570
570
  Network usage: background.
@@ -585,7 +585,7 @@ Network usage: background.
585
585
 
586
586
  > **apiGetActiveUser**(): `Promise`\<`User` \| `undefined`\>
587
587
 
588
- Defined in: [src/api.ts:829](../src/api.ts#L829)
588
+ Defined in: [src/api.ts:867](../src/api.ts#L867)
589
589
 
590
590
  Get active user profile
591
591
  Network usage: no.
@@ -600,7 +600,7 @@ Network usage: no.
600
600
 
601
601
  > **apiGetChat**(`chatType`, `chatId`, `count`): `Promise`\<`any`\>
602
602
 
603
- Defined in: [src/api.ts:819](../src/api.ts#L819)
603
+ Defined in: [src/api.ts:857](../src/api.ts#L857)
604
604
 
605
605
  Get chat items.
606
606
  Network usage: no.
@@ -625,11 +625,48 @@ Network usage: no.
625
625
 
626
626
  ***
627
627
 
628
+ ### apiGetChats()
629
+
630
+ > **apiGetChats**(`userId`, `pagination`, `query?`, `pendingConnections?`): `Promise`\<`AChat`[]\>
631
+
632
+ Defined in: [src/api.ts:794](../src/api.ts#L794)
633
+
634
+ Get chat previews (paginated).
635
+ Network usage: no.
636
+
637
+ Prefer this over apiListContacts / apiListGroups for any scan: those
638
+ methods load every record into memory in a single response and will fail
639
+ on large databases.
640
+
641
+ #### Parameters
642
+
643
+ ##### userId
644
+
645
+ `number`
646
+
647
+ ##### pagination
648
+
649
+ `Last`
650
+
651
+ ##### query?
652
+
653
+ `ChatListQuery` = `...`
654
+
655
+ ##### pendingConnections?
656
+
657
+ `boolean` = `false`
658
+
659
+ #### Returns
660
+
661
+ `Promise`\<`AChat`[]\>
662
+
663
+ ***
664
+
628
665
  ### apiGetGroupLink()
629
666
 
630
667
  > **apiGetGroupLink**(`groupId`): `Promise`\<`GroupLink`\>
631
668
 
632
- Defined in: [src/api.ts:662](../src/api.ts#L662)
669
+ Defined in: [src/api.ts:681](../src/api.ts#L681)
633
670
 
634
671
  Get group link.
635
672
  Network usage: no.
@@ -650,7 +687,7 @@ Network usage: no.
650
687
 
651
688
  > **apiGetGroupLinkStr**(`groupId`): `Promise`\<`string`\>
652
689
 
653
- Defined in: [src/api.ts:668](../src/api.ts#L668)
690
+ Defined in: [src/api.ts:687](../src/api.ts#L687)
654
691
 
655
692
  #### Parameters
656
693
 
@@ -668,7 +705,7 @@ Defined in: [src/api.ts:668](../src/api.ts#L668)
668
705
 
669
706
  > **apiGetUserAddress**(`userId`): `Promise`\<`UserContactLink` \| `undefined`\>
670
707
 
671
- Defined in: [src/api.ts:366](../src/api.ts#L366)
708
+ Defined in: [src/api.ts:381](../src/api.ts#L381)
672
709
 
673
710
  Get bot address and settings.
674
711
  Network usage: no.
@@ -689,7 +726,7 @@ Network usage: no.
689
726
 
690
727
  > **apiJoinGroup**(`groupId`): `Promise`\<`GroupInfo`\>
691
728
 
692
- Defined in: [src/api.ts:541](../src/api.ts#L541)
729
+ Defined in: [src/api.ts:560](../src/api.ts#L560)
693
730
 
694
731
  Join group.
695
732
  Network usage: interactive.
@@ -710,7 +747,7 @@ Network usage: interactive.
710
747
 
711
748
  > **apiLeaveGroup**(`groupId`): `Promise`\<`GroupInfo`\>
712
749
 
713
- Defined in: [src/api.ts:591](../src/api.ts#L591)
750
+ Defined in: [src/api.ts:610](../src/api.ts#L610)
714
751
 
715
752
  Leave group.
716
753
  Network usage: background.
@@ -731,7 +768,7 @@ Network usage: background.
731
768
 
732
769
  > **apiListContacts**(`userId`): `Promise`\<`Contact`[]\>
733
770
 
734
- Defined in: [src/api.ts:751](../src/api.ts#L751)
771
+ Defined in: [src/api.ts:770](../src/api.ts#L770)
735
772
 
736
773
  Get contacts.
737
774
  Network usage: no.
@@ -752,7 +789,7 @@ Network usage: no.
752
789
 
753
790
  > **apiListGroups**(`userId`, `contactId?`, `search?`): `Promise`\<`GroupInfo`[]\>
754
791
 
755
- Defined in: [src/api.ts:761](../src/api.ts#L761)
792
+ Defined in: [src/api.ts:780](../src/api.ts#L780)
756
793
 
757
794
  Get groups.
758
795
  Network usage: no.
@@ -781,7 +818,7 @@ Network usage: no.
781
818
 
782
819
  > **apiListMembers**(`groupId`): `Promise`\<`GroupMember`[]\>
783
820
 
784
- Defined in: [src/api.ts:601](../src/api.ts#L601)
821
+ Defined in: [src/api.ts:620](../src/api.ts#L620)
785
822
 
786
823
  Get group members.
787
824
  Network usage: no.
@@ -802,7 +839,7 @@ Network usage: no.
802
839
 
803
840
  > **apiListUsers**(): `Promise`\<`UserInfo`[]\>
804
841
 
805
- Defined in: [src/api.ts:859](../src/api.ts#L859)
842
+ Defined in: [src/api.ts:897](../src/api.ts#L897)
806
843
 
807
844
  Get all user profiles
808
845
  Network usage: no.
@@ -817,7 +854,7 @@ Network usage: no.
817
854
 
818
855
  > **apiNewGroup**(`userId`, `groupProfile`): `Promise`\<`GroupInfo`\>
819
856
 
820
- Defined in: [src/api.ts:611](../src/api.ts#L611)
857
+ Defined in: [src/api.ts:630](../src/api.ts#L630)
821
858
 
822
859
  Create group.
823
860
  Network usage: no.
@@ -842,7 +879,7 @@ Network usage: no.
842
879
 
843
880
  > **apiReceiveFile**(`fileId`): `Promise`\<`AChatItem`\>
844
881
 
845
- Defined in: [src/api.ts:511](../src/api.ts#L511)
882
+ Defined in: [src/api.ts:529](../src/api.ts#L529)
846
883
 
847
884
  Receive file.
848
885
  Network usage: no.
@@ -863,7 +900,7 @@ Network usage: no.
863
900
 
864
901
  > **apiRejectContactRequest**(`contactReqId`): `Promise`\<`void`\>
865
902
 
866
- Defined in: [src/api.ts:741](../src/api.ts#L741)
903
+ Defined in: [src/api.ts:760](../src/api.ts#L760)
867
904
 
868
905
  Reject contact request. The user who sent the request is **not notified**.
869
906
  Network usage: no.
@@ -884,7 +921,7 @@ Network usage: no.
884
921
 
885
922
  > **apiRemoveMembers**(`groupId`, `memberIds`, `withMessages?`): `Promise`\<`GroupMember`[]\>
886
923
 
887
- Defined in: [src/api.ts:581](../src/api.ts#L581)
924
+ Defined in: [src/api.ts:600](../src/api.ts#L600)
888
925
 
889
926
  Remove members. Requires Admin role.
890
927
  Network usage: background.
@@ -913,7 +950,7 @@ Network usage: background.
913
950
 
914
951
  > **apiSendMemberContactInvitation**(`contactId`, `message?`): `Promise`\<`Contact`\>
915
952
 
916
- Defined in: [src/api.ts:926](../src/api.ts#L926)
953
+ Defined in: [src/api.ts:964](../src/api.ts#L964)
917
954
 
918
955
  Send a direct message invitation to a group member contact.
919
956
  The contact must have been created with [apiCreateMemberContact](#apicreatemembercontact).
@@ -939,7 +976,7 @@ Network usage: interactive.
939
976
 
940
977
  > **apiSendMessages**(`chat`, `messages`, `liveMessage?`): `Promise`\<`AChatItem`[]\>
941
978
 
942
- Defined in: [src/api.ts:415](../src/api.ts#L415)
979
+ Defined in: [src/api.ts:432](../src/api.ts#L432)
943
980
 
944
981
  Send messages.
945
982
  Network usage: background.
@@ -968,7 +1005,7 @@ Network usage: background.
968
1005
 
969
1006
  > **apiSendTextMessage**(`chat`, `text`, `inReplyTo?`): `Promise`\<`AChatItem`[]\>
970
1007
 
971
- Defined in: [src/api.ts:437](../src/api.ts#L437)
1008
+ Defined in: [src/api.ts:455](../src/api.ts#L455)
972
1009
 
973
1010
  Send text message.
974
1011
  Network usage: background.
@@ -997,7 +1034,7 @@ Network usage: background.
997
1034
 
998
1035
  > **apiSendTextReply**(`chatItem`, `text`): `Promise`\<`AChatItem`[]\>
999
1036
 
1000
- Defined in: [src/api.ts:445](../src/api.ts#L445)
1037
+ Defined in: [src/api.ts:463](../src/api.ts#L463)
1001
1038
 
1002
1039
  Send text message in reply to received message.
1003
1040
  Network usage: background.
@@ -1022,7 +1059,7 @@ Network usage: background.
1022
1059
 
1023
1060
  > **apiSetActiveUser**(`userId`, `viewPwd?`): `Promise`\<`User`\>
1024
1061
 
1025
- Defined in: [src/api.ts:869](../src/api.ts#L869)
1062
+ Defined in: [src/api.ts:907](../src/api.ts#L907)
1026
1063
 
1027
1064
  Set active user profile
1028
1065
  Network usage: no.
@@ -1047,7 +1084,7 @@ Network usage: no.
1047
1084
 
1048
1085
  > **apiSetAddressSettings**(`userId`, `__namedParameters`): `Promise`\<`void`\>
1049
1086
 
1050
- Defined in: [src/api.ts:398](../src/api.ts#L398)
1087
+ Defined in: [src/api.ts:415](../src/api.ts#L415)
1051
1088
 
1052
1089
  Set bot address settings.
1053
1090
  Network usage: interactive.
@@ -1072,7 +1109,7 @@ Network usage: interactive.
1072
1109
 
1073
1110
  > **apiSetAutoAcceptMemberContacts**(`userId`, `onOff`): `Promise`\<`void`\>
1074
1111
 
1075
- Defined in: [src/api.ts:808](../src/api.ts#L808)
1112
+ Defined in: [src/api.ts:846](../src/api.ts#L846)
1076
1113
 
1077
1114
  Set auto-accept member contacts.
1078
1115
  Network usage: no.
@@ -1097,7 +1134,7 @@ Network usage: no.
1097
1134
 
1098
1135
  > **apiSetContactCustomData**(`contactId`, `customData?`): `Promise`\<`void`\>
1099
1136
 
1100
- Defined in: [src/api.ts:798](../src/api.ts#L798)
1137
+ Defined in: [src/api.ts:836](../src/api.ts#L836)
1101
1138
 
1102
1139
  Set contact custom data.
1103
1140
  Network usage: no.
@@ -1122,7 +1159,7 @@ Network usage: no.
1122
1159
 
1123
1160
  > **apiSetContactPrefs**(`contactId`, `preferences`): `Promise`\<`void`\>
1124
1161
 
1125
- Defined in: [src/api.ts:905](../src/api.ts#L905)
1162
+ Defined in: [src/api.ts:943](../src/api.ts#L943)
1126
1163
 
1127
1164
  Configure chat preference overrides for the contact.
1128
1165
  Network usage: background.
@@ -1147,7 +1184,7 @@ Network usage: background.
1147
1184
 
1148
1185
  > **apiSetGroupCustomData**(`groupId`, `customData?`): `Promise`\<`void`\>
1149
1186
 
1150
- Defined in: [src/api.ts:788](../src/api.ts#L788)
1187
+ Defined in: [src/api.ts:826](../src/api.ts#L826)
1151
1188
 
1152
1189
  Set group custom data.
1153
1190
  Network usage: no.
@@ -1172,7 +1209,7 @@ Network usage: no.
1172
1209
 
1173
1210
  > **apiSetGroupLinkMemberRole**(`groupId`, `memberRole`): `Promise`\<`void`\>
1174
1211
 
1175
- Defined in: [src/api.ts:644](../src/api.ts#L644)
1212
+ Defined in: [src/api.ts:663](../src/api.ts#L663)
1176
1213
 
1177
1214
  Set member role for group link.
1178
1215
  Network usage: no.
@@ -1197,7 +1234,7 @@ Network usage: no.
1197
1234
 
1198
1235
  > **apiSetMembersRole**(`groupId`, `groupMemberIds`, `memberRole`): `Promise`\<`void`\>
1199
1236
 
1200
- Defined in: [src/api.ts:561](../src/api.ts#L561)
1237
+ Defined in: [src/api.ts:580](../src/api.ts#L580)
1201
1238
 
1202
1239
  Set members role. Requires Admin role.
1203
1240
  Network usage: background.
@@ -1226,7 +1263,7 @@ Network usage: background.
1226
1263
 
1227
1264
  > **apiSetProfileAddress**(`userId`, `enable`): `Promise`\<`UserProfileUpdateSummary`\>
1228
1265
 
1229
- Defined in: [src/api.ts:384](../src/api.ts#L384)
1266
+ Defined in: [src/api.ts:399](../src/api.ts#L399)
1230
1267
 
1231
1268
  Add address to bot profile.
1232
1269
  Network usage: interactive.
@@ -1251,7 +1288,7 @@ Network usage: interactive.
1251
1288
 
1252
1289
  > **apiUpdateChatItem**(`chatType`, `chatId`, `chatItemId`, `msgContent`, `liveMessage`): `Promise`\<`ChatItem`\>
1253
1290
 
1254
- Defined in: [src/api.ts:453](../src/api.ts#L453)
1291
+ Defined in: [src/api.ts:471](../src/api.ts#L471)
1255
1292
 
1256
1293
  Update message.
1257
1294
  Network usage: background.
@@ -1288,7 +1325,7 @@ Network usage: background.
1288
1325
 
1289
1326
  > **apiUpdateGroupProfile**(`groupId`, `groupProfile`): `Promise`\<`GroupInfo`\>
1290
1327
 
1291
- Defined in: [src/api.ts:621](../src/api.ts#L621)
1328
+ Defined in: [src/api.ts:640](../src/api.ts#L640)
1292
1329
 
1293
1330
  Update group profile.
1294
1331
  Network usage: background.
@@ -1313,7 +1350,7 @@ Network usage: background.
1313
1350
 
1314
1351
  > **apiUpdateProfile**(`userId`, `profile`): `Promise`\<`UserProfileUpdateSummary` \| `undefined`\>
1315
1352
 
1316
- Defined in: [src/api.ts:889](../src/api.ts#L889)
1353
+ Defined in: [src/api.ts:927](../src/api.ts#L927)
1317
1354
 
1318
1355
  Update user profile.
1319
1356
  Network usage: background.
@@ -1338,9 +1375,10 @@ Network usage: background.
1338
1375
 
1339
1376
  > **close**(): `Promise`\<`void`\>
1340
1377
 
1341
- Defined in: [src/api.ts:148](../src/api.ts#L148)
1378
+ Defined in: [src/api.ts:158](../src/api.ts#L158)
1342
1379
 
1343
- Close chat database.
1380
+ Stop chat controller and close chat database.
1381
+ The database is not closed if stopping fails.
1344
1382
  Usually doesn't need to be called in chat bots.
1345
1383
 
1346
1384
  #### Returns
@@ -1353,7 +1391,7 @@ Usually doesn't need to be called in chat bots.
1353
1391
 
1354
1392
  > **off**\<`K`\>(`event`, `subscriber?`): `void`
1355
1393
 
1356
- Defined in: [src/api.ts:287](../src/api.ts#L287)
1394
+ Defined in: [src/api.ts:302](../src/api.ts#L302)
1357
1395
 
1358
1396
  Unsubscribe all or a specific handler from a specific event.
1359
1397
 
@@ -1387,7 +1425,7 @@ An optional subscriber function for the event.
1387
1425
 
1388
1426
  > **offAny**(`receiver?`): `void`
1389
1427
 
1390
- Defined in: [src/api.ts:303](../src/api.ts#L303)
1428
+ Defined in: [src/api.ts:318](../src/api.ts#L318)
1391
1429
 
1392
1430
  Unsubscribe all or a specific handler from any events.
1393
1431
 
@@ -1411,7 +1449,7 @@ An optional subscriber function for the event.
1411
1449
 
1412
1450
  > **on**\<`K`\>(`subscribers`): `void`
1413
1451
 
1414
- Defined in: [src/api.ts:197](../src/api.ts#L197)
1452
+ Defined in: [src/api.ts:212](../src/api.ts#L212)
1415
1453
 
1416
1454
  Subscribe multiple event handlers at once.
1417
1455
 
@@ -1441,7 +1479,7 @@ If the same function is subscribed to event.
1441
1479
 
1442
1480
  > **on**\<`K`\>(`event`, `subscriber`): `void`
1443
1481
 
1444
- Defined in: [src/api.ts:205](../src/api.ts#L205)
1482
+ Defined in: [src/api.ts:220](../src/api.ts#L220)
1445
1483
 
1446
1484
  Subscribe a handler to a specific event.
1447
1485
 
@@ -1479,7 +1517,7 @@ If the same function is subscribed to event.
1479
1517
 
1480
1518
  > **onAny**(`receiver`): `void`
1481
1519
 
1482
- Defined in: [src/api.ts:228](../src/api.ts#L228)
1520
+ Defined in: [src/api.ts:243](../src/api.ts#L243)
1483
1521
 
1484
1522
  Subscribe a handler to any event.
1485
1523
 
@@ -1505,7 +1543,7 @@ If the same function is subscribed to event.
1505
1543
 
1506
1544
  > **once**\<`K`\>(`event`, `subscriber`): `void`
1507
1545
 
1508
- Defined in: [src/api.ts:239](../src/api.ts#L239)
1546
+ Defined in: [src/api.ts:254](../src/api.ts#L254)
1509
1547
 
1510
1548
  Subscribe a handler to a specific event to be delivered one time.
1511
1549
 
@@ -1543,13 +1581,13 @@ If the same function is subscribed to event.
1543
1581
 
1544
1582
  > **recvChatEvent**(`wait?`): `Promise`\<`ChatEvent` \| `undefined`\>
1545
1583
 
1546
- Defined in: [src/api.ts:338](../src/api.ts#L338)
1584
+ Defined in: [src/api.ts:353](../src/api.ts#L353)
1547
1585
 
1548
1586
  #### Parameters
1549
1587
 
1550
1588
  ##### wait?
1551
1589
 
1552
- `number` = `5_000_000`
1590
+ `number` = `500_000`
1553
1591
 
1554
1592
  #### Returns
1555
1593
 
@@ -1561,7 +1599,7 @@ Defined in: [src/api.ts:338](../src/api.ts#L338)
1561
1599
 
1562
1600
  > **sendChatCmd**(`cmd`): `Promise`\<`ChatResponse`\>
1563
1601
 
1564
- Defined in: [src/api.ts:334](../src/api.ts#L334)
1602
+ Defined in: [src/api.ts:349](../src/api.ts#L349)
1565
1603
 
1566
1604
  #### Parameters
1567
1605
 
@@ -1579,7 +1617,7 @@ Defined in: [src/api.ts:334](../src/api.ts#L334)
1579
1617
 
1580
1618
  > **startChat**(): `Promise`\<`void`\>
1581
1619
 
1582
- Defined in: [src/api.ts:122](../src/api.ts#L122)
1620
+ Defined in: [src/api.ts:124](../src/api.ts#L124)
1583
1621
 
1584
1622
  Start chat controller. Must be called with the existing user profile.
1585
1623
 
@@ -1593,10 +1631,10 @@ Start chat controller. Must be called with the existing user profile.
1593
1631
 
1594
1632
  > **stopChat**(): `Promise`\<`void`\>
1595
1633
 
1596
- Defined in: [src/api.ts:136](../src/api.ts#L136)
1634
+ Defined in: [src/api.ts:147](../src/api.ts#L147)
1597
1635
 
1598
1636
  Stop chat controller.
1599
- Must be called before closing the database.
1637
+ `close` calls it before closing the database.
1600
1638
  Usually doesn't need to be called in chat bots.
1601
1639
 
1602
1640
  #### Returns
@@ -1611,7 +1649,7 @@ Usually doesn't need to be called in chat bots.
1611
1649
 
1612
1650
  > **wait**\<`K`\>(`event`): `Promise`\<`ChatEvent` & `object`\>
1613
1651
 
1614
- Defined in: [src/api.ts:247](../src/api.ts#L247)
1652
+ Defined in: [src/api.ts:262](../src/api.ts#L262)
1615
1653
 
1616
1654
  Waits for specific event, with an optional predicate.
1617
1655
  Returns `undefined` on timeout if specified.
@@ -1636,7 +1674,7 @@ Returns `undefined` on timeout if specified.
1636
1674
 
1637
1675
  > **wait**\<`K`\>(`event`, `predicate`): `Promise`\<`ChatEvent` & `object`\>
1638
1676
 
1639
- Defined in: [src/api.ts:248](../src/api.ts#L248)
1677
+ Defined in: [src/api.ts:263](../src/api.ts#L263)
1640
1678
 
1641
1679
  Waits for specific event, with an optional predicate.
1642
1680
  Returns `undefined` on timeout if specified.
@@ -1665,7 +1703,7 @@ Returns `undefined` on timeout if specified.
1665
1703
 
1666
1704
  > **wait**\<`K`\>(`event`, `timeout`): `Promise`\<ChatEvent & \{ type: K; \} \| `undefined`\>
1667
1705
 
1668
- Defined in: [src/api.ts:249](../src/api.ts#L249)
1706
+ Defined in: [src/api.ts:264](../src/api.ts#L264)
1669
1707
 
1670
1708
  Waits for specific event, with an optional predicate.
1671
1709
  Returns `undefined` on timeout if specified.
@@ -1694,7 +1732,7 @@ Returns `undefined` on timeout if specified.
1694
1732
 
1695
1733
  > **wait**\<`K`\>(`event`, `predicate`, `timeout`): `Promise`\<ChatEvent & \{ type: K; \} \| `undefined`\>
1696
1734
 
1697
- Defined in: [src/api.ts:250](../src/api.ts#L250)
1735
+ Defined in: [src/api.ts:265](../src/api.ts#L265)
1698
1736
 
1699
1737
  Waits for specific event, with an optional predicate.
1700
1738
  Returns `undefined` on timeout if specified.
@@ -1727,9 +1765,9 @@ Returns `undefined` on timeout if specified.
1727
1765
 
1728
1766
  ### init()
1729
1767
 
1730
- > `static` **init**(`db`, `confirm?`): `Promise`\<`ChatApi`\>
1768
+ > `static` **init**(`db`, `confirm?`, `queueSize?`): `Promise`\<`ChatApi`\>
1731
1769
 
1732
- Defined in: [src/api.ts:110](../src/api.ts#L110)
1770
+ Defined in: [src/api.ts:111](../src/api.ts#L111)
1733
1771
 
1734
1772
  Initializes the ChatApi.
1735
1773
 
@@ -1747,6 +1785,12 @@ Database configuration (sqlite or postgres).
1747
1785
 
1748
1786
  Migration confirmation mode.
1749
1787
 
1788
+ ##### queueSize?
1789
+
1790
+ `number`
1791
+
1792
+ Size of internal queues, the core default is used when omitted.
1793
+
1750
1794
  #### Returns
1751
1795
 
1752
1796
  `Promise`\<`ChatApi`\>