@mtcute/core 0.18.0-rc.5 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.cts +1 -0
- package/highlevel/base.d.cts +115 -0
- package/highlevel/base.test.d.cts +1 -0
- package/highlevel/client.d.cts +5045 -0
- package/highlevel/client.types.d.cts +61 -0
- package/highlevel/index.d.cts +4 -0
- package/highlevel/managers/app-config-manager.d.cts +11 -0
- package/highlevel/managers/timers.d.cts +10 -0
- package/highlevel/methods/_imports.d.cts +1 -0
- package/highlevel/methods/_init.d.cts +1 -0
- package/highlevel/methods/auth/check-password.d.cts +10 -0
- package/highlevel/methods/auth/get-password-hint.d.cts +7 -0
- package/highlevel/methods/auth/log-out.d.cts +17 -0
- package/highlevel/methods/auth/recover-password.d.cts +12 -0
- package/highlevel/methods/auth/resend-code.d.cts +16 -0
- package/highlevel/methods/auth/run.d.cts +16 -0
- package/highlevel/methods/auth/send-code.d.cts +18 -0
- package/highlevel/methods/auth/send-recovery-code.d.cts +7 -0
- package/highlevel/methods/auth/sign-in-bot.d.cts +10 -0
- package/highlevel/methods/auth/sign-in-qr.d.cts +33 -0
- package/highlevel/methods/auth/sign-in.d.cts +19 -0
- package/highlevel/methods/auth/start-test.d.cts +30 -0
- package/highlevel/methods/auth/start.d.cts +89 -0
- package/highlevel/methods/auth/utils.d.cts +9 -0
- package/highlevel/methods/bots/answer-callback-query.d.cts +41 -0
- package/highlevel/methods/bots/answer-inline-query.d.cts +88 -0
- package/highlevel/methods/bots/answer-pre-checkout-query.d.cts +12 -0
- package/highlevel/methods/bots/delete-my-commands.d.cts +22 -0
- package/highlevel/methods/bots/get-bot-info.d.cts +18 -0
- package/highlevel/methods/bots/get-bot-menu-button.d.cts +7 -0
- package/highlevel/methods/bots/get-callback-answer.d.cts +41 -0
- package/highlevel/methods/bots/get-game-high-scores.d.cts +17 -0
- package/highlevel/methods/bots/get-my-commands.d.cts +21 -0
- package/highlevel/methods/bots/normalize-command-scope.d.cts +5 -0
- package/highlevel/methods/bots/open-webview.d.cts +73 -0
- package/highlevel/methods/bots/prepare-inline-message.d.cts +32 -0
- package/highlevel/methods/bots/set-bot-info.d.cts +23 -0
- package/highlevel/methods/bots/set-bot-menu-button.d.cts +7 -0
- package/highlevel/methods/bots/set-game-score.d.cts +54 -0
- package/highlevel/methods/bots/set-my-commands.d.cts +26 -0
- package/highlevel/methods/bots/set-my-default-rights.d.cts +11 -0
- package/highlevel/methods/bots/toggle-emoji-status-permission.d.cts +11 -0
- package/highlevel/methods/chats/add-chat-members.d.cts +20 -0
- package/highlevel/methods/chats/archive-chats.d.cts +9 -0
- package/highlevel/methods/chats/ban-chat-member.d.cts +24 -0
- package/highlevel/methods/chats/batched-queries.d.cts +11 -0
- package/highlevel/methods/chats/create-channel.d.cts +17 -0
- package/highlevel/methods/chats/create-group.d.cts +33 -0
- package/highlevel/methods/chats/create-supergroup.d.cts +27 -0
- package/highlevel/methods/chats/delete-channel.d.cts +8 -0
- package/highlevel/methods/chats/delete-chat-photo.d.cts +10 -0
- package/highlevel/methods/chats/delete-group.d.cts +8 -0
- package/highlevel/methods/chats/delete-history.d.cts +22 -0
- package/highlevel/methods/chats/delete-user-history.d.cts +16 -0
- package/highlevel/methods/chats/edit-admin-rights.d.cts +16 -0
- package/highlevel/methods/chats/get-chat-event-log.d.cts +61 -0
- package/highlevel/methods/chats/get-chat-member.d.cts +15 -0
- package/highlevel/methods/chats/get-chat-members.d.cts +51 -0
- package/highlevel/methods/chats/get-chat-preview.d.cts +12 -0
- package/highlevel/methods/chats/get-chat.d.cts +11 -0
- package/highlevel/methods/chats/get-full-chat.d.cts +11 -0
- package/highlevel/methods/chats/get-full-user.d.cts +8 -0
- package/highlevel/methods/chats/get-nearby-chats.d.cts +9 -0
- package/highlevel/methods/chats/get-similar-channels.d.cts +12 -0
- package/highlevel/methods/chats/get-user.d.cts +8 -0
- package/highlevel/methods/chats/iter-chat-event-log.d.cts +26 -0
- package/highlevel/methods/chats/iter-chat-members.d.cts +22 -0
- package/highlevel/methods/chats/join-chat.d.cts +14 -0
- package/highlevel/methods/chats/kick-chat-member.d.cts +15 -0
- package/highlevel/methods/chats/leave-chat.d.cts +13 -0
- package/highlevel/methods/chats/mark-chat-unread.d.cts +8 -0
- package/highlevel/methods/chats/open-chat.d.cts +26 -0
- package/highlevel/methods/chats/reorder-usernames.d.cts +8 -0
- package/highlevel/methods/chats/restrict-chat-member.d.cts +28 -0
- package/highlevel/methods/chats/save-draft.d.cts +10 -0
- package/highlevel/methods/chats/set-chat-color.d.cts +38 -0
- package/highlevel/methods/chats/set-chat-default-permissions.d.cts +16 -0
- package/highlevel/methods/chats/set-chat-description.d.cts +11 -0
- package/highlevel/methods/chats/set-chat-photo.d.cts +20 -0
- package/highlevel/methods/chats/set-chat-title.d.cts +11 -0
- package/highlevel/methods/chats/set-chat-ttl.d.cts +9 -0
- package/highlevel/methods/chats/set-chat-username.d.cts +11 -0
- package/highlevel/methods/chats/set-slow-mode.d.cts +12 -0
- package/highlevel/methods/chats/toggle-content-protection.d.cts +9 -0
- package/highlevel/methods/chats/toggle-fragment-username.d.cts +20 -0
- package/highlevel/methods/chats/toggle-join-requests.d.cts +12 -0
- package/highlevel/methods/chats/toggle-join-to-send.d.cts +12 -0
- package/highlevel/methods/chats/unarchive-chats.d.cts +9 -0
- package/highlevel/methods/chats/unban-chat-member.d.cts +16 -0
- package/highlevel/methods/contacts/add-contact.d.cts +28 -0
- package/highlevel/methods/contacts/delete-contacts.d.cts +12 -0
- package/highlevel/methods/contacts/get-contacts.d.cts +6 -0
- package/highlevel/methods/contacts/import-contacts.d.cts +9 -0
- package/highlevel/methods/dialogs/create-folder.d.cts +13 -0
- package/highlevel/methods/dialogs/delete-folder.d.cts +8 -0
- package/highlevel/methods/dialogs/edit-folder.d.cts +18 -0
- package/highlevel/methods/dialogs/find-dialogs.d.cts +12 -0
- package/highlevel/methods/dialogs/find-folder.d.cts +19 -0
- package/highlevel/methods/dialogs/get-chatlist-preview.d.cts +8 -0
- package/highlevel/methods/dialogs/get-folders.d.cts +9 -0
- package/highlevel/methods/dialogs/get-peer-dialogs.d.cts +10 -0
- package/highlevel/methods/dialogs/iter-dialogs.d.cts +103 -0
- package/highlevel/methods/dialogs/join-chatlist.d.cts +15 -0
- package/highlevel/methods/dialogs/set-folders-order.d.cts +7 -0
- package/highlevel/methods/files/download-buffer.d.cts +11 -0
- package/highlevel/methods/files/download-file.d.cts +1 -0
- package/highlevel/methods/files/download-iterable.cjs +9 -7
- package/highlevel/methods/files/download-iterable.d.cts +10 -0
- package/highlevel/methods/files/download-iterable.js +9 -7
- package/highlevel/methods/files/download-node-stream.d.cts +1 -0
- package/highlevel/methods/files/download-stream.d.cts +9 -0
- package/highlevel/methods/files/normalize-file-to-document.d.cts +9 -0
- package/highlevel/methods/files/normalize-input-file.d.cts +13 -0
- package/highlevel/methods/files/normalize-input-media.d.cts +12 -0
- package/highlevel/methods/files/upload-file.d.cts +72 -0
- package/highlevel/methods/files/upload-media.d.cts +28 -0
- package/highlevel/methods/forums/create-forum-topic.d.cts +36 -0
- package/highlevel/methods/forums/delete-forum-topic-history.d.cts +15 -0
- package/highlevel/methods/forums/edit-forum-topic.d.cts +34 -0
- package/highlevel/methods/forums/get-forum-topics-by-id.d.cts +9 -0
- package/highlevel/methods/forums/get-forum-topics.d.cts +28 -0
- package/highlevel/methods/forums/iter-forum-topics.d.cts +20 -0
- package/highlevel/methods/forums/reorder-pinned-forum-topics.d.cts +19 -0
- package/highlevel/methods/forums/toggle-forum-topic-closed.d.cts +22 -0
- package/highlevel/methods/forums/toggle-forum-topic-pinned.d.cts +15 -0
- package/highlevel/methods/forums/toggle-forum.d.cts +11 -0
- package/highlevel/methods/forums/toggle-general-topic-hidden.d.cts +20 -0
- package/highlevel/methods/invite-links/create-invite-link.d.cts +38 -0
- package/highlevel/methods/invite-links/edit-invite-link.d.cts +36 -0
- package/highlevel/methods/invite-links/export-invite-link.d.cts +12 -0
- package/highlevel/methods/invite-links/get-invite-link-members.d.cts +45 -0
- package/highlevel/methods/invite-links/get-invite-link.d.cts +9 -0
- package/highlevel/methods/invite-links/get-invite-links.d.cts +39 -0
- package/highlevel/methods/invite-links/get-primary-invite-link.d.cts +8 -0
- package/highlevel/methods/invite-links/hide-all-join-requests.d.cts +13 -0
- package/highlevel/methods/invite-links/hide-join-request.d.cts +13 -0
- package/highlevel/methods/invite-links/iter-invite-link-members.d.cts +25 -0
- package/highlevel/methods/invite-links/iter-invite-links.d.cts +27 -0
- package/highlevel/methods/invite-links/revoke-invite-link.d.cts +13 -0
- package/highlevel/methods/messages/_business-connection.d.cts +8 -0
- package/highlevel/methods/messages/close-poll.d.cts +15 -0
- package/highlevel/methods/messages/delete-messages.d.cts +29 -0
- package/highlevel/methods/messages/delete-scheduled-messages.d.cts +9 -0
- package/highlevel/methods/messages/edit-inline-message.d.cts +51 -0
- package/highlevel/methods/messages/edit-message.d.cts +55 -0
- package/highlevel/methods/messages/find-in-update.d.cts +13 -0
- package/highlevel/methods/messages/forward-messages.d.cts +84 -0
- package/highlevel/methods/messages/get-all-scheduled-messages.d.cts +8 -0
- package/highlevel/methods/messages/get-available-effects.d.cts +6 -0
- package/highlevel/methods/messages/get-callback-query-message.d.cts +14 -0
- package/highlevel/methods/messages/get-discussion-message.d.cts +21 -0
- package/highlevel/methods/messages/get-fact-check.d.cts +11 -0
- package/highlevel/methods/messages/get-history.d.cts +59 -0
- package/highlevel/methods/messages/get-message-by-link.d.cts +6 -0
- package/highlevel/methods/messages/get-message-group.d.cts +9 -0
- package/highlevel/methods/messages/get-message-reactions.d.cts +28 -0
- package/highlevel/methods/messages/get-messages-unsafe.d.cts +19 -0
- package/highlevel/methods/messages/get-messages.d.cts +17 -0
- package/highlevel/methods/messages/get-reaction-users.d.cts +24 -0
- package/highlevel/methods/messages/get-reply-to.d.cts +10 -0
- package/highlevel/methods/messages/get-scheduled-messages.d.cts +13 -0
- package/highlevel/methods/messages/iter-history.d.cts +23 -0
- package/highlevel/methods/messages/iter-reaction-users.d.cts +26 -0
- package/highlevel/methods/messages/iter-search-global.d.cts +27 -0
- package/highlevel/methods/messages/iter-search-messages.d.cts +26 -0
- package/highlevel/methods/messages/pin-message.d.cts +21 -0
- package/highlevel/methods/messages/read-history.d.cts +24 -0
- package/highlevel/methods/messages/read-reactions.d.cts +14 -0
- package/highlevel/methods/messages/search-global.d.cts +51 -0
- package/highlevel/methods/messages/search-hashtag.d.cts +44 -0
- package/highlevel/methods/messages/search-messages.d.cts +93 -0
- package/highlevel/methods/messages/send-answer.d.cts +12 -0
- package/highlevel/methods/messages/send-comment.d.cts +39 -0
- package/highlevel/methods/messages/send-common.d.cts +122 -0
- package/highlevel/methods/messages/send-copy-group.d.cts +21 -0
- package/highlevel/methods/messages/send-copy.d.cts +32 -0
- package/highlevel/methods/messages/send-media-group.d.cts +35 -0
- package/highlevel/methods/messages/send-media.d.cts +48 -0
- package/highlevel/methods/messages/send-paid-reaction.d.cts +24 -0
- package/highlevel/methods/messages/send-quote.d.cts +33 -0
- package/highlevel/methods/messages/send-reaction.d.cts +21 -0
- package/highlevel/methods/messages/send-reply.d.cts +12 -0
- package/highlevel/methods/messages/send-scheduled.d.cts +14 -0
- package/highlevel/methods/messages/send-text.d.cts +31 -0
- package/highlevel/methods/messages/send-text.test.d.cts +1 -0
- package/highlevel/methods/messages/send-typing.d.cts +32 -0
- package/highlevel/methods/messages/send-vote.d.cts +15 -0
- package/highlevel/methods/messages/set-typing.d.cts +33 -0
- package/highlevel/methods/messages/translate-message.d.cts +11 -0
- package/highlevel/methods/messages/translate-text.d.cts +9 -0
- package/highlevel/methods/messages/unpin-all-messages.d.cts +18 -0
- package/highlevel/methods/messages/unpin-message.d.cts +12 -0
- package/highlevel/methods/misc/chain-id.d.cts +4 -0
- package/highlevel/methods/misc/get-collectible-info.d.cts +6 -0
- package/highlevel/methods/misc/init-takeout-session.d.cts +9 -0
- package/highlevel/methods/misc/normalize-privacy-rules.d.cts +8 -0
- package/highlevel/methods/misc/normalize-text.d.cts +5 -0
- package/highlevel/methods/misc/with-params.d.cts +10 -0
- package/highlevel/methods/password/change-cloud-password.d.cts +12 -0
- package/highlevel/methods/password/enable-cloud-password.d.cts +17 -0
- package/highlevel/methods/password/password-email.d.cts +15 -0
- package/highlevel/methods/password/remove-cloud-password.d.cts +7 -0
- package/highlevel/methods/premium/accept-star-gift.d.cts +16 -0
- package/highlevel/methods/premium/apply-boost.d.cts +8 -0
- package/highlevel/methods/premium/can-apply-boost.d.cts +29 -0
- package/highlevel/methods/premium/create-business-chat-link.d.cts +12 -0
- package/highlevel/methods/premium/edit-business-chat-link.d.cts +20 -0
- package/highlevel/methods/premium/get-boost-stats.d.cts +9 -0
- package/highlevel/methods/premium/get-boosts.d.cts +18 -0
- package/highlevel/methods/premium/get-business-chat-links.d.cts +6 -0
- package/highlevel/methods/premium/get-business-connection.d.cts +8 -0
- package/highlevel/methods/premium/get-my-boost-slots.d.cts +9 -0
- package/highlevel/methods/premium/get-star-gift-options.d.cts +6 -0
- package/highlevel/methods/premium/get-star-gifts.d.cts +22 -0
- package/highlevel/methods/premium/get-stars-transactions.d.cts +34 -0
- package/highlevel/methods/premium/iter-boosters.d.cts +24 -0
- package/highlevel/methods/premium/iter-star-gifts.d.cts +26 -0
- package/highlevel/methods/premium/iter-stars-transactions.d.cts +29 -0
- package/highlevel/methods/premium/send-star-gift.d.cts +35 -0
- package/highlevel/methods/premium/set-business-intro.d.cts +22 -0
- package/highlevel/methods/premium/set-business-work-hours.d.cts +18 -0
- package/highlevel/methods/stickers/_utils.d.cts +10 -0
- package/highlevel/methods/stickers/add-sticker-to-set.d.cts +21 -0
- package/highlevel/methods/stickers/create-sticker-set.d.cts +66 -0
- package/highlevel/methods/stickers/delete-sticker-from-set.d.cts +15 -0
- package/highlevel/methods/stickers/get-custom-emojis.d.cts +14 -0
- package/highlevel/methods/stickers/get-installed-stickers.d.cts +10 -0
- package/highlevel/methods/stickers/get-my-sticker-sets.d.cts +13 -0
- package/highlevel/methods/stickers/get-sticker-set.d.cts +8 -0
- package/highlevel/methods/stickers/move-sticker-in-set.d.cts +17 -0
- package/highlevel/methods/stickers/replace-sticker-in-set.d.cts +24 -0
- package/highlevel/methods/stickers/set-chat-sticker-set.d.cts +11 -0
- package/highlevel/methods/stickers/set-sticker-set-thumb.d.cts +20 -0
- package/highlevel/methods/stories/can-send-story.d.cts +13 -0
- package/highlevel/methods/stories/delete-stories.d.cts +20 -0
- package/highlevel/methods/stories/edit-story.d.cts +38 -0
- package/highlevel/methods/stories/find-in-update.d.cts +5 -0
- package/highlevel/methods/stories/get-all-stories.d.cts +15 -0
- package/highlevel/methods/stories/get-peer-stories.d.cts +8 -0
- package/highlevel/methods/stories/get-profile-stories.d.cts +25 -0
- package/highlevel/methods/stories/get-stories-by-id.d.cts +10 -0
- package/highlevel/methods/stories/get-stories-interactions.d.cts +9 -0
- package/highlevel/methods/stories/get-story-link.d.cts +11 -0
- package/highlevel/methods/stories/get-story-viewers.d.cts +33 -0
- package/highlevel/methods/stories/hide-my-stories-views.d.cts +21 -0
- package/highlevel/methods/stories/increment-stories-views.d.cts +13 -0
- package/highlevel/methods/stories/iter-all-stories.d.cts +16 -0
- package/highlevel/methods/stories/iter-profile-stories.d.cts +21 -0
- package/highlevel/methods/stories/iter-story-viewers.d.cts +22 -0
- package/highlevel/methods/stories/read-stories.d.cts +11 -0
- package/highlevel/methods/stories/send-story-reaction.d.cts +14 -0
- package/highlevel/methods/stories/send-story.d.cts +51 -0
- package/highlevel/methods/stories/toggle-peer-stories-archived.d.cts +8 -0
- package/highlevel/methods/stories/toggle-stories-pinned.d.cts +24 -0
- package/highlevel/methods/users/block-user.d.cts +8 -0
- package/highlevel/methods/users/delete-profile-photos.d.cts +9 -0
- package/highlevel/methods/users/edit-close-friends.d.cts +14 -0
- package/highlevel/methods/users/get-common-chats.d.cts +9 -0
- package/highlevel/methods/users/get-global-ttl.d.cts +5 -0
- package/highlevel/methods/users/get-me.d.cts +6 -0
- package/highlevel/methods/users/get-my-username.d.cts +8 -0
- package/highlevel/methods/users/get-profile-photo.d.cts +11 -0
- package/highlevel/methods/users/get-profile-photos.d.cts +22 -0
- package/highlevel/methods/users/get-users.d.cts +12 -0
- package/highlevel/methods/users/get-users.test.d.cts +1 -0
- package/highlevel/methods/users/is-peer-available.d.cts +20 -0
- package/highlevel/methods/users/iter-profile-photos.d.cts +23 -0
- package/highlevel/methods/users/resolve-peer-many.d.cts +26 -0
- package/highlevel/methods/users/resolve-peer.d.cts +20 -0
- package/highlevel/methods/users/resolve-peer.test.d.cts +1 -0
- package/highlevel/methods/users/set-emoji-status.d.cts +32 -0
- package/highlevel/methods/users/set-global-ttl.d.cts +8 -0
- package/highlevel/methods/users/set-my-birthday.d.cts +12 -0
- package/highlevel/methods/users/set-my-profile-photo.d.cts +16 -0
- package/highlevel/methods/users/set-my-username.d.cts +11 -0
- package/highlevel/methods/users/set-online.d.cts +19 -0
- package/highlevel/methods/users/unblock-user.d.cts +8 -0
- package/highlevel/methods/users/update-profile.d.cts +23 -0
- package/highlevel/methods.d.cts +291 -0
- package/highlevel/storage/index.d.cts +4 -0
- package/highlevel/storage/provider.d.cts +7 -0
- package/highlevel/storage/repository/peers.d.cts +44 -0
- package/highlevel/storage/repository/ref-messages.d.cts +20 -0
- package/highlevel/storage/service/current-user.d.cts +23 -0
- package/highlevel/storage/service/peers.d.cts +23 -0
- package/highlevel/storage/service/ref-messages.d.cts +15 -0
- package/highlevel/storage/service/updates.d.cts +16 -0
- package/highlevel/storage/storage.d.cts +27 -0
- package/highlevel/types/auth/index.d.cts +1 -0
- package/highlevel/types/auth/sent-code.d.cts +56 -0
- package/highlevel/types/bots/command-scope/index.d.cts +10 -0
- package/highlevel/types/bots/command-scope/inner.d.cts +54 -0
- package/highlevel/types/bots/game-high-score.d.cts +23 -0
- package/highlevel/types/bots/index.d.cts +6 -0
- package/highlevel/types/bots/inline-message/factories.d.cts +47 -0
- package/highlevel/types/bots/inline-message/index.d.cts +3 -0
- package/highlevel/types/bots/inline-message/types.d.cts +114 -0
- package/highlevel/types/bots/inline-result/factories.d.cts +97 -0
- package/highlevel/types/bots/inline-result/index.d.cts +3 -0
- package/highlevel/types/bots/inline-result/types.d.cts +417 -0
- package/highlevel/types/bots/keyboards/builder.d.cts +38 -0
- package/highlevel/types/bots/keyboards/builder.test.d.cts +1 -0
- package/highlevel/types/bots/keyboards/factories.d.cts +208 -0
- package/highlevel/types/bots/keyboards/index.d.cts +15 -0
- package/highlevel/types/bots/keyboards/keyboards.test.d.cts +1 -0
- package/highlevel/types/bots/keyboards/types.d.cts +34 -0
- package/highlevel/types/bots/webview.d.cts +114 -0
- package/highlevel/types/calls/discard-reason.d.cts +13 -0
- package/highlevel/types/calls/index.d.cts +1 -0
- package/highlevel/types/conversation.d.cts +210 -0
- package/highlevel/types/errors.d.cts +33 -0
- package/highlevel/types/files/file-location.d.cts +48 -0
- package/highlevel/types/files/index.d.cts +4 -0
- package/highlevel/types/files/uploaded-file.d.cts +24 -0
- package/highlevel/types/files/utils.d.cts +89 -0
- package/highlevel/types/files/web-document.d.cts +32 -0
- package/highlevel/types/index.d.cts +15 -0
- package/highlevel/types/media/audio.d.cts +31 -0
- package/highlevel/types/media/contact.d.cts +31 -0
- package/highlevel/types/media/dice.d.cts +155 -0
- package/highlevel/types/media/document-utils.d.cts +11 -0
- package/highlevel/types/media/document.d.cts +75 -0
- package/highlevel/types/media/extended-media.d.cts +20 -0
- package/highlevel/types/media/game.d.cts +38 -0
- package/highlevel/types/media/index.d.cts +19 -0
- package/highlevel/types/media/input-media/factories.d.cts +142 -0
- package/highlevel/types/media/input-media/index.d.cts +3 -0
- package/highlevel/types/media/input-media/types.d.cts +520 -0
- package/highlevel/types/media/invoice.d.cts +89 -0
- package/highlevel/types/media/location.d.cts +83 -0
- package/highlevel/types/media/paid-media.d.cts +33 -0
- package/highlevel/types/media/photo.d.cts +72 -0
- package/highlevel/types/media/poll.d.cts +110 -0
- package/highlevel/types/media/sticker.d.cts +123 -0
- package/highlevel/types/media/story.d.cts +33 -0
- package/highlevel/types/media/thumbnail.d.cts +70 -0
- package/highlevel/types/media/venue.d.cts +58 -0
- package/highlevel/types/media/video.d.cts +48 -0
- package/highlevel/types/media/voice.d.cts +23 -0
- package/highlevel/types/media/web-page.d.cts +151 -0
- package/highlevel/types/messages/dialog.d.cts +110 -0
- package/highlevel/types/messages/draft-message.d.cts +29 -0
- package/highlevel/types/messages/fact-check.d.cts +30 -0
- package/highlevel/types/messages/index.d.cts +14 -0
- package/highlevel/types/messages/input-message-id.d.cts +20 -0
- package/highlevel/types/messages/message-action.d.cts +420 -0
- package/highlevel/types/messages/message-effect.d.cts +20 -0
- package/highlevel/types/messages/message-entity.d.cts +89 -0
- package/highlevel/types/messages/message-forward.d.cts +39 -0
- package/highlevel/types/messages/message-media.d.cts +23 -0
- package/highlevel/types/messages/message-reactions.d.cts +31 -0
- package/highlevel/types/messages/message-replies.d.cts +42 -0
- package/highlevel/types/messages/message.d.cts +249 -0
- package/highlevel/types/messages/replied-message.d.cts +103 -0
- package/highlevel/types/messages/search-filters.d.cts +82 -0
- package/highlevel/types/misc/app-config.d.cts +887 -0
- package/highlevel/types/misc/collectible-info.d.cts +27 -0
- package/highlevel/types/misc/entities.d.cts +22 -0
- package/highlevel/types/misc/index.d.cts +6 -0
- package/highlevel/types/misc/input-privacy-rule/allow.d.cts +22 -0
- package/highlevel/types/misc/input-privacy-rule/bundle.d.cts +3 -0
- package/highlevel/types/misc/input-privacy-rule/disallow.d.cts +20 -0
- package/highlevel/types/misc/input-privacy-rule/index.d.cts +3 -0
- package/highlevel/types/misc/input-privacy-rule/types.d.cts +11 -0
- package/highlevel/types/misc/sticker-set.d.cts +154 -0
- package/highlevel/types/misc/takeout-session.d.cts +49 -0
- package/highlevel/types/peers/bot-info.d.cts +21 -0
- package/highlevel/types/peers/chat-colors.d.cts +25 -0
- package/highlevel/types/peers/chat-event/actions.d.cts +279 -0
- package/highlevel/types/peers/chat-event/filters.d.cts +10 -0
- package/highlevel/types/peers/chat-event/index.d.cts +27 -0
- package/highlevel/types/peers/chat-invite-link-member.d.cts +33 -0
- package/highlevel/types/peers/chat-invite-link.d.cts +72 -0
- package/highlevel/types/peers/chat-location.d.cts +17 -0
- package/highlevel/types/peers/chat-member.d.cts +86 -0
- package/highlevel/types/peers/chat-permissions.d.cts +127 -0
- package/highlevel/types/peers/chat-photo.d.cts +39 -0
- package/highlevel/types/peers/chat-preview.d.cts +55 -0
- package/highlevel/types/peers/chat.d.cts +250 -0
- package/highlevel/types/peers/chatlist-preview.d.cts +21 -0
- package/highlevel/types/peers/forum-topic.d.cts +96 -0
- package/highlevel/types/peers/full-chat.cjs +1 -1
- package/highlevel/types/peers/full-chat.d.cts +161 -0
- package/highlevel/types/peers/full-chat.js +1 -1
- package/highlevel/types/peers/full-user.d.cts +115 -0
- package/highlevel/types/peers/index.d.cts +19 -0
- package/highlevel/types/peers/index.d.ts +1 -0
- package/highlevel/types/peers/peer.d.cts +49 -0
- package/highlevel/types/peers/peers-index.d.cts +15 -0
- package/highlevel/types/peers/peers-index.test.d.cts +1 -0
- package/highlevel/types/peers/typing-status.d.cts +26 -0
- package/highlevel/types/peers/user.d.cts +268 -0
- package/highlevel/types/peers/user.test.d.cts +1 -0
- package/highlevel/types/premium/boost-slot.d.cts +37 -0
- package/highlevel/types/premium/boost-stats.d.cts +54 -0
- package/highlevel/types/premium/boost.d.cts +56 -0
- package/highlevel/types/premium/boost.d.ts +1 -2
- package/highlevel/types/premium/business-account.d.cts +19 -0
- package/highlevel/types/premium/business-chat-link.d.cts +19 -0
- package/highlevel/types/premium/business-connection.d.cts +23 -0
- package/highlevel/types/premium/business-intro.d.cts +22 -0
- package/highlevel/types/premium/business-location.d.cts +10 -0
- package/highlevel/types/premium/business-work-hours.d.cts +42 -0
- package/highlevel/types/premium/business-work-hours.test.d.cts +1 -0
- package/highlevel/types/premium/index.d.cts +12 -0
- package/highlevel/types/premium/index.d.ts +1 -0
- package/highlevel/types/premium/stars-gift.d.cts +68 -0
- package/highlevel/types/premium/stars-status.d.cts +16 -0
- package/highlevel/types/premium/stars-status.d.ts +1 -1
- package/highlevel/types/premium/stars-transaction.cjs +7 -3
- package/highlevel/types/premium/stars-transaction.d.cts +134 -0
- package/highlevel/types/premium/stars-transaction.d.ts +1 -1
- package/highlevel/types/premium/stars-transaction.js +7 -3
- package/highlevel/types/reactions/emoji-status.d.cts +12 -0
- package/highlevel/types/reactions/index.d.cts +4 -0
- package/highlevel/types/reactions/index.d.ts +2 -0
- package/highlevel/types/reactions/peer-reaction.d.cts +53 -0
- package/highlevel/types/reactions/reaction-count.d.cts +25 -0
- package/highlevel/types/reactions/types.d.cts +16 -0
- package/highlevel/types/stories/all-stories.d.cts +28 -0
- package/highlevel/types/stories/index.d.cts +7 -0
- package/highlevel/types/stories/interactive/base.d.cts +16 -0
- package/highlevel/types/stories/interactive/channel-post.d.cts +17 -0
- package/highlevel/types/stories/interactive/index.d.cts +12 -0
- package/highlevel/types/stories/interactive/input.d.cts +68 -0
- package/highlevel/types/stories/interactive/location.d.cts +15 -0
- package/highlevel/types/stories/interactive/reaction.d.cts +21 -0
- package/highlevel/types/stories/interactive/url.d.cts +11 -0
- package/highlevel/types/stories/interactive/venue.d.cts +28 -0
- package/highlevel/types/stories/interactive/weather.d.cts +15 -0
- package/highlevel/types/stories/peer-stories.d.cts +20 -0
- package/highlevel/types/stories/stealth-mode.d.cts +9 -0
- package/highlevel/types/stories/story-interactions.d.cts +34 -0
- package/highlevel/types/stories/story-viewer.d.cts +75 -0
- package/highlevel/types/stories/story.d.cts +79 -0
- package/highlevel/types/updates/bot-chat-join-request.d.cts +42 -0
- package/highlevel/types/updates/bot-reaction.d.cts +71 -0
- package/highlevel/types/updates/bot-stopped.d.cts +28 -0
- package/highlevel/types/updates/business-message.d.cts +18 -0
- package/highlevel/types/updates/callback-query.d.cts +95 -0
- package/highlevel/types/updates/chat-join-request.d.cts +30 -0
- package/highlevel/types/updates/chat-member-update.cjs +1 -0
- package/highlevel/types/updates/chat-member-update.d.cts +76 -0
- package/highlevel/types/updates/chat-member-update.js +1 -0
- package/highlevel/types/updates/chosen-inline-result.d.cts +50 -0
- package/highlevel/types/updates/delete-business-message-update.d.cts +21 -0
- package/highlevel/types/updates/delete-message-update.d.cts +16 -0
- package/highlevel/types/updates/delete-story-update.d.cts +18 -0
- package/highlevel/types/updates/history-read-update.d.cts +39 -0
- package/highlevel/types/updates/index.d.cts +107 -0
- package/highlevel/types/updates/inline-query.d.cts +42 -0
- package/highlevel/types/updates/parse-update.d.cts +4 -0
- package/highlevel/types/updates/poll-update.d.cts +39 -0
- package/highlevel/types/updates/poll-vote.d.cts +52 -0
- package/highlevel/types/updates/pre-checkout-query.d.cts +36 -0
- package/highlevel/types/updates/story-update.d.cts +22 -0
- package/highlevel/types/updates/user-status-update.d.cts +28 -0
- package/highlevel/types/updates/user-typing-update.d.cts +31 -0
- package/highlevel/types/utils.d.cts +12 -0
- package/highlevel/updates/index.d.cts +2 -0
- package/highlevel/updates/manager.d.cts +121 -0
- package/highlevel/updates/parsed.d.cts +26 -0
- package/highlevel/updates/types.d.cts +147 -0
- package/highlevel/updates/utils.d.cts +21 -0
- package/highlevel/utils/convert-file-id.d.cts +46 -0
- package/highlevel/utils/entities.d.cts +19 -0
- package/highlevel/utils/entities.test.d.cts +1 -0
- package/highlevel/utils/file-type.d.cts +2 -0
- package/highlevel/utils/file-type.test.d.cts +1 -0
- package/highlevel/utils/file-utils.d.cts +31 -0
- package/highlevel/utils/file-utils.test.d.cts +1 -0
- package/highlevel/utils/index.d.cts +11 -0
- package/highlevel/utils/inline-utils.d.cts +14 -0
- package/highlevel/utils/inline-utils.test.d.cts +1 -0
- package/highlevel/utils/inspectable.d.cts +9 -0
- package/highlevel/utils/inspectable.test.d.cts +1 -0
- package/highlevel/utils/memoize.d.cts +1 -0
- package/highlevel/utils/memoize.test.d.cts +1 -0
- package/highlevel/utils/misc-utils.d.cts +12 -0
- package/highlevel/utils/peer-utils.d.cts +11 -0
- package/highlevel/utils/peer-utils.test.d.cts +1 -0
- package/highlevel/utils/query-batcher.d.cts +49 -0
- package/highlevel/utils/query-batcher.test.d.cts +1 -0
- package/highlevel/utils/rps-meter.d.cts +9 -0
- package/highlevel/utils/stream-utils.d.cts +1 -0
- package/highlevel/utils/string-session.d.cts +16 -0
- package/highlevel/utils/string-session.test.d.cts +1 -0
- package/highlevel/utils/voice-utils.d.cts +14 -0
- package/highlevel/utils/voice-utils.test.d.cts +1 -0
- package/highlevel/worker/app-config.d.cts +9 -0
- package/highlevel/worker/errors.d.cts +8 -0
- package/highlevel/worker/index.d.cts +3 -0
- package/highlevel/worker/invoker.d.cts +18 -0
- package/highlevel/worker/port.d.cts +60 -0
- package/highlevel/worker/protocol.d.cts +57 -0
- package/highlevel/worker/storage.d.cts +39 -0
- package/highlevel/worker/worker.d.cts +15 -0
- package/index.cjs +8 -0
- package/index.d.cts +10 -0
- package/index.js +8 -0
- package/methods.d.cts +1 -0
- package/network/auth-key.d.cts +21 -0
- package/network/auth-key.test.d.cts +1 -0
- package/network/authorization.d.cts +9 -0
- package/network/client.d.cts +218 -0
- package/network/config-manager.d.cts +19 -0
- package/network/config-manager.test.d.cts +1 -0
- package/network/index.d.cts +6 -0
- package/network/middlewares/bundle.d.cts +3 -0
- package/network/middlewares/default.d.cts +8 -0
- package/network/middlewares/flood-waiter.d.cts +37 -0
- package/network/middlewares/index.d.cts +4 -0
- package/network/middlewares/index.d.ts +2 -0
- package/network/middlewares/internal-errors.d.cts +17 -0
- package/network/middlewares/on-error.d.cts +30 -0
- package/network/middlewares/on-method.d.cts +39 -0
- package/network/mtproto-session.d.cts +127 -0
- package/network/mtproxy/_fake-tls.d.cts +22 -0
- package/network/mtproxy/index.d.cts +42 -0
- package/network/multi-session-connection.cjs +25 -43
- package/network/multi-session-connection.d.cts +43 -0
- package/network/multi-session-connection.d.ts +5 -5
- package/network/multi-session-connection.js +25 -43
- package/network/network-manager.cjs +7 -20
- package/network/network-manager.d.cts +256 -0
- package/network/network-manager.js +7 -20
- package/network/persistent-connection.cjs +8 -0
- package/network/persistent-connection.d.cts +55 -0
- package/network/persistent-connection.d.ts +3 -1
- package/network/persistent-connection.js +8 -0
- package/network/server-salt.d.cts +12 -0
- package/network/session-connection.cjs +35 -18
- package/network/session-connection.d.cts +94 -0
- package/network/session-connection.d.ts +5 -3
- package/network/session-connection.js +35 -18
- package/network/transports/abstract.d.cts +47 -0
- package/network/transports/index.d.cts +3 -0
- package/network/transports/intermediate.d.cts +23 -0
- package/network/transports/intermediate.test.d.cts +1 -0
- package/network/transports/obfuscated.d.cts +23 -0
- package/network/transports/obfuscated.test.d.cts +1 -0
- package/package.json +13 -13
- package/storage/driver.d.cts +58 -0
- package/storage/index.d.cts +6 -0
- package/storage/memory/driver.d.cts +6 -0
- package/storage/memory/index.d.cts +22 -0
- package/storage/memory/memory.test.d.cts +1 -0
- package/storage/memory/repository/auth-keys.d.cts +19 -0
- package/storage/memory/repository/kv.d.cts +11 -0
- package/storage/memory/repository/peers.d.cts +18 -0
- package/storage/memory/repository/ref-messages.d.cts +16 -0
- package/storage/provider.d.cts +10 -0
- package/storage/repository/auth-keys.d.cts +41 -0
- package/storage/repository/index.d.cts +2 -0
- package/storage/repository/key-value.d.cts +10 -0
- package/storage/service/auth-keys.d.cts +9 -0
- package/storage/service/auth-keys.test.d.cts +1 -0
- package/storage/service/base.d.cts +19 -0
- package/storage/service/default-dcs.d.cts +10 -0
- package/storage/service/future-salts.d.cts +11 -0
- package/storage/service/updates.test.d.cts +1 -0
- package/storage/service/utils.test-utils.d.cts +2 -0
- package/storage/sqlite/driver.d.cts +24 -0
- package/storage/sqlite/index.d.cts +17 -0
- package/storage/sqlite/repository/auth-keys.d.cts +20 -0
- package/storage/sqlite/repository/kv.d.cts +14 -0
- package/storage/sqlite/repository/peers.d.cts +19 -0
- package/storage/sqlite/repository/ref-messages.d.cts +16 -0
- package/storage/sqlite/types.d.cts +18 -0
- package/storage/storage.d.cts +55 -0
- package/types/errors.d.cts +53 -0
- package/types/index.d.cts +4 -0
- package/types/peers.d.cts +4 -0
- package/types/platform.d.cts +15 -0
- package/types/utils.d.cts +9 -0
- package/utils/abort-signal.d.cts +1 -0
- package/utils/bigint-utils.d.cts +18 -0
- package/utils/bigint-utils.test.d.cts +1 -0
- package/utils/binary/asn1-parser.d.cts +17 -0
- package/utils/crypto/abstract.d.cts +29 -0
- package/utils/crypto/factorization.d.cts +6 -0
- package/utils/crypto/factorization.test.d.cts +1 -0
- package/utils/crypto/index.d.cts +6 -0
- package/utils/crypto/keys.d.cts +27 -0
- package/utils/crypto/keys.test.d.cts +1 -0
- package/utils/crypto/miller-rabin.d.cts +2 -0
- package/utils/crypto/miller-rabin.test.d.cts +1 -0
- package/utils/crypto/mtproto.d.cts +31 -0
- package/utils/crypto/mtproto.test.d.cts +1 -0
- package/utils/crypto/password.d.cts +29 -0
- package/utils/crypto/password.test.d.cts +1 -0
- package/utils/dcs.d.cts +18 -0
- package/utils/early-timer.d.cts +41 -0
- package/utils/error-reporting.d.cts +3 -0
- package/utils/function-utils.d.cts +22 -0
- package/utils/function-utils.test.d.cts +1 -0
- package/utils/index.d.cts +20 -0
- package/utils/linked-list.d.cts +21 -0
- package/utils/linked-list.test.d.cts +1 -0
- package/utils/links/bots.d.cts +72 -0
- package/utils/links/bots.test.d.cts +1 -0
- package/utils/links/bundle.d.cts +7 -0
- package/utils/links/calls.d.cts +17 -0
- package/utils/links/chat.d.cts +47 -0
- package/utils/links/chat.test.d.cts +1 -0
- package/utils/links/common.d.cts +31 -0
- package/utils/links/index.d.cts +2 -0
- package/utils/links/misc.d.cts +26 -0
- package/utils/links/misc.test.d.cts +1 -0
- package/utils/links/proxy.d.cts +18 -0
- package/utils/links/proxy.test.d.cts +1 -0
- package/utils/links/stickers.d.cts +10 -0
- package/utils/links/user.d.cts +28 -0
- package/utils/links/user.test.d.cts +1 -0
- package/utils/logger.d.cts +54 -0
- package/utils/logger.test.d.cts +1 -0
- package/utils/long-utils.d.cts +67 -0
- package/utils/long-utils.test.d.cts +1 -0
- package/utils/misc-utils.d.cts +2 -0
- package/utils/peer-utils.d.cts +29 -0
- package/utils/peer-utils.test.d.cts +1 -0
- package/utils/sorted-array.d.cts +17 -0
- package/utils/sorted-array.test.d.cts +1 -0
- package/utils/timers.d.cts +1 -0
- package/utils/tl-json.d.cts +13 -0
- package/utils/tl-json.test.d.cts +1 -0
- package/utils/type-assertions.d.cts +29 -0
- package/utils/type-assertions.test.d.cts +1 -0
- package/utils.d.cts +1 -0
- package/worker.d.cts +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ParsedUpdate } from '../types/updates/index.js';
|
|
2
|
+
import { RawUpdateInfo } from './types.js';
|
|
3
|
+
export interface ParsedUpdateHandlerParams {
|
|
4
|
+
/**
|
|
5
|
+
* When non-zero, allows the library to automatically handle Telegram
|
|
6
|
+
* media groups (e.g. albums) in {@link MessageGroup} updates
|
|
7
|
+
* in a given time interval (in ms).
|
|
8
|
+
*
|
|
9
|
+
* > **Note**: this does not catch messages that happen to be consecutive,
|
|
10
|
+
* > only messages belonging to the same "media group".
|
|
11
|
+
*
|
|
12
|
+
* This will cause up to `messageGroupingInterval` delay
|
|
13
|
+
* in handling media group messages.
|
|
14
|
+
*
|
|
15
|
+
* This option only applies to `new_message` updates,
|
|
16
|
+
* and the updates being grouped **will not** be dispatched on their own.
|
|
17
|
+
*
|
|
18
|
+
* Recommended value is 250 ms.
|
|
19
|
+
*
|
|
20
|
+
* @default 0 (disabled)
|
|
21
|
+
*/
|
|
22
|
+
messageGroupingInterval?: number;
|
|
23
|
+
/** Handler for parsed updates */
|
|
24
|
+
onUpdate: (update: ParsedUpdate) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function makeParsedUpdateHandler(params: ParsedUpdateHandlerParams): (update: RawUpdateInfo) => void;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { AsyncLock, ConditionVariable, Deque, timers } from '@fuman/utils';
|
|
2
|
+
import { tl } from '@mtcute/tl';
|
|
3
|
+
import { EarlyTimer, Logger, SortedLinkedList } from '../../utils/index.js';
|
|
4
|
+
import { CurrentUserInfo } from '../storage/service/current-user.js';
|
|
5
|
+
import { PeersIndex } from '../types/peers/peers-index.js';
|
|
6
|
+
/** Information about a raw update. */
|
|
7
|
+
export declare class RawUpdateInfo {
|
|
8
|
+
/** The update */
|
|
9
|
+
readonly update: tl.TypeUpdate;
|
|
10
|
+
/** Peers that are present in the update */
|
|
11
|
+
readonly peers: PeersIndex;
|
|
12
|
+
constructor(
|
|
13
|
+
/** The update */
|
|
14
|
+
update: tl.TypeUpdate,
|
|
15
|
+
/** Peers that are present in the update */
|
|
16
|
+
peers: PeersIndex);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Parameters for the updates manager
|
|
20
|
+
*/
|
|
21
|
+
export interface UpdatesManagerParams {
|
|
22
|
+
/**
|
|
23
|
+
* **ADVANCED**
|
|
24
|
+
*
|
|
25
|
+
* Whether to globally disable no-dispatch mechanism.
|
|
26
|
+
*
|
|
27
|
+
* No-dispatch is a mechanism that allows you to call methods
|
|
28
|
+
* that return updates and correctly handle them, without
|
|
29
|
+
* actually dispatching them to the event handlers.
|
|
30
|
+
*
|
|
31
|
+
* In other words, the following code will work differently:
|
|
32
|
+
* ```ts
|
|
33
|
+
* dp.onNewMessage(console.log)
|
|
34
|
+
* console.log(await tg.sendText('me', 'hello'))
|
|
35
|
+
* ```
|
|
36
|
+
* - if `disableNoDispatch` is `true`, the sent message will be
|
|
37
|
+
* dispatched to the event handler, thus it will be printed twice
|
|
38
|
+
* - if `disableNoDispatch` is `false`, the sent message will not be
|
|
39
|
+
* dispatched to the event handler, thus it will onlt be printed once
|
|
40
|
+
*
|
|
41
|
+
* Disabling it may also improve performance, but it's not guaranteed.
|
|
42
|
+
*
|
|
43
|
+
* > **Note**: you can disable this on per-request basis by passing
|
|
44
|
+
* > `shouldDispatch: true` to the method call that accepts it.
|
|
45
|
+
* > For some methods you need to always pass `shouldDispatch: true` explicitly.
|
|
46
|
+
* > This is noted in the corresponding method's documentation by "Doesn't follow `disableNoDispatch`"
|
|
47
|
+
*
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
disableNoDispatch?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* **ADVANCED**
|
|
53
|
+
*
|
|
54
|
+
* PTS limit for `getChannelDifference` requests (max. 100000).
|
|
55
|
+
* When there are more updates than this limit, the library will
|
|
56
|
+
* skip some of them.
|
|
57
|
+
* According to the [official docs](https://core.telegram.org/method/updates.getChannelDifference),
|
|
58
|
+
* "Ordinary (non-bot) users are supposed to pass `10-100`", so passing >100
|
|
59
|
+
* for users may lead to issues.
|
|
60
|
+
*
|
|
61
|
+
* @default 100 for users, 100000 for bots
|
|
62
|
+
*/
|
|
63
|
+
channelPtsLimit?: number | ((channelId: number) => number);
|
|
64
|
+
/**
|
|
65
|
+
* **ADVANCED**
|
|
66
|
+
*
|
|
67
|
+
* Whenever an `updates.channelDifferenceTooLong` is received,
|
|
68
|
+
* the library isn't able to efficiently handle it on its own,
|
|
69
|
+
* and will call this function for you to handle it instead.
|
|
70
|
+
*
|
|
71
|
+
* [See docs](https://core.telegram.org/constructor/updates.channelDifferenceTooLong)
|
|
72
|
+
*/
|
|
73
|
+
onChannelTooLong?: (channelId: number, update: tl.updates.RawChannelDifferenceTooLong) => void;
|
|
74
|
+
/**
|
|
75
|
+
* **ADVANCED**
|
|
76
|
+
*
|
|
77
|
+
* When `openChat` method is used on a client, the library will
|
|
78
|
+
* set up a timer to periodically fetch the new updates.
|
|
79
|
+
* By default, it will respect the value provided by the server,
|
|
80
|
+
* but it some cases you may want to override it (e.g. decrease it to
|
|
81
|
+
* poll more often and potentially get updates faster).
|
|
82
|
+
*
|
|
83
|
+
* The returned value is treated as seconds.
|
|
84
|
+
*/
|
|
85
|
+
overrideOpenChatTimeout?: (upd: tl.updates.TypeChannelDifference) => number;
|
|
86
|
+
/**
|
|
87
|
+
* Whether to catch up with missed updates when starting updates loop.
|
|
88
|
+
*
|
|
89
|
+
* > **Note**: In case the storage was not properly closed the last time,
|
|
90
|
+
* > "catching up" might result in duplicate updates.
|
|
91
|
+
*/
|
|
92
|
+
catchUp?: boolean;
|
|
93
|
+
}
|
|
94
|
+
/** @internal */
|
|
95
|
+
export interface PendingUpdateContainer {
|
|
96
|
+
upd: tl.TypeUpdates;
|
|
97
|
+
seqStart: number;
|
|
98
|
+
seqEnd: number;
|
|
99
|
+
}
|
|
100
|
+
/** @internal */
|
|
101
|
+
export interface PendingUpdate {
|
|
102
|
+
update: tl.TypeUpdate;
|
|
103
|
+
channelId?: number;
|
|
104
|
+
pts?: number;
|
|
105
|
+
ptsBefore?: number;
|
|
106
|
+
qts?: number;
|
|
107
|
+
qtsBefore?: number;
|
|
108
|
+
timeout?: number;
|
|
109
|
+
peers: PeersIndex;
|
|
110
|
+
fromDifference: boolean;
|
|
111
|
+
}
|
|
112
|
+
/** @internal */
|
|
113
|
+
export interface UpdatesState {
|
|
114
|
+
updatesLoopActive: boolean;
|
|
115
|
+
updatesLoopCv: ConditionVariable;
|
|
116
|
+
postponedTimer: EarlyTimer;
|
|
117
|
+
hasTimedoutPostponed: boolean;
|
|
118
|
+
pendingUpdateContainers: SortedLinkedList<PendingUpdateContainer>;
|
|
119
|
+
pendingPtsUpdates: SortedLinkedList<PendingUpdate>;
|
|
120
|
+
pendingPtsUpdatesPostponed: SortedLinkedList<PendingUpdate>;
|
|
121
|
+
pendingQtsUpdates: SortedLinkedList<PendingUpdate>;
|
|
122
|
+
pendingQtsUpdatesPostponed: SortedLinkedList<PendingUpdate>;
|
|
123
|
+
pendingUnorderedUpdates: Deque<PendingUpdate>;
|
|
124
|
+
noDispatchEnabled: boolean;
|
|
125
|
+
noDispatchMsg: Map<number, Set<number>>;
|
|
126
|
+
noDispatchPts: Map<number, Set<number>>;
|
|
127
|
+
noDispatchQts: Set<number>;
|
|
128
|
+
lock: AsyncLock;
|
|
129
|
+
pts?: number;
|
|
130
|
+
qts?: number;
|
|
131
|
+
date?: number;
|
|
132
|
+
seq?: number;
|
|
133
|
+
oldPts?: number;
|
|
134
|
+
oldQts?: number;
|
|
135
|
+
oldDate?: number;
|
|
136
|
+
oldSeq?: number;
|
|
137
|
+
selfChanged: boolean;
|
|
138
|
+
catchUpChannels: boolean;
|
|
139
|
+
catchUpOnStart: boolean;
|
|
140
|
+
cpts: Map<number, number>;
|
|
141
|
+
cptsMod: Map<number, number>;
|
|
142
|
+
channelDiffTimeouts: Map<number, timers.Timer>;
|
|
143
|
+
channelsOpened: Map<number, number>;
|
|
144
|
+
log: Logger;
|
|
145
|
+
stop: () => void;
|
|
146
|
+
auth: CurrentUserInfo | null;
|
|
147
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { PeersIndex } from '../types/peers/peers-index.js';
|
|
3
|
+
import { PendingUpdate } from './types.js';
|
|
4
|
+
export declare function messageToUpdate(message: tl.TypeMessage): tl.TypeUpdate;
|
|
5
|
+
export declare function extractChannelIdFromUpdate(upd: tl.TypeUpdate): number | undefined;
|
|
6
|
+
export declare function toPendingUpdate(upd: tl.TypeUpdate, peers: PeersIndex, fromDifference?: boolean): PendingUpdate;
|
|
7
|
+
export declare function isMessageEmpty(upd: tl.TypeUpdate): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Create a dummy `updates` container with given updates.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createDummyUpdatesContainer(updates: tl.TypeUpdate[], seq?: number): tl.TypeUpdates;
|
|
12
|
+
/**
|
|
13
|
+
* Create a dummy update from PTS and PTS count.
|
|
14
|
+
*
|
|
15
|
+
* @param pts PTS
|
|
16
|
+
* @param ptsCount PTS count
|
|
17
|
+
* @param channelId Channel ID (bare), if applicable
|
|
18
|
+
*/
|
|
19
|
+
export declare function createDummyUpdate(pts: number, ptsCount: number, channelId?: number): tl.TypeUpdates;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare function assertIsUpdatesGroup(ctx: string, upd: tl.TypeUpdates): asserts upd is tl.RawUpdates | tl.RawUpdatesCombined;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { tdFileId as td } from '@mtcute/file-id';
|
|
3
|
+
type FileId = td.RawFullRemoteFileLocation;
|
|
4
|
+
/**
|
|
5
|
+
* Convert a file ID or {@link tdFileId.RawFullRemoteFileLocation}
|
|
6
|
+
* to TL object `inputWebFileLocation`
|
|
7
|
+
*
|
|
8
|
+
* @param fileId File ID, either parsed or as a string
|
|
9
|
+
*/
|
|
10
|
+
export declare function fileIdToInputWebFileLocation(fileId: string | FileId): tl.RawInputWebFileLocation;
|
|
11
|
+
/**
|
|
12
|
+
* Convert a file ID or {@link tdFileId.RawFullRemoteFileLocation}
|
|
13
|
+
* to TL object representing an `InputFileLocation`
|
|
14
|
+
*
|
|
15
|
+
* @param fileId File ID, either parsed or as a string
|
|
16
|
+
*/
|
|
17
|
+
export declare function fileIdToInputFileLocation(fileId: string | FileId): tl.TypeInputFileLocation;
|
|
18
|
+
/**
|
|
19
|
+
* Convert a file ID or {@link tdFileId.RawFullRemoteFileLocation}
|
|
20
|
+
* to TL object `inputDocument`
|
|
21
|
+
*
|
|
22
|
+
* @param fileId File ID, either parsed or as a string
|
|
23
|
+
*/
|
|
24
|
+
export declare function fileIdToInputDocument(fileId: string | FileId): tl.RawInputDocument;
|
|
25
|
+
/**
|
|
26
|
+
* Convert a file ID or {@link tdFileId.RawFullRemoteFileLocation}
|
|
27
|
+
* to TL object `inputPhoto`
|
|
28
|
+
*
|
|
29
|
+
* @param fileId File ID, either parsed or as a string
|
|
30
|
+
*/
|
|
31
|
+
export declare function fileIdToInputPhoto(fileId: string | FileId): tl.RawInputPhoto;
|
|
32
|
+
/**
|
|
33
|
+
* Convert a file ID or {@link tdFileId.RawFullRemoteFileLocation}
|
|
34
|
+
* to TL object `inputEncryptedFile`
|
|
35
|
+
*
|
|
36
|
+
* @param fileId File ID, either parsed or as a string
|
|
37
|
+
*/
|
|
38
|
+
export declare function fileIdToEncryptedFile(fileId: string | FileId): tl.RawInputEncryptedFile;
|
|
39
|
+
/**
|
|
40
|
+
* Convert a file ID or {@link tdFileId.RawFullRemoteFileLocation}
|
|
41
|
+
* to TL object `inputSecureFile`
|
|
42
|
+
*
|
|
43
|
+
* @param fileId File ID, either parsed or as a string
|
|
44
|
+
*/
|
|
45
|
+
export declare function fileIdToSecureFile(fileId: string | FileId): tl.RawInputSecureFile;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TextWithEntities } from '../types/misc/entities.js';
|
|
2
|
+
/**
|
|
3
|
+
* Join multiple text parts with entities into a single text with entities,
|
|
4
|
+
* adjusting the entities' offsets accordingly.
|
|
5
|
+
*
|
|
6
|
+
* @param parts List of text parts with entities
|
|
7
|
+
* @param delim Delimiter to insert between parts
|
|
8
|
+
* @returns A single text with entities
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* const scoreboardText = joinTextWithEntities(
|
|
13
|
+
* apiResult.scoreboard.map((entry) => html`<b>${entry.name}</b>: ${entry.score}`),
|
|
14
|
+
* html`<br>`
|
|
15
|
+
* )
|
|
16
|
+
* await tg.sendText(chatId, html`<b>scoreboard:</b><br><br>${scoreboardText}`)
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function joinTextWithEntities(parts: (string | TextWithEntities)[], delim?: string | TextWithEntities): TextWithEntities;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
/**
|
|
3
|
+
* Given file size, determine the appropriate chunk size (in KB)
|
|
4
|
+
* for upload/download operations.
|
|
5
|
+
*/
|
|
6
|
+
export declare function determinePartSize(fileSize: number): number;
|
|
7
|
+
/**
|
|
8
|
+
* Returns `true` if all bytes in `buf` are printable ASCII characters
|
|
9
|
+
*/
|
|
10
|
+
export declare function isProbablyPlainText(buf: Uint8Array): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Convert stripped JPEG (from `photoStrippedSize`) to full JPEG
|
|
13
|
+
*/
|
|
14
|
+
export declare function strippedPhotoToJpg(stripped: Uint8Array): Uint8Array;
|
|
15
|
+
/**
|
|
16
|
+
* Inflate compressed preview SVG path to full SVG path
|
|
17
|
+
* @param encoded
|
|
18
|
+
*/
|
|
19
|
+
export declare function inflateSvgPath(encoded: Uint8Array): string;
|
|
20
|
+
/**
|
|
21
|
+
* Convert SVG path to SVG file
|
|
22
|
+
* @param path SVG path
|
|
23
|
+
* @param size Size attribute of the document, if available
|
|
24
|
+
*/
|
|
25
|
+
export declare function svgPathToFile(path: string, size?: tl.RawDocumentAttributeImageSize): Uint8Array;
|
|
26
|
+
/**
|
|
27
|
+
* Get file name from file path
|
|
28
|
+
*
|
|
29
|
+
* @param path File path
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractFileName(path: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './convert-file-id.js';
|
|
2
|
+
export * from './entities.js';
|
|
3
|
+
export * from './file-utils.js';
|
|
4
|
+
export * from './inline-utils.js';
|
|
5
|
+
export * from './inspectable.js';
|
|
6
|
+
export * from './misc-utils.js';
|
|
7
|
+
export * from './peer-utils.js';
|
|
8
|
+
export * from './rps-meter.js';
|
|
9
|
+
export * from './stream-utils.js';
|
|
10
|
+
export * from './string-session.js';
|
|
11
|
+
export * from './voice-utils.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
/**
|
|
3
|
+
* Parse TDLib style inline message ID
|
|
4
|
+
*
|
|
5
|
+
* @param id Inline message ID
|
|
6
|
+
*/
|
|
7
|
+
export declare function parseInlineMessageId(id: string): tl.TypeInputBotInlineMessageID;
|
|
8
|
+
/**
|
|
9
|
+
* Generate TDLib style inline message ID
|
|
10
|
+
*
|
|
11
|
+
* @param id Inline message ID object
|
|
12
|
+
*/
|
|
13
|
+
export declare function encodeInlineMessageId(id: tl.TypeInputBotInlineMessageID): string;
|
|
14
|
+
export declare function normalizeInlineId(id: string | tl.TypeInputBotInlineMessageID): tl.TypeInputBotInlineMessageID;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Small helper function that adds `toJSON` and `util.custom.inspect`
|
|
3
|
+
* methods to a given class based on its getters
|
|
4
|
+
*
|
|
5
|
+
* > **Note**: This means that all getters must be pure!
|
|
6
|
+
* > (getter that caches after its first invocation is also
|
|
7
|
+
* > considered pure in this case)
|
|
8
|
+
*/
|
|
9
|
+
export declare function makeInspectable<T>(obj: new (...args: any[]) => T, props?: (keyof T)[], hide?: (keyof T)[]): typeof obj;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function memoizeGetters<T>(cls: new (...args: any[]) => T, fields: (keyof T)[]): typeof cls;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ArrayPaginated, ArrayWithTotal, MaybeDynamic, Message } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize phone number by stripping formatting
|
|
4
|
+
* @param phone Phone number
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizePhoneNumber(phone: string): string;
|
|
7
|
+
export declare function resolveMaybeDynamic<T>(val: MaybeDynamic<T>): Promise<T>;
|
|
8
|
+
export declare function makeArrayWithTotal<T>(arr: T[], total: number): ArrayWithTotal<T>;
|
|
9
|
+
export declare function makeArrayPaginated<T, Offset>(arr: T[], total: number, next?: Offset): ArrayPaginated<T, Offset>;
|
|
10
|
+
export declare function normalizeDate(date: Date | number): number;
|
|
11
|
+
export declare function normalizeDate(date: Date | number | undefined): number | undefined;
|
|
12
|
+
export declare function normalizeMessageId(msg: Message | number | undefined): number | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InputPeerLike } from '../types/peers/index.js';
|
|
2
|
+
import { tl } from '@mtcute/tl';
|
|
3
|
+
export declare const INVITE_LINK_REGEX: RegExp;
|
|
4
|
+
export declare function toInputPeer(res: tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel): tl.TypeInputPeer;
|
|
5
|
+
export declare function toInputUser(res: tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel, input?: InputPeerLike): tl.TypeInputUser;
|
|
6
|
+
export declare function toInputChannel(res: tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel, input?: InputPeerLike): tl.TypeInputChannel;
|
|
7
|
+
export declare function isInputPeerUser(obj: tl.TypeInputPeer): obj is tl.RawInputPeerUser | tl.RawInputPeerUserFromMessage | tl.RawInputPeerSelf;
|
|
8
|
+
export declare function isInputPeerChannel(obj: tl.TypeInputPeer): obj is tl.RawInputPeerChannel | tl.RawInputPeerChannelFromMessage;
|
|
9
|
+
export declare function isInputPeerChat(obj: tl.TypeInputPeer): obj is tl.RawInputPeerChat;
|
|
10
|
+
export declare function inputPeerToPeer(inp: tl.TypeInputPeer): tl.TypePeer;
|
|
11
|
+
export declare function extractUsernames(obj: tl.RawUser | tl.RawChannel): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ITelegramClient } from '../client.types.js';
|
|
2
|
+
export type BatchedQuery<T, U> = (client: ITelegramClient, item: T) => Promise<U | null>;
|
|
3
|
+
/**
|
|
4
|
+
* Helper function for building batched queries.
|
|
5
|
+
*
|
|
6
|
+
* Concepts:
|
|
7
|
+
* - "input" - items being passed to the query function
|
|
8
|
+
* - "output" - items returned by the query function
|
|
9
|
+
* - "key" - unique identifier of the item, which should be deriveable from both input and output.
|
|
10
|
+
* used for matching input and output items and deduplicating them.
|
|
11
|
+
*/
|
|
12
|
+
export declare function batchedQuery<T, U>(params: {
|
|
13
|
+
/**
|
|
14
|
+
* Fetcher function, taking an array of input items and returning an array of output items.
|
|
15
|
+
*
|
|
16
|
+
* If some item is not found, it should be omitted from the result array,
|
|
17
|
+
* this way the corresponding request will be resolved with `null`.
|
|
18
|
+
*/
|
|
19
|
+
fetch: (client: ITelegramClient, items: T[]) => Promise<U[]>;
|
|
20
|
+
/** Key derivation function for input items */
|
|
21
|
+
inputKey: (item: T, client: ITelegramClient) => string | number;
|
|
22
|
+
/** Key derivation function for output items */
|
|
23
|
+
outputKey: (item: U, client: ITelegramClient) => string | number;
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of items to be passed to the `fetcher` function at once.
|
|
26
|
+
*
|
|
27
|
+
* It is recommended to pass ~half of the maximum allowed by the server,
|
|
28
|
+
* since in some cases failing on a single item will cause the whole batch to fail.
|
|
29
|
+
*
|
|
30
|
+
* @default Infinity
|
|
31
|
+
*/
|
|
32
|
+
maxBatchSize?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Maximum number of concurrently running queries.
|
|
35
|
+
*
|
|
36
|
+
* @default 1
|
|
37
|
+
*/
|
|
38
|
+
maxConcurrent?: number;
|
|
39
|
+
/**
|
|
40
|
+
* In case of an error, we can try retrying the query for some items one-by-one,
|
|
41
|
+
* to avoid failing the whole batch.
|
|
42
|
+
*
|
|
43
|
+
* @param items Items contained in the batch that failed
|
|
44
|
+
* @param err Error that was thrown by the fetcher
|
|
45
|
+
* @returns `true` if the query should be retried for all items, `false` if it should be retried for none,
|
|
46
|
+
* or an array of items for which the query should be retried (waiters for other items will throw `err`).
|
|
47
|
+
*/
|
|
48
|
+
retrySingleOnError?: (items: T[], err: unknown) => boolean | T[];
|
|
49
|
+
}): BatchedQuery<T, U>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function streamToBuffer(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DcOptions } from '../../utils/dcs.js';
|
|
2
|
+
import { CurrentUserInfo } from '../storage/service/current-user.js';
|
|
3
|
+
export interface InputStringSessionData {
|
|
4
|
+
primaryDcs?: DcOptions;
|
|
5
|
+
testMode?: boolean;
|
|
6
|
+
self?: CurrentUserInfo | null;
|
|
7
|
+
authKey: Uint8Array;
|
|
8
|
+
}
|
|
9
|
+
export interface StringSessionData {
|
|
10
|
+
version: number;
|
|
11
|
+
primaryDcs: DcOptions;
|
|
12
|
+
self?: CurrentUserInfo | null;
|
|
13
|
+
authKey: Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
export declare function writeStringSession(data: StringSessionData): string;
|
|
16
|
+
export declare function readStringSession(data: string | InputStringSessionData): StringSessionData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decode 5-bit encoded voice message waveform into
|
|
3
|
+
* an array of waveform values (0-32).
|
|
4
|
+
*
|
|
5
|
+
* @param wf Encoded waveform
|
|
6
|
+
*/
|
|
7
|
+
export declare function decodeWaveform(wf: Uint8Array): number[];
|
|
8
|
+
/**
|
|
9
|
+
* Encode an array of waveform values into
|
|
10
|
+
* 5-bit encoded voice message waveform into
|
|
11
|
+
*
|
|
12
|
+
* @param wf Waveform values
|
|
13
|
+
*/
|
|
14
|
+
export declare function encodeWaveform(wf: number[]): Uint8Array;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PublicPart } from '../../types/utils.js';
|
|
2
|
+
import { AppConfigManager } from '../managers/app-config-manager.js';
|
|
3
|
+
import { WorkerInvoker } from './invoker.js';
|
|
4
|
+
export declare class AppConfigManagerProxy implements PublicPart<AppConfigManager> {
|
|
5
|
+
readonly invoker: WorkerInvoker;
|
|
6
|
+
readonly get: AppConfigManager['get'];
|
|
7
|
+
readonly getField: AppConfigManager['getField'];
|
|
8
|
+
constructor(invoker: WorkerInvoker);
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SerializedError {
|
|
2
|
+
name: string;
|
|
3
|
+
message: string;
|
|
4
|
+
stack?: string;
|
|
5
|
+
custom?: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export declare function serializeError(error: unknown): SerializedError;
|
|
8
|
+
export declare function deserializeError(error: SerializedError): Error;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { SendFn, WorkerInboundMessage, WorkerOutboundMessage } from './protocol.js';
|
|
2
|
+
export type InvokeTarget = Extract<WorkerInboundMessage, {
|
|
3
|
+
type: 'invoke';
|
|
4
|
+
}>['target'];
|
|
5
|
+
export declare class WorkerInvoker {
|
|
6
|
+
private send;
|
|
7
|
+
constructor(send: SendFn);
|
|
8
|
+
private _nextId;
|
|
9
|
+
private _pending;
|
|
10
|
+
private _invoke;
|
|
11
|
+
invoke(target: InvokeTarget, method: string, args: unknown[]): Promise<unknown>;
|
|
12
|
+
invokeVoid(target: InvokeTarget, method: string, args: unknown[]): void;
|
|
13
|
+
invokeWithAbort(target: InvokeTarget, method: string, args: unknown[], abortSignal: AbortSignal): Promise<unknown>;
|
|
14
|
+
handleResult(msg: Extract<WorkerOutboundMessage, {
|
|
15
|
+
type: 'result';
|
|
16
|
+
}>): void;
|
|
17
|
+
makeBinder<T>(target: InvokeTarget): <K extends keyof T>(method: K, isVoid?: boolean) => T[K];
|
|
18
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { tl } from '@mtcute/tl';
|
|
2
|
+
import { RpcCallOptions } from '../../network/network-manager.js';
|
|
3
|
+
import { ICorePlatform } from '../../types/platform.js';
|
|
4
|
+
import { MustEqual } from '../../types/utils.js';
|
|
5
|
+
import { ConnectionState, ITelegramClient } from '../client.types.js';
|
|
6
|
+
import { RawUpdateInfo } from '../updates/types.js';
|
|
7
|
+
import { ClientMessageHandler, SendFn, SomeWorker, WorkerCustomMethods } from './protocol.js';
|
|
8
|
+
import { Emitter } from '@fuman/utils';
|
|
9
|
+
import { LogManager } from '../../utils/logger.js';
|
|
10
|
+
import { TimersManager } from '../managers/timers.js';
|
|
11
|
+
import { AppConfigManagerProxy } from './app-config.js';
|
|
12
|
+
import { TelegramStorageProxy } from './storage.js';
|
|
13
|
+
export interface TelegramWorkerPortOptions {
|
|
14
|
+
worker: SomeWorker;
|
|
15
|
+
platform: ICorePlatform;
|
|
16
|
+
}
|
|
17
|
+
export declare abstract class TelegramWorkerPort<Custom extends WorkerCustomMethods> implements ITelegramClient {
|
|
18
|
+
readonly options: TelegramWorkerPortOptions;
|
|
19
|
+
readonly log: LogManager;
|
|
20
|
+
readonly platform: ICorePlatform;
|
|
21
|
+
private _connection;
|
|
22
|
+
private _invoker;
|
|
23
|
+
readonly storage: TelegramStorageProxy;
|
|
24
|
+
readonly appConfig: AppConfigManagerProxy;
|
|
25
|
+
readonly timers: TimersManager;
|
|
26
|
+
readonly prepare: ITelegramClient['prepare'];
|
|
27
|
+
private _connect;
|
|
28
|
+
readonly close: ITelegramClient['close'];
|
|
29
|
+
readonly notifyLoggedIn: ITelegramClient['notifyLoggedIn'];
|
|
30
|
+
readonly notifyLoggedOut: ITelegramClient['notifyLoggedOut'];
|
|
31
|
+
readonly notifyChannelOpened: ITelegramClient['notifyChannelOpened'];
|
|
32
|
+
readonly notifyChannelClosed: ITelegramClient['notifyChannelClosed'];
|
|
33
|
+
readonly importSession: ITelegramClient['importSession'];
|
|
34
|
+
readonly exportSession: ITelegramClient['exportSession'];
|
|
35
|
+
readonly handleClientUpdate: ITelegramClient['handleClientUpdate'];
|
|
36
|
+
readonly getApiCrenetials: ITelegramClient['getApiCrenetials'];
|
|
37
|
+
readonly getPoolSize: ITelegramClient['getPoolSize'];
|
|
38
|
+
readonly getPrimaryDcId: ITelegramClient['getPrimaryDcId'];
|
|
39
|
+
readonly changePrimaryDc: ITelegramClient['changePrimaryDc'];
|
|
40
|
+
readonly computeSrpParams: ITelegramClient['computeSrpParams'];
|
|
41
|
+
readonly computeNewPasswordHash: ITelegramClient['computeNewPasswordHash'];
|
|
42
|
+
readonly startUpdatesLoop: ITelegramClient['startUpdatesLoop'];
|
|
43
|
+
readonly stopUpdatesLoop: ITelegramClient['stopUpdatesLoop'];
|
|
44
|
+
readonly getMtprotoMessageId: ITelegramClient['getMtprotoMessageId'];
|
|
45
|
+
readonly recreateDc: ITelegramClient['recreateDc'];
|
|
46
|
+
private _abortController;
|
|
47
|
+
readonly stopSignal: AbortSignal;
|
|
48
|
+
constructor(options: TelegramWorkerPortOptions);
|
|
49
|
+
call<T extends tl.RpcMethod>(message: MustEqual<T, tl.RpcMethod>, params?: RpcCallOptions): Promise<tl.RpcCallReturn[T['_']]>;
|
|
50
|
+
abstract connectToWorker(worker: SomeWorker, handler: ClientMessageHandler): [SendFn, () => void];
|
|
51
|
+
onServerUpdate: Emitter<tl.TypeUpdates>;
|
|
52
|
+
onRawUpdate: Emitter<RawUpdateInfo>;
|
|
53
|
+
onConnectionState: Emitter<ConnectionState>;
|
|
54
|
+
onError: Emitter<Error>;
|
|
55
|
+
private _onMessage;
|
|
56
|
+
private _destroyed;
|
|
57
|
+
destroy(terminate?: boolean): void;
|
|
58
|
+
invokeCustom<T extends keyof Custom>(method: T, ...args: Parameters<Custom[T]>): Promise<ReturnType<Custom[T]>>;
|
|
59
|
+
connect(): Promise<void>;
|
|
60
|
+
}
|