@mtcute/core 0.29.5 → 0.29.7

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 (96) hide show
  1. package/client.cjs +12 -0
  2. package/client.js +12 -0
  3. package/highlevel/client.d.cts +49 -1
  4. package/highlevel/client.d.ts +49 -1
  5. package/highlevel/methods/bots/answer-bot-guest-chat-query.cjs +26 -0
  6. package/highlevel/methods/bots/answer-bot-guest-chat-query.d.cts +12 -0
  7. package/highlevel/methods/bots/answer-bot-guest-chat-query.d.ts +12 -0
  8. package/highlevel/methods/bots/answer-bot-guest-chat-query.js +21 -0
  9. package/highlevel/methods/files/normalize-input-media.cjs +21 -1
  10. package/highlevel/methods/files/normalize-input-media.js +21 -1
  11. package/highlevel/methods/messages/create-streaming-draft.cjs +57 -0
  12. package/highlevel/methods/messages/create-streaming-draft.d.cts +36 -0
  13. package/highlevel/methods/messages/create-streaming-draft.d.ts +36 -0
  14. package/highlevel/methods/messages/create-streaming-draft.js +52 -0
  15. package/highlevel/methods/messages/send-common.cjs +2 -1
  16. package/highlevel/methods/messages/send-common.d.cts +4 -0
  17. package/highlevel/methods/messages/send-common.d.ts +4 -0
  18. package/highlevel/methods/messages/send-common.js +2 -1
  19. package/highlevel/methods/messages/send-copy-group.cjs +5 -9
  20. package/highlevel/methods/messages/send-copy-group.js +5 -9
  21. package/highlevel/methods/messages/send-media.cjs +1 -1
  22. package/highlevel/methods/messages/send-media.d.cts +3 -0
  23. package/highlevel/methods/messages/send-media.d.ts +3 -0
  24. package/highlevel/methods/messages/send-media.js +1 -1
  25. package/highlevel/methods/messages/send-text.cjs +1 -1
  26. package/highlevel/methods/messages/send-text.d.cts +3 -0
  27. package/highlevel/methods/messages/send-text.d.ts +3 -0
  28. package/highlevel/methods/messages/send-text.js +1 -1
  29. package/highlevel/methods.d.cts +3 -0
  30. package/highlevel/methods.d.ts +3 -0
  31. package/highlevel/storage/service/peers.cjs +1 -0
  32. package/highlevel/storage/service/peers.js +1 -0
  33. package/highlevel/types/media/input-media/types.d.cts +14 -0
  34. package/highlevel/types/media/input-media/types.d.ts +14 -0
  35. package/highlevel/types/media/photo.cjs +8 -0
  36. package/highlevel/types/media/photo.d.cts +2 -0
  37. package/highlevel/types/media/photo.d.ts +2 -0
  38. package/highlevel/types/media/photo.js +8 -0
  39. package/highlevel/types/media/poll.cjs +58 -4
  40. package/highlevel/types/media/poll.d.cts +25 -1
  41. package/highlevel/types/media/poll.d.ts +25 -1
  42. package/highlevel/types/media/poll.js +58 -4
  43. package/highlevel/types/messages/message-media.cjs +6 -1
  44. package/highlevel/types/messages/message-media.js +6 -1
  45. package/highlevel/types/messages/message.cjs +10 -1
  46. package/highlevel/types/messages/message.d.cts +5 -0
  47. package/highlevel/types/messages/message.d.ts +5 -0
  48. package/highlevel/types/messages/message.js +10 -1
  49. package/highlevel/types/messages/replied-message.cjs +4 -0
  50. package/highlevel/types/messages/replied-message.d.cts +2 -0
  51. package/highlevel/types/messages/replied-message.d.ts +2 -0
  52. package/highlevel/types/messages/replied-message.js +4 -0
  53. package/highlevel/types/messages/search-filters.cjs +2 -1
  54. package/highlevel/types/messages/search-filters.d.cts +4 -0
  55. package/highlevel/types/messages/search-filters.d.ts +4 -0
  56. package/highlevel/types/messages/search-filters.js +2 -1
  57. package/highlevel/types/peers/chat-permissions.cjs +6 -0
  58. package/highlevel/types/peers/chat-permissions.d.cts +4 -0
  59. package/highlevel/types/peers/chat-permissions.d.ts +4 -0
  60. package/highlevel/types/peers/chat-permissions.js +6 -0
  61. package/highlevel/types/peers/user.cjs +4 -0
  62. package/highlevel/types/peers/user.d.cts +2 -0
  63. package/highlevel/types/peers/user.d.ts +2 -0
  64. package/highlevel/types/peers/user.js +4 -0
  65. package/highlevel/types/updates/bot-guest-chat-query.cjs +39 -0
  66. package/highlevel/types/updates/bot-guest-chat-query.d.cts +21 -0
  67. package/highlevel/types/updates/bot-guest-chat-query.d.ts +21 -0
  68. package/highlevel/types/updates/bot-guest-chat-query.js +34 -0
  69. package/highlevel/types/updates/index.d.cts +5 -1
  70. package/highlevel/types/updates/index.d.ts +5 -1
  71. package/highlevel/types/updates/parse-update.cjs +3 -0
  72. package/highlevel/types/updates/parse-update.js +3 -0
  73. package/highlevel/updates/manager.cjs +23 -3
  74. package/highlevel/updates/manager.d.cts +1 -0
  75. package/highlevel/updates/manager.d.ts +1 -0
  76. package/highlevel/updates/manager.js +23 -3
  77. package/index.cjs +2 -0
  78. package/index.js +2 -0
  79. package/methods.cjs +4 -0
  80. package/methods.js +4 -0
  81. package/network/network-manager.cjs +1 -1
  82. package/network/network-manager.js +1 -1
  83. package/package.json +1 -1
  84. package/tl/api-schema.json +1 -1
  85. package/tl/binary/reader.cjs +85 -40
  86. package/tl/binary/reader.js +85 -40
  87. package/tl/binary/writer.cjs +349 -143
  88. package/tl/binary/writer.js +349 -143
  89. package/tl/compat/reader.cjs +8 -0
  90. package/tl/compat/reader.js +8 -0
  91. package/tl/index.d.cts +2071 -179
  92. package/tl/index.d.ts +2071 -179
  93. package/tl/inner-tl.cjs +17 -5
  94. package/tl/inner-tl.js +17 -5
  95. package/utils/binary/compat.cjs +5 -0
  96. package/utils/binary/compat.js +5 -0
package/client.cjs CHANGED
@@ -20,6 +20,7 @@ const signIn = require("./highlevel/methods/auth/sign-in.cjs");
20
20
  const startTest = require("./highlevel/methods/auth/start-test.cjs");
21
21
  const start = require("./highlevel/methods/auth/start.cjs");
22
22
  const utils$1 = require("./highlevel/methods/auth/utils.cjs");
23
+ const answerBotGuestChatQuery = require("./highlevel/methods/bots/answer-bot-guest-chat-query.cjs");
23
24
  const answerCallbackQuery = require("./highlevel/methods/bots/answer-callback-query.cjs");
24
25
  const answerInlineQuery = require("./highlevel/methods/bots/answer-inline-query.cjs");
25
26
  const answerPreCheckoutQuery = require("./highlevel/methods/bots/answer-pre-checkout-query.cjs");
@@ -158,6 +159,7 @@ const iterInviteLinks = require("./highlevel/methods/invite-links/iter-invite-li
158
159
  const revokeInviteLink = require("./highlevel/methods/invite-links/revoke-invite-link.cjs");
159
160
  const appendTodoList = require("./highlevel/methods/messages/append-todo-list.cjs");
160
161
  const closePoll = require("./highlevel/methods/messages/close-poll.cjs");
162
+ const createStreamingDraft = require("./highlevel/methods/messages/create-streaming-draft.cjs");
161
163
  const deleteMessages = require("./highlevel/methods/messages/delete-messages.cjs");
162
164
  const deleteScheduledMessages = require("./highlevel/methods/messages/delete-scheduled-messages.cjs");
163
165
  const editInlineMessage = require("./highlevel/methods/messages/edit-inline-message.cjs");
@@ -302,6 +304,7 @@ class TelegramClient {
302
304
  this.onDeleteMessage = new utils.Emitter();
303
305
  this.onChatMemberUpdate = new utils.Emitter();
304
306
  this.onInlineQuery = new utils.Emitter();
307
+ this.onBotGuestChatQuery = new utils.Emitter();
305
308
  this.onChosenInlineResult = new utils.Emitter();
306
309
  this.onCallbackQuery = new utils.Emitter();
307
310
  this.onInlineCallbackQuery = new utils.Emitter();
@@ -372,6 +375,9 @@ class TelegramClient {
372
375
  case "inline_query":
373
376
  this.onInlineQuery.emit(update.data);
374
377
  break;
378
+ case "bot_guest_chat_query":
379
+ this.onBotGuestChatQuery.emit(update.data);
380
+ break;
375
381
  case "chosen_inline_result":
376
382
  this.onChosenInlineResult.emit(update.data);
377
383
  break;
@@ -487,6 +493,9 @@ TelegramClient.prototype.start = function(...args) {
487
493
  TelegramClient.prototype.isSelfPeer = function(...args) {
488
494
  return utils$1.isSelfPeer(this._client, ...args);
489
495
  };
496
+ TelegramClient.prototype.answerBotGuestChatQuery = function(...args) {
497
+ return answerBotGuestChatQuery.answerBotGuestChatQuery(this._client, ...args);
498
+ };
490
499
  TelegramClient.prototype.answerCallbackQuery = function(...args) {
491
500
  return answerCallbackQuery.answerCallbackQuery(this._client, ...args);
492
501
  };
@@ -922,6 +931,9 @@ TelegramClient.prototype.appendTodoList = function(...args) {
922
931
  TelegramClient.prototype.closePoll = function(...args) {
923
932
  return closePoll.closePoll(this._client, ...args);
924
933
  };
934
+ TelegramClient.prototype.createStreamingDraft = function(...args) {
935
+ return createStreamingDraft.createStreamingDraft(this._client, ...args);
936
+ };
925
937
  TelegramClient.prototype.deleteMessagesById = function(...args) {
926
938
  return deleteMessages.deleteMessagesById(this._client, ...args);
927
939
  };
package/client.js CHANGED
@@ -13,6 +13,7 @@ import { signIn } from "./highlevel/methods/auth/sign-in.js";
13
13
  import { startTest } from "./highlevel/methods/auth/start-test.js";
14
14
  import { start } from "./highlevel/methods/auth/start.js";
15
15
  import { isSelfPeer } from "./highlevel/methods/auth/utils.js";
16
+ import { answerBotGuestChatQuery } from "./highlevel/methods/bots/answer-bot-guest-chat-query.js";
16
17
  import { answerCallbackQuery } from "./highlevel/methods/bots/answer-callback-query.js";
17
18
  import { answerInlineQuery } from "./highlevel/methods/bots/answer-inline-query.js";
18
19
  import { answerPreCheckoutQuery } from "./highlevel/methods/bots/answer-pre-checkout-query.js";
@@ -151,6 +152,7 @@ import { iterInviteLinks } from "./highlevel/methods/invite-links/iter-invite-li
151
152
  import { revokeInviteLink } from "./highlevel/methods/invite-links/revoke-invite-link.js";
152
153
  import { appendTodoList } from "./highlevel/methods/messages/append-todo-list.js";
153
154
  import { closePoll } from "./highlevel/methods/messages/close-poll.js";
155
+ import { createStreamingDraft } from "./highlevel/methods/messages/create-streaming-draft.js";
154
156
  import { deleteMessagesById, deleteMessages } from "./highlevel/methods/messages/delete-messages.js";
155
157
  import { deleteScheduledMessages } from "./highlevel/methods/messages/delete-scheduled-messages.js";
156
158
  import { editInlineMessage } from "./highlevel/methods/messages/edit-inline-message.js";
@@ -295,6 +297,7 @@ class TelegramClient {
295
297
  this.onDeleteMessage = new Emitter();
296
298
  this.onChatMemberUpdate = new Emitter();
297
299
  this.onInlineQuery = new Emitter();
300
+ this.onBotGuestChatQuery = new Emitter();
298
301
  this.onChosenInlineResult = new Emitter();
299
302
  this.onCallbackQuery = new Emitter();
300
303
  this.onInlineCallbackQuery = new Emitter();
@@ -365,6 +368,9 @@ class TelegramClient {
365
368
  case "inline_query":
366
369
  this.onInlineQuery.emit(update.data);
367
370
  break;
371
+ case "bot_guest_chat_query":
372
+ this.onBotGuestChatQuery.emit(update.data);
373
+ break;
368
374
  case "chosen_inline_result":
369
375
  this.onChosenInlineResult.emit(update.data);
370
376
  break;
@@ -480,6 +486,9 @@ TelegramClient.prototype.start = function(...args) {
480
486
  TelegramClient.prototype.isSelfPeer = function(...args) {
481
487
  return isSelfPeer(this._client, ...args);
482
488
  };
489
+ TelegramClient.prototype.answerBotGuestChatQuery = function(...args) {
490
+ return answerBotGuestChatQuery(this._client, ...args);
491
+ };
483
492
  TelegramClient.prototype.answerCallbackQuery = function(...args) {
484
493
  return answerCallbackQuery(this._client, ...args);
485
494
  };
@@ -915,6 +924,9 @@ TelegramClient.prototype.appendTodoList = function(...args) {
915
924
  TelegramClient.prototype.closePoll = function(...args) {
916
925
  return closePoll(this._client, ...args);
917
926
  };
927
+ TelegramClient.prototype.createStreamingDraft = function(...args) {
928
+ return createStreamingDraft(this._client, ...args);
929
+ };
918
930
  TelegramClient.prototype.deleteMessagesById = function(...args) {
919
931
  return deleteMessagesById(this._client, ...args);
920
932
  };
@@ -10,6 +10,7 @@ import { GetForumTopicsOffset, getForumTopics } from './methods/forums/get-forum
10
10
  import { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/gifts/get-resale-star-gifts.js';
11
11
  import { StarGiftUpgradeOptions } from './methods/gifts/get-star-gift-upgrade-options.js';
12
12
  import { GetInviteLinksOffset, getInviteLinks } from './methods/invite-links/get-invite-links.js';
13
+ import { StreamingDraft } from './methods/messages/create-streaming-draft.js';
13
14
  import { DeleteMessagesParams } from './methods/messages/delete-messages.js';
14
15
  import { ForwardMessageOptions } from './methods/messages/forward-messages.js';
15
16
  import { GetHistoryOffset, getHistory } from './methods/messages/get-history.js';
@@ -26,7 +27,7 @@ import { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
26
27
  import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
27
28
  import { CanSendStoryResult } from './methods/stories/can-send-story.js';
28
29
  import { ITelegramStorageProvider } from './storage/provider.js';
29
- import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
30
+ import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotGuestChatQuery, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineMessage, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
30
31
  import { ParsedUpdateHandlerParams } from './updates/parsed.js';
31
32
  import { RawUpdateInfo } from './updates/types.js';
32
33
  import { InputStringSessionData } from './utils/string-session.js';
@@ -90,6 +91,8 @@ export interface TelegramClient extends ITelegramClient {
90
91
  readonly onChatMemberUpdate: Emitter<ChatMemberUpdate>;
91
92
  /** an inline query handler */
92
93
  readonly onInlineQuery: Emitter<InlineQuery>;
94
+ /** a bot guest chat query handler */
95
+ readonly onBotGuestChatQuery: Emitter<BotGuestChatQuery>;
93
96
  /** a chosen inline result handler */
94
97
  readonly onChosenInlineResult: Emitter<ChosenInlineResult>;
95
98
  /** a callback query handler */
@@ -411,6 +414,14 @@ export interface TelegramClient extends ITelegramClient {
411
414
  *
412
415
  */
413
416
  isSelfPeer(peer: tl.TypeInputPeer | tl.TypePeer | tl.TypeInputUser): boolean;
417
+ /**
418
+ * Answer a bot guest chat query with a result.
419
+ *
420
+ * @param queryId Query ID
421
+ * @param result Result of the query
422
+ * @returns ID of the inline message that was sent
423
+ */
424
+ answerBotGuestChatQuery(queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
414
425
  /**
415
426
  * Send an answer to a callback query.
416
427
  *
@@ -1112,6 +1123,8 @@ export interface TelegramClient extends ITelegramClient {
1112
1123
  }): Promise<void>;
1113
1124
  /**
1114
1125
  * Edit the custom rank (title) of a group chat participant.
1126
+ * **Available**: 👤 users only
1127
+ *
1115
1128
  */
1116
1129
  editChatMemberRank(params: {
1117
1130
  /** Chat ID */
@@ -1282,6 +1295,8 @@ export interface TelegramClient extends ITelegramClient {
1282
1295
  * Get the user who will be made the creator of the chat/channel/supergroup if you were to leave it.
1283
1296
  *
1284
1297
  * You must be the creator of the chat/channel/supergroup to use this method.
1298
+ * **Available**: 👤 users only
1299
+ *
1285
1300
  */
1286
1301
  getCreatorAfterLeave(chatId: InputPeerLike): Promise<User | null>;
1287
1302
  /**
@@ -1688,6 +1703,8 @@ export interface TelegramClient extends ITelegramClient {
1688
1703
  *
1689
1704
  * You must be the creator of the chat to use this method,
1690
1705
  * and your account must have 2FA enabled.
1706
+ * **Available**: 👤 users only
1707
+ *
1691
1708
  */
1692
1709
  transferChatOwnership(params: {
1693
1710
  /** ID of the chat/channel/supergroup to transfer */
@@ -3077,6 +3094,33 @@ export interface TelegramClient extends ITelegramClient {
3077
3094
  */
3078
3095
  shouldDispatch?: true;
3079
3096
  }): Promise<Poll>;
3097
+ /**
3098
+ * Create a streaming text message draft
3099
+ *
3100
+ * **Available**: 👤 users only
3101
+ *
3102
+ * @param chatId Chat ID
3103
+ * @param params
3104
+ */
3105
+ createStreamingDraft(chatId: InputPeerLike, params?: {
3106
+ /**
3107
+ * Unique identifier of the business connection on behalf of which the action will be sent
3108
+ */
3109
+ businessConnectionId?: string;
3110
+ /**
3111
+ * For comment threads, ID of the thread (i.e. top message)
3112
+ */
3113
+ threadId?: number;
3114
+ /**
3115
+ * Mode of the draft's `send` method
3116
+ *
3117
+ * - `append` - appends the text to the previous draft
3118
+ * - `replace` - replaces the previous draft with the new one
3119
+ *
3120
+ * @default `replace`
3121
+ */
3122
+ mode?: 'append' | 'replace';
3123
+ }): Promise<StreamingDraft>;
3080
3124
  /**
3081
3125
  * Delete messages by their IDs
3082
3126
  *
@@ -3949,6 +3993,8 @@ export interface TelegramClient extends ITelegramClient {
3949
3993
  * @link InputMedia
3950
3994
  */
3951
3995
  sendMedia(chatId: InputPeerLike, media: InputMediaLike | string, params?: CommonSendParams & {
3996
+ /** Override the default random ID, for streaming drafts */
3997
+ randomId?: Long;
3952
3998
  /**
3953
3999
  * For bots: inline or reply markup or an instruction
3954
4000
  * to hide a reply keyboard or to force a reply.
@@ -4072,6 +4118,8 @@ export interface TelegramClient extends ITelegramClient {
4072
4118
  * @param params Additional sending parameters
4073
4119
  */
4074
4120
  sendText(chatId: InputPeerLike, text: InputText, params?: CommonSendParams & {
4121
+ /** Override the default random ID, for streaming drafts */
4122
+ randomId?: Long;
4075
4123
  /**
4076
4124
  * For bots: inline or reply markup or an instruction
4077
4125
  * to hide a reply keyboard or to force a reply.
@@ -10,6 +10,7 @@ import { GetForumTopicsOffset, getForumTopics } from './methods/forums/get-forum
10
10
  import { InputStarGiftAttributeIds, ResaleStarGiftsMeta } from './methods/gifts/get-resale-star-gifts.js';
11
11
  import { StarGiftUpgradeOptions } from './methods/gifts/get-star-gift-upgrade-options.js';
12
12
  import { GetInviteLinksOffset, getInviteLinks } from './methods/invite-links/get-invite-links.js';
13
+ import { StreamingDraft } from './methods/messages/create-streaming-draft.js';
13
14
  import { DeleteMessagesParams } from './methods/messages/delete-messages.js';
14
15
  import { ForwardMessageOptions } from './methods/messages/forward-messages.js';
15
16
  import { GetHistoryOffset, getHistory } from './methods/messages/get-history.js';
@@ -26,7 +27,7 @@ import { InputStarsAmount } from './methods/premium/_normalize-stars-amount.js';
26
27
  import { CanApplyBoostResult } from './methods/premium/can-apply-boost.js';
27
28
  import { CanSendStoryResult } from './methods/stories/can-send-story.js';
28
29
  import { ITelegramStorageProvider } from './storage/provider.js';
29
- import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
30
+ import { AllStories, ArrayPaginated, ArrayPaginatedWithMeta, ArrayWithTotal, Audio, Boost, BoostSlot, BoostStats, BotChatJoinRequestUpdate, BotCommands, BotGuestChatQuery, BotReactionCountUpdate, BotReactionUpdate, BotStoppedUpdate, BusinessCallbackQuery, BusinessChatLink, BusinessConnection, BusinessMessage, BusinessWorkHoursDay, CallbackQuery, Chat, ChatEvent, ChatInviteLink, ChatInviteLinkMember, ChatJoinRequestUpdate, ChatlistPreview, ChatMember, ChatMemberUpdate, ChatPreview, ChosenInlineResult, CollectibleInfo, DeleteBusinessMessageUpdate, DeleteMessageUpdate, DeleteStoryUpdate, Dialog, FactCheck, FileDownloadLocation, FileDownloadParameters, ForumTopic, FullChat, FullUser, GameHighScore, HistoryReadUpdate, InlineCallbackQuery, InlineQuery, InputChatEventFilters, InputDialogFolder, InputDocumentId, InputFileLike, InputInlineMessage, InputInlineResult, InputMediaAudio, InputMediaLike, InputMediaSticker, InputMessageId, InputPeerLike, InputPrivacyRule, InputReaction, InputStarGift, InputStickerSet, InputStickerSetItem, InputText, InputWebview, MaybeDynamic, Message, MessageEffect, MessageMedia, MessageReactions, ParametersSkip2, ParsedUpdate, Peer, PeerReaction, PeerSettings, PeerStories, Photo, Poll, PollUpdate, PollVoteUpdate, PreCheckoutQuery, RawDocument, ReplyMarkup, SavedStarGift, SentCode, StarGift, StarGiftUnique, StarGiftValue, StarsStatus, StarsTransaction, Sticker, StickerSet, StickerType, StoriesStealthMode, Story, StoryInteractions, StoryUpdate, StoryViewer, StoryViewersList, TakeoutSession, TextWithEntities, TypingStatus, UploadedFile, UploadFileLike, User, UserStatusUpdate, UserTypingUpdate, WebPageMedia, WebviewResult } from './types/index.js';
30
31
  import { ParsedUpdateHandlerParams } from './updates/parsed.js';
31
32
  import { RawUpdateInfo } from './updates/types.js';
32
33
  import { InputStringSessionData } from './utils/string-session.js';
@@ -90,6 +91,8 @@ export interface TelegramClient extends ITelegramClient {
90
91
  readonly onChatMemberUpdate: Emitter<ChatMemberUpdate>;
91
92
  /** an inline query handler */
92
93
  readonly onInlineQuery: Emitter<InlineQuery>;
94
+ /** a bot guest chat query handler */
95
+ readonly onBotGuestChatQuery: Emitter<BotGuestChatQuery>;
93
96
  /** a chosen inline result handler */
94
97
  readonly onChosenInlineResult: Emitter<ChosenInlineResult>;
95
98
  /** a callback query handler */
@@ -411,6 +414,14 @@ export interface TelegramClient extends ITelegramClient {
411
414
  *
412
415
  */
413
416
  isSelfPeer(peer: tl.TypeInputPeer | tl.TypePeer | tl.TypeInputUser): boolean;
417
+ /**
418
+ * Answer a bot guest chat query with a result.
419
+ *
420
+ * @param queryId Query ID
421
+ * @param result Result of the query
422
+ * @returns ID of the inline message that was sent
423
+ */
424
+ answerBotGuestChatQuery(queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
414
425
  /**
415
426
  * Send an answer to a callback query.
416
427
  *
@@ -1112,6 +1123,8 @@ export interface TelegramClient extends ITelegramClient {
1112
1123
  }): Promise<void>;
1113
1124
  /**
1114
1125
  * Edit the custom rank (title) of a group chat participant.
1126
+ * **Available**: 👤 users only
1127
+ *
1115
1128
  */
1116
1129
  editChatMemberRank(params: {
1117
1130
  /** Chat ID */
@@ -1282,6 +1295,8 @@ export interface TelegramClient extends ITelegramClient {
1282
1295
  * Get the user who will be made the creator of the chat/channel/supergroup if you were to leave it.
1283
1296
  *
1284
1297
  * You must be the creator of the chat/channel/supergroup to use this method.
1298
+ * **Available**: 👤 users only
1299
+ *
1285
1300
  */
1286
1301
  getCreatorAfterLeave(chatId: InputPeerLike): Promise<User | null>;
1287
1302
  /**
@@ -1688,6 +1703,8 @@ export interface TelegramClient extends ITelegramClient {
1688
1703
  *
1689
1704
  * You must be the creator of the chat to use this method,
1690
1705
  * and your account must have 2FA enabled.
1706
+ * **Available**: 👤 users only
1707
+ *
1691
1708
  */
1692
1709
  transferChatOwnership(params: {
1693
1710
  /** ID of the chat/channel/supergroup to transfer */
@@ -3077,6 +3094,33 @@ export interface TelegramClient extends ITelegramClient {
3077
3094
  */
3078
3095
  shouldDispatch?: true;
3079
3096
  }): Promise<Poll>;
3097
+ /**
3098
+ * Create a streaming text message draft
3099
+ *
3100
+ * **Available**: 👤 users only
3101
+ *
3102
+ * @param chatId Chat ID
3103
+ * @param params
3104
+ */
3105
+ createStreamingDraft(chatId: InputPeerLike, params?: {
3106
+ /**
3107
+ * Unique identifier of the business connection on behalf of which the action will be sent
3108
+ */
3109
+ businessConnectionId?: string;
3110
+ /**
3111
+ * For comment threads, ID of the thread (i.e. top message)
3112
+ */
3113
+ threadId?: number;
3114
+ /**
3115
+ * Mode of the draft's `send` method
3116
+ *
3117
+ * - `append` - appends the text to the previous draft
3118
+ * - `replace` - replaces the previous draft with the new one
3119
+ *
3120
+ * @default `replace`
3121
+ */
3122
+ mode?: 'append' | 'replace';
3123
+ }): Promise<StreamingDraft>;
3080
3124
  /**
3081
3125
  * Delete messages by their IDs
3082
3126
  *
@@ -3949,6 +3993,8 @@ export interface TelegramClient extends ITelegramClient {
3949
3993
  * @link InputMedia
3950
3994
  */
3951
3995
  sendMedia(chatId: InputPeerLike, media: InputMediaLike | string, params?: CommonSendParams & {
3996
+ /** Override the default random ID, for streaming drafts */
3997
+ randomId?: Long;
3952
3998
  /**
3953
3999
  * For bots: inline or reply markup or an instruction
3954
4000
  * to hide a reply keyboard or to force a reply.
@@ -4072,6 +4118,8 @@ export interface TelegramClient extends ITelegramClient {
4072
4118
  * @param params Additional sending parameters
4073
4119
  */
4074
4120
  sendText(chatId: InputPeerLike, text: InputText, params?: CommonSendParams & {
4121
+ /** Override the default random ID, for streaming drafts */
4122
+ randomId?: Long;
4075
4123
  /**
4076
4124
  * For bots: inline or reply markup or an instruction
4077
4125
  * to hide a reply keyboard or to force a reply.
@@ -0,0 +1,26 @@
1
+ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
2
+ globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
3
+ console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
4
+ console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
5
+ }
6
+ "use strict";
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const Long = require("long");
9
+ const factories = require("../../types/bots/inline-result/factories.cjs");
10
+ async function answerBotGuestChatQuery(client, queryId, result) {
11
+ if (!("id" in result)) {
12
+ result = {
13
+ type: "article",
14
+ id: "guest",
15
+ title: "guest",
16
+ message: result
17
+ };
18
+ }
19
+ const [, tlResults] = await factories._convertToTl(client, [result]);
20
+ return client.call({
21
+ _: "messages.setBotGuestChatResult",
22
+ queryId: Long.isLong(queryId) ? queryId : queryId.id,
23
+ result: tlResults[0]
24
+ });
25
+ }
26
+ exports.answerBotGuestChatQuery = answerBotGuestChatQuery;
@@ -0,0 +1,12 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { ITelegramClient } from '../../client.types.js';
3
+ import { InputInlineMessage, InputInlineResult } from '../../types/bots/index.js';
4
+ import { BotGuestChatQuery } from '../../types/updates/bot-guest-chat-query.js';
5
+ /**
6
+ * Answer a bot guest chat query with a result.
7
+ *
8
+ * @param queryId Query ID
9
+ * @param result Result of the query
10
+ * @returns ID of the inline message that was sent
11
+ */
12
+ export declare function answerBotGuestChatQuery(client: ITelegramClient, queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
@@ -0,0 +1,12 @@
1
+ import { tl } from '../../../tl/index.js';
2
+ import { ITelegramClient } from '../../client.types.js';
3
+ import { InputInlineMessage, InputInlineResult } from '../../types/bots/index.js';
4
+ import { BotGuestChatQuery } from '../../types/updates/bot-guest-chat-query.js';
5
+ /**
6
+ * Answer a bot guest chat query with a result.
7
+ *
8
+ * @param queryId Query ID
9
+ * @param result Result of the query
10
+ * @returns ID of the inline message that was sent
11
+ */
12
+ export declare function answerBotGuestChatQuery(client: ITelegramClient, queryId: tl.Long | BotGuestChatQuery, result: InputInlineMessage | InputInlineResult): Promise<tl.TypeInputBotInlineMessageID>;
@@ -0,0 +1,21 @@
1
+ import Long from "long";
2
+ import { _convertToTl } from "../../types/bots/inline-result/factories.js";
3
+ async function answerBotGuestChatQuery(client, queryId, result) {
4
+ if (!("id" in result)) {
5
+ result = {
6
+ type: "article",
7
+ id: "guest",
8
+ title: "guest",
9
+ message: result
10
+ };
11
+ }
12
+ const [, tlResults] = await _convertToTl(client, [result]);
13
+ return client.call({
14
+ _: "messages.setBotGuestChatResult",
15
+ queryId: Long.isLong(queryId) ? queryId : queryId.id,
16
+ result: tlResults[0]
17
+ });
18
+ }
19
+ export {
20
+ answerBotGuestChatQuery
21
+ };
@@ -135,6 +135,10 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
135
135
  let correct;
136
136
  let solution;
137
137
  let solutionEntities;
138
+ const [attachedMedia, solutionMedia] = await Promise.all([
139
+ media.attachedMedia ? _normalizeInputMedia(client, media.attachedMedia, params, true) : void 0,
140
+ media.type === "quiz" && media.solutionMedia ? _normalizeInputMedia(client, media.solutionMedia, params, true) : void 0
141
+ ]);
138
142
  if (media.type === "quiz") {
139
143
  let input2 = media.correct;
140
144
  if (!Array.isArray(input2)) input2 = [input2];
@@ -145,6 +149,8 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
145
149
  }
146
150
  return {
147
151
  _: "inputMediaPoll",
152
+ attachedMedia,
153
+ solutionMedia,
148
154
  poll: {
149
155
  _: "poll",
150
156
  closed: media.closed,
@@ -156,6 +162,10 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
156
162
  answers,
157
163
  closePeriod: media.closePeriod,
158
164
  closeDate: miscUtils.normalizeDate(media.closeDate),
165
+ openAnswers: media.openAnswers,
166
+ revotingDisabled: media.disableRevoting,
167
+ shuffleAnswers: media.shuffleAnswers,
168
+ hideResultsUntilClose: media.hideResultsUntilClose,
159
169
  hash: Long.ZERO
160
170
  },
161
171
  correctAnswers: correct,
@@ -238,6 +248,12 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
238
248
  typeAssertions.assertTypeIs("uploadMediaIfNeeded", inputMedia, "inputMediaPhoto");
239
249
  videoCover = inputMedia.id;
240
250
  }
251
+ let livePhotoVideo;
252
+ if (media.type === "photo" && media.livePhotoVideo) {
253
+ const inputMedia = await _normalizeInputMedia(client, media.livePhotoVideo, params, true);
254
+ typeAssertions.assertTypeIs("uploadMediaIfNeeded", inputMedia, "inputMediaDocument");
255
+ livePhotoVideo = inputMedia.id;
256
+ }
241
257
  const uploadPeer = params.uploadPeer ?? { _: "inputPeerSelf" };
242
258
  const uploadMediaIfNeeded = async (inputMedia, photo) => {
243
259
  if (!uploadMedia) return inputMedia;
@@ -259,7 +275,9 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
259
275
  fileReference: res.photo.fileReference
260
276
  },
261
277
  ttlSeconds: media.ttlSeconds,
262
- spoiler: media.type === "video" && media.spoiler
278
+ spoiler: media.type === "video" && media.spoiler,
279
+ livePhoto: Boolean(livePhotoVideo),
280
+ video: livePhotoVideo
263
281
  };
264
282
  }
265
283
  typeAssertions.assertTypeIs("normalizeInputMedia (@ messages.uploadMedia)", res, "messageMediaDocument");
@@ -336,6 +354,8 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
336
354
  {
337
355
  _: "inputMediaUploadedPhoto",
338
356
  file: inputFile,
357
+ livePhoto: Boolean(livePhotoVideo),
358
+ video: livePhotoVideo,
339
359
  ttlSeconds: media.ttlSeconds,
340
360
  spoiler: media.spoiler
341
361
  },
@@ -128,6 +128,10 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
128
128
  let correct;
129
129
  let solution;
130
130
  let solutionEntities;
131
+ const [attachedMedia, solutionMedia] = await Promise.all([
132
+ media.attachedMedia ? _normalizeInputMedia(client, media.attachedMedia, params, true) : void 0,
133
+ media.type === "quiz" && media.solutionMedia ? _normalizeInputMedia(client, media.solutionMedia, params, true) : void 0
134
+ ]);
131
135
  if (media.type === "quiz") {
132
136
  let input2 = media.correct;
133
137
  if (!Array.isArray(input2)) input2 = [input2];
@@ -138,6 +142,8 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
138
142
  }
139
143
  return {
140
144
  _: "inputMediaPoll",
145
+ attachedMedia,
146
+ solutionMedia,
141
147
  poll: {
142
148
  _: "poll",
143
149
  closed: media.closed,
@@ -149,6 +155,10 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
149
155
  answers,
150
156
  closePeriod: media.closePeriod,
151
157
  closeDate: normalizeDate(media.closeDate),
158
+ openAnswers: media.openAnswers,
159
+ revotingDisabled: media.disableRevoting,
160
+ shuffleAnswers: media.shuffleAnswers,
161
+ hideResultsUntilClose: media.hideResultsUntilClose,
152
162
  hash: Long.ZERO
153
163
  },
154
164
  correctAnswers: correct,
@@ -231,6 +241,12 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
231
241
  assertTypeIs("uploadMediaIfNeeded", inputMedia, "inputMediaPhoto");
232
242
  videoCover = inputMedia.id;
233
243
  }
244
+ let livePhotoVideo;
245
+ if (media.type === "photo" && media.livePhotoVideo) {
246
+ const inputMedia = await _normalizeInputMedia(client, media.livePhotoVideo, params, true);
247
+ assertTypeIs("uploadMediaIfNeeded", inputMedia, "inputMediaDocument");
248
+ livePhotoVideo = inputMedia.id;
249
+ }
234
250
  const uploadPeer = params.uploadPeer ?? { _: "inputPeerSelf" };
235
251
  const uploadMediaIfNeeded = async (inputMedia, photo) => {
236
252
  if (!uploadMedia) return inputMedia;
@@ -252,7 +268,9 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
252
268
  fileReference: res.photo.fileReference
253
269
  },
254
270
  ttlSeconds: media.ttlSeconds,
255
- spoiler: media.type === "video" && media.spoiler
271
+ spoiler: media.type === "video" && media.spoiler,
272
+ livePhoto: Boolean(livePhotoVideo),
273
+ video: livePhotoVideo
256
274
  };
257
275
  }
258
276
  assertTypeIs("normalizeInputMedia (@ messages.uploadMedia)", res, "messageMediaDocument");
@@ -329,6 +347,8 @@ async function _normalizeInputMedia(client, media, params = {}, uploadMedia = fa
329
347
  {
330
348
  _: "inputMediaUploadedPhoto",
331
349
  file: inputFile,
350
+ livePhoto: Boolean(livePhotoVideo),
351
+ video: livePhotoVideo,
332
352
  ttlSeconds: media.ttlSeconds,
333
353
  spoiler: media.spoiler
334
354
  },
@@ -0,0 +1,57 @@
1
+ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
2
+ globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
3
+ console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
4
+ console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
5
+ }
6
+ "use strict";
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const longUtils = require("../../../utils/long-utils.cjs");
9
+ const typeAssertions = require("../../../utils/type-assertions.cjs");
10
+ const entities = require("../../utils/entities.cjs");
11
+ const normalizeText = require("../misc/normalize-text.cjs");
12
+ const resolvePeer = require("../users/resolve-peer.cjs");
13
+ async function createStreamingDraft(client, chatId, params) {
14
+ const {
15
+ mode = "replace",
16
+ threadId,
17
+ businessConnectionId
18
+ } = params ?? {};
19
+ const randomId = longUtils.randomLong();
20
+ const peer = await resolvePeer.resolvePeer(client, chatId);
21
+ let previousText;
22
+ const sendDraft = async (text) => {
23
+ if (typeof text === "string") {
24
+ text = { text };
25
+ }
26
+ if (mode === "append" && previousText) {
27
+ text = entities.joinTextWithEntities([previousText, text]);
28
+ }
29
+ previousText = text;
30
+ const [_text, entities$1 = []] = await normalizeText._normalizeInputText(client, text);
31
+ const r = await client.call({
32
+ _: "messages.setTyping",
33
+ peer,
34
+ action: {
35
+ _: "sendMessageTextDraftAction",
36
+ text: {
37
+ _: "textWithEntities",
38
+ text: _text,
39
+ entities: entities$1
40
+ },
41
+ randomId
42
+ },
43
+ topMsgId: threadId
44
+ }, {
45
+ businessConnectionId
46
+ });
47
+ typeAssertions.assertTrue("messages.setTyping", r);
48
+ };
49
+ return {
50
+ randomId,
51
+ send: sendDraft,
52
+ get finalText() {
53
+ return previousText ?? { text: "", entities: [] };
54
+ }
55
+ };
56
+ }
57
+ exports.createStreamingDraft = createStreamingDraft;
@@ -0,0 +1,36 @@
1
+ import { default as Long } from 'long';
2
+ import { ITelegramClient } from '../../client.types.js';
3
+ import { InputPeerLike, InputText, TextWithEntities } from '../../types/index.js';
4
+ export interface StreamingDraft {
5
+ /** Random ID of the draft */
6
+ readonly randomId: Long;
7
+ /** Depending on the `mode`, this method will either append or replace the draft */
8
+ send(text: InputText): Promise<void>;
9
+ /** Final text of the draft, for convenience */
10
+ get finalText(): TextWithEntities;
11
+ }
12
+ /**
13
+ * Create a streaming text message draft
14
+ *
15
+ * @param chatId Chat ID
16
+ * @param params
17
+ */
18
+ export declare function createStreamingDraft(client: ITelegramClient, chatId: InputPeerLike, params?: {
19
+ /**
20
+ * Unique identifier of the business connection on behalf of which the action will be sent
21
+ */
22
+ businessConnectionId?: string;
23
+ /**
24
+ * For comment threads, ID of the thread (i.e. top message)
25
+ */
26
+ threadId?: number;
27
+ /**
28
+ * Mode of the draft's `send` method
29
+ *
30
+ * - `append` - appends the text to the previous draft
31
+ * - `replace` - replaces the previous draft with the new one
32
+ *
33
+ * @default `replace`
34
+ */
35
+ mode?: 'append' | 'replace';
36
+ }): Promise<StreamingDraft>;