@mtkruto/node 0.62.1 → 0.63.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 (511) hide show
  1. package/esm/2_tl.d.ts +6 -6
  2. package/esm/2_tl.d.ts.map +1 -1
  3. package/esm/2_tl.js +6 -6
  4. package/esm/3_errors.d.ts +1 -2
  5. package/esm/3_errors.d.ts.map +1 -1
  6. package/esm/3_errors.js +2 -1
  7. package/esm/4_constants.d.ts +0 -1
  8. package/esm/4_constants.d.ts.map +1 -1
  9. package/esm/4_constants.js +0 -1
  10. package/esm/4_errors.d.ts +2 -2
  11. package/esm/4_errors.d.ts.map +1 -1
  12. package/esm/4_session.d.ts +24 -0
  13. package/esm/4_session.d.ts.map +1 -0
  14. package/esm/4_session.js +23 -0
  15. package/esm/5_client.d.ts +1 -1
  16. package/esm/5_client.js +1 -1
  17. package/esm/client/0_client_abstract.d.ts +28 -26
  18. package/esm/client/0_client_abstract.d.ts.map +1 -1
  19. package/esm/client/0_client_abstract.js +16 -88
  20. package/esm/client/0_params.d.ts +5 -0
  21. package/esm/client/0_params.d.ts.map +1 -1
  22. package/esm/client/0_password.d.ts.map +1 -1
  23. package/esm/client/0_password.js +2 -2
  24. package/esm/client/0_storage_operations.d.ts +4 -4
  25. package/esm/client/0_storage_operations.d.ts.map +1 -1
  26. package/esm/client/0_storage_operations.js +14 -14
  27. package/esm/client/0_update_processor.d.ts +19 -0
  28. package/esm/client/0_update_processor.d.ts.map +1 -1
  29. package/esm/client/0_update_processor.js +19 -0
  30. package/esm/client/0_utilities.d.ts +6 -2
  31. package/esm/client/0_utilities.d.ts.map +1 -1
  32. package/esm/client/0_utilities.js +21 -23
  33. package/esm/client/1_client_plain.d.ts +9 -6
  34. package/esm/client/1_client_plain.d.ts.map +1 -1
  35. package/esm/client/1_client_plain.js +26 -41
  36. package/esm/client/1_types.d.ts +4 -23
  37. package/esm/client/1_types.d.ts.map +1 -1
  38. package/esm/client/2_account_manager.js +10 -10
  39. package/esm/client/2_business_connection_manager.d.ts.map +1 -1
  40. package/esm/client/2_business_connection_manager.js +4 -4
  41. package/esm/client/2_client_encrypted.d.ts +58 -0
  42. package/esm/client/2_client_encrypted.d.ts.map +1 -0
  43. package/esm/client/2_client_encrypted.js +265 -0
  44. package/esm/client/2_file_manager.d.ts.map +1 -1
  45. package/esm/client/2_file_manager.js +54 -74
  46. package/esm/client/2_network_statistics_manager.d.ts +1 -1
  47. package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
  48. package/esm/client/2_network_statistics_manager.js +3 -3
  49. package/esm/client/2_payment_manager.d.ts.map +1 -1
  50. package/esm/client/2_payment_manager.js +3 -3
  51. package/esm/client/2_reaction_manager.d.ts.map +1 -1
  52. package/esm/client/2_reaction_manager.js +10 -10
  53. package/esm/client/2_translations_manager.d.ts +19 -0
  54. package/esm/client/2_translations_manager.d.ts.map +1 -1
  55. package/esm/client/2_translations_manager.js +24 -5
  56. package/esm/client/2_update_manager.d.ts +4 -4
  57. package/esm/client/2_update_manager.d.ts.map +1 -1
  58. package/esm/client/2_update_manager.js +69 -79
  59. package/esm/client/3_client_encrypted_pool.d.ts +30 -0
  60. package/esm/client/3_client_encrypted_pool.d.ts.map +1 -0
  61. package/esm/client/3_client_encrypted_pool.js +70 -0
  62. package/esm/client/3_message_manager.d.ts.map +1 -1
  63. package/esm/client/3_message_manager.js +96 -70
  64. package/esm/client/3_video_chat_manager.d.ts.map +1 -1
  65. package/esm/client/3_video_chat_manager.js +15 -20
  66. package/esm/client/4_callback_query_manager.d.ts.map +1 -1
  67. package/esm/client/4_callback_query_manager.js +2 -2
  68. package/esm/client/4_chat_list_manager.d.ts.map +1 -1
  69. package/esm/client/4_chat_list_manager.js +33 -33
  70. package/esm/client/4_chat_manager.d.ts.map +1 -1
  71. package/esm/client/4_chat_manager.js +25 -25
  72. package/esm/client/4_gift_manager.js +2 -2
  73. package/esm/client/4_inline_query_manager.d.ts.map +1 -1
  74. package/esm/client/4_inline_query_manager.js +4 -4
  75. package/esm/client/4_poll_manager.d.ts.map +1 -1
  76. package/esm/client/4_poll_manager.js +5 -5
  77. package/esm/client/4_story_manager.d.ts.map +1 -1
  78. package/esm/client/4_story_manager.js +10 -10
  79. package/esm/client/5_client.d.ts +3 -9
  80. package/esm/client/5_client.d.ts.map +1 -1
  81. package/esm/client/5_client.js +290 -306
  82. package/esm/connection/0_connection.d.ts +5 -4
  83. package/esm/connection/0_connection.d.ts.map +1 -1
  84. package/esm/connection/1_connection_web_socket.js +2 -2
  85. package/esm/mod.d.ts +1 -1
  86. package/esm/mod.d.ts.map +1 -1
  87. package/esm/mod.js +1 -1
  88. package/{script/tl/2_tl_reader.d.ts → esm/session/0_session_error.d.ts} +4 -7
  89. package/esm/session/0_session_error.d.ts.map +1 -0
  90. package/esm/{tl/2_tl_reader.d.ts → session/0_session_error.js} +5 -7
  91. package/esm/{tl/2_tl_writer.d.ts → session/0_session_state.d.ts} +7 -5
  92. package/esm/session/0_session_state.d.ts.map +1 -0
  93. package/esm/session/0_session_state.js +77 -0
  94. package/esm/session/1_session.d.ts +31 -0
  95. package/esm/session/1_session.d.ts.map +1 -0
  96. package/esm/session/1_session.js +149 -0
  97. package/esm/session/2_session_encrypted.d.ts +40 -0
  98. package/esm/session/2_session_encrypted.d.ts.map +1 -0
  99. package/esm/session/2_session_encrypted.js +416 -0
  100. package/esm/session/2_session_plain.d.ts +25 -0
  101. package/esm/session/2_session_plain.d.ts.map +1 -0
  102. package/esm/session/2_session_plain.js +56 -0
  103. package/esm/tl/0_tl_error.d.ts +22 -0
  104. package/esm/tl/0_tl_error.d.ts.map +1 -0
  105. package/esm/tl/0_tl_error.js +21 -0
  106. package/esm/tl/0_types.d.ts +25 -0
  107. package/esm/tl/0_types.d.ts.map +1 -0
  108. package/esm/tl/0_types.js +20 -0
  109. package/esm/tl/0_utilities.d.ts +32 -0
  110. package/esm/tl/0_utilities.d.ts.map +1 -0
  111. package/esm/tl/0_utilities.js +51 -0
  112. package/esm/tl/0_utilities_test.d.ts.map +1 -0
  113. package/esm/tl/1_mtproto_api.d.ts +371 -0
  114. package/esm/tl/1_mtproto_api.d.ts.map +1 -0
  115. package/esm/tl/1_mtproto_api.js +416 -0
  116. package/esm/tl/{0_api.d.ts → 1_telegram_api.d.ts} +23 -340
  117. package/esm/tl/1_telegram_api.d.ts.map +1 -0
  118. package/esm/tl/{0_api.js → 1_telegram_api.js} +4945 -11109
  119. package/{script/tl/0_tl_raw_reader.d.ts → esm/tl/1_tl_reader.d.ts} +5 -2
  120. package/esm/tl/1_tl_reader.d.ts.map +1 -0
  121. package/esm/tl/{2_tl_reader.js → 1_tl_reader.js} +107 -40
  122. package/esm/tl/1_tl_reader_test.d.ts.map +1 -0
  123. package/esm/tl/{0_tl_raw_writer.d.ts → 1_tl_writer.d.ts} +5 -2
  124. package/esm/tl/1_tl_writer.d.ts.map +1 -0
  125. package/esm/tl/{2_tl_writer.js → 1_tl_writer.js} +80 -23
  126. package/esm/tl/1_tl_writer_test.d.ts.map +1 -0
  127. package/esm/tl/1_utilities.d.ts +9 -24
  128. package/esm/tl/1_utilities.d.ts.map +1 -1
  129. package/esm/tl/1_utilities.js +18 -64
  130. package/esm/tl/2_message.d.ts +2 -2
  131. package/esm/tl/2_message.d.ts.map +1 -1
  132. package/esm/tl/2_message.js +7 -7
  133. package/esm/tl/2_mtproto.d.ts +33 -0
  134. package/esm/tl/2_mtproto.d.ts.map +1 -0
  135. package/esm/tl/2_mtproto.js +53 -0
  136. package/{script/tl/2_utilities.d.ts → esm/tl/2_telegram.d.ts} +16 -2
  137. package/esm/tl/2_telegram.d.ts.map +1 -0
  138. package/esm/tl/{2_utilities.js → 2_telegram.js} +46 -1
  139. package/esm/transport/0_transport.d.ts +1 -1
  140. package/esm/transport/0_transport.d.ts.map +1 -1
  141. package/esm/types/0_chat_photo.d.ts.map +1 -1
  142. package/esm/types/0_chat_photo.js +2 -2
  143. package/esm/types/0_giveaway_parameters.d.ts.map +1 -1
  144. package/esm/types/0_giveaway_parameters.js +3 -3
  145. package/esm/types/0_location.d.ts.map +1 -1
  146. package/esm/types/0_location.js +5 -5
  147. package/esm/types/0_message_entity.d.ts.map +1 -1
  148. package/esm/types/0_message_entity.js +20 -20
  149. package/esm/types/0_reaction.d.ts.map +1 -1
  150. package/esm/types/0_reaction.js +4 -4
  151. package/esm/types/0_slow_mode_duration.d.ts +19 -0
  152. package/esm/types/0_slow_mode_duration.d.ts.map +1 -1
  153. package/esm/types/0_slow_mode_duration.js +19 -0
  154. package/esm/types/0_thumbnail.d.ts.map +1 -1
  155. package/esm/types/0_thumbnail.js +3 -3
  156. package/esm/types/0_translation.d.ts +19 -0
  157. package/esm/types/0_translation.d.ts.map +1 -1
  158. package/esm/types/0_translation.js +22 -3
  159. package/esm/types/0_video_chat.d.ts.map +1 -1
  160. package/esm/types/0_video_chat.js +2 -2
  161. package/esm/types/1_animation.d.ts.map +1 -1
  162. package/esm/types/1_animation.js +2 -2
  163. package/esm/types/1_audio.d.ts.map +1 -1
  164. package/esm/types/1_audio.js +2 -2
  165. package/esm/types/1_bot_command_scope.d.ts.map +1 -1
  166. package/esm/types/1_bot_command_scope.js +2 -2
  167. package/esm/types/1_chat_p.d.ts.map +1 -1
  168. package/esm/types/1_chat_p.js +6 -6
  169. package/esm/types/1_document.d.ts.map +1 -1
  170. package/esm/types/1_document.js +2 -2
  171. package/esm/types/1_keyboard_button.d.ts.map +1 -1
  172. package/esm/types/1_keyboard_button.js +10 -10
  173. package/esm/types/1_message_reaction.d.ts.map +1 -1
  174. package/esm/types/1_message_reaction.js +6 -6
  175. package/esm/types/1_photo.d.ts.map +1 -1
  176. package/esm/types/1_photo.js +3 -3
  177. package/esm/types/1_sticker.d.ts.map +1 -1
  178. package/esm/types/1_sticker.js +8 -8
  179. package/esm/types/1_story_privacy.d.ts.map +1 -1
  180. package/esm/types/1_story_privacy.js +7 -7
  181. package/esm/types/1_user.d.ts.map +1 -1
  182. package/esm/types/1_user.js +2 -2
  183. package/esm/types/1_venue.d.ts.map +1 -1
  184. package/esm/types/1_venue.js +2 -2
  185. package/esm/types/1_video.d.ts.map +1 -1
  186. package/esm/types/1_video.js +2 -2
  187. package/esm/types/1_video_note.d.ts.map +1 -1
  188. package/esm/types/1_video_note.js +2 -2
  189. package/esm/types/2_chat.d.ts.map +1 -1
  190. package/esm/types/2_chat.js +8 -8
  191. package/esm/types/2_chat_member.d.ts.map +1 -1
  192. package/esm/types/2_chat_member.js +10 -10
  193. package/esm/types/2_chat_settings.d.ts +19 -0
  194. package/esm/types/2_chat_settings.d.ts.map +1 -1
  195. package/esm/types/2_chat_settings.js +21 -2
  196. package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
  197. package/esm/types/2_chosen_inline_result.js +4 -4
  198. package/esm/types/2_game.d.ts.map +1 -1
  199. package/esm/types/2_game.js +4 -4
  200. package/esm/types/2_gift_upgraded_component.d.ts.map +1 -1
  201. package/esm/types/2_gift_upgraded_component.js +3 -3
  202. package/esm/types/2_inactive_chat.d.ts.map +1 -1
  203. package/esm/types/2_inactive_chat.js +2 -2
  204. package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
  205. package/esm/types/2_inline_keyboard_button.js +10 -10
  206. package/esm/types/2_inline_query.d.ts.map +1 -1
  207. package/esm/types/2_inline_query.js +7 -7
  208. package/esm/types/2_message_reactions.d.ts.map +1 -1
  209. package/esm/types/2_message_reactions.js +2 -2
  210. package/esm/types/2_story_content.d.ts.map +1 -1
  211. package/esm/types/2_story_content.js +6 -6
  212. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  213. package/esm/types/2_story_interactive_area.js +9 -9
  214. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  215. package/esm/types/3_chat_member_updated.js +2 -2
  216. package/esm/types/3_gift.d.ts.map +1 -1
  217. package/esm/types/3_gift.js +3 -3
  218. package/esm/types/3_join_request.d.ts.map +1 -1
  219. package/esm/types/3_join_request.js +2 -2
  220. package/esm/types/3_reply_markup.d.ts.map +1 -1
  221. package/esm/types/3_reply_markup.js +5 -5
  222. package/esm/types/4_claimed_gift.d.ts.map +1 -1
  223. package/esm/types/4_claimed_gift.js +2 -2
  224. package/esm/types/4_inline_query_result.d.ts.map +1 -1
  225. package/esm/types/4_inline_query_result.js +14 -14
  226. package/esm/types/4_message.d.ts.map +1 -1
  227. package/esm/types/4_message.js +57 -57
  228. package/esm/types/5_callback_query.d.ts.map +1 -1
  229. package/esm/types/5_callback_query.js +6 -7
  230. package/esm/types/5_chat_list_item.d.ts.map +1 -1
  231. package/esm/types/5_chat_list_item.js +5 -5
  232. package/esm/types/5_claimed_gifts.d.ts.map +1 -1
  233. package/esm/types/5_claimed_gifts.js +6 -6
  234. package/esm/types/_file_id.d.ts.map +1 -1
  235. package/esm/types/_file_id.js +3 -3
  236. package/package.json +1 -1
  237. package/script/2_tl.d.ts +6 -6
  238. package/script/2_tl.d.ts.map +1 -1
  239. package/script/2_tl.js +11 -11
  240. package/script/3_errors.d.ts +1 -2
  241. package/script/3_errors.d.ts.map +1 -1
  242. package/script/3_errors.js +2 -1
  243. package/script/4_constants.d.ts +0 -1
  244. package/script/4_constants.d.ts.map +1 -1
  245. package/script/4_constants.js +1 -2
  246. package/script/4_errors.d.ts +2 -2
  247. package/script/4_errors.d.ts.map +1 -1
  248. package/script/4_session.d.ts +24 -0
  249. package/script/4_session.d.ts.map +1 -0
  250. package/script/4_session.js +39 -0
  251. package/script/5_client.d.ts +1 -1
  252. package/script/5_client.js +1 -1
  253. package/script/client/0_client_abstract.d.ts +28 -26
  254. package/script/client/0_client_abstract.d.ts.map +1 -1
  255. package/script/client/0_client_abstract.js +18 -113
  256. package/script/client/0_params.d.ts +5 -0
  257. package/script/client/0_params.d.ts.map +1 -1
  258. package/script/client/0_password.d.ts.map +1 -1
  259. package/script/client/0_password.js +1 -1
  260. package/script/client/0_storage_operations.d.ts +4 -4
  261. package/script/client/0_storage_operations.d.ts.map +1 -1
  262. package/script/client/0_storage_operations.js +13 -13
  263. package/script/client/0_update_processor.d.ts +19 -0
  264. package/script/client/0_update_processor.d.ts.map +1 -1
  265. package/script/client/0_update_processor.js +19 -0
  266. package/script/client/0_utilities.d.ts +6 -2
  267. package/script/client/0_utilities.d.ts.map +1 -1
  268. package/script/client/0_utilities.js +22 -24
  269. package/script/client/1_client_plain.d.ts +9 -6
  270. package/script/client/1_client_plain.d.ts.map +1 -1
  271. package/script/client/1_client_plain.js +25 -40
  272. package/script/client/1_types.d.ts +4 -23
  273. package/script/client/1_types.d.ts.map +1 -1
  274. package/script/client/2_account_manager.js +9 -9
  275. package/script/client/2_business_connection_manager.d.ts.map +1 -1
  276. package/script/client/2_business_connection_manager.js +3 -3
  277. package/script/client/2_client_encrypted.d.ts +58 -0
  278. package/script/client/2_client_encrypted.d.ts.map +1 -0
  279. package/script/client/2_client_encrypted.js +269 -0
  280. package/script/client/2_file_manager.d.ts.map +1 -1
  281. package/script/client/2_file_manager.js +52 -72
  282. package/script/client/2_network_statistics_manager.d.ts +1 -1
  283. package/script/client/2_network_statistics_manager.d.ts.map +1 -1
  284. package/script/client/2_network_statistics_manager.js +3 -3
  285. package/script/client/2_payment_manager.d.ts.map +1 -1
  286. package/script/client/2_payment_manager.js +2 -2
  287. package/script/client/2_reaction_manager.d.ts.map +1 -1
  288. package/script/client/2_reaction_manager.js +9 -9
  289. package/script/client/2_translations_manager.d.ts +19 -0
  290. package/script/client/2_translations_manager.d.ts.map +1 -1
  291. package/script/client/2_translations_manager.js +23 -4
  292. package/script/client/2_update_manager.d.ts +4 -4
  293. package/script/client/2_update_manager.d.ts.map +1 -1
  294. package/script/client/2_update_manager.js +68 -78
  295. package/script/client/3_client_encrypted_pool.d.ts +30 -0
  296. package/script/client/3_client_encrypted_pool.d.ts.map +1 -0
  297. package/script/client/3_client_encrypted_pool.js +74 -0
  298. package/script/client/3_message_manager.d.ts.map +1 -1
  299. package/script/client/3_message_manager.js +95 -69
  300. package/script/client/3_video_chat_manager.d.ts.map +1 -1
  301. package/script/client/3_video_chat_manager.js +14 -19
  302. package/script/client/4_callback_query_manager.d.ts.map +1 -1
  303. package/script/client/4_callback_query_manager.js +1 -1
  304. package/script/client/4_chat_list_manager.d.ts.map +1 -1
  305. package/script/client/4_chat_list_manager.js +32 -32
  306. package/script/client/4_chat_manager.d.ts.map +1 -1
  307. package/script/client/4_chat_manager.js +24 -24
  308. package/script/client/4_gift_manager.js +1 -1
  309. package/script/client/4_inline_query_manager.d.ts.map +1 -1
  310. package/script/client/4_inline_query_manager.js +3 -3
  311. package/script/client/4_poll_manager.d.ts.map +1 -1
  312. package/script/client/4_poll_manager.js +4 -4
  313. package/script/client/4_story_manager.d.ts.map +1 -1
  314. package/script/client/4_story_manager.js +9 -9
  315. package/script/client/5_client.d.ts +3 -9
  316. package/script/client/5_client.d.ts.map +1 -1
  317. package/script/client/5_client.js +284 -300
  318. package/script/connection/0_connection.d.ts +5 -4
  319. package/script/connection/0_connection.d.ts.map +1 -1
  320. package/script/connection/1_connection_web_socket.js +2 -2
  321. package/script/mod.d.ts +1 -1
  322. package/script/mod.d.ts.map +1 -1
  323. package/script/mod.js +1 -2
  324. package/script/session/0_session_error.d.ts +24 -0
  325. package/script/session/0_session_error.d.ts.map +1 -0
  326. package/script/session/0_session_error.js +29 -0
  327. package/script/{tl/2_tl_writer.d.ts → session/0_session_state.d.ts} +7 -5
  328. package/script/session/0_session_state.d.ts.map +1 -0
  329. package/script/session/0_session_state.js +81 -0
  330. package/script/session/1_session.d.ts +31 -0
  331. package/script/session/1_session.d.ts.map +1 -0
  332. package/script/session/1_session.js +176 -0
  333. package/script/session/2_session_encrypted.d.ts +40 -0
  334. package/script/session/2_session_encrypted.d.ts.map +1 -0
  335. package/script/session/2_session_encrypted.js +420 -0
  336. package/script/session/2_session_plain.d.ts +25 -0
  337. package/script/session/2_session_plain.d.ts.map +1 -0
  338. package/script/session/2_session_plain.js +60 -0
  339. package/script/tl/0_tl_error.d.ts +22 -0
  340. package/script/tl/0_tl_error.d.ts.map +1 -0
  341. package/script/tl/0_tl_error.js +25 -0
  342. package/script/tl/0_types.d.ts +25 -0
  343. package/script/tl/0_types.d.ts.map +1 -0
  344. package/script/tl/0_types.js +21 -0
  345. package/script/tl/0_utilities.d.ts +32 -0
  346. package/script/tl/0_utilities.d.ts.map +1 -0
  347. package/script/tl/0_utilities.js +59 -0
  348. package/script/tl/0_utilities_test.d.ts.map +1 -0
  349. package/script/tl/1_mtproto_api.d.ts +371 -0
  350. package/script/tl/1_mtproto_api.d.ts.map +1 -0
  351. package/script/tl/1_mtproto_api.js +419 -0
  352. package/script/tl/{0_api.d.ts → 1_telegram_api.d.ts} +23 -340
  353. package/script/tl/1_telegram_api.d.ts.map +1 -0
  354. package/script/tl/{0_api.js → 1_telegram_api.js} +4947 -11134
  355. package/{esm/tl/0_tl_raw_reader.d.ts → script/tl/1_tl_reader.d.ts} +5 -2
  356. package/script/tl/1_tl_reader.d.ts.map +1 -0
  357. package/script/tl/1_tl_reader.js +218 -0
  358. package/script/tl/1_tl_reader_test.d.ts.map +1 -0
  359. package/script/tl/{0_tl_raw_writer.d.ts → 1_tl_writer.d.ts} +5 -2
  360. package/script/tl/1_tl_writer.d.ts.map +1 -0
  361. package/script/tl/{2_tl_writer.js → 1_tl_writer.js} +102 -45
  362. package/script/tl/1_tl_writer_test.d.ts.map +1 -0
  363. package/script/tl/1_utilities.d.ts +9 -24
  364. package/script/tl/1_utilities.d.ts.map +1 -1
  365. package/script/tl/1_utilities.js +19 -72
  366. package/script/tl/2_message.d.ts +2 -2
  367. package/script/tl/2_message.d.ts.map +1 -1
  368. package/script/tl/2_message.js +7 -7
  369. package/script/tl/2_mtproto.d.ts +33 -0
  370. package/script/tl/2_mtproto.d.ts.map +1 -0
  371. package/script/tl/2_mtproto.js +78 -0
  372. package/{esm/tl/2_utilities.d.ts → script/tl/2_telegram.d.ts} +16 -2
  373. package/script/tl/2_telegram.d.ts.map +1 -0
  374. package/script/tl/2_telegram.js +167 -0
  375. package/script/transport/0_transport.d.ts +1 -1
  376. package/script/transport/0_transport.d.ts.map +1 -1
  377. package/script/types/0_chat_photo.d.ts.map +1 -1
  378. package/script/types/0_chat_photo.js +1 -1
  379. package/script/types/0_giveaway_parameters.d.ts.map +1 -1
  380. package/script/types/0_giveaway_parameters.js +2 -2
  381. package/script/types/0_location.d.ts.map +1 -1
  382. package/script/types/0_location.js +4 -4
  383. package/script/types/0_message_entity.d.ts.map +1 -1
  384. package/script/types/0_message_entity.js +19 -19
  385. package/script/types/0_reaction.d.ts.map +1 -1
  386. package/script/types/0_reaction.js +3 -3
  387. package/script/types/0_slow_mode_duration.d.ts +19 -0
  388. package/script/types/0_slow_mode_duration.d.ts.map +1 -1
  389. package/script/types/0_slow_mode_duration.js +19 -0
  390. package/script/types/0_thumbnail.d.ts.map +1 -1
  391. package/script/types/0_thumbnail.js +2 -2
  392. package/script/types/0_translation.d.ts +19 -0
  393. package/script/types/0_translation.d.ts.map +1 -1
  394. package/script/types/0_translation.js +21 -2
  395. package/script/types/0_video_chat.d.ts.map +1 -1
  396. package/script/types/0_video_chat.js +1 -1
  397. package/script/types/1_animation.d.ts.map +1 -1
  398. package/script/types/1_animation.js +1 -1
  399. package/script/types/1_audio.d.ts.map +1 -1
  400. package/script/types/1_audio.js +1 -1
  401. package/script/types/1_bot_command_scope.d.ts.map +1 -1
  402. package/script/types/1_bot_command_scope.js +1 -1
  403. package/script/types/1_chat_p.d.ts.map +1 -1
  404. package/script/types/1_chat_p.js +5 -5
  405. package/script/types/1_document.d.ts.map +1 -1
  406. package/script/types/1_document.js +1 -1
  407. package/script/types/1_keyboard_button.d.ts.map +1 -1
  408. package/script/types/1_keyboard_button.js +9 -9
  409. package/script/types/1_message_reaction.d.ts.map +1 -1
  410. package/script/types/1_message_reaction.js +5 -5
  411. package/script/types/1_photo.d.ts.map +1 -1
  412. package/script/types/1_photo.js +2 -2
  413. package/script/types/1_sticker.d.ts.map +1 -1
  414. package/script/types/1_sticker.js +7 -7
  415. package/script/types/1_story_privacy.d.ts.map +1 -1
  416. package/script/types/1_story_privacy.js +6 -6
  417. package/script/types/1_user.d.ts.map +1 -1
  418. package/script/types/1_user.js +1 -1
  419. package/script/types/1_venue.d.ts.map +1 -1
  420. package/script/types/1_venue.js +1 -1
  421. package/script/types/1_video.d.ts.map +1 -1
  422. package/script/types/1_video.js +1 -1
  423. package/script/types/1_video_note.d.ts.map +1 -1
  424. package/script/types/1_video_note.js +1 -1
  425. package/script/types/2_chat.d.ts.map +1 -1
  426. package/script/types/2_chat.js +7 -7
  427. package/script/types/2_chat_member.d.ts.map +1 -1
  428. package/script/types/2_chat_member.js +9 -9
  429. package/script/types/2_chat_settings.d.ts +19 -0
  430. package/script/types/2_chat_settings.d.ts.map +1 -1
  431. package/script/types/2_chat_settings.js +20 -1
  432. package/script/types/2_chosen_inline_result.d.ts.map +1 -1
  433. package/script/types/2_chosen_inline_result.js +3 -3
  434. package/script/types/2_game.d.ts.map +1 -1
  435. package/script/types/2_game.js +3 -3
  436. package/script/types/2_gift_upgraded_component.d.ts.map +1 -1
  437. package/script/types/2_gift_upgraded_component.js +2 -2
  438. package/script/types/2_inactive_chat.d.ts.map +1 -1
  439. package/script/types/2_inactive_chat.js +1 -1
  440. package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
  441. package/script/types/2_inline_keyboard_button.js +9 -9
  442. package/script/types/2_inline_query.d.ts.map +1 -1
  443. package/script/types/2_inline_query.js +6 -6
  444. package/script/types/2_message_reactions.d.ts.map +1 -1
  445. package/script/types/2_message_reactions.js +1 -1
  446. package/script/types/2_story_content.d.ts.map +1 -1
  447. package/script/types/2_story_content.js +5 -5
  448. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  449. package/script/types/2_story_interactive_area.js +8 -8
  450. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  451. package/script/types/3_chat_member_updated.js +1 -1
  452. package/script/types/3_gift.d.ts.map +1 -1
  453. package/script/types/3_gift.js +2 -2
  454. package/script/types/3_join_request.d.ts.map +1 -1
  455. package/script/types/3_join_request.js +1 -1
  456. package/script/types/3_reply_markup.d.ts.map +1 -1
  457. package/script/types/3_reply_markup.js +4 -4
  458. package/script/types/4_claimed_gift.d.ts.map +1 -1
  459. package/script/types/4_claimed_gift.js +1 -1
  460. package/script/types/4_inline_query_result.d.ts.map +1 -1
  461. package/script/types/4_inline_query_result.js +13 -13
  462. package/script/types/4_message.d.ts.map +1 -1
  463. package/script/types/4_message.js +56 -56
  464. package/script/types/5_callback_query.d.ts.map +1 -1
  465. package/script/types/5_callback_query.js +5 -6
  466. package/script/types/5_chat_list_item.d.ts.map +1 -1
  467. package/script/types/5_chat_list_item.js +4 -4
  468. package/script/types/5_claimed_gifts.d.ts.map +1 -1
  469. package/script/types/5_claimed_gifts.js +5 -5
  470. package/script/types/_file_id.d.ts.map +1 -1
  471. package/script/types/_file_id.js +2 -2
  472. package/esm/client/0_message.d.ts +0 -29
  473. package/esm/client/0_message.d.ts.map +0 -1
  474. package/esm/client/0_message.js +0 -83
  475. package/esm/client/1_client_encrypted.d.ts +0 -52
  476. package/esm/client/1_client_encrypted.d.ts.map +0 -1
  477. package/esm/client/1_client_encrypted.js +0 -381
  478. package/esm/tl/0_api.d.ts.map +0 -1
  479. package/esm/tl/0_tl_raw_reader.d.ts.map +0 -1
  480. package/esm/tl/0_tl_raw_reader.js +0 -97
  481. package/esm/tl/0_tl_raw_reader_test.d.ts.map +0 -1
  482. package/esm/tl/0_tl_raw_writer.d.ts.map +0 -1
  483. package/esm/tl/0_tl_raw_writer.js +0 -86
  484. package/esm/tl/0_tl_raw_writer_test.d.ts.map +0 -1
  485. package/esm/tl/1_utilities_test.d.ts.map +0 -1
  486. package/esm/tl/2_tl_reader.d.ts.map +0 -1
  487. package/esm/tl/2_tl_reader_test.d.ts.map +0 -1
  488. package/esm/tl/2_tl_writer.d.ts.map +0 -1
  489. package/esm/tl/2_tl_writer_test.d.ts.map +0 -1
  490. package/esm/tl/2_utilities.d.ts.map +0 -1
  491. package/script/client/0_message.d.ts +0 -29
  492. package/script/client/0_message.d.ts.map +0 -1
  493. package/script/client/0_message.js +0 -90
  494. package/script/client/1_client_encrypted.d.ts +0 -52
  495. package/script/client/1_client_encrypted.d.ts.map +0 -1
  496. package/script/client/1_client_encrypted.js +0 -385
  497. package/script/tl/0_api.d.ts.map +0 -1
  498. package/script/tl/0_tl_raw_reader.d.ts.map +0 -1
  499. package/script/tl/0_tl_raw_reader.js +0 -102
  500. package/script/tl/0_tl_raw_reader_test.d.ts.map +0 -1
  501. package/script/tl/0_tl_raw_writer.d.ts.map +0 -1
  502. package/script/tl/0_tl_raw_writer.js +0 -90
  503. package/script/tl/0_tl_raw_writer_test.d.ts.map +0 -1
  504. package/script/tl/1_utilities_test.d.ts.map +0 -1
  505. package/script/tl/2_tl_reader.d.ts.map +0 -1
  506. package/script/tl/2_tl_reader.js +0 -150
  507. package/script/tl/2_tl_reader_test.d.ts.map +0 -1
  508. package/script/tl/2_tl_writer.d.ts.map +0 -1
  509. package/script/tl/2_tl_writer_test.d.ts.map +0 -1
  510. package/script/tl/2_utilities.d.ts.map +0 -1
  511. package/script/tl/2_utilities.js +0 -98
@@ -48,10 +48,10 @@ class ReactionManager {
48
48
  __classPrivateFieldSet(this, _ReactionManager_c, c, "f");
49
49
  }
50
50
  canHandleUpdate(update) {
51
- return (0, _2_tl_js_1.isOneOf)(reactionManagerUpdates, update);
51
+ return _2_tl_js_1.Api.isOneOf(reactionManagerUpdates, update);
52
52
  }
53
53
  async handleUpdate(update) {
54
- if ((0, _2_tl_js_1.is)("updateBotMessageReactions", update)) {
54
+ if (_2_tl_js_1.Api.is("updateBotMessageReactions", update)) {
55
55
  const messageReactionCount = await (0, _3_types_js_1.constructMessageReactionCount)(update, __classPrivateFieldGet(this, _ReactionManager_c, "f").getEntity);
56
56
  if (messageReactionCount) {
57
57
  return { messageReactionCount };
@@ -60,7 +60,7 @@ class ReactionManager {
60
60
  return null;
61
61
  }
62
62
  }
63
- else if ((0, _2_tl_js_1.is)("updateBotMessageReaction", update)) {
63
+ else if (_2_tl_js_1.Api.is("updateBotMessageReaction", update)) {
64
64
  const messageReactions = await (0, _3_types_js_1.constructMessageReactions)(update, __classPrivateFieldGet(this, _ReactionManager_c, "f").getEntity);
65
65
  if (messageReactions) {
66
66
  return { messageReactions };
@@ -69,10 +69,10 @@ class ReactionManager {
69
69
  return null;
70
70
  }
71
71
  }
72
- else if ((0, _2_tl_js_1.is)("updateMessageReactions", update)) {
73
- const chatId = (0, _2_tl_js_1.peerToChatId)(update.peer);
72
+ else if (_2_tl_js_1.Api.is("updateMessageReactions", update)) {
73
+ const chatId = _2_tl_js_1.Api.peerToChatId(update.peer);
74
74
  const message = await __classPrivateFieldGet(this, _ReactionManager_c, "f").messageStorage.getMessage(chatId, update.msg_id);
75
- if ((0, _2_tl_js_1.is)("message", message)) {
75
+ if (_2_tl_js_1.Api.is("message", message)) {
76
76
  message.reactions = update.reactions;
77
77
  await __classPrivateFieldGet(this, _ReactionManager_c, "f").messageStorage.setMessage(chatId, update.msg_id, message);
78
78
  const views = message.views ?? 0;
@@ -85,10 +85,10 @@ class ReactionManager {
85
85
  return null;
86
86
  }
87
87
  }
88
- else if ((0, _2_tl_js_1.isOneOf)(["updateChannelMessageViews", "updateChannelMessageForwards"], update)) {
89
- const chatId = (0, _2_tl_js_1.peerToChatId)({ ...update, _: "peerChannel" });
88
+ else if (_2_tl_js_1.Api.isOneOf(["updateChannelMessageViews", "updateChannelMessageForwards"], update)) {
89
+ const chatId = _2_tl_js_1.Api.peerToChatId({ ...update, _: "peerChannel" });
90
90
  const message = await __classPrivateFieldGet(this, _ReactionManager_c, "f").messageStorage.getMessage(chatId, update.id);
91
- if ((0, _2_tl_js_1.is)("message", message)) {
91
+ if (_2_tl_js_1.Api.is("message", message)) {
92
92
  if ("views" in update) {
93
93
  message.views = update.views;
94
94
  }
@@ -1,3 +1,22 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2025 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
1
20
  import { Api } from "../2_tl.js";
2
21
  import { Translation, Update } from "../3_types.js";
3
22
  import { GetTranslationsParams } from "./0_params.js";
@@ -1 +1 @@
1
- {"version":3,"file":"2_translations_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_translations_manager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAe,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAwB,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,QAAA,MAAM,0BAA0B,sDAGtB,CAAC;AAEX,KAAK,yBAAyB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAExF,qBAAa,mBAAoB,YAAW,eAAe,CAAC,yBAAyB,CAAC;;gBAGxE,CAAC,EAAE,CAAC;IAIhB,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,yBAAyB;IAIlE,eAAe,CAAC,MAAM,CAAC,EAAE,qBAAqB;IA8F9C,YAAY,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAqB9E"}
1
+ {"version":3,"file":"2_translations_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_translations_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAwB,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,QAAA,MAAM,0BAA0B,sDAGtB,CAAC;AAEX,KAAK,yBAAyB,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAExF,qBAAa,mBAAoB,YAAW,eAAe,CAAC,yBAAyB,CAAC;;gBAGxE,CAAC,EAAE,CAAC;IAIhB,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,IAAI,yBAAyB;IAIlE,eAAe,CAAC,MAAM,CAAC,EAAE,qBAAqB;IA8F9C,YAAY,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;CAqB9E"}
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ /**
3
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
4
+ * Copyright (C) 2023-2025 Roj <https://roj.im/>
5
+ *
6
+ * This file is part of MTKruto.
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU Lesser General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ * GNU Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public License
19
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
+ */
2
21
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
22
  if (kind === "m") throw new TypeError("Private method is not writable");
4
23
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
@@ -30,7 +49,7 @@ class TranslationsManager {
30
49
  __classPrivateFieldSet(this, _TranslationsManager_c, c, "f");
31
50
  }
32
51
  canHandleUpdate(update) {
33
- return (0, _2_tl_js_1.isOneOf)(translationsManagerUpdates, update);
52
+ return _2_tl_js_1.Api.isOneOf(translationsManagerUpdates, update);
34
53
  }
35
54
  async getTranslations(params) {
36
55
  __classPrivateFieldGet(this, _TranslationsManager_c, "f").storage.assertUser("getTranslations");
@@ -48,12 +67,12 @@ class TranslationsManager {
48
67
  if (!__classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack) {
49
68
  return null;
50
69
  }
51
- if ((0, _2_tl_js_1.is)("updateLangPackTooLong", update)) {
70
+ if (_2_tl_js_1.Api.is("updateLangPackTooLong", update)) {
52
71
  await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_updateTranslations).call(this, __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, update.lang_code);
53
72
  const translations = await __classPrivateFieldGet(this, _TranslationsManager_instances, "m", _TranslationsManager_getTranslationsInner).call(this, __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, update.lang_code, true);
54
73
  return { platform: __classPrivateFieldGet(this, _TranslationsManager_c, "f").langPack, language: update.lang_code, translations };
55
74
  }
56
- else if ((0, _2_tl_js_1.is)("updateLangPack", update)) {
75
+ else if (_2_tl_js_1.Api.is("updateLangPack", update)) {
57
76
  if (!__classPrivateFieldGet(this, _TranslationsManager_c, "f").langCode) {
58
77
  return null;
59
78
  }
@@ -134,7 +153,7 @@ _TranslationsManager_c = new WeakMap(), _TranslationsManager_updateTranslationsQ
134
153
  }
135
154
  }, _TranslationsManager_applyLangPackDifference = function _TranslationsManager_applyLangPackDifference(translations, strings) {
136
155
  for (const string of strings) {
137
- if ((0, _2_tl_js_1.is)("langPackStringDeleted", string)) {
156
+ if (_2_tl_js_1.Api.is("langPackStringDeleted", string)) {
138
157
  translations = translations.filter((v) => v.key != string.key);
139
158
  }
140
159
  else {
@@ -18,7 +18,7 @@
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
20
  import { Queue } from "../1_utilities.js";
21
- import { Api, ReadObject } from "../2_tl.js";
21
+ import { Api } from "../2_tl.js";
22
22
  import { ID } from "../3_types.js";
23
23
  import { C } from "./1_types.js";
24
24
  type UpdateHandler = (update: Api.Update) => Promise<(() => Promise<unknown>)>;
@@ -34,9 +34,9 @@ export declare class UpdateManager {
34
34
  static isQtsUpdate(v: Api.Update): v is QtsUpdate;
35
35
  static isChannelPtsUpdate(v: Api.Update | Api.Updates): v is ChannelPtsUpdate;
36
36
  fetchState(source: string): Promise<void>;
37
- processChats(chats: Api.Chat[], context: ReadObject): Promise<void>;
38
- processResult(result: ReadObject): Promise<void>;
39
- processUsers(users: Api.User[], context: ReadObject): Promise<void>;
37
+ processChats(chats: Api.Chat[], context: Api.DeserializedType): Promise<void>;
38
+ processResult(result: Api.DeserializedType): Promise<void>;
39
+ processUsers(users: Api.User[], context: Api.DeserializedType): Promise<void>;
40
40
  getHandleUpdateQueue(boxId: bigint): Queue;
41
41
  processUpdates(updates: Api.Update | Api.Updates, checkGap: boolean, call?: Api.AnyObject | null, callback?: () => void): void;
42
42
  recoverUpdateGap(source: string): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"2_update_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_update_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAA4B,KAAK,EAAmB,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,GAAG,EAA4D,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvG,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,SAAS,GACjB,GAAG,CAAC,gBAAgB,GACpB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,sBAAsB,GAC1B,GAAG,CAAC,uBAAuB,GAC3B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,0BAA0B,GAC9B,GAAG,CAAC,aAAa,CAAC;AAEtB,MAAM,MAAM,gBAAgB,GACxB,GAAG,CAAC,uBAAuB,GAC3B,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,oBAAoB,CAAC;AAE7B,MAAM,MAAM,SAAS,GACjB,GAAG,CAAC,yBAAyB,GAC7B,GAAG,CAAC,qBAAqB,GACzB,GAAG,CAAC,gBAAgB,GACpB,GAAG,CAAC,qBAAqB,GACzB,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,4BAA4B,GAChC,GAAG,CAAC,kBAAkB,GACtB,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,yBAAyB,GAC7B,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,4BAA4B,GAChC,GAAG,CAAC,8BAA8B,CAAC;AAEvC,qBAAa,aAAa;;IACxB,MAAM,CAAC,QAAQ,CAAC,SAAS,KAAK;IAC9B,MAAM,CAAC,QAAQ,CAAC,WAAW,MAAM;gBAcrB,CAAC,EAAE,CAAC;IAahB,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS;IAIjD,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS;IAIjD,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC,IAAI,gBAAgB;IAuCvE,UAAU,CAAC,MAAM,EAAE,MAAM;IA6DzB,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU;IA8BnD,aAAa,CAAC,MAAM,EAAE,UAAU;IAqGhC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,UAAU;IAgCzD,oBAAoB,CAAC,KAAK,EAAE,MAAM;IA2JlC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,CAAC,SAAS,GAAG,IAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI;IAuMvH,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAsLrC,gBAAgB,CAAC,OAAO,EAAE,aAAa;IAQjC,QAAQ,CAAC,MAAM,EAAE,EAAE;IAmDnB,SAAS,CAAC,MAAM,EAAE,EAAE;IAY1B,aAAa;CAMd"}
1
+ {"version":3,"file":"2_update_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_update_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAA4B,KAAK,EAAmB,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AAEjC,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAEnC,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,KAAK,aAAa,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,SAAS,GACjB,GAAG,CAAC,gBAAgB,GACpB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,sBAAsB,GAC1B,GAAG,CAAC,uBAAuB,GAC3B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,oBAAoB,GACxB,GAAG,CAAC,iBAAiB,GACrB,GAAG,CAAC,0BAA0B,GAC9B,GAAG,CAAC,aAAa,CAAC;AAEtB,MAAM,MAAM,gBAAgB,GACxB,GAAG,CAAC,uBAAuB,GAC3B,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,oBAAoB,CAAC;AAE7B,MAAM,MAAM,SAAS,GACjB,GAAG,CAAC,yBAAyB,GAC7B,GAAG,CAAC,qBAAqB,GACzB,GAAG,CAAC,gBAAgB,GACpB,GAAG,CAAC,qBAAqB,GACzB,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,4BAA4B,GAChC,GAAG,CAAC,kBAAkB,GACtB,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,yBAAyB,GAC7B,GAAG,CAAC,wBAAwB,GAC5B,GAAG,CAAC,2BAA2B,GAC/B,GAAG,CAAC,4BAA4B,GAChC,GAAG,CAAC,8BAA8B,CAAC;AAEvC,qBAAa,aAAa;;IACxB,MAAM,CAAC,QAAQ,CAAC,SAAS,KAAK;IAC9B,MAAM,CAAC,QAAQ,CAAC,WAAW,MAAM;gBAcrB,CAAC,EAAE,CAAC;IAahB,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS;IAIjD,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS;IAIjD,MAAM,CAAC,kBAAkB,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,CAAC,IAAI,gBAAgB;IAuCvE,UAAU,CAAC,MAAM,EAAE,MAAM;IA0DzB,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,gBAAgB;IA8B7D,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB;IAqG1C,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,gBAAgB;IAgCnE,oBAAoB,CAAC,KAAK,EAAE,MAAM;IA2JlC,cAAc,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,CAAC,SAAS,GAAG,IAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI;IAsMvH,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAmLrC,gBAAgB,CAAC,OAAO,EAAE,aAAa;IAKjC,QAAQ,CAAC,MAAM,EAAE,EAAE;IAmDnB,SAAS,CAAC,MAAM,EAAE,EAAE;IAY1B,aAAa;CAMd"}
@@ -74,13 +74,13 @@ class UpdateManager {
74
74
  __classPrivateFieldSet(this, _UpdateManager_Lmin, L.branch("min"), "f");
75
75
  }
76
76
  static isPtsUpdate(v) {
77
- return (0, _2_tl_js_1.isOneOf)(["updateNewMessage", "updateDeleteMessages", "updateReadHistoryInbox", "updateReadHistoryOutbox", "updatePinnedChannelMessages", "updatePinnedMessages", "updateFolderPeers", "updateChannelWebPage", "updateEditMessage", "updateReadMessagesContents", "updateWebPage"], v);
77
+ return _2_tl_js_1.Api.isOneOf(["updateNewMessage", "updateDeleteMessages", "updateReadHistoryInbox", "updateReadHistoryOutbox", "updatePinnedChannelMessages", "updatePinnedMessages", "updateFolderPeers", "updateChannelWebPage", "updateEditMessage", "updateReadMessagesContents", "updateWebPage"], v);
78
78
  }
79
79
  static isQtsUpdate(v) {
80
- return (0, _2_tl_js_1.isOneOf)(["updateNewEncryptedMessage", "updateMessagePollVote", "updateBotStopped", "updateChatParticipant", "updateChannelParticipant", "updateBotChatInviteRequester", "updateBotChatBoost", "updateBotMessageReaction", "updateBotMessageReactions", "updateBotBusinessConnect", "updateBotNewBusinessMessage", "updateBotEditBusinessMessage", "updateBotDeleteBusinessMessage"], v);
80
+ return _2_tl_js_1.Api.isOneOf(["updateNewEncryptedMessage", "updateMessagePollVote", "updateBotStopped", "updateChatParticipant", "updateChannelParticipant", "updateBotChatInviteRequester", "updateBotChatBoost", "updateBotMessageReaction", "updateBotMessageReactions", "updateBotBusinessConnect", "updateBotNewBusinessMessage", "updateBotEditBusinessMessage", "updateBotDeleteBusinessMessage"], v);
81
81
  }
82
82
  static isChannelPtsUpdate(v) {
83
- return (0, _2_tl_js_1.isOneOf)([
83
+ return _2_tl_js_1.Api.isOneOf([
84
84
  "updateNewChannelMessage",
85
85
  "updateEditChannelMessage",
86
86
  "updateDeleteChannelMessages",
@@ -88,15 +88,12 @@ class UpdateManager {
88
88
  ], v);
89
89
  }
90
90
  async fetchState(source) {
91
- if (__classPrivateFieldGet(this, _UpdateManager_c, "f").cdn) {
92
- return;
93
- }
94
91
  let state = await __classPrivateFieldGet(this, _UpdateManager_c, "f").invoke({ _: "updates.getState" });
95
92
  const difference = await __classPrivateFieldGet(this, _UpdateManager_c, "f").invoke({ ...state, _: "updates.getDifference" });
96
- if ((0, _2_tl_js_1.is)("updates.difference", difference)) {
93
+ if (_2_tl_js_1.Api.is("updates.difference", difference)) {
97
94
  state = difference.state;
98
95
  }
99
- else if ((0, _2_tl_js_1.is)("updates.differenceSlice", difference)) {
96
+ else if (_2_tl_js_1.Api.is("updates.differenceSlice", difference)) {
100
97
  state = difference.intermediate_state;
101
98
  }
102
99
  __classPrivateFieldSet(this, _UpdateManager_updateState, state, "f");
@@ -107,14 +104,14 @@ class UpdateManager {
107
104
  }
108
105
  async processChats(chats, context) {
109
106
  for (const chat of chats) {
110
- if ((0, _2_tl_js_1.isOneOf)(["channel", "channelForbidden"], chat)) {
111
- if (!(0, _2_tl_js_1.is)("channel", chat) || !chat.min || chat.min && await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity((0, _2_tl_js_1.peerToChatId)(chat)) == null) {
107
+ if (_2_tl_js_1.Api.isOneOf(["channel", "channelForbidden"], chat)) {
108
+ if (!_2_tl_js_1.Api.is("channel", chat) || !chat.min || chat.min && await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity(_2_tl_js_1.Api.peerToChatId(chat)) == null) {
112
109
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setEntity(chat);
113
110
  }
114
- if ((0, _2_tl_js_1.is)("channel", chat) && chat.min) {
115
- const entity = await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity((0, _2_tl_js_1.peerToChatId)(chat));
116
- const senderChatId = (0, _2_tl_js_1.peerToChatId)(chat);
117
- if ((0, _2_tl_js_1.is)("channel", entity) && entity.min) {
111
+ if (_2_tl_js_1.Api.is("channel", chat) && chat.min) {
112
+ const entity = await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity(_2_tl_js_1.Api.peerToChatId(chat));
113
+ const senderChatId = _2_tl_js_1.Api.peerToChatId(chat);
114
+ if (_2_tl_js_1.Api.is("channel", entity) && entity.min) {
118
115
  for (const { chatId, senderId, messageId } of __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_extractMinPeerReferences).call(this, context)) {
119
116
  if (senderId == senderChatId) {
120
117
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setMinPeerReference(chatId, senderId, messageId);
@@ -124,19 +121,19 @@ class UpdateManager {
124
121
  }
125
122
  }
126
123
  if ("username" in chat && chat.username) {
127
- await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames((0, _2_tl_js_1.peerToChatId)(chat), [chat.username]);
124
+ await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames(_2_tl_js_1.Api.peerToChatId(chat), [chat.username]);
128
125
  }
129
126
  if ("usernames" in chat && chat.usernames) {
130
- await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames((0, _2_tl_js_1.peerToChatId)(chat), chat.usernames.map((v) => v.username));
127
+ await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames(_2_tl_js_1.Api.peerToChatId(chat), chat.usernames.map((v) => v.username));
131
128
  }
132
129
  }
133
- else if ((0, _2_tl_js_1.isOneOf)(["chat", "chatForbidden"], chat)) {
130
+ else if (_2_tl_js_1.Api.isOneOf(["chat", "chatForbidden"], chat)) {
134
131
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setEntity(chat);
135
132
  }
136
133
  }
137
134
  }
138
135
  async processResult(result) {
139
- if ((0, _2_tl_js_1.isOneOf)([
136
+ if (_2_tl_js_1.Api.isOneOf([
140
137
  "account.authorizationForm",
141
138
  "account.autoSaveSettings",
142
139
  "account.privacyRules",
@@ -216,33 +213,33 @@ class UpdateManager {
216
213
  }
217
214
  if ("messages" in result && Array.isArray(result.messages)) {
218
215
  for (const message of result.messages) {
219
- if ((0, _2_tl_js_1.is)("message", message) || (0, _2_tl_js_1.is)("messageService", message)) {
220
- await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setMessage((0, _2_tl_js_1.peerToChatId)(message.peer_id), message.id, message);
216
+ if (_2_tl_js_1.Api.is("message", message) || _2_tl_js_1.Api.is("messageService", message)) {
217
+ await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setMessage(_2_tl_js_1.Api.peerToChatId(message.peer_id), message.id, message);
221
218
  }
222
219
  }
223
220
  }
224
221
  }
225
- if ((0, _2_tl_js_1.is)("messages.messages", result)) {
222
+ if (_2_tl_js_1.Api.is("messages.messages", result)) {
226
223
  for (const message of result.messages) {
227
- if ((0, _2_tl_js_1.is)("message", message) || (0, _2_tl_js_1.is)("messageService", message)) {
228
- await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setMessage((0, _2_tl_js_1.peerToChatId)(message.peer_id), message.id, message);
224
+ if (_2_tl_js_1.Api.is("message", message) || _2_tl_js_1.Api.is("messageService", message)) {
225
+ await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setMessage(_2_tl_js_1.Api.peerToChatId(message.peer_id), message.id, message);
229
226
  }
230
227
  }
231
228
  }
232
229
  }
233
230
  async processUsers(users, context) {
234
231
  for (const user of users) {
235
- if ((0, _2_tl_js_1.is)("user", user) && user.access_hash) {
236
- if (!user.min || user.min && await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity((0, _2_tl_js_1.peerToChatId)(user)) == null) {
232
+ if (_2_tl_js_1.Api.is("user", user) && user.access_hash) {
233
+ if (!user.min || user.min && await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity(_2_tl_js_1.Api.peerToChatId(user)) == null) {
237
234
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setEntity(user);
238
235
  }
239
236
  if (user.min) {
240
237
  __classPrivateFieldGet(this, _UpdateManager_Lmin, "f").debug("encountered min user");
241
238
  }
242
- if ((0, _2_tl_js_1.is)("user", user) && user.min) {
243
- const entity = await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity((0, _2_tl_js_1.peerToChatId)(user));
244
- const userId = (0, _2_tl_js_1.peerToChatId)(user);
245
- if ((0, _2_tl_js_1.is)("user", entity) && entity.min) {
239
+ if (_2_tl_js_1.Api.is("user", user) && user.min) {
240
+ const entity = await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.getEntity(_2_tl_js_1.Api.peerToChatId(user));
241
+ const userId = _2_tl_js_1.Api.peerToChatId(user);
242
+ if (_2_tl_js_1.Api.is("user", entity) && entity.min) {
246
243
  for (const { chatId, senderId, messageId } of __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_extractMinPeerReferences).call(this, context)) {
247
244
  if (senderId == userId) {
248
245
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.setMinPeerReference(chatId, senderId, messageId);
@@ -252,10 +249,10 @@ class UpdateManager {
252
249
  }
253
250
  }
254
251
  if (user.username) {
255
- await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames((0, _2_tl_js_1.peerToChatId)(user), [user.username]);
252
+ await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames(_2_tl_js_1.Api.peerToChatId(user), [user.username]);
256
253
  }
257
254
  if (user.usernames) {
258
- await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames((0, _2_tl_js_1.peerToChatId)(user), user.usernames.map((v) => v.username));
255
+ await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.updateUsernames(_2_tl_js_1.Api.peerToChatId(user), user.usernames.map((v) => v.username));
259
256
  }
260
257
  }
261
258
  }
@@ -271,15 +268,9 @@ class UpdateManager {
271
268
  }
272
269
  }
273
270
  processUpdates(updates, checkGap, call = null, callback) {
274
- if (__classPrivateFieldGet(this, _UpdateManager_c, "f").cdn) {
275
- return;
276
- }
277
- __classPrivateFieldGet(this, _UpdateManager_processUpdatesQueue, "f").add(() => __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processUpdates).call(this, updates, checkGap, call).then(callback));
271
+ __classPrivateFieldGet(this, _UpdateManager_processUpdatesQueue, "f").add(() => __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processUpdates).call(this, updates, checkGap, call).finally(callback));
278
272
  }
279
273
  async recoverUpdateGap(source) {
280
- if (__classPrivateFieldGet(this, _UpdateManager_c, "f").cdn) {
281
- return;
282
- }
283
274
  const wasRecoveringUpdateGap = __classPrivateFieldGet(this, _UpdateManager_recoveringUpdateGap, "f");
284
275
  const unlock = await __classPrivateFieldGet(this, _UpdateManager_recoverUpdateGapMutex, "f").lock();
285
276
  if (wasRecoveringUpdateGap) {
@@ -311,7 +302,7 @@ class UpdateManager {
311
302
  throw err;
312
303
  }
313
304
  }
314
- if ((0, _2_tl_js_1.is)("updates.difference", difference) || (0, _2_tl_js_1.is)("updates.differenceSlice", difference)) {
305
+ if (_2_tl_js_1.Api.is("updates.difference", difference) || _2_tl_js_1.Api.is("updates.differenceSlice", difference)) {
315
306
  await this.processChats(difference.chats, difference);
316
307
  await this.processUsers(difference.users, difference);
317
308
  for (const message of difference.new_messages) {
@@ -320,26 +311,26 @@ class UpdateManager {
320
311
  for (const update of difference.other_updates) {
321
312
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processUpdates).call(this, update, false);
322
313
  }
323
- if ((0, _2_tl_js_1.is)("updates.difference", difference)) {
314
+ if (_2_tl_js_1.Api.is("updates.difference", difference)) {
324
315
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, difference.state);
325
316
  __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").debug("recovered from update gap");
326
317
  break;
327
318
  }
328
- else if ((0, _2_tl_js_1.is)("updates.differenceSlice", difference)) {
319
+ else if (_2_tl_js_1.Api.is("updates.differenceSlice", difference)) {
329
320
  state = difference.intermediate_state;
330
321
  }
331
322
  else {
332
323
  (0, _0_deps_js_1.unreachable)();
333
324
  }
334
325
  }
335
- else if ((0, _2_tl_js_1.is)("updates.differenceTooLong", difference)) {
326
+ else if (_2_tl_js_1.Api.is("updates.differenceTooLong", difference)) {
336
327
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").messageStorage.deleteMessages();
337
328
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").storage.removeChats(0);
338
329
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").storage.removeChats(1);
339
330
  state.pts = difference.pts;
340
331
  __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").debug("received differenceTooLong");
341
332
  }
342
- else if ((0, _2_tl_js_1.is)("updates.differenceEmpty", difference)) {
333
+ else if (_2_tl_js_1.Api.is("updates.differenceEmpty", difference)) {
343
334
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setUpdateStateDate).call(this, difference.date);
344
335
  __classPrivateFieldGet(this, _UpdateManager_LrecoverUpdateGap, "f").debug("there was no update gap");
345
336
  break;
@@ -359,9 +350,6 @@ class UpdateManager {
359
350
  }
360
351
  }
361
352
  setUpdateHandler(handler) {
362
- if (__classPrivateFieldGet(this, _UpdateManager_c, "f").cdn) {
363
- return;
364
- }
365
353
  __classPrivateFieldSet(this, _UpdateManager_updateHandler, handler, "f");
366
354
  }
367
355
  async openChat(chatId) {
@@ -373,7 +361,7 @@ class UpdateManager {
373
361
  }
374
362
  const controller = new AbortController();
375
363
  const promise = Promise.resolve().then(async () => {
376
- const logger = __classPrivateFieldGet(this, _UpdateManager_LopenChat, "f").branch((0, _2_tl_js_1.peerToChatId)(channel) + "");
364
+ const logger = __classPrivateFieldGet(this, _UpdateManager_LopenChat, "f").branch(_2_tl_js_1.Api.peerToChatId(channel) + "");
377
365
  while (true) {
378
366
  if (__classPrivateFieldGet(this, _UpdateManager_c, "f").disconnected()) {
379
367
  logger.debug("disconnected, stopping the loop");
@@ -464,28 +452,28 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
464
452
  messages.push(...__classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_extractMessages).call(this, item));
465
453
  }
466
454
  }
467
- else if ((0, _2_tl_js_1.isOneOf)(["updates", "updatesCombined"], context)) {
455
+ else if (_2_tl_js_1.Api.isOneOf(["updates", "updatesCombined"], context)) {
468
456
  messages.push(...__classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_extractMessages).call(this, context.updates));
469
457
  }
470
- else if ((0, _2_tl_js_1.isOneOf)(["updates.difference", "updates.differenceSlice", "updates.channelDifference"], context)) {
458
+ else if (_2_tl_js_1.Api.isOneOf(["updates.difference", "updates.differenceSlice", "updates.channelDifference"], context)) {
471
459
  for (const message of context.new_messages) {
472
- if ((0, _2_tl_js_1.is)("message", message)) {
460
+ if (_2_tl_js_1.Api.is("message", message)) {
473
461
  messages.push(message);
474
462
  }
475
463
  }
476
464
  messages.push(...__classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_extractMessages).call(this, context.other_updates));
477
465
  }
478
- else if ((0, _2_tl_js_1.isOneOf)(["updateNewMessage", "updateNewChannelMessage", "updateEditMessage", "updateEditChannelMessage", "updateBotNewBusinessMessage", "updateBotNewBusinessMessage"], context)) {
479
- if ((0, _2_tl_js_1.is)("message", context.message)) {
466
+ else if (_2_tl_js_1.Api.isOneOf(["updateNewMessage", "updateNewChannelMessage", "updateEditMessage", "updateEditChannelMessage", "updateBotNewBusinessMessage", "updateBotNewBusinessMessage"], context)) {
467
+ if (_2_tl_js_1.Api.is("message", context.message)) {
480
468
  messages.push(context.message);
481
469
  }
482
470
  }
483
- else if ((0, _2_tl_js_1.is)("message", context)) {
471
+ else if (_2_tl_js_1.Api.is("message", context)) {
484
472
  messages.push(context);
485
473
  }
486
474
  else if (context != null && typeof context === "object" && "messages" in context && Array.isArray(context.messages)) {
487
475
  for (const message of context.messages) {
488
- if ((0, _2_tl_js_1.is)("message", message)) {
476
+ if (_2_tl_js_1.Api.is("message", message)) {
489
477
  messages.push(message);
490
478
  }
491
479
  }
@@ -498,7 +486,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
498
486
  if (!message.from_id) {
499
487
  continue;
500
488
  }
501
- minPeerReferences.push({ chatId: (0, _2_tl_js_1.peerToChatId)(message.peer_id), senderId: (0, _2_tl_js_1.peerToChatId)(message.from_id), messageId: message.id });
489
+ minPeerReferences.push({ chatId: _2_tl_js_1.Api.peerToChatId(message.peer_id), senderId: _2_tl_js_1.Api.peerToChatId(message.from_id), messageId: message.id });
502
490
  }
503
491
  return minPeerReferences;
504
492
  }, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck = async function _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck(channelId) {
@@ -532,8 +520,8 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
532
520
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_recoverChannelUpdateGap).call(this, channelId, "processUpdates");
533
521
  }
534
522
  }, _UpdateManager_processChannelPtsUpdateInner = async function _UpdateManager_processChannelPtsUpdateInner(update, checkGap) {
535
- const channelId = (0, _2_tl_js_1.is)("updateNewChannelMessage", update) || (0, _2_tl_js_1.is)("updateEditChannelMessage", update) ? (0, _2_tl_js_1.as)("peerChannel", update.message.peer_id).channel_id : update.channel_id;
536
- if ((0, _2_tl_js_1.is)("updateChannelTooLong", update)) {
523
+ const channelId = _2_tl_js_1.Api.is("updateNewChannelMessage", update) || _2_tl_js_1.Api.is("updateEditChannelMessage", update) ? _2_tl_js_1.Api.as("peerChannel", update.message.peer_id).channel_id : update.channel_id;
524
+ if (_2_tl_js_1.Api.is("updateChannelTooLong", update)) {
537
525
  if (update.pts != undefined) {
538
526
  await __classPrivateFieldGet(this, _UpdateManager_c, "f").storage.setChannelPts(channelId, update.pts);
539
527
  }
@@ -568,7 +556,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
568
556
  }
569
557
  });
570
558
  }, _UpdateManager_processChannelPtsUpdate = function _UpdateManager_processChannelPtsUpdate(update, checkGap) {
571
- const channelId = (0, _2_tl_js_1.is)("updateNewChannelMessage", update) || (0, _2_tl_js_1.is)("updateEditChannelMessage", update) ? (0, _2_tl_js_1.as)("peerChannel", update.message.peer_id).channel_id : update.channel_id;
559
+ const channelId = _2_tl_js_1.Api.is("updateNewChannelMessage", update) || _2_tl_js_1.Api.is("updateEditChannelMessage", update) ? _2_tl_js_1.Api.as("peerChannel", update.message.peer_id).channel_id : update.channel_id;
572
560
  let queue = __classPrivateFieldGet(this, _UpdateManager_channelUpdateQueues, "f").get(channelId);
573
561
  if (queue == undefined) {
574
562
  queue = new _1_utilities_js_1.Queue(`channelUpdates-${channelId}`);
@@ -628,7 +616,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
628
616
  /// [2]: https://core.telegram.org/type/Updates
629
617
  /// [3]: https://core.telegram.org/constructor/updatesTooLong
630
618
  let updates;
631
- if ((0, _2_tl_js_1.is)("updatesCombined", updates_) || (0, _2_tl_js_1.is)("updates", updates_)) {
619
+ if (_2_tl_js_1.Api.is("updatesCombined", updates_) || _2_tl_js_1.Api.is("updates", updates_)) {
632
620
  updates = updates_.updates;
633
621
  const seq = updates_.seq;
634
622
  const seqStart = "seq_start" in updates_ ? updates_.seq_start : updates_.seq;
@@ -659,10 +647,10 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
659
647
  }
660
648
  }
661
649
  }
662
- else if ((0, _2_tl_js_1.is)("updateShort", updates_)) {
650
+ else if (_2_tl_js_1.Api.is("updateShort", updates_)) {
663
651
  updates = [updates_.update];
664
652
  }
665
- else if ((0, _2_tl_js_1.is)("updateShortMessage", updates_)) {
653
+ else if (_2_tl_js_1.Api.is("updateShortMessage", updates_)) {
666
654
  updates = [
667
655
  {
668
656
  _: "updateNewMessage",
@@ -688,7 +676,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
688
676
  },
689
677
  ];
690
678
  }
691
- else if ((0, _2_tl_js_1.is)("updateShortChatMessage", updates_)) {
679
+ else if (_2_tl_js_1.Api.is("updateShortChatMessage", updates_)) {
692
680
  updates = [
693
681
  {
694
682
  _: "updateNewMessage",
@@ -713,8 +701,8 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
713
701
  },
714
702
  ];
715
703
  }
716
- else if ((0, _2_tl_js_1.is)("updateShortSentMessage", updates_)) {
717
- if (!(0, _2_tl_js_1.is)("messages.sendMessage", call)) {
704
+ else if (_2_tl_js_1.Api.is("updateShortSentMessage", updates_)) {
705
+ if (!_2_tl_js_1.Api.is("messages.sendMessage", call)) {
718
706
  (0, _0_deps_js_1.unreachable)();
719
707
  }
720
708
  updates = [{
@@ -725,7 +713,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
725
713
  silent: call.silent,
726
714
  id: updates_.id,
727
715
  from_id: { _: "peerUser", user_id: BigInt(await __classPrivateFieldGet(this, _UpdateManager_c, "f").getSelfId()) },
728
- peer_id: (0, _2_tl_js_1.inputPeerToPeer)(call.peer),
716
+ peer_id: _2_tl_js_1.Api.inputPeerToPeer(call.peer),
729
717
  message: call.message,
730
718
  media: updates_.media,
731
719
  date: updates_.date,
@@ -737,30 +725,32 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
737
725
  pts_count: updates_.pts_count,
738
726
  }];
739
727
  }
740
- else if ((0, _2_tl_js_1.is)("updatesTooLong", updates_)) {
728
+ else if (_2_tl_js_1.Api.is("updatesTooLong", updates_)) {
741
729
  await this.recoverUpdateGap("updatesTooLong");
742
730
  return;
743
731
  }
744
- else if ((0, _2_tl_js_1.isOfEnum)("Update", updates_)) {
732
+ else if (_2_tl_js_1.Api.isOfEnum("Update", updates_)) {
745
733
  updates = [updates_];
746
734
  }
747
735
  else {
748
736
  (0, _0_deps_js_1.unreachable)();
749
737
  }
750
738
  /// We process the updates when we are sure there is no gap.
751
- if ((0, _2_tl_js_1.is)("updates", updates_) || (0, _2_tl_js_1.is)("updatesCombined", updates_)) {
739
+ if (_2_tl_js_1.Api.is("updates", updates_) || _2_tl_js_1.Api.is("updatesCombined", updates_)) {
752
740
  await this.processChats(updates_.chats, updates_);
753
741
  await this.processUsers(updates_.users, updates_);
754
742
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setUpdateStateDate).call(this, updates_.date);
755
743
  }
756
- else if ((0, _2_tl_js_1.is)("updateShort", updates_) ||
757
- (0, _2_tl_js_1.is)("updateShortMessage", updates_) ||
758
- (0, _2_tl_js_1.is)("updateShortChatMessage", updates_) ||
759
- (0, _2_tl_js_1.is)("updateShortSentMessage", updates_)) {
744
+ else if (_2_tl_js_1.Api.isOneOf([
745
+ "updateShort",
746
+ "updateShortMessage",
747
+ "updateShortChatMessage",
748
+ "updateShortSentMessage",
749
+ ], updates_)) {
760
750
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setUpdateStateDate).call(this, updates_.date);
761
751
  }
762
752
  for (const update of updates) {
763
- if ((0, _2_tl_js_1.is)("updatePtsChanged", update)) {
753
+ if (_2_tl_js_1.Api.is("updatePtsChanged", update)) {
764
754
  await this.fetchState("updatePtsChanged");
765
755
  if (__classPrivateFieldGet(this, _UpdateManager_updateState, "f")) {
766
756
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, __classPrivateFieldGet(this, _UpdateManager_updateState, "f"));
@@ -820,7 +810,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
820
810
  let pts = pts_ == null ? 1 : pts_;
821
811
  let delay = 5;
822
812
  while (true) {
823
- const { access_hash } = await __classPrivateFieldGet(this, _UpdateManager_c, "f").getInputPeer(_1_utilities_js_1.ZERO_CHANNEL_ID + -Number(channelId)).then((v) => (0, _2_tl_js_1.as)("inputPeerChannel", v));
813
+ const { access_hash } = await __classPrivateFieldGet(this, _UpdateManager_c, "f").getInputPeer(_1_utilities_js_1.ZERO_CHANNEL_ID + -Number(channelId)).then((v) => _2_tl_js_1.Api.as("inputPeerChannel", v));
824
814
  let difference;
825
815
  try {
826
816
  difference = await __classPrivateFieldGet(this, _UpdateManager_c, "f").invoke({
@@ -845,7 +835,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
845
835
  throw err;
846
836
  }
847
837
  }
848
- if ((0, _2_tl_js_1.is)("updates.channelDifference", difference)) {
838
+ if (_2_tl_js_1.Api.is("updates.channelDifference", difference)) {
849
839
  await this.processChats(difference.chats, difference);
850
840
  await this.processUsers(difference.users, difference);
851
841
  for (const message of difference.new_messages) {
@@ -858,7 +848,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
858
848
  __classPrivateFieldGet(this, _UpdateManager_LrecoverChannelUpdateGap, "f").debug(`recovered from update gap [${channelId}, ${source}]`, channelId, source);
859
849
  break;
860
850
  }
861
- else if ((0, _2_tl_js_1.is)("updates.channelDifferenceTooLong", difference)) {
851
+ else if (_2_tl_js_1.Api.is("updates.channelDifferenceTooLong", difference)) {
862
852
  // TODO: invalidate messages
863
853
  __classPrivateFieldGet(this, _UpdateManager_LrecoverChannelUpdateGap, "f").debug("received channelDifferenceTooLong");
864
854
  await this.processChats(difference.chats, difference);
@@ -866,7 +856,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
866
856
  for (const message of difference.messages) {
867
857
  await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_processUpdates).call(this, { _: "updateNewChannelMessage", message, pts: 0, pts_count: 0 }, false);
868
858
  }
869
- const pts_ = (0, _2_tl_js_1.as)("dialog", difference.dialog).pts;
859
+ const pts_ = _2_tl_js_1.Api.as("dialog", difference.dialog).pts;
870
860
  if (pts_ != undefined) {
871
861
  pts = pts_;
872
862
  }
@@ -875,7 +865,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
875
865
  }
876
866
  __classPrivateFieldGet(this, _UpdateManager_LrecoverChannelUpdateGap, "f").debug("processed channelDifferenceTooLong");
877
867
  }
878
- else if ((0, _2_tl_js_1.is)("updates.channelDifferenceEmpty", difference)) {
868
+ else if (_2_tl_js_1.Api.is("updates.channelDifferenceEmpty", difference)) {
879
869
  __classPrivateFieldGet(this, _UpdateManager_LrecoverChannelUpdateGap, "f").debug("there was no update gap");
880
870
  break;
881
871
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2025 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import { ClientEncrypted } from "./2_client_encrypted.js";
21
+ export declare class ClientEncryptedPool {
22
+ #private;
23
+ constructor(requestPerClient: number);
24
+ get size(): number;
25
+ add(client: ClientEncrypted): void;
26
+ nextClient(): ClientEncrypted;
27
+ disconnect(): void;
28
+ map(callback: (client: ClientEncrypted) => void): void;
29
+ }
30
+ //# sourceMappingURL=3_client_encrypted_pool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"3_client_encrypted_pool.d.ts","sourceRoot":"","sources":["../../src/client/3_client_encrypted_pool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,qBAAa,mBAAmB;;gBAMlB,gBAAgB,EAAE,MAAM;IAIpC,IAAI,IAAI,WAEP;IAED,GAAG,CAAC,MAAM,EAAE,eAAe;IAc3B,UAAU;IAKV,UAAU;IAMV,GAAG,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI;CAGhD"}