@mtcute/core 0.28.1 → 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.
Files changed (783) hide show
  1. package/client.cjs +8 -4
  2. package/client.js +8 -4
  3. package/highlevel/base.cjs +8 -9
  4. package/highlevel/base.d.cts +1 -1
  5. package/highlevel/base.d.ts +1 -1
  6. package/highlevel/base.js +8 -9
  7. package/highlevel/client.d.cts +64 -21
  8. package/highlevel/client.d.ts +64 -21
  9. package/highlevel/client.types.d.cts +5 -2
  10. package/highlevel/client.types.d.ts +5 -2
  11. package/highlevel/managers/timers.cjs +38 -18
  12. package/highlevel/managers/timers.d.cts +18 -4
  13. package/highlevel/managers/timers.d.ts +18 -4
  14. package/highlevel/managers/timers.js +38 -18
  15. package/highlevel/managers/timers.test.d.cts +1 -0
  16. package/highlevel/managers/timers.test.d.ts +1 -0
  17. package/highlevel/methods/auth/check-password.d.cts +1 -1
  18. package/highlevel/methods/auth/check-password.d.ts +1 -1
  19. package/highlevel/methods/auth/send-code.d.cts +1 -1
  20. package/highlevel/methods/auth/send-code.d.ts +1 -1
  21. package/highlevel/methods/auth/sign-in-qr.cjs +4 -4
  22. package/highlevel/methods/auth/sign-in-qr.js +4 -4
  23. package/highlevel/methods/auth/start.cjs +6 -6
  24. package/highlevel/methods/auth/start.d.cts +1 -1
  25. package/highlevel/methods/auth/start.d.ts +1 -1
  26. package/highlevel/methods/auth/start.js +6 -6
  27. package/highlevel/methods/auth/utils.d.cts +1 -1
  28. package/highlevel/methods/auth/utils.d.ts +1 -1
  29. package/highlevel/methods/bots/answer-inline-query.d.cts +1 -1
  30. package/highlevel/methods/bots/answer-inline-query.d.ts +1 -1
  31. package/highlevel/methods/bots/answer-pre-checkout-query.d.cts +1 -1
  32. package/highlevel/methods/bots/answer-pre-checkout-query.d.ts +1 -1
  33. package/highlevel/methods/bots/delete-my-commands.d.cts +1 -1
  34. package/highlevel/methods/bots/delete-my-commands.d.ts +1 -1
  35. package/highlevel/methods/bots/get-bot-info.d.cts +1 -1
  36. package/highlevel/methods/bots/get-bot-info.d.ts +1 -1
  37. package/highlevel/methods/bots/get-bot-menu-button.d.cts +1 -1
  38. package/highlevel/methods/bots/get-bot-menu-button.d.ts +1 -1
  39. package/highlevel/methods/bots/get-callback-answer.d.cts +1 -1
  40. package/highlevel/methods/bots/get-callback-answer.d.ts +1 -1
  41. package/highlevel/methods/bots/get-game-high-scores.d.cts +1 -1
  42. package/highlevel/methods/bots/get-game-high-scores.d.ts +1 -1
  43. package/highlevel/methods/bots/get-my-commands.d.cts +1 -1
  44. package/highlevel/methods/bots/get-my-commands.d.ts +1 -1
  45. package/highlevel/methods/bots/normalize-command-scope.cjs +2 -2
  46. package/highlevel/methods/bots/normalize-command-scope.d.cts +1 -1
  47. package/highlevel/methods/bots/normalize-command-scope.d.ts +1 -1
  48. package/highlevel/methods/bots/normalize-command-scope.js +2 -2
  49. package/highlevel/methods/bots/open-webview.cjs +15 -9
  50. package/highlevel/methods/bots/open-webview.d.cts +1 -1
  51. package/highlevel/methods/bots/open-webview.d.ts +1 -1
  52. package/highlevel/methods/bots/open-webview.js +15 -9
  53. package/highlevel/methods/bots/prepare-inline-message.d.cts +1 -1
  54. package/highlevel/methods/bots/prepare-inline-message.d.ts +1 -1
  55. package/highlevel/methods/bots/set-bot-menu-button.d.cts +1 -1
  56. package/highlevel/methods/bots/set-bot-menu-button.d.ts +1 -1
  57. package/highlevel/methods/bots/set-game-score.d.cts +1 -1
  58. package/highlevel/methods/bots/set-game-score.d.ts +1 -1
  59. package/highlevel/methods/bots/set-my-commands.d.cts +1 -1
  60. package/highlevel/methods/bots/set-my-commands.d.ts +1 -1
  61. package/highlevel/methods/bots/set-my-default-rights.d.cts +1 -1
  62. package/highlevel/methods/bots/set-my-default-rights.d.ts +1 -1
  63. package/highlevel/methods/chats/add-chat-members.d.cts +1 -1
  64. package/highlevel/methods/chats/add-chat-members.d.ts +1 -1
  65. package/highlevel/methods/chats/batched-queries.cjs +3 -3
  66. package/highlevel/methods/chats/batched-queries.d.cts +1 -1
  67. package/highlevel/methods/chats/batched-queries.d.ts +1 -1
  68. package/highlevel/methods/chats/batched-queries.js +3 -3
  69. package/highlevel/methods/chats/create-group.d.cts +1 -1
  70. package/highlevel/methods/chats/create-group.d.ts +1 -1
  71. package/highlevel/methods/chats/edit-admin-rights.d.cts +1 -1
  72. package/highlevel/methods/chats/edit-admin-rights.d.ts +1 -1
  73. package/highlevel/methods/chats/edit-chat-member-rank.cjs +19 -0
  74. package/highlevel/methods/chats/edit-chat-member-rank.d.cts +13 -0
  75. package/highlevel/methods/chats/edit-chat-member-rank.d.ts +13 -0
  76. package/highlevel/methods/chats/edit-chat-member-rank.js +14 -0
  77. package/highlevel/methods/chats/get-chat-event-log.d.cts +1 -1
  78. package/highlevel/methods/chats/get-chat-event-log.d.ts +1 -1
  79. package/highlevel/methods/chats/get-chat-member.cjs +2 -2
  80. package/highlevel/methods/chats/get-chat-member.js +2 -2
  81. package/highlevel/methods/chats/get-creator-after-leave.cjs +20 -4
  82. package/highlevel/methods/chats/get-creator-after-leave.d.cts +2 -2
  83. package/highlevel/methods/chats/get-creator-after-leave.d.ts +2 -2
  84. package/highlevel/methods/chats/get-creator-after-leave.js +21 -5
  85. package/highlevel/methods/chats/restrict-chat-member.d.cts +1 -1
  86. package/highlevel/methods/chats/restrict-chat-member.d.ts +1 -1
  87. package/highlevel/methods/chats/save-draft.d.cts +1 -1
  88. package/highlevel/methods/chats/save-draft.d.ts +1 -1
  89. package/highlevel/methods/chats/set-chat-color.d.cts +1 -1
  90. package/highlevel/methods/chats/set-chat-color.d.ts +1 -1
  91. package/highlevel/methods/chats/set-chat-default-permissions.d.cts +1 -1
  92. package/highlevel/methods/chats/set-chat-default-permissions.d.ts +1 -1
  93. package/highlevel/methods/chats/set-chat-photo.cjs +3 -3
  94. package/highlevel/methods/chats/set-chat-photo.js +3 -3
  95. package/highlevel/methods/chats/toggle-content-protection.cjs +3 -2
  96. package/highlevel/methods/chats/toggle-content-protection.d.cts +4 -1
  97. package/highlevel/methods/chats/toggle-content-protection.d.ts +4 -1
  98. package/highlevel/methods/chats/toggle-content-protection.js +3 -2
  99. package/highlevel/methods/chats/transfer-chat-ownership.cjs +36 -0
  100. package/highlevel/methods/chats/transfer-chat-ownership.d.cts +16 -0
  101. package/highlevel/methods/chats/transfer-chat-ownership.d.ts +16 -0
  102. package/highlevel/methods/chats/transfer-chat-ownership.js +31 -0
  103. package/highlevel/methods/contacts/import-contacts.d.cts +1 -1
  104. package/highlevel/methods/contacts/import-contacts.d.ts +1 -1
  105. package/highlevel/methods/contacts/set-contact-note.cjs +0 -2
  106. package/highlevel/methods/contacts/set-contact-note.js +0 -2
  107. package/highlevel/methods/dialogs/create-folder.d.cts +1 -1
  108. package/highlevel/methods/dialogs/create-folder.d.ts +1 -1
  109. package/highlevel/methods/dialogs/delete-folder.d.cts +1 -1
  110. package/highlevel/methods/dialogs/delete-folder.d.ts +1 -1
  111. package/highlevel/methods/dialogs/edit-folder.d.cts +1 -1
  112. package/highlevel/methods/dialogs/edit-folder.d.ts +1 -1
  113. package/highlevel/methods/dialogs/find-folder.cjs +1 -1
  114. package/highlevel/methods/dialogs/find-folder.d.cts +1 -1
  115. package/highlevel/methods/dialogs/find-folder.d.ts +1 -1
  116. package/highlevel/methods/dialogs/find-folder.js +1 -1
  117. package/highlevel/methods/dialogs/get-folders.d.cts +1 -1
  118. package/highlevel/methods/dialogs/get-folders.d.ts +1 -1
  119. package/highlevel/methods/dialogs/iter-dialogs.d.cts +1 -1
  120. package/highlevel/methods/dialogs/iter-dialogs.d.ts +1 -1
  121. package/highlevel/methods/dialogs/join-chatlist.d.cts +1 -1
  122. package/highlevel/methods/dialogs/join-chatlist.d.ts +1 -1
  123. package/highlevel/methods/files/download-chunk.cjs +2 -2
  124. package/highlevel/methods/files/download-chunk.js +2 -2
  125. package/highlevel/methods/files/download-iterable.cjs +3 -3
  126. package/highlevel/methods/files/download-iterable.d.cts +1 -1
  127. package/highlevel/methods/files/download-iterable.d.ts +1 -1
  128. package/highlevel/methods/files/download-iterable.js +3 -3
  129. package/highlevel/methods/files/normalize-file-to-document.cjs +2 -2
  130. package/highlevel/methods/files/normalize-file-to-document.d.cts +1 -1
  131. package/highlevel/methods/files/normalize-file-to-document.d.ts +1 -1
  132. package/highlevel/methods/files/normalize-file-to-document.js +2 -2
  133. package/highlevel/methods/files/normalize-input-file.cjs +3 -3
  134. package/highlevel/methods/files/normalize-input-file.d.cts +1 -1
  135. package/highlevel/methods/files/normalize-input-file.d.ts +1 -1
  136. package/highlevel/methods/files/normalize-input-file.js +3 -3
  137. package/highlevel/methods/files/normalize-input-media.cjs +5 -5
  138. package/highlevel/methods/files/normalize-input-media.d.cts +1 -1
  139. package/highlevel/methods/files/normalize-input-media.d.ts +1 -1
  140. package/highlevel/methods/files/normalize-input-media.js +5 -5
  141. package/highlevel/methods/files/upload-file.cjs +2 -2
  142. package/highlevel/methods/files/upload-file.js +2 -2
  143. package/highlevel/methods/forums/create-forum-topic.d.cts +1 -1
  144. package/highlevel/methods/forums/create-forum-topic.d.ts +1 -1
  145. package/highlevel/methods/forums/edit-forum-topic.d.cts +1 -1
  146. package/highlevel/methods/forums/edit-forum-topic.d.ts +1 -1
  147. package/highlevel/methods/gifts/_normalize-input-star-gift.d.cts +1 -1
  148. package/highlevel/methods/gifts/_normalize-input-star-gift.d.ts +1 -1
  149. package/highlevel/methods/gifts/get-resale-star-gifts.d.cts +1 -1
  150. package/highlevel/methods/gifts/get-resale-star-gifts.d.ts +1 -1
  151. package/highlevel/methods/gifts/get-star-gift-upgrade-options.d.cts +1 -1
  152. package/highlevel/methods/gifts/get-star-gift-upgrade-options.d.ts +1 -1
  153. package/highlevel/methods/gifts/send-star-gift-offer.d.cts +1 -1
  154. package/highlevel/methods/gifts/send-star-gift-offer.d.ts +1 -1
  155. package/highlevel/methods/gifts/transfer-star-gift.cjs +2 -2
  156. package/highlevel/methods/gifts/transfer-star-gift.js +2 -2
  157. package/highlevel/methods/gifts/upgrade-star-gift.cjs +2 -2
  158. package/highlevel/methods/gifts/upgrade-star-gift.js +2 -2
  159. package/highlevel/methods/invite-links/create-invite-link.d.cts +1 -1
  160. package/highlevel/methods/invite-links/create-invite-link.d.ts +1 -1
  161. package/highlevel/methods/invite-links/get-invite-link-members.d.cts +1 -1
  162. package/highlevel/methods/invite-links/get-invite-link-members.d.ts +1 -1
  163. package/highlevel/methods/messages/edit-inline-message.cjs +2 -2
  164. package/highlevel/methods/messages/edit-inline-message.d.cts +1 -1
  165. package/highlevel/methods/messages/edit-inline-message.d.ts +1 -1
  166. package/highlevel/methods/messages/edit-inline-message.js +2 -2
  167. package/highlevel/methods/messages/edit-message.cjs +3 -2
  168. package/highlevel/methods/messages/edit-message.js +3 -2
  169. package/highlevel/methods/messages/find-in-update.d.cts +1 -1
  170. package/highlevel/methods/messages/find-in-update.d.ts +1 -1
  171. package/highlevel/methods/messages/forward-messages.cjs +1 -1
  172. package/highlevel/methods/messages/forward-messages.d.cts +1 -1
  173. package/highlevel/methods/messages/forward-messages.d.ts +1 -1
  174. package/highlevel/methods/messages/forward-messages.js +1 -1
  175. package/highlevel/methods/messages/get-callback-query-message.d.cts +1 -1
  176. package/highlevel/methods/messages/get-callback-query-message.d.ts +1 -1
  177. package/highlevel/methods/messages/get-discussion-message.d.cts +1 -1
  178. package/highlevel/methods/messages/get-discussion-message.d.ts +1 -1
  179. package/highlevel/methods/messages/search-global.d.cts +1 -1
  180. package/highlevel/methods/messages/search-global.d.ts +1 -1
  181. package/highlevel/methods/messages/search-hashtag.d.cts +1 -1
  182. package/highlevel/methods/messages/search-hashtag.d.ts +1 -1
  183. package/highlevel/methods/messages/search-messages.d.cts +1 -1
  184. package/highlevel/methods/messages/search-messages.d.ts +1 -1
  185. package/highlevel/methods/messages/search-posts-global.d.cts +1 -1
  186. package/highlevel/methods/messages/search-posts-global.d.ts +1 -1
  187. package/highlevel/methods/messages/send-common.cjs +1 -1
  188. package/highlevel/methods/messages/send-common.d.cts +1 -1
  189. package/highlevel/methods/messages/send-common.d.ts +1 -1
  190. package/highlevel/methods/messages/send-common.js +1 -1
  191. package/highlevel/methods/messages/send-media-group.cjs +6 -5
  192. package/highlevel/methods/messages/send-media-group.js +6 -5
  193. package/highlevel/methods/messages/send-media.cjs +6 -5
  194. package/highlevel/methods/messages/send-media.js +6 -5
  195. package/highlevel/methods/messages/send-paid-reaction.cjs +2 -2
  196. package/highlevel/methods/messages/send-paid-reaction.js +2 -2
  197. package/highlevel/methods/messages/send-text.cjs +6 -5
  198. package/highlevel/methods/messages/send-text.js +6 -5
  199. package/highlevel/methods/messages/send-typing.cjs +3 -2
  200. package/highlevel/methods/messages/send-typing.d.cts +1 -1
  201. package/highlevel/methods/messages/send-typing.d.ts +1 -1
  202. package/highlevel/methods/messages/send-typing.js +3 -2
  203. package/highlevel/methods/messages/set-typing.cjs +12 -8
  204. package/highlevel/methods/messages/set-typing.d.cts +1 -1
  205. package/highlevel/methods/messages/set-typing.d.ts +1 -1
  206. package/highlevel/methods/messages/set-typing.js +12 -8
  207. package/highlevel/methods/messages/set-typing.test.d.cts +1 -0
  208. package/highlevel/methods/messages/set-typing.test.d.ts +1 -0
  209. package/highlevel/methods/misc/chain-id.d.cts +1 -1
  210. package/highlevel/methods/misc/chain-id.d.ts +1 -1
  211. package/highlevel/methods/misc/init-takeout-session.d.cts +1 -1
  212. package/highlevel/methods/misc/init-takeout-session.d.ts +1 -1
  213. package/highlevel/methods/misc/normalize-privacy-rules.d.cts +1 -1
  214. package/highlevel/methods/misc/normalize-privacy-rules.d.ts +1 -1
  215. package/highlevel/methods/misc/normalize-text.d.cts +1 -1
  216. package/highlevel/methods/misc/normalize-text.d.ts +1 -1
  217. package/highlevel/methods/premium/_normalize-stars-amount.d.cts +1 -1
  218. package/highlevel/methods/premium/_normalize-stars-amount.d.ts +1 -1
  219. package/highlevel/methods/premium/set-business-intro.d.cts +1 -1
  220. package/highlevel/methods/premium/set-business-intro.d.ts +1 -1
  221. package/highlevel/methods/premium/set-business-work-hours.d.cts +1 -1
  222. package/highlevel/methods/premium/set-business-work-hours.d.ts +1 -1
  223. package/highlevel/methods/stickers/_utils.d.cts +1 -1
  224. package/highlevel/methods/stickers/_utils.d.ts +1 -1
  225. package/highlevel/methods/stickers/get-custom-emojis.cjs +4 -5
  226. package/highlevel/methods/stickers/get-custom-emojis.d.cts +3 -3
  227. package/highlevel/methods/stickers/get-custom-emojis.d.ts +3 -3
  228. package/highlevel/methods/stickers/get-custom-emojis.js +4 -5
  229. package/highlevel/methods/stickers/set-sticker-set-thumb.d.cts +1 -1
  230. package/highlevel/methods/stickers/set-sticker-set-thumb.d.ts +1 -1
  231. package/highlevel/methods/stories/can-send-story.cjs +3 -3
  232. package/highlevel/methods/stories/can-send-story.js +3 -3
  233. package/highlevel/methods/stories/edit-story.d.cts +1 -1
  234. package/highlevel/methods/stories/edit-story.d.ts +1 -1
  235. package/highlevel/methods/stories/find-in-update.d.cts +1 -1
  236. package/highlevel/methods/stories/find-in-update.d.ts +1 -1
  237. package/highlevel/methods/stories/get-profile-stories.cjs +3 -3
  238. package/highlevel/methods/stories/get-profile-stories.js +3 -3
  239. package/highlevel/methods/stories/get-stories-by-id.cjs +3 -3
  240. package/highlevel/methods/stories/get-stories-by-id.js +3 -3
  241. package/highlevel/methods/stories/send-story.d.cts +1 -1
  242. package/highlevel/methods/stories/send-story.d.ts +1 -1
  243. package/highlevel/methods/users/_resolve-common.cjs +74 -0
  244. package/highlevel/methods/users/_resolve-common.d.cts +4 -0
  245. package/highlevel/methods/users/_resolve-common.d.ts +4 -0
  246. package/highlevel/methods/users/_resolve-common.js +69 -0
  247. package/highlevel/methods/users/delete-profile-photos.d.cts +1 -1
  248. package/highlevel/methods/users/delete-profile-photos.d.ts +1 -1
  249. package/highlevel/methods/users/get-profile-photo.cjs +1 -2
  250. package/highlevel/methods/users/get-profile-photo.d.cts +2 -2
  251. package/highlevel/methods/users/get-profile-photo.d.ts +2 -2
  252. package/highlevel/methods/users/get-profile-photo.js +1 -2
  253. package/highlevel/methods/users/get-profile-photos.cjs +3 -3
  254. package/highlevel/methods/users/get-profile-photos.js +3 -3
  255. package/highlevel/methods/users/get-saved-music.cjs +1 -0
  256. package/highlevel/methods/users/get-saved-music.js +1 -0
  257. package/highlevel/methods/users/is-peer-available.cjs +2 -2
  258. package/highlevel/methods/users/is-peer-available.js +1 -1
  259. package/highlevel/methods/users/resolve-peer-many.d.cts +1 -1
  260. package/highlevel/methods/users/resolve-peer-many.d.ts +1 -1
  261. package/highlevel/methods/users/resolve-peer.cjs +11 -72
  262. package/highlevel/methods/users/resolve-peer.d.cts +1 -3
  263. package/highlevel/methods/users/resolve-peer.d.ts +1 -3
  264. package/highlevel/methods/users/resolve-peer.js +12 -73
  265. package/highlevel/methods/users/resolve-phone-number.cjs +4 -4
  266. package/highlevel/methods/users/resolve-phone-number.d.cts +1 -1
  267. package/highlevel/methods/users/resolve-phone-number.d.ts +1 -1
  268. package/highlevel/methods/users/resolve-phone-number.js +3 -3
  269. package/highlevel/methods/users/save-music-to-profile.cjs +2 -2
  270. package/highlevel/methods/users/save-music-to-profile.js +2 -2
  271. package/highlevel/methods/users/set-emoji-status.d.cts +1 -1
  272. package/highlevel/methods/users/set-emoji-status.d.ts +1 -1
  273. package/highlevel/methods/users/set-my-profile-photo.cjs +5 -2
  274. package/highlevel/methods/users/set-my-profile-photo.d.cts +1 -1
  275. package/highlevel/methods/users/set-my-profile-photo.d.ts +1 -1
  276. package/highlevel/methods/users/set-my-profile-photo.js +5 -2
  277. package/highlevel/methods/users/set-online.cjs +9 -5
  278. package/highlevel/methods/users/set-online.js +9 -5
  279. package/highlevel/methods.d.cts +2 -1
  280. package/highlevel/methods.d.ts +2 -1
  281. package/highlevel/storage/service/current-user.cjs +1 -1
  282. package/highlevel/storage/service/current-user.d.cts +1 -1
  283. package/highlevel/storage/service/current-user.d.ts +1 -1
  284. package/highlevel/storage/service/current-user.js +1 -1
  285. package/highlevel/storage/service/peers.d.cts +1 -1
  286. package/highlevel/storage/service/peers.d.ts +1 -1
  287. package/highlevel/types/auth/sent-code.d.cts +1 -1
  288. package/highlevel/types/auth/sent-code.d.ts +1 -1
  289. package/highlevel/types/bots/command-scope/inner.d.cts +1 -1
  290. package/highlevel/types/bots/command-scope/inner.d.ts +1 -1
  291. package/highlevel/types/bots/game-high-score.d.cts +1 -1
  292. package/highlevel/types/bots/game-high-score.d.ts +1 -1
  293. package/highlevel/types/bots/inline-message/factories.d.cts +1 -1
  294. package/highlevel/types/bots/inline-message/factories.d.ts +1 -1
  295. package/highlevel/types/bots/inline-result/factories.d.cts +1 -1
  296. package/highlevel/types/bots/inline-result/factories.d.ts +1 -1
  297. package/highlevel/types/bots/inline-result/types.d.cts +1 -1
  298. package/highlevel/types/bots/inline-result/types.d.ts +1 -1
  299. package/highlevel/types/bots/keyboards/builder.d.cts +1 -1
  300. package/highlevel/types/bots/keyboards/builder.d.ts +1 -1
  301. package/highlevel/types/bots/keyboards/factories.cjs +2 -2
  302. package/highlevel/types/bots/keyboards/factories.d.cts +1 -1
  303. package/highlevel/types/bots/keyboards/factories.d.ts +1 -1
  304. package/highlevel/types/bots/keyboards/factories.js +2 -2
  305. package/highlevel/types/bots/keyboards/types.d.cts +1 -1
  306. package/highlevel/types/bots/keyboards/types.d.ts +1 -1
  307. package/highlevel/types/bots/webview.d.cts +1 -1
  308. package/highlevel/types/bots/webview.d.ts +1 -1
  309. package/highlevel/types/conversation.d.cts +1 -1
  310. package/highlevel/types/conversation.d.ts +1 -1
  311. package/highlevel/types/files/file-location.d.cts +1 -1
  312. package/highlevel/types/files/file-location.d.ts +1 -1
  313. package/highlevel/types/files/uploaded-file.d.cts +1 -1
  314. package/highlevel/types/files/uploaded-file.d.ts +1 -1
  315. package/highlevel/types/files/utils.d.cts +1 -1
  316. package/highlevel/types/files/utils.d.ts +1 -1
  317. package/highlevel/types/files/web-document.d.cts +1 -1
  318. package/highlevel/types/files/web-document.d.ts +1 -1
  319. package/highlevel/types/media/audio.d.cts +1 -1
  320. package/highlevel/types/media/audio.d.ts +1 -1
  321. package/highlevel/types/media/contact.d.cts +1 -1
  322. package/highlevel/types/media/contact.d.ts +1 -1
  323. package/highlevel/types/media/dice.d.cts +1 -1
  324. package/highlevel/types/media/dice.d.ts +1 -1
  325. package/highlevel/types/media/document-utils.d.cts +1 -1
  326. package/highlevel/types/media/document-utils.d.ts +1 -1
  327. package/highlevel/types/media/document.d.cts +1 -1
  328. package/highlevel/types/media/document.d.ts +1 -1
  329. package/highlevel/types/media/extended-media.d.cts +1 -1
  330. package/highlevel/types/media/extended-media.d.ts +1 -1
  331. package/highlevel/types/media/game.d.cts +1 -1
  332. package/highlevel/types/media/game.d.ts +1 -1
  333. package/highlevel/types/media/input-media/factories.d.cts +1 -1
  334. package/highlevel/types/media/input-media/factories.d.ts +1 -1
  335. package/highlevel/types/media/input-media/types.d.cts +1 -1
  336. package/highlevel/types/media/input-media/types.d.ts +1 -1
  337. package/highlevel/types/media/invoice.d.cts +1 -1
  338. package/highlevel/types/media/invoice.d.ts +1 -1
  339. package/highlevel/types/media/location.d.cts +1 -1
  340. package/highlevel/types/media/location.d.ts +1 -1
  341. package/highlevel/types/media/paid-media.d.cts +1 -1
  342. package/highlevel/types/media/paid-media.d.ts +1 -1
  343. package/highlevel/types/media/photo.d.cts +1 -1
  344. package/highlevel/types/media/photo.d.ts +1 -1
  345. package/highlevel/types/media/poll.d.cts +1 -1
  346. package/highlevel/types/media/poll.d.ts +1 -1
  347. package/highlevel/types/media/sticker.d.cts +1 -1
  348. package/highlevel/types/media/sticker.d.ts +1 -1
  349. package/highlevel/types/media/story.d.cts +1 -1
  350. package/highlevel/types/media/story.d.ts +1 -1
  351. package/highlevel/types/media/thumbnail.d.cts +1 -1
  352. package/highlevel/types/media/thumbnail.d.ts +1 -1
  353. package/highlevel/types/media/todo.d.cts +1 -1
  354. package/highlevel/types/media/todo.d.ts +1 -1
  355. package/highlevel/types/media/venue.cjs +2 -2
  356. package/highlevel/types/media/venue.d.cts +1 -1
  357. package/highlevel/types/media/venue.d.ts +1 -1
  358. package/highlevel/types/media/venue.js +2 -2
  359. package/highlevel/types/media/video.d.cts +1 -1
  360. package/highlevel/types/media/video.d.ts +1 -1
  361. package/highlevel/types/media/voice.d.cts +1 -1
  362. package/highlevel/types/media/voice.d.ts +1 -1
  363. package/highlevel/types/media/web-page.d.cts +1 -1
  364. package/highlevel/types/media/web-page.d.ts +1 -1
  365. package/highlevel/types/messages/dialog.d.cts +1 -1
  366. package/highlevel/types/messages/dialog.d.ts +1 -1
  367. package/highlevel/types/messages/draft-message.d.cts +1 -1
  368. package/highlevel/types/messages/draft-message.d.ts +1 -1
  369. package/highlevel/types/messages/fact-check.d.cts +1 -1
  370. package/highlevel/types/messages/fact-check.d.ts +1 -1
  371. package/highlevel/types/messages/message-action.cjs +17 -0
  372. package/highlevel/types/messages/message-action.d.cts +20 -2
  373. package/highlevel/types/messages/message-action.d.ts +20 -2
  374. package/highlevel/types/messages/message-action.js +17 -0
  375. package/highlevel/types/messages/message-effect.cjs +2 -6
  376. package/highlevel/types/messages/message-effect.d.cts +1 -1
  377. package/highlevel/types/messages/message-effect.d.ts +1 -1
  378. package/highlevel/types/messages/message-effect.js +2 -6
  379. package/highlevel/types/messages/message-entity.d.cts +1 -1
  380. package/highlevel/types/messages/message-entity.d.ts +1 -1
  381. package/highlevel/types/messages/message-forward.d.cts +1 -1
  382. package/highlevel/types/messages/message-forward.d.ts +1 -1
  383. package/highlevel/types/messages/message-media.d.cts +1 -1
  384. package/highlevel/types/messages/message-media.d.ts +1 -1
  385. package/highlevel/types/messages/message-reactions.d.cts +1 -1
  386. package/highlevel/types/messages/message-reactions.d.ts +1 -1
  387. package/highlevel/types/messages/message-replies.d.cts +1 -1
  388. package/highlevel/types/messages/message-replies.d.ts +1 -1
  389. package/highlevel/types/messages/message.cjs +4 -0
  390. package/highlevel/types/messages/message.d.cts +3 -1
  391. package/highlevel/types/messages/message.d.ts +3 -1
  392. package/highlevel/types/messages/message.js +4 -0
  393. package/highlevel/types/messages/replied-message.cjs +4 -14
  394. package/highlevel/types/messages/replied-message.d.cts +2 -2
  395. package/highlevel/types/messages/replied-message.d.ts +2 -2
  396. package/highlevel/types/messages/replied-message.js +2 -12
  397. package/highlevel/types/messages/suggested-post.d.cts +1 -1
  398. package/highlevel/types/messages/suggested-post.d.ts +1 -1
  399. package/highlevel/types/misc/collectible-info.d.cts +1 -1
  400. package/highlevel/types/misc/collectible-info.d.ts +1 -1
  401. package/highlevel/types/misc/entities.d.cts +1 -1
  402. package/highlevel/types/misc/entities.d.ts +1 -1
  403. package/highlevel/types/misc/input-privacy-rule/allow.d.cts +1 -1
  404. package/highlevel/types/misc/input-privacy-rule/allow.d.ts +1 -1
  405. package/highlevel/types/misc/input-privacy-rule/disallow.d.cts +1 -1
  406. package/highlevel/types/misc/input-privacy-rule/disallow.d.ts +1 -1
  407. package/highlevel/types/misc/input-privacy-rule/types.d.cts +1 -1
  408. package/highlevel/types/misc/input-privacy-rule/types.d.ts +1 -1
  409. package/highlevel/types/misc/sticker-set.cjs +5 -3
  410. package/highlevel/types/misc/sticker-set.d.cts +1 -1
  411. package/highlevel/types/misc/sticker-set.d.ts +1 -1
  412. package/highlevel/types/misc/sticker-set.js +5 -3
  413. package/highlevel/types/misc/takeout-session.d.cts +1 -1
  414. package/highlevel/types/misc/takeout-session.d.ts +1 -1
  415. package/highlevel/types/peers/bot-info.d.cts +1 -1
  416. package/highlevel/types/peers/bot-info.d.ts +1 -1
  417. package/highlevel/types/peers/bot-verification.d.cts +1 -1
  418. package/highlevel/types/peers/bot-verification.d.ts +1 -1
  419. package/highlevel/types/peers/chat-colors.d.cts +1 -1
  420. package/highlevel/types/peers/chat-colors.d.ts +1 -1
  421. package/highlevel/types/peers/chat-event/actions.cjs +11 -5
  422. package/highlevel/types/peers/chat-event/actions.d.cts +16 -7
  423. package/highlevel/types/peers/chat-event/actions.d.ts +16 -7
  424. package/highlevel/types/peers/chat-event/actions.js +11 -5
  425. package/highlevel/types/peers/chat-event/filters.cjs +1 -0
  426. package/highlevel/types/peers/chat-event/filters.d.cts +1 -1
  427. package/highlevel/types/peers/chat-event/filters.d.ts +1 -1
  428. package/highlevel/types/peers/chat-event/filters.js +1 -0
  429. package/highlevel/types/peers/chat-event/index.d.cts +1 -1
  430. package/highlevel/types/peers/chat-event/index.d.ts +1 -1
  431. package/highlevel/types/peers/chat-invite-link-member.d.cts +1 -1
  432. package/highlevel/types/peers/chat-invite-link-member.d.ts +1 -1
  433. package/highlevel/types/peers/chat-invite-link.d.cts +1 -1
  434. package/highlevel/types/peers/chat-invite-link.d.ts +1 -1
  435. package/highlevel/types/peers/chat-member.cjs +5 -8
  436. package/highlevel/types/peers/chat-member.d.cts +3 -3
  437. package/highlevel/types/peers/chat-member.d.ts +3 -3
  438. package/highlevel/types/peers/chat-member.js +5 -8
  439. package/highlevel/types/peers/chat-permissions.d.cts +1 -1
  440. package/highlevel/types/peers/chat-permissions.d.ts +1 -1
  441. package/highlevel/types/peers/chat-photo.d.cts +1 -1
  442. package/highlevel/types/peers/chat-photo.d.ts +1 -1
  443. package/highlevel/types/peers/chat-preview.d.cts +1 -1
  444. package/highlevel/types/peers/chat-preview.d.ts +1 -1
  445. package/highlevel/types/peers/chat.d.cts +1 -1
  446. package/highlevel/types/peers/chat.d.ts +1 -1
  447. package/highlevel/types/peers/chatlist-preview.d.cts +1 -1
  448. package/highlevel/types/peers/chatlist-preview.d.ts +1 -1
  449. package/highlevel/types/peers/forum-topic.d.cts +1 -1
  450. package/highlevel/types/peers/forum-topic.d.ts +1 -1
  451. package/highlevel/types/peers/full-chat.cjs +0 -11
  452. package/highlevel/types/peers/full-chat.d.cts +1 -6
  453. package/highlevel/types/peers/full-chat.d.ts +1 -6
  454. package/highlevel/types/peers/full-chat.js +0 -11
  455. package/highlevel/types/peers/full-user.cjs +14 -0
  456. package/highlevel/types/peers/full-user.d.cts +11 -1
  457. package/highlevel/types/peers/full-user.d.ts +11 -1
  458. package/highlevel/types/peers/full-user.js +14 -0
  459. package/highlevel/types/peers/index.d.cts +0 -1
  460. package/highlevel/types/peers/index.d.ts +0 -1
  461. package/highlevel/types/peers/peer-settings.d.cts +1 -1
  462. package/highlevel/types/peers/peer-settings.d.ts +1 -1
  463. package/highlevel/types/peers/peer.d.cts +1 -1
  464. package/highlevel/types/peers/peer.d.ts +1 -1
  465. package/highlevel/types/peers/peers-index.cjs +3 -1
  466. package/highlevel/types/peers/peers-index.d.cts +1 -1
  467. package/highlevel/types/peers/peers-index.d.ts +1 -1
  468. package/highlevel/types/peers/peers-index.js +3 -1
  469. package/highlevel/types/peers/user.d.cts +1 -1
  470. package/highlevel/types/peers/user.d.ts +1 -1
  471. package/highlevel/types/premium/boost-slot.d.cts +1 -1
  472. package/highlevel/types/premium/boost-slot.d.ts +1 -1
  473. package/highlevel/types/premium/boost-stats.d.cts +1 -1
  474. package/highlevel/types/premium/boost-stats.d.ts +1 -1
  475. package/highlevel/types/premium/boost.d.cts +1 -1
  476. package/highlevel/types/premium/boost.d.ts +1 -1
  477. package/highlevel/types/premium/business-account.d.cts +1 -1
  478. package/highlevel/types/premium/business-account.d.ts +1 -1
  479. package/highlevel/types/premium/business-chat-link.d.cts +1 -1
  480. package/highlevel/types/premium/business-chat-link.d.ts +1 -1
  481. package/highlevel/types/premium/business-connection.d.cts +1 -1
  482. package/highlevel/types/premium/business-connection.d.ts +1 -1
  483. package/highlevel/types/premium/business-intro.d.cts +1 -1
  484. package/highlevel/types/premium/business-intro.d.ts +1 -1
  485. package/highlevel/types/premium/business-location.d.cts +1 -1
  486. package/highlevel/types/premium/business-location.d.ts +1 -1
  487. package/highlevel/types/premium/business-work-hours.d.cts +1 -1
  488. package/highlevel/types/premium/business-work-hours.d.ts +1 -1
  489. package/highlevel/types/premium/saved-star-gift.d.cts +1 -1
  490. package/highlevel/types/premium/saved-star-gift.d.ts +1 -1
  491. package/highlevel/types/premium/star-gift-unique.d.cts +1 -1
  492. package/highlevel/types/premium/star-gift-unique.d.ts +1 -1
  493. package/highlevel/types/premium/star-gift-value.d.cts +1 -1
  494. package/highlevel/types/premium/star-gift-value.d.ts +1 -1
  495. package/highlevel/types/premium/star-gift.cjs +0 -4
  496. package/highlevel/types/premium/star-gift.d.cts +1 -3
  497. package/highlevel/types/premium/star-gift.d.ts +1 -3
  498. package/highlevel/types/premium/star-gift.js +0 -4
  499. package/highlevel/types/premium/stars-status.d.cts +1 -1
  500. package/highlevel/types/premium/stars-status.d.ts +1 -1
  501. package/highlevel/types/premium/stars-transaction.d.cts +1 -1
  502. package/highlevel/types/premium/stars-transaction.d.ts +1 -1
  503. package/highlevel/types/reactions/emoji-status.d.cts +1 -1
  504. package/highlevel/types/reactions/emoji-status.d.ts +1 -1
  505. package/highlevel/types/reactions/peer-reaction.cjs +5 -8
  506. package/highlevel/types/reactions/peer-reaction.d.cts +4 -5
  507. package/highlevel/types/reactions/peer-reaction.d.ts +4 -5
  508. package/highlevel/types/reactions/peer-reaction.js +5 -8
  509. package/highlevel/types/reactions/reaction-count.d.cts +1 -1
  510. package/highlevel/types/reactions/reaction-count.d.ts +1 -1
  511. package/highlevel/types/reactions/types.d.cts +1 -1
  512. package/highlevel/types/reactions/types.d.ts +1 -1
  513. package/highlevel/types/stories/all-stories.d.cts +1 -1
  514. package/highlevel/types/stories/all-stories.d.ts +1 -1
  515. package/highlevel/types/stories/interactive/base.d.cts +1 -1
  516. package/highlevel/types/stories/interactive/base.d.ts +1 -1
  517. package/highlevel/types/stories/interactive/channel-post.d.cts +1 -1
  518. package/highlevel/types/stories/interactive/channel-post.d.ts +1 -1
  519. package/highlevel/types/stories/interactive/index.d.cts +1 -1
  520. package/highlevel/types/stories/interactive/index.d.ts +1 -1
  521. package/highlevel/types/stories/interactive/input.d.cts +1 -1
  522. package/highlevel/types/stories/interactive/input.d.ts +1 -1
  523. package/highlevel/types/stories/interactive/location.d.cts +1 -1
  524. package/highlevel/types/stories/interactive/location.d.ts +1 -1
  525. package/highlevel/types/stories/interactive/reaction.d.cts +1 -1
  526. package/highlevel/types/stories/interactive/reaction.d.ts +1 -1
  527. package/highlevel/types/stories/interactive/star-gift.d.cts +1 -1
  528. package/highlevel/types/stories/interactive/star-gift.d.ts +1 -1
  529. package/highlevel/types/stories/interactive/url.d.cts +1 -1
  530. package/highlevel/types/stories/interactive/url.d.ts +1 -1
  531. package/highlevel/types/stories/interactive/venue.d.cts +1 -1
  532. package/highlevel/types/stories/interactive/venue.d.ts +1 -1
  533. package/highlevel/types/stories/interactive/weather.d.cts +1 -1
  534. package/highlevel/types/stories/interactive/weather.d.ts +1 -1
  535. package/highlevel/types/stories/peer-stories.cjs +4 -4
  536. package/highlevel/types/stories/peer-stories.d.cts +1 -1
  537. package/highlevel/types/stories/peer-stories.d.ts +1 -1
  538. package/highlevel/types/stories/peer-stories.js +4 -4
  539. package/highlevel/types/stories/stealth-mode.d.cts +1 -1
  540. package/highlevel/types/stories/stealth-mode.d.ts +1 -1
  541. package/highlevel/types/stories/story-interactions.d.cts +1 -1
  542. package/highlevel/types/stories/story-interactions.d.ts +1 -1
  543. package/highlevel/types/stories/story-viewer.cjs +3 -4
  544. package/highlevel/types/stories/story-viewer.d.cts +3 -3
  545. package/highlevel/types/stories/story-viewer.d.ts +3 -3
  546. package/highlevel/types/stories/story-viewer.js +3 -4
  547. package/highlevel/types/stories/story.d.cts +1 -1
  548. package/highlevel/types/stories/story.d.ts +1 -1
  549. package/highlevel/types/updates/bot-chat-join-request.d.cts +1 -1
  550. package/highlevel/types/updates/bot-chat-join-request.d.ts +1 -1
  551. package/highlevel/types/updates/bot-reaction.d.cts +1 -1
  552. package/highlevel/types/updates/bot-reaction.d.ts +1 -1
  553. package/highlevel/types/updates/bot-stopped.d.cts +1 -1
  554. package/highlevel/types/updates/bot-stopped.d.ts +1 -1
  555. package/highlevel/types/updates/business-message.d.cts +1 -1
  556. package/highlevel/types/updates/business-message.d.ts +1 -1
  557. package/highlevel/types/updates/callback-query.d.cts +1 -1
  558. package/highlevel/types/updates/callback-query.d.ts +1 -1
  559. package/highlevel/types/updates/chat-join-request.d.cts +1 -1
  560. package/highlevel/types/updates/chat-join-request.d.ts +1 -1
  561. package/highlevel/types/updates/chat-member-update.cjs +2 -2
  562. package/highlevel/types/updates/chat-member-update.d.cts +1 -1
  563. package/highlevel/types/updates/chat-member-update.d.ts +1 -1
  564. package/highlevel/types/updates/chat-member-update.js +2 -2
  565. package/highlevel/types/updates/chosen-inline-result.d.cts +1 -1
  566. package/highlevel/types/updates/chosen-inline-result.d.ts +1 -1
  567. package/highlevel/types/updates/delete-business-message-update.d.cts +1 -1
  568. package/highlevel/types/updates/delete-business-message-update.d.ts +1 -1
  569. package/highlevel/types/updates/delete-message-update.d.cts +1 -1
  570. package/highlevel/types/updates/delete-message-update.d.ts +1 -1
  571. package/highlevel/types/updates/delete-story-update.d.cts +1 -1
  572. package/highlevel/types/updates/delete-story-update.d.ts +1 -1
  573. package/highlevel/types/updates/history-read-update.d.cts +1 -1
  574. package/highlevel/types/updates/history-read-update.d.ts +1 -1
  575. package/highlevel/types/updates/inline-query.d.cts +1 -1
  576. package/highlevel/types/updates/inline-query.d.ts +1 -1
  577. package/highlevel/types/updates/poll-update.d.cts +1 -1
  578. package/highlevel/types/updates/poll-update.d.ts +1 -1
  579. package/highlevel/types/updates/poll-vote.d.cts +1 -1
  580. package/highlevel/types/updates/poll-vote.d.ts +1 -1
  581. package/highlevel/types/updates/pre-checkout-query.d.cts +1 -1
  582. package/highlevel/types/updates/pre-checkout-query.d.ts +1 -1
  583. package/highlevel/types/updates/story-update.d.cts +1 -1
  584. package/highlevel/types/updates/story-update.d.ts +1 -1
  585. package/highlevel/types/updates/user-status-update.d.cts +1 -1
  586. package/highlevel/types/updates/user-status-update.d.ts +1 -1
  587. package/highlevel/types/updates/user-typing-update.d.cts +1 -1
  588. package/highlevel/types/updates/user-typing-update.d.ts +1 -1
  589. package/highlevel/updates/manager.cjs +8 -9
  590. package/highlevel/updates/manager.d.cts +4 -2
  591. package/highlevel/updates/manager.d.ts +4 -2
  592. package/highlevel/updates/manager.js +8 -9
  593. package/highlevel/updates/types.d.cts +1 -1
  594. package/highlevel/updates/types.d.ts +1 -1
  595. package/highlevel/updates/utils.d.cts +1 -1
  596. package/highlevel/updates/utils.d.ts +1 -1
  597. package/highlevel/utils/convert-file-id.d.cts +1 -1
  598. package/highlevel/utils/convert-file-id.d.ts +1 -1
  599. package/highlevel/utils/file-utils.cjs +2 -2
  600. package/highlevel/utils/file-utils.d.cts +2 -2
  601. package/highlevel/utils/file-utils.d.ts +2 -2
  602. package/highlevel/utils/file-utils.js +2 -2
  603. package/highlevel/utils/inline-utils.d.cts +1 -1
  604. package/highlevel/utils/inline-utils.d.ts +1 -1
  605. package/highlevel/utils/peer-utils.cjs +4 -4
  606. package/highlevel/utils/peer-utils.d.cts +1 -1
  607. package/highlevel/utils/peer-utils.d.ts +1 -1
  608. package/highlevel/utils/peer-utils.js +4 -4
  609. package/highlevel/worker/errors.cjs +3 -3
  610. package/highlevel/worker/errors.js +3 -3
  611. package/highlevel/worker/invoker.cjs +67 -9
  612. package/highlevel/worker/invoker.d.cts +9 -1
  613. package/highlevel/worker/invoker.d.ts +9 -1
  614. package/highlevel/worker/invoker.js +67 -9
  615. package/highlevel/worker/invoker.test.d.cts +1 -0
  616. package/highlevel/worker/invoker.test.d.ts +1 -0
  617. package/highlevel/worker/port.cjs +50 -16
  618. package/highlevel/worker/port.d.cts +9 -5
  619. package/highlevel/worker/port.d.ts +9 -5
  620. package/highlevel/worker/port.js +51 -17
  621. package/highlevel/worker/protocol.cjs +19 -7
  622. package/highlevel/worker/protocol.d.cts +28 -4
  623. package/highlevel/worker/protocol.d.ts +28 -4
  624. package/highlevel/worker/protocol.js +19 -7
  625. package/highlevel/worker/protocol.test.d.cts +1 -0
  626. package/highlevel/worker/protocol.test.d.ts +1 -0
  627. package/highlevel/worker/storage.cjs +4 -1
  628. package/highlevel/worker/storage.d.cts +2 -1
  629. package/highlevel/worker/storage.d.ts +2 -1
  630. package/highlevel/worker/storage.js +4 -1
  631. package/highlevel/worker/timers.cjs +19 -0
  632. package/highlevel/worker/timers.d.cts +11 -0
  633. package/highlevel/worker/timers.d.ts +11 -0
  634. package/highlevel/worker/timers.js +14 -0
  635. package/highlevel/worker/timers.test.d.cts +1 -0
  636. package/highlevel/worker/timers.test.d.ts +1 -0
  637. package/highlevel/worker/worker.cjs +266 -53
  638. package/highlevel/worker/worker.d.cts +30 -2
  639. package/highlevel/worker/worker.d.ts +30 -2
  640. package/highlevel/worker/worker.js +267 -54
  641. package/highlevel/worker/worker.test.d.cts +1 -0
  642. package/highlevel/worker/worker.test.d.ts +1 -0
  643. package/index.cjs +4 -11
  644. package/index.d.cts +2 -2
  645. package/index.d.ts +2 -2
  646. package/index.js +4 -5
  647. package/methods.cjs +4 -2
  648. package/methods.js +4 -2
  649. package/network/auth-key.d.cts +1 -1
  650. package/network/auth-key.d.ts +1 -1
  651. package/network/authorization.cjs +2 -2
  652. package/network/authorization.js +2 -2
  653. package/network/client.cjs +6 -7
  654. package/network/client.d.cts +1 -12
  655. package/network/client.d.ts +1 -12
  656. package/network/client.js +4 -5
  657. package/network/config-manager.d.cts +1 -1
  658. package/network/config-manager.d.ts +1 -1
  659. package/network/middlewares/internal-errors.cjs +8 -8
  660. package/network/middlewares/internal-errors.js +8 -8
  661. package/network/middlewares/on-error.d.cts +1 -1
  662. package/network/middlewares/on-error.d.ts +1 -1
  663. package/network/middlewares/on-method.d.cts +1 -1
  664. package/network/middlewares/on-method.d.ts +1 -1
  665. package/network/mtproto-session.cjs +0 -3
  666. package/network/mtproto-session.d.cts +1 -2
  667. package/network/mtproto-session.d.ts +1 -2
  668. package/network/mtproto-session.js +0 -3
  669. package/network/mtproxy/index.d.cts +1 -1
  670. package/network/mtproxy/index.d.ts +1 -1
  671. package/network/multi-session-connection.d.cts +1 -1
  672. package/network/multi-session-connection.d.ts +1 -1
  673. package/network/network-manager.cjs +40 -2
  674. package/network/network-manager.d.cts +12 -3
  675. package/network/network-manager.d.ts +12 -3
  676. package/network/network-manager.js +41 -3
  677. package/network/persistent-connection.d.cts +1 -1
  678. package/network/persistent-connection.d.ts +1 -1
  679. package/network/server-salt.cjs +4 -8
  680. package/network/server-salt.d.cts +1 -1
  681. package/network/server-salt.d.ts +1 -1
  682. package/network/server-salt.js +4 -8
  683. package/network/session-connection.cjs +10 -17
  684. package/network/session-connection.d.cts +1 -3
  685. package/network/session-connection.d.ts +1 -3
  686. package/network/session-connection.js +10 -17
  687. package/network/transports/abstract.d.cts +1 -1
  688. package/network/transports/abstract.d.ts +1 -1
  689. package/network/transports/intermediate.cjs +0 -2
  690. package/network/transports/intermediate.js +0 -2
  691. package/package.json +9 -6
  692. package/storage/service/base.d.cts +1 -1
  693. package/storage/service/base.d.ts +1 -1
  694. package/storage/service/future-salts.d.cts +1 -1
  695. package/storage/service/future-salts.d.ts +1 -1
  696. package/storage/sqlite/driver.cjs +0 -22
  697. package/storage/sqlite/driver.d.cts +0 -3
  698. package/storage/sqlite/driver.d.ts +0 -3
  699. package/storage/sqlite/driver.js +0 -22
  700. package/storage/sqlite/repository/kv.cjs +5 -47
  701. package/storage/sqlite/repository/kv.js +5 -47
  702. package/storage/sqlite/repository/peers.cjs +0 -3
  703. package/storage/sqlite/repository/peers.js +0 -3
  704. package/storage/storage.cjs +1 -3
  705. package/storage/storage.js +1 -3
  706. package/tl/api-schema.json +1 -0
  707. package/tl/app-config.json +1 -0
  708. package/tl/binary/reader.cjs +5248 -0
  709. package/tl/binary/reader.d.cts +3 -0
  710. package/tl/binary/reader.d.ts +3 -0
  711. package/tl/binary/reader.js +5243 -0
  712. package/tl/binary/rsa-keys.cjs +9 -0
  713. package/tl/binary/rsa-keys.d.cts +38 -0
  714. package/tl/binary/rsa-keys.d.ts +38 -0
  715. package/tl/binary/rsa-keys.js +4 -0
  716. package/tl/binary/writer.cjs +18718 -0
  717. package/tl/binary/writer.d.cts +4 -0
  718. package/tl/binary/writer.d.ts +4 -0
  719. package/tl/binary/writer.js +18713 -0
  720. package/tl/compat/reader.cjs +313 -0
  721. package/tl/compat/reader.d.cts +1 -0
  722. package/tl/compat/reader.d.ts +1 -0
  723. package/tl/compat/reader.js +308 -0
  724. package/tl/index.d.cts +58614 -0
  725. package/tl/index.d.ts +58614 -0
  726. package/tl/inner-mtp.cjs +63 -0
  727. package/tl/inner-mtp.js +58 -0
  728. package/tl/inner-tl.cjs +1261 -0
  729. package/tl/inner-tl.js +1256 -0
  730. package/tl/mtp-schema.json +1 -0
  731. package/tl/raw-errors.json +1 -0
  732. package/utils/binary/compat.cjs +18 -10
  733. package/utils/binary/compat.d.cts +1 -1
  734. package/utils/binary/compat.d.ts +1 -1
  735. package/utils/binary/compat.js +13 -5
  736. package/utils/binary/serialization.cjs +7 -7
  737. package/utils/binary/serialization.d.cts +1 -1
  738. package/utils/binary/serialization.d.ts +1 -1
  739. package/utils/binary/serialization.js +5 -5
  740. package/utils/crypto/keys.cjs +5 -5
  741. package/utils/crypto/keys.d.cts +1 -1
  742. package/utils/crypto/keys.d.ts +1 -1
  743. package/utils/crypto/keys.js +1 -1
  744. package/utils/crypto/password.d.cts +1 -1
  745. package/utils/crypto/password.d.ts +1 -1
  746. package/utils/date-entity-format.cjs +48 -0
  747. package/utils/date-entity-format.d.cts +24 -0
  748. package/utils/date-entity-format.d.ts +24 -0
  749. package/utils/date-entity-format.js +43 -0
  750. package/utils/date-entity-format.test.d.cts +1 -0
  751. package/utils/date-entity-format.test.d.ts +1 -0
  752. package/utils/index.d.cts +3 -6
  753. package/utils/index.d.ts +3 -6
  754. package/utils/links/bots.cjs +3 -0
  755. package/utils/links/bots.d.cts +1 -1
  756. package/utils/links/bots.d.ts +1 -1
  757. package/utils/links/bots.js +3 -0
  758. package/utils/logger.cjs +2 -2
  759. package/utils/logger.js +2 -2
  760. package/utils/peer-utils.d.cts +1 -1
  761. package/utils/peer-utils.d.ts +1 -1
  762. package/utils/tl-json.d.cts +1 -1
  763. package/utils/tl-json.d.ts +1 -1
  764. package/utils/type-assertions.d.cts +1 -1
  765. package/utils/type-assertions.d.ts +1 -1
  766. package/utils.cjs +7 -18
  767. package/utils.js +5 -10
  768. package/highlevel/methods/chats/get-nearby-chats.cjs +0 -37
  769. package/highlevel/methods/chats/get-nearby-chats.d.cts +0 -9
  770. package/highlevel/methods/chats/get-nearby-chats.d.ts +0 -9
  771. package/highlevel/methods/chats/get-nearby-chats.js +0 -32
  772. package/highlevel/methods/messages/_business-connection.cjs +0 -42
  773. package/highlevel/methods/messages/_business-connection.d.cts +0 -8
  774. package/highlevel/methods/messages/_business-connection.d.ts +0 -8
  775. package/highlevel/methods/messages/_business-connection.js +0 -37
  776. package/highlevel/types/peers/chat-location.cjs +0 -30
  777. package/highlevel/types/peers/chat-location.d.cts +0 -17
  778. package/highlevel/types/peers/chat-location.d.ts +0 -17
  779. package/highlevel/types/peers/chat-location.js +0 -25
  780. package/utils/error-reporting.cjs +0 -23
  781. package/utils/error-reporting.d.cts +0 -3
  782. package/utils/error-reporting.d.ts +0 -3
  783. package/utils/error-reporting.js +0 -18
@@ -1,6 +1,6 @@
1
- import { tl } from '@mtcute/tl';
2
1
  import { default as Long } from 'long';
3
2
  import { RpcCallOptions } from '../network/index.js';
3
+ import { tl } from '../tl/index.js';
4
4
  import { MaybeArray, MaybePromise, PartialExcept, PartialOnly } from '../types/index.js';
5
5
  import { BaseTelegramClientOptions } from './base.js';
6
6
  import { ITelegramClient } from './client.types.js';
@@ -1110,6 +1110,17 @@ export interface TelegramClient extends ITelegramClient {
1110
1110
  /** Custom admin rank */
1111
1111
  rank?: string;
1112
1112
  }): Promise<void>;
1113
+ /**
1114
+ * Edit the custom rank (title) of a group chat participant.
1115
+ */
1116
+ editChatMemberRank(params: {
1117
+ /** Chat ID */
1118
+ chatId: InputPeerLike;
1119
+ /** ID of the user to edit the rank of */
1120
+ participantId: InputPeerLike;
1121
+ /** New rank, or `null` to remove it */
1122
+ rank: string | null;
1123
+ }): Promise<void>;
1113
1124
  /**
1114
1125
  * Get chat event log ("Recent actions" in official clients).
1115
1126
  *
@@ -1268,9 +1279,9 @@ export interface TelegramClient extends ITelegramClient {
1268
1279
  */
1269
1280
  getChats(chatIds: InputPeerLike[]): Promise<(Chat | null)[]>;
1270
1281
  /**
1271
- * Get the user who will be made the creator of the channel/supergroup if you were to leave it.
1282
+ * Get the user who will be made the creator of the chat/channel/supergroup if you were to leave it.
1272
1283
  *
1273
- * You must be the creator of the channel/supergroup to use this method.
1284
+ * You must be the creator of the chat/channel/supergroup to use this method.
1274
1285
  */
1275
1286
  getCreatorAfterLeave(chatId: InputPeerLike): Promise<User | null>;
1276
1287
  /**
@@ -1293,15 +1304,6 @@ export interface TelegramClient extends ITelegramClient {
1293
1304
  */
1294
1305
  getFullUser(userId: InputPeerLike): Promise<FullUser>;
1295
1306
  getMessageAuthor(message: InputMessageId): Promise<User>;
1296
- /**
1297
- * Get nearby chats
1298
- *
1299
- * **Available**: 👤 users only
1300
- *
1301
- * @param latitude Latitude of the location
1302
- * @param longitude Longitude of the location
1303
- */
1304
- getNearbyChats(latitude: number, longitude: number): Promise<Chat[]>;
1305
1307
  /** Shorthand for {@link getChat} and {@link getUser} depending on the type of the peer */
1306
1308
  getPeer(peer: InputPeerLike): Promise<Peer>;
1307
1309
  /**
@@ -1633,7 +1635,10 @@ export interface TelegramClient extends ITelegramClient {
1633
1635
  * @param chatId Chat ID or username
1634
1636
  * @param [enabled=false] Whether content protection should be enabled
1635
1637
  */
1636
- toggleContentProtection(chatId: InputPeerLike, enabled?: boolean): Promise<void>;
1638
+ toggleContentProtection(chatId: InputPeerLike, enabled?: boolean, params?: {
1639
+ /** If this method was called in response to the other party enabling content protection, ID of that message */
1640
+ requestMsgId?: number;
1641
+ }): Promise<void>;
1637
1642
  /**
1638
1643
  * Toggle a collectible (Fragment) username
1639
1644
  *
@@ -1678,6 +1683,20 @@ export interface TelegramClient extends ITelegramClient {
1678
1683
  * @param [enabled=false] Whether join-to-send setting should be enabled
1679
1684
  */
1680
1685
  toggleJoinToSend(chatId: InputPeerLike, enabled?: boolean): Promise<void>;
1686
+ /**
1687
+ * Transfer ownership of a chat/channel/supergroup to another user.
1688
+ *
1689
+ * You must be the creator of the chat to use this method,
1690
+ * and your account must have 2FA enabled.
1691
+ */
1692
+ transferChatOwnership(params: {
1693
+ /** ID of the chat/channel/supergroup to transfer */
1694
+ chatId: InputPeerLike;
1695
+ /** ID of the user to transfer ownership to */
1696
+ userId: InputPeerLike;
1697
+ /** Your 2FA password */
1698
+ password: string;
1699
+ }): Promise<void>;
1681
1700
  /**
1682
1701
  * Unarchive one or more chats
1683
1702
  *
@@ -1778,6 +1797,8 @@ export interface TelegramClient extends ITelegramClient {
1778
1797
  /**
1779
1798
  * Set a note for a contact
1780
1799
  *
1800
+ * **Available**: 👤 users only
1801
+ *
1781
1802
  * @param userId ID of the user to set the note for
1782
1803
  * @param note Note text
1783
1804
  */
@@ -2217,6 +2238,8 @@ export interface TelegramClient extends ITelegramClient {
2217
2238
  *
2218
2239
  * Only admins with `manageTopics` permission can do this.
2219
2240
  *
2241
+ * **Available**: 👤 users only
2242
+ *
2220
2243
  * @returns Service message for the created topic
2221
2244
  */
2222
2245
  createForumTopic(params: {
@@ -2248,6 +2271,8 @@ export interface TelegramClient extends ITelegramClient {
2248
2271
  /**
2249
2272
  * Delete a forum topic and all its history
2250
2273
  *
2274
+ * **Available**: 👤 users only
2275
+ *
2251
2276
  * @param chat Chat or user ID, username, phone number, `"me"` or `"self"`
2252
2277
  * @param topicId ID of the topic (i.e. its top message ID)
2253
2278
  */
@@ -2263,6 +2288,8 @@ export interface TelegramClient extends ITelegramClient {
2263
2288
  *
2264
2289
  * Only admins with `manageTopics` permission can do this.
2265
2290
  *
2291
+ * **Available**: 👤 users only
2292
+ *
2266
2293
  * @param chatId Chat ID or username
2267
2294
  * @param topicId ID of the topic (i.e. its top message ID)
2268
2295
  * @returns Service message about the modification
@@ -2296,12 +2323,16 @@ export interface TelegramClient extends ITelegramClient {
2296
2323
  /**
2297
2324
  * Get forum topics by their IDs
2298
2325
  *
2326
+ * **Available**: 👤 users only
2327
+ *
2299
2328
  * @param chatId Chat ID or username
2300
2329
  */
2301
2330
  getForumTopicsById(chatId: InputPeerLike, ids: MaybeArray<number>): Promise<ForumTopic[]>;
2302
2331
  /**
2303
2332
  * Get forum topics
2304
2333
  *
2334
+ * **Available**: 👤 users only
2335
+ *
2305
2336
  * @param chatId Chat ID or username
2306
2337
  */
2307
2338
  getForumTopics(chatId: InputPeerLike, params?: {
@@ -2343,6 +2374,8 @@ export interface TelegramClient extends ITelegramClient {
2343
2374
  * Reorder pinned forum topics
2344
2375
  *
2345
2376
  * Only admins with `manageTopics` permission can do this.
2377
+ * **Available**: 👤 users only
2378
+ *
2346
2379
  */
2347
2380
  reorderPinnedForumTopics(params: {
2348
2381
  /** Chat ID or username */
@@ -2361,6 +2394,8 @@ export interface TelegramClient extends ITelegramClient {
2361
2394
  *
2362
2395
  * Only admins with `manageTopics` permission can do this.
2363
2396
  *
2397
+ * **Available**: 👤 users only
2398
+ *
2364
2399
  * @returns Service message about the modification
2365
2400
  */
2366
2401
  toggleForumTopicClosed(parmas: {
@@ -2380,6 +2415,8 @@ export interface TelegramClient extends ITelegramClient {
2380
2415
  * Toggle whether a topic in a forum is pinned
2381
2416
  *
2382
2417
  * Only admins with `manageTopics` permission can do this.
2418
+ * **Available**: 👤 users only
2419
+ *
2383
2420
  */
2384
2421
  toggleForumTopicPinned(params: {
2385
2422
  /** Chat ID or username */
@@ -2529,6 +2566,8 @@ export interface TelegramClient extends ITelegramClient {
2529
2566
  getStarGiftOptions(): Promise<StarGift[]>;
2530
2567
  /**
2531
2568
  * Get a list of all possible attributes when upgrading a given star gift
2569
+ * **Available**: 👤 users only
2570
+ *
2532
2571
  */
2533
2572
  getStarGiftUpgradeOptions(giftId: tl.Long): Promise<StarGiftUpgradeOptions>;
2534
2573
  /**
@@ -2608,6 +2647,8 @@ export interface TelegramClient extends ITelegramClient {
2608
2647
  /**
2609
2648
  * Accept or decline a purchase offer for a star gift
2610
2649
  *
2650
+ * **Available**: 👤 users only
2651
+ *
2611
2652
  * @returns The generated service message
2612
2653
  */
2613
2654
  resolveStarGiftOffer(options: {
@@ -2623,6 +2664,8 @@ export interface TelegramClient extends ITelegramClient {
2623
2664
  }): Promise<Message>;
2624
2665
  /**
2625
2666
  * Create a purchase offer for a unique star gift
2667
+ * **Available**: 👤 users only
2668
+ *
2626
2669
  * @param client
2627
2670
  * @param params
2628
2671
  */
@@ -3113,7 +3156,7 @@ export interface TelegramClient extends ITelegramClient {
3113
3156
  /**
3114
3157
  * Edit message text, media, reply markup and schedule date.
3115
3158
  *
3116
- * **Available**: both users and bots
3159
+ * **Available**: 👤 users only
3117
3160
  *
3118
3161
  * @param chatId ID of the chat, its username, phone or `"me"` or `"self"`
3119
3162
  * @param message Message or its ID
@@ -3866,7 +3909,7 @@ export interface TelegramClient extends ITelegramClient {
3866
3909
  * To add a caption to the group, add caption to the first
3867
3910
  * media in the group and don't add caption for any other.
3868
3911
  *
3869
- * **Available**: both users and bots
3912
+ * **Available**: 👤 users only
3870
3913
  *
3871
3914
  * @param chatId ID of the chat, its username, phone or `"me"` or `"self"`
3872
3915
  * @param medias Medias contained in the message.
@@ -3895,7 +3938,7 @@ export interface TelegramClient extends ITelegramClient {
3895
3938
  /**
3896
3939
  * Send a single media (a photo or a document-based media)
3897
3940
  *
3898
- * **Available**: both users and bots
3941
+ * **Available**: 👤 users only
3899
3942
  *
3900
3943
  * @param chatId ID of the chat, its username, phone or `"me"` or `"self"`
3901
3944
  * @param media
@@ -4022,7 +4065,7 @@ export interface TelegramClient extends ITelegramClient {
4022
4065
  /**
4023
4066
  * Send a text message
4024
4067
  *
4025
- * **Available**: both users and bots
4068
+ * **Available**: 👤 users only
4026
4069
  *
4027
4070
  * @param chatId ID of the chat, its username, phone or `"me"` or `"self"`
4028
4071
  * @param text Text of the message
@@ -4056,7 +4099,7 @@ export interface TelegramClient extends ITelegramClient {
4056
4099
  *
4057
4100
  * If you need a continuous typing status, use {@link setTyping} instead.
4058
4101
  *
4059
- * **Available**: both users and bots
4102
+ * **Available**: 👤 users only
4060
4103
  *
4061
4104
  * @param chatId Chat ID
4062
4105
  * @param [status='typing'] Typing status
@@ -4595,13 +4638,13 @@ export interface TelegramClient extends ITelegramClient {
4595
4638
  */
4596
4639
  deleteStickerFromSet(sticker: InputDocumentId): Promise<StickerSet>;
4597
4640
  /**
4598
- * Get custom emoji stickers by their IDs
4641
+ * Get custom emoji stickers by their IDs, or `null` if not available/found.
4599
4642
  *
4600
4643
  * **Available**: 👤 users only
4601
4644
  *
4602
4645
  * @param ids IDs of the stickers (as defined in {@link MessageEntity.emojiId})
4603
4646
  */
4604
- getCustomEmojis(ids: tl.Long[]): Promise<Sticker[]>;
4647
+ getCustomEmojis(ids: tl.Long[]): Promise<(Sticker | null)[]>;
4605
4648
  /**
4606
4649
  * Given one or more messages, extract all unique custom emojis from it and fetch them
4607
4650
  * **Available**: ✅ both users and bots
@@ -5153,7 +5196,7 @@ export interface TelegramClient extends ITelegramClient {
5153
5196
  * @param photoId ID of the photo to fetch
5154
5197
  * @param params
5155
5198
  */
5156
- getProfilePhoto(userId: InputPeerLike, photoId: tl.Long): Promise<Photo>;
5199
+ getProfilePhoto(userId: InputPeerLike, photoId: tl.Long): Promise<Photo | null>;
5157
5200
  /**
5158
5201
  * Get a list of profile pictures of a user
5159
5202
  *
@@ -1,7 +1,7 @@
1
1
  import { Emitter } from '@fuman/utils';
2
- import { tl } from '@mtcute/tl';
3
2
  import { default as Long } from 'long';
4
3
  import { ConnectionKind, RpcCallOptions } from '../network/index.js';
4
+ import { tl } from '../tl/index.js';
5
5
  import { ICorePlatform } from '../types/platform.js';
6
6
  import { MustEqual, PublicPart } from '../types/utils.js';
7
7
  import { Logger } from '../utils/logger.js';
@@ -31,7 +31,7 @@ export interface ITelegramClient {
31
31
  /** App config manager */
32
32
  readonly appConfig: PublicPart<AppConfigManager>;
33
33
  /** Timers manager */
34
- readonly timers: Pick<TimersManager, 'create' | 'cancel' | 'exists'>;
34
+ readonly timers: Pick<TimersManager, 'upsert' | 'cancel' | 'exists'>;
35
35
  /** Signal that will be aborted when the client is destroyed */
36
36
  readonly stopSignal: AbortSignal;
37
37
  /** Platform used by the client */
@@ -62,6 +62,9 @@ export interface ITelegramClient {
62
62
  *
63
63
  * This will terminate any connections to the Telegram servers,
64
64
  * free all the resources, and make the client no longer usable
65
+ *
66
+ * > **Note**: the above is not true for worker ports, which instead only closes the port connection itself.
67
+ * > To destroy the underlying client, use `unsafeForceDestroy()`.
65
68
  */
66
69
  destroy(): Promise<void>;
67
70
  /** Notify the client that the user has logged in */
@@ -1,7 +1,7 @@
1
1
  import { Emitter } from '@fuman/utils';
2
- import { tl } from '@mtcute/tl';
3
2
  import { default as Long } from 'long';
4
3
  import { ConnectionKind, RpcCallOptions } from '../network/index.js';
4
+ import { tl } from '../tl/index.js';
5
5
  import { ICorePlatform } from '../types/platform.js';
6
6
  import { MustEqual, PublicPart } from '../types/utils.js';
7
7
  import { Logger } from '../utils/logger.js';
@@ -31,7 +31,7 @@ export interface ITelegramClient {
31
31
  /** App config manager */
32
32
  readonly appConfig: PublicPart<AppConfigManager>;
33
33
  /** Timers manager */
34
- readonly timers: Pick<TimersManager, 'create' | 'cancel' | 'exists'>;
34
+ readonly timers: Pick<TimersManager, 'upsert' | 'cancel' | 'exists'>;
35
35
  /** Signal that will be aborted when the client is destroyed */
36
36
  readonly stopSignal: AbortSignal;
37
37
  /** Platform used by the client */
@@ -62,6 +62,9 @@ export interface ITelegramClient {
62
62
  *
63
63
  * This will terminate any connections to the Telegram servers,
64
64
  * free all the resources, and make the client no longer usable
65
+ *
66
+ * > **Note**: the above is not true for worker ports, which instead only closes the port connection itself.
67
+ * > To destroy the underlying client, use `unsafeForceDestroy()`.
65
68
  */
66
69
  destroy(): Promise<void>;
67
70
  /** Notify the client that the user has logged in */
@@ -7,37 +7,57 @@ 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
  class TimersManager {
10
+ constructor(_executeRpc) {
11
+ this._executeRpc = _executeRpc;
12
+ }
10
13
  _timers = /* @__PURE__ */ new Map();
11
14
  _errorHandler;
12
- constructor() {
13
- }
14
- exists(key) {
15
+ // These methods are async for API parity with worker-backed clients,
16
+ // where keepalive state is owned by the shared client/worker and accessed over RPC.
17
+ async exists(key) {
15
18
  return this._timers.has(key);
16
19
  }
17
- create(key, handler, interval, startNow = false) {
18
- if (this._timers.has(key)) {
19
- return;
20
+ async upsert(spec) {
21
+ this.upsertOwned("local", spec);
22
+ }
23
+ async cancel(key) {
24
+ this._cancel(key);
25
+ }
26
+ upsertOwned(ownerId, spec) {
27
+ this._cancel(spec.key);
28
+ const timer = new utils.AsyncInterval(
29
+ (abortSignal) => this._executeRpc(spec, abortSignal),
30
+ spec.interval
31
+ );
32
+ if (this._errorHandler) {
33
+ timer.onError(this._errorHandler);
20
34
  }
21
- const timer = new utils.AsyncInterval(handler, interval);
22
- if (this._errorHandler) timer.onError(this._errorHandler);
23
- this._timers.set(key, timer);
24
- if (startNow) timer.startNow();
35
+ this._timers.set(spec.key, {
36
+ ownerId,
37
+ timer
38
+ });
39
+ if (spec.startNow) timer.startNow();
25
40
  else timer.start();
26
41
  }
27
- cancel(key) {
28
- const timer = this._timers.get(key);
29
- if (!timer) return;
30
- timer.stop();
31
- this._timers.delete(key);
42
+ clearOwner(ownerId) {
43
+ for (const [key, timer] of Array.from(this._timers.entries())) {
44
+ if (timer.ownerId !== ownerId) continue;
45
+ this._cancel(key);
46
+ }
32
47
  }
33
48
  onError(handler) {
34
49
  this._errorHandler = handler;
35
50
  }
36
51
  destroy() {
37
- for (const timer of this._timers.values()) {
38
- timer.stop();
52
+ for (const key of Array.from(this._timers.keys())) {
53
+ this._cancel(key);
39
54
  }
40
- this._timers.clear();
55
+ }
56
+ _cancel(key) {
57
+ const timer = this._timers.get(key);
58
+ if (!timer) return;
59
+ timer.timer.stop();
60
+ this._timers.delete(key);
41
61
  }
42
62
  }
43
63
  exports.TimersManager = TimersManager;
@@ -1,10 +1,24 @@
1
+ import { RpcCallOptions } from '../../network/network-manager.js';
2
+ import { tl } from '../../tl/index.js';
3
+ export interface RpcTimerSpec {
4
+ kind: 'rpc';
5
+ key: string;
6
+ interval: number;
7
+ request: tl.RpcMethod;
8
+ options?: Omit<RpcCallOptions, 'abortSignal' | 'manager'>;
9
+ startNow?: boolean;
10
+ }
1
11
  export declare class TimersManager {
12
+ private readonly _executeRpc;
2
13
  private _timers;
3
14
  private _errorHandler?;
4
- constructor();
5
- exists(key: string): boolean;
6
- create(key: string, handler: (abortSignal: AbortSignal) => Promise<void>, interval: number, startNow?: boolean): void;
7
- cancel(key: string): void;
15
+ constructor(_executeRpc: (spec: RpcTimerSpec, abortSignal: AbortSignal) => Promise<void>);
16
+ exists(key: string): Promise<boolean>;
17
+ upsert(spec: RpcTimerSpec): Promise<void>;
18
+ cancel(key: string): Promise<void>;
19
+ upsertOwned(ownerId: string, spec: RpcTimerSpec): void;
20
+ clearOwner(ownerId: string): void;
8
21
  onError(handler: (err: unknown) => void): void;
9
22
  destroy(): void;
23
+ private _cancel;
10
24
  }
@@ -1,10 +1,24 @@
1
+ import { RpcCallOptions } from '../../network/network-manager.js';
2
+ import { tl } from '../../tl/index.js';
3
+ export interface RpcTimerSpec {
4
+ kind: 'rpc';
5
+ key: string;
6
+ interval: number;
7
+ request: tl.RpcMethod;
8
+ options?: Omit<RpcCallOptions, 'abortSignal' | 'manager'>;
9
+ startNow?: boolean;
10
+ }
1
11
  export declare class TimersManager {
12
+ private readonly _executeRpc;
2
13
  private _timers;
3
14
  private _errorHandler?;
4
- constructor();
5
- exists(key: string): boolean;
6
- create(key: string, handler: (abortSignal: AbortSignal) => Promise<void>, interval: number, startNow?: boolean): void;
7
- cancel(key: string): void;
15
+ constructor(_executeRpc: (spec: RpcTimerSpec, abortSignal: AbortSignal) => Promise<void>);
16
+ exists(key: string): Promise<boolean>;
17
+ upsert(spec: RpcTimerSpec): Promise<void>;
18
+ cancel(key: string): Promise<void>;
19
+ upsertOwned(ownerId: string, spec: RpcTimerSpec): void;
20
+ clearOwner(ownerId: string): void;
8
21
  onError(handler: (err: unknown) => void): void;
9
22
  destroy(): void;
23
+ private _cancel;
10
24
  }
@@ -1,36 +1,56 @@
1
1
  import { AsyncInterval } from "@fuman/utils";
2
2
  class TimersManager {
3
+ constructor(_executeRpc) {
4
+ this._executeRpc = _executeRpc;
5
+ }
3
6
  _timers = /* @__PURE__ */ new Map();
4
7
  _errorHandler;
5
- constructor() {
6
- }
7
- exists(key) {
8
+ // These methods are async for API parity with worker-backed clients,
9
+ // where keepalive state is owned by the shared client/worker and accessed over RPC.
10
+ async exists(key) {
8
11
  return this._timers.has(key);
9
12
  }
10
- create(key, handler, interval, startNow = false) {
11
- if (this._timers.has(key)) {
12
- return;
13
+ async upsert(spec) {
14
+ this.upsertOwned("local", spec);
15
+ }
16
+ async cancel(key) {
17
+ this._cancel(key);
18
+ }
19
+ upsertOwned(ownerId, spec) {
20
+ this._cancel(spec.key);
21
+ const timer = new AsyncInterval(
22
+ (abortSignal) => this._executeRpc(spec, abortSignal),
23
+ spec.interval
24
+ );
25
+ if (this._errorHandler) {
26
+ timer.onError(this._errorHandler);
13
27
  }
14
- const timer = new AsyncInterval(handler, interval);
15
- if (this._errorHandler) timer.onError(this._errorHandler);
16
- this._timers.set(key, timer);
17
- if (startNow) timer.startNow();
28
+ this._timers.set(spec.key, {
29
+ ownerId,
30
+ timer
31
+ });
32
+ if (spec.startNow) timer.startNow();
18
33
  else timer.start();
19
34
  }
20
- cancel(key) {
21
- const timer = this._timers.get(key);
22
- if (!timer) return;
23
- timer.stop();
24
- this._timers.delete(key);
35
+ clearOwner(ownerId) {
36
+ for (const [key, timer] of Array.from(this._timers.entries())) {
37
+ if (timer.ownerId !== ownerId) continue;
38
+ this._cancel(key);
39
+ }
25
40
  }
26
41
  onError(handler) {
27
42
  this._errorHandler = handler;
28
43
  }
29
44
  destroy() {
30
- for (const timer of this._timers.values()) {
31
- timer.stop();
45
+ for (const key of Array.from(this._timers.keys())) {
46
+ this._cancel(key);
32
47
  }
33
- this._timers.clear();
48
+ }
49
+ _cancel(key) {
50
+ const timer = this._timers.get(key);
51
+ if (!timer) return;
52
+ timer.timer.stop();
53
+ this._timers.delete(key);
34
54
  }
35
55
  }
36
56
  export {
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { tl } from '@mtcute/tl';
1
+ import { tl } from '../../../tl/index.js';
2
2
  import { ITelegramClient } from '../../client.types.js';
3
3
  import { User } from '../../types/index.js';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { tl } from '@mtcute/tl';
1
+ import { tl } from '../../../tl/index.js';
2
2
  import { ITelegramClient } from '../../client.types.js';
3
3
  import { User } from '../../types/index.js';
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { tl } from '@mtcute/tl';
1
+ import { tl } from '../../../tl/index.js';
2
2
  import { ITelegramClient } from '../../client.types.js';
3
3
  import { SentCode } from '../../types/auth/sent-code.js';
4
4
  import { User } from '../../types/index.js';
@@ -1,4 +1,4 @@
1
- import { tl } from '@mtcute/tl';
1
+ import { tl } from '../../../tl/index.js';
2
2
  import { ITelegramClient } from '../../client.types.js';
3
3
  import { SentCode } from '../../types/auth/sent-code.js';
4
4
  import { User } from '../../types/index.js';
@@ -6,11 +6,11 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
6
6
  "use strict";
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
8
  const utils = require("@fuman/utils");
9
- const tl = require("@mtcute/tl");
10
9
  const miscUtils = require("../../../utils/misc-utils.cjs");
11
10
  const typeAssertions = require("../../../utils/type-assertions.cjs");
12
11
  const miscUtils$1 = require("../../utils/misc-utils.cjs");
13
12
  const checkPassword = require("./check-password.cjs");
13
+ const innerTl = require("../../../tl/inner-tl.cjs");
14
14
  const user = require("../../types/peers/user.cjs");
15
15
  async function signInQr(client, params) {
16
16
  const { onUrlUpdated, abortSignal, onQrScanned } = params;
@@ -37,7 +37,7 @@ async function signInQr(client, params) {
37
37
  abortSignal
38
38
  });
39
39
  } catch (e) {
40
- if (tl.tl.RpcError.is(e, "PASSWORD_HASH_INVALID")) {
40
+ if (innerTl.RpcError.is(e, "PASSWORD_HASH_INVALID")) {
41
41
  if (!isDynamic) {
42
42
  throw e;
43
43
  }
@@ -67,7 +67,7 @@ async function signInQr(client, params) {
67
67
  { abortSignal }
68
68
  );
69
69
  } catch (e) {
70
- if (tl.tl.RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
70
+ if (innerTl.RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
71
71
  return await handle2fa(params.password);
72
72
  }
73
73
  throw e;
@@ -96,7 +96,7 @@ async function signInQr(client, params) {
96
96
  { abortSignal }
97
97
  );
98
98
  } catch (e) {
99
- if (tl.tl.RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
99
+ if (innerTl.RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
100
100
  return await handle2fa(params.password);
101
101
  }
102
102
  throw e;
@@ -1,9 +1,9 @@
1
1
  import { base64, Deferred } from "@fuman/utils";
2
- import { tl } from "@mtcute/tl";
3
2
  import { sleepWithAbort } from "../../../utils/misc-utils.js";
4
3
  import { assertTypeIs } from "../../../utils/type-assertions.js";
5
4
  import { resolveMaybeDynamic } from "../../utils/misc-utils.js";
6
5
  import { checkPassword } from "./check-password.js";
6
+ import { RpcError } from "../../../tl/inner-tl.js";
7
7
  import { User as User$2 } from "../../types/peers/user.js";
8
8
  async function signInQr(client, params) {
9
9
  const { onUrlUpdated, abortSignal, onQrScanned } = params;
@@ -30,7 +30,7 @@ async function signInQr(client, params) {
30
30
  abortSignal
31
31
  });
32
32
  } catch (e) {
33
- if (tl.RpcError.is(e, "PASSWORD_HASH_INVALID")) {
33
+ if (RpcError.is(e, "PASSWORD_HASH_INVALID")) {
34
34
  if (!isDynamic) {
35
35
  throw e;
36
36
  }
@@ -60,7 +60,7 @@ async function signInQr(client, params) {
60
60
  { abortSignal }
61
61
  );
62
62
  } catch (e) {
63
- if (tl.RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
63
+ if (RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
64
64
  return await handle2fa(params.password);
65
65
  }
66
66
  throw e;
@@ -89,7 +89,7 @@ async function signInQr(client, params) {
89
89
  { abortSignal }
90
90
  );
91
91
  } catch (e) {
92
- if (tl.RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
92
+ if (RpcError.is(e, "SESSION_PASSWORD_NEEDED") && params.password) {
93
93
  return await handle2fa(params.password);
94
94
  }
95
95
  throw e;