@mtkruto/node 0.67.1 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_errors.js +2 -6
- package/esm/3_errors.js +2 -12
- package/esm/3_transport.d.ts +3 -3
- package/esm/3_transport.js +3 -3
- package/esm/3_types.d.ts +8 -7
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +8 -7
- package/esm/4_errors.js +2 -12
- package/esm/_dnt.polyfills.d.ts +99 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +127 -1
- package/esm/_dnt.test_polyfills.d.ts.map +1 -0
- package/esm/client/0_filters_test.d.ts.map +1 -1
- package/esm/client/0_markdown_test.d.ts.map +1 -1
- package/esm/client/0_params.d.ts +2 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts +5 -5
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password_test.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +143 -155
- package/esm/client/0_storage_operations_test.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +1 -1
- package/esm/client/0_utilities_test.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +4 -22
- package/esm/client/1_composer.js +8 -21
- package/esm/client/2_account_manager.js +85 -97
- package/esm/client/2_bot_info_manager.js +26 -38
- package/esm/client/2_business_connection_manager.js +10 -23
- package/esm/client/2_client_encrypted.js +194 -211
- package/esm/client/2_file_manager.d.ts +4 -3
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +268 -224
- package/esm/client/2_file_manager_test.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +8 -21
- package/esm/client/2_payment_manager.js +7 -20
- package/esm/client/2_reaction_manager.js +7 -20
- package/esm/client/2_translations_manager.js +97 -107
- package/esm/client/2_update_manager.js +764 -759
- package/esm/client/3_client_encrypted_pool.js +10 -26
- package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts +1 -1
- package/esm/client/3_message_manager.js +441 -448
- package/esm/client/3_message_manager_test.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.d.ts +1 -1
- package/esm/client/3_video_chat_manager.js +57 -68
- package/esm/client/4_callback_query_manager.js +18 -30
- package/esm/client/4_chat_list_manager.js +322 -318
- package/esm/client/4_chat_manager.js +118 -131
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.js +16 -29
- package/esm/client/4_inline_query_manager.js +16 -28
- package/esm/client/4_link_preview_manager.js +6 -19
- package/esm/client/4_poll_manager.js +44 -57
- package/esm/client/4_story_manager.js +41 -53
- package/esm/client/5_client.d.ts +7 -0
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +1271 -1290
- package/esm/connection/1_connection_tcp.node.js +48 -65
- package/esm/connection/1_connection_web_socket.js +75 -91
- package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/esm/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
- package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/esm/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.js +70 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
- package/esm/mod.js +2 -12
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.js +324 -320
- package/esm/storage/1_utilities_test.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.js +26 -44
- package/esm/storage/2_storage_local_storage.node.js +12 -25
- package/esm/storage/2_storage_memory.js +24 -41
- package/esm/storage/2_storage_session_storage.js +3 -16
- package/esm/tl/0_utilities_test.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +80 -88
- package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
- package/esm/tl/1_tl_writer.js +155 -164
- package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
- package/esm/tl/2_telegram.d.ts +9 -10
- package/esm/tl/2_telegram.d.ts.map +1 -1
- package/esm/tl/2_telegram.js +10 -10
- package/esm/transport/0_transport.js +1 -8
- package/esm/transport/1_transport_abridged.js +11 -24
- package/esm/transport/1_transport_intermediate.js +10 -23
- package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts} +1 -1
- package/esm/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
- package/{script/transport/3_transport_provider_tcp.d.ts → esm/transport/2_transport_provider_tcp.d.ts} +2 -2
- package/esm/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
- package/esm/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +1 -1
- package/esm/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
- package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -0
- package/esm/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +1 -1
- package/esm/types/0_upload_progress.d.ts +29 -0
- package/esm/types/0_upload_progress.d.ts.map +1 -0
- package/esm/types/0_upload_progress.js +20 -0
- package/esm/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
- package/esm/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_poll_answer.d.ts +19 -0
- package/esm/types/2_poll_answer.d.ts.map +1 -1
- package/esm/types/2_poll_answer.js +19 -0
- package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
- package/esm/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
- package/esm/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
- package/esm/types/{3_reply_markup.js → 2_reply_markup.js} +1 -1
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/5_message.d.ts +1 -1
- package/esm/types/5_message.d.ts.map +1 -1
- package/esm/types/5_message.js +1 -1
- package/esm/types/6_inline_query_result.d.ts +1 -1
- package/esm/types/6_inline_query_result.js +1 -1
- package/esm/types/7_update.d.ts +21 -2
- package/esm/types/7_update.d.ts.map +1 -1
- package/esm/utilities/0_bigint_test.d.ts.map +1 -1
- package/esm/utilities/0_buffer.d.ts +1 -1
- package/esm/utilities/0_buffer.d.ts.map +1 -1
- package/esm/utilities/0_buffer_test.d.ts.map +1 -1
- package/esm/utilities/0_hash.d.ts +2 -2
- package/esm/utilities/0_hash.d.ts.map +1 -1
- package/esm/utilities/0_mutex.js +4 -19
- package/esm/utilities/0_part_stream.js +11 -25
- package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
- package/esm/utilities/0_rle.d.ts +2 -2
- package/esm/utilities/0_rle.d.ts.map +1 -1
- package/esm/utilities/0_rle_test.d.ts.map +1 -1
- package/esm/utilities/0_text.d.ts +20 -1
- package/esm/utilities/0_text.d.ts.map +1 -1
- package/esm/utilities/0_text.js +19 -0
- package/esm/utilities/1_auth.d.ts +1 -1
- package/esm/utilities/1_auth.d.ts.map +1 -1
- package/esm/utilities/1_base64.d.ts +1 -1
- package/esm/utilities/1_base64.d.ts.map +1 -1
- package/esm/utilities/1_base64_test.d.ts.map +1 -1
- package/esm/utilities/1_crypto.js +42 -53
- package/esm/utilities/1_crypto_test.d.ts.map +1 -1
- package/esm/utilities/1_logger.d.ts +2 -2
- package/esm/utilities/1_math_test.d.ts.map +1 -1
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_errors.js +2 -6
- package/script/2_tl.js +17 -7
- package/script/3_errors.js +2 -12
- package/script/3_transport.d.ts +3 -3
- package/script/3_transport.js +3 -3
- package/script/3_types.d.ts +8 -7
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +8 -7
- package/script/4_constants.js +17 -7
- package/script/4_errors.js +2 -12
- package/script/_dnt.polyfills.d.ts +99 -0
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +128 -0
- package/script/_dnt.test_polyfills.d.ts.map +1 -0
- package/script/client/0_filters_test.d.ts.map +1 -1
- package/script/client/0_markdown_test.d.ts.map +1 -1
- package/script/client/0_params.d.ts +2 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts +5 -5
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +17 -7
- package/script/client/0_password_test.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +143 -155
- package/script/client/0_storage_operations_test.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +1 -1
- package/script/client/0_utilities_test.d.ts.map +1 -1
- package/script/client/1_client_plain.js +4 -22
- package/script/client/1_composer.js +8 -21
- package/script/client/2_account_manager.js +85 -97
- package/script/client/2_bot_info_manager.js +26 -38
- package/script/client/2_business_connection_manager.js +10 -23
- package/script/client/2_client_encrypted.js +195 -212
- package/script/client/2_file_manager.d.ts +4 -3
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +285 -231
- package/script/client/2_file_manager_test.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +8 -21
- package/script/client/2_payment_manager.js +7 -20
- package/script/client/2_reaction_manager.js +7 -20
- package/script/client/2_translations_manager.js +98 -108
- package/script/client/2_update_manager.js +764 -759
- package/script/client/3_client_encrypted_pool.js +10 -26
- package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts +1 -1
- package/script/client/3_message_manager.js +441 -448
- package/script/client/3_message_manager_test.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.d.ts +1 -1
- package/script/client/3_video_chat_manager.js +57 -68
- package/script/client/4_callback_query_manager.js +18 -30
- package/script/client/4_chat_list_manager.js +322 -318
- package/script/client/4_chat_manager.js +118 -131
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.js +16 -29
- package/script/client/4_inline_query_manager.js +16 -28
- package/script/client/4_link_preview_manager.js +6 -19
- package/script/client/4_poll_manager.js +44 -57
- package/script/client/4_story_manager.js +41 -53
- package/script/client/5_client.d.ts +7 -0
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +1271 -1290
- package/script/connection/1_connection_tcp.node.js +48 -65
- package/script/connection/1_connection_web_socket.js +92 -98
- package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
- package/script/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
- package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
- package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/script/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.js +106 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +17 -7
- package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
- package/script/mod.js +19 -19
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.js +66 -79
- package/script/session/2_session_encrypted.js +325 -321
- package/script/storage/1_utilities_test.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.js +26 -44
- package/script/storage/2_storage_local_storage.node.js +12 -25
- package/script/storage/2_storage_memory.js +24 -41
- package/script/storage/2_storage_session_storage.js +3 -16
- package/script/tl/0_utilities_test.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +81 -89
- package/script/tl/1_tl_reader_test.d.ts.map +1 -1
- package/script/tl/1_tl_writer.js +156 -165
- package/script/tl/1_tl_writer_test.d.ts.map +1 -1
- package/script/tl/2_telegram.d.ts +9 -10
- package/script/tl/2_telegram.d.ts.map +1 -1
- package/script/tl/2_telegram.js +32 -10
- package/script/transport/0_obfuscation.js +17 -7
- package/script/transport/0_transport.js +1 -8
- package/script/transport/1_transport_abridged.js +11 -24
- package/script/transport/1_transport_intermediate.js +10 -23
- package/{esm/transport/2_transport_provider.d.ts → script/transport/1_transport_provider.d.ts} +1 -1
- package/script/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
- package/{esm/transport/3_transport_provider_tcp.d.ts → script/transport/2_transport_provider_tcp.d.ts} +2 -2
- package/script/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
- package/script/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +3 -3
- package/script/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
- package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -0
- package/script/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +2 -2
- package/script/types/0_upload_progress.d.ts +29 -0
- package/script/types/0_upload_progress.d.ts.map +1 -0
- package/script/types/0_upload_progress.js +21 -0
- package/script/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
- package/script/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_poll_answer.d.ts +19 -0
- package/script/types/2_poll_answer.d.ts.map +1 -1
- package/script/types/2_poll_answer.js +19 -0
- package/script/types/2_pre_checkout_query.d.ts.map +1 -1
- package/script/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
- package/script/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
- package/script/types/{3_reply_markup.js → 2_reply_markup.js} +3 -3
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/5_message.d.ts +1 -1
- package/script/types/5_message.d.ts.map +1 -1
- package/script/types/5_message.js +2 -2
- package/script/types/6_inline_query_result.d.ts +1 -1
- package/script/types/6_inline_query_result.js +4 -4
- package/script/types/7_update.d.ts +21 -2
- package/script/types/7_update.d.ts.map +1 -1
- package/script/utilities/0_bigint.js +17 -7
- package/script/utilities/0_bigint_test.d.ts.map +1 -1
- package/script/utilities/0_buffer.d.ts +1 -1
- package/script/utilities/0_buffer.d.ts.map +1 -1
- package/script/utilities/0_buffer_test.d.ts.map +1 -1
- package/script/utilities/0_env.js +17 -7
- package/script/utilities/0_hash.d.ts +2 -2
- package/script/utilities/0_hash.d.ts.map +1 -1
- package/script/utilities/0_hash.js +17 -7
- package/script/utilities/0_misc.js +17 -7
- package/script/utilities/0_mutex.js +4 -19
- package/script/utilities/0_part_stream.js +11 -25
- package/script/utilities/0_part_stream_test.d.ts.map +1 -1
- package/script/utilities/0_rle.d.ts +2 -2
- package/script/utilities/0_rle.d.ts.map +1 -1
- package/script/utilities/0_rle_test.d.ts.map +1 -1
- package/script/utilities/0_text.d.ts +20 -1
- package/script/utilities/0_text.d.ts.map +1 -1
- package/script/utilities/0_text.js +19 -0
- package/script/utilities/1_auth.d.ts +1 -1
- package/script/utilities/1_auth.d.ts.map +1 -1
- package/script/utilities/1_auth.js +17 -7
- package/script/utilities/1_base64.d.ts +1 -1
- package/script/utilities/1_base64.d.ts.map +1 -1
- package/script/utilities/1_base64_test.d.ts.map +1 -1
- package/script/utilities/1_crypto.js +60 -61
- package/script/utilities/1_crypto_test.d.ts.map +1 -1
- package/script/utilities/1_logger.d.ts +2 -2
- package/script/utilities/1_math_test.d.ts.map +1 -1
- package/script/utilities/2_queue.js +30 -48
- package/esm/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.js +0 -37
- package/esm/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
- package/esm/transport/3_transport_provider_web_socket.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
- package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/format.js +0 -63
- package/script/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
- package/script/transport/3_transport_provider_web_socket.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
- /package/esm/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
- /package/esm/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
- /package/script/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
- /package/script/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
|
@@ -18,18 +18,6 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _StorageOperations_instances, _StorageOperations_storage, _StorageOperations_supportsFiles, _StorageOperations_mustSerialize, _StorageOperations_authKeyId, _StorageOperations_resetAuthKeyId, _StorageOperations_accountId, _StorageOperations_accountType, _StorageOperations_getUpdateId;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.StorageOperations = exports.K = void 0;
|
|
35
23
|
const _0_deps_js_1 = require("../0_deps.js");
|
|
@@ -119,57 +107,62 @@ exports.K = {
|
|
|
119
107
|
},
|
|
120
108
|
};
|
|
121
109
|
class StorageOperations {
|
|
110
|
+
#storage;
|
|
111
|
+
#supportsFiles;
|
|
112
|
+
#mustSerialize;
|
|
113
|
+
#authKeyId = null;
|
|
122
114
|
constructor(storage) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
_StorageOperations_mustSerialize.set(this, void 0);
|
|
127
|
-
_StorageOperations_authKeyId.set(this, null);
|
|
128
|
-
_StorageOperations_accountId.set(this, null);
|
|
129
|
-
_StorageOperations_accountType.set(this, null);
|
|
130
|
-
__classPrivateFieldSet(this, _StorageOperations_storage, storage, "f");
|
|
131
|
-
__classPrivateFieldSet(this, _StorageOperations_supportsFiles, storage.supportsFiles, "f");
|
|
132
|
-
__classPrivateFieldSet(this, _StorageOperations_mustSerialize, storage.mustSerialize, "f");
|
|
115
|
+
this.#storage = storage;
|
|
116
|
+
this.#supportsFiles = storage.supportsFiles;
|
|
117
|
+
this.#mustSerialize = storage.mustSerialize;
|
|
133
118
|
}
|
|
134
119
|
get provider() {
|
|
135
|
-
return
|
|
120
|
+
return this.#storage;
|
|
136
121
|
}
|
|
137
122
|
get supportsFiles() {
|
|
138
|
-
return
|
|
123
|
+
return this.#storage.supportsFiles;
|
|
139
124
|
}
|
|
140
125
|
async initialize() {
|
|
141
|
-
await
|
|
126
|
+
await this.#storage.initialize();
|
|
142
127
|
await this.getAccountType();
|
|
143
128
|
}
|
|
144
129
|
set(...args) {
|
|
145
|
-
return
|
|
130
|
+
return this.#storage.set(...args);
|
|
146
131
|
}
|
|
147
132
|
incr(...args) {
|
|
148
|
-
return
|
|
133
|
+
return this.#storage.incr(...args);
|
|
149
134
|
}
|
|
150
135
|
get(...args) {
|
|
151
|
-
return
|
|
136
|
+
return this.#storage.get(...args);
|
|
152
137
|
}
|
|
153
138
|
getMany(...args) {
|
|
154
|
-
return
|
|
139
|
+
return this.#storage.getMany(...args);
|
|
155
140
|
}
|
|
156
141
|
async setDc(dc) {
|
|
157
|
-
await
|
|
142
|
+
await this.#storage.set(exports.K.auth.dc(), dc);
|
|
158
143
|
}
|
|
159
144
|
getDc() {
|
|
160
|
-
return
|
|
145
|
+
return this.#storage.get(exports.K.auth.dc());
|
|
146
|
+
}
|
|
147
|
+
async #resetAuthKeyId(authKey) {
|
|
148
|
+
if (authKey != null) {
|
|
149
|
+
this.#authKeyId = (0, _1_utilities_js_1.bigIntFromBuffer)((await (0, _1_utilities_js_1.sha1)(authKey)).subarray(-8), true, false);
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
this.#authKeyId = null;
|
|
153
|
+
}
|
|
161
154
|
}
|
|
162
155
|
async getAuthKey() {
|
|
163
|
-
const authKey = await
|
|
164
|
-
await
|
|
156
|
+
const authKey = await this.#storage.get(exports.K.auth.key());
|
|
157
|
+
await this.#resetAuthKeyId(authKey);
|
|
165
158
|
return authKey;
|
|
166
159
|
}
|
|
167
160
|
async setAuthKey(authKey) {
|
|
168
|
-
await
|
|
169
|
-
await
|
|
161
|
+
await this.#storage.set(exports.K.auth.key(), authKey);
|
|
162
|
+
await this.#resetAuthKeyId(authKey);
|
|
170
163
|
}
|
|
171
164
|
get authKeyId() {
|
|
172
|
-
return
|
|
165
|
+
return this.#authKeyId;
|
|
173
166
|
}
|
|
174
167
|
async exportAuthString(apiId_) {
|
|
175
168
|
if (typeof apiId_ === "number") {
|
|
@@ -235,24 +228,24 @@ class StorageOperations {
|
|
|
235
228
|
async updateUsernames(id, usernames) {
|
|
236
229
|
for (let username of usernames) {
|
|
237
230
|
username = username.toLowerCase();
|
|
238
|
-
await
|
|
231
|
+
await this.#storage.set(exports.K.cache.username(username), [id, new Date()]);
|
|
239
232
|
}
|
|
240
233
|
}
|
|
241
234
|
async getUsername(username) {
|
|
242
235
|
username = username.toLowerCase();
|
|
243
|
-
return await
|
|
236
|
+
return await this.#storage.get(exports.K.cache.username(username));
|
|
244
237
|
}
|
|
245
238
|
async setTlObject(key, value) {
|
|
246
239
|
if (value == null) {
|
|
247
|
-
await
|
|
240
|
+
await this.#storage.set(key, null);
|
|
248
241
|
}
|
|
249
242
|
else {
|
|
250
|
-
await
|
|
243
|
+
await this.#storage.set(key, this.#mustSerialize ? [value._, (0, _1_utilities_js_1.rleEncode)(_2_tl_js_1.Api.serializeObject(value))] : value);
|
|
251
244
|
}
|
|
252
245
|
}
|
|
253
246
|
async getTlObject(keyOrBuffer) {
|
|
254
247
|
// @ts-ignore: TBD
|
|
255
|
-
const buffer = (keyOrBuffer instanceof Uint8Array || _2_tl_js_1.Api.isValidObject(keyOrBuffer)) ? keyOrBuffer : await
|
|
248
|
+
const buffer = (keyOrBuffer instanceof Uint8Array || _2_tl_js_1.Api.isValidObject(keyOrBuffer)) ? keyOrBuffer : await this.#storage.get(keyOrBuffer);
|
|
256
249
|
if (buffer != null) {
|
|
257
250
|
if (buffer instanceof Uint8Array) {
|
|
258
251
|
return await _2_tl_js_1.Api.deserializeType(_2_tl_js_1.X, (0, _1_utilities_js_1.rleDecode)(buffer));
|
|
@@ -276,40 +269,40 @@ class StorageOperations {
|
|
|
276
269
|
}
|
|
277
270
|
async setMessage(chatId, messageId, message) {
|
|
278
271
|
if (chatId > _1_utilities_js_1.ZERO_CHANNEL_ID) {
|
|
279
|
-
await
|
|
272
|
+
await this.#storage.set(exports.K.messages.messageRef(messageId), message == null ? null : chatId);
|
|
280
273
|
}
|
|
281
274
|
await this.setTlObject(exports.K.messages.message(chatId, messageId), message);
|
|
282
275
|
}
|
|
283
276
|
async deleteMessages() {
|
|
284
277
|
const maybePromises = new Array();
|
|
285
|
-
for await (const [k, o] of await
|
|
286
|
-
maybePromises.push(Promise.all([
|
|
278
|
+
for await (const [k, o] of await this.#storage.getMany({ prefix: exports.K.messages.allMessageRefs() })) {
|
|
279
|
+
maybePromises.push(Promise.all([this.#storage.set(k, null), o == null ? Promise.resolve() : this.#storage.set(exports.K.messages.message(o, k[1]), null)]));
|
|
287
280
|
}
|
|
288
281
|
await Promise.all(maybePromises.filter((v) => v instanceof Promise));
|
|
289
282
|
}
|
|
290
283
|
getMessageChat(messageId) {
|
|
291
|
-
return
|
|
284
|
+
return this.#storage.get(exports.K.messages.messageRef(messageId));
|
|
292
285
|
}
|
|
293
286
|
async getMessage(chatId, messageId) {
|
|
294
287
|
return await this.getTlObject(exports.K.messages.message(chatId, messageId));
|
|
295
288
|
}
|
|
296
289
|
async getLastMessage(chatId) {
|
|
297
|
-
for await (const [_, buffer] of await
|
|
290
|
+
for await (const [_, buffer] of await this.#storage.getMany({ prefix: exports.K.messages.messages(chatId) }, { limit: 1, reverse: true })) {
|
|
298
291
|
return await this.getTlObject(buffer);
|
|
299
292
|
}
|
|
300
293
|
return null;
|
|
301
294
|
}
|
|
302
295
|
async setChannelPts(channelId, pts) {
|
|
303
|
-
await
|
|
296
|
+
await this.#storage.set(exports.K.updates.channelPts(channelId), pts);
|
|
304
297
|
}
|
|
305
298
|
getChannelPts(channelId) {
|
|
306
|
-
return
|
|
299
|
+
return this.#storage.get(exports.K.updates.channelPts(channelId));
|
|
307
300
|
}
|
|
308
301
|
async setEntity(entity) {
|
|
309
|
-
await
|
|
302
|
+
await this.#storage.set(exports.K.cache.peer(_2_tl_js_1.Api.peerToChatId(entity)), [this.#mustSerialize ? (0, _1_utilities_js_1.rleEncode)(_2_tl_js_1.Api.serializeObject(entity)) : entity, new Date()]);
|
|
310
303
|
}
|
|
311
304
|
async getEntity(key) {
|
|
312
|
-
const peer_ = await
|
|
305
|
+
const peer_ = await this.#storage.get(exports.K.cache.peer(key));
|
|
313
306
|
if (peer_ != null) {
|
|
314
307
|
const [obj_] = peer_;
|
|
315
308
|
return await this.getTlObject(obj_);
|
|
@@ -319,58 +312,60 @@ class StorageOperations {
|
|
|
319
312
|
}
|
|
320
313
|
}
|
|
321
314
|
async setAccountId(accountId) {
|
|
322
|
-
await
|
|
315
|
+
await this.#storage.set(exports.K.auth.accountId(), accountId);
|
|
323
316
|
}
|
|
317
|
+
#accountId = null;
|
|
324
318
|
async getAccountId() {
|
|
325
|
-
if (
|
|
326
|
-
return
|
|
319
|
+
if (this.#accountId != null) {
|
|
320
|
+
return this.#accountId;
|
|
327
321
|
}
|
|
328
322
|
else {
|
|
329
|
-
return (
|
|
323
|
+
return (this.#accountId = await this.#storage.get(exports.K.auth.accountId()));
|
|
330
324
|
}
|
|
331
325
|
}
|
|
332
326
|
async setAccountType(type) {
|
|
333
|
-
await
|
|
327
|
+
await this.#storage.set(exports.K.auth.accountType(), type);
|
|
334
328
|
await this.getAccountType();
|
|
335
329
|
}
|
|
330
|
+
#accountType = null;
|
|
336
331
|
async getAccountType() {
|
|
337
|
-
if (
|
|
338
|
-
return
|
|
332
|
+
if (this.#accountType != null) {
|
|
333
|
+
return this.#accountType;
|
|
339
334
|
}
|
|
340
335
|
else {
|
|
341
|
-
return
|
|
336
|
+
return this.#accountType = await this.#storage.get(exports.K.auth.accountType());
|
|
342
337
|
}
|
|
343
338
|
}
|
|
344
339
|
get accountType() {
|
|
345
|
-
if (
|
|
340
|
+
if (this.#accountType == null) {
|
|
346
341
|
(0, _0_deps_js_1.unreachable)();
|
|
347
342
|
}
|
|
348
|
-
return
|
|
343
|
+
return this.#accountType;
|
|
349
344
|
}
|
|
350
345
|
async setIsPremium(isPremium) {
|
|
351
|
-
await
|
|
346
|
+
await this.#storage.set(exports.K.auth.isPremium(), isPremium);
|
|
352
347
|
}
|
|
353
348
|
async getIsPremium() {
|
|
354
|
-
return await
|
|
349
|
+
return await this.#storage.get(exports.K.auth.isPremium());
|
|
355
350
|
}
|
|
356
351
|
async updateStickerSetName(id, accessHash, name) {
|
|
357
|
-
await
|
|
352
|
+
await this.#storage.set(exports.K.cache.stickerSetName(id, accessHash), [name, new Date()]);
|
|
358
353
|
}
|
|
359
354
|
getStickerSetName(id, accessHash) {
|
|
360
|
-
return
|
|
355
|
+
return this.#storage.get(exports.K.cache.stickerSetName(id, accessHash));
|
|
361
356
|
}
|
|
362
357
|
async setServerSalt(serverSalt) {
|
|
363
|
-
await
|
|
358
|
+
await this.#storage.set(exports.K.session.serverSalt(), serverSalt);
|
|
364
359
|
}
|
|
365
360
|
getServerSalt() {
|
|
366
|
-
return
|
|
361
|
+
return this.#storage.get(exports.K.session.serverSalt());
|
|
367
362
|
}
|
|
368
363
|
async setChat(listId, chatId, pinned, topMessageId, topMessageDate) {
|
|
369
|
-
await
|
|
364
|
+
await this.#storage.set(exports.K.chatlists.chat(listId, chatId), [pinned, topMessageId, topMessageDate]);
|
|
370
365
|
}
|
|
371
366
|
async getChats(listId) {
|
|
372
367
|
const chats = new Array();
|
|
373
|
-
for await (const [key, value] of await
|
|
368
|
+
for await (const [key, value] of await this.#storage.getMany({ prefix: exports.K.chatlists.chats(listId) })) {
|
|
374
369
|
if (key.length != 3 || typeof key[2] !== "number") {
|
|
375
370
|
continue;
|
|
376
371
|
}
|
|
@@ -379,24 +374,24 @@ class StorageOperations {
|
|
|
379
374
|
return chats;
|
|
380
375
|
}
|
|
381
376
|
async removeChats(listId) {
|
|
382
|
-
for await (const [key] of await
|
|
383
|
-
await
|
|
377
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.chatlists.chats(listId) })) {
|
|
378
|
+
await this.#storage.set(key, null);
|
|
384
379
|
}
|
|
385
380
|
await this.setHasAllChats(listId, false);
|
|
386
381
|
await this.setPinnedChats(listId, null);
|
|
387
382
|
}
|
|
388
383
|
async setHasAllChats(listId, hasAllChats) {
|
|
389
|
-
await
|
|
384
|
+
await this.#storage.set(exports.K.chatlists.hasAllChats(listId), hasAllChats);
|
|
390
385
|
}
|
|
391
386
|
async hasAllChats(listId) {
|
|
392
|
-
const v = await
|
|
387
|
+
const v = await this.#storage.get(exports.K.chatlists.hasAllChats(listId));
|
|
393
388
|
return v == true;
|
|
394
389
|
}
|
|
395
390
|
async setPinnedChats(listId, chatIds) {
|
|
396
|
-
await
|
|
391
|
+
await this.#storage.set(exports.K.chatlists.pinnedChats(listId), chatIds);
|
|
397
392
|
}
|
|
398
393
|
async getPinnedChats(listId) {
|
|
399
|
-
return await
|
|
394
|
+
return await this.#storage.get(exports.K.chatlists.pinnedChats(listId));
|
|
400
395
|
}
|
|
401
396
|
async getHistory(chatId, offsetId, limit) {
|
|
402
397
|
if (offsetId == 0) {
|
|
@@ -404,7 +399,7 @@ class StorageOperations {
|
|
|
404
399
|
}
|
|
405
400
|
++limit;
|
|
406
401
|
const messages = new Array();
|
|
407
|
-
for await (const [_, buffer] of await
|
|
402
|
+
for await (const [_, buffer] of await this.#storage.getMany({ start: exports.K.messages.message(chatId, 0), end: exports.K.messages.message(chatId, offsetId) }, { limit, reverse: true })) {
|
|
408
403
|
const message = await this.getTlObject(buffer);
|
|
409
404
|
if ("id" in message && message.id == offsetId) {
|
|
410
405
|
continue;
|
|
@@ -414,18 +409,18 @@ class StorageOperations {
|
|
|
414
409
|
return messages;
|
|
415
410
|
}
|
|
416
411
|
async getFile(id) {
|
|
417
|
-
if (!
|
|
412
|
+
if (!this.#supportsFiles) {
|
|
418
413
|
return null;
|
|
419
414
|
}
|
|
420
|
-
return await
|
|
415
|
+
return await this.#storage.get(exports.K.cache.file(id));
|
|
421
416
|
}
|
|
422
417
|
async *iterFileParts(id, partCount, offset, signal) {
|
|
423
|
-
if (!
|
|
418
|
+
if (!this.#supportsFiles) {
|
|
424
419
|
return;
|
|
425
420
|
}
|
|
426
421
|
for (let i = offset; i < partCount; i++) {
|
|
427
422
|
signal?.throwIfAborted();
|
|
428
|
-
const part = await
|
|
423
|
+
const part = await this.#storage.get(exports.K.cache.filePart(id, i));
|
|
429
424
|
if (part == null) {
|
|
430
425
|
continue;
|
|
431
426
|
}
|
|
@@ -433,22 +428,22 @@ class StorageOperations {
|
|
|
433
428
|
}
|
|
434
429
|
}
|
|
435
430
|
async saveFilePart(id, index, bytes) {
|
|
436
|
-
if (!
|
|
431
|
+
if (!this.#supportsFiles) {
|
|
437
432
|
return;
|
|
438
433
|
}
|
|
439
|
-
await
|
|
434
|
+
await this.#storage.set(exports.K.cache.filePart(id, index), bytes);
|
|
440
435
|
}
|
|
441
436
|
async setFilePartCount(id, partCount, chunkSize) {
|
|
442
|
-
if (!
|
|
437
|
+
if (!this.#supportsFiles) {
|
|
443
438
|
return;
|
|
444
439
|
}
|
|
445
|
-
await
|
|
440
|
+
await this.#storage.set(exports.K.cache.file(id), [partCount, chunkSize]);
|
|
446
441
|
}
|
|
447
442
|
async setCustomEmojiDocument(id, document) {
|
|
448
|
-
await
|
|
443
|
+
await this.#storage.set(exports.K.cache.customEmojiDocument(id), [this.#mustSerialize ? (0, _1_utilities_js_1.rleEncode)(_2_tl_js_1.Api.serializeObject(document)) : document, new Date()]);
|
|
449
444
|
}
|
|
450
445
|
async getCustomEmojiDocument(id) {
|
|
451
|
-
const v = await
|
|
446
|
+
const v = await this.#storage.get(exports.K.cache.customEmojiDocument(id));
|
|
452
447
|
if (v != null) {
|
|
453
448
|
return [await this.getTlObject(v[0]), v[1]];
|
|
454
449
|
}
|
|
@@ -457,10 +452,10 @@ class StorageOperations {
|
|
|
457
452
|
}
|
|
458
453
|
}
|
|
459
454
|
async setBusinessConnection(id, connection) {
|
|
460
|
-
await
|
|
455
|
+
await this.#storage.set(exports.K.cache.businessConnection(id), connection == null ? null : this.#mustSerialize ? (0, _1_utilities_js_1.rleEncode)(_2_tl_js_1.Api.serializeObject(connection)) : connection);
|
|
461
456
|
}
|
|
462
457
|
async getBusinessConnection(id) {
|
|
463
|
-
const v = await
|
|
458
|
+
const v = await this.#storage.get(exports.K.cache.businessConnection(id));
|
|
464
459
|
if (v != null) {
|
|
465
460
|
return await this.getTlObject(v);
|
|
466
461
|
}
|
|
@@ -469,10 +464,10 @@ class StorageOperations {
|
|
|
469
464
|
}
|
|
470
465
|
}
|
|
471
466
|
async setInlineQueryAnswer(userId, chatId, query, offset, results, date) {
|
|
472
|
-
await
|
|
467
|
+
await this.#storage.set(exports.K.cache.inlineQueryAnswer(userId, chatId, query, offset), [this.#mustSerialize ? (0, _1_utilities_js_1.rleEncode)(_2_tl_js_1.Api.serializeObject(results)) : results, date]);
|
|
473
468
|
}
|
|
474
469
|
async getInlineQueryAnswer(userId, chatId, query, offset) {
|
|
475
|
-
const peer_ = await
|
|
470
|
+
const peer_ = await this.#storage.get(exports.K.cache.inlineQueryAnswer(userId, chatId, query, offset));
|
|
476
471
|
if (peer_ != null) {
|
|
477
472
|
const [obj_, date] = peer_;
|
|
478
473
|
return [_2_tl_js_1.Api.as("messages.botResults", await this.getTlObject(obj_)), date];
|
|
@@ -482,10 +477,10 @@ class StorageOperations {
|
|
|
482
477
|
}
|
|
483
478
|
}
|
|
484
479
|
async setCallbackQueryAnswer(chatId, messageId, question, answer) {
|
|
485
|
-
await
|
|
480
|
+
await this.#storage.set(exports.K.cache.callbackQueryAnswer(chatId, messageId, question), [this.#mustSerialize ? (0, _1_utilities_js_1.rleEncode)(_2_tl_js_1.Api.serializeObject(answer)) : answer, new Date()]);
|
|
486
481
|
}
|
|
487
482
|
async getCallbackQueryAnswer(chatId, messageId, question) {
|
|
488
|
-
const peer_ = await
|
|
483
|
+
const peer_ = await this.#storage.get(exports.K.cache.callbackQueryAnswer(chatId, messageId, question));
|
|
489
484
|
if (peer_ != null) {
|
|
490
485
|
const [obj_, date] = peer_;
|
|
491
486
|
return [_2_tl_js_1.Api.as("messages.botCallbackAnswer", await this.getTlObject(obj_)), date];
|
|
@@ -507,23 +502,33 @@ class StorageOperations {
|
|
|
507
502
|
return await this.getTlObject(exports.K.cache.groupCall(id));
|
|
508
503
|
}
|
|
509
504
|
async setGroupCallAccessHash(id, accessHash) {
|
|
510
|
-
await
|
|
505
|
+
await this.#storage.set(exports.K.cache.groupCallAccessHash(id), accessHash);
|
|
511
506
|
}
|
|
512
507
|
async getGroupCallAccessHash(id) {
|
|
513
|
-
return await
|
|
508
|
+
return await this.#storage.get(exports.K.cache.groupCallAccessHash(id));
|
|
509
|
+
}
|
|
510
|
+
#getUpdateId(update) {
|
|
511
|
+
let id = BigInt(Date.now()) << 32n;
|
|
512
|
+
if ("pts" in update && update.pts) {
|
|
513
|
+
id |= BigInt(update.pts);
|
|
514
|
+
}
|
|
515
|
+
else {
|
|
516
|
+
id |= BigInt(0xffffffffn);
|
|
517
|
+
}
|
|
518
|
+
return id;
|
|
514
519
|
}
|
|
515
520
|
async setUpdate(boxId, update) {
|
|
516
|
-
await this.setTlObject(exports.K.updates.update(boxId,
|
|
521
|
+
await this.setTlObject(exports.K.updates.update(boxId, this.#getUpdateId(update)), update);
|
|
517
522
|
}
|
|
518
523
|
async deleteUpdates() {
|
|
519
524
|
const maybePromises = new Array();
|
|
520
|
-
for await (const [k] of await
|
|
521
|
-
maybePromises.push(
|
|
525
|
+
for await (const [k] of await this.#storage.getMany({ prefix: exports.K.updates.all() })) {
|
|
526
|
+
maybePromises.push(this.#storage.set(k, null));
|
|
522
527
|
}
|
|
523
528
|
await Promise.all(maybePromises.filter((v) => v instanceof Promise));
|
|
524
529
|
}
|
|
525
530
|
async getFirstUpdate(boxId) {
|
|
526
|
-
for await (const [key, update] of await
|
|
531
|
+
for await (const [key, update] of await this.#storage.getMany({ prefix: exports.K.updates.updates(boxId) }, { limit: 1 })) {
|
|
527
532
|
return [key, (await this.getTlObject(update))];
|
|
528
533
|
}
|
|
529
534
|
return null;
|
|
@@ -539,59 +544,59 @@ class StorageOperations {
|
|
|
539
544
|
}
|
|
540
545
|
}
|
|
541
546
|
async deleteFiles() {
|
|
542
|
-
if (!
|
|
547
|
+
if (!this.#supportsFiles) {
|
|
543
548
|
return;
|
|
544
549
|
}
|
|
545
|
-
for await (const [key] of await
|
|
546
|
-
await
|
|
550
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.fileParts() })) {
|
|
551
|
+
await this.#storage.set(key, null);
|
|
547
552
|
}
|
|
548
|
-
for await (const [key] of await
|
|
549
|
-
await
|
|
553
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.files() })) {
|
|
554
|
+
await this.#storage.set(key, null);
|
|
550
555
|
}
|
|
551
556
|
}
|
|
552
557
|
async deleteCustomEmojiDocuments() {
|
|
553
|
-
for await (const [key] of await
|
|
554
|
-
await
|
|
558
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.customEmojiDocuments() })) {
|
|
559
|
+
await this.#storage.set(key, null);
|
|
555
560
|
}
|
|
556
561
|
}
|
|
557
562
|
async deleteBusinessConnections() {
|
|
558
|
-
for await (const [key] of await
|
|
559
|
-
await
|
|
563
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.businessConnections() })) {
|
|
564
|
+
await this.#storage.set(key, null);
|
|
560
565
|
}
|
|
561
566
|
}
|
|
562
567
|
async deleteInlineQueryAnswers() {
|
|
563
|
-
for await (const [key] of await
|
|
564
|
-
await
|
|
568
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.inlineQueryAnswers() })) {
|
|
569
|
+
await this.#storage.set(key, null);
|
|
565
570
|
}
|
|
566
571
|
}
|
|
567
572
|
async deleteCallbackQueryAnswers() {
|
|
568
|
-
for await (const [key] of await
|
|
569
|
-
await
|
|
573
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.callbackQueryAnswers() })) {
|
|
574
|
+
await this.#storage.set(key, null);
|
|
570
575
|
}
|
|
571
576
|
}
|
|
572
577
|
async deleteFullChats() {
|
|
573
|
-
for await (const [key] of await
|
|
574
|
-
await
|
|
578
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.fullChats() })) {
|
|
579
|
+
await this.#storage.set(key, null);
|
|
575
580
|
}
|
|
576
581
|
}
|
|
577
582
|
async deleteGroupCalls() {
|
|
578
|
-
for await (const [key] of await
|
|
579
|
-
await
|
|
583
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.groupCalls() })) {
|
|
584
|
+
await this.#storage.set(key, null);
|
|
580
585
|
}
|
|
581
586
|
}
|
|
582
587
|
async deleteStickerSetNames() {
|
|
583
|
-
for await (const [key] of await
|
|
584
|
-
await
|
|
588
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.stickerSetNames() })) {
|
|
589
|
+
await this.#storage.set(key, null);
|
|
585
590
|
}
|
|
586
591
|
}
|
|
587
592
|
async deletePeers() {
|
|
588
|
-
for await (const [key] of await
|
|
589
|
-
await
|
|
593
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.peers() })) {
|
|
594
|
+
await this.#storage.set(key, null);
|
|
590
595
|
}
|
|
591
596
|
}
|
|
592
597
|
async deleteUsernames() {
|
|
593
|
-
for await (const [key] of await
|
|
594
|
-
await
|
|
598
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.usernames() })) {
|
|
599
|
+
await this.#storage.set(key, null);
|
|
595
600
|
}
|
|
596
601
|
}
|
|
597
602
|
async clear() {
|
|
@@ -618,38 +623,38 @@ class StorageOperations {
|
|
|
618
623
|
]);
|
|
619
624
|
}
|
|
620
625
|
async setApiId(apiId) {
|
|
621
|
-
await
|
|
626
|
+
await this.#storage.set(exports.K.connection.apiId(), apiId);
|
|
622
627
|
}
|
|
623
628
|
async getApiId() {
|
|
624
|
-
return await
|
|
629
|
+
return await this.#storage.get(exports.K.connection.apiId());
|
|
625
630
|
}
|
|
626
631
|
async reset() {
|
|
627
|
-
for await (const [key] of await
|
|
628
|
-
await
|
|
632
|
+
for await (const [key] of await this.#storage.getMany({ prefix: [] })) {
|
|
633
|
+
await this.#storage.set(key, null);
|
|
629
634
|
}
|
|
630
635
|
}
|
|
631
636
|
async setMinPeerReference(chatId, senderId, messageId) {
|
|
632
|
-
await
|
|
637
|
+
await this.#storage.set(exports.K.cache.minPeerReference(senderId, chatId), [{ chatId, messageId }, new Date()]);
|
|
633
638
|
}
|
|
634
639
|
async getLastMinPeerReference(senderId) {
|
|
635
640
|
const references = new Array();
|
|
636
|
-
for await (const [, reference] of await
|
|
641
|
+
for await (const [, reference] of await this.#storage.getMany({ prefix: exports.K.cache.minPeerReferenceSender(senderId) })) {
|
|
637
642
|
references.push(reference);
|
|
638
643
|
}
|
|
639
644
|
return references.sort((a, b) => b[1].getTime() - a[1].getTime())[0]?.[0] ?? null;
|
|
640
645
|
}
|
|
641
646
|
async deleteTranslations() {
|
|
642
647
|
const maybePromises = new Array();
|
|
643
|
-
for await (const [key] of await
|
|
644
|
-
maybePromises.push(
|
|
648
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.allTranslations() })) {
|
|
649
|
+
maybePromises.push(this.#storage.set(key, null));
|
|
645
650
|
}
|
|
646
651
|
await Promise.all(maybePromises);
|
|
647
652
|
}
|
|
648
653
|
async getTranslations(platform, language) {
|
|
649
|
-
return await
|
|
654
|
+
return await this.#storage.get(exports.K.cache.translations(platform, language));
|
|
650
655
|
}
|
|
651
656
|
async setTranslations(platform, language, version, translations) {
|
|
652
|
-
await
|
|
657
|
+
await this.#storage.set(exports.K.cache.translations(platform, language), [version, translations, new Date()]);
|
|
653
658
|
}
|
|
654
659
|
async setPollResults(pollId, pollResults) {
|
|
655
660
|
await this.setTlObject(exports.K.cache.pollResult(pollId), pollResults);
|
|
@@ -659,8 +664,8 @@ class StorageOperations {
|
|
|
659
664
|
}
|
|
660
665
|
async deletePollResults() {
|
|
661
666
|
const maybePromises = new Array();
|
|
662
|
-
for await (const [key] of await
|
|
663
|
-
maybePromises.push(
|
|
667
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.pollResults() })) {
|
|
668
|
+
maybePromises.push(this.#storage.set(key, null));
|
|
664
669
|
}
|
|
665
670
|
await Promise.all(maybePromises);
|
|
666
671
|
}
|
|
@@ -672,8 +677,8 @@ class StorageOperations {
|
|
|
672
677
|
}
|
|
673
678
|
async deletePolls() {
|
|
674
679
|
const maybePromises = new Array();
|
|
675
|
-
for await (const [key] of await
|
|
676
|
-
maybePromises.push(
|
|
680
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.polls() })) {
|
|
681
|
+
maybePromises.push(this.#storage.set(key, null));
|
|
677
682
|
}
|
|
678
683
|
await Promise.all(maybePromises);
|
|
679
684
|
}
|
|
@@ -685,8 +690,8 @@ class StorageOperations {
|
|
|
685
690
|
}
|
|
686
691
|
async deleteVoiceTranscriptions() {
|
|
687
692
|
const maybePromises = new Array();
|
|
688
|
-
for await (const [key] of await
|
|
689
|
-
maybePromises.push(
|
|
693
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.voiceTranscriptions() })) {
|
|
694
|
+
maybePromises.push(this.#storage.set(key, null));
|
|
690
695
|
}
|
|
691
696
|
await Promise.all(maybePromises);
|
|
692
697
|
}
|
|
@@ -698,27 +703,10 @@ class StorageOperations {
|
|
|
698
703
|
}
|
|
699
704
|
async deleteVoiceTranscriptionReferences() {
|
|
700
705
|
const maybePromises = new Array();
|
|
701
|
-
for await (const [key] of await
|
|
702
|
-
maybePromises.push(
|
|
706
|
+
for await (const [key] of await this.#storage.getMany({ prefix: exports.K.cache.voiceTranscriptions() })) {
|
|
707
|
+
maybePromises.push(this.#storage.set(key, null));
|
|
703
708
|
}
|
|
704
709
|
await Promise.all(maybePromises);
|
|
705
710
|
}
|
|
706
711
|
}
|
|
707
712
|
exports.StorageOperations = StorageOperations;
|
|
708
|
-
_StorageOperations_storage = new WeakMap(), _StorageOperations_supportsFiles = new WeakMap(), _StorageOperations_mustSerialize = new WeakMap(), _StorageOperations_authKeyId = new WeakMap(), _StorageOperations_accountId = new WeakMap(), _StorageOperations_accountType = new WeakMap(), _StorageOperations_instances = new WeakSet(), _StorageOperations_resetAuthKeyId = async function _StorageOperations_resetAuthKeyId(authKey) {
|
|
709
|
-
if (authKey != null) {
|
|
710
|
-
__classPrivateFieldSet(this, _StorageOperations_authKeyId, (0, _1_utilities_js_1.bigIntFromBuffer)((await (0, _1_utilities_js_1.sha1)(authKey)).subarray(-8), true, false), "f");
|
|
711
|
-
}
|
|
712
|
-
else {
|
|
713
|
-
__classPrivateFieldSet(this, _StorageOperations_authKeyId, null, "f");
|
|
714
|
-
}
|
|
715
|
-
}, _StorageOperations_getUpdateId = function _StorageOperations_getUpdateId(update) {
|
|
716
|
-
let id = BigInt(Date.now()) << 32n;
|
|
717
|
-
if ("pts" in update && update.pts) {
|
|
718
|
-
id |= BigInt(update.pts);
|
|
719
|
-
}
|
|
720
|
-
else {
|
|
721
|
-
id |= BigInt(0xffffffffn);
|
|
722
|
-
}
|
|
723
|
-
return id;
|
|
724
|
-
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_storage_operations_test.d.ts","sourceRoot":"","sources":["../../src/client/0_storage_operations_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"0_storage_operations_test.d.ts","sourceRoot":"","sources":["../../src/client/0_storage_operations_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|