@mtkruto/browser 0.1.800 → 0.2.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 (660) hide show
  1. package/esm/0_deps.d.ts +2 -0
  2. package/esm/0_deps.d.ts.map +1 -1
  3. package/esm/0_deps.js +2 -1
  4. package/esm/2_tl.d.ts +7 -8
  5. package/esm/2_tl.d.ts.map +1 -1
  6. package/esm/2_tl.js +7 -8
  7. package/esm/3_errors.d.ts +519 -515
  8. package/esm/3_errors.d.ts.map +1 -1
  9. package/esm/3_errors.js +527 -512
  10. package/esm/3_transport.d.ts +1 -0
  11. package/esm/3_transport.d.ts.map +1 -1
  12. package/esm/3_transport.js +1 -0
  13. package/esm/4_constants.d.ts +0 -19
  14. package/esm/4_constants.d.ts.map +1 -1
  15. package/esm/4_constants.js +2 -1
  16. package/esm/4_errors.d.ts +7 -7
  17. package/esm/4_errors.d.ts.map +1 -1
  18. package/esm/4_errors.js +5 -5
  19. package/esm/_dnt.shims.d.ts +1 -0
  20. package/esm/_dnt.shims.d.ts.map +1 -1
  21. package/esm/client/0_client_abstract.d.ts +1 -21
  22. package/esm/client/0_client_abstract.d.ts.map +1 -1
  23. package/esm/client/0_client_abstract.js +17 -15
  24. package/esm/client/0_message.d.ts +3 -3
  25. package/esm/client/0_message.d.ts.map +1 -1
  26. package/esm/client/0_message.js +4 -20
  27. package/esm/client/0_params.d.ts +1 -1
  28. package/esm/client/0_params.d.ts.map +1 -1
  29. package/esm/client/0_password.d.ts +2 -2
  30. package/esm/client/0_password.d.ts.map +1 -1
  31. package/esm/client/0_password.js +3 -8
  32. package/esm/client/0_storage_operations.d.ts +23 -23
  33. package/esm/client/0_storage_operations.d.ts.map +1 -1
  34. package/esm/client/0_storage_operations.js +13 -12
  35. package/esm/client/0_utilities.d.ts.map +1 -1
  36. package/esm/client/0_utilities.js +13 -10
  37. package/esm/client/1_client_encrypted.d.ts +3 -5
  38. package/esm/client/1_client_encrypted.d.ts.map +1 -1
  39. package/esm/client/1_client_encrypted.js +44 -28
  40. package/esm/client/1_client_plain.d.ts +2 -2
  41. package/esm/client/1_client_plain.d.ts.map +1 -1
  42. package/esm/client/1_client_plain.js +27 -19
  43. package/esm/client/1_types.d.ts +9 -22
  44. package/esm/client/1_types.d.ts.map +1 -1
  45. package/esm/client/2_account_manager.d.ts +2 -2
  46. package/esm/client/2_account_manager.js +16 -16
  47. package/esm/client/2_bot_info_manager.d.ts.map +1 -1
  48. package/esm/client/2_bot_info_manager.js +7 -6
  49. package/esm/client/2_business_connection_manager.d.ts +3 -3
  50. package/esm/client/2_business_connection_manager.d.ts.map +1 -1
  51. package/esm/client/2_business_connection_manager.js +6 -5
  52. package/esm/client/2_file_manager.d.ts +4 -23
  53. package/esm/client/2_file_manager.d.ts.map +1 -1
  54. package/esm/client/2_file_manager.js +40 -36
  55. package/esm/client/2_reaction_manager.d.ts +3 -3
  56. package/esm/client/2_reaction_manager.d.ts.map +1 -1
  57. package/esm/client/2_reaction_manager.js +16 -10
  58. package/esm/client/2_update_manager.d.ts +11 -11
  59. package/esm/client/2_update_manager.d.ts.map +1 -1
  60. package/esm/client/2_update_manager.js +162 -160
  61. package/esm/client/3_message_manager.d.ts +8 -9
  62. package/esm/client/3_message_manager.d.ts.map +1 -1
  63. package/esm/client/3_message_manager.js +205 -474
  64. package/esm/client/3_video_chat_manager.d.ts +3 -3
  65. package/esm/client/3_video_chat_manager.d.ts.map +1 -1
  66. package/esm/client/3_video_chat_manager.js +26 -36
  67. package/esm/client/4_callback_query_manager.d.ts +3 -3
  68. package/esm/client/4_callback_query_manager.d.ts.map +1 -1
  69. package/esm/client/4_callback_query_manager.js +5 -16
  70. package/esm/client/4_chat_list_manager.d.ts +5 -4
  71. package/esm/client/4_chat_list_manager.d.ts.map +1 -1
  72. package/esm/client/4_chat_list_manager.js +56 -34
  73. package/esm/client/4_inline_query_manager.d.ts +3 -3
  74. package/esm/client/4_inline_query_manager.d.ts.map +1 -1
  75. package/esm/client/4_inline_query_manager.js +6 -15
  76. package/esm/client/4_story_manager.d.ts +3 -3
  77. package/esm/client/4_story_manager.d.ts.map +1 -1
  78. package/esm/client/4_story_manager.js +15 -32
  79. package/esm/client/5_client.d.ts +10 -12
  80. package/esm/client/5_client.d.ts.map +1 -1
  81. package/esm/client/5_client.js +60 -114
  82. package/esm/{tl/7_message.d.ts → connection/1_connection_tcp.d.ts} +14 -12
  83. package/esm/connection/1_connection_tcp.d.ts.map +1 -0
  84. package/esm/connection/1_connection_tcp.js +169 -0
  85. package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
  86. package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
  87. package/esm/deps/deno.land/std@0.224.0/io/_constants.js +4 -0
  88. package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
  89. package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
  90. package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.js +86 -0
  91. package/esm/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
  92. package/esm/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
  93. package/esm/deps/deno.land/std@0.224.0/io/types.js +3 -0
  94. package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
  95. package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
  96. package/esm/deps/deno.land/std@0.224.0/io/write_all.js +49 -0
  97. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
  98. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
  99. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +253 -0
  100. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
  101. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
  102. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +1 -0
  103. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
  104. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
  105. package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +13 -0
  106. package/esm/mod.d.ts +0 -1
  107. package/esm/mod.d.ts.map +1 -1
  108. package/esm/mod.js +0 -1
  109. package/esm/tl/0_api.d.ts +14813 -0
  110. package/esm/tl/0_api.d.ts.map +1 -0
  111. package/esm/tl/0_api.js +23222 -0
  112. package/esm/tl/1_utilities.d.ts +32 -0
  113. package/esm/tl/1_utilities.d.ts.map +1 -0
  114. package/esm/tl/1_utilities.js +65 -0
  115. package/esm/tl/2_deserialize.d.ts +23 -0
  116. package/esm/tl/2_deserialize.d.ts.map +1 -0
  117. package/esm/tl/{3_deserialize.js → 2_deserialize.js} +16 -17
  118. package/esm/tl/2_serialize.d.ts +22 -0
  119. package/esm/tl/2_serialize.d.ts.map +1 -0
  120. package/esm/tl/2_serialize.js +160 -0
  121. package/esm/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
  122. package/esm/tl/3_tl_reader.d.ts.map +1 -0
  123. package/esm/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
  124. package/esm/tl/3_utilities.d.ts +5 -5
  125. package/esm/tl/3_utilities.d.ts.map +1 -1
  126. package/esm/tl/3_utilities.js +9 -10
  127. package/esm/tl/4_rpc_result.d.ts +27 -0
  128. package/esm/tl/4_rpc_result.d.ts.map +1 -0
  129. package/esm/tl/4_rpc_result.js +28 -0
  130. package/{script/tl/5_tl_writer.d.ts → esm/tl/4_tl_writer.d.ts} +2 -2
  131. package/esm/tl/4_tl_writer.d.ts.map +1 -0
  132. package/esm/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
  133. package/esm/tl/5_message.d.ts +39 -0
  134. package/esm/tl/5_message.d.ts.map +1 -0
  135. package/esm/tl/5_message.js +98 -0
  136. package/esm/transport/3_transport_provider_tcp.d.ts +14 -0
  137. package/esm/transport/3_transport_provider_tcp.d.ts.map +1 -0
  138. package/esm/transport/3_transport_provider_tcp.js +15 -0
  139. package/esm/types/0_birthday.d.ts +2 -2
  140. package/esm/types/0_birthday.d.ts.map +1 -1
  141. package/esm/types/0_callback_query_answer.d.ts +2 -2
  142. package/esm/types/0_callback_query_answer.d.ts.map +1 -1
  143. package/esm/types/0_chat_administrator_rights.d.ts +3 -3
  144. package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
  145. package/esm/types/0_chat_administrator_rights.js +1 -11
  146. package/esm/types/0_chat_member_rights.d.ts +3 -3
  147. package/esm/types/0_chat_member_rights.d.ts.map +1 -1
  148. package/esm/types/0_chat_member_rights.js +3 -3
  149. package/esm/types/0_chat_photo.d.ts +2 -2
  150. package/esm/types/0_chat_photo.d.ts.map +1 -1
  151. package/esm/types/0_chat_photo.js +2 -2
  152. package/esm/types/0_contact.d.ts +2 -2
  153. package/esm/types/0_contact.d.ts.map +1 -1
  154. package/esm/types/0_dice.d.ts +2 -2
  155. package/esm/types/0_dice.d.ts.map +1 -1
  156. package/esm/types/0_giveaway_parameters.d.ts +2 -2
  157. package/esm/types/0_giveaway_parameters.d.ts.map +1 -1
  158. package/esm/types/0_giveaway_parameters.js +3 -3
  159. package/esm/types/0_link_preview.d.ts +2 -2
  160. package/esm/types/0_link_preview.d.ts.map +1 -1
  161. package/esm/types/0_live_stream_channel.d.ts +2 -2
  162. package/esm/types/0_live_stream_channel.d.ts.map +1 -1
  163. package/esm/types/0_location.d.ts +2 -2
  164. package/esm/types/0_location.d.ts.map +1 -1
  165. package/esm/types/0_location.js +5 -5
  166. package/esm/types/0_mask_position.d.ts +2 -2
  167. package/esm/types/0_mask_position.d.ts.map +1 -1
  168. package/esm/types/0_message_entity.d.ts +3 -3
  169. package/esm/types/0_message_entity.d.ts.map +1 -1
  170. package/esm/types/0_message_entity.js +42 -42
  171. package/esm/types/0_message_search_filter.d.ts +2 -2
  172. package/esm/types/0_message_search_filter.d.ts.map +1 -1
  173. package/esm/types/0_message_search_filter.js +14 -15
  174. package/esm/types/0_opening_hours.d.ts +2 -2
  175. package/esm/types/0_opening_hours.d.ts.map +1 -1
  176. package/esm/types/0_poll_option.d.ts +2 -2
  177. package/esm/types/0_poll_option.d.ts.map +1 -1
  178. package/esm/types/0_reaction.d.ts +3 -3
  179. package/esm/types/0_reaction.d.ts.map +1 -1
  180. package/esm/types/0_reaction.js +4 -4
  181. package/esm/types/0_restriction_reason.d.ts +2 -2
  182. package/esm/types/0_restriction_reason.d.ts.map +1 -1
  183. package/esm/types/0_thumbnail.d.ts +2 -2
  184. package/esm/types/0_thumbnail.d.ts.map +1 -1
  185. package/esm/types/0_thumbnail.js +3 -3
  186. package/esm/types/0_video_chat.d.ts +2 -2
  187. package/esm/types/0_video_chat.d.ts.map +1 -1
  188. package/esm/types/0_video_chat.js +2 -2
  189. package/esm/types/0_voice.d.ts +2 -2
  190. package/esm/types/0_voice.d.ts.map +1 -1
  191. package/esm/types/1_animation.d.ts +2 -2
  192. package/esm/types/1_animation.d.ts.map +1 -1
  193. package/esm/types/1_animation.js +2 -2
  194. package/esm/types/1_audio.d.ts +2 -2
  195. package/esm/types/1_audio.d.ts.map +1 -1
  196. package/esm/types/1_audio.js +2 -2
  197. package/esm/types/1_bot_command_scope.d.ts +9 -2
  198. package/esm/types/1_bot_command_scope.d.ts.map +1 -1
  199. package/esm/types/1_bot_command_scope.js +9 -9
  200. package/esm/types/1_chat_p.d.ts +5 -5
  201. package/esm/types/1_chat_p.d.ts.map +1 -1
  202. package/esm/types/1_chat_p.js +6 -6
  203. package/esm/types/1_document.d.ts +2 -2
  204. package/esm/types/1_document.d.ts.map +1 -1
  205. package/esm/types/1_document.js +2 -2
  206. package/esm/types/1_giveaway.d.ts +2 -2
  207. package/esm/types/1_giveaway.d.ts.map +1 -1
  208. package/esm/types/1_keyboard_button.d.ts +3 -3
  209. package/esm/types/1_keyboard_button.d.ts.map +1 -1
  210. package/esm/types/1_keyboard_button.js +18 -45
  211. package/esm/types/1_message_reaction.d.ts +2 -2
  212. package/esm/types/1_message_reaction.d.ts.map +1 -1
  213. package/esm/types/1_message_reaction.js +5 -5
  214. package/esm/types/1_photo.d.ts +5 -5
  215. package/esm/types/1_photo.d.ts.map +1 -1
  216. package/esm/types/1_photo.js +4 -4
  217. package/esm/types/1_poll.d.ts +2 -2
  218. package/esm/types/1_poll.d.ts.map +1 -1
  219. package/esm/types/1_reaction_count.d.ts +2 -2
  220. package/esm/types/1_reaction_count.d.ts.map +1 -1
  221. package/esm/types/1_reply_quote.d.ts +2 -2
  222. package/esm/types/1_reply_quote.d.ts.map +1 -1
  223. package/esm/types/1_sticker.d.ts +3 -3
  224. package/esm/types/1_sticker.d.ts.map +1 -1
  225. package/esm/types/1_sticker.js +9 -9
  226. package/esm/types/1_story_privacy.d.ts +3 -3
  227. package/esm/types/1_story_privacy.d.ts.map +1 -1
  228. package/esm/types/1_story_privacy.js +14 -14
  229. package/esm/types/1_story_reaction.d.ts +2 -2
  230. package/esm/types/1_story_reaction.d.ts.map +1 -1
  231. package/esm/types/1_user.d.ts +2 -2
  232. package/esm/types/1_user.d.ts.map +1 -1
  233. package/esm/types/1_user.js +2 -2
  234. package/esm/types/1_venue.d.ts +2 -2
  235. package/esm/types/1_venue.d.ts.map +1 -1
  236. package/esm/types/1_venue.js +2 -2
  237. package/esm/types/1_video.d.ts +2 -2
  238. package/esm/types/1_video.d.ts.map +1 -1
  239. package/esm/types/1_video.js +2 -2
  240. package/esm/types/1_video_note.d.ts +2 -2
  241. package/esm/types/1_video_note.d.ts.map +1 -1
  242. package/esm/types/1_video_note.js +2 -2
  243. package/esm/types/2_business_connection.d.ts +2 -2
  244. package/esm/types/2_business_connection.d.ts.map +1 -1
  245. package/esm/types/2_business_connection.js +1 -2
  246. package/esm/types/2_chat.d.ts +2 -2
  247. package/esm/types/2_chat.d.ts.map +1 -1
  248. package/esm/types/2_chat.js +11 -11
  249. package/esm/types/2_chat_member.d.ts +2 -2
  250. package/esm/types/2_chat_member.d.ts.map +1 -1
  251. package/esm/types/2_chat_member.js +10 -10
  252. package/esm/types/2_chosen_inline_result.d.ts +2 -2
  253. package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
  254. package/esm/types/2_chosen_inline_result.js +5 -5
  255. package/esm/types/2_game.d.ts +2 -2
  256. package/esm/types/2_game.d.ts.map +1 -1
  257. package/esm/types/2_game.js +4 -4
  258. package/esm/types/2_inactive_chat.d.ts +2 -2
  259. package/esm/types/2_inactive_chat.d.ts.map +1 -1
  260. package/esm/types/2_inactive_chat.js +2 -2
  261. package/esm/types/2_inline_keyboard_button.d.ts +3 -3
  262. package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
  263. package/esm/types/2_inline_keyboard_button.js +15 -21
  264. package/esm/types/2_inline_query.d.ts +2 -2
  265. package/esm/types/2_inline_query.d.ts.map +1 -1
  266. package/esm/types/2_inline_query.js +8 -8
  267. package/esm/types/2_invite_link.d.ts +2 -2
  268. package/esm/types/2_invite_link.d.ts.map +1 -1
  269. package/esm/types/2_invite_link.js +1 -2
  270. package/esm/types/2_message_reaction_count.d.ts +2 -2
  271. package/esm/types/2_message_reaction_count.d.ts.map +1 -1
  272. package/esm/types/2_message_reactions.d.ts +2 -2
  273. package/esm/types/2_message_reactions.d.ts.map +1 -1
  274. package/esm/types/2_message_reactions.js +2 -2
  275. package/esm/types/2_story_content.d.ts +2 -2
  276. package/esm/types/2_story_content.d.ts.map +1 -1
  277. package/esm/types/2_story_content.js +6 -6
  278. package/esm/types/2_story_interactions.d.ts +2 -2
  279. package/esm/types/2_story_interactions.d.ts.map +1 -1
  280. package/esm/types/2_story_interactive_area.d.ts +3 -3
  281. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  282. package/esm/types/2_story_interactive_area.js +19 -29
  283. package/esm/types/3_chat_member_updated.d.ts +2 -2
  284. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  285. package/esm/types/3_chat_member_updated.js +7 -7
  286. package/esm/types/3_reply_markup.d.ts +3 -3
  287. package/esm/types/3_reply_markup.d.ts.map +1 -1
  288. package/esm/types/3_reply_markup.js +12 -22
  289. package/esm/types/3_story.d.ts +2 -2
  290. package/esm/types/3_story.d.ts.map +1 -1
  291. package/esm/types/4_inline_query_result.d.ts +3 -3
  292. package/esm/types/4_inline_query_result.d.ts.map +1 -1
  293. package/esm/types/4_inline_query_result.js +53 -161
  294. package/esm/types/4_message.d.ts +3 -3
  295. package/esm/types/4_message.d.ts.map +1 -1
  296. package/esm/types/4_message.js +68 -59
  297. package/esm/types/5_callback_query.d.ts +3 -3
  298. package/esm/types/5_callback_query.d.ts.map +1 -1
  299. package/esm/types/5_callback_query.js +5 -5
  300. package/esm/types/5_chat_list_item.d.ts +3 -3
  301. package/esm/types/5_chat_list_item.d.ts.map +1 -1
  302. package/esm/types/5_chat_list_item.js +2 -2
  303. package/esm/types/5_inline_query_answer.d.ts +2 -2
  304. package/esm/types/5_inline_query_answer.d.ts.map +1 -1
  305. package/esm/types/_file_id.d.ts +2 -2
  306. package/esm/types/_file_id.d.ts.map +1 -1
  307. package/esm/types/_file_id.js +4 -4
  308. package/esm/types/_getters.d.ts +7 -7
  309. package/esm/types/_getters.d.ts.map +1 -1
  310. package/package.json +4 -1
  311. package/script/0_deps.d.ts +2 -0
  312. package/script/0_deps.d.ts.map +1 -1
  313. package/script/0_deps.js +5 -2
  314. package/script/2_tl.d.ts +7 -8
  315. package/script/2_tl.d.ts.map +1 -1
  316. package/script/2_tl.js +20 -11
  317. package/script/3_errors.d.ts +519 -515
  318. package/script/3_errors.d.ts.map +1 -1
  319. package/script/3_errors.js +543 -514
  320. package/script/3_transport.d.ts +1 -0
  321. package/script/3_transport.d.ts.map +1 -1
  322. package/script/3_transport.js +1 -0
  323. package/script/4_constants.d.ts +0 -19
  324. package/script/4_constants.d.ts.map +1 -1
  325. package/script/4_constants.js +27 -3
  326. package/script/4_errors.d.ts +7 -7
  327. package/script/4_errors.d.ts.map +1 -1
  328. package/script/4_errors.js +6 -6
  329. package/script/_dnt.shims.d.ts +1 -0
  330. package/script/_dnt.shims.d.ts.map +1 -1
  331. package/script/client/0_client_abstract.d.ts +1 -21
  332. package/script/client/0_client_abstract.d.ts.map +1 -1
  333. package/script/client/0_client_abstract.js +41 -16
  334. package/script/client/0_message.d.ts +3 -3
  335. package/script/client/0_message.d.ts.map +1 -1
  336. package/script/client/0_message.js +3 -19
  337. package/script/client/0_params.d.ts +1 -1
  338. package/script/client/0_params.d.ts.map +1 -1
  339. package/script/client/0_password.d.ts +2 -2
  340. package/script/client/0_password.d.ts.map +1 -1
  341. package/script/client/0_password.js +2 -7
  342. package/script/client/0_storage_operations.d.ts +23 -23
  343. package/script/client/0_storage_operations.d.ts.map +1 -1
  344. package/script/client/0_storage_operations.js +12 -11
  345. package/script/client/0_utilities.d.ts.map +1 -1
  346. package/script/client/0_utilities.js +12 -9
  347. package/script/client/1_client_encrypted.d.ts +3 -5
  348. package/script/client/1_client_encrypted.d.ts.map +1 -1
  349. package/script/client/1_client_encrypted.js +42 -26
  350. package/script/client/1_client_plain.d.ts +2 -2
  351. package/script/client/1_client_plain.d.ts.map +1 -1
  352. package/script/client/1_client_plain.js +25 -17
  353. package/script/client/1_types.d.ts +9 -22
  354. package/script/client/1_types.d.ts.map +1 -1
  355. package/script/client/2_account_manager.d.ts +2 -2
  356. package/script/client/2_account_manager.js +15 -15
  357. package/script/client/2_bot_info_manager.d.ts.map +1 -1
  358. package/script/client/2_bot_info_manager.js +7 -6
  359. package/script/client/2_business_connection_manager.d.ts +3 -3
  360. package/script/client/2_business_connection_manager.d.ts.map +1 -1
  361. package/script/client/2_business_connection_manager.js +5 -4
  362. package/script/client/2_file_manager.d.ts +4 -23
  363. package/script/client/2_file_manager.d.ts.map +1 -1
  364. package/script/client/2_file_manager.js +64 -37
  365. package/script/client/2_reaction_manager.d.ts +3 -3
  366. package/script/client/2_reaction_manager.d.ts.map +1 -1
  367. package/script/client/2_reaction_manager.js +15 -9
  368. package/script/client/2_update_manager.d.ts +11 -11
  369. package/script/client/2_update_manager.d.ts.map +1 -1
  370. package/script/client/2_update_manager.js +161 -159
  371. package/script/client/3_message_manager.d.ts +8 -9
  372. package/script/client/3_message_manager.d.ts.map +1 -1
  373. package/script/client/3_message_manager.js +204 -473
  374. package/script/client/3_video_chat_manager.d.ts +3 -3
  375. package/script/client/3_video_chat_manager.d.ts.map +1 -1
  376. package/script/client/3_video_chat_manager.js +25 -35
  377. package/script/client/4_callback_query_manager.d.ts +3 -3
  378. package/script/client/4_callback_query_manager.d.ts.map +1 -1
  379. package/script/client/4_callback_query_manager.js +4 -15
  380. package/script/client/4_chat_list_manager.d.ts +5 -4
  381. package/script/client/4_chat_list_manager.d.ts.map +1 -1
  382. package/script/client/4_chat_list_manager.js +54 -32
  383. package/script/client/4_inline_query_manager.d.ts +3 -3
  384. package/script/client/4_inline_query_manager.d.ts.map +1 -1
  385. package/script/client/4_inline_query_manager.js +5 -14
  386. package/script/client/4_story_manager.d.ts +3 -3
  387. package/script/client/4_story_manager.d.ts.map +1 -1
  388. package/script/client/4_story_manager.js +14 -31
  389. package/script/client/5_client.d.ts +10 -12
  390. package/script/client/5_client.d.ts.map +1 -1
  391. package/script/client/5_client.js +59 -113
  392. package/{esm/tl/6_rpc_result.d.ts → script/connection/1_connection_tcp.d.ts} +14 -10
  393. package/script/connection/1_connection_tcp.d.ts.map +1 -0
  394. package/script/connection/1_connection_tcp.js +196 -0
  395. package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
  396. package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
  397. package/script/deps/deno.land/std@0.224.0/io/_constants.js +7 -0
  398. package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
  399. package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
  400. package/script/deps/deno.land/std@0.224.0/io/iterate_reader.js +91 -0
  401. package/script/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
  402. package/script/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
  403. package/script/deps/deno.land/std@0.224.0/io/types.js +4 -0
  404. package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
  405. package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
  406. package/script/deps/deno.land/std@0.224.0/io/write_all.js +54 -0
  407. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
  408. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
  409. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +280 -0
  410. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
  411. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
  412. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +5 -0
  413. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
  414. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
  415. package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +40 -0
  416. package/script/mod.d.ts +0 -1
  417. package/script/mod.d.ts.map +1 -1
  418. package/script/mod.js +0 -1
  419. package/script/tl/0_api.d.ts +14813 -0
  420. package/script/tl/0_api.d.ts.map +1 -0
  421. package/script/tl/0_api.js +23248 -0
  422. package/script/tl/1_utilities.d.ts +32 -0
  423. package/script/tl/1_utilities.d.ts.map +1 -0
  424. package/script/tl/1_utilities.js +76 -0
  425. package/script/tl/2_deserialize.d.ts +23 -0
  426. package/script/tl/2_deserialize.d.ts.map +1 -0
  427. package/script/tl/{3_deserialize.js → 2_deserialize.js} +19 -20
  428. package/script/tl/2_serialize.d.ts +22 -0
  429. package/script/tl/2_serialize.d.ts.map +1 -0
  430. package/script/tl/2_serialize.js +164 -0
  431. package/script/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
  432. package/script/tl/3_tl_reader.d.ts.map +1 -0
  433. package/script/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
  434. package/script/tl/3_utilities.d.ts +5 -5
  435. package/script/tl/3_utilities.d.ts.map +1 -1
  436. package/script/tl/3_utilities.js +9 -10
  437. package/script/tl/4_rpc_result.d.ts +27 -0
  438. package/script/tl/4_rpc_result.d.ts.map +1 -0
  439. package/{esm/tl/8_message_container.d.ts → script/tl/4_rpc_result.js} +12 -12
  440. package/{esm/tl/5_tl_writer.d.ts → script/tl/4_tl_writer.d.ts} +2 -2
  441. package/script/tl/4_tl_writer.d.ts.map +1 -0
  442. package/script/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
  443. package/script/tl/5_message.d.ts +39 -0
  444. package/script/tl/5_message.d.ts.map +1 -0
  445. package/script/tl/5_message.js +106 -0
  446. package/script/transport/3_transport_provider_tcp.d.ts +14 -0
  447. package/script/transport/3_transport_provider_tcp.d.ts.map +1 -0
  448. package/script/transport/3_transport_provider_tcp.js +19 -0
  449. package/script/types/0_birthday.d.ts +2 -2
  450. package/script/types/0_birthday.d.ts.map +1 -1
  451. package/script/types/0_callback_query_answer.d.ts +2 -2
  452. package/script/types/0_callback_query_answer.d.ts.map +1 -1
  453. package/script/types/0_chat_administrator_rights.d.ts +3 -3
  454. package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
  455. package/script/types/0_chat_administrator_rights.js +1 -11
  456. package/script/types/0_chat_member_rights.d.ts +3 -3
  457. package/script/types/0_chat_member_rights.d.ts.map +1 -1
  458. package/script/types/0_chat_member_rights.js +3 -3
  459. package/script/types/0_chat_photo.d.ts +2 -2
  460. package/script/types/0_chat_photo.d.ts.map +1 -1
  461. package/script/types/0_chat_photo.js +1 -1
  462. package/script/types/0_contact.d.ts +2 -2
  463. package/script/types/0_contact.d.ts.map +1 -1
  464. package/script/types/0_dice.d.ts +2 -2
  465. package/script/types/0_dice.d.ts.map +1 -1
  466. package/script/types/0_giveaway_parameters.d.ts +2 -2
  467. package/script/types/0_giveaway_parameters.d.ts.map +1 -1
  468. package/script/types/0_giveaway_parameters.js +2 -2
  469. package/script/types/0_link_preview.d.ts +2 -2
  470. package/script/types/0_link_preview.d.ts.map +1 -1
  471. package/script/types/0_live_stream_channel.d.ts +2 -2
  472. package/script/types/0_live_stream_channel.d.ts.map +1 -1
  473. package/script/types/0_location.d.ts +2 -2
  474. package/script/types/0_location.d.ts.map +1 -1
  475. package/script/types/0_location.js +4 -4
  476. package/script/types/0_mask_position.d.ts +2 -2
  477. package/script/types/0_mask_position.d.ts.map +1 -1
  478. package/script/types/0_message_entity.d.ts +3 -3
  479. package/script/types/0_message_entity.d.ts.map +1 -1
  480. package/script/types/0_message_entity.js +41 -41
  481. package/script/types/0_message_search_filter.d.ts +2 -2
  482. package/script/types/0_message_search_filter.d.ts.map +1 -1
  483. package/script/types/0_message_search_filter.js +14 -15
  484. package/script/types/0_opening_hours.d.ts +2 -2
  485. package/script/types/0_opening_hours.d.ts.map +1 -1
  486. package/script/types/0_poll_option.d.ts +2 -2
  487. package/script/types/0_poll_option.d.ts.map +1 -1
  488. package/script/types/0_reaction.d.ts +3 -3
  489. package/script/types/0_reaction.d.ts.map +1 -1
  490. package/script/types/0_reaction.js +3 -3
  491. package/script/types/0_restriction_reason.d.ts +2 -2
  492. package/script/types/0_restriction_reason.d.ts.map +1 -1
  493. package/script/types/0_thumbnail.d.ts +2 -2
  494. package/script/types/0_thumbnail.d.ts.map +1 -1
  495. package/script/types/0_thumbnail.js +2 -2
  496. package/script/types/0_video_chat.d.ts +2 -2
  497. package/script/types/0_video_chat.d.ts.map +1 -1
  498. package/script/types/0_video_chat.js +1 -1
  499. package/script/types/0_voice.d.ts +2 -2
  500. package/script/types/0_voice.d.ts.map +1 -1
  501. package/script/types/1_animation.d.ts +2 -2
  502. package/script/types/1_animation.d.ts.map +1 -1
  503. package/script/types/1_animation.js +1 -1
  504. package/script/types/1_audio.d.ts +2 -2
  505. package/script/types/1_audio.d.ts.map +1 -1
  506. package/script/types/1_audio.js +1 -1
  507. package/script/types/1_bot_command_scope.d.ts +9 -2
  508. package/script/types/1_bot_command_scope.d.ts.map +1 -1
  509. package/script/types/1_bot_command_scope.js +8 -8
  510. package/script/types/1_chat_p.d.ts +5 -5
  511. package/script/types/1_chat_p.d.ts.map +1 -1
  512. package/script/types/1_chat_p.js +5 -5
  513. package/script/types/1_document.d.ts +2 -2
  514. package/script/types/1_document.d.ts.map +1 -1
  515. package/script/types/1_document.js +1 -1
  516. package/script/types/1_giveaway.d.ts +2 -2
  517. package/script/types/1_giveaway.d.ts.map +1 -1
  518. package/script/types/1_keyboard_button.d.ts +3 -3
  519. package/script/types/1_keyboard_button.d.ts.map +1 -1
  520. package/script/types/1_keyboard_button.js +17 -44
  521. package/script/types/1_message_reaction.d.ts +2 -2
  522. package/script/types/1_message_reaction.d.ts.map +1 -1
  523. package/script/types/1_message_reaction.js +4 -4
  524. package/script/types/1_photo.d.ts +5 -5
  525. package/script/types/1_photo.d.ts.map +1 -1
  526. package/script/types/1_photo.js +3 -3
  527. package/script/types/1_poll.d.ts +2 -2
  528. package/script/types/1_poll.d.ts.map +1 -1
  529. package/script/types/1_reaction_count.d.ts +2 -2
  530. package/script/types/1_reaction_count.d.ts.map +1 -1
  531. package/script/types/1_reply_quote.d.ts +2 -2
  532. package/script/types/1_reply_quote.d.ts.map +1 -1
  533. package/script/types/1_sticker.d.ts +3 -3
  534. package/script/types/1_sticker.d.ts.map +1 -1
  535. package/script/types/1_sticker.js +8 -8
  536. package/script/types/1_story_privacy.d.ts +3 -3
  537. package/script/types/1_story_privacy.d.ts.map +1 -1
  538. package/script/types/1_story_privacy.js +13 -13
  539. package/script/types/1_story_reaction.d.ts +2 -2
  540. package/script/types/1_story_reaction.d.ts.map +1 -1
  541. package/script/types/1_user.d.ts +2 -2
  542. package/script/types/1_user.d.ts.map +1 -1
  543. package/script/types/1_user.js +1 -1
  544. package/script/types/1_venue.d.ts +2 -2
  545. package/script/types/1_venue.d.ts.map +1 -1
  546. package/script/types/1_venue.js +1 -1
  547. package/script/types/1_video.d.ts +2 -2
  548. package/script/types/1_video.d.ts.map +1 -1
  549. package/script/types/1_video.js +1 -1
  550. package/script/types/1_video_note.d.ts +2 -2
  551. package/script/types/1_video_note.d.ts.map +1 -1
  552. package/script/types/1_video_note.js +1 -1
  553. package/script/types/2_business_connection.d.ts +2 -2
  554. package/script/types/2_business_connection.d.ts.map +1 -1
  555. package/script/types/2_business_connection.js +1 -2
  556. package/script/types/2_chat.d.ts +2 -2
  557. package/script/types/2_chat.d.ts.map +1 -1
  558. package/script/types/2_chat.js +10 -10
  559. package/script/types/2_chat_member.d.ts +2 -2
  560. package/script/types/2_chat_member.d.ts.map +1 -1
  561. package/script/types/2_chat_member.js +9 -9
  562. package/script/types/2_chosen_inline_result.d.ts +2 -2
  563. package/script/types/2_chosen_inline_result.d.ts.map +1 -1
  564. package/script/types/2_chosen_inline_result.js +4 -4
  565. package/script/types/2_game.d.ts +2 -2
  566. package/script/types/2_game.d.ts.map +1 -1
  567. package/script/types/2_game.js +3 -3
  568. package/script/types/2_inactive_chat.d.ts +2 -2
  569. package/script/types/2_inactive_chat.d.ts.map +1 -1
  570. package/script/types/2_inactive_chat.js +1 -1
  571. package/script/types/2_inline_keyboard_button.d.ts +3 -3
  572. package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
  573. package/script/types/2_inline_keyboard_button.js +14 -20
  574. package/script/types/2_inline_query.d.ts +2 -2
  575. package/script/types/2_inline_query.d.ts.map +1 -1
  576. package/script/types/2_inline_query.js +7 -7
  577. package/script/types/2_invite_link.d.ts +2 -2
  578. package/script/types/2_invite_link.d.ts.map +1 -1
  579. package/script/types/2_invite_link.js +1 -2
  580. package/script/types/2_message_reaction_count.d.ts +2 -2
  581. package/script/types/2_message_reaction_count.d.ts.map +1 -1
  582. package/script/types/2_message_reactions.d.ts +2 -2
  583. package/script/types/2_message_reactions.d.ts.map +1 -1
  584. package/script/types/2_message_reactions.js +1 -1
  585. package/script/types/2_story_content.d.ts +2 -2
  586. package/script/types/2_story_content.d.ts.map +1 -1
  587. package/script/types/2_story_content.js +5 -5
  588. package/script/types/2_story_interactions.d.ts +2 -2
  589. package/script/types/2_story_interactions.d.ts.map +1 -1
  590. package/script/types/2_story_interactive_area.d.ts +3 -3
  591. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  592. package/script/types/2_story_interactive_area.js +18 -28
  593. package/script/types/3_chat_member_updated.d.ts +2 -2
  594. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  595. package/script/types/3_chat_member_updated.js +6 -6
  596. package/script/types/3_reply_markup.d.ts +3 -3
  597. package/script/types/3_reply_markup.d.ts.map +1 -1
  598. package/script/types/3_reply_markup.js +11 -21
  599. package/script/types/3_story.d.ts +2 -2
  600. package/script/types/3_story.d.ts.map +1 -1
  601. package/script/types/4_inline_query_result.d.ts +3 -3
  602. package/script/types/4_inline_query_result.d.ts.map +1 -1
  603. package/script/types/4_inline_query_result.js +52 -160
  604. package/script/types/4_message.d.ts +3 -3
  605. package/script/types/4_message.d.ts.map +1 -1
  606. package/script/types/4_message.js +67 -58
  607. package/script/types/5_callback_query.d.ts +3 -3
  608. package/script/types/5_callback_query.d.ts.map +1 -1
  609. package/script/types/5_callback_query.js +4 -4
  610. package/script/types/5_chat_list_item.d.ts +3 -3
  611. package/script/types/5_chat_list_item.d.ts.map +1 -1
  612. package/script/types/5_chat_list_item.js +1 -1
  613. package/script/types/5_inline_query_answer.d.ts +2 -2
  614. package/script/types/5_inline_query_answer.d.ts.map +1 -1
  615. package/script/types/_file_id.d.ts +2 -2
  616. package/script/types/_file_id.d.ts.map +1 -1
  617. package/script/types/_file_id.js +3 -3
  618. package/script/types/_getters.d.ts +7 -7
  619. package/script/types/_getters.d.ts.map +1 -1
  620. package/esm/tl/1_tl_object.d.ts +0 -64
  621. package/esm/tl/1_tl_object.d.ts.map +0 -1
  622. package/esm/tl/1_tl_object.js +0 -221
  623. package/esm/tl/2_types.d.ts +0 -28060
  624. package/esm/tl/2_types.d.ts.map +0 -1
  625. package/esm/tl/2_types.js +0 -68685
  626. package/esm/tl/3_deserialize.d.ts +0 -23
  627. package/esm/tl/3_deserialize.d.ts.map +0 -1
  628. package/esm/tl/3_functions.d.ts +0 -14094
  629. package/esm/tl/3_functions.d.ts.map +0 -1
  630. package/esm/tl/3_functions.js +0 -28475
  631. package/esm/tl/4_tl_reader.d.ts.map +0 -1
  632. package/esm/tl/5_tl_writer.d.ts.map +0 -1
  633. package/esm/tl/6_rpc_result.d.ts.map +0 -1
  634. package/esm/tl/6_rpc_result.js +0 -49
  635. package/esm/tl/7_message.d.ts.map +0 -1
  636. package/esm/tl/7_message.js +0 -90
  637. package/esm/tl/8_message_container.d.ts.map +0 -1
  638. package/esm/tl/8_message_container.js +0 -72
  639. package/script/tl/1_tl_object.d.ts +0 -64
  640. package/script/tl/1_tl_object.d.ts.map +0 -1
  641. package/script/tl/1_tl_object.js +0 -228
  642. package/script/tl/2_types.d.ts +0 -28060
  643. package/script/tl/2_types.d.ts.map +0 -1
  644. package/script/tl/2_types.js +0 -70558
  645. package/script/tl/3_deserialize.d.ts +0 -23
  646. package/script/tl/3_deserialize.d.ts.map +0 -1
  647. package/script/tl/3_functions.d.ts +0 -14094
  648. package/script/tl/3_functions.d.ts.map +0 -1
  649. package/script/tl/3_functions.js +0 -29121
  650. package/script/tl/4_tl_reader.d.ts.map +0 -1
  651. package/script/tl/5_tl_writer.d.ts.map +0 -1
  652. package/script/tl/6_rpc_result.d.ts +0 -30
  653. package/script/tl/6_rpc_result.d.ts.map +0 -1
  654. package/script/tl/6_rpc_result.js +0 -53
  655. package/script/tl/7_message.d.ts +0 -32
  656. package/script/tl/7_message.d.ts.map +0 -1
  657. package/script/tl/7_message.js +0 -95
  658. package/script/tl/8_message_container.d.ts +0 -32
  659. package/script/tl/8_message_container.d.ts.map +0 -1
  660. package/script/tl/8_message_container.js +0 -76
@@ -189,7 +189,7 @@ class StorageOperations {
189
189
  async getChannelAccessHash(id) {
190
190
  const channel = await this.getEntity(id);
191
191
  if (channel) {
192
- if (!(channel instanceof _2_tl_js_1.types.Channel) && !(channel instanceof _2_tl_js_1.types.ChannelForbidden)) {
192
+ if (!((0, _2_tl_js_1.is)("channel", channel)) && !(0, _2_tl_js_1.is)("channelForbidden", channel)) {
193
193
  (0, _0_deps_js_1.unreachable)();
194
194
  }
195
195
  return typeof channel.access_hash === "bigint" ? channel.access_hash : null;
@@ -201,7 +201,7 @@ class StorageOperations {
201
201
  async getUserAccessHash(id) {
202
202
  const user = await this.getEntity(id);
203
203
  if (user) {
204
- if (!(user instanceof _2_tl_js_1.types.User)) {
204
+ if (!(0, _2_tl_js_1.is)("user", user)) {
205
205
  (0, _0_deps_js_1.unreachable)();
206
206
  }
207
207
  return typeof user.access_hash === "bigint" ? user.access_hash : null;
@@ -225,11 +225,12 @@ class StorageOperations {
225
225
  await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(key, null);
226
226
  }
227
227
  else {
228
- await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(key, __classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)(value[_2_tl_js_1.serialize]()) : value);
228
+ await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(key, __classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _2_tl_js_1.serialize)(value) : value);
229
229
  }
230
230
  }
231
231
  async getTlObject(keyOrBuffer) {
232
- const buffer = (keyOrBuffer instanceof Uint8Array || keyOrBuffer instanceof _2_tl_js_1.TLObject) ? keyOrBuffer : await __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(keyOrBuffer);
232
+ // @ts-ignore: TBD
233
+ const buffer = (keyOrBuffer instanceof Uint8Array || (0, _2_tl_js_1.isValidType)(keyOrBuffer)) ? keyOrBuffer : await __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(keyOrBuffer);
233
234
  if (buffer != null) {
234
235
  if (buffer instanceof Uint8Array) {
235
236
  return new _2_tl_js_1.TLReader((0, _1_utilities_js_1.rleDecode)(buffer)).readObject();
@@ -280,7 +281,7 @@ class StorageOperations {
280
281
  return __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(exports.K.updates.channelPts(channelId));
281
282
  }
282
283
  async setEntity(entity) {
283
- await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.peer((0, _2_tl_js_1.peerToChatId)(entity)), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)(entity[_2_tl_js_1.serialize]()) : entity, new Date()]);
284
+ await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.peer((0, _2_tl_js_1.peerToChatId)(entity)), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)((0, _2_tl_js_1.serialize)(entity)) : entity, new Date()]);
284
285
  }
285
286
  async getEntity(key) {
286
287
  const peer_ = await __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(exports.K.cache.peer(key));
@@ -416,7 +417,7 @@ class StorageOperations {
416
417
  await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.file(id), [partCount, chunkSize]);
417
418
  }
418
419
  async setCustomEmojiDocument(id, document) {
419
- await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.customEmojiDocument(id), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)(document[_2_tl_js_1.serialize]()) : document, new Date()]);
420
+ await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.customEmojiDocument(id), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)((0, _2_tl_js_1.serialize)(document)) : document, new Date()]);
420
421
  }
421
422
  async getCustomEmojiDocument(id) {
422
423
  const v = await __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(exports.K.cache.customEmojiDocument(id));
@@ -428,7 +429,7 @@ class StorageOperations {
428
429
  }
429
430
  }
430
431
  async setBusinessConnection(id, connection) {
431
- await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.businessConnection(id), connection == null ? null : __classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)(connection[_2_tl_js_1.serialize]()) : connection);
432
+ await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.businessConnection(id), connection == null ? null : __classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)((0, _2_tl_js_1.serialize)(connection)) : connection);
432
433
  }
433
434
  async getBusinessConnection(id) {
434
435
  const v = await __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(exports.K.cache.businessConnection(id));
@@ -440,26 +441,26 @@ class StorageOperations {
440
441
  }
441
442
  }
442
443
  async setInlineQueryAnswer(userId, chatId, query, offset, results, date) {
443
- await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.inlineQueryAnswer(userId, chatId, query, offset), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)(results[_2_tl_js_1.serialize]()) : results, date]);
444
+ await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.inlineQueryAnswer(userId, chatId, query, offset), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)((0, _2_tl_js_1.serialize)(results)) : results, date]);
444
445
  }
445
446
  async getInlineQueryAnswer(userId, chatId, query, offset) {
446
447
  const peer_ = await __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(exports.K.cache.inlineQueryAnswer(userId, chatId, query, offset));
447
448
  if (peer_ != null) {
448
449
  const [obj_, date] = peer_;
449
- return [await this.getTlObject(obj_), date];
450
+ return [(0, _2_tl_js_1.as)("messages.botResults", await this.getTlObject(obj_)), date];
450
451
  }
451
452
  else {
452
453
  return null;
453
454
  }
454
455
  }
455
456
  async setCallbackQueryAnswer(chatId, messageId, question, answer) {
456
- await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.callbackQueryAnswer(chatId, messageId, question), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)(answer[_2_tl_js_1.serialize]()) : answer, new Date()]);
457
+ await __classPrivateFieldGet(this, _StorageOperations_storage, "f").set(exports.K.cache.callbackQueryAnswer(chatId, messageId, question), [__classPrivateFieldGet(this, _StorageOperations_mustSerialize, "f") ? (0, _1_utilities_js_1.rleEncode)((0, _2_tl_js_1.serialize)(answer)) : answer, new Date()]);
457
458
  }
458
459
  async getCallbackQueryAnswer(chatId, messageId, question) {
459
460
  const peer_ = await __classPrivateFieldGet(this, _StorageOperations_storage, "f").get(exports.K.cache.callbackQueryAnswer(chatId, messageId, question));
460
461
  if (peer_ != null) {
461
462
  const [obj_, date] = peer_;
462
- return [await this.getTlObject(obj_), date];
463
+ return [(0, _2_tl_js_1.as)("messages.botCallbackAnswer", await this.getTlObject(obj_)), date];
463
464
  }
464
465
  else {
465
466
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/client/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,eAAO,MAAM,OAAO,qBAA0B,CAAC;AAE/C,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,WAMvC;AAsCD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,UAyBzC;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,SAS7C;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,UAK/C;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,UAK3C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,QAI7C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAIlE;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,QAI9C;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,QAI5C;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,WAU/C"}
1
+ {"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/client/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,eAAO,MAAM,OAAO,qBAA0B,CAAC;AAE/C,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,WAMvC;AAsCD,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,UAyBzC;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,SAS7C;AAED,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,UAK/C;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,UAK3C;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,QAI7C;AAED,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,QAIlE;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,QAI9C;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,QAI5C;AAaD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,WAE/C"}
@@ -147,15 +147,18 @@ function checkInlineQueryId(id) {
147
147
  }
148
148
  }
149
149
  exports.checkInlineQueryId = checkInlineQueryId;
150
+ const MTPROTO_FUNCTIONS = [
151
+ "ping",
152
+ "ping_delay_disconnect",
153
+ "req_pq_multi",
154
+ "rpc_drop_answer",
155
+ "get_future_salts",
156
+ "destroy_session",
157
+ "destroy_auth_key",
158
+ "req_DH_params",
159
+ "set_client_DH_params",
160
+ ];
150
161
  function isMtprotoFunction(value) {
151
- return value instanceof _2_tl_js_1.functions.ping ||
152
- value instanceof _2_tl_js_1.functions.ping_delay_disconnect ||
153
- value instanceof _2_tl_js_1.functions.req_pq_multi ||
154
- value instanceof _2_tl_js_1.functions.rpc_drop_answer ||
155
- value instanceof _2_tl_js_1.functions.get_future_salts ||
156
- value instanceof _2_tl_js_1.functions.destroy_session ||
157
- value instanceof _2_tl_js_1.functions.destroy_auth_key ||
158
- value instanceof _2_tl_js_1.functions.req_DH_params ||
159
- value instanceof _2_tl_js_1.functions.set_client_DH_params;
162
+ return (0, _2_tl_js_1.isOneOf)(MTPROTO_FUNCTIONS, value);
160
163
  }
161
164
  exports.isMtprotoFunction = isMtprotoFunction;
@@ -17,13 +17,13 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import { enums, functions, ReadObject, TLObject, types } from "../2_tl.js";
20
+ import { Api, ReadObject } from "../2_tl.js";
21
21
  import { ClientAbstract } from "./0_client_abstract.js";
22
22
  import { ClientAbstractParams } from "./0_client_abstract.js";
23
23
  export type ErrorSource = "deserialization" | "decryption" | "unknown";
24
24
  export interface Handlers {
25
25
  serverSaltReassigned?: (newServerSalt: bigint) => void;
26
- updates?: (updates: enums.Updates | enums.Update, call: TLObject | null, callback?: () => void) => void;
26
+ updates?: (updates: Api.Updates | Api.Update, call: Api.AnyType | null, callback?: () => void) => void;
27
27
  result?: (result: ReadObject, callback: () => void) => void;
28
28
  error?: (err: unknown, source: ErrorSource) => void;
29
29
  }
@@ -47,8 +47,6 @@ export declare class ClientEncrypted extends ClientAbstract {
47
47
  get authKey(): Uint8Array;
48
48
  set serverSalt(serverSalt: bigint);
49
49
  get serverSalt(): bigint;
50
- invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
51
- invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, noWait: true): Promise<void>;
52
- invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, noWait?: boolean): Promise<T | void>;
50
+ invoke<T extends Api.AnyObject<P>, P extends Api.Function, R extends unknown = Promise<T["_"] extends keyof Api.Functions ? Api.ReturnType<Api.Functions[T["_"]]> : never>>(function_: T, noWait?: boolean): Promise<R | void>;
53
51
  }
54
52
  //# sourceMappingURL=1_client_encrypted.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"1_client_encrypted.d.ts","sourceRoot":"","sources":["../../src/client/1_client_encrypted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoC,UAAU,EAAsB,QAAQ,EAAY,KAAK,EAAE,MAAM,YAAY,CAAC;AAE3I,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9D,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG,YAAY,GAAG,SAAS,CAAC;AAEvE,MAAM,WAAW,QAAQ;IACvB,oBAAoB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;IACvD,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,EAAE,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IACxG,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC5D,KAAK,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,KAAK,IA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AAS,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;CAoKrO"}
@@ -98,23 +98,38 @@ class ClientEncrypted extends _0_client_abstract_js_1.ClientAbstract {
98
98
  }
99
99
  async invoke(function_, noWait) {
100
100
  const messageId = __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextMessageId).call(this);
101
- const message__ = new _2_tl_js_1.Message_(messageId, __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextSeqNo).call(this, true), function_);
102
- let message_;
101
+ let message_ = {
102
+ _: "message",
103
+ msg_id: messageId,
104
+ seqno: __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextSeqNo).call(this, true),
105
+ body: function_,
106
+ };
107
+ const message__ = message_;
103
108
  let container = undefined;
104
109
  if (__classPrivateFieldGet(this, _ClientEncrypted_toAcknowledge, "f").size) {
105
- const ack = new _2_tl_js_1.Message_(__classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextMessageId).call(this), __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextSeqNo).call(this, false), new _2_tl_js_1.types.Msgs_ack({ msg_ids: [...__classPrivateFieldGet(this, _ClientEncrypted_toAcknowledge, "f")] }));
106
- __classPrivateFieldGet(this, _ClientEncrypted_recentAcks, "f").set(ack.id, { container, message: ack });
107
- message_ = new _2_tl_js_1.MessageContainer(container = __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextMessageId).call(this), __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextSeqNo).call(this, false), [message__, ack]);
108
- }
109
- else {
110
- message_ = message__;
110
+ const ack = {
111
+ _: "message",
112
+ msg_id: __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextMessageId).call(this),
113
+ seqno: __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextSeqNo).call(this, false),
114
+ body: { _: "msgs_ack", msg_ids: [...__classPrivateFieldGet(this, _ClientEncrypted_toAcknowledge, "f")] },
115
+ };
116
+ __classPrivateFieldGet(this, _ClientEncrypted_recentAcks, "f").set(ack.msg_id, { container, message: ack });
117
+ message_ = {
118
+ _: "message",
119
+ msg_id: container = __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextMessageId).call(this),
120
+ seqno: __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_nextSeqNo).call(this, false),
121
+ body: {
122
+ _: "msg_container",
123
+ messages: [message_, ack],
124
+ },
125
+ };
111
126
  }
112
127
  await __classPrivateFieldGet(this, _ClientEncrypted_instances, "m", _ClientEncrypted_sendMessage).call(this, message_);
113
- __classPrivateFieldGet(this, _ClientEncrypted_Linvoke, "f").debug("invoked", function_[_2_tl_js_1.name]);
128
+ __classPrivateFieldGet(this, _ClientEncrypted_Linvoke, "f").debug("invoked", function_._);
114
129
  if (noWait) {
115
130
  __classPrivateFieldGet(this, _ClientEncrypted_promises, "f").set(messageId, {
116
131
  container,
117
- message: message__,
132
+ message: message_,
118
133
  call: function_,
119
134
  });
120
135
  return;
@@ -157,37 +172,37 @@ _ClientEncrypted_authKey = new WeakMap(), _ClientEncrypted_authKeyId = new WeakM
157
172
  (0, _1_utilities_js_1.drop)(this.handlers.error?.(err, "decryption"));
158
173
  continue;
159
174
  }
160
- const messages = decrypted instanceof _2_tl_js_1.MessageContainer ? decrypted.messages : [decrypted];
175
+ const messages = decrypted.body._ == "msg_container" ? decrypted.body.messages : [decrypted];
161
176
  for (const message of messages) {
162
177
  let body = message.body;
163
- if (body instanceof _2_tl_js_1.types.Gzip_packed) {
178
+ if ((0, _2_tl_js_1.is)("gzip_packed", body)) {
164
179
  body = new _2_tl_js_1.TLReader((0, _0_deps_js_1.gunzip)(body.packed_data)).readObject();
165
180
  }
166
- __classPrivateFieldGet(this, _ClientEncrypted_LreceiveLoop, "f").debug("received", (typeof body === "object" && _2_tl_js_1.name in body) ? body[_2_tl_js_1.name] : body.constructor.name);
167
- if (body instanceof _2_tl_js_1.types._Updates || body instanceof _2_tl_js_1.types._Update) {
181
+ __classPrivateFieldGet(this, _ClientEncrypted_LreceiveLoop, "f").debug("received", body._);
182
+ if ((0, _2_tl_js_1.isOfEnum)("Updates", body) || (0, _2_tl_js_1.isOfEnum)("Update", body)) {
168
183
  (0, _1_utilities_js_1.drop)(this.handlers.updates?.(body, null));
169
184
  }
170
- else if (body instanceof _2_tl_js_1.types.New_session_created) {
185
+ else if ((0, _2_tl_js_1.is)("new_session_created", body)) {
171
186
  this.serverSalt = body.server_salt;
172
187
  (0, _1_utilities_js_1.drop)(this.handlers.serverSaltReassigned?.(this.serverSalt));
173
188
  }
174
- else if (message.body instanceof _2_tl_js_1.RPCResult) {
189
+ else if (message.body._ == "rpc_result") {
175
190
  let result = message.body.result;
176
- if (result instanceof _2_tl_js_1.types.Gzip_packed) {
191
+ if ((0, _2_tl_js_1.is)("gzip_packed", result)) {
177
192
  result = new _2_tl_js_1.TLReader((0, _0_deps_js_1.gunzip)(result.packed_data)).readObject();
178
193
  }
179
- if (result instanceof _2_tl_js_1.types.Rpc_error) {
194
+ if ((0, _2_tl_js_1.is)("rpc_error", result)) {
180
195
  __classPrivateFieldGet(this, _ClientEncrypted_LreceiveLoop, "f").debug("RPCResult:", result.error_code, result.error_message);
181
196
  }
182
197
  else {
183
- __classPrivateFieldGet(this, _ClientEncrypted_LreceiveLoop, "f").debug("RPCResult:", (typeof result === "object" && _2_tl_js_1.name in result) ? result[_2_tl_js_1.name] : result.constructor.name);
198
+ __classPrivateFieldGet(this, _ClientEncrypted_LreceiveLoop, "f").debug("RPCResult:", result._);
184
199
  }
185
- const messageId = message.body.messageId;
200
+ const messageId = message.body.req_msg_id;
186
201
  const promise = __classPrivateFieldGet(this, _ClientEncrypted_promises, "f").get(messageId);
187
202
  const resolvePromise = () => {
188
203
  if (promise) {
189
- if (result instanceof _2_tl_js_1.types.Rpc_error) {
190
- promise.reject?.((0, _4_errors_js_1.upgradeInstance)(result, promise.call));
204
+ if ((0, _2_tl_js_1.is)("rpc_error", result)) {
205
+ promise.reject?.((0, _4_errors_js_1.constructTelegramError)(result, promise.call));
191
206
  }
192
207
  else {
193
208
  promise.resolve?.(result);
@@ -195,21 +210,22 @@ _ClientEncrypted_authKey = new WeakMap(), _ClientEncrypted_authKeyId = new WeakM
195
210
  __classPrivateFieldGet(this, _ClientEncrypted_promises, "f").delete(messageId);
196
211
  }
197
212
  };
198
- if (result instanceof _2_tl_js_1.types._Updates || result instanceof _2_tl_js_1.types._Update) {
213
+ if ((0, _2_tl_js_1.isOfEnum)("Updates", result) || (0, _2_tl_js_1.isOfEnum)("Update", result)) {
214
+ // @ts-ignore tbd
199
215
  (0, _1_utilities_js_1.drop)(this.handlers.updates?.(result, promise?.call ?? null, resolvePromise));
200
216
  }
201
217
  else {
202
218
  (0, _1_utilities_js_1.drop)(this.handlers.result?.(result, resolvePromise));
203
219
  }
204
220
  }
205
- else if (message.body instanceof _2_tl_js_1.types.Pong) {
221
+ else if ((0, _2_tl_js_1.is)("pong", message.body)) {
206
222
  const promise = __classPrivateFieldGet(this, _ClientEncrypted_promises, "f").get(message.body.msg_id);
207
223
  if (promise) {
208
224
  promise.resolve?.(message.body);
209
225
  __classPrivateFieldGet(this, _ClientEncrypted_promises, "f").delete(message.body.msg_id);
210
226
  }
211
227
  }
212
- else if (message.body instanceof _2_tl_js_1.types.Bad_server_salt) {
228
+ else if ((0, _2_tl_js_1.is)("bad_server_salt", message.body)) {
213
229
  __classPrivateFieldGet(this, _ClientEncrypted_LreceiveLoop, "f").debug("server salt reassigned");
214
230
  this.serverSalt = message.body.new_server_salt;
215
231
  (0, _1_utilities_js_1.drop)(this.handlers.serverSaltReassigned?.(this.serverSalt));
@@ -234,7 +250,7 @@ _ClientEncrypted_authKey = new WeakMap(), _ClientEncrypted_authKeyId = new WeakM
234
250
  }
235
251
  }
236
252
  }
237
- __classPrivateFieldGet(this, _ClientEncrypted_toAcknowledge, "f").add(message.id);
253
+ __classPrivateFieldGet(this, _ClientEncrypted_toAcknowledge, "f").add(message.msg_id);
238
254
  }
239
255
  }
240
256
  catch (err) {
@@ -17,7 +17,7 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import { functions } from "../2_tl.js";
20
+ import { Api } from "../2_tl.js";
21
21
  import { PublicKeys } from "../4_constants.js";
22
22
  import { ClientAbstract, ClientAbstractParams } from "./0_client_abstract.js";
23
23
  export interface ClientPlainParams extends ClientAbstractParams {
@@ -32,7 +32,7 @@ export interface ClientPlainParams extends ClientAbstractParams {
32
32
  export declare class ClientPlain extends ClientAbstract {
33
33
  #private;
34
34
  constructor(params?: ClientPlainParams);
35
- invoke<T extends functions.Function<unknown>>(function_: T): Promise<T["__R"]>;
35
+ invoke<T extends Api.AnyObject<P>, P extends Api.Function>(function_: T): Promise<T["_"] extends keyof Api.Functions ? Api.ReturnType<Api.Functions[T["_"]]> : never>;
36
36
  createAuthKey(): Promise<[Uint8Array, bigint]>;
37
37
  }
38
38
  //# sourceMappingURL=1_client_plain.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"1_client_plain.d.ts","sourceRoot":"","sources":["../../src/client/1_client_plain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAE,SAAS,EAA8B,MAAM,YAAY,CAAC;AACnE,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAM9E,MAAM,WAAW,iBAAkB,SAAQ,oBAAo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ateFieldGet = (this && this.__classPrivateFieldGet) || function (
29
29
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
30
30
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
31
  };
32
- var _ClientPlain_publicKeys, _ClientPlain_lastMsgId;
32
+ var _ClientPlain_publicKeys, _ClientPlain_lastMessageId;
33
33
  Object.defineProperty(exports, "__esModule", { value: true });
34
34
  exports.ClientPlain = void 0;
35
35
  const _0_deps_js_1 = require("../0_deps.js");
@@ -48,15 +48,15 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
48
48
  constructor(params) {
49
49
  super(params);
50
50
  _ClientPlain_publicKeys.set(this, void 0);
51
- _ClientPlain_lastMsgId.set(this, 0n); // TODO: refactor
51
+ _ClientPlain_lastMessageId.set(this, 0n);
52
52
  __classPrivateFieldSet(this, _ClientPlain_publicKeys, params?.publicKeys ?? _4_constants_js_1.PUBLIC_KEYS, "f");
53
53
  }
54
54
  async invoke(function_) {
55
55
  if (!this.transport) {
56
56
  throw new _0_errors_js_1.ConnectionError("Not connected.");
57
57
  }
58
- const msgId = __classPrivateFieldSet(this, _ClientPlain_lastMsgId, (0, _0_message_js_1.getMessageId)(__classPrivateFieldGet(this, _ClientPlain_lastMsgId, "f")), "f");
59
- const payload = (0, _0_message_js_1.packUnencryptedMessage)(function_[_2_tl_js_1.serialize](), msgId);
58
+ const messageId = __classPrivateFieldSet(this, _ClientPlain_lastMessageId, (0, _0_message_js_1.getMessageId)(__classPrivateFieldGet(this, _ClientPlain_lastMessageId, "f")), "f");
59
+ const payload = (0, _0_message_js_1.packUnencryptedMessage)((0, _2_tl_js_1.serialize)(function_), messageId);
60
60
  await this.transport.transport.send(payload);
61
61
  L.out(function_);
62
62
  L.outBin(payload);
@@ -79,8 +79,8 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
79
79
  for (let i = 0; i < 10; i++) {
80
80
  try {
81
81
  LcreateAuthKey.debug(`req_pq_multi [${i + 1}]`);
82
- resPq = await this.invoke(new _2_tl_js_1.functions.req_pq_multi({ nonce }));
83
- (0, _0_deps_js_1.assertInstanceOf)(resPq, _2_tl_js_1.types.ResPQ);
82
+ resPq = await this.invoke({ _: "req_pq_multi", nonce });
83
+ (0, _0_deps_js_1.assert)((0, _2_tl_js_1.is)("resPQ", resPq));
84
84
  (0, _0_deps_js_1.assertEquals)(resPq.nonce, nonce);
85
85
  LcreateAuthKey.debug("got res_pq");
86
86
  break;
@@ -116,7 +116,8 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
116
116
  const pq = resPq.pq;
117
117
  const serverNonce = resPq.server_nonce;
118
118
  const newNonce = (0, _1_utilities_js_1.getRandomBigInt)(32, false, true);
119
- let encryptedData = await (0, _1_utilities_js_1.rsaPad)(new _2_tl_js_1.types.P_q_inner_data_dc({
119
+ let encryptedData = await (0, _1_utilities_js_1.rsaPad)((0, _2_tl_js_1.serialize)({
120
+ _: "p_q_inner_data_dc",
120
121
  pq,
121
122
  p,
122
123
  q,
@@ -124,16 +125,17 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
124
125
  new_nonce: newNonce,
125
126
  nonce,
126
127
  server_nonce: serverNonce,
127
- })[_2_tl_js_1.serialize](), publicKey);
128
- const dhParams = await this.invoke(new _2_tl_js_1.functions.req_DH_params({
128
+ }), publicKey);
129
+ const dhParams = await this.invoke({
130
+ _: "req_DH_params",
129
131
  nonce,
130
132
  server_nonce: serverNonce,
131
133
  p,
132
134
  q,
133
135
  public_key_fingerprint: publicKeyFingerprint,
134
136
  encrypted_data: encryptedData,
135
- }));
136
- (0, _0_deps_js_1.assertInstanceOf)(dhParams, _2_tl_js_1.types.Server_DH_params_ok);
137
+ });
138
+ (0, _0_deps_js_1.assert)((0, _2_tl_js_1.is)("server_DH_params_ok", dhParams));
137
139
  LcreateAuthKey.debug("got server_DH_params_ok");
138
140
  const newNonce_ = (0, _1_utilities_js_1.bufferFromBigInt)(newNonce, 32, true, true);
139
141
  const serverNonce_ = (0, _1_utilities_js_1.bufferFromBigInt)(serverNonce, 16, true, true);
@@ -141,25 +143,31 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
141
143
  const tmpAesIv = (0, _0_deps_js_1.concat)([(await (0, _1_utilities_js_1.sha1)((0, _0_deps_js_1.concat)([serverNonce_, newNonce_]))).subarray(12, 12 + 8), await (0, _1_utilities_js_1.sha1)((0, _0_deps_js_1.concat)([newNonce_, newNonce_])), newNonce_.subarray(0, 0 + 4)]);
142
144
  const answerWithHash = (0, _0_deps_js_1.ige256Decrypt)(dhParams.encrypted_answer, tmpAesKey, tmpAesIv);
143
145
  const dhInnerData = new _2_tl_js_1.TLReader(answerWithHash.slice(20)).readObject();
144
- (0, _0_deps_js_1.assertInstanceOf)(dhInnerData, _2_tl_js_1.types.Server_DH_inner_data);
146
+ (0, _0_deps_js_1.assert)((0, _2_tl_js_1.is)("server_DH_inner_data", dhInnerData));
145
147
  const { g, g_a: gA_, dh_prime: dhPrime_ } = dhInnerData;
146
148
  const gA = (0, _1_utilities_js_1.bigIntFromBuffer)(gA_, false, false);
147
149
  const dhPrime = (0, _1_utilities_js_1.bigIntFromBuffer)(dhPrime_, false, false);
148
150
  const b = (0, _1_utilities_js_1.getRandomBigInt)(256, false, false);
149
151
  const gB = (0, _1_utilities_js_1.modExp)(BigInt(g), b, dhPrime);
150
- const data = new _2_tl_js_1.types.Client_DH_inner_data({
152
+ const data = (0, _2_tl_js_1.serialize)({
153
+ _: "client_DH_inner_data",
151
154
  nonce,
152
155
  server_nonce: serverNonce,
153
156
  retry_id: 0n,
154
157
  g_b: (0, _1_utilities_js_1.bufferFromBigInt)(gB, 256, false, false),
155
- })[_2_tl_js_1.serialize]();
158
+ });
156
159
  let dataWithHash = (0, _0_deps_js_1.concat)([await (0, _1_utilities_js_1.sha1)(data), data]);
157
160
  while (dataWithHash.length % 16 != 0) {
158
161
  dataWithHash = (0, _0_deps_js_1.concat)([dataWithHash, new Uint8Array(1)]);
159
162
  }
160
163
  encryptedData = (0, _0_deps_js_1.ige256Encrypt)(dataWithHash, tmpAesKey, tmpAesIv);
161
- const dhGenOk = await this.invoke(new _2_tl_js_1.functions.set_client_DH_params({ nonce, server_nonce: serverNonce, encrypted_data: encryptedData }));
162
- (0, _0_deps_js_1.assertInstanceOf)(dhGenOk, _2_tl_js_1.types.Dh_gen_ok);
164
+ const dhGenOk = await this.invoke({
165
+ _: "set_client_DH_params",
166
+ nonce,
167
+ server_nonce: serverNonce,
168
+ encrypted_data: encryptedData,
169
+ });
170
+ (0, _0_deps_js_1.assert)((0, _2_tl_js_1.is)("dh_gen_ok", dhGenOk));
163
171
  LcreateAuthKey.debug("got dh_gen_ok");
164
172
  const serverNonceSlice = serverNonce_.subarray(0, 8);
165
173
  const salt = newNonce_.subarray(0, 0 + 8).map((v, i) => v ^ serverNonceSlice[i]);
@@ -170,4 +178,4 @@ class ClientPlain extends _0_client_abstract_js_1.ClientAbstract {
170
178
  }
171
179
  }
172
180
  exports.ClientPlain = ClientPlain;
173
- _ClientPlain_publicKeys = new WeakMap(), _ClientPlain_lastMsgId = new WeakMap();
181
+ _ClientPlain_publicKeys = new WeakMap(), _ClientPlain_lastMessageId = new WeakMap();
@@ -17,30 +17,18 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
- import { enums, functions, types } from "../2_tl.js";
20
+ import { Api } from "../2_tl.js";
21
21
  import { StorageOperations } from "./0_storage_operations.js";
22
22
  import { ConnectionState, EntityGetter, ID, ParseMode, Update } from "../3_types.js";
23
- type Functions = typeof functions;
24
- type Keys = keyof Functions;
25
- type AnyFunc = (...args: any) => any;
26
- type Promisify<T extends AnyFunc> = (...args: Parameters<T>) => Promise<ReturnType<T>>;
27
- export type Api = {
28
- [K in Keys]: Functions[K] extends {
29
- __F: AnyFunc;
30
- } ? Promisify<Functions[K]["__F"]> : {
31
- [K_ in keyof Functions[K]]: Functions[K][K_] extends {
32
- __F: AnyFunc;
33
- } ? Promisify<Functions[K][K_]["__F"]> : Functions[K][K_];
34
- };
35
- };
23
+ export type Invoke = <T extends Api.AnyFunction<P>, P extends Api.Function, R extends unknown = Api.ReturnType<Api.Functions[T["_"]]>>(function_: T, businessConnectionId?: string) => Promise<R>;
36
24
  interface Connection {
37
- api: Api;
25
+ invoke: Invoke;
38
26
  connect: () => Promise<void>;
39
27
  disconnect: () => Promise<void>;
40
28
  }
41
- export interface ConnectionPool extends Omit<Connection, "api"> {
29
+ export interface ConnectionPool extends Omit<Connection, "invoke"> {
42
30
  size: number;
43
- api: () => Api;
31
+ invoke: () => Invoke;
44
32
  connect: () => Promise<void>;
45
33
  disconnect: () => Promise<void>;
46
34
  }
@@ -52,16 +40,15 @@ interface GetCdnConnectionPool {
52
40
  }
53
41
  export interface C {
54
42
  id: number;
55
- api: Api;
56
43
  storage: StorageOperations;
57
44
  messageStorage: StorageOperations;
58
45
  guaranteeUpdateDelivery: boolean;
59
46
  setConnectionState: (connectionState: ConnectionState) => void;
60
47
  resetConnectionState: () => void;
61
48
  getSelfId: () => Promise<number>;
62
- getInputPeer: (id: ID) => Promise<enums.InputPeer>;
63
- getInputChannel: (id: ID) => Promise<types.InputChannel>;
64
- getInputUser: (id: ID) => Promise<types.InputUser>;
49
+ getInputPeer: (id: ID) => Promise<Api.InputPeer>;
50
+ getInputChannel: (id: ID) => Promise<Api.inputChannel>;
51
+ getInputUser: (id: ID) => Promise<Api.inputUser>;
65
52
  getEntity: EntityGetter;
66
53
  handleUpdate: (update: Update) => void;
67
54
  parseMode: ParseMode;
@@ -70,7 +57,7 @@ export interface C {
70
57
  ignoreOutgoing: boolean | null;
71
58
  cdn: boolean;
72
59
  dropPendingUpdates?: boolean;
73
- invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, businessConnectionId: string | undefined): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
60
+ invoke: Invoke;
74
61
  }
75
62
  export {};
76
63
  //# sourceMappingURL=1_types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"1_types.d.ts","sourceRoot":"","sources":["../../src/client/1_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAErF,KAAK,SAAS,GAAG,OAAO,SAAS,CAAC;AAClC,KAAK,IAAI,GAAG,MAAM,SAAS,CAAC;AAE5B,KAAK,OAAO,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;AACrC,KAAK,SAAS,CAAC,CAAC,SAAS,OAAO,IAAI,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AACvF,MAAM,MAAM,GAAG,GAAG;KAAG,CAAC,IAAI,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS;QAAE,GAAG,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG;SAAG,EAAE,IAAI,MAAM,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS;YAAE,GAAG,EAAE,OAAO,CAAA;SAAE,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAAE;CAAE,CAAC;AAE9O,UAAU,UAAU;IACl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,MAAM,KAAK,IAAI,CAAC;IACvC,SAAS,EAAE,SAAS,CAAC;IACrB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,EAAE,oBAAoB,CAAC;IAC3C,cAAc,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,GAAG,EAAE,OAAO,CAAC;IACb,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB"}
@@ -24,8 +24,8 @@ export declare class AccountManager {
24
24
  constructor(c: C);
25
25
  showUsername(id: ID, username: string): Promise<void>;
26
26
  hideUsername(id: ID, username: string): Promise<void>;
27
- reorderUsernames(id: ID, order: string[]): Promise<boolean>;
28
- hideUsernames(id: ID): Promise<boolean>;
27
+ reorderUsernames(id: ID, order: string[]): Promise<NonNullable<boolean | undefined>>;
28
+ hideUsernames(id: ID): Promise<NonNullable<boolean | undefined>>;
29
29
  getInactiveChats(): Promise<import("../3_types.js").InactiveChat[]>;
30
30
  }
31
31
  //# sourceMappingURL=2_account_manager.d.ts.map
@@ -52,14 +52,14 @@ class AccountManager {
52
52
  async reorderUsernames(id, order) {
53
53
  await __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("reorderUsernames");
54
54
  const peer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(id);
55
- if (peer instanceof _2_tl_js_1.types.InputPeerSelf) {
56
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.account.reorderUsernames({ order });
55
+ if ((0, _2_tl_js_1.is)("inputPeerSelf", peer)) {
56
+ return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.reorderUsernames", order });
57
57
  }
58
- else if (peer instanceof _2_tl_js_1.types.InputPeerUser) {
59
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.bots.reorderUsernames({ bot: new _2_tl_js_1.types.InputUser(peer), order });
58
+ else if ((0, _2_tl_js_1.is)("inputPeerUser", peer)) {
59
+ return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "bots.reorderUsernames", bot: { ...peer, _: "inputUser" }, order });
60
60
  }
61
- else if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
62
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.reorderUsernames({ channel: new _2_tl_js_1.types.InputChannel(peer), order });
61
+ else if ((0, _2_tl_js_1.is)("inputPeerChannel", peer)) {
62
+ return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.reorderUsernames", channel: { ...peer, _: "inputChannel" }, order });
63
63
  }
64
64
  else {
65
65
  (0, _0_deps_js_1.unreachable)();
@@ -68,8 +68,8 @@ class AccountManager {
68
68
  async hideUsernames(id) {
69
69
  await __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("hideUsernames");
70
70
  const peer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(id);
71
- if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
72
- return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.deactivateAllUsernames({ channel: new _2_tl_js_1.types.InputChannel(peer) });
71
+ if ((0, _2_tl_js_1.is)("inputPeerChannel", peer)) {
72
+ return await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.deactivateAllUsernames", channel: { ...peer, _: "inputChannel" } });
73
73
  }
74
74
  else {
75
75
  (0, _0_deps_js_1.unreachable)();
@@ -77,21 +77,21 @@ class AccountManager {
77
77
  }
78
78
  async getInactiveChats() {
79
79
  await __classPrivateFieldGet(this, _AccountManager_c, "f").storage.assertUser("getInactiveChats");
80
- const { chats, dates } = await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.getInactiveChannels();
80
+ const { chats, dates } = await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.getInactiveChannels" });
81
81
  return chats.map((v, i) => (0, _3_types_js_1.constructInactiveChat)(v, dates[i]));
82
82
  }
83
83
  }
84
84
  exports.AccountManager = AccountManager;
85
85
  _AccountManager_c = new WeakMap(), _AccountManager_instances = new WeakSet(), _AccountManager_toggleUsername = async function _AccountManager_toggleUsername(id, username, active) {
86
86
  const peer = await __classPrivateFieldGet(this, _AccountManager_c, "f").getInputPeer(id);
87
- if (peer instanceof _2_tl_js_1.types.InputPeerSelf) {
88
- await __classPrivateFieldGet(this, _AccountManager_c, "f").api.account.toggleUsername({ username, active });
87
+ if ((0, _2_tl_js_1.is)("inputPeerSelf", peer)) {
88
+ await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "account.toggleUsername", username, active });
89
89
  }
90
- else if (peer instanceof _2_tl_js_1.types.InputPeerUser) {
91
- await __classPrivateFieldGet(this, _AccountManager_c, "f").api.bots.toggleUsername({ bot: new _2_tl_js_1.types.InputUser(peer), username, active });
90
+ else if ((0, _2_tl_js_1.is)("inputPeerUser", peer)) {
91
+ await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "bots.toggleUsername", bot: { ...peer, _: "inputUser" }, username, active });
92
92
  }
93
- else if (peer instanceof _2_tl_js_1.types.InputPeerChannel) {
94
- await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.toggleUsername({ channel: new _2_tl_js_1.types.InputChannel(peer), username, active });
93
+ else if ((0, _2_tl_js_1.is)("inputPeerChannel", peer)) {
94
+ await __classPrivateFieldGet(this, _AccountManager_c, "f").invoke({ _: "channels.toggleUsername", channel: { ...peer, _: "inputChannel" }, username, active });
95
95
  }
96
96
  else {
97
97
  (0, _0_deps_js_1.unreachable)();
@@ -1 +1 @@
1
- {"version":3,"file":"2_bot_info_manager.d.ts","sourceRoot":"","sources":["../../src/client/2_bot_info_manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,UAAU,EAA6B,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,qBAAa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