@mtkruto/node 0.69.0 → 0.70.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 (541) hide show
  1. package/esm/0_deps.d.ts +3 -1
  2. package/esm/0_deps.d.ts.map +1 -1
  3. package/esm/0_deps.js +3 -1
  4. package/esm/3_types.d.ts +35 -35
  5. package/esm/3_types.d.ts.map +1 -1
  6. package/esm/3_types.js +35 -35
  7. package/esm/_dnt.polyfills.d.ts +7 -0
  8. package/esm/_dnt.polyfills.d.ts.map +1 -1
  9. package/esm/_dnt.polyfills.js +109 -0
  10. package/esm/client/0_abortable_loop.d.ts +27 -0
  11. package/esm/client/0_abortable_loop.d.ts.map +1 -0
  12. package/esm/client/0_abortable_loop.js +49 -0
  13. package/esm/client/0_filters.d.ts +9 -3
  14. package/esm/client/0_filters.d.ts.map +1 -1
  15. package/esm/client/0_filters.js +4 -1
  16. package/esm/client/0_params.d.ts +1 -1
  17. package/esm/client/0_password.d.ts +2 -2
  18. package/esm/client/0_password.d.ts.map +1 -1
  19. package/esm/client/0_storage_operations.d.ts +53 -71
  20. package/esm/client/0_storage_operations.d.ts.map +1 -1
  21. package/esm/client/0_storage_operations.js +241 -238
  22. package/esm/client/0_update_processor.d.ts +2 -2
  23. package/esm/client/0_update_processor.d.ts.map +1 -1
  24. package/esm/client/0_utilities.d.ts +2 -2
  25. package/esm/client/0_utilities.d.ts.map +1 -1
  26. package/esm/client/1_types.d.ts +2 -2
  27. package/esm/client/1_types.d.ts.map +1 -1
  28. package/esm/client/2_account_manager.js +5 -5
  29. package/esm/client/2_business_connection_manager.d.ts +1 -1
  30. package/esm/client/2_business_connection_manager.d.ts.map +1 -1
  31. package/esm/client/2_business_connection_manager.js +3 -3
  32. package/esm/client/2_client_encrypted.d.ts +1 -1
  33. package/esm/client/2_client_encrypted.d.ts.map +1 -1
  34. package/esm/client/2_file_manager.js +2 -2
  35. package/esm/client/2_payment_manager.d.ts +1 -1
  36. package/esm/client/2_payment_manager.d.ts.map +1 -1
  37. package/esm/client/2_payment_manager.js +2 -2
  38. package/esm/client/2_reaction_manager.d.ts +1 -1
  39. package/esm/client/2_reaction_manager.d.ts.map +1 -1
  40. package/esm/client/2_reaction_manager.js +2 -2
  41. package/esm/client/2_translations_manager.d.ts +1 -1
  42. package/esm/client/2_translations_manager.d.ts.map +1 -1
  43. package/esm/client/2_translations_manager.js +15 -11
  44. package/esm/client/2_update_manager.d.ts +4 -2
  45. package/esm/client/2_update_manager.d.ts.map +1 -1
  46. package/esm/client/2_update_manager.js +61 -79
  47. package/esm/client/3_message_manager.d.ts +2 -2
  48. package/esm/client/3_message_manager.d.ts.map +1 -1
  49. package/esm/client/3_message_manager.js +5 -5
  50. package/esm/client/3_video_chat_manager.d.ts +1 -1
  51. package/esm/client/3_video_chat_manager.d.ts.map +1 -1
  52. package/esm/client/4_callback_query_manager.d.ts +1 -1
  53. package/esm/client/4_callback_query_manager.d.ts.map +1 -1
  54. package/esm/client/4_callback_query_manager.js +1 -1
  55. package/esm/client/4_chat_list_manager.d.ts +2 -3
  56. package/esm/client/4_chat_list_manager.d.ts.map +1 -1
  57. package/esm/client/4_chat_list_manager.js +10 -265
  58. package/esm/client/4_chat_manager.d.ts +2 -2
  59. package/esm/client/4_chat_manager.d.ts.map +1 -1
  60. package/esm/client/4_chat_manager.js +7 -7
  61. package/esm/client/4_gift_manager.js +3 -3
  62. package/esm/client/4_inline_query_manager.d.ts +1 -1
  63. package/esm/client/4_inline_query_manager.d.ts.map +1 -1
  64. package/esm/client/4_inline_query_manager.js +3 -3
  65. package/esm/client/4_link_preview_manager.d.ts +1 -1
  66. package/esm/client/4_link_preview_manager.d.ts.map +1 -1
  67. package/esm/client/4_link_preview_manager.js +3 -3
  68. package/esm/client/4_poll_manager.d.ts +1 -1
  69. package/esm/client/4_poll_manager.d.ts.map +1 -1
  70. package/esm/client/4_poll_manager.js +1 -1
  71. package/esm/client/4_story_manager.d.ts +1 -1
  72. package/esm/client/4_story_manager.d.ts.map +1 -1
  73. package/esm/client/4_story_manager.js +7 -7
  74. package/esm/client/5_client.d.ts +15 -9
  75. package/esm/client/5_client.d.ts.map +1 -1
  76. package/esm/client/5_client.js +420 -382
  77. package/esm/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts +12 -0
  78. package/esm/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts.map +1 -0
  79. package/esm/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.js +69 -0
  80. package/esm/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts +112 -0
  81. package/esm/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts.map +1 -0
  82. package/esm/deps/jsr.io/@std/cache/0.2.0/lru_cache.js +140 -0
  83. package/esm/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts +111 -0
  84. package/esm/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts.map +1 -0
  85. package/esm/deps/jsr.io/@std/cache/0.2.0/memoize.js +82 -0
  86. package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts +39 -0
  87. package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  88. package/esm/deps/jsr.io/@std/encoding/1.0.7/hex.js +109 -0
  89. package/esm/session/2_session_encrypted.d.ts +1 -1
  90. package/esm/session/2_session_encrypted.d.ts.map +1 -1
  91. package/esm/session/2_session_encrypted.js +71 -72
  92. package/esm/storage/0_storage.d.ts +1 -0
  93. package/esm/storage/0_storage.d.ts.map +1 -1
  94. package/esm/storage/2_storage_indexed_db.d.ts +1 -0
  95. package/esm/storage/2_storage_indexed_db.d.ts.map +1 -1
  96. package/esm/storage/2_storage_indexed_db.js +3 -0
  97. package/esm/storage/2_storage_local_storage.node.d.ts +1 -0
  98. package/esm/storage/2_storage_local_storage.node.d.ts.map +1 -1
  99. package/esm/storage/2_storage_local_storage.node.js +3 -0
  100. package/esm/storage/2_storage_memory.d.ts +1 -0
  101. package/esm/storage/2_storage_memory.d.ts.map +1 -1
  102. package/esm/storage/2_storage_memory.js +3 -0
  103. package/esm/storage/2_storage_session_storage.d.ts +1 -0
  104. package/esm/storage/2_storage_session_storage.d.ts.map +1 -1
  105. package/esm/storage/2_storage_session_storage.js +3 -0
  106. package/esm/tl/0_utilities.d.ts +1 -0
  107. package/esm/tl/0_utilities.d.ts.map +1 -1
  108. package/esm/tl/0_utilities.js +20 -1
  109. package/esm/tl/1_telegram_api.d.ts +810 -254
  110. package/esm/tl/1_telegram_api.d.ts.map +1 -1
  111. package/esm/tl/1_telegram_api.js +912 -213
  112. package/esm/tl/1_tl_reader.d.ts +2 -2
  113. package/esm/tl/1_tl_reader.d.ts.map +1 -1
  114. package/esm/tl/1_tl_writer.d.ts +2 -2
  115. package/esm/tl/1_tl_writer.d.ts.map +1 -1
  116. package/esm/tl/2_mtproto.d.ts +1 -1
  117. package/esm/tl/2_mtproto.d.ts.map +1 -1
  118. package/esm/types/0_file_source.d.ts +1 -1
  119. package/esm/types/0_file_source.d.ts.map +1 -1
  120. package/esm/types/1_chat_p.d.ts +10 -0
  121. package/esm/types/1_chat_p.d.ts.map +1 -1
  122. package/esm/types/1_chat_p.js +4 -0
  123. package/esm/types/2_chat.d.ts +2 -5
  124. package/esm/types/2_chat.d.ts.map +1 -1
  125. package/esm/types/2_chat.js +10 -15
  126. package/esm/types/{0_message_entity.d.ts → 2_message_entity.d.ts} +3 -3
  127. package/esm/types/{0_message_entity.d.ts.map → 2_message_entity.d.ts.map} +1 -1
  128. package/esm/types/{0_message_entity.js → 2_message_entity.js} +7 -7
  129. package/esm/types/2_message_reaction_count.d.ts +2 -3
  130. package/esm/types/2_message_reaction_count.d.ts.map +1 -1
  131. package/esm/types/2_message_reaction_count.js +4 -6
  132. package/esm/types/2_poll_answer.d.ts +2 -3
  133. package/esm/types/2_poll_answer.d.ts.map +1 -1
  134. package/esm/types/2_poll_answer.js +4 -5
  135. package/esm/types/2_story_interactive_area.d.ts +2 -2
  136. package/esm/types/2_story_interactive_area.d.ts.map +1 -1
  137. package/esm/types/2_story_interactive_area.js +2 -2
  138. package/esm/types/{1_story_privacy.d.ts → 2_story_privacy.d.ts} +3 -3
  139. package/esm/types/{1_story_privacy.d.ts.map → 2_story_privacy.d.ts.map} +1 -1
  140. package/esm/types/{1_story_privacy.js → 2_story_privacy.js} +10 -10
  141. package/{script/types/1_user.d.ts → esm/types/2_user.d.ts} +5 -1
  142. package/esm/types/2_user.d.ts.map +1 -0
  143. package/esm/types/{1_user.js → 2_user.js} +24 -0
  144. package/esm/types/{2_business_connection.d.ts → 3_business_connection.d.ts} +4 -4
  145. package/esm/types/3_business_connection.d.ts.map +1 -0
  146. package/esm/types/{2_business_connection.js → 3_business_connection.js} +10 -3
  147. package/{script/types/2_chat_member.d.ts → esm/types/3_chat_member.d.ts} +6 -4
  148. package/esm/types/{2_chat_member.d.ts.map → 3_chat_member.d.ts.map} +1 -1
  149. package/esm/types/{2_chat_member.js → 3_chat_member.js} +5 -5
  150. package/esm/types/{2_chat_settings.d.ts → 3_chat_settings.d.ts} +2 -2
  151. package/{script/types/2_chat_settings.d.ts.map → esm/types/3_chat_settings.d.ts.map} +1 -1
  152. package/esm/types/{2_chat_settings.js → 3_chat_settings.js} +1 -1
  153. package/esm/types/{2_chosen_inline_result.d.ts → 3_chosen_inline_result.d.ts} +4 -4
  154. package/esm/types/3_chosen_inline_result.d.ts.map +1 -0
  155. package/esm/types/{2_chosen_inline_result.js → 3_chosen_inline_result.js} +3 -3
  156. package/esm/types/{2_forward_header.d.ts → 3_forward_header.d.ts} +4 -5
  157. package/esm/types/3_forward_header.d.ts.map +1 -0
  158. package/esm/types/{2_forward_header.js → 3_forward_header.js} +11 -12
  159. package/{script/types/2_game.d.ts → esm/types/3_game.d.ts} +2 -2
  160. package/esm/types/3_game.d.ts.map +1 -0
  161. package/esm/types/{2_gift_upgraded_component.d.ts → 3_gift_upgraded_component.d.ts} +2 -2
  162. package/esm/types/{2_gift_upgraded_component.d.ts.map → 3_gift_upgraded_component.d.ts.map} +1 -1
  163. package/esm/types/{2_gift_upgraded_component.js → 3_gift_upgraded_component.js} +1 -1
  164. package/esm/types/{2_inline_query.d.ts → 3_inline_query.d.ts} +4 -4
  165. package/esm/types/3_inline_query.d.ts.map +1 -0
  166. package/esm/types/{2_inline_query.js → 3_inline_query.js} +5 -5
  167. package/{script/types/1_input_media.d.ts → esm/types/3_input_media.d.ts} +2 -2
  168. package/esm/types/{1_input_media.d.ts.map → 3_input_media.d.ts.map} +1 -1
  169. package/{script/types/2_invite_link.d.ts → esm/types/3_invite_link.d.ts} +4 -4
  170. package/{script/types/2_invite_link.d.ts.map → esm/types/3_invite_link.d.ts.map} +1 -1
  171. package/esm/types/{2_invite_link.js → 3_invite_link.js} +5 -5
  172. package/{script/types/2_message_reactions.d.ts → esm/types/3_message_reactions.d.ts} +5 -6
  173. package/esm/types/3_message_reactions.d.ts.map +1 -0
  174. package/esm/types/{2_message_reactions.js → 3_message_reactions.js} +10 -12
  175. package/esm/types/{1_poll_option.d.ts → 3_poll_option.d.ts} +2 -2
  176. package/esm/types/{1_poll_option.d.ts.map → 3_poll_option.d.ts.map} +1 -1
  177. package/esm/types/{1_poll_option.js → 3_poll_option.js} +1 -1
  178. package/esm/types/{2_pre_checkout_query.d.ts → 3_pre_checkout_query.d.ts} +4 -4
  179. package/esm/types/3_pre_checkout_query.d.ts.map +1 -0
  180. package/esm/types/{2_pre_checkout_query.js → 3_pre_checkout_query.js} +5 -5
  181. package/{script/types/1_reply_quote.d.ts → esm/types/3_reply_quote.d.ts} +2 -2
  182. package/esm/types/{1_reply_quote.d.ts.map → 3_reply_quote.d.ts.map} +1 -1
  183. package/esm/types/{1_reply_quote.js → 3_reply_quote.js} +1 -1
  184. package/esm/types/3_story.d.ts +4 -5
  185. package/esm/types/3_story.d.ts.map +1 -1
  186. package/esm/types/3_story.js +6 -7
  187. package/esm/types/{3_chat_member_updated.d.ts → 4_chat_member_updated.d.ts} +6 -7
  188. package/esm/types/4_chat_member_updated.d.ts.map +1 -0
  189. package/esm/types/{3_chat_member_updated.js → 4_chat_member_updated.js} +13 -14
  190. package/esm/types/{3_gift.d.ts → 4_gift.d.ts} +6 -6
  191. package/esm/types/{3_gift.d.ts.map → 4_gift.d.ts.map} +1 -1
  192. package/esm/types/{3_gift.js → 4_gift.js} +7 -7
  193. package/esm/types/{3_join_request.d.ts → 4_join_request.d.ts} +6 -7
  194. package/esm/types/4_join_request.d.ts.map +1 -0
  195. package/esm/types/{3_join_request.js → 4_join_request.js} +17 -18
  196. package/esm/types/{2_poll.d.ts → 4_poll.d.ts} +3 -3
  197. package/esm/types/{2_poll.d.ts.map → 4_poll.d.ts.map} +1 -1
  198. package/esm/types/{2_poll.js → 4_poll.js} +2 -2
  199. package/{script/types/2_reply_to.d.ts → esm/types/4_reply_to.d.ts} +2 -2
  200. package/esm/types/{2_reply_to.d.ts.map → 4_reply_to.d.ts.map} +1 -1
  201. package/esm/types/{4_claimed_gift.d.ts → 5_claimed_gift.d.ts} +5 -6
  202. package/esm/types/5_claimed_gift.d.ts.map +1 -0
  203. package/esm/types/{4_claimed_gift.js → 5_claimed_gift.js} +4 -4
  204. package/esm/types/{4_link_preview.d.ts → 5_link_preview.d.ts} +4 -4
  205. package/{script/types/4_link_preview.d.ts.map → esm/types/5_link_preview.d.ts.map} +1 -1
  206. package/esm/types/{4_link_preview.js → 5_link_preview.js} +3 -3
  207. package/esm/types/{5_claimed_gifts.d.ts → 6_claimed_gifts.d.ts} +4 -4
  208. package/esm/types/6_claimed_gifts.d.ts.map +1 -0
  209. package/esm/types/{5_claimed_gifts.js → 6_claimed_gifts.js} +4 -4
  210. package/esm/types/{5_message.d.ts → 6_message.d.ts} +10 -11
  211. package/esm/types/6_message.d.ts.map +1 -0
  212. package/esm/types/{5_message.js → 6_message.js} +41 -66
  213. package/{script/types/5_message_content.d.ts → esm/types/6_message_content.d.ts} +3 -3
  214. package/esm/types/{5_message_content.d.ts.map → 6_message_content.d.ts.map} +1 -1
  215. package/{script/types/6_callback_query.d.ts → esm/types/7_callback_query.d.ts} +5 -5
  216. package/esm/types/{6_callback_query.d.ts.map → 7_callback_query.d.ts.map} +1 -1
  217. package/esm/types/{6_callback_query.js → 7_callback_query.js} +5 -5
  218. package/{script/types/6_chat_list_item.d.ts → esm/types/7_chat_list_item.d.ts} +6 -7
  219. package/esm/types/7_chat_list_item.d.ts.map +1 -0
  220. package/esm/types/{6_chat_list_item.js → 7_chat_list_item.js} +11 -11
  221. package/{script/types/6_inline_query_result.d.ts → esm/types/7_inline_query_result.d.ts} +3 -3
  222. package/esm/types/{6_inline_query_result.d.ts.map → 7_inline_query_result.d.ts.map} +1 -1
  223. package/esm/types/{6_inline_query_result.js → 7_inline_query_result.js} +1 -1
  224. package/esm/types/{6_saved_chat.d.ts → 7_saved_chat.d.ts} +4 -5
  225. package/esm/types/7_saved_chat.d.ts.map +1 -0
  226. package/esm/types/{6_saved_chat.js → 7_saved_chat.js} +4 -4
  227. package/esm/types/{6_topic.d.ts → 7_topic.d.ts} +2 -2
  228. package/esm/types/{6_topic.d.ts.map → 7_topic.d.ts.map} +1 -1
  229. package/esm/types/{7_inline_query_answer.d.ts → 8_inline_query_answer.d.ts} +2 -2
  230. package/esm/types/{7_inline_query_answer.d.ts.map → 8_inline_query_answer.d.ts.map} +1 -1
  231. package/esm/types/{7_inline_query_answer.js → 8_inline_query_answer.js} +1 -1
  232. package/{script/types/7_saved_chats.d.ts → esm/types/8_saved_chats.d.ts} +5 -5
  233. package/esm/types/8_saved_chats.d.ts.map +1 -0
  234. package/esm/types/{7_saved_chats.js → 8_saved_chats.js} +3 -3
  235. package/esm/types/{7_update.d.ts → 8_update.d.ts} +35 -16
  236. package/esm/types/8_update.d.ts.map +1 -0
  237. package/esm/types/_file_id.d.ts +1 -1
  238. package/esm/types/_file_id.d.ts.map +1 -1
  239. package/esm/types/_getters.d.ts +0 -7
  240. package/esm/types/_getters.d.ts.map +1 -1
  241. package/esm/utilities/0_hash.d.ts +2 -2
  242. package/esm/utilities/0_hash.d.ts.map +1 -1
  243. package/esm/utilities/0_misc.d.ts +1 -0
  244. package/esm/utilities/0_misc.d.ts.map +1 -1
  245. package/esm/utilities/0_misc.js +14 -1
  246. package/esm/utilities/0_part_stream.d.ts +1 -1
  247. package/esm/utilities/0_part_stream.d.ts.map +1 -1
  248. package/package.json +1 -1
  249. package/script/0_deps.d.ts +3 -1
  250. package/script/0_deps.d.ts.map +1 -1
  251. package/script/0_deps.js +6 -1
  252. package/script/3_types.d.ts +35 -35
  253. package/script/3_types.d.ts.map +1 -1
  254. package/script/3_types.js +35 -35
  255. package/script/_dnt.polyfills.d.ts +7 -0
  256. package/script/_dnt.polyfills.d.ts.map +1 -1
  257. package/script/_dnt.polyfills.js +109 -0
  258. package/script/client/0_abortable_loop.d.ts +27 -0
  259. package/script/client/0_abortable_loop.d.ts.map +1 -0
  260. package/script/client/0_abortable_loop.js +53 -0
  261. package/script/client/0_filters.d.ts +9 -3
  262. package/script/client/0_filters.d.ts.map +1 -1
  263. package/script/client/0_filters.js +4 -1
  264. package/script/client/0_params.d.ts +1 -1
  265. package/script/client/0_password.d.ts +2 -2
  266. package/script/client/0_password.d.ts.map +1 -1
  267. package/script/client/0_storage_operations.d.ts +53 -71
  268. package/script/client/0_storage_operations.d.ts.map +1 -1
  269. package/script/client/0_storage_operations.js +239 -236
  270. package/script/client/0_update_processor.d.ts +2 -2
  271. package/script/client/0_update_processor.d.ts.map +1 -1
  272. package/script/client/0_utilities.d.ts +2 -2
  273. package/script/client/0_utilities.d.ts.map +1 -1
  274. package/script/client/1_types.d.ts +2 -2
  275. package/script/client/1_types.d.ts.map +1 -1
  276. package/script/client/2_account_manager.js +5 -5
  277. package/script/client/2_business_connection_manager.d.ts +1 -1
  278. package/script/client/2_business_connection_manager.d.ts.map +1 -1
  279. package/script/client/2_business_connection_manager.js +3 -3
  280. package/script/client/2_client_encrypted.d.ts +1 -1
  281. package/script/client/2_client_encrypted.d.ts.map +1 -1
  282. package/script/client/2_file_manager.js +2 -2
  283. package/script/client/2_payment_manager.d.ts +1 -1
  284. package/script/client/2_payment_manager.d.ts.map +1 -1
  285. package/script/client/2_payment_manager.js +2 -2
  286. package/script/client/2_reaction_manager.d.ts +1 -1
  287. package/script/client/2_reaction_manager.d.ts.map +1 -1
  288. package/script/client/2_reaction_manager.js +2 -2
  289. package/script/client/2_translations_manager.d.ts +1 -1
  290. package/script/client/2_translations_manager.d.ts.map +1 -1
  291. package/script/client/2_translations_manager.js +15 -11
  292. package/script/client/2_update_manager.d.ts +4 -2
  293. package/script/client/2_update_manager.d.ts.map +1 -1
  294. package/script/client/2_update_manager.js +61 -79
  295. package/script/client/3_message_manager.d.ts +2 -2
  296. package/script/client/3_message_manager.d.ts.map +1 -1
  297. package/script/client/3_message_manager.js +5 -5
  298. package/script/client/3_video_chat_manager.d.ts +1 -1
  299. package/script/client/3_video_chat_manager.d.ts.map +1 -1
  300. package/script/client/4_callback_query_manager.d.ts +1 -1
  301. package/script/client/4_callback_query_manager.d.ts.map +1 -1
  302. package/script/client/4_callback_query_manager.js +1 -1
  303. package/script/client/4_chat_list_manager.d.ts +2 -3
  304. package/script/client/4_chat_list_manager.d.ts.map +1 -1
  305. package/script/client/4_chat_list_manager.js +9 -264
  306. package/script/client/4_chat_manager.d.ts +2 -2
  307. package/script/client/4_chat_manager.d.ts.map +1 -1
  308. package/script/client/4_chat_manager.js +7 -7
  309. package/script/client/4_gift_manager.js +3 -3
  310. package/script/client/4_inline_query_manager.d.ts +1 -1
  311. package/script/client/4_inline_query_manager.d.ts.map +1 -1
  312. package/script/client/4_inline_query_manager.js +3 -3
  313. package/script/client/4_link_preview_manager.d.ts +1 -1
  314. package/script/client/4_link_preview_manager.d.ts.map +1 -1
  315. package/script/client/4_link_preview_manager.js +3 -3
  316. package/script/client/4_poll_manager.d.ts +1 -1
  317. package/script/client/4_poll_manager.d.ts.map +1 -1
  318. package/script/client/4_poll_manager.js +1 -1
  319. package/script/client/4_story_manager.d.ts +1 -1
  320. package/script/client/4_story_manager.d.ts.map +1 -1
  321. package/script/client/4_story_manager.js +7 -7
  322. package/script/client/5_client.d.ts +15 -9
  323. package/script/client/5_client.d.ts.map +1 -1
  324. package/script/client/5_client.js +418 -380
  325. package/script/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts +12 -0
  326. package/script/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.d.ts.map +1 -0
  327. package/script/deps/jsr.io/@std/cache/0.2.0/_serialize_arg_list.js +72 -0
  328. package/script/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts +112 -0
  329. package/script/deps/jsr.io/@std/cache/0.2.0/lru_cache.d.ts.map +1 -0
  330. package/script/deps/jsr.io/@std/cache/0.2.0/lru_cache.js +144 -0
  331. package/script/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts +111 -0
  332. package/script/deps/jsr.io/@std/cache/0.2.0/memoize.d.ts.map +1 -0
  333. package/script/deps/jsr.io/@std/cache/0.2.0/memoize.js +85 -0
  334. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts +39 -0
  335. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.d.ts.map +1 -0
  336. package/script/deps/jsr.io/@std/encoding/1.0.7/hex.js +113 -0
  337. package/script/session/2_session_encrypted.d.ts +1 -1
  338. package/script/session/2_session_encrypted.d.ts.map +1 -1
  339. package/script/session/2_session_encrypted.js +70 -71
  340. package/script/storage/0_storage.d.ts +1 -0
  341. package/script/storage/0_storage.d.ts.map +1 -1
  342. package/script/storage/2_storage_indexed_db.d.ts +1 -0
  343. package/script/storage/2_storage_indexed_db.d.ts.map +1 -1
  344. package/script/storage/2_storage_indexed_db.js +3 -0
  345. package/script/storage/2_storage_local_storage.node.d.ts +1 -0
  346. package/script/storage/2_storage_local_storage.node.d.ts.map +1 -1
  347. package/script/storage/2_storage_local_storage.node.js +3 -0
  348. package/script/storage/2_storage_memory.d.ts +1 -0
  349. package/script/storage/2_storage_memory.d.ts.map +1 -1
  350. package/script/storage/2_storage_memory.js +3 -0
  351. package/script/storage/2_storage_session_storage.d.ts +1 -0
  352. package/script/storage/2_storage_session_storage.d.ts.map +1 -1
  353. package/script/storage/2_storage_session_storage.js +3 -0
  354. package/script/tl/0_utilities.d.ts +1 -0
  355. package/script/tl/0_utilities.d.ts.map +1 -1
  356. package/script/tl/0_utilities.js +20 -0
  357. package/script/tl/1_telegram_api.d.ts +810 -254
  358. package/script/tl/1_telegram_api.d.ts.map +1 -1
  359. package/script/tl/1_telegram_api.js +912 -213
  360. package/script/tl/1_tl_reader.d.ts +2 -2
  361. package/script/tl/1_tl_reader.d.ts.map +1 -1
  362. package/script/tl/1_tl_writer.d.ts +2 -2
  363. package/script/tl/1_tl_writer.d.ts.map +1 -1
  364. package/script/tl/2_mtproto.d.ts +1 -1
  365. package/script/tl/2_mtproto.d.ts.map +1 -1
  366. package/script/types/0_file_source.d.ts +1 -1
  367. package/script/types/0_file_source.d.ts.map +1 -1
  368. package/script/types/1_chat_p.d.ts +10 -0
  369. package/script/types/1_chat_p.d.ts.map +1 -1
  370. package/script/types/1_chat_p.js +5 -0
  371. package/script/types/2_chat.d.ts +2 -5
  372. package/script/types/2_chat.d.ts.map +1 -1
  373. package/script/types/2_chat.js +10 -15
  374. package/script/types/{0_message_entity.d.ts → 2_message_entity.d.ts} +3 -3
  375. package/script/types/{0_message_entity.d.ts.map → 2_message_entity.d.ts.map} +1 -1
  376. package/script/types/{0_message_entity.js → 2_message_entity.js} +7 -7
  377. package/script/types/2_message_reaction_count.d.ts +2 -3
  378. package/script/types/2_message_reaction_count.d.ts.map +1 -1
  379. package/script/types/2_message_reaction_count.js +4 -6
  380. package/script/types/2_poll_answer.d.ts +2 -3
  381. package/script/types/2_poll_answer.d.ts.map +1 -1
  382. package/script/types/2_poll_answer.js +4 -5
  383. package/script/types/2_story_interactive_area.d.ts +2 -2
  384. package/script/types/2_story_interactive_area.d.ts.map +1 -1
  385. package/script/types/2_story_interactive_area.js +2 -2
  386. package/script/types/{1_story_privacy.d.ts → 2_story_privacy.d.ts} +3 -3
  387. package/script/types/{1_story_privacy.d.ts.map → 2_story_privacy.d.ts.map} +1 -1
  388. package/script/types/{1_story_privacy.js → 2_story_privacy.js} +10 -10
  389. package/{esm/types/1_user.d.ts → script/types/2_user.d.ts} +5 -1
  390. package/script/types/2_user.d.ts.map +1 -0
  391. package/script/types/{1_user.js → 2_user.js} +25 -0
  392. package/script/types/{2_business_connection.d.ts → 3_business_connection.d.ts} +4 -4
  393. package/script/types/3_business_connection.d.ts.map +1 -0
  394. package/script/types/{2_business_connection.js → 3_business_connection.js} +10 -3
  395. package/{esm/types/2_chat_member.d.ts → script/types/3_chat_member.d.ts} +6 -4
  396. package/script/types/{2_chat_member.d.ts.map → 3_chat_member.d.ts.map} +1 -1
  397. package/script/types/{2_chat_member.js → 3_chat_member.js} +5 -5
  398. package/script/types/{2_chat_settings.d.ts → 3_chat_settings.d.ts} +2 -2
  399. package/{esm/types/2_chat_settings.d.ts.map → script/types/3_chat_settings.d.ts.map} +1 -1
  400. package/script/types/{2_chat_settings.js → 3_chat_settings.js} +2 -2
  401. package/script/types/{2_chosen_inline_result.d.ts → 3_chosen_inline_result.d.ts} +4 -4
  402. package/script/types/3_chosen_inline_result.d.ts.map +1 -0
  403. package/script/types/{2_chosen_inline_result.js → 3_chosen_inline_result.js} +4 -4
  404. package/script/types/{2_forward_header.d.ts → 3_forward_header.d.ts} +4 -5
  405. package/script/types/3_forward_header.d.ts.map +1 -0
  406. package/script/types/{2_forward_header.js → 3_forward_header.js} +11 -12
  407. package/{esm/types/2_game.d.ts → script/types/3_game.d.ts} +2 -2
  408. package/script/types/3_game.d.ts.map +1 -0
  409. package/script/types/{2_gift_upgraded_component.d.ts → 3_gift_upgraded_component.d.ts} +2 -2
  410. package/script/types/{2_gift_upgraded_component.d.ts.map → 3_gift_upgraded_component.d.ts.map} +1 -1
  411. package/script/types/{2_gift_upgraded_component.js → 3_gift_upgraded_component.js} +2 -2
  412. package/script/types/{2_inline_query.d.ts → 3_inline_query.d.ts} +4 -4
  413. package/script/types/3_inline_query.d.ts.map +1 -0
  414. package/script/types/{2_inline_query.js → 3_inline_query.js} +5 -5
  415. package/{esm/types/1_input_media.d.ts → script/types/3_input_media.d.ts} +2 -2
  416. package/script/types/{1_input_media.d.ts.map → 3_input_media.d.ts.map} +1 -1
  417. package/{esm/types/2_invite_link.d.ts → script/types/3_invite_link.d.ts} +4 -4
  418. package/{esm/types/2_invite_link.d.ts.map → script/types/3_invite_link.d.ts.map} +1 -1
  419. package/script/types/{2_invite_link.js → 3_invite_link.js} +5 -5
  420. package/{esm/types/2_message_reactions.d.ts → script/types/3_message_reactions.d.ts} +5 -6
  421. package/script/types/3_message_reactions.d.ts.map +1 -0
  422. package/script/types/{2_message_reactions.js → 3_message_reactions.js} +10 -12
  423. package/script/types/{1_poll_option.d.ts → 3_poll_option.d.ts} +2 -2
  424. package/script/types/{1_poll_option.d.ts.map → 3_poll_option.d.ts.map} +1 -1
  425. package/script/types/{1_poll_option.js → 3_poll_option.js} +2 -2
  426. package/script/types/{2_pre_checkout_query.d.ts → 3_pre_checkout_query.d.ts} +4 -4
  427. package/script/types/3_pre_checkout_query.d.ts.map +1 -0
  428. package/script/types/{2_pre_checkout_query.js → 3_pre_checkout_query.js} +5 -5
  429. package/{esm/types/1_reply_quote.d.ts → script/types/3_reply_quote.d.ts} +2 -2
  430. package/script/types/{1_reply_quote.d.ts.map → 3_reply_quote.d.ts.map} +1 -1
  431. package/script/types/{1_reply_quote.js → 3_reply_quote.js} +2 -2
  432. package/script/types/3_story.d.ts +4 -5
  433. package/script/types/3_story.d.ts.map +1 -1
  434. package/script/types/3_story.js +8 -9
  435. package/script/types/{3_chat_member_updated.d.ts → 4_chat_member_updated.d.ts} +6 -7
  436. package/script/types/4_chat_member_updated.d.ts.map +1 -0
  437. package/script/types/{3_chat_member_updated.js → 4_chat_member_updated.js} +13 -14
  438. package/script/types/{3_gift.d.ts → 4_gift.d.ts} +6 -6
  439. package/script/types/{3_gift.d.ts.map → 4_gift.d.ts.map} +1 -1
  440. package/script/types/{3_gift.js → 4_gift.js} +9 -9
  441. package/script/types/{3_join_request.d.ts → 4_join_request.d.ts} +6 -7
  442. package/script/types/4_join_request.d.ts.map +1 -0
  443. package/script/types/{3_join_request.js → 4_join_request.js} +17 -18
  444. package/script/types/{2_poll.d.ts → 4_poll.d.ts} +3 -3
  445. package/script/types/{2_poll.d.ts.map → 4_poll.d.ts.map} +1 -1
  446. package/script/types/{2_poll.js → 4_poll.js} +5 -5
  447. package/{esm/types/2_reply_to.d.ts → script/types/4_reply_to.d.ts} +2 -2
  448. package/script/types/{2_reply_to.d.ts.map → 4_reply_to.d.ts.map} +1 -1
  449. package/script/types/{4_claimed_gift.d.ts → 5_claimed_gift.d.ts} +5 -6
  450. package/script/types/5_claimed_gift.d.ts.map +1 -0
  451. package/script/types/{4_claimed_gift.js → 5_claimed_gift.js} +5 -5
  452. package/script/types/{4_link_preview.d.ts → 5_link_preview.d.ts} +4 -4
  453. package/{esm/types/4_link_preview.d.ts.map → script/types/5_link_preview.d.ts.map} +1 -1
  454. package/script/types/{4_link_preview.js → 5_link_preview.js} +3 -3
  455. package/script/types/{5_claimed_gifts.d.ts → 6_claimed_gifts.d.ts} +4 -4
  456. package/script/types/6_claimed_gifts.d.ts.map +1 -0
  457. package/script/types/{5_claimed_gifts.js → 6_claimed_gifts.js} +4 -4
  458. package/script/types/{5_message.d.ts → 6_message.d.ts} +10 -11
  459. package/script/types/6_message.d.ts.map +1 -0
  460. package/script/types/{5_message.js → 6_message.js} +45 -70
  461. package/{esm/types/5_message_content.d.ts → script/types/6_message_content.d.ts} +3 -3
  462. package/script/types/{5_message_content.d.ts.map → 6_message_content.d.ts.map} +1 -1
  463. package/{esm/types/6_callback_query.d.ts → script/types/7_callback_query.d.ts} +5 -5
  464. package/script/types/{6_callback_query.d.ts.map → 7_callback_query.d.ts.map} +1 -1
  465. package/script/types/{6_callback_query.js → 7_callback_query.js} +5 -5
  466. package/{esm/types/6_chat_list_item.d.ts → script/types/7_chat_list_item.d.ts} +6 -7
  467. package/script/types/7_chat_list_item.d.ts.map +1 -0
  468. package/script/types/{6_chat_list_item.js → 7_chat_list_item.js} +11 -11
  469. package/{esm/types/6_inline_query_result.d.ts → script/types/7_inline_query_result.d.ts} +3 -3
  470. package/script/types/{6_inline_query_result.d.ts.map → 7_inline_query_result.d.ts.map} +1 -1
  471. package/script/types/{6_inline_query_result.js → 7_inline_query_result.js} +3 -3
  472. package/script/types/{6_saved_chat.d.ts → 7_saved_chat.d.ts} +4 -5
  473. package/script/types/7_saved_chat.d.ts.map +1 -0
  474. package/script/types/{6_saved_chat.js → 7_saved_chat.js} +4 -4
  475. package/script/types/{6_topic.d.ts → 7_topic.d.ts} +2 -2
  476. package/script/types/{6_topic.d.ts.map → 7_topic.d.ts.map} +1 -1
  477. package/script/types/{7_inline_query_answer.d.ts → 8_inline_query_answer.d.ts} +2 -2
  478. package/script/types/{7_inline_query_answer.d.ts.map → 8_inline_query_answer.d.ts.map} +1 -1
  479. package/script/types/{7_inline_query_answer.js → 8_inline_query_answer.js} +2 -2
  480. package/{esm/types/7_saved_chats.d.ts → script/types/8_saved_chats.d.ts} +5 -5
  481. package/script/types/8_saved_chats.d.ts.map +1 -0
  482. package/script/types/{7_saved_chats.js → 8_saved_chats.js} +3 -3
  483. package/script/types/{7_update.d.ts → 8_update.d.ts} +35 -16
  484. package/script/types/8_update.d.ts.map +1 -0
  485. package/script/types/_file_id.d.ts +1 -1
  486. package/script/types/_file_id.d.ts.map +1 -1
  487. package/script/types/_getters.d.ts +0 -7
  488. package/script/types/_getters.d.ts.map +1 -1
  489. package/script/utilities/0_hash.d.ts +2 -2
  490. package/script/utilities/0_hash.d.ts.map +1 -1
  491. package/script/utilities/0_misc.d.ts +1 -0
  492. package/script/utilities/0_misc.d.ts.map +1 -1
  493. package/script/utilities/0_misc.js +14 -0
  494. package/script/utilities/0_part_stream.d.ts +1 -1
  495. package/script/utilities/0_part_stream.d.ts.map +1 -1
  496. package/esm/types/1_user.d.ts.map +0 -1
  497. package/esm/types/2_business_connection.d.ts.map +0 -1
  498. package/esm/types/2_chosen_inline_result.d.ts.map +0 -1
  499. package/esm/types/2_forward_header.d.ts.map +0 -1
  500. package/esm/types/2_game.d.ts.map +0 -1
  501. package/esm/types/2_inline_query.d.ts.map +0 -1
  502. package/esm/types/2_message_reactions.d.ts.map +0 -1
  503. package/esm/types/2_pre_checkout_query.d.ts.map +0 -1
  504. package/esm/types/3_chat_member_updated.d.ts.map +0 -1
  505. package/esm/types/3_join_request.d.ts.map +0 -1
  506. package/esm/types/4_claimed_gift.d.ts.map +0 -1
  507. package/esm/types/5_claimed_gifts.d.ts.map +0 -1
  508. package/esm/types/5_message.d.ts.map +0 -1
  509. package/esm/types/6_chat_list_item.d.ts.map +0 -1
  510. package/esm/types/6_saved_chat.d.ts.map +0 -1
  511. package/esm/types/7_saved_chats.d.ts.map +0 -1
  512. package/esm/types/7_update.d.ts.map +0 -1
  513. package/script/types/1_user.d.ts.map +0 -1
  514. package/script/types/2_business_connection.d.ts.map +0 -1
  515. package/script/types/2_chosen_inline_result.d.ts.map +0 -1
  516. package/script/types/2_forward_header.d.ts.map +0 -1
  517. package/script/types/2_game.d.ts.map +0 -1
  518. package/script/types/2_inline_query.d.ts.map +0 -1
  519. package/script/types/2_message_reactions.d.ts.map +0 -1
  520. package/script/types/2_pre_checkout_query.d.ts.map +0 -1
  521. package/script/types/3_chat_member_updated.d.ts.map +0 -1
  522. package/script/types/3_join_request.d.ts.map +0 -1
  523. package/script/types/4_claimed_gift.d.ts.map +0 -1
  524. package/script/types/5_claimed_gifts.d.ts.map +0 -1
  525. package/script/types/5_message.d.ts.map +0 -1
  526. package/script/types/6_chat_list_item.d.ts.map +0 -1
  527. package/script/types/6_saved_chat.d.ts.map +0 -1
  528. package/script/types/7_saved_chats.d.ts.map +0 -1
  529. package/script/types/7_update.d.ts.map +0 -1
  530. /package/esm/types/{2_game.js → 3_game.js} +0 -0
  531. /package/esm/types/{1_input_media.js → 3_input_media.js} +0 -0
  532. /package/esm/types/{2_reply_to.js → 4_reply_to.js} +0 -0
  533. /package/esm/types/{5_message_content.js → 6_message_content.js} +0 -0
  534. /package/esm/types/{6_topic.js → 7_topic.js} +0 -0
  535. /package/esm/types/{7_update.js → 8_update.js} +0 -0
  536. /package/script/types/{2_game.js → 3_game.js} +0 -0
  537. /package/script/types/{1_input_media.js → 3_input_media.js} +0 -0
  538. /package/script/types/{2_reply_to.js → 4_reply_to.js} +0 -0
  539. /package/script/types/{5_message_content.js → 6_message_content.js} +0 -0
  540. /package/script/types/{6_topic.js → 7_topic.js} +0 -0
  541. /package/script/types/{7_update.js → 8_update.js} +0 -0
@@ -0,0 +1,109 @@
1
+ // Copyright 2009 The Go Authors. All rights reserved.
2
+ // https://github.com/golang/go/blob/master/LICENSE
3
+ // Copyright 2018-2025 the Deno authors. MIT license.
4
+ // This module is browser compatible.
5
+ /**
6
+ * Port of the Go
7
+ * {@link https://github.com/golang/go/blob/go1.12.5/src/encoding/hex/hex.go | encoding/hex}
8
+ * library.
9
+ *
10
+ * ```ts
11
+ * import {
12
+ * decodeHex,
13
+ * encodeHex,
14
+ * } from "@std/encoding/hex";
15
+ * import { assertEquals } from "@std/assert";
16
+ *
17
+ * assertEquals(encodeHex("abc"), "616263");
18
+ *
19
+ * assertEquals(
20
+ * decodeHex("616263"),
21
+ * new TextEncoder().encode("abc"),
22
+ * );
23
+ * ```
24
+ *
25
+ * @module
26
+ */
27
+ import { validateBinaryLike } from "./_validate_binary_like.js";
28
+ const hexTable = new TextEncoder().encode("0123456789abcdef");
29
+ const textEncoder = new TextEncoder();
30
+ const textDecoder = new TextDecoder();
31
+ function errInvalidByte(byte) {
32
+ return new TypeError(`Invalid byte '${String.fromCharCode(byte)}'`);
33
+ }
34
+ function errLength(len) {
35
+ return new RangeError(`Cannot decode the hex string as the input length should be even: length is ${len}`);
36
+ }
37
+ /** Converts a hex character into its value. */
38
+ function fromHexChar(byte) {
39
+ // '0' <= byte && byte <= '9'
40
+ if (48 <= byte && byte <= 57)
41
+ return byte - 48;
42
+ // 'a' <= byte && byte <= 'f'
43
+ if (97 <= byte && byte <= 102)
44
+ return byte - 97 + 10;
45
+ // 'A' <= byte && byte <= 'F'
46
+ if (65 <= byte && byte <= 70)
47
+ return byte - 65 + 10;
48
+ throw errInvalidByte(byte);
49
+ }
50
+ /**
51
+ * Converts data into a hex-encoded string.
52
+ *
53
+ * @param src The data to encode.
54
+ *
55
+ * @returns The hex-encoded string.
56
+ *
57
+ * @example Usage
58
+ * ```ts
59
+ * import { encodeHex } from "@std/encoding/hex";
60
+ * import { assertEquals } from "@std/assert";
61
+ *
62
+ * assertEquals(encodeHex("abc"), "616263");
63
+ * ```
64
+ */
65
+ export function encodeHex(src) {
66
+ const u8 = validateBinaryLike(src);
67
+ const dst = new Uint8Array(u8.length * 2);
68
+ for (let i = 0; i < u8.length; i++) {
69
+ const v = u8[i];
70
+ dst[i * 2] = hexTable[v >> 4];
71
+ dst[i * 2 + 1] = hexTable[v & 0x0f];
72
+ }
73
+ return textDecoder.decode(dst);
74
+ }
75
+ /**
76
+ * Decodes the given hex-encoded string. If the input is malformed, an error is
77
+ * thrown.
78
+ *
79
+ * @param src The hex-encoded string to decode.
80
+ *
81
+ * @returns The decoded data.
82
+ *
83
+ * @example Usage
84
+ * ```ts
85
+ * import { decodeHex } from "@std/encoding/hex";
86
+ * import { assertEquals } from "@std/assert";
87
+ *
88
+ * assertEquals(
89
+ * decodeHex("616263"),
90
+ * new TextEncoder().encode("abc"),
91
+ * );
92
+ * ```
93
+ */
94
+ export function decodeHex(src) {
95
+ const u8 = textEncoder.encode(src);
96
+ const dst = new Uint8Array(u8.length / 2);
97
+ for (let i = 0; i < dst.length; i++) {
98
+ const a = fromHexChar(u8[i * 2]);
99
+ const b = fromHexChar(u8[i * 2 + 1]);
100
+ dst[i] = (a << 4) | b;
101
+ }
102
+ if (u8.length % 2 === 1) {
103
+ // Check for invalid char before reporting bad length,
104
+ // since the invalid char (if present) is an earlier problem.
105
+ fromHexChar(u8[dst.length * 2]);
106
+ throw errLength(u8.length);
107
+ }
108
+ return dst;
109
+ }
@@ -33,7 +33,7 @@ export declare class SessionEncrypted extends Session implements Session {
33
33
  handlers: Handlers;
34
34
  constructor(dc: DC, params?: SessionParams);
35
35
  setAuthKey(key: Uint8Array<ArrayBuffer>): Promise<void>;
36
- get authKey(): Uint8Array;
36
+ get authKey(): Uint8Array<ArrayBuffer>;
37
37
  connect(): Promise<void>;
38
38
  disconnect(): void;
39
39
  send(body: Uint8Array): Promise<bigint>;
@@ -1 +1 @@
1
- {"version":3,"file":"2_session_encrypted.d.ts","sourceRoot":"","sources":["../../src/session/2_session_encrypted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAAwD,OAAO,EAAuC,MAAM,YAAY,CAAC;AAChI,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAG5C,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAS7D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC;IAC5D,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC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,SAAQ,OAAQ,YAAW,OAAO;;IAI9D,QAAQ,EAAE,QAAQ,CAAM;gBAUZ,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,aAAa;IAMpC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC;IAM7C,IAAI,OAAO,IAAI,UAAU,CAAC,WAAW,CAAC,CAErC;IAEc,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAa9B,UAAU,IAAI,IAAI;IA2ErB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CAsT9C"}
@@ -17,10 +17,11 @@
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 { assertEquals, concat, delay, ige256Decrypt, ige256Encrypt, initTgCrypto, SECOND } from "../0_deps.js";
20
+ import { assertEquals, concat, delay, ige256Decrypt, ige256Encrypt, initTgCrypto, LruCache, SECOND } from "../0_deps.js";
21
21
  import { ConnectionError, TransportError } from "../0_errors.js";
22
22
  import { bigIntFromBuffer, bufferFromBigInt, drop, getLogger, getRandomId, gunzip, mod, sha1, sha256, toUnixTimestamp } from "../1_utilities.js";
23
23
  import { deserializeMessage, Mtproto, repr, serializeMessage, TLReader, X } from "../2_tl.js";
24
+ import { AbortableLoop } from "../client/0_abortable_loop.js";
24
25
  import { TLWriter } from "../tl/1_tl_writer.js";
25
26
  import { SessionError } from "./0_session_error.js";
26
27
  import { Session } from "./1_session.js";
@@ -36,6 +37,8 @@ export class SessionEncrypted extends Session {
36
37
  handlers = {};
37
38
  #toAcknowledge = new Array();
38
39
  #pendingMessages = new Set();
40
+ #pendingContainers = new LruCache(20_000);
41
+ #pendingAcks = new LruCache(100);
39
42
  #pendingPings = new Map();
40
43
  #L;
41
44
  static #TGCRYPTO_INITED = false;
@@ -61,8 +64,8 @@ export class SessionEncrypted extends Session {
61
64
  await initTgCrypto();
62
65
  SessionEncrypted.#TGCRYPTO_INITED = true;
63
66
  }
64
- this.#startReceiveLoop();
65
- this.#startPingLoop();
67
+ this.#receiveLoop.start();
68
+ this.#pingLoop.start();
66
69
  }
67
70
  disconnect() {
68
71
  super.disconnect();
@@ -93,6 +96,7 @@ export class SessionEncrypted extends Session {
93
96
  pendingPing.reject(reason);
94
97
  }
95
98
  this.#pendingPings.clear();
99
+ this.#pendingContainers.clear();
96
100
  }
97
101
  #onMessageFailed(id, reason) {
98
102
  this.#pendingMessages.delete(id);
@@ -105,11 +109,26 @@ export class SessionEncrypted extends Session {
105
109
  else {
106
110
  pendingPing.reject(reason);
107
111
  }
112
+ return;
108
113
  }
109
- else {
110
- // message was not sent by us
111
- this.handlers.onMessageFailed?.(id, reason);
114
+ const pendingAck = this.#pendingAcks.get(id);
115
+ if (pendingAck) {
116
+ for (const id of pendingAck) {
117
+ this.#toAcknowledge.push(id);
118
+ }
119
+ this.#pendingAcks.delete(id);
120
+ return;
112
121
  }
122
+ const pendingContainer = this.#pendingContainers.get(id);
123
+ if (pendingContainer) {
124
+ for (const id of pendingContainer) {
125
+ this.#onMessageFailed(id, reason);
126
+ }
127
+ this.#pendingContainers.delete(id);
128
+ return;
129
+ }
130
+ // message was not sent by us
131
+ this.handlers.onMessageFailed?.(id, reason);
113
132
  }
114
133
  #setServerSalt(newServerSalt) {
115
134
  this.state.serverSalt = newServerSalt;
@@ -129,12 +148,14 @@ export class SessionEncrypted extends Session {
129
148
  body,
130
149
  };
131
150
  if (this.#toAcknowledge.length) {
151
+ const msg_ids = this.#toAcknowledge.splice(0, 8192);
132
152
  const ack = {
133
153
  _: "message",
134
154
  msg_id: this.state.nextMessageId(),
135
155
  seqno: this.state.nextSeqNo(false),
136
- body: Mtproto.serializeObject({ _: "msgs_ack", msg_ids: this.#toAcknowledge.splice(0, 8192) }),
156
+ body: Mtproto.serializeObject({ _: "msgs_ack", msg_ids }),
137
157
  };
158
+ this.#pendingAcks.set(ack.msg_id, msg_ids);
138
159
  message = {
139
160
  _: "message",
140
161
  msg_id: this.state.nextMessageId(),
@@ -149,6 +170,9 @@ export class SessionEncrypted extends Session {
149
170
  const payload = await this.#encryptMessage(message);
150
171
  await this.transport.transport.send(payload);
151
172
  this.#pendingMessages.add(msg_id);
173
+ if (!(message.body instanceof Uint8Array)) {
174
+ this.#pendingContainers.set(message.msg_id, message.body.messages.map((v) => v.msg_id));
175
+ }
152
176
  return msg_id;
153
177
  }
154
178
  async #receive() {
@@ -203,44 +227,34 @@ export class SessionEncrypted extends Session {
203
227
  return deserializeMessage(plainReader);
204
228
  }
205
229
  //// RECEIVE LOOP ////
206
- #startReceiveLoop() {
207
- if (!this.#receiveLoopActive) {
208
- drop(this.#receiveLoop());
230
+ #receiveLoop = new AbortableLoop(this.#receiveLoopBody.bind(this), (err) => {
231
+ this.#L.error("unhandled receive loop error:", err);
232
+ });
233
+ async #receiveLoopBody() {
234
+ let message;
235
+ try {
236
+ message = await this.#receive();
237
+ }
238
+ catch (err) {
239
+ this.#L.error("failed to receive message:", err);
240
+ if (!this.connected) {
241
+ this.#receiveLoop.abort();
242
+ return;
243
+ }
244
+ else {
245
+ return;
246
+ }
209
247
  }
210
- }
211
- #receiveLoopActive = false;
212
- async #receiveLoop() {
213
- this.#receiveLoopActive = true;
214
248
  try {
215
- while (this.connected) {
216
- let message;
217
- try {
218
- message = await this.#receive();
219
- }
220
- catch (err) {
221
- this.#L.error("failed to receive message:", err);
222
- if (!this.connected) {
223
- break;
224
- }
225
- else {
226
- continue;
227
- }
228
- }
229
- try {
230
- if (message.body instanceof Uint8Array) {
231
- this.#onMessage(message.msg_id, message.body);
232
- }
233
- else {
234
- this.#onMessageContainer(message.msg_id, message.body);
235
- }
236
- }
237
- catch (err) {
238
- this.#L.error("failed to handle message:", err);
239
- }
249
+ if (message.body instanceof Uint8Array) {
250
+ this.#onMessage(message.msg_id, message.body);
251
+ }
252
+ else {
253
+ this.#onMessageContainer(message.msg_id, message.body);
240
254
  }
241
255
  }
242
- finally {
243
- this.#receiveLoopActive = false;
256
+ catch (err) {
257
+ this.#L.error("failed to handle message:", err);
244
258
  }
245
259
  }
246
260
  //// RECEIVE LOOP HANDLERS ////
@@ -378,41 +392,26 @@ export class SessionEncrypted extends Session {
378
392
  }
379
393
  //// PING LOOP ////
380
394
  #pingInterval = 56 * SECOND;
381
- #startPingLoop() {
382
- drop(this.#pingLoop());
383
- }
384
395
  #pingLoopAbortController;
385
396
  #LpingLoop;
386
- async #pingLoop() {
387
- this.#pingLoopAbortController?.abort();
388
- const controller = this.#pingLoopAbortController = new AbortController();
397
+ #pingLoop = new AbortableLoop(this.#pingLoopBody.bind(this), (err) => {
398
+ this.#LpingLoop.error(err);
399
+ });
400
+ async #pingLoopBody(signal) {
389
401
  let timeElapsed = 0;
390
- while (this.connected) {
391
- try {
392
- await delay(Math.max(0, this.#pingInterval - timeElapsed), { signal: controller.signal });
393
- if (!this.connected) {
394
- continue;
395
- }
396
- controller.signal.throwIfAborted();
397
- const then = Date.now();
398
- try {
399
- await this.#sendPingDelayDisconnect(this.#pingInterval / SECOND + 15);
400
- }
401
- finally {
402
- timeElapsed = Date.now() - then;
403
- }
404
- controller.signal.throwIfAborted();
405
- }
406
- catch (err) {
407
- if (err instanceof DOMException && err.name === "AbortError") {
408
- break;
409
- }
410
- else if (!this.connected) {
411
- break;
412
- }
413
- this.#LpingLoop.error(err);
414
- }
402
+ await delay(Math.max(0, this.#pingInterval - timeElapsed), { signal });
403
+ if (!this.connected) {
404
+ return;
405
+ }
406
+ signal.throwIfAborted();
407
+ const then = Date.now();
408
+ try {
409
+ await this.#sendPingDelayDisconnect(this.#pingInterval / SECOND + 15);
410
+ }
411
+ finally {
412
+ timeElapsed = Date.now() - then;
415
413
  }
414
+ signal.throwIfAborted();
416
415
  }
417
416
  async #sendPingDelayDisconnect(disconnect_delay) {
418
417
  const ping_id = getRandomId();
@@ -37,5 +37,6 @@ export interface Storage {
37
37
  branch(id: string): Storage;
38
38
  supportsFiles: boolean;
39
39
  mustSerialize: boolean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EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CACnB"}
@@ -31,6 +31,7 @@ export declare class StorageIndexedDB implements Storage {
31
31
  initialize(): Promise<void>;
32
32
  get supportsFiles(): boolean;
33
33
  get mustSerialize(): boolean;
34
+ get isMemory(): boolean;
34
35
  set(k: readonly StorageKeyPart[], v: unknown, tx_?: IDBTransaction): Promise<void>;
35
36
  get<T>(k: readonly StorageKeyPart[], tx_?: IDBTransaction | null, fix?: boolean): Promise<T | null>;
36
37
  getMany<T>(filter: GetManyFilter, params?: {
@@ -1 +1 @@
1
- {"version":3,"file":"2_storage_indexed_db.d.ts","sourceRoot":"","sources":["../../src/storage/2_storage_indexed_db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAM7E,MAAM,WAAW,sBAAsB;IACrC,gDAAgD;IAChD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,qBAAa,gBAAiB,YAAW,OAAO;;IAC9C,QAAQ,EAAE,WAAW,GAAG,IAAI,CAAQ;gBAKxB,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,sBAAsB;IAQzD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,gBAAgB;IAMpC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3B,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,IAAI,aAAa,IAAI,OAAO,CAE3B;IAUD,GAAG,CAAC,CAAC,EAAE,SAAS,cAAc,EAAE,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BlF,GAAG,CAAC,CA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AAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BlF,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,cAAc,EAAE,EAAE,GAAG,CAAC,EAAE,cAAc,GAAG,IAAI,EAAE,GAAG,UAAO,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAoBzF,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,EAAE,GAAG,CAAC,EAAE,cAAc,GAAG,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;IA+CxJ,IAAI,CAAC,GAAG,EAAE,SAAS,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM;CAStD"}
@@ -60,6 +60,9 @@ export class StorageIndexedDB {
60
60
  get mustSerialize() {
61
61
  return true;
62
62
  }
63
+ get isMemory() {
64
+ return false;
65
+ }
63
66
  #fixKey(key) {
64
67
  if (this.#id !== null) {
65
68
  return ["__S" + this.#id, ...key];
@@ -26,6 +26,7 @@ export declare class StorageLocalStorage implements Storage {
26
26
  initialize(): void;
27
27
  get supportsFiles(): boolean;
28
28
  get mustSerialize(): boolean;
29
+ get isMemory(): boolean;
29
30
  get<T>(key_: readonly StorageKeyPart[]): T | null;
30
31
  getMany<T>(filter: GetManyFilter, params?: {
31
32
  limit?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"2_storage_local_storage.node.d.ts","sourceRoot":"","sources":["../../src/storage/2_storage_local_storage.node.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG7E,qBAAa,mBAAoB,YAAW,OAAO;;gBAKrC,IAAI,EAAE,MAAM;IAKxB,IAAI,MAAM,IAAI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AC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;IA+B7H,GAAG,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,OAAO;IASnD,IAAI,CAAC,GAAG,EAAE,SAAS,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM;CAGhD"}
@@ -43,6 +43,9 @@ export class StorageLocalStorage {
43
43
  get mustSerialize() {
44
44
  return true;
45
45
  }
46
+ get isMemory() {
47
+ return false;
48
+ }
46
49
  get(key_) {
47
50
  const key = this.prefix + toString(key_);
48
51
  const value = this.#storage.getItem(key);
@@ -27,6 +27,7 @@ export declare class StorageMemory implements Storage {
27
27
  initialize(): void;
28
28
  branch(id: string): Storage;
29
29
  get supportsFiles(): boolean;
30
+ get isMemory(): boolean;
30
31
  get<T>(key: readonly StorageKeyPart[]): T | null;
31
32
  getMany<T>(filter: GetManyFilter, params?: {
32
33
  limit?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"2_storage_memory.d.ts","sourceRoot":"","sources":["../../src/storage/2_storage_memory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG7E,qBAAa,aAAc,YAAW,OAAO;;IAC3C,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAA8B;;IAMjE,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,UAAU;IAWV,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAM3B,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,GAAG,CAAC,CAAC,EAAE,GAAG,E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,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC;IA4B7H,GAAG,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC;IAWxE,IAAI,CAAC,GAAG,EAAE,SAAS,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM;CAGhD"}
@@ -44,6 +44,9 @@ export class StorageMemory {
44
44
  get supportsFiles() {
45
45
  return false;
46
46
  }
47
+ get isMemory() {
48
+ return true;
49
+ }
47
50
  get(key) {
48
51
  key = this.#fixKey(key);
49
52
  return this.map.get(toString(key)) ?? null;
@@ -27,6 +27,7 @@ export declare class StorageSessionStorage implements Storage {
27
27
  branch(id: string): StorageSessionStorage;
28
28
  initialize(): void;
29
29
  get supportsFiles(): boolean;
30
+ get isMemory(): boolean;
30
31
  get<T>(key_: readonly StorageKeyPart[]): T | null;
31
32
  getMany<T>(filter: GetManyFilter, params?: {
32
33
  limit?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"2_storage_session_storage.d.ts","sourceRoot":"","sources":["../../src/storage/2_storage_session_storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAG7E,qBAAa,qBAAsB,YAAW,OAAO;;gBAGvC,MAAM,EAAE,MAAM;IAU1B,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,qBAAqB;IAIzC,UAAU;IAGV,IAAI,aAAa,IAAI,OAAO,CAE3B;IAED,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,cAAc,EAAE,GAAG,CAAC,GAAG,IAAI;IAUhD,OAA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B7H,GAAG,CAAC,IAAI,EAAE,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC;IASxE,IAAI,CAAC,GAAG,EAAE,SAAS,cAAc,EAAE,EAAE,EAAE,EAAE,MAAM;CAGhD"}
@@ -43,6 +43,9 @@ export class StorageSessionStorage {
43
43
  get supportsFiles() {
44
44
  return false;
45
45
  }
46
+ get isMemory() {
47
+ return false;
48
+ }
46
49
  get(key_) {
47
50
  const key = this.prefix + toString(key_);
48
51
  const value = sessionStorage.getItem(key);
@@ -24,6 +24,7 @@ export declare function analyzeOptionalParam(ntype: string): {
24
24
  bitIndex: number;
25
25
  };
26
26
  export declare function repr(value: unknown): string | null;
27
+ export declare function toJSON(object: unknown): any;
27
28
  export declare function getVectorItemType(type: string): string | null;
28
29
  export declare const X = "X";
29
30
  export declare const VECTOR = 481674261;
@@ -1 +1 @@
1
- {"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAY3F;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAElD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAID,eAAO,MAAM,CAAC,MAAM,CAAC;AACrB,eAAO,MAAM,MAAM,YAAa,CAAC;AACjC,eAAO,MAAM,SAAS,aAAa,CAAC;AACpC,eAAO,MAAM,UAAU,aAAa,CAAC"}
1
+ {"version":3,"file":"0_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAY3F;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAElD;AAGD,wBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,GAAG,GAAG,CAc3C;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAK7D;AAID,eAAO,MAAM,CAAC,MAAM,CAAC;AACrB,eAAO,MAAM,MAAM,YAAa,CAAC;AACjC,eAAO,MAAM,SAAS,aAAa,CAAC;AACpC,eAAO,MAAM,UAAU,aAAa,CAAC"}
@@ -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 { assertEquals, assertFalse } from "../0_deps.js";
20
+ import { assertEquals, assertFalse, encodeHex } from "../0_deps.js";
21
21
  export function isOptionalParam(ntype) {
22
22
  return ntype.includes("?");
23
23
  }
@@ -37,6 +37,25 @@ export function analyzeOptionalParam(ntype) {
37
37
  export function repr(value) {
38
38
  return value === undefined ? "undefined" : value === null ? null : (typeof value === "object" && "_" in value) ? value._ : value.constructor.name;
39
39
  }
40
+ // deno-lint-ignore no-explicit-any
41
+ export function toJSON(object) {
42
+ if (typeof object === "bigint") {
43
+ return { _: "bigint", bigint: String(object) };
44
+ }
45
+ else if (object instanceof Uint8Array) {
46
+ return { _: "buffer", buffer: encodeHex(object) };
47
+ }
48
+ else if (object !== null && typeof object === "object" && ("_" in object)) {
49
+ const newObject = {};
50
+ for (const [key, value] of Object.entries(object)) {
51
+ newObject[key] = toJSON(value);
52
+ }
53
+ return newObject;
54
+ }
55
+ else {
56
+ return object;
57
+ }
58
+ }
40
59
  export function getVectorItemType(type) {
41
60
  if (!type.startsWith(VECTOR_PREFIX) || !type.endsWith(VECTOR_SUFFIX)) {
42
61
  return null;