@mtkruto/node 0.1.101 → 0.1.103

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 (257) hide show
  1. package/esm/0_deps.d.ts +2 -3
  2. package/esm/0_deps.js +2 -3
  3. package/esm/4_constants.d.ts +1 -1
  4. package/esm/4_constants.js +1 -1
  5. package/esm/client/3_types.d.ts +25 -1
  6. package/esm/client/4_client.d.ts +57 -26
  7. package/esm/client/4_client.js +72 -12
  8. package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
  9. package/esm/storage/0_storage.d.ts +3 -1
  10. package/esm/storage/0_storage.js +7 -0
  11. package/esm/storage/0_utilities.d.ts +2 -1
  12. package/esm/storage/0_utilities.js +63 -0
  13. package/esm/storage/1_storage_indexed_db.d.ts +2 -1
  14. package/esm/storage/1_storage_indexed_db.js +18 -1
  15. package/esm/storage/1_storage_local_storage.d.ts +1 -0
  16. package/esm/storage/1_storage_local_storage.js +16 -0
  17. package/esm/storage/1_storage_memory.d.ts +1 -0
  18. package/esm/storage/1_storage_memory.js +14 -1
  19. package/esm/storage/1_storage_session_storage.d.ts +1 -0
  20. package/esm/storage/1_storage_session_storage.js +16 -0
  21. package/esm/tl/6_message.d.ts +1 -0
  22. package/esm/tl/6_message.js +1 -2
  23. package/esm/tl/6_message_test.d.ts +1 -0
  24. package/esm/transport/0_obfuscation.js +3 -3
  25. package/esm/transport/0_transport.d.ts +2 -2
  26. package/esm/transport/0_transport.js +2 -8
  27. package/esm/transport/1_transport_abridged.js +9 -7
  28. package/esm/transport/1_transport_intermediate.js +7 -3
  29. package/esm/types/3_message.d.ts +4 -0
  30. package/esm/types/3_message.js +3 -0
  31. package/esm/utilities/0_bigint.js +2 -1
  32. package/esm/utilities/0_crypto.d.ts +1 -1
  33. package/esm/utilities/0_crypto.js +1 -3
  34. package/package.json +1 -1
  35. package/script/0_deps.d.ts +2 -3
  36. package/script/0_deps.js +3 -5
  37. package/script/4_constants.d.ts +1 -1
  38. package/script/4_constants.js +1 -1
  39. package/script/client/3_types.d.ts +25 -1
  40. package/script/client/4_client.d.ts +57 -26
  41. package/script/client/4_client.js +71 -11
  42. package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.js +10 -3
  43. package/script/storage/0_storage.d.ts +3 -1
  44. package/script/storage/0_storage.js +7 -0
  45. package/script/storage/0_utilities.d.ts +2 -1
  46. package/script/storage/0_utilities.js +65 -1
  47. package/script/storage/1_storage_indexed_db.d.ts +2 -1
  48. package/script/storage/1_storage_indexed_db.js +17 -0
  49. package/script/storage/1_storage_local_storage.d.ts +1 -0
  50. package/script/storage/1_storage_local_storage.js +16 -0
  51. package/script/storage/1_storage_memory.d.ts +1 -0
  52. package/script/storage/1_storage_memory.js +13 -0
  53. package/script/storage/1_storage_session_storage.d.ts +1 -0
  54. package/script/storage/1_storage_session_storage.js +16 -0
  55. package/script/tl/6_message.d.ts +1 -0
  56. package/script/tl/6_message.js +2 -2
  57. package/script/tl/6_message_test.d.ts +1 -0
  58. package/script/transport/0_obfuscation.js +3 -3
  59. package/script/transport/0_transport.d.ts +2 -2
  60. package/script/transport/0_transport.js +2 -8
  61. package/script/transport/1_transport_abridged.js +9 -7
  62. package/script/transport/1_transport_intermediate.js +7 -3
  63. package/script/types/3_message.d.ts +4 -0
  64. package/script/types/3_message.js +3 -0
  65. package/script/utilities/0_bigint.js +2 -1
  66. package/script/utilities/0_crypto.d.ts +1 -1
  67. package/script/utilities/0_crypto.js +1 -3
  68. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +0 -2
  69. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +0 -24
  70. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +0 -2
  71. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +0 -27
  72. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +0 -1
  73. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +0 -21
  74. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +0 -13
  75. package/esm/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +0 -48
  76. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +0 -125
  77. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +0 -3337
  78. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +0 -12
  79. package/esm/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +0 -39
  80. package/esm/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +0 -157
  81. package/esm/deps/deno.land/std@0.203.0/crypto/crypto.js +0 -266
  82. package/esm/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +0 -4
  83. package/esm/deps/deno.land/std@0.203.0/crypto/keystack.js +0 -6
  84. package/esm/deps/deno.land/std@0.203.0/crypto/mod.d.ts +0 -12
  85. package/esm/deps/deno.land/std@0.203.0/crypto/mod.js +0 -14
  86. package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +0 -28
  87. package/esm/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +0 -54
  88. package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +0 -19
  89. package/esm/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +0 -31
  90. package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +0 -46
  91. package/esm/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +0 -149
  92. package/esm/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +0 -24
  93. package/esm/deps/deno.land/std@0.203.0/encoding/base64url.js +0 -80
  94. package/esm/deps/deno.land/std@0.203.0/encoding/hex.d.ts +0 -18
  95. package/esm/deps/deno.land/std@0.203.0/encoding/hex.js +0 -115
  96. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.d.ts +0 -2
  97. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv32.js +0 -29
  98. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.d.ts +0 -2
  99. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/fnv64.js +0 -32
  100. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.d.ts +0 -1
  101. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/mod.js +0 -25
  102. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.d.ts +0 -13
  103. package/script/deps/deno.land/std@0.203.0/crypto/_fnv/util.js +0 -54
  104. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.d.ts +0 -125
  105. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/lib/deno_std_wasm_crypto.generated.js +0 -3345
  106. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.d.ts +0 -12
  107. package/script/deps/deno.land/std@0.203.0/crypto/_wasm/mod.js +0 -44
  108. package/script/deps/deno.land/std@0.203.0/crypto/crypto.d.ts +0 -157
  109. package/script/deps/deno.land/std@0.203.0/crypto/crypto.js +0 -292
  110. package/script/deps/deno.land/std@0.203.0/crypto/keystack.d.ts +0 -4
  111. package/script/deps/deno.land/std@0.203.0/crypto/keystack.js +0 -22
  112. package/script/deps/deno.land/std@0.203.0/crypto/mod.d.ts +0 -12
  113. package/script/deps/deno.land/std@0.203.0/crypto/mod.js +0 -30
  114. package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.d.ts +0 -28
  115. package/script/deps/deno.land/std@0.203.0/crypto/timing_safe_equal.js +0 -58
  116. package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.d.ts +0 -19
  117. package/script/deps/deno.land/std@0.203.0/crypto/to_hash_string.js +0 -35
  118. package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.d.ts +0 -46
  119. package/script/deps/deno.land/std@0.203.0/crypto/unstable/keystack.js +0 -176
  120. package/script/deps/deno.land/std@0.203.0/encoding/base64url.d.ts +0 -24
  121. package/script/deps/deno.land/std@0.203.0/encoding/base64url.js +0 -108
  122. package/script/deps/deno.land/std@0.203.0/encoding/hex.d.ts +0 -18
  123. package/script/deps/deno.land/std@0.203.0/encoding/hex.js +0 -122
  124. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.d.ts +0 -0
  125. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.js +0 -0
  126. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.d.ts +0 -0
  127. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.d.ts +0 -0
  128. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.js +0 -0
  129. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.d.ts +0 -0
  130. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.js +0 -0
  131. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.d.ts +0 -0
  132. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.js +0 -0
  133. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.d.ts +0 -0
  134. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.js +0 -0
  135. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.d.ts +0 -0
  136. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.js +0 -0
  137. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.d.ts +0 -0
  138. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.js +0 -0
  139. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.d.ts +0 -0
  140. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.js +0 -0
  141. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.d.ts +0 -0
  142. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.js +0 -0
  143. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.d.ts +0 -0
  144. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.js +0 -0
  145. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.d.ts +0 -0
  146. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.js +0 -0
  147. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.d.ts +0 -0
  148. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.js +0 -0
  149. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.d.ts +0 -0
  150. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.js +0 -0
  151. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.d.ts +0 -0
  152. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.js +0 -0
  153. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.d.ts +0 -0
  154. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.js +0 -0
  155. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.d.ts +0 -0
  156. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.js +0 -0
  157. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.d.ts +0 -0
  158. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.js +0 -0
  159. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.d.ts +0 -0
  160. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.js +0 -0
  161. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.d.ts +0 -0
  162. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.js +0 -0
  163. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.d.ts +0 -0
  164. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.js +0 -0
  165. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.d.ts +0 -0
  166. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.js +0 -0
  167. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.d.ts +0 -0
  168. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.js +0 -0
  169. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.d.ts +0 -0
  170. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.js +0 -0
  171. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.d.ts +0 -0
  172. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.js +0 -0
  173. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.d.ts +0 -0
  174. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.js +0 -0
  175. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.d.ts +0 -0
  176. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.js +0 -0
  177. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.d.ts +0 -0
  178. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.js +0 -0
  179. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.d.ts +0 -0
  180. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.js +0 -0
  181. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.d.ts +0 -0
  182. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.js +0 -0
  183. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.d.ts +0 -0
  184. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.js +0 -0
  185. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.d.ts +0 -0
  186. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.js +0 -0
  187. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.d.ts +0 -0
  188. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.js +0 -0
  189. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.d.ts +0 -0
  190. /package/esm/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.js +0 -0
  191. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.d.ts +0 -0
  192. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_constants.js +0 -0
  193. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_diff.d.ts +0 -0
  194. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.d.ts +0 -0
  195. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/_format.js +0 -0
  196. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.d.ts +0 -0
  197. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert.js +0 -0
  198. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.d.ts +0 -0
  199. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_almost_equals.js +0 -0
  200. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.d.ts +0 -0
  201. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_array_includes.js +0 -0
  202. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.d.ts +0 -0
  203. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_equals.js +0 -0
  204. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.d.ts +0 -0
  205. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_exists.js +0 -0
  206. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.d.ts +0 -0
  207. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_false.js +0 -0
  208. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.d.ts +0 -0
  209. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater.js +0 -0
  210. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.d.ts +0 -0
  211. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_greater_or_equal.js +0 -0
  212. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.d.ts +0 -0
  213. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_instance_of.js +0 -0
  214. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.d.ts +0 -0
  215. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_is_error.js +0 -0
  216. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.d.ts +0 -0
  217. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less.js +0 -0
  218. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.d.ts +0 -0
  219. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_less_or_equal.js +0 -0
  220. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.d.ts +0 -0
  221. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_match.js +0 -0
  222. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.d.ts +0 -0
  223. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_equals.js +0 -0
  224. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.d.ts +0 -0
  225. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_instance_of.js +0 -0
  226. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.d.ts +0 -0
  227. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_match.js +0 -0
  228. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.d.ts +0 -0
  229. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_not_strict_equals.js +0 -0
  230. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.d.ts +0 -0
  231. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_object_match.js +0 -0
  232. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.d.ts +0 -0
  233. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_rejects.js +0 -0
  234. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.d.ts +0 -0
  235. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_strict_equals.js +0 -0
  236. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.d.ts +0 -0
  237. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_string_includes.js +0 -0
  238. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.d.ts +0 -0
  239. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assert_throws.js +0 -0
  240. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.d.ts +0 -0
  241. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/assertion_error.js +0 -0
  242. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.d.ts +0 -0
  243. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/equal.js +0 -0
  244. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.d.ts +0 -0
  245. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/fail.js +0 -0
  246. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.d.ts +0 -0
  247. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/mod.js +0 -0
  248. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.d.ts +0 -0
  249. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unimplemented.js +0 -0
  250. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.d.ts +0 -0
  251. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/assert/unreachable.js +0 -0
  252. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.d.ts +0 -0
  253. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/_util.js +0 -0
  254. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.d.ts +0 -0
  255. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/encoding/base64.js +0 -0
  256. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.d.ts +0 -0
  257. /package/script/deps/deno.land/{std@0.203.0 → std@0.204.0}/fmt/colors.js +0 -0
@@ -1,10 +1,9 @@
1
1
  import * as dntShim from "../_dnt.shims.js";
2
2
  import { bufferFromBigInt, concat, CTR } from "../1_utilities.js";
3
3
  export async function getObfuscationParameters(protocol, connection) {
4
- const dc = 0xFCFF;
5
4
  let init;
6
5
  while (true) {
7
- init = concat(dntShim.crypto.getRandomValues(new Uint8Array(56)), bufferFromBigInt(protocol, 4, false), bufferFromBigInt(dc, 2, false), dntShim.crypto.getRandomValues(new Uint8Array(2)));
6
+ init = concat(dntShim.crypto.getRandomValues(new Uint8Array(56)), bufferFromBigInt(protocol, 4, false), dntShim.crypto.getRandomValues(new Uint8Array(4)));
8
7
  if (init[0] == 0xEF) {
9
8
  continue;
10
9
  }
@@ -22,7 +21,8 @@ export async function getObfuscationParameters(protocol, connection) {
22
21
  const encryptKey = init.slice(8, 8 + 32);
23
22
  const encryptIv = init.slice(40, 40 + 16);
24
23
  const encryptionCTR = new CTR(encryptKey, encryptIv);
25
- const encryptedInit = encryptionCTR.call(init);
24
+ const encryptedInit = new Uint8Array(init);
25
+ encryptionCTR.call(encryptedInit);
26
26
  const initRev = new Uint8Array(init).reverse();
27
27
  const decryptKey = initRev.slice(8, 8 + 32);
28
28
  const decryptIv = initRev.slice(40, 40 + 16);
@@ -5,8 +5,8 @@ export declare abstract class Transport {
5
5
  encryptionCTR: CTR;
6
6
  decryptionCTR: CTR;
7
7
  } | null;
8
- protected encrypt(buffer: Uint8Array): Uint8Array;
9
- protected decrypt(buffer: Uint8Array): Uint8Array;
8
+ protected encrypt(buffer: Uint8Array): void;
9
+ protected decrypt(buffer: Uint8Array): void;
10
10
  abstract initialize(): MaybePromise<void>;
11
11
  abstract receive(): MaybePromise<Uint8Array>;
12
12
  abstract send(buffer: Uint8Array): MaybePromise<void>;
@@ -15,18 +15,12 @@ export class Transport {
15
15
  }
16
16
  encrypt(buffer) {
17
17
  if (this.obfuscationParameters) {
18
- return this.obfuscationParameters.encryptionCTR.call(buffer);
19
- }
20
- else {
21
- return buffer;
18
+ this.obfuscationParameters.encryptionCTR.call(buffer);
22
19
  }
23
20
  }
24
21
  decrypt(buffer) {
25
22
  if (this.obfuscationParameters) {
26
- return this.obfuscationParameters.decryptionCTR.call(buffer);
27
- }
28
- else {
29
- return buffer;
23
+ this.obfuscationParameters.decryptionCTR.call(buffer);
30
24
  }
31
25
  }
32
26
  }
@@ -34,24 +34,24 @@ export class TransportAbridged extends Transport {
34
34
  async receive() {
35
35
  let length;
36
36
  {
37
- let buffer = new Uint8Array(1);
37
+ const buffer = new Uint8Array(1);
38
38
  await this.connection.read(buffer);
39
- buffer = this.decrypt(buffer);
39
+ this.decrypt(buffer);
40
40
  if (buffer[0] < 0x7F) {
41
41
  length = buffer[0];
42
42
  }
43
43
  else {
44
- let buffer = new Uint8Array(3);
44
+ const buffer = new Uint8Array(3);
45
45
  await this.connection.read(buffer);
46
- buffer = this.decrypt(buffer);
46
+ this.decrypt(buffer);
47
47
  const dataView = new DataView(buffer.buffer);
48
48
  length = dataView.getUint16(0, true);
49
49
  }
50
50
  }
51
51
  length *= 4;
52
- let buffer = new Uint8Array(length);
52
+ const buffer = new Uint8Array(length);
53
53
  await this.connection.read(buffer);
54
- buffer = this.decrypt(buffer);
54
+ this.decrypt(buffer);
55
55
  return buffer;
56
56
  }
57
57
  async send(buffer) {
@@ -61,7 +61,9 @@ export class TransportAbridged extends Transport {
61
61
  const bufferLength = buffer.length / 4;
62
62
  const header = new Uint8Array([bufferLength >= 0x7F ? 0x7F : bufferLength]);
63
63
  const length = bufferLength >= 0x7F ? bufferFromBigInt(bufferLength, 3) : new Uint8Array();
64
- await this.connection.write(this.encrypt(concat(header, length, buffer)));
64
+ const data = concat(header, length, buffer);
65
+ this.encrypt(data);
66
+ await this.connection.write(data);
65
67
  }
66
68
  deinitialize() {
67
69
  this.initialized = false;
@@ -36,19 +36,23 @@ export class TransportIntermediate extends Transport {
36
36
  {
37
37
  const buffer = new Uint8Array(4);
38
38
  await this.connection.read(buffer);
39
- const dataView = new DataView(this.decrypt(buffer).buffer);
39
+ this.decrypt(buffer);
40
+ const dataView = new DataView(buffer.buffer);
40
41
  length = dataView.getUint32(0, true);
41
42
  }
42
43
  const buffer = new Uint8Array(length);
43
44
  await this.connection.read(buffer);
44
- return this.decrypt(buffer);
45
+ this.decrypt(buffer);
46
+ return buffer;
45
47
  }
46
48
  async send(buffer) {
47
49
  if (!this.initialized) {
48
50
  throw new Error("Transport not initialized");
49
51
  }
50
52
  const length = bufferFromBigInt(buffer.length, 4);
51
- await this.connection.write(this.encrypt(concat(length, buffer)));
53
+ const data = concat(length, buffer);
54
+ this.encrypt(data);
55
+ await this.connection.write(data);
52
56
  }
53
57
  deinitialize() {
54
58
  this.initialized = false;
@@ -126,6 +126,10 @@ export interface Message {
126
126
  supergroupCreated?: true;
127
127
  /** Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel. */
128
128
  channelCreated?: true;
129
+ /** Service message: auto-delete timer settings changed in the chat */
130
+ messageAutoDeleteTimerChanged?: {
131
+ messageAutoDeleteTime: number;
132
+ };
129
133
  /** The group has been migrated to a supergroup with the specified identifier */
130
134
  chatMigratedTo?: number;
131
135
  /** The supergroup has been migrated from a group with the specified identifier */
@@ -177,6 +177,9 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
177
177
  message.videoChatStarted = {};
178
178
  }
179
179
  }
180
+ else if (message_.action instanceof types.MessageActionSetMessagesTTL) {
181
+ message.messageAutoDeleteTimerChanged = { messageAutoDeleteTime: message_.action.period || 0 };
182
+ }
180
183
  return cleanObject(message);
181
184
  }
182
185
  export async function constructMessage(message_, getEntity, getMessage, getStickerSetName) {
@@ -16,7 +16,8 @@ export function modExp(a, b, n) {
16
16
  return result;
17
17
  }
18
18
  export function mod(n, m) {
19
- // @ts-ignore: TODO: do sth
19
+ // deno-lint-ignore ban-ts-comment
20
+ // @ts-ignore
20
21
  return ((n % m) + m) % m;
21
22
  }
22
23
  export function bigIntFromBuffer(buffer, little = true, signed = false) {
@@ -3,5 +3,5 @@ export declare class CTR {
3
3
  iv: Uint8Array;
4
4
  state: Uint8Array;
5
5
  constructor(key: Uint8Array, iv: Uint8Array);
6
- call(data: Uint8Array): Uint8Array;
6
+ call(data: Uint8Array): void;
7
7
  }
@@ -21,8 +21,6 @@ export class CTR {
21
21
  });
22
22
  }
23
23
  call(data) {
24
- const v = new Uint8Array(data); // TODO: don't copy
25
- ctr256(v, this.key, this.iv, this.state);
26
- return v;
24
+ ctr256(data, this.key, this.iv, this.state);
27
25
  }
28
26
  }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.1.101",
5
+ "version": "0.1.103",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -1,9 +1,8 @@
1
- export * from "./deps/deno.land/std@0.203.0/assert/mod.js";
1
+ export * from "./deps/deno.land/std@0.204.0/assert/mod.js";
2
2
  export { ctr256, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.3.3/mod.js";
3
3
  export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/gzip/gzip.js";
4
4
  export { Mutex, type MutexInterface } from "async-mutex";
5
5
  export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
6
6
  import { debug as debug_ } from "./deps/raw.githubusercontent.com/MTKruto/debug/main/mod.js";
7
7
  export declare const debug: typeof debug_;
8
- export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.203.0/encoding/base64.js";
9
- export { crypto } from "./deps/deno.land/std@0.203.0/crypto/mod.js";
8
+ export { decode as base64Decode, encode as base64Encode } from "./deps/deno.land/std@0.204.0/encoding/base64.js";
package/script/0_deps.js CHANGED
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.crypto = exports.base64Encode = exports.base64Decode = exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256 = void 0;
18
- __exportStar(require("./deps/deno.land/std@0.203.0/assert/mod.js"), exports);
17
+ exports.base64Encode = exports.base64Decode = exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256 = void 0;
18
+ __exportStar(require("./deps/deno.land/std@0.204.0/assert/mod.js"), exports);
19
19
  var mod_js_1 = require("./deps/deno.land/x/tgcrypto@0.3.3/mod.js");
20
20
  Object.defineProperty(exports, "ctr256", { enumerable: true, get: function () { return mod_js_1.ctr256; } });
21
21
  Object.defineProperty(exports, "factorize", { enumerable: true, get: function () { return mod_js_1.factorize; } });
@@ -32,8 +32,6 @@ Object.defineProperty(exports, "Parser", { enumerable: true, get: function () {
32
32
  const mod_js_3 = require("./deps/raw.githubusercontent.com/MTKruto/debug/main/mod.js");
33
33
  const debug = (v) => (0, mod_js_3.debug)(v);
34
34
  exports.debug = debug;
35
- var base64_js_1 = require("./deps/deno.land/std@0.203.0/encoding/base64.js");
35
+ var base64_js_1 = require("./deps/deno.land/std@0.204.0/encoding/base64.js");
36
36
  Object.defineProperty(exports, "base64Decode", { enumerable: true, get: function () { return base64_js_1.decode; } });
37
37
  Object.defineProperty(exports, "base64Encode", { enumerable: true, get: function () { return base64_js_1.encode; } });
38
- var mod_js_4 = require("./deps/deno.land/std@0.203.0/crypto/mod.js");
39
- Object.defineProperty(exports, "crypto", { enumerable: true, get: function () { return mod_js_4.crypto; } });
@@ -5,7 +5,7 @@ export declare const PUBLIC_KEYS: PublicKeys;
5
5
  export declare const VECTOR_CONSTRUCTOR = 481674261;
6
6
  export declare const INITIAL_DC: DC;
7
7
  export declare const LAYER = 161;
8
- export declare const APP_VERSION = "MTKruto 0.1.101";
8
+ export declare const APP_VERSION = "MTKruto 0.1.103";
9
9
  export declare const DEVICE_MODEL: string;
10
10
  export declare const LANG_CODE: string;
11
11
  export declare const LANG_PACK = "";
@@ -80,7 +80,7 @@ exports.PUBLIC_KEYS = Object.freeze([
80
80
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
81
81
  exports.INITIAL_DC = "2-test";
82
82
  exports.LAYER = 161;
83
- exports.APP_VERSION = "MTKruto 0.1.101";
83
+ exports.APP_VERSION = "MTKruto 0.1.103";
84
84
  // @ts-ignore: lib
85
85
  exports.DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
86
86
  exports.LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -1,6 +1,6 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
2
  import { functions, types } from "../2_tl.js";
3
- import { CallbackQuery, ChatID, ForceReply, InlineKeyboardMarkup, InlineQuery, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
3
+ import { BotCommandScope, CallbackQuery, ChatID, ForceReply, InlineKeyboardMarkup, InlineQuery, InlineQueryResultButton, Message, MessageEntity, ReplyKeyboardMarkup, ReplyKeyboardRemove } from "../3_types.js";
4
4
  import { With } from "./0_utilities.js";
5
5
  import { ClientPlainParams } from "./2_client_plain.js";
6
6
  export type ParseMode = "HTML" | null;
@@ -194,6 +194,30 @@ export interface SendPollParams {
194
194
  */
195
195
  protectContent?: boolean;
196
196
  }
197
+ export interface DownloadParams {
198
+ /** Size of each download chunk in bytes. */
199
+ chunkSize?: number;
200
+ }
201
+ export interface UploadParams {
202
+ /** The file name to assign. */
203
+ fileName?: string;
204
+ /** Size of each upload chunk in bytes. */
205
+ chunkSize?: number;
206
+ /** Upload abort signal. */
207
+ signal?: AbortSignal | null;
208
+ }
209
+ export interface AnswerInlineQueryParams {
210
+ cacheTime?: number;
211
+ isPersonal?: boolean;
212
+ nextOffset?: string;
213
+ isGallery?: boolean;
214
+ button?: InlineQueryResultButton;
215
+ }
216
+ export interface SetMyCommandsParams {
217
+ languageCode?: string;
218
+ scope?: BotCommandScope;
219
+ }
220
+ export type GetMyCommandsParams = SetMyCommandsParams;
197
221
  export type ConnectionState = "notConnected" | "updating" | "ready";
198
222
  export type AuthorizationState = {
199
223
  authorized: boolean;
@@ -2,11 +2,11 @@ import { MaybePromise } from "../1_utilities.js";
2
2
  import { functions, ReadObject, types } from "../2_tl.js";
3
3
  import { Storage } from "../3_storage.js";
4
4
  import { DC } from "../3_transport.js";
5
- import { BotCommand, BotCommandScope, ChatAction, ChatID, InlineQueryResult, InlineQueryResultButton, Message } from "../3_types.js";
5
+ import { BotCommand, ChatAction, ChatID, InlineQueryResult, Message } from "../3_types.js";
6
6
  import { Migrate } from "../4_errors.js";
7
7
  import { With } from "./0_utilities.js";
8
8
  import { ClientAbstract } from "./1_client_abstract.js";
9
- import { AnswerCallbackQueryParams, AuthorizeUserParams, ClientParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, Handler, ParseMode, SendMessagesParams, SendPollParams, Update } from "./3_types.js";
9
+ import { AnswerCallbackQueryParams, AnswerInlineQueryParams, AuthorizeUserParams, ClientParams, DownloadParams, EditMessageParams, FilterableUpdates, FilterUpdate, ForwardMessagesParams, GetMyCommandsParams, Handler, ParseMode, SendMessagesParams, SendPollParams, SetMyCommandsParams, Update, UploadParams } from "./3_types.js";
10
10
  export declare const getEntity: unique symbol;
11
11
  export declare const getStickerSetName: unique symbol;
12
12
  export declare const handleMigrationError: unique symbol;
@@ -145,7 +145,7 @@ export declare class Client extends ClientAbstract {
145
145
  * @param messageId The ID of the message.
146
146
  * @param text The new text of the message.
147
147
  */
148
- editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<void>;
148
+ editMessageText(chatId: ChatID, messageId: number, text: string, params?: EditMessageParams): Promise<With<Message, "text">>;
149
149
  private getMessagesInner;
150
150
  /**
151
151
  * Retrieve multiple messages.
@@ -168,9 +168,7 @@ export declare class Client extends ClientAbstract {
168
168
  *
169
169
  * @param fileId The identifier of the file to download.
170
170
  */
171
- download(fileId: string, params?: {
172
- chunkSize?: number;
173
- }): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
171
+ download(fileId: string, params?: DownloadParams): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
174
172
  [getStickerSetName](inputStickerSet: types.InputStickerSetID, hash?: number): Promise<string>;
175
173
  /**
176
174
  * Forward multiple messages.
@@ -223,30 +221,63 @@ export declare class Client extends ClientAbstract {
223
221
  *
224
222
  * @param contents The contents of the file.
225
223
  */
226
- upload(contents: Uint8Array, params?: {
227
- fileName?: string;
228
- chunkSize?: number;
229
- signal?: AbortSignal | null;
230
- }): Promise<types.InputFile | types.InputFileBig>;
231
- setMyCommands(commands: BotCommand[], params?: {
232
- languageCode?: string;
233
- scope?: BotCommandScope;
234
- }): Promise<void>;
235
- getMyCommands(params?: {
236
- languageCode?: string;
237
- scope?: BotCommandScope;
238
- }): Promise<BotCommand[]>;
239
- answerInlineQuery(id: string, results: InlineQueryResult[], params?: {
240
- cacheTime?: number;
241
- isPersonal?: boolean;
242
- nextOffset?: string;
243
- isGallery?: boolean;
244
- button: InlineQueryResultButton;
245
- }): Promise<void>;
224
+ upload(contents: Uint8Array, params?: UploadParams): Promise<types.InputFile | types.InputFileBig>;
225
+ /**
226
+ * Set the bot's commands in the given scope and/or language. Bot-only.
227
+ *
228
+ * @param commands The commands to set.
229
+ */
230
+ setMyCommands(commands: BotCommand[], params?: SetMyCommandsParams): Promise<void>;
231
+ /**
232
+ * Get the bot's commands in the given scope and/or language. Bot-only.
233
+ */
234
+ getMyCommands(params?: GetMyCommandsParams): Promise<BotCommand[]>;
235
+ /**
236
+ * Answer an inline query. Bot-only.
237
+ *
238
+ * @param id The ID of the inline query to answer.
239
+ * @param results The results to answer with.
240
+ */
241
+ answerInlineQuery(id: string, results: InlineQueryResult[], params?: AnswerInlineQueryParams): Promise<void>;
246
242
  private handle;
247
243
  use(handler: Handler): void;
248
244
  branch(predicate: (upd: Update) => MaybePromise<boolean>, trueHandler: Handler, falseHandler: Handler): void;
249
245
  filter<D extends Update>(predicate: (update: Update) => update is D, handler: Handler<D>): void;
250
246
  filter(predicate: (update: Update) => MaybePromise<boolean>, handler: Handler): void;
251
247
  on<T extends keyof Update, F extends keyof NonNullable<Update[T]>>(filter: T extends FilterableUpdates ? T | [T, F, ...F[]] : T, handler: Handler<FilterUpdate<Update, T, F>>): void;
248
+ private setMyInfo;
249
+ /**
250
+ * Set the bot's description in the given language. Bot-only.
251
+ */
252
+ setMyDescription({ description, languageCode }: {
253
+ description?: string;
254
+ languageCode?: string;
255
+ }): Promise<void>;
256
+ /**
257
+ * Set the bot's name in the given language. Bot-only.
258
+ */
259
+ setMyName({ name, languageCode }: {
260
+ name?: string;
261
+ languageCode?: string;
262
+ }): Promise<void>;
263
+ /**
264
+ * Set the bot's short description in the given language. Bot-only.
265
+ */
266
+ setMyShortDescription({ shortDescription: about, languageCode }: {
267
+ shortDescription?: string;
268
+ languageCode?: string;
269
+ }): Promise<void>;
270
+ private getMyInfo;
271
+ /**
272
+ * Get the bot's description in the given language. Bot-only.
273
+ */
274
+ getMyDescription(languageCode?: string): Promise<string>;
275
+ /**
276
+ * Set the bot's name in the given language. Bot-only.
277
+ */
278
+ getMyName(languageCode?: string): Promise<string>;
279
+ /**
280
+ * Get the bot's short description in the given language. Bot-only.
281
+ */
282
+ getMyShortDescription(languageCode?: string): Promise<string>;
252
283
  }
@@ -990,8 +990,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
990
990
  }
991
991
  }
992
992
  else if (difference instanceof _2_tl_js_1.types.UpdatesDifferenceTooLong) {
993
- // TODO: we actually do now
994
- // stored messages should be invalidated in case we store messages in the future
993
+ await this.storage.deleteMessages();
995
994
  state.pts = difference.pts;
996
995
  dGap("received differenceTooLong");
997
996
  }
@@ -1203,10 +1202,10 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1203
1202
  const messages = new Array();
1204
1203
  if (updates instanceof _2_tl_js_1.types.Updates) {
1205
1204
  for (const update of updates.updates) {
1206
- if (update instanceof _2_tl_js_1.types.UpdateNewMessage) {
1205
+ if (update instanceof _2_tl_js_1.types.UpdateNewMessage || update instanceof _2_tl_js_1.types.UpdateEditMessage) {
1207
1206
  messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(this)));
1208
1207
  }
1209
- else if (update instanceof _2_tl_js_1.types.UpdateNewChannelMessage) {
1208
+ else if (update instanceof _2_tl_js_1.types.UpdateNewChannelMessage || update instanceof _2_tl_js_1.types.UpdateEditChannelMessage) {
1210
1209
  messages.push(await (0, _3_types_js_1.constructMessage)(update.message, this[exports.getEntity].bind(this), this.getMessage.bind(this), this[exports.getStickerSetName].bind(this)));
1211
1210
  }
1212
1211
  }
@@ -1287,7 +1286,7 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1287
1286
  */
1288
1287
  async editMessageText(chatId, messageId, text, params) {
1289
1288
  const [message, entities] = this.parseText(text, params);
1290
- await this.invoke(new _2_tl_js_1.functions.MessagesEditMessage({
1289
+ const result = await this.invoke(new _2_tl_js_1.functions.MessagesEditMessage({
1291
1290
  id: messageId,
1292
1291
  peer: await this.getInputPeer(chatId),
1293
1292
  entities,
@@ -1295,6 +1294,8 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1295
1294
  noWebpage: params?.disableWebPagePreview ? true : undefined,
1296
1295
  replyMarkup: await this.constructReplyMarkup(params),
1297
1296
  }));
1297
+ const message_ = await this.updatesToMessages(chatId, result).then((v) => v[0]);
1298
+ return Client.assertMsgHas(message_, "text");
1298
1299
  }
1299
1300
  async getMessagesInner(chatId_, messageIds) {
1300
1301
  const peer = await this.getInputPeer(chatId_);
@@ -1690,9 +1691,6 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1690
1691
  client.state.salt = this.state.salt;
1691
1692
  await client.connect();
1692
1693
  let part = 0;
1693
- const md5sum = await _0_deps_js_1.crypto.subtle.digest("MD5", contents).then((v) => [...new Uint8Array(v)]
1694
- .map((b) => b.toString(16).padStart(2, "0"))
1695
- .join(""));
1696
1694
  const partCount = Math.ceil(contents.length / chunkSize);
1697
1695
  try {
1698
1696
  main: for (; part < partCount; part++) {
@@ -1749,23 +1747,37 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1749
1747
  return new _2_tl_js_1.types.InputFileBig({ id: fileId, parts: contents.length / chunkSize, name });
1750
1748
  }
1751
1749
  else {
1752
- return new _2_tl_js_1.types.InputFile({ id: fileId, name, parts: part, md5Checksum: md5sum });
1750
+ return new _2_tl_js_1.types.InputFile({ id: fileId, name, parts: part, md5Checksum: "" });
1753
1751
  }
1754
1752
  }
1753
+ /**
1754
+ * Set the bot's commands in the given scope and/or language. Bot-only.
1755
+ *
1756
+ * @param commands The commands to set.
1757
+ */
1755
1758
  async setMyCommands(commands, params) {
1756
1759
  await this.invoke(new _2_tl_js_1.functions.BotsSetBotCommands({
1757
1760
  commands: commands.map((v) => new _2_tl_js_1.types.BotCommand(v)),
1758
1761
  langCode: params?.languageCode ?? "",
1759
- scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)), // TODO: use params.scope
1762
+ scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)),
1760
1763
  }));
1761
1764
  }
1765
+ /**
1766
+ * Get the bot's commands in the given scope and/or language. Bot-only.
1767
+ */
1762
1768
  async getMyCommands(params) {
1763
1769
  const commands_ = await this.invoke(new _2_tl_js_1.functions.BotsGetBotCommands({
1764
1770
  langCode: params?.languageCode ?? "",
1765
- scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)), // TODO: use params.scope
1771
+ scope: await (0, _3_types_js_1.botCommandScopeToTlObject)(params?.scope ?? { type: "default" }, this.getInputPeer.bind(this)),
1766
1772
  }));
1767
1773
  return commands_.map((v) => ({ command: v.command, description: v.description }));
1768
1774
  }
1775
+ /**
1776
+ * Answer an inline query. Bot-only.
1777
+ *
1778
+ * @param id The ID of the inline query to answer.
1779
+ * @param results The results to answer with.
1780
+ */
1769
1781
  async answerInlineQuery(id, results, params) {
1770
1782
  await this.invoke(new _2_tl_js_1.functions.MessagesSetInlineBotResults({
1771
1783
  queryId: BigInt(id),
@@ -1824,5 +1836,53 @@ class Client extends _1_client_abstract_js_1.ClientAbstract {
1824
1836
  }
1825
1837
  }, handler);
1826
1838
  }
1839
+ async setMyInfo(info) {
1840
+ await this.invoke(new _2_tl_js_1.functions.BotsSetBotInfo({ bot: new _2_tl_js_1.types.InputUserSelf(), ...info }));
1841
+ }
1842
+ /**
1843
+ * Set the bot's description in the given language. Bot-only.
1844
+ */
1845
+ async setMyDescription({ description, languageCode }) {
1846
+ await this.assertBot("setMyDescription");
1847
+ await this.setMyInfo({ description, langCode: languageCode ?? "" });
1848
+ }
1849
+ /**
1850
+ * Set the bot's name in the given language. Bot-only.
1851
+ */
1852
+ async setMyName({ name, languageCode }) {
1853
+ await this.assertBot("setMyName");
1854
+ await this.setMyInfo({ name, langCode: languageCode ?? "" });
1855
+ }
1856
+ /**
1857
+ * Set the bot's short description in the given language. Bot-only.
1858
+ */
1859
+ async setMyShortDescription({ shortDescription: about, languageCode }) {
1860
+ await this.assertBot("setMyShortDescription");
1861
+ await this.setMyInfo({ about, langCode: languageCode ?? "" });
1862
+ }
1863
+ getMyInfo(languageCode) {
1864
+ return this.invoke(new _2_tl_js_1.functions.BotsGetBotInfo({ bot: new _2_tl_js_1.types.InputUserSelf(), langCode: languageCode ?? "" }));
1865
+ }
1866
+ /**
1867
+ * Get the bot's description in the given language. Bot-only.
1868
+ */
1869
+ async getMyDescription(languageCode) {
1870
+ await this.assertBot("getMyDescription");
1871
+ return await this.getMyInfo(languageCode).then((v) => v.description);
1872
+ }
1873
+ /**
1874
+ * Set the bot's name in the given language. Bot-only.
1875
+ */
1876
+ async getMyName(languageCode) {
1877
+ await this.assertBot("getMyName");
1878
+ return await this.getMyInfo(languageCode).then((v) => v.description);
1879
+ }
1880
+ /**
1881
+ * Get the bot's short description in the given language. Bot-only.
1882
+ */
1883
+ async getMyShortDescription(languageCode) {
1884
+ await this.assertBot("getMyShortDescription");
1885
+ return await this.getMyInfo(languageCode).then((v) => v.about);
1886
+ }
1827
1887
  }
1828
1888
  exports.Client = Client;
@@ -243,14 +243,21 @@ function diffstr(A, B) {
243
243
  }
244
244
  }
245
245
  // Compute word-diff
246
- const aLines = added.length < removed.length ? added : removed;
247
- const bLines = aLines === removed ? added : removed;
246
+ const hasMoreRemovedLines = added.length < removed.length;
247
+ const aLines = hasMoreRemovedLines ? added : removed;
248
+ const bLines = hasMoreRemovedLines ? removed : added;
248
249
  for (const a of aLines) {
249
250
  let tokens = [], b;
250
251
  // Search another diff line with at least one common token
251
252
  while (bLines.length) {
252
253
  b = bLines.shift();
253
- tokens = diff(tokenize(a.value, { wordDiff: true }), tokenize(b?.value ?? "", { wordDiff: true }));
254
+ const tokenized = [
255
+ tokenize(a.value, { wordDiff: true }),
256
+ tokenize(b?.value ?? "", { wordDiff: true }),
257
+ ];
258
+ if (hasMoreRemovedLines)
259
+ tokenized.reverse();
260
+ tokens = diff(tokenized[0], tokenized[1]);
254
261
  if (tokens.some(({ type, value }) => type === DiffType.common && value.trim().length)) {
255
262
  break;
256
263
  }
@@ -1,12 +1,13 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
2
  import { TLObject, types } from "../2_tl.js";
3
3
  import { DC } from "../3_transport.js";
4
- export type StorageKeyPart = string | number | bigint | Uint8Array;
4
+ export type StorageKeyPart = string | number | bigint;
5
5
  export declare abstract class Storage {
6
6
  private _authKeyId;
7
7
  abstract init(): MaybePromise<void>;
8
8
  abstract set(key: readonly StorageKeyPart[], value: unknown): MaybePromise<void>;
9
9
  abstract get<T>(key: readonly StorageKeyPart[]): MaybePromise<T | null>;
10
+ abstract getMany<T>(prefix: readonly StorageKeyPart[]): MaybePromise<Generator<[readonly StorageKeyPart[], T]> | AsyncGenerator<[readonly StorageKeyPart[], T]>>;
10
11
  setDc(dc: DC | null): MaybePromise<void>;
11
12
  getDc(): MaybePromise<DC | null>;
12
13
  private resetAuthKeyId;
@@ -24,6 +25,7 @@ export declare abstract class Storage {
24
25
  setState(state: types.UpdatesState): Promise<void>;
25
26
  getState(): Promise<types.UpdatesState | null>;
26
27
  setMessage(chatId: number, messageId: number, message: types.TypeMessage | null): Promise<void>;
28
+ deleteMessages(): Promise<void>;
27
29
  getMessageChat(messageId: number): MaybePromise<number | null>;
28
30
  getMessage(chatId: number, messageId: number): Promise<types.TypeMessage | null>;
29
31
  setChannelPts(channelId: bigint, pts: number): Promise<void>;
@@ -107,6 +107,13 @@ class Storage {
107
107
  }
108
108
  await this.setTlObject(KPARTS_MESSAGE(chatId, messageId), message);
109
109
  }
110
+ async deleteMessages() {
111
+ const maybePromises = new Array();
112
+ for await (const [k, o] of await this.getMany(["messageRefs"])) {
113
+ maybePromises.push(Promise.all([this.set(k, null), o == null ? Promise.resolve() : this.set(KPARTS_MESSAGE(o, k[1]), null)]).then(() => { }));
114
+ }
115
+ await Promise.all(maybePromises.filter((v) => v instanceof Promise));
116
+ }
110
117
  getMessageChat(messageId) {
111
118
  return this.get(KPARTS_MESSAGE_REF(messageId));
112
119
  }
@@ -10,4 +10,5 @@ export declare enum ValueType {
10
10
  }
11
11
  export declare function toString(value: unknown): string;
12
12
  export declare function fromString<T>(string: string): any;
13
- export declare function fixKey(key: StorageKeyPart[]): (string | number | Uint8Array)[];
13
+ export declare function fixKey(key: readonly StorageKeyPart[]): (string | number)[];
14
+ export declare function getPrefixKeyRange(prefix: any): IDBKeyRange;