@mtkruto/node 0.62.0 → 0.63.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/2_tl.d.ts +6 -6
- package/esm/2_tl.d.ts.map +1 -1
- package/esm/2_tl.js +6 -6
- package/esm/3_errors.d.ts +1 -2
- package/esm/3_errors.d.ts.map +1 -1
- package/esm/3_errors.js +2 -1
- package/esm/4_constants.d.ts +0 -1
- package/esm/4_constants.d.ts.map +1 -1
- package/esm/4_constants.js +0 -1
- package/esm/4_errors.d.ts +2 -2
- package/esm/4_errors.d.ts.map +1 -1
- package/esm/4_session.d.ts +24 -0
- package/esm/4_session.d.ts.map +1 -0
- package/esm/4_session.js +23 -0
- package/esm/5_client.d.ts +1 -1
- package/esm/5_client.js +1 -1
- package/esm/client/0_client_abstract.d.ts +28 -26
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +16 -88
- package/esm/client/0_params.d.ts +5 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password.js +2 -2
- package/esm/client/0_storage_operations.d.ts +4 -4
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +14 -14
- package/esm/client/0_update_processor.d.ts +19 -0
- package/esm/client/0_update_processor.d.ts.map +1 -1
- package/esm/client/0_update_processor.js +19 -0
- package/esm/client/0_utilities.d.ts +6 -2
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/0_utilities.js +21 -23
- package/esm/client/1_client_plain.d.ts +9 -6
- package/esm/client/1_client_plain.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +26 -41
- package/esm/client/1_types.d.ts +4 -23
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.js +10 -10
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +4 -4
- package/esm/client/2_client_encrypted.d.ts +58 -0
- package/esm/client/2_client_encrypted.d.ts.map +1 -0
- package/esm/client/2_client_encrypted.js +265 -0
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +54 -74
- package/esm/client/2_network_statistics_manager.d.ts +1 -1
- package/esm/client/2_network_statistics_manager.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +3 -3
- package/esm/client/2_payment_manager.d.ts.map +1 -1
- package/esm/client/2_payment_manager.js +3 -3
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +10 -10
- package/esm/client/2_translations_manager.d.ts +19 -0
- package/esm/client/2_translations_manager.d.ts.map +1 -1
- package/esm/client/2_translations_manager.js +24 -5
- package/esm/client/2_update_manager.d.ts +4 -4
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +69 -79
- package/esm/client/3_client_encrypted_pool.d.ts +30 -0
- package/esm/client/3_client_encrypted_pool.d.ts.map +1 -0
- package/esm/client/3_client_encrypted_pool.js +70 -0
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +100 -74
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +15 -20
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +2 -2
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +33 -33
- package/esm/client/4_chat_manager.d.ts.map +1 -1
- package/esm/client/4_chat_manager.js +25 -25
- package/esm/client/4_gift_manager.js +2 -2
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +4 -4
- package/esm/client/4_poll_manager.d.ts.map +1 -1
- package/esm/client/4_poll_manager.js +5 -5
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +10 -10
- package/esm/client/5_client.d.ts +3 -9
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +290 -306
- package/esm/connection/0_connection.d.ts +5 -4
- package/esm/connection/0_connection.d.ts.map +1 -1
- package/esm/connection/1_connection_web_socket.js +2 -2
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/{script/tl/2_tl_reader.d.ts → esm/session/0_session_error.d.ts} +4 -7
- package/esm/session/0_session_error.d.ts.map +1 -0
- package/esm/{tl/2_tl_reader.d.ts → session/0_session_error.js} +5 -7
- package/esm/{tl/2_tl_writer.d.ts → session/0_session_state.d.ts} +7 -5
- package/esm/session/0_session_state.d.ts.map +1 -0
- package/esm/session/0_session_state.js +77 -0
- package/esm/session/1_session.d.ts +31 -0
- package/esm/session/1_session.d.ts.map +1 -0
- package/esm/session/1_session.js +149 -0
- package/esm/session/2_session_encrypted.d.ts +40 -0
- package/esm/session/2_session_encrypted.d.ts.map +1 -0
- package/esm/session/2_session_encrypted.js +416 -0
- package/esm/session/2_session_plain.d.ts +25 -0
- package/esm/session/2_session_plain.d.ts.map +1 -0
- package/esm/session/2_session_plain.js +56 -0
- package/esm/tl/0_tl_error.d.ts +22 -0
- package/esm/tl/0_tl_error.d.ts.map +1 -0
- package/esm/tl/0_tl_error.js +21 -0
- package/esm/tl/0_types.d.ts +25 -0
- package/esm/tl/0_types.d.ts.map +1 -0
- package/esm/tl/0_types.js +20 -0
- package/esm/tl/0_utilities.d.ts +32 -0
- package/esm/tl/0_utilities.d.ts.map +1 -0
- package/esm/tl/0_utilities.js +51 -0
- package/esm/tl/0_utilities_test.d.ts.map +1 -0
- package/esm/tl/1_mtproto_api.d.ts +371 -0
- package/esm/tl/1_mtproto_api.d.ts.map +1 -0
- package/esm/tl/1_mtproto_api.js +416 -0
- package/esm/tl/{0_api.d.ts → 1_telegram_api.d.ts} +23 -340
- package/esm/tl/1_telegram_api.d.ts.map +1 -0
- package/esm/tl/{0_api.js → 1_telegram_api.js} +4945 -11109
- package/{script/tl/0_tl_raw_reader.d.ts → esm/tl/1_tl_reader.d.ts} +5 -2
- package/esm/tl/1_tl_reader.d.ts.map +1 -0
- package/esm/tl/{2_tl_reader.js → 1_tl_reader.js} +107 -40
- package/esm/tl/1_tl_reader_test.d.ts.map +1 -0
- package/esm/tl/{0_tl_raw_writer.d.ts → 1_tl_writer.d.ts} +5 -2
- package/esm/tl/1_tl_writer.d.ts.map +1 -0
- package/esm/tl/{2_tl_writer.js → 1_tl_writer.js} +80 -23
- package/esm/tl/1_tl_writer_test.d.ts.map +1 -0
- package/esm/tl/1_utilities.d.ts +9 -24
- package/esm/tl/1_utilities.d.ts.map +1 -1
- package/esm/tl/1_utilities.js +18 -64
- package/esm/tl/2_message.d.ts +2 -2
- package/esm/tl/2_message.d.ts.map +1 -1
- package/esm/tl/2_message.js +7 -7
- package/esm/tl/2_mtproto.d.ts +33 -0
- package/esm/tl/2_mtproto.d.ts.map +1 -0
- package/esm/tl/2_mtproto.js +53 -0
- package/{script/tl/2_utilities.d.ts → esm/tl/2_telegram.d.ts} +16 -2
- package/esm/tl/2_telegram.d.ts.map +1 -0
- package/esm/tl/{2_utilities.js → 2_telegram.js} +46 -1
- package/esm/transport/0_transport.d.ts +1 -1
- package/esm/transport/0_transport.d.ts.map +1 -1
- package/esm/types/0_chat_photo.d.ts.map +1 -1
- package/esm/types/0_chat_photo.js +2 -2
- package/esm/types/0_giveaway_parameters.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.js +3 -3
- package/esm/types/0_location.d.ts.map +1 -1
- package/esm/types/0_location.js +5 -5
- package/esm/types/0_message_entity.d.ts.map +1 -1
- package/esm/types/0_message_entity.js +20 -20
- package/esm/types/0_reaction.d.ts.map +1 -1
- package/esm/types/0_reaction.js +4 -4
- package/esm/types/0_slow_mode_duration.d.ts +19 -0
- package/esm/types/0_slow_mode_duration.d.ts.map +1 -1
- package/esm/types/0_slow_mode_duration.js +19 -0
- package/esm/types/0_thumbnail.d.ts.map +1 -1
- package/esm/types/0_thumbnail.js +3 -3
- package/esm/types/0_translation.d.ts +19 -0
- package/esm/types/0_translation.d.ts.map +1 -1
- package/esm/types/0_translation.js +22 -3
- package/esm/types/0_video_chat.d.ts.map +1 -1
- package/esm/types/0_video_chat.js +2 -2
- package/esm/types/1_animation.d.ts.map +1 -1
- package/esm/types/1_animation.js +2 -2
- package/esm/types/1_audio.d.ts.map +1 -1
- package/esm/types/1_audio.js +2 -2
- package/esm/types/1_bot_command_scope.d.ts.map +1 -1
- package/esm/types/1_bot_command_scope.js +2 -2
- package/esm/types/1_chat_p.d.ts.map +1 -1
- package/esm/types/1_chat_p.js +6 -6
- package/esm/types/1_document.d.ts.map +1 -1
- package/esm/types/1_document.js +2 -2
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +10 -10
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +6 -6
- package/esm/types/1_photo.d.ts.map +1 -1
- package/esm/types/1_photo.js +3 -3
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +8 -8
- package/esm/types/1_story_privacy.d.ts.map +1 -1
- package/esm/types/1_story_privacy.js +7 -7
- package/esm/types/1_user.d.ts.map +1 -1
- package/esm/types/1_user.js +2 -2
- package/esm/types/1_venue.d.ts.map +1 -1
- package/esm/types/1_venue.js +2 -2
- package/esm/types/1_video.d.ts.map +1 -1
- package/esm/types/1_video.js +2 -2
- package/esm/types/1_video_note.d.ts.map +1 -1
- package/esm/types/1_video_note.js +2 -2
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +8 -8
- package/esm/types/2_chat_member.d.ts.map +1 -1
- package/esm/types/2_chat_member.js +10 -10
- package/esm/types/2_chat_settings.d.ts +19 -0
- package/esm/types/2_chat_settings.d.ts.map +1 -1
- package/esm/types/2_chat_settings.js +21 -2
- package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
- package/esm/types/2_chosen_inline_result.js +4 -4
- package/esm/types/2_game.d.ts.map +1 -1
- package/esm/types/2_game.js +4 -4
- package/esm/types/2_gift_upgraded_component.d.ts.map +1 -1
- package/esm/types/2_gift_upgraded_component.js +3 -3
- package/esm/types/2_inactive_chat.d.ts.map +1 -1
- package/esm/types/2_inactive_chat.js +2 -2
- package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/esm/types/2_inline_keyboard_button.js +10 -10
- package/esm/types/2_inline_query.d.ts.map +1 -1
- package/esm/types/2_inline_query.js +7 -7
- package/esm/types/2_message_reactions.d.ts.map +1 -1
- package/esm/types/2_message_reactions.js +2 -2
- package/esm/types/2_story_content.d.ts.map +1 -1
- package/esm/types/2_story_content.js +6 -6
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.js +9 -9
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.js +2 -2
- package/esm/types/3_gift.d.ts.map +1 -1
- package/esm/types/3_gift.js +3 -3
- package/esm/types/3_join_request.d.ts.map +1 -1
- package/esm/types/3_join_request.js +2 -2
- package/esm/types/3_reply_markup.d.ts.map +1 -1
- package/esm/types/3_reply_markup.js +5 -5
- package/esm/types/4_claimed_gift.d.ts.map +1 -1
- package/esm/types/4_claimed_gift.js +2 -2
- package/esm/types/4_inline_query_result.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.js +14 -14
- package/esm/types/4_message.d.ts.map +1 -1
- package/esm/types/4_message.js +57 -57
- package/esm/types/5_callback_query.d.ts +1 -1
- package/esm/types/5_callback_query.d.ts.map +1 -1
- package/esm/types/5_callback_query.js +7 -8
- package/esm/types/5_chat_list_item.d.ts.map +1 -1
- package/esm/types/5_chat_list_item.js +5 -5
- package/esm/types/5_claimed_gifts.d.ts.map +1 -1
- package/esm/types/5_claimed_gifts.js +6 -6
- package/esm/types/_file_id.d.ts.map +1 -1
- package/esm/types/_file_id.js +3 -3
- package/package.json +1 -1
- package/script/2_tl.d.ts +6 -6
- package/script/2_tl.d.ts.map +1 -1
- package/script/2_tl.js +11 -11
- package/script/3_errors.d.ts +1 -2
- package/script/3_errors.d.ts.map +1 -1
- package/script/3_errors.js +2 -1
- package/script/4_constants.d.ts +0 -1
- package/script/4_constants.d.ts.map +1 -1
- package/script/4_constants.js +1 -2
- package/script/4_errors.d.ts +2 -2
- package/script/4_errors.d.ts.map +1 -1
- package/script/4_session.d.ts +24 -0
- package/script/4_session.d.ts.map +1 -0
- package/script/4_session.js +39 -0
- package/script/5_client.d.ts +1 -1
- package/script/5_client.js +1 -1
- package/script/client/0_client_abstract.d.ts +28 -26
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +18 -113
- package/script/client/0_params.d.ts +5 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +1 -1
- package/script/client/0_storage_operations.d.ts +4 -4
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +13 -13
- package/script/client/0_update_processor.d.ts +19 -0
- package/script/client/0_update_processor.d.ts.map +1 -1
- package/script/client/0_update_processor.js +19 -0
- package/script/client/0_utilities.d.ts +6 -2
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/0_utilities.js +22 -24
- package/script/client/1_client_plain.d.ts +9 -6
- package/script/client/1_client_plain.d.ts.map +1 -1
- package/script/client/1_client_plain.js +25 -40
- package/script/client/1_types.d.ts +4 -23
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.js +9 -9
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +3 -3
- package/script/client/2_client_encrypted.d.ts +58 -0
- package/script/client/2_client_encrypted.d.ts.map +1 -0
- package/script/client/2_client_encrypted.js +269 -0
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +52 -72
- package/script/client/2_network_statistics_manager.d.ts +1 -1
- package/script/client/2_network_statistics_manager.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +3 -3
- package/script/client/2_payment_manager.d.ts.map +1 -1
- package/script/client/2_payment_manager.js +2 -2
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +9 -9
- package/script/client/2_translations_manager.d.ts +19 -0
- package/script/client/2_translations_manager.d.ts.map +1 -1
- package/script/client/2_translations_manager.js +23 -4
- package/script/client/2_update_manager.d.ts +4 -4
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +68 -78
- package/script/client/3_client_encrypted_pool.d.ts +30 -0
- package/script/client/3_client_encrypted_pool.d.ts.map +1 -0
- package/script/client/3_client_encrypted_pool.js +74 -0
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +99 -73
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +14 -19
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +1 -1
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +32 -32
- package/script/client/4_chat_manager.d.ts.map +1 -1
- package/script/client/4_chat_manager.js +24 -24
- package/script/client/4_gift_manager.js +1 -1
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +3 -3
- package/script/client/4_poll_manager.d.ts.map +1 -1
- package/script/client/4_poll_manager.js +4 -4
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +9 -9
- package/script/client/5_client.d.ts +3 -9
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +284 -300
- package/script/connection/0_connection.d.ts +5 -4
- package/script/connection/0_connection.d.ts.map +1 -1
- package/script/connection/1_connection_web_socket.js +2 -2
- package/script/mod.d.ts +1 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +1 -2
- package/script/session/0_session_error.d.ts +24 -0
- package/script/session/0_session_error.d.ts.map +1 -0
- package/script/session/0_session_error.js +29 -0
- package/script/{tl/2_tl_writer.d.ts → session/0_session_state.d.ts} +7 -5
- package/script/session/0_session_state.d.ts.map +1 -0
- package/script/session/0_session_state.js +81 -0
- package/script/session/1_session.d.ts +31 -0
- package/script/session/1_session.d.ts.map +1 -0
- package/script/session/1_session.js +176 -0
- package/script/session/2_session_encrypted.d.ts +40 -0
- package/script/session/2_session_encrypted.d.ts.map +1 -0
- package/script/session/2_session_encrypted.js +420 -0
- package/script/session/2_session_plain.d.ts +25 -0
- package/script/session/2_session_plain.d.ts.map +1 -0
- package/script/session/2_session_plain.js +60 -0
- package/script/tl/0_tl_error.d.ts +22 -0
- package/script/tl/0_tl_error.d.ts.map +1 -0
- package/script/tl/0_tl_error.js +25 -0
- package/script/tl/0_types.d.ts +25 -0
- package/script/tl/0_types.d.ts.map +1 -0
- package/script/tl/0_types.js +21 -0
- package/script/tl/0_utilities.d.ts +32 -0
- package/script/tl/0_utilities.d.ts.map +1 -0
- package/script/tl/0_utilities.js +59 -0
- package/script/tl/0_utilities_test.d.ts.map +1 -0
- package/script/tl/1_mtproto_api.d.ts +371 -0
- package/script/tl/1_mtproto_api.d.ts.map +1 -0
- package/script/tl/1_mtproto_api.js +419 -0
- package/script/tl/{0_api.d.ts → 1_telegram_api.d.ts} +23 -340
- package/script/tl/1_telegram_api.d.ts.map +1 -0
- package/script/tl/{0_api.js → 1_telegram_api.js} +4947 -11134
- package/{esm/tl/0_tl_raw_reader.d.ts → script/tl/1_tl_reader.d.ts} +5 -2
- package/script/tl/1_tl_reader.d.ts.map +1 -0
- package/script/tl/1_tl_reader.js +218 -0
- package/script/tl/1_tl_reader_test.d.ts.map +1 -0
- package/script/tl/{0_tl_raw_writer.d.ts → 1_tl_writer.d.ts} +5 -2
- package/script/tl/1_tl_writer.d.ts.map +1 -0
- package/script/tl/{2_tl_writer.js → 1_tl_writer.js} +102 -45
- package/script/tl/1_tl_writer_test.d.ts.map +1 -0
- package/script/tl/1_utilities.d.ts +9 -24
- package/script/tl/1_utilities.d.ts.map +1 -1
- package/script/tl/1_utilities.js +19 -72
- package/script/tl/2_message.d.ts +2 -2
- package/script/tl/2_message.d.ts.map +1 -1
- package/script/tl/2_message.js +7 -7
- package/script/tl/2_mtproto.d.ts +33 -0
- package/script/tl/2_mtproto.d.ts.map +1 -0
- package/script/tl/2_mtproto.js +78 -0
- package/{esm/tl/2_utilities.d.ts → script/tl/2_telegram.d.ts} +16 -2
- package/script/tl/2_telegram.d.ts.map +1 -0
- package/script/tl/2_telegram.js +167 -0
- package/script/transport/0_transport.d.ts +1 -1
- package/script/transport/0_transport.d.ts.map +1 -1
- package/script/types/0_chat_photo.d.ts.map +1 -1
- package/script/types/0_chat_photo.js +1 -1
- package/script/types/0_giveaway_parameters.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.js +2 -2
- package/script/types/0_location.d.ts.map +1 -1
- package/script/types/0_location.js +4 -4
- package/script/types/0_message_entity.d.ts.map +1 -1
- package/script/types/0_message_entity.js +19 -19
- package/script/types/0_reaction.d.ts.map +1 -1
- package/script/types/0_reaction.js +3 -3
- package/script/types/0_slow_mode_duration.d.ts +19 -0
- package/script/types/0_slow_mode_duration.d.ts.map +1 -1
- package/script/types/0_slow_mode_duration.js +19 -0
- package/script/types/0_thumbnail.d.ts.map +1 -1
- package/script/types/0_thumbnail.js +2 -2
- package/script/types/0_translation.d.ts +19 -0
- package/script/types/0_translation.d.ts.map +1 -1
- package/script/types/0_translation.js +21 -2
- package/script/types/0_video_chat.d.ts.map +1 -1
- package/script/types/0_video_chat.js +1 -1
- package/script/types/1_animation.d.ts.map +1 -1
- package/script/types/1_animation.js +1 -1
- package/script/types/1_audio.d.ts.map +1 -1
- package/script/types/1_audio.js +1 -1
- package/script/types/1_bot_command_scope.d.ts.map +1 -1
- package/script/types/1_bot_command_scope.js +1 -1
- package/script/types/1_chat_p.d.ts.map +1 -1
- package/script/types/1_chat_p.js +5 -5
- package/script/types/1_document.d.ts.map +1 -1
- package/script/types/1_document.js +1 -1
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +9 -9
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +5 -5
- package/script/types/1_photo.d.ts.map +1 -1
- package/script/types/1_photo.js +2 -2
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +7 -7
- package/script/types/1_story_privacy.d.ts.map +1 -1
- package/script/types/1_story_privacy.js +6 -6
- package/script/types/1_user.d.ts.map +1 -1
- package/script/types/1_user.js +1 -1
- package/script/types/1_venue.d.ts.map +1 -1
- package/script/types/1_venue.js +1 -1
- package/script/types/1_video.d.ts.map +1 -1
- package/script/types/1_video.js +1 -1
- package/script/types/1_video_note.d.ts.map +1 -1
- package/script/types/1_video_note.js +1 -1
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +7 -7
- package/script/types/2_chat_member.d.ts.map +1 -1
- package/script/types/2_chat_member.js +9 -9
- package/script/types/2_chat_settings.d.ts +19 -0
- package/script/types/2_chat_settings.d.ts.map +1 -1
- package/script/types/2_chat_settings.js +20 -1
- package/script/types/2_chosen_inline_result.d.ts.map +1 -1
- package/script/types/2_chosen_inline_result.js +3 -3
- package/script/types/2_game.d.ts.map +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_gift_upgraded_component.d.ts.map +1 -1
- package/script/types/2_gift_upgraded_component.js +2 -2
- package/script/types/2_inactive_chat.d.ts.map +1 -1
- package/script/types/2_inactive_chat.js +1 -1
- package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/script/types/2_inline_keyboard_button.js +9 -9
- package/script/types/2_inline_query.d.ts.map +1 -1
- package/script/types/2_inline_query.js +6 -6
- package/script/types/2_message_reactions.d.ts.map +1 -1
- package/script/types/2_message_reactions.js +1 -1
- package/script/types/2_story_content.d.ts.map +1 -1
- package/script/types/2_story_content.js +5 -5
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.js +8 -8
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.js +1 -1
- package/script/types/3_gift.d.ts.map +1 -1
- package/script/types/3_gift.js +2 -2
- package/script/types/3_join_request.d.ts.map +1 -1
- package/script/types/3_join_request.js +1 -1
- package/script/types/3_reply_markup.d.ts.map +1 -1
- package/script/types/3_reply_markup.js +4 -4
- package/script/types/4_claimed_gift.d.ts.map +1 -1
- package/script/types/4_claimed_gift.js +1 -1
- package/script/types/4_inline_query_result.d.ts.map +1 -1
- package/script/types/4_inline_query_result.js +13 -13
- package/script/types/4_message.d.ts.map +1 -1
- package/script/types/4_message.js +56 -56
- package/script/types/5_callback_query.d.ts +1 -1
- package/script/types/5_callback_query.d.ts.map +1 -1
- package/script/types/5_callback_query.js +6 -7
- package/script/types/5_chat_list_item.d.ts.map +1 -1
- package/script/types/5_chat_list_item.js +4 -4
- package/script/types/5_claimed_gifts.d.ts.map +1 -1
- package/script/types/5_claimed_gifts.js +5 -5
- package/script/types/_file_id.d.ts.map +1 -1
- package/script/types/_file_id.js +2 -2
- package/esm/client/0_message.d.ts +0 -29
- package/esm/client/0_message.d.ts.map +0 -1
- package/esm/client/0_message.js +0 -83
- package/esm/client/1_client_encrypted.d.ts +0 -52
- package/esm/client/1_client_encrypted.d.ts.map +0 -1
- package/esm/client/1_client_encrypted.js +0 -381
- package/esm/tl/0_api.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_reader.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_reader.js +0 -97
- package/esm/tl/0_tl_raw_reader_test.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_writer.d.ts.map +0 -1
- package/esm/tl/0_tl_raw_writer.js +0 -86
- package/esm/tl/0_tl_raw_writer_test.d.ts.map +0 -1
- package/esm/tl/1_utilities_test.d.ts.map +0 -1
- package/esm/tl/2_tl_reader.d.ts.map +0 -1
- package/esm/tl/2_tl_reader_test.d.ts.map +0 -1
- package/esm/tl/2_tl_writer.d.ts.map +0 -1
- package/esm/tl/2_tl_writer_test.d.ts.map +0 -1
- package/esm/tl/2_utilities.d.ts.map +0 -1
- package/script/client/0_message.d.ts +0 -29
- package/script/client/0_message.d.ts.map +0 -1
- package/script/client/0_message.js +0 -90
- package/script/client/1_client_encrypted.d.ts +0 -52
- package/script/client/1_client_encrypted.d.ts.map +0 -1
- package/script/client/1_client_encrypted.js +0 -385
- package/script/tl/0_api.d.ts.map +0 -1
- package/script/tl/0_tl_raw_reader.d.ts.map +0 -1
- package/script/tl/0_tl_raw_reader.js +0 -102
- package/script/tl/0_tl_raw_reader_test.d.ts.map +0 -1
- package/script/tl/0_tl_raw_writer.d.ts.map +0 -1
- package/script/tl/0_tl_raw_writer.js +0 -90
- package/script/tl/0_tl_raw_writer_test.d.ts.map +0 -1
- package/script/tl/1_utilities_test.d.ts.map +0 -1
- package/script/tl/2_tl_reader.d.ts.map +0 -1
- package/script/tl/2_tl_reader.js +0 -150
- package/script/tl/2_tl_reader_test.d.ts.map +0 -1
- package/script/tl/2_tl_writer.d.ts.map +0 -1
- package/script/tl/2_tl_writer_test.d.ts.map +0 -1
- package/script/tl/2_utilities.d.ts.map +0 -1
- package/script/tl/2_utilities.js +0 -98
|
@@ -18,16 +18,17 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
import { MaybePromise } from "../1_utilities.js";
|
|
21
|
+
export interface ConnectionCallback {
|
|
22
|
+
read(count: number): void;
|
|
23
|
+
write(count: number): void;
|
|
24
|
+
}
|
|
21
25
|
export interface Connection {
|
|
22
26
|
get connected(): boolean;
|
|
23
27
|
stateChangeHandler?: (connected: boolean) => void;
|
|
24
28
|
open(): MaybePromise<void>;
|
|
25
29
|
write(p: Uint8Array): MaybePromise<void>;
|
|
26
30
|
close(): MaybePromise<void>;
|
|
27
|
-
callback?:
|
|
28
|
-
read(count: number): void;
|
|
29
|
-
write(count: number): void;
|
|
30
|
-
};
|
|
31
|
+
callback?: ConnectionCallback;
|
|
31
32
|
read(p: Uint8Array): MaybePromise<void>;
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=0_connection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_connection.d.ts","sourceRoot":"","sources":["../../src/connection/0_connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,UAAU;IACzB,IAAI,SAAS,IAAI,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE
|
|
1
|
+
{"version":3,"file":"0_connection.d.ts","sourceRoot":"","sources":["../../src/connection/0_connection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,SAAS,IAAI,OAAO,CAAC;IACzB,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;IAClD,IAAI,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,KAAK,CAAC,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,IAAI,CAAC,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;CACzC"}
|
|
@@ -84,11 +84,11 @@ class ConnectionWebSocket {
|
|
|
84
84
|
}
|
|
85
85
|
async open() {
|
|
86
86
|
if (__classPrivateFieldGet(this, _ConnectionWebSocket_isConnecting, "f")) {
|
|
87
|
-
throw new
|
|
87
|
+
throw new _0_errors_js_1.ConnectionError("Already connecting");
|
|
88
88
|
}
|
|
89
89
|
__classPrivateFieldSet(this, _ConnectionWebSocket_isConnecting, true, "f");
|
|
90
90
|
if (this.connected) {
|
|
91
|
-
throw new
|
|
91
|
+
throw new _0_errors_js_1.ConnectionError("Already connected");
|
|
92
92
|
}
|
|
93
93
|
try {
|
|
94
94
|
__classPrivateFieldSet(this, _ConnectionWebSocket_webSocket, await __classPrivateFieldGet(this, _ConnectionWebSocket_instances, "m", _ConnectionWebSocket_initWs).call(this), "f");
|
package/script/mod.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ export * from "./2_storage.js";
|
|
|
25
25
|
export * from "./3_transport.js";
|
|
26
26
|
export * from "./2_tl.js";
|
|
27
27
|
export * from "./3_types.js";
|
|
28
|
-
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK,
|
|
28
|
+
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./4_constants.js";
|
|
29
29
|
export * as errors from "./4_errors.js";
|
|
30
30
|
export * from "./5_client.js";
|
|
31
31
|
//# sourceMappingURL=mod.d.ts.map
|
package/script/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1J,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,qBAAqB,CAAC;AAG7B,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC1J,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjI,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,cAAc,eAAe,CAAC"}
|
package/script/mod.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
26
26
|
return result;
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.errors = exports.SYSTEM_VERSION = exports.SYSTEM_LANG_CODE = exports.
|
|
29
|
+
exports.errors = exports.SYSTEM_VERSION = exports.SYSTEM_LANG_CODE = exports.LANG_PACK = exports.LANG_CODE = exports.INITIAL_DC = exports.DEVICE_MODEL = exports.APP_VERSION = exports.checkPassword = exports.setLogVerbosity = exports.setLoggingProvider = exports.setLogFilter = exports.getRandomId = exports.getColorName = exports.getColorFromPeerId = void 0;
|
|
30
30
|
/**
|
|
31
31
|
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
32
32
|
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
@@ -67,7 +67,6 @@ Object.defineProperty(exports, "DEVICE_MODEL", { enumerable: true, get: function
|
|
|
67
67
|
Object.defineProperty(exports, "INITIAL_DC", { enumerable: true, get: function () { return _4_constants_js_1.INITIAL_DC; } });
|
|
68
68
|
Object.defineProperty(exports, "LANG_CODE", { enumerable: true, get: function () { return _4_constants_js_1.LANG_CODE; } });
|
|
69
69
|
Object.defineProperty(exports, "LANG_PACK", { enumerable: true, get: function () { return _4_constants_js_1.LANG_PACK; } });
|
|
70
|
-
Object.defineProperty(exports, "LAYER", { enumerable: true, get: function () { return _4_constants_js_1.LAYER; } });
|
|
71
70
|
Object.defineProperty(exports, "SYSTEM_LANG_CODE", { enumerable: true, get: function () { return _4_constants_js_1.SYSTEM_LANG_CODE; } });
|
|
72
71
|
Object.defineProperty(exports, "SYSTEM_VERSION", { enumerable: true, get: function () { return _4_constants_js_1.SYSTEM_VERSION; } });
|
|
73
72
|
exports.errors = __importStar(require("./4_errors.js"));
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { MtkrutoError } from "../0_errors.js";
|
|
21
|
+
export declare class SessionError extends MtkrutoError {
|
|
22
|
+
constructor(message: string);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=0_session_error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_session_error.d.ts","sourceRoot":"","sources":["../../src/session/0_session_error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,qBAAa,YAAa,SAAQ,YAAY;gBAChC,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.SessionError = void 0;
|
|
23
|
+
const _0_errors_js_1 = require("../0_errors.js");
|
|
24
|
+
class SessionError extends _0_errors_js_1.MtkrutoError {
|
|
25
|
+
constructor(message) {
|
|
26
|
+
super(message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.SessionError = SessionError;
|
|
@@ -17,10 +17,12 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
|
|
21
|
-
import { TLRawWriter } from "./0_tl_raw_writer.js";
|
|
22
|
-
export declare class TLWriter extends TLRawWriter {
|
|
20
|
+
export declare class SessionState {
|
|
23
21
|
#private;
|
|
24
|
-
|
|
22
|
+
timeDifference: number;
|
|
23
|
+
serverSalt: bigint;
|
|
24
|
+
nextMessageId(): bigint;
|
|
25
|
+
nextSeqNo(contentRelated: boolean): number;
|
|
26
|
+
reset(): void;
|
|
25
27
|
}
|
|
26
|
-
//# sourceMappingURL=
|
|
28
|
+
//# sourceMappingURL=0_session_state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0_session_state.d.ts","sourceRoot":"","sources":["../../src/session/0_session_state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,qBAAa,YAAY;;IACvB,cAAc,SAAK;IACnB,UAAU,SAAM;IAIhB,aAAa,IAAI,MAAM;IAYvB,SAAS,CAAC,cAAc,EAAE,OAAO,GAAG,MAAM;IAS1C,KAAK;CAKN"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
5
|
+
*
|
|
6
|
+
* This file is part of MTKruto.
|
|
7
|
+
*
|
|
8
|
+
* This program is free software: you can redistribute it and/or modify
|
|
9
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
* (at your option) any later version.
|
|
12
|
+
*
|
|
13
|
+
* This program is distributed in the hope that it will be useful,
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
* GNU Lesser General Public License for more details.
|
|
17
|
+
*
|
|
18
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
+
*/
|
|
21
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
22
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
23
|
+
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");
|
|
24
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
25
|
+
};
|
|
26
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
27
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
28
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
29
|
+
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");
|
|
30
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
31
|
+
};
|
|
32
|
+
var _SessionState_seqNo, _SessionState_messageId;
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.SessionState = void 0;
|
|
35
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
36
|
+
class SessionState {
|
|
37
|
+
constructor() {
|
|
38
|
+
Object.defineProperty(this, "timeDifference", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: 0
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(this, "serverSalt", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value: 0n
|
|
49
|
+
});
|
|
50
|
+
_SessionState_seqNo.set(this, 0);
|
|
51
|
+
_SessionState_messageId.set(this, 0n);
|
|
52
|
+
}
|
|
53
|
+
nextMessageId() {
|
|
54
|
+
const now = (0, _1_utilities_js_1.toUnixTimestamp)(new Date()) + this.timeDifference;
|
|
55
|
+
const nanoseconds = Math.floor((now - Math.floor(now)) * 1e9);
|
|
56
|
+
const newMessageId = (BigInt(Math.floor(now)) << 32n) || (BigInt(nanoseconds) << 2n);
|
|
57
|
+
if (__classPrivateFieldGet(this, _SessionState_messageId, "f") >= newMessageId) {
|
|
58
|
+
__classPrivateFieldSet(this, _SessionState_messageId, __classPrivateFieldGet(this, _SessionState_messageId, "f") + 4n, "f");
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
__classPrivateFieldSet(this, _SessionState_messageId, newMessageId, "f");
|
|
62
|
+
}
|
|
63
|
+
return __classPrivateFieldGet(this, _SessionState_messageId, "f");
|
|
64
|
+
}
|
|
65
|
+
nextSeqNo(contentRelated) {
|
|
66
|
+
var _a;
|
|
67
|
+
let seqNo = __classPrivateFieldGet(this, _SessionState_seqNo, "f") * 2;
|
|
68
|
+
if (contentRelated) {
|
|
69
|
+
seqNo++;
|
|
70
|
+
__classPrivateFieldSet(this, _SessionState_seqNo, (_a = __classPrivateFieldGet(this, _SessionState_seqNo, "f"), _a++, _a), "f");
|
|
71
|
+
}
|
|
72
|
+
return seqNo;
|
|
73
|
+
}
|
|
74
|
+
reset() {
|
|
75
|
+
this.serverSalt = 0n;
|
|
76
|
+
__classPrivateFieldSet(this, _SessionState_seqNo, 0, "f");
|
|
77
|
+
__classPrivateFieldSet(this, _SessionState_messageId, 0n, "f");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.SessionState = SessionState;
|
|
81
|
+
_SessionState_seqNo = new WeakMap(), _SessionState_messageId = new WeakMap();
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Connection, ConnectionCallback } from "../2_connection.js";
|
|
2
|
+
import { DC, TransportProvider } from "../3_transport.js";
|
|
3
|
+
import { SessionState } from "./0_session_state.js";
|
|
4
|
+
export interface SessionParams {
|
|
5
|
+
/**
|
|
6
|
+
* The transport provider to use. Defaults to `webSocketTransportProvider` with its default options.
|
|
7
|
+
*/
|
|
8
|
+
transportProvider?: TransportProvider;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the connection is with a CDN server. Defaults to false.
|
|
11
|
+
*/
|
|
12
|
+
cdn?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare abstract class Session {
|
|
15
|
+
#private;
|
|
16
|
+
protected state: SessionState;
|
|
17
|
+
protected transport: ReturnType<TransportProvider>;
|
|
18
|
+
constructor(dc: DC, params?: SessionParams);
|
|
19
|
+
set onConnectionStateChange(onConnectionStateChange: Connection["stateChangeHandler"]);
|
|
20
|
+
set connectionCallback(connectionCallback: ConnectionCallback | undefined);
|
|
21
|
+
get dc(): DC;
|
|
22
|
+
get cdn(): boolean;
|
|
23
|
+
set serverSalt(serverSalt: bigint);
|
|
24
|
+
get connected(): boolean;
|
|
25
|
+
connect(): Promise<void>;
|
|
26
|
+
protected waitUntilConnected(): Promise<void>;
|
|
27
|
+
get disconnected(): boolean;
|
|
28
|
+
disconnect(): void;
|
|
29
|
+
abstract send(body: Uint8Array): Promise<bigint>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=1_session.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_session.d.ts","sourceRoot":"","sources":["../../src/session/1_session.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAoD,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAQpD,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,8BAAsB,OAAO;;IAG3B,SAAS,CAAC,KAAK,EAAE,YAAY,CAAsB;IACnD,SAAS,CAAC,SAAS,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;gBAMvC,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,aAAa;IAc1C,IAAI,uBAAuB,CAAC,uBAAuB,EAAE,UAAU,CAAC,oBAAoB,CAAC,EAEpF;IAED,IAAI,kBAAkB,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,SAAS,EAExE;IAED,IAAI,EAAE,IAAI,EAAE,CAEX;IAED,IAAI,GAAG,IAAI,OAAO,CAEjB;IAED,IAAI,UAAU,CAAC,UAAU,EAAE,MAAM,EAEhC;IAgCD,IAAI,SAAS,IAAI,OAAO,CAEvB;IAGK,OAAO;cAeG,kBAAkB;IAIlC,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,UAAU;IAQV,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CACjD"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
+
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");
|
|
29
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
+
};
|
|
31
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
32
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
33
|
+
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");
|
|
34
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
35
|
+
};
|
|
36
|
+
var _Session_instances, _Session_dc, _Session_cdn, _Session_lastConnect, _Session_disconnected, _Session_L, _Session_onConnectionStateChange, _Session_lastState, _Session_stateChangeHandler, _Session_connectMutex;
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.Session = void 0;
|
|
39
|
+
/**
|
|
40
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
41
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
42
|
+
*
|
|
43
|
+
* This file is part of MTKruto.
|
|
44
|
+
*
|
|
45
|
+
* This program is free software: you can redistribute it and/or modify
|
|
46
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
47
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
48
|
+
* (at your option) any later version.
|
|
49
|
+
*
|
|
50
|
+
* This program is distributed in the hope that it will be useful,
|
|
51
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
52
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
53
|
+
* GNU Lesser General Public License for more details.
|
|
54
|
+
*
|
|
55
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
56
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
57
|
+
*/
|
|
58
|
+
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
59
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
60
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
61
|
+
const _3_transport_js_1 = require("../3_transport.js");
|
|
62
|
+
const _0_session_state_js_1 = require("./0_session_state.js");
|
|
63
|
+
// global Session ID counter for logs
|
|
64
|
+
let id = 0;
|
|
65
|
+
// @ts-ignore: lib
|
|
66
|
+
const defaultTransportProvider = typeof dntShim.Deno === "undefined" ? _3_transport_js_1.transportProviderWebSocket : _3_transport_js_1.transportProviderTcp;
|
|
67
|
+
class Session {
|
|
68
|
+
constructor(dc, params) {
|
|
69
|
+
_Session_instances.add(this);
|
|
70
|
+
_Session_dc.set(this, void 0);
|
|
71
|
+
_Session_cdn.set(this, void 0);
|
|
72
|
+
Object.defineProperty(this, "state", {
|
|
73
|
+
enumerable: true,
|
|
74
|
+
configurable: true,
|
|
75
|
+
writable: true,
|
|
76
|
+
value: new _0_session_state_js_1.SessionState()
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(this, "transport", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
configurable: true,
|
|
81
|
+
writable: true,
|
|
82
|
+
value: void 0
|
|
83
|
+
});
|
|
84
|
+
_Session_lastConnect.set(this, void 0);
|
|
85
|
+
_Session_disconnected.set(this, true);
|
|
86
|
+
_Session_L.set(this, void 0);
|
|
87
|
+
_Session_onConnectionStateChange.set(this, void 0);
|
|
88
|
+
_Session_lastState.set(this, void 0);
|
|
89
|
+
_Session_connectMutex.set(this, new _1_utilities_js_1.Mutex());
|
|
90
|
+
__classPrivateFieldSet(this, _Session_dc, dc, "f");
|
|
91
|
+
__classPrivateFieldSet(this, _Session_cdn, params?.cdn ?? false, "f");
|
|
92
|
+
const transportProvider = params?.transportProvider ?? defaultTransportProvider();
|
|
93
|
+
this.transport = transportProvider({ dc: __classPrivateFieldGet(this, _Session_dc, "f"), cdn: __classPrivateFieldGet(this, _Session_cdn, "f") });
|
|
94
|
+
this.transport.connection.stateChangeHandler = (connected) => {
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
(0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _Session_instances, "m", _Session_stateChangeHandler).call(this, connected));
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
__classPrivateFieldSet(this, _Session_L, (0, _1_utilities_js_1.getLogger)("Session").client(id++), "f");
|
|
100
|
+
}
|
|
101
|
+
set onConnectionStateChange(onConnectionStateChange) {
|
|
102
|
+
__classPrivateFieldSet(this, _Session_onConnectionStateChange, onConnectionStateChange, "f");
|
|
103
|
+
}
|
|
104
|
+
set connectionCallback(connectionCallback) {
|
|
105
|
+
this.transport.connection.callback = connectionCallback;
|
|
106
|
+
}
|
|
107
|
+
get dc() {
|
|
108
|
+
return __classPrivateFieldGet(this, _Session_dc, "f");
|
|
109
|
+
}
|
|
110
|
+
get cdn() {
|
|
111
|
+
return __classPrivateFieldGet(this, _Session_cdn, "f");
|
|
112
|
+
}
|
|
113
|
+
set serverSalt(serverSalt) {
|
|
114
|
+
this.state.serverSalt = serverSalt;
|
|
115
|
+
}
|
|
116
|
+
get connected() {
|
|
117
|
+
return this.transport.connection.connected;
|
|
118
|
+
}
|
|
119
|
+
async connect() {
|
|
120
|
+
const release = await __classPrivateFieldGet(this, _Session_connectMutex, "f").lock();
|
|
121
|
+
try {
|
|
122
|
+
if (this.connected) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
await this.transport.connection.open();
|
|
126
|
+
await this.transport.transport.initialize();
|
|
127
|
+
__classPrivateFieldSet(this, _Session_lastConnect, new Date(), "f");
|
|
128
|
+
__classPrivateFieldSet(this, _Session_disconnected, false, "f");
|
|
129
|
+
}
|
|
130
|
+
finally {
|
|
131
|
+
release();
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async waitUntilConnected() {
|
|
135
|
+
(await __classPrivateFieldGet(this, _Session_connectMutex, "f").lock())();
|
|
136
|
+
}
|
|
137
|
+
get disconnected() {
|
|
138
|
+
return __classPrivateFieldGet(this, _Session_disconnected, "f");
|
|
139
|
+
}
|
|
140
|
+
disconnect() {
|
|
141
|
+
__classPrivateFieldSet(this, _Session_disconnected, true, "f");
|
|
142
|
+
if (this.transport.connection.connected) {
|
|
143
|
+
this.transport.connection.close();
|
|
144
|
+
this.transport.transport.deinitialize();
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.Session = Session;
|
|
149
|
+
_Session_dc = new WeakMap(), _Session_cdn = new WeakMap(), _Session_lastConnect = new WeakMap(), _Session_disconnected = new WeakMap(), _Session_L = new WeakMap(), _Session_onConnectionStateChange = new WeakMap(), _Session_lastState = new WeakMap(), _Session_connectMutex = new WeakMap(), _Session_instances = new WeakSet(), _Session_stateChangeHandler = async function _Session_stateChangeHandler(connected) {
|
|
150
|
+
if (__classPrivateFieldGet(this, _Session_lastState, "f") !== connected) {
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
__classPrivateFieldGet(this, _Session_onConnectionStateChange, "f")?.call(this, connected);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
if (!connected) {
|
|
156
|
+
this.transport.transport.deinitialize();
|
|
157
|
+
}
|
|
158
|
+
if (__classPrivateFieldGet(this, _Session_lastState, "f") === connected) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
__classPrivateFieldSet(this, _Session_lastState, connected, "f");
|
|
162
|
+
if (connected || __classPrivateFieldGet(this, _Session_disconnected, "f")) {
|
|
163
|
+
if (__classPrivateFieldGet(this, _Session_disconnected, "f")) {
|
|
164
|
+
__classPrivateFieldGet(this, _Session_L, "f").debug("not reconnecting because explicitly disconnected");
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (__classPrivateFieldGet(this, _Session_lastConnect, "f") && Date.now() - __classPrivateFieldGet(this, _Session_lastConnect, "f").getTime() <= 10 * _0_deps_js_1.SECOND) {
|
|
169
|
+
__classPrivateFieldGet(this, _Session_L, "f").debug("reconnecting after a delay");
|
|
170
|
+
await new Promise((r) => setTimeout(r, 3 * _0_deps_js_1.SECOND));
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
__classPrivateFieldGet(this, _Session_L, "f").debug("reconnecting");
|
|
174
|
+
}
|
|
175
|
+
await this.connect();
|
|
176
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
import { Mtproto } from "../2_tl.js";
|
|
21
|
+
import { DC } from "../3_transport.js";
|
|
22
|
+
import { Session, SessionParams } from "./1_session.js";
|
|
23
|
+
export interface Handlers {
|
|
24
|
+
onUpdate?: (body: Uint8Array) => void;
|
|
25
|
+
onNewServerSalt?: (serverSalt: bigint) => void;
|
|
26
|
+
onMessageFailed?: (id: bigint, reason: unknown) => void;
|
|
27
|
+
onRpcError?: (id: bigint, error: Mtproto.rpc_error) => void;
|
|
28
|
+
onRpcResult?: (id: bigint, result: Uint8Array) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare class SessionEncrypted extends Session implements Session {
|
|
31
|
+
#private;
|
|
32
|
+
handlers: Handlers;
|
|
33
|
+
constructor(dc: DC, params?: SessionParams);
|
|
34
|
+
setAuthKey(key: Uint8Array<ArrayBuffer>): Promise<void>;
|
|
35
|
+
get authKey(): Uint8Array;
|
|
36
|
+
connect(): Promise<void>;
|
|
37
|
+
disconnect(): void;
|
|
38
|
+
send(body: Uint8Array): Promise<bigint>;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=2_session_encrypted.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"2_session_encrypted.d.ts","sourceRoot":"","sources":["../../src/session/2_session_encrypted.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,OAAO,EAA8C,OAAO,EAAuC,MAAM,YAAY,CAAC;AACtH,OAAO,EAAE,EAAE,EAAE,MAAM,mBAAmB,CAAC;AAGvC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AASxD,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACtC,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxD,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,SAAS,KAAK,IAAI,CAAC;IAC5D,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;CACxD;AAED,qBAAa,gBAAiB,SAAQ,OAAQ,YAAW,OAAO;;IAI9D,QAAQ,EAAE,QAAQ,CAAM;gBAQZ,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,aAAa;IAMpC,UAAU,CAAC,GAAG,EAAE,UAAU,CAAC,WAAW,CAAC;IAM7C,IAAI,OAAO,IAAI,UAAU,CAExB;IAEc,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B,UAAU,IAAI,IAAI;IAgDrB,IAAI,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;CAwU9C"}
|