@mtkruto/node 0.67.1 → 0.68.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 (355) hide show
  1. package/esm/0_errors.js +2 -6
  2. package/esm/3_errors.js +2 -12
  3. package/esm/3_transport.d.ts +3 -3
  4. package/esm/3_transport.js +3 -3
  5. package/esm/3_types.d.ts +8 -7
  6. package/esm/3_types.d.ts.map +1 -1
  7. package/esm/3_types.js +8 -7
  8. package/esm/4_errors.js +2 -12
  9. package/esm/_dnt.polyfills.d.ts +99 -0
  10. package/esm/_dnt.polyfills.d.ts.map +1 -1
  11. package/esm/_dnt.polyfills.js +127 -1
  12. package/esm/_dnt.test_polyfills.d.ts.map +1 -0
  13. package/esm/client/0_filters_test.d.ts.map +1 -1
  14. package/esm/client/0_markdown_test.d.ts.map +1 -1
  15. package/esm/client/0_params.d.ts +2 -0
  16. package/esm/client/0_params.d.ts.map +1 -1
  17. package/esm/client/0_password.d.ts +5 -5
  18. package/esm/client/0_password.d.ts.map +1 -1
  19. package/esm/client/0_password_test.d.ts.map +1 -1
  20. package/esm/client/0_storage_operations.js +143 -155
  21. package/esm/client/0_storage_operations_test.d.ts.map +1 -1
  22. package/esm/client/0_utilities.d.ts +1 -1
  23. package/esm/client/0_utilities_test.d.ts.map +1 -1
  24. package/esm/client/1_client_plain.js +4 -22
  25. package/esm/client/1_composer.js +8 -21
  26. package/esm/client/2_account_manager.js +85 -97
  27. package/esm/client/2_bot_info_manager.js +26 -38
  28. package/esm/client/2_business_connection_manager.js +10 -23
  29. package/esm/client/2_client_encrypted.js +194 -211
  30. package/esm/client/2_file_manager.d.ts +4 -3
  31. package/esm/client/2_file_manager.d.ts.map +1 -1
  32. package/esm/client/2_file_manager.js +268 -224
  33. package/esm/client/2_file_manager_test.d.ts.map +1 -1
  34. package/esm/client/2_network_statistics_manager.js +8 -21
  35. package/esm/client/2_payment_manager.js +7 -20
  36. package/esm/client/2_reaction_manager.js +7 -20
  37. package/esm/client/2_translations_manager.js +97 -107
  38. package/esm/client/2_update_manager.js +764 -759
  39. package/esm/client/3_client_encrypted_pool.js +10 -26
  40. package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  41. package/esm/client/3_message_manager.d.ts +1 -1
  42. package/esm/client/3_message_manager.js +441 -448
  43. package/esm/client/3_message_manager_test.d.ts.map +1 -1
  44. package/esm/client/3_video_chat_manager.d.ts +1 -1
  45. package/esm/client/3_video_chat_manager.js +57 -68
  46. package/esm/client/4_callback_query_manager.js +18 -30
  47. package/esm/client/4_chat_list_manager.js +322 -318
  48. package/esm/client/4_chat_manager.js +118 -131
  49. package/esm/client/4_forum_manager.js +67 -73
  50. package/esm/client/4_gift_manager.js +16 -29
  51. package/esm/client/4_inline_query_manager.js +16 -28
  52. package/esm/client/4_link_preview_manager.js +6 -19
  53. package/esm/client/4_poll_manager.js +44 -57
  54. package/esm/client/4_story_manager.js +41 -53
  55. package/esm/client/5_client.d.ts +7 -0
  56. package/esm/client/5_client.d.ts.map +1 -1
  57. package/esm/client/5_client.js +1271 -1290
  58. package/esm/connection/1_connection_tcp.node.js +48 -65
  59. package/esm/connection/1_connection_web_socket.js +75 -91
  60. package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  61. package/esm/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  62. package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  63. package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  64. package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  65. package/esm/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  66. package/esm/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  67. package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  68. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  69. package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  70. package/esm/deps/jsr.io/@std/internal/1.0.10/format.js +70 -0
  71. package/esm/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  72. package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  73. package/esm/mod.js +2 -12
  74. package/esm/session/0_session_state.js +12 -38
  75. package/esm/session/1_session.js +49 -72
  76. package/esm/session/2_session_encrypted.js +324 -320
  77. package/esm/storage/1_utilities_test.d.ts.map +1 -1
  78. package/esm/storage/2_storage_indexed_db.js +26 -44
  79. package/esm/storage/2_storage_local_storage.node.js +12 -25
  80. package/esm/storage/2_storage_memory.js +24 -41
  81. package/esm/storage/2_storage_session_storage.js +3 -16
  82. package/esm/tl/0_utilities_test.d.ts.map +1 -1
  83. package/esm/tl/1_tl_reader.js +80 -88
  84. package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
  85. package/esm/tl/1_tl_writer.js +155 -164
  86. package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
  87. package/esm/tl/2_telegram.d.ts +9 -10
  88. package/esm/tl/2_telegram.d.ts.map +1 -1
  89. package/esm/tl/2_telegram.js +10 -10
  90. package/esm/transport/0_transport.js +1 -8
  91. package/esm/transport/1_transport_abridged.js +11 -24
  92. package/esm/transport/1_transport_intermediate.js +10 -23
  93. package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts} +1 -1
  94. package/esm/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  95. package/{script/transport/3_transport_provider_tcp.d.ts → esm/transport/2_transport_provider_tcp.d.ts} +2 -2
  96. package/esm/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  97. package/esm/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +1 -1
  98. package/esm/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  99. package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  100. package/esm/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +1 -1
  101. package/esm/types/0_upload_progress.d.ts +29 -0
  102. package/esm/types/0_upload_progress.d.ts.map +1 -0
  103. package/esm/types/0_upload_progress.js +20 -0
  104. package/esm/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  105. package/esm/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  106. package/esm/types/1_sticker.d.ts +1 -1
  107. package/esm/types/1_sticker.d.ts.map +1 -1
  108. package/esm/types/2_chat.d.ts.map +1 -1
  109. package/esm/types/2_poll_answer.d.ts +19 -0
  110. package/esm/types/2_poll_answer.d.ts.map +1 -1
  111. package/esm/types/2_poll_answer.js +19 -0
  112. package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
  113. package/esm/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  114. package/esm/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  115. package/esm/types/{3_reply_markup.js → 2_reply_markup.js} +1 -1
  116. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  117. package/esm/types/3_chat_member_updated.d.ts.map +1 -1
  118. package/esm/types/3_story.d.ts.map +1 -1
  119. package/esm/types/5_message.d.ts +1 -1
  120. package/esm/types/5_message.d.ts.map +1 -1
  121. package/esm/types/5_message.js +1 -1
  122. package/esm/types/6_inline_query_result.d.ts +1 -1
  123. package/esm/types/6_inline_query_result.js +1 -1
  124. package/esm/types/7_update.d.ts +21 -2
  125. package/esm/types/7_update.d.ts.map +1 -1
  126. package/esm/utilities/0_bigint_test.d.ts.map +1 -1
  127. package/esm/utilities/0_buffer.d.ts +1 -1
  128. package/esm/utilities/0_buffer.d.ts.map +1 -1
  129. package/esm/utilities/0_buffer_test.d.ts.map +1 -1
  130. package/esm/utilities/0_hash.d.ts +2 -2
  131. package/esm/utilities/0_hash.d.ts.map +1 -1
  132. package/esm/utilities/0_mutex.js +4 -19
  133. package/esm/utilities/0_part_stream.js +11 -25
  134. package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
  135. package/esm/utilities/0_rle.d.ts +2 -2
  136. package/esm/utilities/0_rle.d.ts.map +1 -1
  137. package/esm/utilities/0_rle_test.d.ts.map +1 -1
  138. package/esm/utilities/0_text.d.ts +20 -1
  139. package/esm/utilities/0_text.d.ts.map +1 -1
  140. package/esm/utilities/0_text.js +19 -0
  141. package/esm/utilities/1_auth.d.ts +1 -1
  142. package/esm/utilities/1_auth.d.ts.map +1 -1
  143. package/esm/utilities/1_base64.d.ts +1 -1
  144. package/esm/utilities/1_base64.d.ts.map +1 -1
  145. package/esm/utilities/1_base64_test.d.ts.map +1 -1
  146. package/esm/utilities/1_crypto.js +42 -53
  147. package/esm/utilities/1_crypto_test.d.ts.map +1 -1
  148. package/esm/utilities/1_logger.d.ts +2 -2
  149. package/esm/utilities/1_math_test.d.ts.map +1 -1
  150. package/esm/utilities/2_queue.js +29 -47
  151. package/package.json +1 -1
  152. package/script/0_errors.js +2 -6
  153. package/script/2_tl.js +17 -7
  154. package/script/3_errors.js +2 -12
  155. package/script/3_transport.d.ts +3 -3
  156. package/script/3_transport.js +3 -3
  157. package/script/3_types.d.ts +8 -7
  158. package/script/3_types.d.ts.map +1 -1
  159. package/script/3_types.js +8 -7
  160. package/script/4_constants.js +17 -7
  161. package/script/4_errors.js +2 -12
  162. package/script/_dnt.polyfills.d.ts +99 -0
  163. package/script/_dnt.polyfills.d.ts.map +1 -1
  164. package/script/_dnt.polyfills.js +128 -0
  165. package/script/_dnt.test_polyfills.d.ts.map +1 -0
  166. package/script/client/0_filters_test.d.ts.map +1 -1
  167. package/script/client/0_markdown_test.d.ts.map +1 -1
  168. package/script/client/0_params.d.ts +2 -0
  169. package/script/client/0_params.d.ts.map +1 -1
  170. package/script/client/0_password.d.ts +5 -5
  171. package/script/client/0_password.d.ts.map +1 -1
  172. package/script/client/0_password.js +17 -7
  173. package/script/client/0_password_test.d.ts.map +1 -1
  174. package/script/client/0_storage_operations.js +143 -155
  175. package/script/client/0_storage_operations_test.d.ts.map +1 -1
  176. package/script/client/0_utilities.d.ts +1 -1
  177. package/script/client/0_utilities_test.d.ts.map +1 -1
  178. package/script/client/1_client_plain.js +4 -22
  179. package/script/client/1_composer.js +8 -21
  180. package/script/client/2_account_manager.js +85 -97
  181. package/script/client/2_bot_info_manager.js +26 -38
  182. package/script/client/2_business_connection_manager.js +10 -23
  183. package/script/client/2_client_encrypted.js +195 -212
  184. package/script/client/2_file_manager.d.ts +4 -3
  185. package/script/client/2_file_manager.d.ts.map +1 -1
  186. package/script/client/2_file_manager.js +285 -231
  187. package/script/client/2_file_manager_test.d.ts.map +1 -1
  188. package/script/client/2_network_statistics_manager.js +8 -21
  189. package/script/client/2_payment_manager.js +7 -20
  190. package/script/client/2_reaction_manager.js +7 -20
  191. package/script/client/2_translations_manager.js +98 -108
  192. package/script/client/2_update_manager.js +764 -759
  193. package/script/client/3_client_encrypted_pool.js +10 -26
  194. package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
  195. package/script/client/3_message_manager.d.ts +1 -1
  196. package/script/client/3_message_manager.js +441 -448
  197. package/script/client/3_message_manager_test.d.ts.map +1 -1
  198. package/script/client/3_video_chat_manager.d.ts +1 -1
  199. package/script/client/3_video_chat_manager.js +57 -68
  200. package/script/client/4_callback_query_manager.js +18 -30
  201. package/script/client/4_chat_list_manager.js +322 -318
  202. package/script/client/4_chat_manager.js +118 -131
  203. package/script/client/4_forum_manager.js +67 -73
  204. package/script/client/4_gift_manager.js +16 -29
  205. package/script/client/4_inline_query_manager.js +16 -28
  206. package/script/client/4_link_preview_manager.js +6 -19
  207. package/script/client/4_poll_manager.js +44 -57
  208. package/script/client/4_story_manager.js +41 -53
  209. package/script/client/5_client.d.ts +7 -0
  210. package/script/client/5_client.d.ts.map +1 -1
  211. package/script/client/5_client.js +1271 -1290
  212. package/script/connection/1_connection_tcp.node.js +48 -65
  213. package/script/connection/1_connection_web_socket.js +92 -98
  214. package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
  215. package/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
  216. package/script/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
  217. package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
  218. package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
  219. package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
  220. package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
  221. package/script/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
  222. package/script/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
  223. package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
  224. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
  225. package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
  226. package/script/deps/jsr.io/@std/internal/1.0.10/format.js +106 -0
  227. package/script/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
  228. package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +17 -7
  229. package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
  230. package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
  231. package/script/mod.js +19 -19
  232. package/script/session/0_session_state.js +12 -38
  233. package/script/session/1_session.js +66 -79
  234. package/script/session/2_session_encrypted.js +325 -321
  235. package/script/storage/1_utilities_test.d.ts.map +1 -1
  236. package/script/storage/2_storage_indexed_db.js +26 -44
  237. package/script/storage/2_storage_local_storage.node.js +12 -25
  238. package/script/storage/2_storage_memory.js +24 -41
  239. package/script/storage/2_storage_session_storage.js +3 -16
  240. package/script/tl/0_utilities_test.d.ts.map +1 -1
  241. package/script/tl/1_tl_reader.js +81 -89
  242. package/script/tl/1_tl_reader_test.d.ts.map +1 -1
  243. package/script/tl/1_tl_writer.js +156 -165
  244. package/script/tl/1_tl_writer_test.d.ts.map +1 -1
  245. package/script/tl/2_telegram.d.ts +9 -10
  246. package/script/tl/2_telegram.d.ts.map +1 -1
  247. package/script/tl/2_telegram.js +32 -10
  248. package/script/transport/0_obfuscation.js +17 -7
  249. package/script/transport/0_transport.js +1 -8
  250. package/script/transport/1_transport_abridged.js +11 -24
  251. package/script/transport/1_transport_intermediate.js +10 -23
  252. package/{esm/transport/2_transport_provider.d.ts → script/transport/1_transport_provider.d.ts} +1 -1
  253. package/script/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
  254. package/{esm/transport/3_transport_provider_tcp.d.ts → script/transport/2_transport_provider_tcp.d.ts} +2 -2
  255. package/script/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
  256. package/script/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +3 -3
  257. package/script/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
  258. package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -0
  259. package/script/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +2 -2
  260. package/script/types/0_upload_progress.d.ts +29 -0
  261. package/script/types/0_upload_progress.d.ts.map +1 -0
  262. package/script/types/0_upload_progress.js +21 -0
  263. package/script/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
  264. package/script/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
  265. package/script/types/1_sticker.d.ts +1 -1
  266. package/script/types/1_sticker.d.ts.map +1 -1
  267. package/script/types/2_chat.d.ts.map +1 -1
  268. package/script/types/2_poll_answer.d.ts +19 -0
  269. package/script/types/2_poll_answer.d.ts.map +1 -1
  270. package/script/types/2_poll_answer.js +19 -0
  271. package/script/types/2_pre_checkout_query.d.ts.map +1 -1
  272. package/script/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
  273. package/script/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
  274. package/script/types/{3_reply_markup.js → 2_reply_markup.js} +3 -3
  275. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  276. package/script/types/3_chat_member_updated.d.ts.map +1 -1
  277. package/script/types/3_story.d.ts.map +1 -1
  278. package/script/types/5_message.d.ts +1 -1
  279. package/script/types/5_message.d.ts.map +1 -1
  280. package/script/types/5_message.js +2 -2
  281. package/script/types/6_inline_query_result.d.ts +1 -1
  282. package/script/types/6_inline_query_result.js +4 -4
  283. package/script/types/7_update.d.ts +21 -2
  284. package/script/types/7_update.d.ts.map +1 -1
  285. package/script/utilities/0_bigint.js +17 -7
  286. package/script/utilities/0_bigint_test.d.ts.map +1 -1
  287. package/script/utilities/0_buffer.d.ts +1 -1
  288. package/script/utilities/0_buffer.d.ts.map +1 -1
  289. package/script/utilities/0_buffer_test.d.ts.map +1 -1
  290. package/script/utilities/0_env.js +17 -7
  291. package/script/utilities/0_hash.d.ts +2 -2
  292. package/script/utilities/0_hash.d.ts.map +1 -1
  293. package/script/utilities/0_hash.js +17 -7
  294. package/script/utilities/0_misc.js +17 -7
  295. package/script/utilities/0_mutex.js +4 -19
  296. package/script/utilities/0_part_stream.js +11 -25
  297. package/script/utilities/0_part_stream_test.d.ts.map +1 -1
  298. package/script/utilities/0_rle.d.ts +2 -2
  299. package/script/utilities/0_rle.d.ts.map +1 -1
  300. package/script/utilities/0_rle_test.d.ts.map +1 -1
  301. package/script/utilities/0_text.d.ts +20 -1
  302. package/script/utilities/0_text.d.ts.map +1 -1
  303. package/script/utilities/0_text.js +19 -0
  304. package/script/utilities/1_auth.d.ts +1 -1
  305. package/script/utilities/1_auth.d.ts.map +1 -1
  306. package/script/utilities/1_auth.js +17 -7
  307. package/script/utilities/1_base64.d.ts +1 -1
  308. package/script/utilities/1_base64.d.ts.map +1 -1
  309. package/script/utilities/1_base64_test.d.ts.map +1 -1
  310. package/script/utilities/1_crypto.js +60 -61
  311. package/script/utilities/1_crypto_test.d.ts.map +1 -1
  312. package/script/utilities/1_logger.d.ts +2 -2
  313. package/script/utilities/1_math_test.d.ts.map +1 -1
  314. package/script/utilities/2_queue.js +30 -48
  315. package/esm/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  316. package/esm/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  317. package/esm/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  318. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  319. package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  320. package/esm/deps/jsr.io/@std/internal/1.0.9/format.js +0 -37
  321. package/esm/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  322. package/esm/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  323. package/esm/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  324. package/script/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
  325. package/script/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
  326. package/script/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
  327. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
  328. package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
  329. package/script/deps/jsr.io/@std/internal/1.0.9/format.js +0 -63
  330. package/script/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
  331. package/script/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
  332. package/script/transport/3_transport_provider_web_socket.d.ts.map +0 -1
  333. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  334. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  335. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  336. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  337. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  338. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  339. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  340. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +0 -0
  341. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  342. /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  343. /package/esm/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  344. /package/esm/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
  345. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
  346. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
  347. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
  348. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
  349. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
  350. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
  351. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
  352. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
  353. /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
  354. /package/script/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
  355. /package/script/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
@@ -19,12 +19,6 @@
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
21
  // deno-lint-ignore-file no-explicit-any
22
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
24
- 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");
25
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
26
- };
27
- var _TLWriter_instances, _TLWriter_serialize, _TLWriter_serializeVector, _TLWriter_serializePrimitive, _TLWriter_isTypeValid;
28
22
  Object.defineProperty(exports, "__esModule", { value: true });
29
23
  exports.TLWriter = void 0;
30
24
  const _0_deps_js_1 = require("../0_deps.js");
@@ -33,14 +27,8 @@ const _0_utilities_js_1 = require("./0_utilities.js");
33
27
  const _0_buffer_js_1 = require("../utilities/0_buffer.js");
34
28
  const _1_utilities_js_1 = require("../1_utilities.js");
35
29
  class TLWriter {
30
+ _buffer = new Uint8Array();
36
31
  constructor() {
37
- _TLWriter_instances.add(this);
38
- Object.defineProperty(this, "_buffer", {
39
- enumerable: true,
40
- configurable: true,
41
- writable: true,
42
- value: new Uint8Array()
43
- });
44
32
  }
45
33
  get buffer() {
46
34
  return this._buffer;
@@ -98,171 +86,174 @@ class TLWriter {
98
86
  return this;
99
87
  }
100
88
  writeObject(value, schema) {
101
- __classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, value._, value, "", schema);
89
+ this.#serialize(value._, value, "", schema);
102
90
  return this;
103
91
  }
104
- }
105
- exports.TLWriter = TLWriter;
106
- _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_serialize(type, value, debugInfo, schema) {
107
- if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializePrimitive).call(this, type, value, debugInfo)) {
108
- return;
109
- }
110
- if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializeVector).call(this, type, value, debugInfo, schema)) {
111
- return;
112
- }
113
- const maybeDefinition = schema.definitions[value._];
114
- if (!maybeDefinition) {
115
- throw new _0_tl_error_js_1.TLError(`Unknown type: ${value._}`);
116
- }
117
- if (type != "!X" && !__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_isTypeValid).call(this, type, value, schema)) {
118
- throw new _0_tl_error_js_1.TLError(`Expected ${type} but got ${value._}`);
119
- }
120
- const type__ = value;
121
- const [id, parameters_] = maybeDefinition;
122
- this.writeInt32(id, false);
123
- for (let [i, [name, type]] of parameters_.entries()) {
124
- if ((0, _0_utilities_js_1.isOptionalParam)(type) && type__[name] === undefined) {
125
- continue;
92
+ #serialize(type, value, debugInfo, schema) {
93
+ if (this.#serializePrimitive(type, value, debugInfo)) {
94
+ return;
95
+ }
96
+ if (this.#serializeVector(type, value, debugInfo, schema)) {
97
+ return;
98
+ }
99
+ const maybeDefinition = schema.definitions[value._];
100
+ if (!maybeDefinition) {
101
+ throw new _0_tl_error_js_1.TLError(`Unknown type: ${value._}`);
102
+ }
103
+ if (type != "!X" && !this.#isTypeValid(type, value, schema)) {
104
+ throw new _0_tl_error_js_1.TLError(`Expected ${type} but got ${value._}`);
126
105
  }
127
- const debugInfo = ` [0x${id.toString(16).toUpperCase()}::${i}]`;
128
- if (type == "#") {
129
- let flags = 0;
130
- const flagField_ = name;
131
- for (const [name, type] of parameters_) {
132
- if ((0, _0_utilities_js_1.isOptionalParam)(type)) {
133
- const { flagField, bitIndex } = (0, _0_utilities_js_1.analyzeOptionalParam)(type);
134
- if (flagField == flagField_) {
135
- if (type__[name] !== undefined) {
136
- flags |= 1 << bitIndex;
106
+ const type__ = value;
107
+ const [id, parameters_] = maybeDefinition;
108
+ this.writeInt32(id, false);
109
+ for (let [i, [name, type]] of parameters_.entries()) {
110
+ if ((0, _0_utilities_js_1.isOptionalParam)(type) && type__[name] === undefined) {
111
+ continue;
112
+ }
113
+ const debugInfo = ` [0x${id.toString(16).toUpperCase()}::${i}]`;
114
+ if (type == "#") {
115
+ let flags = 0;
116
+ const flagField_ = name;
117
+ for (const [name, type] of parameters_) {
118
+ if ((0, _0_utilities_js_1.isOptionalParam)(type)) {
119
+ const { flagField, bitIndex } = (0, _0_utilities_js_1.analyzeOptionalParam)(type);
120
+ if (flagField == flagField_) {
121
+ if (type__[name] !== undefined) {
122
+ flags |= 1 << bitIndex;
123
+ }
137
124
  }
138
125
  }
139
126
  }
127
+ this.writeInt32(flags);
128
+ continue;
129
+ }
130
+ if (type__[name] === undefined && !(0, _0_utilities_js_1.isOptionalParam)(type)) {
131
+ throw new Error(`Missing required parameter: ${name}`);
132
+ }
133
+ if ((0, _0_utilities_js_1.isOptionalParam)(type)) {
134
+ type = (0, _0_utilities_js_1.getOptionalParamInnerType)(type);
140
135
  }
141
- this.writeInt32(flags);
142
- continue;
136
+ this.#serialize(type, type__[name], debugInfo, schema);
143
137
  }
144
- if (type__[name] === undefined && !(0, _0_utilities_js_1.isOptionalParam)(type)) {
145
- throw new Error(`Missing required parameter: ${name}`);
138
+ return;
139
+ }
140
+ #serializeVector(type, value, debugInfo, schema) {
141
+ const itemType = (0, _0_utilities_js_1.getVectorItemType)(type);
142
+ if (!itemType) {
143
+ return false;
146
144
  }
147
- if ((0, _0_utilities_js_1.isOptionalParam)(type)) {
148
- type = (0, _0_utilities_js_1.getOptionalParamInnerType)(type);
145
+ if (!Array.isArray(value)) {
146
+ throw new TypeError(`Expected array but received ${(0, _0_utilities_js_1.repr)(value)}${debugInfo}`);
149
147
  }
150
- __classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, type, type__[name], debugInfo, schema);
151
- }
152
- return;
153
- }, _TLWriter_serializeVector = function _TLWriter_serializeVector(type, value, debugInfo, schema) {
154
- const itemType = (0, _0_utilities_js_1.getVectorItemType)(type);
155
- if (!itemType) {
156
- return false;
157
- }
158
- if (!Array.isArray(value)) {
159
- throw new TypeError(`Expected array but received ${(0, _0_utilities_js_1.repr)(value)}${debugInfo}`);
160
- }
161
- this.writeInt32(_0_utilities_js_1.VECTOR, false);
162
- this.writeInt32(value.length);
163
- for (const item of value) {
164
- __classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, itemType, item, debugInfo, schema);
148
+ this.writeInt32(_0_utilities_js_1.VECTOR, false);
149
+ this.writeInt32(value.length);
150
+ for (const item of value) {
151
+ this.#serialize(itemType, item, debugInfo, schema);
152
+ }
153
+ return true;
165
154
  }
166
- return true;
167
- }, _TLWriter_serializePrimitive = function _TLWriter_serializePrimitive(type, value, debugInfo) {
168
- const valueRepr = (0, _0_utilities_js_1.repr)(value);
169
- switch (type) {
170
- case "bytes":
171
- if ((value instanceof Uint8Array)) {
172
- this.writeBytes(value);
173
- }
174
- else {
175
- throw new _0_tl_error_js_1.TLError(`Expected Uint8Array but received ${valueRepr}${debugInfo}`);
176
- }
177
- return true;
178
- case "int128":
179
- if (typeof value === "bigint") {
180
- this.writeInt128(value);
181
- }
182
- else {
183
- throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
184
- }
185
- return true;
186
- case "int256":
187
- if (typeof value === "bigint") {
188
- this.writeInt256(value);
189
- }
190
- else {
191
- throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
192
- }
193
- return true;
194
- case "long":
195
- if (typeof value === "bigint") {
196
- this.writeInt64(value);
197
- }
198
- else {
199
- throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
200
- }
201
- return true;
202
- case "Bool":
203
- if (typeof value === "boolean") {
204
- if (value) {
205
- this.writeInt32(_0_utilities_js_1.BOOL_TRUE);
155
+ #serializePrimitive(type, value, debugInfo) {
156
+ const valueRepr = (0, _0_utilities_js_1.repr)(value);
157
+ switch (type) {
158
+ case "bytes":
159
+ if ((value instanceof Uint8Array)) {
160
+ this.writeBytes(value);
206
161
  }
207
162
  else {
208
- this.writeInt32(_0_utilities_js_1.BOOL_FALSE);
163
+ throw new _0_tl_error_js_1.TLError(`Expected Uint8Array but received ${valueRepr}${debugInfo}`);
209
164
  }
210
- }
211
- else {
212
- throw new _0_tl_error_js_1.TLError(`Expected boolean but received ${valueRepr}${debugInfo}`);
213
- }
214
- return true;
215
- case "int":
216
- //
217
- if (value == null) {
218
- value = 0;
219
- }
220
- //
221
- if (typeof value === "number") {
222
- this.writeInt32(value);
223
- }
224
- else {
225
- throw new _0_tl_error_js_1.TLError(`Expected number but received ${valueRepr}${debugInfo}`);
226
- }
227
- return true;
228
- case "double":
229
- //
230
- if (value == null) {
231
- value = 0;
232
- }
233
- //
234
- if (typeof value === "number") {
235
- this.writeDouble(value);
236
- }
237
- else {
238
- throw new _0_tl_error_js_1.TLError(`Expected number but received ${valueRepr}${debugInfo}`);
239
- }
240
- return true;
241
- case "string":
242
- if (typeof value === "string") {
243
- this.writeString(value);
244
- }
245
- else if (value instanceof Uint8Array) {
246
- this.writeBytes(value);
247
- }
248
- else {
249
- this.writeString("");
250
- }
251
- // else {
252
- // throw new TypeError(`Expected string or Uint8Array but received ${valueRepr}`);
253
- // }
254
- return true;
255
- case "true":
256
- if (value !== true) {
257
- throw new _0_tl_error_js_1.TLError(`Expected true but received ${valueRepr}${debugInfo}`);
258
- }
259
- return true;
260
- default:
261
- return false;
165
+ return true;
166
+ case "int128":
167
+ if (typeof value === "bigint") {
168
+ this.writeInt128(value);
169
+ }
170
+ else {
171
+ throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
172
+ }
173
+ return true;
174
+ case "int256":
175
+ if (typeof value === "bigint") {
176
+ this.writeInt256(value);
177
+ }
178
+ else {
179
+ throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
180
+ }
181
+ return true;
182
+ case "long":
183
+ if (typeof value === "bigint") {
184
+ this.writeInt64(value);
185
+ }
186
+ else {
187
+ throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
188
+ }
189
+ return true;
190
+ case "Bool":
191
+ if (typeof value === "boolean") {
192
+ if (value) {
193
+ this.writeInt32(_0_utilities_js_1.BOOL_TRUE);
194
+ }
195
+ else {
196
+ this.writeInt32(_0_utilities_js_1.BOOL_FALSE);
197
+ }
198
+ }
199
+ else {
200
+ throw new _0_tl_error_js_1.TLError(`Expected boolean but received ${valueRepr}${debugInfo}`);
201
+ }
202
+ return true;
203
+ case "int":
204
+ //
205
+ if (value == null) {
206
+ value = 0;
207
+ }
208
+ //
209
+ if (typeof value === "number") {
210
+ this.writeInt32(value);
211
+ }
212
+ else {
213
+ throw new _0_tl_error_js_1.TLError(`Expected number but received ${valueRepr}${debugInfo}`);
214
+ }
215
+ return true;
216
+ case "double":
217
+ //
218
+ if (value == null) {
219
+ value = 0;
220
+ }
221
+ //
222
+ if (typeof value === "number") {
223
+ this.writeDouble(value);
224
+ }
225
+ else {
226
+ throw new _0_tl_error_js_1.TLError(`Expected number but received ${valueRepr}${debugInfo}`);
227
+ }
228
+ return true;
229
+ case "string":
230
+ if (typeof value === "string") {
231
+ this.writeString(value);
232
+ }
233
+ else if (value instanceof Uint8Array) {
234
+ this.writeBytes(value);
235
+ }
236
+ else {
237
+ this.writeString("");
238
+ }
239
+ // else {
240
+ // throw new TypeError(`Expected string or Uint8Array but received ${valueRepr}`);
241
+ // }
242
+ return true;
243
+ case "true":
244
+ if (value !== true) {
245
+ throw new _0_tl_error_js_1.TLError(`Expected true but received ${valueRepr}${debugInfo}`);
246
+ }
247
+ return true;
248
+ default:
249
+ return false;
250
+ }
262
251
  }
263
- }, _TLWriter_isTypeValid = function _TLWriter_isTypeValid(type, value, schema) {
264
- if (type == value._) {
265
- return true;
252
+ #isTypeValid(type, value, schema) {
253
+ if (type == value._) {
254
+ return true;
255
+ }
256
+ return schema.definitions[value._]?.[2] === type;
266
257
  }
267
- return schema.definitions[value._]?.[2] === type;
268
- };
258
+ }
259
+ exports.TLWriter = TLWriter;
@@ -1 +1 @@
1
- {"version":3,"file":"1_tl_writer_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer_test.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"1_tl_writer_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
@@ -17,19 +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 { AnyObject, AnyType, Enums, Functions, Types } from "./1_telegram_api.js";
21
20
  import { TLReader } from "./1_tl_reader.js";
22
21
  import * as Api from "./1_telegram_api.js";
23
22
  export * from "./1_telegram_api.js";
24
- export type DeserializedType = boolean | number | bigint | string | Uint8Array | AnyType | Array<DeserializedType>;
25
- export declare function deserializeType<T extends (keyof Types) | "X" | string>(name: T, bufferOrReader: TLReader | Uint8Array): Promise<T extends keyof Types ? Types[T] : DeserializedType>;
26
- export declare function serializeObject(object: AnyObject): Uint8Array;
27
- export declare function isValidObject(object: any): object is AnyType;
28
- export declare function assertIsValidObject(object: any): asserts object is AnyType;
29
- export declare function is<S extends keyof (Types & Functions)>(name: S, value: unknown): value is S extends keyof Types ? Types[S] : S extends keyof Functions ? Functions[S] : never;
30
- export declare function isOneOf<S extends keyof (Types & Functions)>(names: S[] | readonly S[], value: unknown): value is S extends keyof Types ? Types[S] : S extends keyof Functions ? Functions[S] : never;
31
- export declare function isOfEnum<S extends keyof Enums>(name: S, value: unknown): value is Enums[S];
32
- export declare function as<S extends keyof Types>(name: S, value: unknown): Types[S];
23
+ export type DeserializedType = boolean | number | bigint | string | Uint8Array | Api.AnyType | Array<DeserializedType>;
24
+ export declare function deserializeType<T extends (keyof Api.Types) | "X" | string>(name: T, bufferOrReader: TLReader | Uint8Array): Promise<T extends keyof Api.Types ? Api.Types[T] : DeserializedType>;
25
+ export declare function serializeObject(object: Api.AnyObject): Uint8Array;
26
+ export declare function isValidObject(object: any): object is Api.AnyType;
27
+ export declare function assertIsValidObject(object: any): asserts object is Api.AnyType;
28
+ export declare function is<S extends keyof (Api.Types & Api.Functions)>(name: S, value: unknown): value is S extends keyof Api.Types ? Api.Types[S] : S extends keyof Api.Functions ? Api.Functions[S] : never;
29
+ export declare function isOneOf<S extends keyof (Api.Types & Api.Functions)>(names: S[] | readonly S[], value: unknown): value is S extends keyof Api.Types ? Api.Types[S] : S extends keyof Api.Functions ? Api.Functions[S] : never;
30
+ export declare function isOfEnum<S extends keyof Api.Enums>(name: S, value: unknown): value is Api.Enums[S];
31
+ export declare function as<S extends keyof Api.Types>(name: S, value: unknown): Api.Types[S];
33
32
  export declare function mustGetReturnType(name: string): string;
34
33
  export declare function isGenericFunction(value: unknown): value is Api.AnyGenericFunction<Api.AnyFunction>;
35
34
  export declare function getChannelChatId(channelId: bigint): number;
@@ -1 +1 @@
1
- {"version":3,"file":"2_telegram.d.ts","sourceRoot":"","sources":["../../src/tl/2_telegram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAU,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAI5C,OAAO,KAAK,GAAG,MAAM,qBAAqB,CAAC;AAG3C,cAAc,qBAAqB,CAAC;AAEpC,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAEnH,wBAAsB,eAAe,CAAC,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC,GAAG,GAAG,GAAG,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,cAAc,EAAE,QAAQ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AmB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC;AAErG,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,uBAAuB,GAAG,GAAG,CAAC,IAAI,GAAG,mBAAmB,GAAG,MAAM,CAU/G;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC,IAAI,CAQrD;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAWrD;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ7E;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,IAAI,CAUlE"}
@@ -30,6 +30,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
30
30
  if (k2 === undefined) k2 = k;
31
31
  o[k2] = m[k];
32
32
  }));
33
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
34
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
35
+ }) : function(o, v) {
36
+ o["default"] = v;
37
+ });
38
+ var __importStar = (this && this.__importStar) || (function () {
39
+ var ownKeys = function(o) {
40
+ ownKeys = Object.getOwnPropertyNames || function (o) {
41
+ var ar = [];
42
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
43
+ return ar;
44
+ };
45
+ return ownKeys(o);
46
+ };
47
+ return function (mod) {
48
+ if (mod && mod.__esModule) return mod;
49
+ var result = {};
50
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
51
+ __setModuleDefault(result, mod);
52
+ return result;
53
+ };
54
+ })();
33
55
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
34
56
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
35
57
  };
@@ -50,40 +72,40 @@ exports.chatIdToPeer = chatIdToPeer;
50
72
  exports.chatIdToPeerId = chatIdToPeerId;
51
73
  exports.getChatIdPeerType = getChatIdPeerType;
52
74
  exports.inputPeerToPeer = inputPeerToPeer;
53
- const _1_telegram_api_js_1 = require("./1_telegram_api.js");
54
75
  const _1_tl_reader_js_1 = require("./1_tl_reader.js");
55
76
  const _1_tl_writer_js_1 = require("./1_tl_writer.js");
56
77
  const _0_deps_js_1 = require("../0_deps.js");
57
78
  const _1_utilities_js_1 = require("../1_utilities.js");
79
+ const Api = __importStar(require("./1_telegram_api.js"));
58
80
  const _1_utilities_js_2 = require("./1_utilities.js");
59
81
  __exportStar(require("./1_telegram_api.js"), exports);
60
82
  async function deserializeType(name, bufferOrReader) {
61
83
  const reader = bufferOrReader instanceof Uint8Array ? new _1_tl_reader_js_1.TLReader(bufferOrReader) : bufferOrReader;
62
- return await reader.readType(name, _1_telegram_api_js_1.schema);
84
+ return await reader.readType(name, Api.schema);
63
85
  }
64
86
  function serializeObject(object) {
65
- return new _1_tl_writer_js_1.TLWriter().writeObject(object, _1_telegram_api_js_1.schema).buffer;
87
+ return new _1_tl_writer_js_1.TLWriter().writeObject(object, Api.schema).buffer;
66
88
  }
67
89
  function isValidObject(object) {
68
- return (0, _1_utilities_js_2.isValidObject)(object, _1_telegram_api_js_1.schema);
90
+ return (0, _1_utilities_js_2.isValidObject)(object, Api.schema);
69
91
  }
70
92
  function assertIsValidObject(object) {
71
- return (0, _1_utilities_js_2.assertIsValidObject)(object, _1_telegram_api_js_1.schema);
93
+ return (0, _1_utilities_js_2.assertIsValidObject)(object, Api.schema);
72
94
  }
73
95
  function is(name, value) {
74
- return (0, _1_utilities_js_2.is)(name, value, _1_telegram_api_js_1.schema);
96
+ return (0, _1_utilities_js_2.is)(name, value, Api.schema);
75
97
  }
76
98
  function isOneOf(names, value) {
77
- return (0, _1_utilities_js_2.isOneOf)(names, value, _1_telegram_api_js_1.schema);
99
+ return (0, _1_utilities_js_2.isOneOf)(names, value, Api.schema);
78
100
  }
79
101
  function isOfEnum(name, value) {
80
- return (0, _1_utilities_js_2.isOfEnum)(name, value, _1_telegram_api_js_1.schema);
102
+ return (0, _1_utilities_js_2.isOfEnum)(name, value, Api.schema);
81
103
  }
82
104
  function as(name, value) {
83
- return (0, _1_utilities_js_2.as)(name, value, _1_telegram_api_js_1.schema);
105
+ return (0, _1_utilities_js_2.as)(name, value, Api.schema);
84
106
  }
85
107
  function mustGetReturnType(name) {
86
- return (0, _1_utilities_js_2.mustGetReturnType)(name, _1_telegram_api_js_1.schema);
108
+ return (0, _1_utilities_js_2.mustGetReturnType)(name, Api.schema);
87
109
  }
88
110
  const GENERIC_FUNCTIONS = [
89
111
  "invokeAfterMsg",
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
36
  exports.getObfuscationParameters = getObfuscationParameters;
27
37
  /**
@@ -21,14 +21,7 @@
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.Transport = void 0;
23
23
  class Transport {
24
- constructor() {
25
- Object.defineProperty(this, "obfuscationParameters", {
26
- enumerable: true,
27
- configurable: true,
28
- writable: true,
29
- value: null
30
- });
31
- }
24
+ obfuscationParameters = null;
32
25
  async encrypt(buffer) {
33
26
  if (this.obfuscationParameters) {
34
27
  return await this.obfuscationParameters.encryptionCTR.call(buffer);
@@ -18,18 +18,6 @@
18
18
  * You should have received a copy of the GNU Lesser General Public License
19
19
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
20
20
  */
21
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
22
- if (kind === "m") throw new TypeError("Private method is not writable");
23
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
24
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
25
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
26
- };
27
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
28
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
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
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
31
- };
32
- var _TransportAbridged_connection, _TransportAbridged_obfuscated;
33
21
  Object.defineProperty(exports, "__esModule", { value: true });
34
22
  exports.TransportAbridged = void 0;
35
23
  const _0_deps_js_1 = require("../0_deps.js");
@@ -37,40 +25,40 @@ const _1_utilities_js_1 = require("../1_utilities.js");
37
25
  const _0_obfuscation_js_1 = require("./0_obfuscation.js");
38
26
  const _0_transport_js_1 = require("./0_transport.js");
39
27
  class TransportAbridged extends _0_transport_js_1.Transport {
28
+ #connection;
29
+ #obfuscated;
40
30
  constructor(connection, obfuscated = false) {
41
31
  super();
42
- _TransportAbridged_connection.set(this, void 0);
43
- _TransportAbridged_obfuscated.set(this, void 0);
44
- __classPrivateFieldSet(this, _TransportAbridged_connection, connection, "f");
45
- __classPrivateFieldSet(this, _TransportAbridged_obfuscated, obfuscated, "f");
32
+ this.#connection = connection;
33
+ this.#obfuscated = obfuscated;
46
34
  }
47
35
  async initialize() {
48
- if (__classPrivateFieldGet(this, _TransportAbridged_obfuscated, "f")) {
49
- this.obfuscationParameters = await (0, _0_obfuscation_js_1.getObfuscationParameters)(0xEFEFEFEF, __classPrivateFieldGet(this, _TransportAbridged_connection, "f"));
36
+ if (this.#obfuscated) {
37
+ this.obfuscationParameters = await (0, _0_obfuscation_js_1.getObfuscationParameters)(0xEFEFEFEF, this.#connection);
50
38
  }
51
39
  else {
52
- await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").write(new Uint8Array([0xEF]));
40
+ await this.#connection.write(new Uint8Array([0xEF]));
53
41
  }
54
42
  }
55
43
  async receive() {
56
44
  let length;
57
45
  {
58
46
  let buffer = new Uint8Array(1);
59
- await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").read(buffer);
47
+ await this.#connection.read(buffer);
60
48
  buffer = await this.decrypt(buffer);
61
49
  if (buffer[0] < 0x7F) {
62
50
  length = buffer[0];
63
51
  }
64
52
  else {
65
53
  let buffer = new Uint8Array(3);
66
- await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").read(buffer);
54
+ await this.#connection.read(buffer);
67
55
  buffer = await this.decrypt(buffer);
68
56
  length = Number((0, _1_utilities_js_1.bigIntFromBuffer)(buffer));
69
57
  }
70
58
  }
71
59
  length *= 4;
72
60
  const buffer = new Uint8Array(length);
73
- await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").read(buffer);
61
+ await this.#connection.read(buffer);
74
62
  return await this.decrypt(buffer);
75
63
  }
76
64
  async send(buffer) {
@@ -78,8 +66,7 @@ class TransportAbridged extends _0_transport_js_1.Transport {
78
66
  const header = new Uint8Array([bufferLength >= 0x7F ? 0x7F : bufferLength]);
79
67
  const length = bufferLength >= 0x7F ? (0, _1_utilities_js_1.bufferFromBigInt)(bufferLength, 3) : new Uint8Array();
80
68
  const data = (0, _0_deps_js_1.concat)([header, length, buffer]);
81
- await __classPrivateFieldGet(this, _TransportAbridged_connection, "f").write(await this.encrypt(data));
69
+ await this.#connection.write(await this.encrypt(data));
82
70
  }
83
71
  }
84
72
  exports.TransportAbridged = TransportAbridged;
85
- _TransportAbridged_connection = new WeakMap(), _TransportAbridged_obfuscated = new WeakMap();