@mtcute/core 0.28.2 → 0.29.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.cjs +0 -4
- package/client.js +0 -4
- package/highlevel/base.cjs +8 -9
- package/highlevel/base.d.cts +1 -1
- package/highlevel/base.d.ts +1 -1
- package/highlevel/base.js +8 -9
- package/highlevel/client.d.cts +9 -18
- package/highlevel/client.d.ts +9 -18
- package/highlevel/client.types.d.cts +5 -2
- package/highlevel/client.types.d.ts +5 -2
- package/highlevel/managers/timers.cjs +38 -18
- package/highlevel/managers/timers.d.cts +18 -4
- package/highlevel/managers/timers.d.ts +18 -4
- package/highlevel/managers/timers.js +38 -18
- package/highlevel/managers/timers.test.d.cts +1 -0
- package/highlevel/managers/timers.test.d.ts +1 -0
- package/highlevel/methods/auth/check-password.d.cts +1 -1
- package/highlevel/methods/auth/check-password.d.ts +1 -1
- package/highlevel/methods/auth/send-code.d.cts +1 -1
- package/highlevel/methods/auth/send-code.d.ts +1 -1
- package/highlevel/methods/auth/sign-in-qr.cjs +4 -4
- package/highlevel/methods/auth/sign-in-qr.js +4 -4
- package/highlevel/methods/auth/start.cjs +6 -6
- package/highlevel/methods/auth/start.d.cts +1 -1
- package/highlevel/methods/auth/start.d.ts +1 -1
- package/highlevel/methods/auth/start.js +6 -6
- package/highlevel/methods/auth/utils.d.cts +1 -1
- package/highlevel/methods/auth/utils.d.ts +1 -1
- package/highlevel/methods/bots/answer-inline-query.d.cts +1 -1
- package/highlevel/methods/bots/answer-inline-query.d.ts +1 -1
- package/highlevel/methods/bots/answer-pre-checkout-query.d.cts +1 -1
- package/highlevel/methods/bots/answer-pre-checkout-query.d.ts +1 -1
- package/highlevel/methods/bots/delete-my-commands.d.cts +1 -1
- package/highlevel/methods/bots/delete-my-commands.d.ts +1 -1
- package/highlevel/methods/bots/get-bot-info.d.cts +1 -1
- package/highlevel/methods/bots/get-bot-info.d.ts +1 -1
- package/highlevel/methods/bots/get-bot-menu-button.d.cts +1 -1
- package/highlevel/methods/bots/get-bot-menu-button.d.ts +1 -1
- package/highlevel/methods/bots/get-callback-answer.d.cts +1 -1
- package/highlevel/methods/bots/get-callback-answer.d.ts +1 -1
- package/highlevel/methods/bots/get-game-high-scores.d.cts +1 -1
- package/highlevel/methods/bots/get-game-high-scores.d.ts +1 -1
- package/highlevel/methods/bots/get-my-commands.d.cts +1 -1
- package/highlevel/methods/bots/get-my-commands.d.ts +1 -1
- package/highlevel/methods/bots/normalize-command-scope.cjs +2 -2
- package/highlevel/methods/bots/normalize-command-scope.d.cts +1 -1
- package/highlevel/methods/bots/normalize-command-scope.d.ts +1 -1
- package/highlevel/methods/bots/normalize-command-scope.js +2 -2
- package/highlevel/methods/bots/open-webview.cjs +15 -9
- package/highlevel/methods/bots/open-webview.d.cts +1 -1
- package/highlevel/methods/bots/open-webview.d.ts +1 -1
- package/highlevel/methods/bots/open-webview.js +15 -9
- package/highlevel/methods/bots/prepare-inline-message.d.cts +1 -1
- package/highlevel/methods/bots/prepare-inline-message.d.ts +1 -1
- package/highlevel/methods/bots/set-bot-menu-button.d.cts +1 -1
- package/highlevel/methods/bots/set-bot-menu-button.d.ts +1 -1
- package/highlevel/methods/bots/set-game-score.d.cts +1 -1
- package/highlevel/methods/bots/set-game-score.d.ts +1 -1
- package/highlevel/methods/bots/set-my-commands.d.cts +1 -1
- package/highlevel/methods/bots/set-my-commands.d.ts +1 -1
- package/highlevel/methods/bots/set-my-default-rights.d.cts +1 -1
- package/highlevel/methods/bots/set-my-default-rights.d.ts +1 -1
- package/highlevel/methods/chats/add-chat-members.d.cts +1 -1
- package/highlevel/methods/chats/add-chat-members.d.ts +1 -1
- package/highlevel/methods/chats/batched-queries.cjs +3 -3
- package/highlevel/methods/chats/batched-queries.d.cts +1 -1
- package/highlevel/methods/chats/batched-queries.d.ts +1 -1
- package/highlevel/methods/chats/batched-queries.js +3 -3
- package/highlevel/methods/chats/create-group.d.cts +1 -1
- package/highlevel/methods/chats/create-group.d.ts +1 -1
- package/highlevel/methods/chats/edit-admin-rights.d.cts +1 -1
- package/highlevel/methods/chats/edit-admin-rights.d.ts +1 -1
- package/highlevel/methods/chats/get-chat-event-log.d.cts +1 -1
- package/highlevel/methods/chats/get-chat-event-log.d.ts +1 -1
- package/highlevel/methods/chats/get-chat-member.cjs +2 -2
- package/highlevel/methods/chats/get-chat-member.js +2 -2
- package/highlevel/methods/chats/restrict-chat-member.d.cts +1 -1
- package/highlevel/methods/chats/restrict-chat-member.d.ts +1 -1
- package/highlevel/methods/chats/save-draft.d.cts +1 -1
- package/highlevel/methods/chats/save-draft.d.ts +1 -1
- package/highlevel/methods/chats/set-chat-color.d.cts +1 -1
- package/highlevel/methods/chats/set-chat-color.d.ts +1 -1
- package/highlevel/methods/chats/set-chat-default-permissions.d.cts +1 -1
- package/highlevel/methods/chats/set-chat-default-permissions.d.ts +1 -1
- package/highlevel/methods/chats/set-chat-photo.cjs +3 -3
- package/highlevel/methods/chats/set-chat-photo.js +3 -3
- package/highlevel/methods/contacts/import-contacts.d.cts +1 -1
- package/highlevel/methods/contacts/import-contacts.d.ts +1 -1
- package/highlevel/methods/contacts/set-contact-note.cjs +0 -2
- package/highlevel/methods/contacts/set-contact-note.js +0 -2
- package/highlevel/methods/dialogs/create-folder.d.cts +1 -1
- package/highlevel/methods/dialogs/create-folder.d.ts +1 -1
- package/highlevel/methods/dialogs/delete-folder.d.cts +1 -1
- package/highlevel/methods/dialogs/delete-folder.d.ts +1 -1
- package/highlevel/methods/dialogs/edit-folder.d.cts +1 -1
- package/highlevel/methods/dialogs/edit-folder.d.ts +1 -1
- package/highlevel/methods/dialogs/find-folder.cjs +1 -1
- package/highlevel/methods/dialogs/find-folder.d.cts +1 -1
- package/highlevel/methods/dialogs/find-folder.d.ts +1 -1
- package/highlevel/methods/dialogs/find-folder.js +1 -1
- package/highlevel/methods/dialogs/get-folders.d.cts +1 -1
- package/highlevel/methods/dialogs/get-folders.d.ts +1 -1
- package/highlevel/methods/dialogs/iter-dialogs.d.cts +1 -1
- package/highlevel/methods/dialogs/iter-dialogs.d.ts +1 -1
- package/highlevel/methods/dialogs/join-chatlist.d.cts +1 -1
- package/highlevel/methods/dialogs/join-chatlist.d.ts +1 -1
- package/highlevel/methods/files/download-chunk.cjs +2 -2
- package/highlevel/methods/files/download-chunk.js +2 -2
- package/highlevel/methods/files/download-iterable.cjs +3 -3
- package/highlevel/methods/files/download-iterable.d.cts +1 -1
- package/highlevel/methods/files/download-iterable.d.ts +1 -1
- package/highlevel/methods/files/download-iterable.js +3 -3
- package/highlevel/methods/files/normalize-file-to-document.cjs +2 -2
- package/highlevel/methods/files/normalize-file-to-document.d.cts +1 -1
- package/highlevel/methods/files/normalize-file-to-document.d.ts +1 -1
- package/highlevel/methods/files/normalize-file-to-document.js +2 -2
- package/highlevel/methods/files/normalize-input-file.cjs +3 -3
- package/highlevel/methods/files/normalize-input-file.d.cts +1 -1
- package/highlevel/methods/files/normalize-input-file.d.ts +1 -1
- package/highlevel/methods/files/normalize-input-file.js +3 -3
- package/highlevel/methods/files/normalize-input-media.cjs +5 -5
- package/highlevel/methods/files/normalize-input-media.d.cts +1 -1
- package/highlevel/methods/files/normalize-input-media.d.ts +1 -1
- package/highlevel/methods/files/normalize-input-media.js +5 -5
- package/highlevel/methods/forums/create-forum-topic.d.cts +1 -1
- package/highlevel/methods/forums/create-forum-topic.d.ts +1 -1
- package/highlevel/methods/forums/edit-forum-topic.d.cts +1 -1
- package/highlevel/methods/forums/edit-forum-topic.d.ts +1 -1
- package/highlevel/methods/gifts/_normalize-input-star-gift.d.cts +1 -1
- package/highlevel/methods/gifts/_normalize-input-star-gift.d.ts +1 -1
- package/highlevel/methods/gifts/get-resale-star-gifts.d.cts +1 -1
- package/highlevel/methods/gifts/get-resale-star-gifts.d.ts +1 -1
- package/highlevel/methods/gifts/get-star-gift-upgrade-options.d.cts +1 -1
- package/highlevel/methods/gifts/get-star-gift-upgrade-options.d.ts +1 -1
- package/highlevel/methods/gifts/send-star-gift-offer.d.cts +1 -1
- package/highlevel/methods/gifts/send-star-gift-offer.d.ts +1 -1
- package/highlevel/methods/gifts/transfer-star-gift.cjs +2 -2
- package/highlevel/methods/gifts/transfer-star-gift.js +2 -2
- package/highlevel/methods/gifts/upgrade-star-gift.cjs +2 -2
- package/highlevel/methods/gifts/upgrade-star-gift.js +2 -2
- package/highlevel/methods/invite-links/create-invite-link.d.cts +1 -1
- package/highlevel/methods/invite-links/create-invite-link.d.ts +1 -1
- package/highlevel/methods/invite-links/get-invite-link-members.d.cts +1 -1
- package/highlevel/methods/invite-links/get-invite-link-members.d.ts +1 -1
- package/highlevel/methods/messages/edit-inline-message.cjs +2 -2
- package/highlevel/methods/messages/edit-inline-message.d.cts +1 -1
- package/highlevel/methods/messages/edit-inline-message.d.ts +1 -1
- package/highlevel/methods/messages/edit-inline-message.js +2 -2
- package/highlevel/methods/messages/edit-message.cjs +3 -2
- package/highlevel/methods/messages/edit-message.js +3 -2
- package/highlevel/methods/messages/find-in-update.d.cts +1 -1
- package/highlevel/methods/messages/find-in-update.d.ts +1 -1
- package/highlevel/methods/messages/forward-messages.cjs +1 -1
- package/highlevel/methods/messages/forward-messages.d.cts +1 -1
- package/highlevel/methods/messages/forward-messages.d.ts +1 -1
- package/highlevel/methods/messages/forward-messages.js +1 -1
- package/highlevel/methods/messages/get-callback-query-message.d.cts +1 -1
- package/highlevel/methods/messages/get-callback-query-message.d.ts +1 -1
- package/highlevel/methods/messages/get-discussion-message.d.cts +1 -1
- package/highlevel/methods/messages/get-discussion-message.d.ts +1 -1
- package/highlevel/methods/messages/search-global.d.cts +1 -1
- package/highlevel/methods/messages/search-global.d.ts +1 -1
- package/highlevel/methods/messages/search-hashtag.d.cts +1 -1
- package/highlevel/methods/messages/search-hashtag.d.ts +1 -1
- package/highlevel/methods/messages/search-messages.d.cts +1 -1
- package/highlevel/methods/messages/search-messages.d.ts +1 -1
- package/highlevel/methods/messages/search-posts-global.d.cts +1 -1
- package/highlevel/methods/messages/search-posts-global.d.ts +1 -1
- package/highlevel/methods/messages/send-common.cjs +1 -1
- package/highlevel/methods/messages/send-common.d.cts +1 -1
- package/highlevel/methods/messages/send-common.d.ts +1 -1
- package/highlevel/methods/messages/send-common.js +1 -1
- package/highlevel/methods/messages/send-media-group.cjs +6 -5
- package/highlevel/methods/messages/send-media-group.js +6 -5
- package/highlevel/methods/messages/send-media.cjs +6 -5
- package/highlevel/methods/messages/send-media.js +6 -5
- package/highlevel/methods/messages/send-paid-reaction.cjs +2 -2
- package/highlevel/methods/messages/send-paid-reaction.js +2 -2
- package/highlevel/methods/messages/send-text.cjs +6 -5
- package/highlevel/methods/messages/send-text.js +6 -5
- package/highlevel/methods/messages/send-typing.cjs +3 -2
- package/highlevel/methods/messages/send-typing.d.cts +1 -1
- package/highlevel/methods/messages/send-typing.d.ts +1 -1
- package/highlevel/methods/messages/send-typing.js +3 -2
- package/highlevel/methods/messages/set-typing.cjs +12 -8
- package/highlevel/methods/messages/set-typing.d.cts +1 -1
- package/highlevel/methods/messages/set-typing.d.ts +1 -1
- package/highlevel/methods/messages/set-typing.js +12 -8
- package/highlevel/methods/messages/set-typing.test.d.cts +1 -0
- package/highlevel/methods/messages/set-typing.test.d.ts +1 -0
- package/highlevel/methods/misc/chain-id.d.cts +1 -1
- package/highlevel/methods/misc/chain-id.d.ts +1 -1
- package/highlevel/methods/misc/init-takeout-session.d.cts +1 -1
- package/highlevel/methods/misc/init-takeout-session.d.ts +1 -1
- package/highlevel/methods/misc/normalize-privacy-rules.d.cts +1 -1
- package/highlevel/methods/misc/normalize-privacy-rules.d.ts +1 -1
- package/highlevel/methods/misc/normalize-text.d.cts +1 -1
- package/highlevel/methods/misc/normalize-text.d.ts +1 -1
- package/highlevel/methods/premium/_normalize-stars-amount.d.cts +1 -1
- package/highlevel/methods/premium/_normalize-stars-amount.d.ts +1 -1
- package/highlevel/methods/premium/set-business-intro.d.cts +1 -1
- package/highlevel/methods/premium/set-business-intro.d.ts +1 -1
- package/highlevel/methods/premium/set-business-work-hours.d.cts +1 -1
- package/highlevel/methods/premium/set-business-work-hours.d.ts +1 -1
- package/highlevel/methods/stickers/_utils.d.cts +1 -1
- package/highlevel/methods/stickers/_utils.d.ts +1 -1
- package/highlevel/methods/stickers/get-custom-emojis.cjs +4 -5
- package/highlevel/methods/stickers/get-custom-emojis.d.cts +3 -3
- package/highlevel/methods/stickers/get-custom-emojis.d.ts +3 -3
- package/highlevel/methods/stickers/get-custom-emojis.js +4 -5
- package/highlevel/methods/stickers/set-sticker-set-thumb.d.cts +1 -1
- package/highlevel/methods/stickers/set-sticker-set-thumb.d.ts +1 -1
- package/highlevel/methods/stories/can-send-story.cjs +3 -3
- package/highlevel/methods/stories/can-send-story.js +3 -3
- package/highlevel/methods/stories/edit-story.d.cts +1 -1
- package/highlevel/methods/stories/edit-story.d.ts +1 -1
- package/highlevel/methods/stories/find-in-update.d.cts +1 -1
- package/highlevel/methods/stories/find-in-update.d.ts +1 -1
- package/highlevel/methods/stories/get-profile-stories.cjs +3 -3
- package/highlevel/methods/stories/get-profile-stories.js +3 -3
- package/highlevel/methods/stories/get-stories-by-id.cjs +3 -3
- package/highlevel/methods/stories/get-stories-by-id.js +3 -3
- package/highlevel/methods/stories/send-story.d.cts +1 -1
- package/highlevel/methods/stories/send-story.d.ts +1 -1
- package/highlevel/methods/users/_resolve-common.cjs +74 -0
- package/highlevel/methods/users/_resolve-common.d.cts +4 -0
- package/highlevel/methods/users/_resolve-common.d.ts +4 -0
- package/highlevel/methods/users/_resolve-common.js +69 -0
- package/highlevel/methods/users/delete-profile-photos.d.cts +1 -1
- package/highlevel/methods/users/delete-profile-photos.d.ts +1 -1
- package/highlevel/methods/users/get-profile-photo.cjs +1 -2
- package/highlevel/methods/users/get-profile-photo.d.cts +2 -2
- package/highlevel/methods/users/get-profile-photo.d.ts +2 -2
- package/highlevel/methods/users/get-profile-photo.js +1 -2
- package/highlevel/methods/users/get-profile-photos.cjs +3 -3
- package/highlevel/methods/users/get-profile-photos.js +3 -3
- package/highlevel/methods/users/get-saved-music.cjs +1 -0
- package/highlevel/methods/users/get-saved-music.js +1 -0
- package/highlevel/methods/users/is-peer-available.cjs +2 -2
- package/highlevel/methods/users/is-peer-available.js +1 -1
- package/highlevel/methods/users/resolve-peer-many.d.cts +1 -1
- package/highlevel/methods/users/resolve-peer-many.d.ts +1 -1
- package/highlevel/methods/users/resolve-peer.cjs +7 -68
- package/highlevel/methods/users/resolve-peer.d.cts +1 -3
- package/highlevel/methods/users/resolve-peer.d.ts +1 -3
- package/highlevel/methods/users/resolve-peer.js +8 -69
- package/highlevel/methods/users/resolve-phone-number.cjs +4 -4
- package/highlevel/methods/users/resolve-phone-number.d.cts +1 -1
- package/highlevel/methods/users/resolve-phone-number.d.ts +1 -1
- package/highlevel/methods/users/resolve-phone-number.js +3 -3
- package/highlevel/methods/users/save-music-to-profile.cjs +2 -2
- package/highlevel/methods/users/save-music-to-profile.js +2 -2
- package/highlevel/methods/users/set-emoji-status.d.cts +1 -1
- package/highlevel/methods/users/set-emoji-status.d.ts +1 -1
- package/highlevel/methods/users/set-my-profile-photo.cjs +5 -2
- package/highlevel/methods/users/set-my-profile-photo.d.cts +1 -1
- package/highlevel/methods/users/set-my-profile-photo.d.ts +1 -1
- package/highlevel/methods/users/set-my-profile-photo.js +5 -2
- package/highlevel/methods/users/set-online.cjs +9 -5
- package/highlevel/methods/users/set-online.js +9 -5
- package/highlevel/methods.d.cts +0 -1
- package/highlevel/methods.d.ts +0 -1
- package/highlevel/storage/service/current-user.cjs +1 -1
- package/highlevel/storage/service/current-user.d.cts +1 -1
- package/highlevel/storage/service/current-user.d.ts +1 -1
- package/highlevel/storage/service/current-user.js +1 -1
- package/highlevel/storage/service/peers.d.cts +1 -1
- package/highlevel/storage/service/peers.d.ts +1 -1
- package/highlevel/types/auth/sent-code.d.cts +1 -1
- package/highlevel/types/auth/sent-code.d.ts +1 -1
- package/highlevel/types/bots/command-scope/inner.d.cts +1 -1
- package/highlevel/types/bots/command-scope/inner.d.ts +1 -1
- package/highlevel/types/bots/game-high-score.d.cts +1 -1
- package/highlevel/types/bots/game-high-score.d.ts +1 -1
- package/highlevel/types/bots/inline-message/factories.d.cts +1 -1
- package/highlevel/types/bots/inline-message/factories.d.ts +1 -1
- package/highlevel/types/bots/inline-result/factories.d.cts +1 -1
- package/highlevel/types/bots/inline-result/factories.d.ts +1 -1
- package/highlevel/types/bots/inline-result/types.d.cts +1 -1
- package/highlevel/types/bots/inline-result/types.d.ts +1 -1
- package/highlevel/types/bots/keyboards/builder.d.cts +1 -1
- package/highlevel/types/bots/keyboards/builder.d.ts +1 -1
- package/highlevel/types/bots/keyboards/factories.cjs +2 -2
- package/highlevel/types/bots/keyboards/factories.d.cts +1 -1
- package/highlevel/types/bots/keyboards/factories.d.ts +1 -1
- package/highlevel/types/bots/keyboards/factories.js +2 -2
- package/highlevel/types/bots/keyboards/types.d.cts +1 -1
- package/highlevel/types/bots/keyboards/types.d.ts +1 -1
- package/highlevel/types/bots/webview.d.cts +1 -1
- package/highlevel/types/bots/webview.d.ts +1 -1
- package/highlevel/types/conversation.d.cts +1 -1
- package/highlevel/types/conversation.d.ts +1 -1
- package/highlevel/types/files/file-location.d.cts +1 -1
- package/highlevel/types/files/file-location.d.ts +1 -1
- package/highlevel/types/files/uploaded-file.d.cts +1 -1
- package/highlevel/types/files/uploaded-file.d.ts +1 -1
- package/highlevel/types/files/utils.d.cts +1 -1
- package/highlevel/types/files/utils.d.ts +1 -1
- package/highlevel/types/files/web-document.d.cts +1 -1
- package/highlevel/types/files/web-document.d.ts +1 -1
- package/highlevel/types/media/audio.d.cts +1 -1
- package/highlevel/types/media/audio.d.ts +1 -1
- package/highlevel/types/media/contact.d.cts +1 -1
- package/highlevel/types/media/contact.d.ts +1 -1
- package/highlevel/types/media/dice.d.cts +1 -1
- package/highlevel/types/media/dice.d.ts +1 -1
- package/highlevel/types/media/document-utils.d.cts +1 -1
- package/highlevel/types/media/document-utils.d.ts +1 -1
- package/highlevel/types/media/document.d.cts +1 -1
- package/highlevel/types/media/document.d.ts +1 -1
- package/highlevel/types/media/extended-media.d.cts +1 -1
- package/highlevel/types/media/extended-media.d.ts +1 -1
- package/highlevel/types/media/game.d.cts +1 -1
- package/highlevel/types/media/game.d.ts +1 -1
- package/highlevel/types/media/input-media/factories.d.cts +1 -1
- package/highlevel/types/media/input-media/factories.d.ts +1 -1
- package/highlevel/types/media/input-media/types.d.cts +1 -1
- package/highlevel/types/media/input-media/types.d.ts +1 -1
- package/highlevel/types/media/invoice.d.cts +1 -1
- package/highlevel/types/media/invoice.d.ts +1 -1
- package/highlevel/types/media/location.d.cts +1 -1
- package/highlevel/types/media/location.d.ts +1 -1
- package/highlevel/types/media/paid-media.d.cts +1 -1
- package/highlevel/types/media/paid-media.d.ts +1 -1
- package/highlevel/types/media/photo.d.cts +1 -1
- package/highlevel/types/media/photo.d.ts +1 -1
- package/highlevel/types/media/poll.d.cts +1 -1
- package/highlevel/types/media/poll.d.ts +1 -1
- package/highlevel/types/media/sticker.d.cts +1 -1
- package/highlevel/types/media/sticker.d.ts +1 -1
- package/highlevel/types/media/story.d.cts +1 -1
- package/highlevel/types/media/story.d.ts +1 -1
- package/highlevel/types/media/thumbnail.d.cts +1 -1
- package/highlevel/types/media/thumbnail.d.ts +1 -1
- package/highlevel/types/media/todo.d.cts +1 -1
- package/highlevel/types/media/todo.d.ts +1 -1
- package/highlevel/types/media/venue.cjs +2 -2
- package/highlevel/types/media/venue.d.cts +1 -1
- package/highlevel/types/media/venue.d.ts +1 -1
- package/highlevel/types/media/venue.js +2 -2
- package/highlevel/types/media/video.d.cts +1 -1
- package/highlevel/types/media/video.d.ts +1 -1
- package/highlevel/types/media/voice.d.cts +1 -1
- package/highlevel/types/media/voice.d.ts +1 -1
- package/highlevel/types/media/web-page.d.cts +1 -1
- package/highlevel/types/media/web-page.d.ts +1 -1
- package/highlevel/types/messages/dialog.d.cts +1 -1
- package/highlevel/types/messages/dialog.d.ts +1 -1
- package/highlevel/types/messages/draft-message.d.cts +1 -1
- package/highlevel/types/messages/draft-message.d.ts +1 -1
- package/highlevel/types/messages/fact-check.d.cts +1 -1
- package/highlevel/types/messages/fact-check.d.ts +1 -1
- package/highlevel/types/messages/message-action.cjs +4 -0
- package/highlevel/types/messages/message-action.d.cts +1 -1
- package/highlevel/types/messages/message-action.d.ts +1 -1
- package/highlevel/types/messages/message-action.js +4 -0
- package/highlevel/types/messages/message-effect.cjs +2 -6
- package/highlevel/types/messages/message-effect.d.cts +1 -1
- package/highlevel/types/messages/message-effect.d.ts +1 -1
- package/highlevel/types/messages/message-effect.js +2 -6
- package/highlevel/types/messages/message-entity.d.cts +1 -1
- package/highlevel/types/messages/message-entity.d.ts +1 -1
- package/highlevel/types/messages/message-forward.d.cts +1 -1
- package/highlevel/types/messages/message-forward.d.ts +1 -1
- package/highlevel/types/messages/message-media.d.cts +1 -1
- package/highlevel/types/messages/message-media.d.ts +1 -1
- package/highlevel/types/messages/message-reactions.d.cts +1 -1
- package/highlevel/types/messages/message-reactions.d.ts +1 -1
- package/highlevel/types/messages/message-replies.d.cts +1 -1
- package/highlevel/types/messages/message-replies.d.ts +1 -1
- package/highlevel/types/messages/message.d.cts +1 -1
- package/highlevel/types/messages/message.d.ts +1 -1
- package/highlevel/types/messages/replied-message.cjs +4 -14
- package/highlevel/types/messages/replied-message.d.cts +2 -2
- package/highlevel/types/messages/replied-message.d.ts +2 -2
- package/highlevel/types/messages/replied-message.js +2 -12
- package/highlevel/types/messages/suggested-post.d.cts +1 -1
- package/highlevel/types/messages/suggested-post.d.ts +1 -1
- package/highlevel/types/misc/collectible-info.d.cts +1 -1
- package/highlevel/types/misc/collectible-info.d.ts +1 -1
- package/highlevel/types/misc/entities.d.cts +1 -1
- package/highlevel/types/misc/entities.d.ts +1 -1
- package/highlevel/types/misc/input-privacy-rule/allow.d.cts +1 -1
- package/highlevel/types/misc/input-privacy-rule/allow.d.ts +1 -1
- package/highlevel/types/misc/input-privacy-rule/disallow.d.cts +1 -1
- package/highlevel/types/misc/input-privacy-rule/disallow.d.ts +1 -1
- package/highlevel/types/misc/input-privacy-rule/types.d.cts +1 -1
- package/highlevel/types/misc/input-privacy-rule/types.d.ts +1 -1
- package/highlevel/types/misc/sticker-set.cjs +5 -3
- package/highlevel/types/misc/sticker-set.d.cts +1 -1
- package/highlevel/types/misc/sticker-set.d.ts +1 -1
- package/highlevel/types/misc/sticker-set.js +5 -3
- package/highlevel/types/misc/takeout-session.d.cts +1 -1
- package/highlevel/types/misc/takeout-session.d.ts +1 -1
- package/highlevel/types/peers/bot-info.d.cts +1 -1
- package/highlevel/types/peers/bot-info.d.ts +1 -1
- package/highlevel/types/peers/bot-verification.d.cts +1 -1
- package/highlevel/types/peers/bot-verification.d.ts +1 -1
- package/highlevel/types/peers/chat-colors.d.cts +1 -1
- package/highlevel/types/peers/chat-colors.d.ts +1 -1
- package/highlevel/types/peers/chat-event/actions.cjs +4 -5
- package/highlevel/types/peers/chat-event/actions.d.cts +5 -6
- package/highlevel/types/peers/chat-event/actions.d.ts +5 -6
- package/highlevel/types/peers/chat-event/actions.js +4 -5
- package/highlevel/types/peers/chat-event/filters.d.cts +1 -1
- package/highlevel/types/peers/chat-event/filters.d.ts +1 -1
- package/highlevel/types/peers/chat-event/index.d.cts +1 -1
- package/highlevel/types/peers/chat-event/index.d.ts +1 -1
- package/highlevel/types/peers/chat-invite-link-member.d.cts +1 -1
- package/highlevel/types/peers/chat-invite-link-member.d.ts +1 -1
- package/highlevel/types/peers/chat-invite-link.d.cts +1 -1
- package/highlevel/types/peers/chat-invite-link.d.ts +1 -1
- package/highlevel/types/peers/chat-member.d.cts +1 -1
- package/highlevel/types/peers/chat-member.d.ts +1 -1
- package/highlevel/types/peers/chat-permissions.d.cts +1 -1
- package/highlevel/types/peers/chat-permissions.d.ts +1 -1
- package/highlevel/types/peers/chat-photo.d.cts +1 -1
- package/highlevel/types/peers/chat-photo.d.ts +1 -1
- package/highlevel/types/peers/chat-preview.d.cts +1 -1
- package/highlevel/types/peers/chat-preview.d.ts +1 -1
- package/highlevel/types/peers/chat.d.cts +1 -1
- package/highlevel/types/peers/chat.d.ts +1 -1
- package/highlevel/types/peers/chatlist-preview.d.cts +1 -1
- package/highlevel/types/peers/chatlist-preview.d.ts +1 -1
- package/highlevel/types/peers/forum-topic.d.cts +1 -1
- package/highlevel/types/peers/forum-topic.d.ts +1 -1
- package/highlevel/types/peers/full-chat.cjs +0 -11
- package/highlevel/types/peers/full-chat.d.cts +1 -6
- package/highlevel/types/peers/full-chat.d.ts +1 -6
- package/highlevel/types/peers/full-chat.js +0 -11
- package/highlevel/types/peers/full-user.d.cts +1 -1
- package/highlevel/types/peers/full-user.d.ts +1 -1
- package/highlevel/types/peers/index.d.cts +0 -1
- package/highlevel/types/peers/index.d.ts +0 -1
- package/highlevel/types/peers/peer-settings.d.cts +1 -1
- package/highlevel/types/peers/peer-settings.d.ts +1 -1
- package/highlevel/types/peers/peer.d.cts +1 -1
- package/highlevel/types/peers/peer.d.ts +1 -1
- package/highlevel/types/peers/peers-index.cjs +3 -1
- package/highlevel/types/peers/peers-index.d.cts +1 -1
- package/highlevel/types/peers/peers-index.d.ts +1 -1
- package/highlevel/types/peers/peers-index.js +3 -1
- package/highlevel/types/peers/user.d.cts +1 -1
- package/highlevel/types/peers/user.d.ts +1 -1
- package/highlevel/types/premium/boost-slot.d.cts +1 -1
- package/highlevel/types/premium/boost-slot.d.ts +1 -1
- package/highlevel/types/premium/boost-stats.d.cts +1 -1
- package/highlevel/types/premium/boost-stats.d.ts +1 -1
- package/highlevel/types/premium/boost.d.cts +1 -1
- package/highlevel/types/premium/boost.d.ts +1 -1
- package/highlevel/types/premium/business-account.d.cts +1 -1
- package/highlevel/types/premium/business-account.d.ts +1 -1
- package/highlevel/types/premium/business-chat-link.d.cts +1 -1
- package/highlevel/types/premium/business-chat-link.d.ts +1 -1
- package/highlevel/types/premium/business-connection.d.cts +1 -1
- package/highlevel/types/premium/business-connection.d.ts +1 -1
- package/highlevel/types/premium/business-intro.d.cts +1 -1
- package/highlevel/types/premium/business-intro.d.ts +1 -1
- package/highlevel/types/premium/business-location.d.cts +1 -1
- package/highlevel/types/premium/business-location.d.ts +1 -1
- package/highlevel/types/premium/business-work-hours.d.cts +1 -1
- package/highlevel/types/premium/business-work-hours.d.ts +1 -1
- package/highlevel/types/premium/saved-star-gift.d.cts +1 -1
- package/highlevel/types/premium/saved-star-gift.d.ts +1 -1
- package/highlevel/types/premium/star-gift-unique.d.cts +1 -1
- package/highlevel/types/premium/star-gift-unique.d.ts +1 -1
- package/highlevel/types/premium/star-gift-value.d.cts +1 -1
- package/highlevel/types/premium/star-gift-value.d.ts +1 -1
- package/highlevel/types/premium/star-gift.cjs +0 -4
- package/highlevel/types/premium/star-gift.d.cts +1 -3
- package/highlevel/types/premium/star-gift.d.ts +1 -3
- package/highlevel/types/premium/star-gift.js +0 -4
- package/highlevel/types/premium/stars-status.d.cts +1 -1
- package/highlevel/types/premium/stars-status.d.ts +1 -1
- package/highlevel/types/premium/stars-transaction.d.cts +1 -1
- package/highlevel/types/premium/stars-transaction.d.ts +1 -1
- package/highlevel/types/reactions/emoji-status.d.cts +1 -1
- package/highlevel/types/reactions/emoji-status.d.ts +1 -1
- package/highlevel/types/reactions/peer-reaction.cjs +5 -8
- package/highlevel/types/reactions/peer-reaction.d.cts +4 -5
- package/highlevel/types/reactions/peer-reaction.d.ts +4 -5
- package/highlevel/types/reactions/peer-reaction.js +5 -8
- package/highlevel/types/reactions/reaction-count.d.cts +1 -1
- package/highlevel/types/reactions/reaction-count.d.ts +1 -1
- package/highlevel/types/reactions/types.d.cts +1 -1
- package/highlevel/types/reactions/types.d.ts +1 -1
- package/highlevel/types/stories/all-stories.d.cts +1 -1
- package/highlevel/types/stories/all-stories.d.ts +1 -1
- package/highlevel/types/stories/interactive/base.d.cts +1 -1
- package/highlevel/types/stories/interactive/base.d.ts +1 -1
- package/highlevel/types/stories/interactive/channel-post.d.cts +1 -1
- package/highlevel/types/stories/interactive/channel-post.d.ts +1 -1
- package/highlevel/types/stories/interactive/index.d.cts +1 -1
- package/highlevel/types/stories/interactive/index.d.ts +1 -1
- package/highlevel/types/stories/interactive/input.d.cts +1 -1
- package/highlevel/types/stories/interactive/input.d.ts +1 -1
- package/highlevel/types/stories/interactive/location.d.cts +1 -1
- package/highlevel/types/stories/interactive/location.d.ts +1 -1
- package/highlevel/types/stories/interactive/reaction.d.cts +1 -1
- package/highlevel/types/stories/interactive/reaction.d.ts +1 -1
- package/highlevel/types/stories/interactive/star-gift.d.cts +1 -1
- package/highlevel/types/stories/interactive/star-gift.d.ts +1 -1
- package/highlevel/types/stories/interactive/url.d.cts +1 -1
- package/highlevel/types/stories/interactive/url.d.ts +1 -1
- package/highlevel/types/stories/interactive/venue.d.cts +1 -1
- package/highlevel/types/stories/interactive/venue.d.ts +1 -1
- package/highlevel/types/stories/interactive/weather.d.cts +1 -1
- package/highlevel/types/stories/interactive/weather.d.ts +1 -1
- package/highlevel/types/stories/peer-stories.cjs +4 -4
- package/highlevel/types/stories/peer-stories.d.cts +1 -1
- package/highlevel/types/stories/peer-stories.d.ts +1 -1
- package/highlevel/types/stories/peer-stories.js +4 -4
- package/highlevel/types/stories/stealth-mode.d.cts +1 -1
- package/highlevel/types/stories/stealth-mode.d.ts +1 -1
- package/highlevel/types/stories/story-interactions.d.cts +1 -1
- package/highlevel/types/stories/story-interactions.d.ts +1 -1
- package/highlevel/types/stories/story-viewer.cjs +3 -4
- package/highlevel/types/stories/story-viewer.d.cts +3 -3
- package/highlevel/types/stories/story-viewer.d.ts +3 -3
- package/highlevel/types/stories/story-viewer.js +3 -4
- package/highlevel/types/stories/story.d.cts +1 -1
- package/highlevel/types/stories/story.d.ts +1 -1
- package/highlevel/types/updates/bot-chat-join-request.d.cts +1 -1
- package/highlevel/types/updates/bot-chat-join-request.d.ts +1 -1
- package/highlevel/types/updates/bot-reaction.d.cts +1 -1
- package/highlevel/types/updates/bot-reaction.d.ts +1 -1
- package/highlevel/types/updates/bot-stopped.d.cts +1 -1
- package/highlevel/types/updates/bot-stopped.d.ts +1 -1
- package/highlevel/types/updates/business-message.d.cts +1 -1
- package/highlevel/types/updates/business-message.d.ts +1 -1
- package/highlevel/types/updates/callback-query.d.cts +1 -1
- package/highlevel/types/updates/callback-query.d.ts +1 -1
- package/highlevel/types/updates/chat-join-request.d.cts +1 -1
- package/highlevel/types/updates/chat-join-request.d.ts +1 -1
- package/highlevel/types/updates/chat-member-update.cjs +2 -2
- package/highlevel/types/updates/chat-member-update.d.cts +1 -1
- package/highlevel/types/updates/chat-member-update.d.ts +1 -1
- package/highlevel/types/updates/chat-member-update.js +2 -2
- package/highlevel/types/updates/chosen-inline-result.d.cts +1 -1
- package/highlevel/types/updates/chosen-inline-result.d.ts +1 -1
- package/highlevel/types/updates/delete-business-message-update.d.cts +1 -1
- package/highlevel/types/updates/delete-business-message-update.d.ts +1 -1
- package/highlevel/types/updates/delete-message-update.d.cts +1 -1
- package/highlevel/types/updates/delete-message-update.d.ts +1 -1
- package/highlevel/types/updates/delete-story-update.d.cts +1 -1
- package/highlevel/types/updates/delete-story-update.d.ts +1 -1
- package/highlevel/types/updates/history-read-update.d.cts +1 -1
- package/highlevel/types/updates/history-read-update.d.ts +1 -1
- package/highlevel/types/updates/inline-query.d.cts +1 -1
- package/highlevel/types/updates/inline-query.d.ts +1 -1
- package/highlevel/types/updates/poll-update.d.cts +1 -1
- package/highlevel/types/updates/poll-update.d.ts +1 -1
- package/highlevel/types/updates/poll-vote.d.cts +1 -1
- package/highlevel/types/updates/poll-vote.d.ts +1 -1
- package/highlevel/types/updates/pre-checkout-query.d.cts +1 -1
- package/highlevel/types/updates/pre-checkout-query.d.ts +1 -1
- package/highlevel/types/updates/story-update.d.cts +1 -1
- package/highlevel/types/updates/story-update.d.ts +1 -1
- package/highlevel/types/updates/user-status-update.d.cts +1 -1
- package/highlevel/types/updates/user-status-update.d.ts +1 -1
- package/highlevel/types/updates/user-typing-update.d.cts +1 -1
- package/highlevel/types/updates/user-typing-update.d.ts +1 -1
- package/highlevel/updates/manager.cjs +8 -9
- package/highlevel/updates/manager.d.cts +4 -2
- package/highlevel/updates/manager.d.ts +4 -2
- package/highlevel/updates/manager.js +8 -9
- package/highlevel/updates/types.d.cts +1 -1
- package/highlevel/updates/types.d.ts +1 -1
- package/highlevel/updates/utils.d.cts +1 -1
- package/highlevel/updates/utils.d.ts +1 -1
- package/highlevel/utils/convert-file-id.d.cts +1 -1
- package/highlevel/utils/convert-file-id.d.ts +1 -1
- package/highlevel/utils/file-utils.d.cts +1 -1
- package/highlevel/utils/file-utils.d.ts +1 -1
- package/highlevel/utils/inline-utils.d.cts +1 -1
- package/highlevel/utils/inline-utils.d.ts +1 -1
- package/highlevel/utils/peer-utils.cjs +4 -4
- package/highlevel/utils/peer-utils.d.cts +1 -1
- package/highlevel/utils/peer-utils.d.ts +1 -1
- package/highlevel/utils/peer-utils.js +4 -4
- package/highlevel/worker/errors.cjs +3 -3
- package/highlevel/worker/errors.js +3 -3
- package/highlevel/worker/invoker.cjs +67 -9
- package/highlevel/worker/invoker.d.cts +9 -1
- package/highlevel/worker/invoker.d.ts +9 -1
- package/highlevel/worker/invoker.js +67 -9
- package/highlevel/worker/invoker.test.d.cts +1 -0
- package/highlevel/worker/invoker.test.d.ts +1 -0
- package/highlevel/worker/port.cjs +50 -16
- package/highlevel/worker/port.d.cts +9 -5
- package/highlevel/worker/port.d.ts +9 -5
- package/highlevel/worker/port.js +51 -17
- package/highlevel/worker/protocol.cjs +19 -7
- package/highlevel/worker/protocol.d.cts +28 -4
- package/highlevel/worker/protocol.d.ts +28 -4
- package/highlevel/worker/protocol.js +19 -7
- package/highlevel/worker/protocol.test.d.cts +1 -0
- package/highlevel/worker/protocol.test.d.ts +1 -0
- package/highlevel/worker/storage.cjs +4 -1
- package/highlevel/worker/storage.d.cts +2 -1
- package/highlevel/worker/storage.d.ts +2 -1
- package/highlevel/worker/storage.js +4 -1
- package/highlevel/worker/timers.cjs +19 -0
- package/highlevel/worker/timers.d.cts +11 -0
- package/highlevel/worker/timers.d.ts +11 -0
- package/highlevel/worker/timers.js +14 -0
- package/highlevel/worker/timers.test.d.cts +1 -0
- package/highlevel/worker/timers.test.d.ts +1 -0
- package/highlevel/worker/worker.cjs +266 -53
- package/highlevel/worker/worker.d.cts +30 -2
- package/highlevel/worker/worker.d.ts +30 -2
- package/highlevel/worker/worker.js +267 -54
- package/highlevel/worker/worker.test.d.cts +1 -0
- package/highlevel/worker/worker.test.d.ts +1 -0
- package/index.cjs +4 -11
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/index.js +4 -5
- package/methods.cjs +0 -2
- package/methods.js +0 -2
- package/network/auth-key.d.cts +1 -1
- package/network/auth-key.d.ts +1 -1
- package/network/authorization.cjs +2 -2
- package/network/authorization.js +2 -2
- package/network/client.cjs +6 -7
- package/network/client.d.cts +1 -12
- package/network/client.d.ts +1 -12
- package/network/client.js +4 -5
- package/network/config-manager.d.cts +1 -1
- package/network/config-manager.d.ts +1 -1
- package/network/middlewares/internal-errors.cjs +8 -8
- package/network/middlewares/internal-errors.js +8 -8
- package/network/middlewares/on-error.d.cts +1 -1
- package/network/middlewares/on-error.d.ts +1 -1
- package/network/middlewares/on-method.d.cts +1 -1
- package/network/middlewares/on-method.d.ts +1 -1
- package/network/mtproto-session.cjs +0 -3
- package/network/mtproto-session.d.cts +1 -2
- package/network/mtproto-session.d.ts +1 -2
- package/network/mtproto-session.js +0 -3
- package/network/mtproxy/index.d.cts +1 -1
- package/network/mtproxy/index.d.ts +1 -1
- package/network/multi-session-connection.d.cts +1 -1
- package/network/multi-session-connection.d.ts +1 -1
- package/network/network-manager.cjs +40 -2
- package/network/network-manager.d.cts +12 -3
- package/network/network-manager.d.ts +12 -3
- package/network/network-manager.js +41 -3
- package/network/persistent-connection.d.cts +1 -1
- package/network/persistent-connection.d.ts +1 -1
- package/network/server-salt.d.cts +1 -1
- package/network/server-salt.d.ts +1 -1
- package/network/session-connection.cjs +10 -17
- package/network/session-connection.d.cts +1 -3
- package/network/session-connection.d.ts +1 -3
- package/network/session-connection.js +10 -17
- package/network/transports/abstract.d.cts +1 -1
- package/network/transports/abstract.d.ts +1 -1
- package/network/transports/intermediate.cjs +0 -2
- package/network/transports/intermediate.js +0 -2
- package/package.json +9 -6
- package/storage/service/base.d.cts +1 -1
- package/storage/service/base.d.ts +1 -1
- package/storage/service/future-salts.d.cts +1 -1
- package/storage/service/future-salts.d.ts +1 -1
- package/storage/sqlite/driver.cjs +0 -22
- package/storage/sqlite/driver.d.cts +0 -3
- package/storage/sqlite/driver.d.ts +0 -3
- package/storage/sqlite/driver.js +0 -22
- package/storage/sqlite/repository/kv.cjs +5 -47
- package/storage/sqlite/repository/kv.js +5 -47
- package/storage/sqlite/repository/peers.cjs +0 -3
- package/storage/sqlite/repository/peers.js +0 -3
- package/storage/storage.cjs +1 -3
- package/storage/storage.js +1 -3
- package/tl/api-schema.json +1 -0
- package/tl/app-config.json +1 -0
- package/tl/binary/reader.cjs +5248 -0
- package/tl/binary/reader.d.cts +3 -0
- package/tl/binary/reader.d.ts +3 -0
- package/tl/binary/reader.js +5243 -0
- package/tl/binary/rsa-keys.cjs +9 -0
- package/tl/binary/rsa-keys.d.cts +38 -0
- package/tl/binary/rsa-keys.d.ts +38 -0
- package/tl/binary/rsa-keys.js +4 -0
- package/tl/binary/writer.cjs +18718 -0
- package/tl/binary/writer.d.cts +4 -0
- package/tl/binary/writer.d.ts +4 -0
- package/tl/binary/writer.js +18713 -0
- package/tl/compat/reader.cjs +313 -0
- package/tl/compat/reader.d.cts +1 -0
- package/tl/compat/reader.d.ts +1 -0
- package/tl/compat/reader.js +308 -0
- package/tl/index.d.cts +58614 -0
- package/tl/index.d.ts +58614 -0
- package/tl/inner-mtp.cjs +63 -0
- package/tl/inner-mtp.js +58 -0
- package/tl/inner-tl.cjs +1261 -0
- package/tl/inner-tl.js +1256 -0
- package/tl/mtp-schema.json +1 -0
- package/tl/raw-errors.json +1 -0
- package/utils/binary/compat.cjs +10 -10
- package/utils/binary/compat.d.cts +1 -1
- package/utils/binary/compat.d.ts +1 -1
- package/utils/binary/compat.js +5 -5
- package/utils/binary/serialization.cjs +7 -7
- package/utils/binary/serialization.d.cts +1 -1
- package/utils/binary/serialization.d.ts +1 -1
- package/utils/binary/serialization.js +5 -5
- package/utils/crypto/keys.cjs +5 -5
- package/utils/crypto/keys.d.cts +1 -1
- package/utils/crypto/keys.d.ts +1 -1
- package/utils/crypto/keys.js +1 -1
- package/utils/crypto/password.d.cts +1 -1
- package/utils/crypto/password.d.ts +1 -1
- package/utils/date-entity-format.d.cts +1 -1
- package/utils/date-entity-format.d.ts +1 -1
- package/utils/index.d.cts +2 -6
- package/utils/index.d.ts +2 -6
- package/utils/links/bots.d.cts +1 -1
- package/utils/links/bots.d.ts +1 -1
- package/utils/logger.cjs +2 -2
- package/utils/logger.js +2 -2
- package/utils/peer-utils.d.cts +1 -1
- package/utils/peer-utils.d.ts +1 -1
- package/utils/tl-json.d.cts +1 -1
- package/utils/tl-json.d.ts +1 -1
- package/utils/type-assertions.d.cts +1 -1
- package/utils/type-assertions.d.ts +1 -1
- package/utils.cjs +4 -18
- package/utils.js +2 -10
- package/highlevel/methods/chats/get-nearby-chats.cjs +0 -37
- package/highlevel/methods/chats/get-nearby-chats.d.cts +0 -9
- package/highlevel/methods/chats/get-nearby-chats.d.ts +0 -9
- package/highlevel/methods/chats/get-nearby-chats.js +0 -32
- package/highlevel/methods/messages/_business-connection.cjs +0 -42
- package/highlevel/methods/messages/_business-connection.d.cts +0 -8
- package/highlevel/methods/messages/_business-connection.d.ts +0 -8
- package/highlevel/methods/messages/_business-connection.js +0 -37
- package/highlevel/types/peers/chat-location.cjs +0 -30
- package/highlevel/types/peers/chat-location.d.cts +0 -17
- package/highlevel/types/peers/chat-location.d.ts +0 -17
- package/highlevel/types/peers/chat-location.js +0 -25
- package/utils/error-reporting.cjs +0 -23
- package/utils/error-reporting.d.cts +0 -3
- package/utils/error-reporting.d.ts +0 -3
- package/utils/error-reporting.js +0 -18
|
@@ -5,12 +5,12 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
const tl = require("@mtcute/tl");
|
|
9
8
|
const utils = require("../../types/utils.cjs");
|
|
10
9
|
const errors = require("../types/errors.cjs");
|
|
10
|
+
const innerTl = require("../../tl/inner-tl.cjs");
|
|
11
11
|
const INVITE_LINK_REGEX = /^(?:https?:\/\/)?(?:www\.)?t(?:elegram)?\.(?:org|me|dog)\/(?:joinchat\/|\+)([\w-]+)$/i;
|
|
12
12
|
function toInputPeer(res) {
|
|
13
|
-
if (
|
|
13
|
+
if (innerTl.isAnyInputPeer(res)) return res;
|
|
14
14
|
switch (res._) {
|
|
15
15
|
case "inputChannelEmpty":
|
|
16
16
|
case "inputUserEmpty":
|
|
@@ -48,7 +48,7 @@ function toInputPeer(res) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
function toInputUser(res, input) {
|
|
51
|
-
if (
|
|
51
|
+
if (innerTl.isAnyInputUser(res)) return res;
|
|
52
52
|
switch (res._) {
|
|
53
53
|
case "inputPeerSelf":
|
|
54
54
|
return { _: "inputUserSelf" };
|
|
@@ -69,7 +69,7 @@ function toInputUser(res, input) {
|
|
|
69
69
|
throw new errors.MtInvalidPeerTypeError(input ?? res, "user");
|
|
70
70
|
}
|
|
71
71
|
function toInputChannel(res, input) {
|
|
72
|
-
if (
|
|
72
|
+
if (innerTl.isAnyInputChannel(res)) return res;
|
|
73
73
|
switch (res._) {
|
|
74
74
|
case "inputPeerChannel":
|
|
75
75
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputPeerLike } from '../types/peers/index.js';
|
|
2
|
-
import { tl } from '
|
|
2
|
+
import { tl } from '../../tl/index.js';
|
|
3
3
|
export declare const INVITE_LINK_REGEX: RegExp;
|
|
4
4
|
export declare function toInputPeer(res: tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel): tl.TypeInputPeer;
|
|
5
5
|
export declare function toInputUser(res: tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel, input?: InputPeerLike): tl.TypeInputUser;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InputPeerLike } from '../types/peers/index.js';
|
|
2
|
-
import { tl } from '
|
|
2
|
+
import { tl } from '../../tl/index.js';
|
|
3
3
|
export declare const INVITE_LINK_REGEX: RegExp;
|
|
4
4
|
export declare function toInputPeer(res: tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel): tl.TypeInputPeer;
|
|
5
5
|
export declare function toInputUser(res: tl.TypeInputPeer | tl.TypeInputUser | tl.TypeInputChannel, input?: InputPeerLike): tl.TypeInputUser;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { tl } from "@mtcute/tl";
|
|
2
1
|
import { assertNever } from "../../types/utils.js";
|
|
3
2
|
import { MtInvalidPeerTypeError } from "../types/errors.js";
|
|
3
|
+
import { isAnyInputPeer, isAnyInputUser, isAnyInputChannel } from "../../tl/inner-tl.js";
|
|
4
4
|
const INVITE_LINK_REGEX = /^(?:https?:\/\/)?(?:www\.)?t(?:elegram)?\.(?:org|me|dog)\/(?:joinchat\/|\+)([\w-]+)$/i;
|
|
5
5
|
function toInputPeer(res) {
|
|
6
|
-
if (
|
|
6
|
+
if (isAnyInputPeer(res)) return res;
|
|
7
7
|
switch (res._) {
|
|
8
8
|
case "inputChannelEmpty":
|
|
9
9
|
case "inputUserEmpty":
|
|
@@ -41,7 +41,7 @@ function toInputPeer(res) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
function toInputUser(res, input) {
|
|
44
|
-
if (
|
|
44
|
+
if (isAnyInputUser(res)) return res;
|
|
45
45
|
switch (res._) {
|
|
46
46
|
case "inputPeerSelf":
|
|
47
47
|
return { _: "inputUserSelf" };
|
|
@@ -62,7 +62,7 @@ function toInputUser(res, input) {
|
|
|
62
62
|
throw new MtInvalidPeerTypeError(input ?? res, "user");
|
|
63
63
|
}
|
|
64
64
|
function toInputChannel(res, input) {
|
|
65
|
-
if (
|
|
65
|
+
if (isAnyInputChannel(res)) return res;
|
|
66
66
|
switch (res._) {
|
|
67
67
|
case "inputPeerChannel":
|
|
68
68
|
return {
|
|
@@ -5,9 +5,9 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
5
5
|
}
|
|
6
6
|
"use strict";
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
|
-
const tl = require("@mtcute/tl");
|
|
9
8
|
const errors$1 = require("../../types/errors.cjs");
|
|
10
9
|
const errors = require("../types/errors.cjs");
|
|
10
|
+
const innerTl = require("../../tl/inner-tl.cjs");
|
|
11
11
|
function serializeError(error) {
|
|
12
12
|
if (!(error instanceof Error)) return { name: "Error", message: String(error) };
|
|
13
13
|
const res = {
|
|
@@ -38,7 +38,7 @@ function serializeError(error) {
|
|
|
38
38
|
messageId: _error.messageId,
|
|
39
39
|
context: _error.context
|
|
40
40
|
};
|
|
41
|
-
} else if (ctor ===
|
|
41
|
+
} else if (ctor === innerTl.RpcError) {
|
|
42
42
|
res.name = "RpcError";
|
|
43
43
|
res.custom = { ...error };
|
|
44
44
|
} else if (ctor === errors$1.MtArgumentError) {
|
|
@@ -78,7 +78,7 @@ function deserializeError(error) {
|
|
|
78
78
|
}
|
|
79
79
|
case "RpcError": {
|
|
80
80
|
const custom = error.custom;
|
|
81
|
-
err2 = new
|
|
81
|
+
err2 = new innerTl.RpcError(custom.code, custom.text);
|
|
82
82
|
err2.message = error.message;
|
|
83
83
|
for (const key in custom) {
|
|
84
84
|
if (key === "code" || key === "text") continue;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { tl } from "@mtcute/tl";
|
|
2
1
|
import { MtUnsupportedError, MtSecurityError, MtArgumentError, MtTimeoutError, MtTypeAssertionError, MtcuteError } from "../../types/errors.js";
|
|
3
2
|
import { MtEmptyError, MtInvalidPeerTypeError, MtPeerNotFoundError, MtMessageNotFoundError } from "../types/errors.js";
|
|
3
|
+
import { RpcError } from "../../tl/inner-tl.js";
|
|
4
4
|
function serializeError(error) {
|
|
5
5
|
if (!(error instanceof Error)) return { name: "Error", message: String(error) };
|
|
6
6
|
const res = {
|
|
@@ -31,7 +31,7 @@ function serializeError(error) {
|
|
|
31
31
|
messageId: _error.messageId,
|
|
32
32
|
context: _error.context
|
|
33
33
|
};
|
|
34
|
-
} else if (ctor ===
|
|
34
|
+
} else if (ctor === RpcError) {
|
|
35
35
|
res.name = "RpcError";
|
|
36
36
|
res.custom = { ...error };
|
|
37
37
|
} else if (ctor === MtArgumentError) {
|
|
@@ -71,7 +71,7 @@ function deserializeError(error) {
|
|
|
71
71
|
}
|
|
72
72
|
case "RpcError": {
|
|
73
73
|
const custom = error.custom;
|
|
74
|
-
err2 = new
|
|
74
|
+
err2 = new RpcError(custom.code, custom.text);
|
|
75
75
|
err2.message = error.message;
|
|
76
76
|
for (const key in custom) {
|
|
77
77
|
if (key === "code" || key === "text") continue;
|
|
@@ -9,16 +9,61 @@ const utils = require("@fuman/utils");
|
|
|
9
9
|
const errors = require("./errors.cjs");
|
|
10
10
|
const protocol = require("./protocol.cjs");
|
|
11
11
|
class WorkerInvoker {
|
|
12
|
-
constructor(send, workerId) {
|
|
12
|
+
constructor(send, workerId, connectionId) {
|
|
13
13
|
this.send = send;
|
|
14
14
|
this.workerId = workerId;
|
|
15
|
+
this.connectionId = connectionId;
|
|
15
16
|
}
|
|
16
17
|
_nextId = 0;
|
|
18
|
+
_released = false;
|
|
19
|
+
_releasedError = new Error("Worker connection closed");
|
|
17
20
|
_pending = /* @__PURE__ */ new Map();
|
|
21
|
+
_close(error, shouldRelease) {
|
|
22
|
+
if (this._released) return;
|
|
23
|
+
this._released = true;
|
|
24
|
+
this._releasedError = error;
|
|
25
|
+
if (shouldRelease) {
|
|
26
|
+
this.send({
|
|
27
|
+
_mtcuteWorkerId: this.workerId,
|
|
28
|
+
connectionId: this.connectionId,
|
|
29
|
+
type: "release"
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
for (const pending of this._pending.values()) {
|
|
33
|
+
pending.reject(error);
|
|
34
|
+
}
|
|
35
|
+
this._pending.clear();
|
|
36
|
+
}
|
|
37
|
+
connect() {
|
|
38
|
+
this.send({
|
|
39
|
+
_mtcuteWorkerId: this.workerId,
|
|
40
|
+
connectionId: this.connectionId,
|
|
41
|
+
type: "connect"
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
heartbeat() {
|
|
45
|
+
if (this._released) return;
|
|
46
|
+
this.send({
|
|
47
|
+
_mtcuteWorkerId: this.workerId,
|
|
48
|
+
connectionId: this.connectionId,
|
|
49
|
+
type: "heartbeat"
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
release() {
|
|
53
|
+
this._close(new Error("Worker connection closed"), true);
|
|
54
|
+
}
|
|
55
|
+
expire() {
|
|
56
|
+
this._close(new Error("Worker connection expired"), false);
|
|
57
|
+
}
|
|
18
58
|
_invoke(target, method, args, isVoid, abortSignal) {
|
|
59
|
+
if (this._released) {
|
|
60
|
+
if (isVoid) throw this._releasedError;
|
|
61
|
+
return Promise.reject(this._releasedError);
|
|
62
|
+
}
|
|
19
63
|
const id = this._nextId++;
|
|
20
64
|
this.send({
|
|
21
65
|
_mtcuteWorkerId: this.workerId,
|
|
66
|
+
connectionId: this.connectionId,
|
|
22
67
|
type: "invoke",
|
|
23
68
|
id,
|
|
24
69
|
target,
|
|
@@ -27,13 +72,26 @@ class WorkerInvoker {
|
|
|
27
72
|
void: isVoid,
|
|
28
73
|
withAbort: Boolean(abortSignal)
|
|
29
74
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
75
|
+
if (abortSignal) {
|
|
76
|
+
const onAbort = () => {
|
|
77
|
+
if (this._released) return;
|
|
78
|
+
this.send({
|
|
79
|
+
_mtcuteWorkerId: this.workerId,
|
|
80
|
+
connectionId: this.connectionId,
|
|
81
|
+
type: "abort",
|
|
82
|
+
id
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
86
|
+
if (!isVoid) {
|
|
87
|
+
const promise = new utils.Deferred();
|
|
88
|
+
this._pending.set(id, promise);
|
|
89
|
+
return promise.promise.finally(() => {
|
|
90
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
37
95
|
if (!isVoid) {
|
|
38
96
|
const promise = new utils.Deferred();
|
|
39
97
|
this._pending.set(id, promise);
|
|
@@ -44,7 +102,7 @@ class WorkerInvoker {
|
|
|
44
102
|
return this._invoke(target, method, args, false);
|
|
45
103
|
}
|
|
46
104
|
invokeVoid(target, method, args) {
|
|
47
|
-
this._invoke(target, method, args, true);
|
|
105
|
+
void this._invoke(target, method, args, true);
|
|
48
106
|
}
|
|
49
107
|
invokeWithAbort(target, method, args, abortSignal) {
|
|
50
108
|
if (abortSignal.aborted) return Promise.reject(abortSignal.reason);
|
|
@@ -5,9 +5,17 @@ export type InvokeTarget = Extract<WorkerInboundMessage, {
|
|
|
5
5
|
export declare class WorkerInvoker {
|
|
6
6
|
private send;
|
|
7
7
|
private readonly workerId;
|
|
8
|
-
|
|
8
|
+
private readonly connectionId;
|
|
9
|
+
constructor(send: SendFn, workerId: string, connectionId: string);
|
|
9
10
|
private _nextId;
|
|
11
|
+
private _released;
|
|
12
|
+
private _releasedError;
|
|
10
13
|
private _pending;
|
|
14
|
+
private _close;
|
|
15
|
+
connect(): void;
|
|
16
|
+
heartbeat(): void;
|
|
17
|
+
release(): void;
|
|
18
|
+
expire(): void;
|
|
11
19
|
private _invoke;
|
|
12
20
|
invoke(target: InvokeTarget, method: string, args: unknown[]): Promise<unknown>;
|
|
13
21
|
invokeVoid(target: InvokeTarget, method: string, args: unknown[]): void;
|
|
@@ -5,9 +5,17 @@ export type InvokeTarget = Extract<WorkerInboundMessage, {
|
|
|
5
5
|
export declare class WorkerInvoker {
|
|
6
6
|
private send;
|
|
7
7
|
private readonly workerId;
|
|
8
|
-
|
|
8
|
+
private readonly connectionId;
|
|
9
|
+
constructor(send: SendFn, workerId: string, connectionId: string);
|
|
9
10
|
private _nextId;
|
|
11
|
+
private _released;
|
|
12
|
+
private _releasedError;
|
|
10
13
|
private _pending;
|
|
14
|
+
private _close;
|
|
15
|
+
connect(): void;
|
|
16
|
+
heartbeat(): void;
|
|
17
|
+
release(): void;
|
|
18
|
+
expire(): void;
|
|
11
19
|
private _invoke;
|
|
12
20
|
invoke(target: InvokeTarget, method: string, args: unknown[]): Promise<unknown>;
|
|
13
21
|
invokeVoid(target: InvokeTarget, method: string, args: unknown[]): void;
|
|
@@ -2,16 +2,61 @@ import { Deferred } from "@fuman/utils";
|
|
|
2
2
|
import { deserializeError } from "./errors.js";
|
|
3
3
|
import { serializeResult, deserializeResult } from "./protocol.js";
|
|
4
4
|
class WorkerInvoker {
|
|
5
|
-
constructor(send, workerId) {
|
|
5
|
+
constructor(send, workerId, connectionId) {
|
|
6
6
|
this.send = send;
|
|
7
7
|
this.workerId = workerId;
|
|
8
|
+
this.connectionId = connectionId;
|
|
8
9
|
}
|
|
9
10
|
_nextId = 0;
|
|
11
|
+
_released = false;
|
|
12
|
+
_releasedError = new Error("Worker connection closed");
|
|
10
13
|
_pending = /* @__PURE__ */ new Map();
|
|
14
|
+
_close(error, shouldRelease) {
|
|
15
|
+
if (this._released) return;
|
|
16
|
+
this._released = true;
|
|
17
|
+
this._releasedError = error;
|
|
18
|
+
if (shouldRelease) {
|
|
19
|
+
this.send({
|
|
20
|
+
_mtcuteWorkerId: this.workerId,
|
|
21
|
+
connectionId: this.connectionId,
|
|
22
|
+
type: "release"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
for (const pending of this._pending.values()) {
|
|
26
|
+
pending.reject(error);
|
|
27
|
+
}
|
|
28
|
+
this._pending.clear();
|
|
29
|
+
}
|
|
30
|
+
connect() {
|
|
31
|
+
this.send({
|
|
32
|
+
_mtcuteWorkerId: this.workerId,
|
|
33
|
+
connectionId: this.connectionId,
|
|
34
|
+
type: "connect"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
heartbeat() {
|
|
38
|
+
if (this._released) return;
|
|
39
|
+
this.send({
|
|
40
|
+
_mtcuteWorkerId: this.workerId,
|
|
41
|
+
connectionId: this.connectionId,
|
|
42
|
+
type: "heartbeat"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
release() {
|
|
46
|
+
this._close(new Error("Worker connection closed"), true);
|
|
47
|
+
}
|
|
48
|
+
expire() {
|
|
49
|
+
this._close(new Error("Worker connection expired"), false);
|
|
50
|
+
}
|
|
11
51
|
_invoke(target, method, args, isVoid, abortSignal) {
|
|
52
|
+
if (this._released) {
|
|
53
|
+
if (isVoid) throw this._releasedError;
|
|
54
|
+
return Promise.reject(this._releasedError);
|
|
55
|
+
}
|
|
12
56
|
const id = this._nextId++;
|
|
13
57
|
this.send({
|
|
14
58
|
_mtcuteWorkerId: this.workerId,
|
|
59
|
+
connectionId: this.connectionId,
|
|
15
60
|
type: "invoke",
|
|
16
61
|
id,
|
|
17
62
|
target,
|
|
@@ -20,13 +65,26 @@ class WorkerInvoker {
|
|
|
20
65
|
void: isVoid,
|
|
21
66
|
withAbort: Boolean(abortSignal)
|
|
22
67
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
68
|
+
if (abortSignal) {
|
|
69
|
+
const onAbort = () => {
|
|
70
|
+
if (this._released) return;
|
|
71
|
+
this.send({
|
|
72
|
+
_mtcuteWorkerId: this.workerId,
|
|
73
|
+
connectionId: this.connectionId,
|
|
74
|
+
type: "abort",
|
|
75
|
+
id
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
79
|
+
if (!isVoid) {
|
|
80
|
+
const promise = new Deferred();
|
|
81
|
+
this._pending.set(id, promise);
|
|
82
|
+
return promise.promise.finally(() => {
|
|
83
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
30
88
|
if (!isVoid) {
|
|
31
89
|
const promise = new Deferred();
|
|
32
90
|
this._pending.set(id, promise);
|
|
@@ -37,7 +95,7 @@ class WorkerInvoker {
|
|
|
37
95
|
return this._invoke(target, method, args, false);
|
|
38
96
|
}
|
|
39
97
|
invokeVoid(target, method, args) {
|
|
40
|
-
this._invoke(target, method, args, true);
|
|
98
|
+
void this._invoke(target, method, args, true);
|
|
41
99
|
}
|
|
42
100
|
invokeWithAbort(target, method, args, abortSignal) {
|
|
43
101
|
if (abortSignal.aborted) return Promise.reject(abortSignal.reason);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -7,28 +7,41 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
|
|
|
7
7
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
8
8
|
const utils = require("@fuman/utils");
|
|
9
9
|
const logger = require("../../utils/logger.cjs");
|
|
10
|
-
const timers = require("../managers/timers.cjs");
|
|
11
10
|
const peersIndex = require("../types/peers/peers-index.cjs");
|
|
12
11
|
const appConfig = require("./app-config.cjs");
|
|
13
12
|
const errors = require("./errors.cjs");
|
|
14
13
|
const invoker = require("./invoker.cjs");
|
|
15
14
|
const protocol = require("./protocol.cjs");
|
|
16
15
|
const storage = require("./storage.cjs");
|
|
16
|
+
const timers = require("./timers.cjs");
|
|
17
|
+
const WORKER_HEARTBEAT_INTERVAL = 1e4;
|
|
18
|
+
let _nextConnectionId = 0;
|
|
19
|
+
function makeConnectionId() {
|
|
20
|
+
return `${Date.now().toString(36)}-${(_nextConnectionId++).toString(36)}-${Math.random().toString(36).slice(2)}`;
|
|
21
|
+
}
|
|
17
22
|
class TelegramWorkerPort {
|
|
18
23
|
constructor(options) {
|
|
19
24
|
this.options = options;
|
|
20
25
|
this.log = new logger.LogManager("worker", options.platform);
|
|
21
26
|
this.platform = options.platform;
|
|
22
27
|
this.workerId = options.workerId ?? protocol.DEFAULT_WORKER_ID;
|
|
28
|
+
this.connectionId = makeConnectionId();
|
|
23
29
|
this._connection = this.connectToWorker(this.options.worker, this._onMessage);
|
|
24
|
-
this._invoker = new invoker.WorkerInvoker(this._connection[0], this.workerId);
|
|
30
|
+
this._invoker = new invoker.WorkerInvoker(this._connection[0], this.workerId, this.connectionId);
|
|
31
|
+
this._invoker.connect();
|
|
32
|
+
this._heartbeatTimer = setInterval(() => {
|
|
33
|
+
this._invoker.heartbeat();
|
|
34
|
+
}, WORKER_HEARTBEAT_INTERVAL);
|
|
35
|
+
this._cancelBeforeExit = this.platform.beforeExit(() => {
|
|
36
|
+
void this.destroy();
|
|
37
|
+
});
|
|
25
38
|
this.storage = new storage.TelegramStorageProxy(this._invoker);
|
|
26
39
|
this.appConfig = new appConfig.AppConfigManagerProxy(this._invoker);
|
|
27
40
|
const bind = this._invoker.makeBinder("client");
|
|
28
41
|
this.prepare = bind("prepare");
|
|
29
42
|
this._connect = bind("connect");
|
|
30
43
|
this.disconnect = bind("disconnect");
|
|
31
|
-
this.
|
|
44
|
+
this.unsafeForceDestroy = bind("destroy");
|
|
32
45
|
this.notifyLoggedIn = bind("notifyLoggedIn");
|
|
33
46
|
this.notifyLoggedOut = bind("notifyLoggedOut");
|
|
34
47
|
this.notifyChannelOpened = bind("notifyChannelOpened");
|
|
@@ -46,8 +59,7 @@ class TelegramWorkerPort {
|
|
|
46
59
|
this.stopUpdatesLoop = bind("stopUpdatesLoop");
|
|
47
60
|
this.getMtprotoMessageId = bind("getMtprotoMessageId");
|
|
48
61
|
this.recreateDc = bind("recreateDc");
|
|
49
|
-
this.timers = new timers.
|
|
50
|
-
this.timers.onError((err) => this.onError.emit(utils.unknownToError(err)));
|
|
62
|
+
this.timers = new timers.WorkerTimersManager(this._invoker);
|
|
51
63
|
}
|
|
52
64
|
log;
|
|
53
65
|
platform;
|
|
@@ -55,15 +67,12 @@ class TelegramWorkerPort {
|
|
|
55
67
|
_invoker;
|
|
56
68
|
storage;
|
|
57
69
|
appConfig;
|
|
58
|
-
// todo: ideally timers should be handled on the worker side,
|
|
59
|
-
// but i'm not sure yet of the best way to handle multiple clients (e.g. in SharedWorker-s)
|
|
60
|
-
// (with one worker client it's not that big of a deal)
|
|
61
70
|
timers;
|
|
62
71
|
// bound methods
|
|
63
72
|
prepare;
|
|
64
73
|
_connect;
|
|
65
74
|
disconnect;
|
|
66
|
-
|
|
75
|
+
unsafeForceDestroy;
|
|
67
76
|
notifyLoggedIn;
|
|
68
77
|
notifyLoggedOut;
|
|
69
78
|
notifyChannelOpened;
|
|
@@ -84,6 +93,9 @@ class TelegramWorkerPort {
|
|
|
84
93
|
_abortController = new AbortController();
|
|
85
94
|
stopSignal = this._abortController.signal;
|
|
86
95
|
workerId;
|
|
96
|
+
connectionId;
|
|
97
|
+
_cancelBeforeExit;
|
|
98
|
+
_heartbeatTimer;
|
|
87
99
|
call(message, params) {
|
|
88
100
|
if (params?.abortSignal) {
|
|
89
101
|
const { abortSignal, ...rest } = params;
|
|
@@ -96,7 +108,9 @@ class TelegramWorkerPort {
|
|
|
96
108
|
onConnectionState = new utils.Emitter();
|
|
97
109
|
onError = new utils.Emitter();
|
|
98
110
|
_onMessage = (message) => {
|
|
111
|
+
if (this._closed) return;
|
|
99
112
|
if (message._mtcuteWorkerId !== this.workerId) return;
|
|
113
|
+
if ("connectionId" in message && message.connectionId !== this.connectionId) return;
|
|
100
114
|
switch (message.type) {
|
|
101
115
|
case "log":
|
|
102
116
|
this.log.handler(message.color, message.level, message.tag, message.fmt, message.args);
|
|
@@ -104,6 +118,15 @@ class TelegramWorkerPort {
|
|
|
104
118
|
case "server_update":
|
|
105
119
|
this.onServerUpdate.emit(protocol.deserializeResult(message.update));
|
|
106
120
|
break;
|
|
121
|
+
case "self_sync":
|
|
122
|
+
this.storage.self.setCached(protocol.deserializeResult(message.self));
|
|
123
|
+
break;
|
|
124
|
+
case "connection_expired": {
|
|
125
|
+
const error = new Error("Worker connection expired");
|
|
126
|
+
this.onError.emit(error);
|
|
127
|
+
this._close(false);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
107
130
|
case "conn_state":
|
|
108
131
|
this.onConnectionState.emit(message.state);
|
|
109
132
|
break;
|
|
@@ -120,17 +143,28 @@ class TelegramWorkerPort {
|
|
|
120
143
|
this.onError.emit(errors.deserializeError(message.error));
|
|
121
144
|
break;
|
|
122
145
|
case "stop":
|
|
123
|
-
this.
|
|
146
|
+
this._close(false);
|
|
124
147
|
break;
|
|
125
148
|
}
|
|
126
149
|
};
|
|
127
|
-
|
|
150
|
+
_closed = false;
|
|
151
|
+
_close(sendRelease) {
|
|
152
|
+
if (this._closed) return;
|
|
153
|
+
this._closed = true;
|
|
154
|
+
if (this._heartbeatTimer !== void 0) {
|
|
155
|
+
clearInterval(this._heartbeatTimer);
|
|
156
|
+
}
|
|
157
|
+
this._cancelBeforeExit?.();
|
|
158
|
+
if (sendRelease) {
|
|
159
|
+
this._invoker.release();
|
|
160
|
+
} else {
|
|
161
|
+
this._invoker.expire();
|
|
162
|
+
}
|
|
163
|
+
this._abortController.abort();
|
|
164
|
+
queueMicrotask(() => this._connection[1]());
|
|
165
|
+
}
|
|
128
166
|
async destroy(terminate = false) {
|
|
129
|
-
|
|
130
|
-
await this.destroy_();
|
|
131
|
-
this.timers.destroy();
|
|
132
|
-
this._connection[1]();
|
|
133
|
-
this._destroyed = true;
|
|
167
|
+
this._close(true);
|
|
134
168
|
if (terminate && "terminate" in this.options.worker) {
|
|
135
169
|
await Promise.resolve(this.options.worker.terminate());
|
|
136
170
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { tl } from '@mtcute/tl';
|
|
2
1
|
import { RpcCallOptions } from '../../network/network-manager.js';
|
|
2
|
+
import { tl } from '../../tl/index.js';
|
|
3
3
|
import { ICorePlatform } from '../../types/platform.js';
|
|
4
4
|
import { MustEqual } from '../../types/utils.js';
|
|
5
5
|
import { ConnectionState, ITelegramClient } from '../client.types.js';
|
|
@@ -7,9 +7,9 @@ import { RawUpdateInfo } from '../updates/types.js';
|
|
|
7
7
|
import { ClientMessageHandler, SendFn, SomeWorker, WorkerCustomMethods } from './protocol.js';
|
|
8
8
|
import { Emitter } from '@fuman/utils';
|
|
9
9
|
import { LogManager } from '../../utils/logger.js';
|
|
10
|
-
import { TimersManager } from '../managers/timers.js';
|
|
11
10
|
import { AppConfigManagerProxy } from './app-config.js';
|
|
12
11
|
import { TelegramStorageProxy } from './storage.js';
|
|
12
|
+
import { WorkerTimersManager } from './timers.js';
|
|
13
13
|
export interface TelegramWorkerPortOptions {
|
|
14
14
|
worker: SomeWorker;
|
|
15
15
|
workerId?: string;
|
|
@@ -23,11 +23,11 @@ export declare abstract class TelegramWorkerPort<Custom extends WorkerCustomMeth
|
|
|
23
23
|
private _invoker;
|
|
24
24
|
readonly storage: TelegramStorageProxy;
|
|
25
25
|
readonly appConfig: AppConfigManagerProxy;
|
|
26
|
-
readonly timers:
|
|
26
|
+
readonly timers: WorkerTimersManager;
|
|
27
27
|
readonly prepare: ITelegramClient['prepare'];
|
|
28
28
|
private _connect;
|
|
29
29
|
readonly disconnect: ITelegramClient['disconnect'];
|
|
30
|
-
readonly
|
|
30
|
+
readonly unsafeForceDestroy: () => Promise<void>;
|
|
31
31
|
readonly notifyLoggedIn: ITelegramClient['notifyLoggedIn'];
|
|
32
32
|
readonly notifyLoggedOut: ITelegramClient['notifyLoggedOut'];
|
|
33
33
|
readonly notifyChannelOpened: ITelegramClient['notifyChannelOpened'];
|
|
@@ -48,6 +48,9 @@ export declare abstract class TelegramWorkerPort<Custom extends WorkerCustomMeth
|
|
|
48
48
|
private _abortController;
|
|
49
49
|
readonly stopSignal: AbortSignal;
|
|
50
50
|
readonly workerId: string;
|
|
51
|
+
readonly connectionId: string;
|
|
52
|
+
private _cancelBeforeExit;
|
|
53
|
+
private _heartbeatTimer;
|
|
51
54
|
constructor(options: TelegramWorkerPortOptions);
|
|
52
55
|
call<T extends tl.RpcMethod>(message: MustEqual<T, tl.RpcMethod>, params?: RpcCallOptions): Promise<tl.RpcCallReturn[T['_']]>;
|
|
53
56
|
abstract connectToWorker(worker: SomeWorker, handler: ClientMessageHandler): [SendFn, () => void];
|
|
@@ -56,7 +59,8 @@ export declare abstract class TelegramWorkerPort<Custom extends WorkerCustomMeth
|
|
|
56
59
|
onConnectionState: Emitter<ConnectionState>;
|
|
57
60
|
onError: Emitter<Error>;
|
|
58
61
|
private _onMessage;
|
|
59
|
-
private
|
|
62
|
+
private _closed;
|
|
63
|
+
private _close;
|
|
60
64
|
destroy(terminate?: boolean): Promise<void>;
|
|
61
65
|
invokeCustom<T extends keyof Custom>(method: T, ...args: Parameters<Custom[T]>): Promise<ReturnType<Custom[T]>>;
|
|
62
66
|
connect(): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { tl } from '@mtcute/tl';
|
|
2
1
|
import { RpcCallOptions } from '../../network/network-manager.js';
|
|
2
|
+
import { tl } from '../../tl/index.js';
|
|
3
3
|
import { ICorePlatform } from '../../types/platform.js';
|
|
4
4
|
import { MustEqual } from '../../types/utils.js';
|
|
5
5
|
import { ConnectionState, ITelegramClient } from '../client.types.js';
|
|
@@ -7,9 +7,9 @@ import { RawUpdateInfo } from '../updates/types.js';
|
|
|
7
7
|
import { ClientMessageHandler, SendFn, SomeWorker, WorkerCustomMethods } from './protocol.js';
|
|
8
8
|
import { Emitter } from '@fuman/utils';
|
|
9
9
|
import { LogManager } from '../../utils/logger.js';
|
|
10
|
-
import { TimersManager } from '../managers/timers.js';
|
|
11
10
|
import { AppConfigManagerProxy } from './app-config.js';
|
|
12
11
|
import { TelegramStorageProxy } from './storage.js';
|
|
12
|
+
import { WorkerTimersManager } from './timers.js';
|
|
13
13
|
export interface TelegramWorkerPortOptions {
|
|
14
14
|
worker: SomeWorker;
|
|
15
15
|
workerId?: string;
|
|
@@ -23,11 +23,11 @@ export declare abstract class TelegramWorkerPort<Custom extends WorkerCustomMeth
|
|
|
23
23
|
private _invoker;
|
|
24
24
|
readonly storage: TelegramStorageProxy;
|
|
25
25
|
readonly appConfig: AppConfigManagerProxy;
|
|
26
|
-
readonly timers:
|
|
26
|
+
readonly timers: WorkerTimersManager;
|
|
27
27
|
readonly prepare: ITelegramClient['prepare'];
|
|
28
28
|
private _connect;
|
|
29
29
|
readonly disconnect: ITelegramClient['disconnect'];
|
|
30
|
-
readonly
|
|
30
|
+
readonly unsafeForceDestroy: () => Promise<void>;
|
|
31
31
|
readonly notifyLoggedIn: ITelegramClient['notifyLoggedIn'];
|
|
32
32
|
readonly notifyLoggedOut: ITelegramClient['notifyLoggedOut'];
|
|
33
33
|
readonly notifyChannelOpened: ITelegramClient['notifyChannelOpened'];
|
|
@@ -48,6 +48,9 @@ export declare abstract class TelegramWorkerPort<Custom extends WorkerCustomMeth
|
|
|
48
48
|
private _abortController;
|
|
49
49
|
readonly stopSignal: AbortSignal;
|
|
50
50
|
readonly workerId: string;
|
|
51
|
+
readonly connectionId: string;
|
|
52
|
+
private _cancelBeforeExit;
|
|
53
|
+
private _heartbeatTimer;
|
|
51
54
|
constructor(options: TelegramWorkerPortOptions);
|
|
52
55
|
call<T extends tl.RpcMethod>(message: MustEqual<T, tl.RpcMethod>, params?: RpcCallOptions): Promise<tl.RpcCallReturn[T['_']]>;
|
|
53
56
|
abstract connectToWorker(worker: SomeWorker, handler: ClientMessageHandler): [SendFn, () => void];
|
|
@@ -56,7 +59,8 @@ export declare abstract class TelegramWorkerPort<Custom extends WorkerCustomMeth
|
|
|
56
59
|
onConnectionState: Emitter<ConnectionState>;
|
|
57
60
|
onError: Emitter<Error>;
|
|
58
61
|
private _onMessage;
|
|
59
|
-
private
|
|
62
|
+
private _closed;
|
|
63
|
+
private _close;
|
|
60
64
|
destroy(terminate?: boolean): Promise<void>;
|
|
61
65
|
invokeCustom<T extends keyof Custom>(method: T, ...args: Parameters<Custom[T]>): Promise<ReturnType<Custom[T]>>;
|
|
62
66
|
connect(): Promise<void>;
|