@mtkruto/node 0.62.1 → 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 +96 -70
- 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.map +1 -1
- package/esm/types/5_callback_query.js +6 -7
- 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 +95 -69
- 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.map +1 -1
- package/script/types/5_callback_query.js +5 -6
- 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
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
+
import { Schema } from "./0_types.js";
|
|
20
21
|
export declare class TLError extends Error {
|
|
21
22
|
}
|
|
22
|
-
export declare class
|
|
23
|
+
export declare class TLReader {
|
|
24
|
+
#private;
|
|
23
25
|
protected _buffer: Uint8Array;
|
|
24
26
|
constructor(_buffer: Uint8Array);
|
|
25
27
|
get buffer(): Uint8Array;
|
|
@@ -34,5 +36,6 @@ export declare class TLRawReader {
|
|
|
34
36
|
readInt256(signed?: boolean): bigint;
|
|
35
37
|
readBytes(): Uint8Array;
|
|
36
38
|
readString(): string;
|
|
39
|
+
readType(name: string, schema: Schema): Promise<any>;
|
|
37
40
|
}
|
|
38
|
-
//# sourceMappingURL=
|
|
41
|
+
//# sourceMappingURL=1_tl_reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_tl_reader.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAoB,MAAM,EAAE,MAAM,cAAc,CAAC;AAGxD,qBAAa,OAAQ,SAAQ,KAAK;CAEjC;AAED,qBAAa,QAAQ;;IACP,SAAS,CAAC,OAAO,EAAE,UAAU;gBAAnB,OAAO,EAAE,UAAU;IAGzC,IAAI,MAAM,IAAI,UAAU,CAEvB;IAED,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU;IAS/B,MAAM,CAAC,KAAK,EAAE,MAAM;IAQpB,SAAS,CAAC,MAAM,UAAO,GAAG,MAAM;IAKhC,SAAS,CAAC,MAAM,UAAO,GAAG,MAAM;IAKhC,WAAW;IAIX,SAAS,CAAC,MAAM,UAAO,GAAG,MAAM;IAKhC,UAAU,IAAI,MAAM;IAKpB,UAAU,CAAC,MAAM,UAAO,GAAG,MAAM;IAKjC,UAAU,CAAC,MAAM,UAAO,GAAG,MAAM;IAKjC,SAAS,IAAI,UAAU;IAiBvB,UAAU,IAAI,MAAM;IAId,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;CAmH3D"}
|
|
@@ -0,0 +1,218 @@
|
|
|
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
|
+
// deno-lint-ignore-file no-explicit-any
|
|
22
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
23
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
24
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
25
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
26
|
+
};
|
|
27
|
+
var _TLReader_instances, _TLReader_deserializeEnum, _TLReader_deserializeType, _TLReader_deserializeVector, _TLReader_deserializePrimitive;
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.TLReader = exports.TLError = void 0;
|
|
30
|
+
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
31
|
+
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
32
|
+
class TLError extends Error {
|
|
33
|
+
}
|
|
34
|
+
exports.TLError = TLError;
|
|
35
|
+
class TLReader {
|
|
36
|
+
constructor(_buffer) {
|
|
37
|
+
_TLReader_instances.add(this);
|
|
38
|
+
Object.defineProperty(this, "_buffer", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: _buffer
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
get buffer() {
|
|
46
|
+
return this._buffer;
|
|
47
|
+
}
|
|
48
|
+
read(count) {
|
|
49
|
+
if (this._buffer.length < count) {
|
|
50
|
+
throw new TLError("No data remaining");
|
|
51
|
+
}
|
|
52
|
+
const buffer = this._buffer.slice(0, count);
|
|
53
|
+
this._buffer = this._buffer.subarray(count);
|
|
54
|
+
return buffer;
|
|
55
|
+
}
|
|
56
|
+
unread(count) {
|
|
57
|
+
const newOffest = this._buffer.byteOffset - count;
|
|
58
|
+
if (newOffest < 0) {
|
|
59
|
+
throw new TLError("No data has been read");
|
|
60
|
+
}
|
|
61
|
+
this._buffer = new Uint8Array(this._buffer.buffer, newOffest);
|
|
62
|
+
}
|
|
63
|
+
readInt24(signed = true) {
|
|
64
|
+
const buffer = this.read(24 / 8);
|
|
65
|
+
return Number((0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed));
|
|
66
|
+
}
|
|
67
|
+
readInt32(signed = true) {
|
|
68
|
+
const buffer = this.read(32 / 8);
|
|
69
|
+
return Number((0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed));
|
|
70
|
+
}
|
|
71
|
+
unreadInt32() {
|
|
72
|
+
this.unread(32 / 8);
|
|
73
|
+
}
|
|
74
|
+
readInt64(signed = true) {
|
|
75
|
+
const buffer = this.read(64 / 8);
|
|
76
|
+
return (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed);
|
|
77
|
+
}
|
|
78
|
+
readDouble() {
|
|
79
|
+
const buffer = this.read(8);
|
|
80
|
+
return new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength).getFloat64(0, true);
|
|
81
|
+
}
|
|
82
|
+
readInt128(signed = true) {
|
|
83
|
+
const buffer = this.read(128 / 8);
|
|
84
|
+
return (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed);
|
|
85
|
+
}
|
|
86
|
+
readInt256(signed = true) {
|
|
87
|
+
const buffer = this.read(256 / 8);
|
|
88
|
+
return (0, _1_utilities_js_1.bigIntFromBuffer)(buffer, true, signed);
|
|
89
|
+
}
|
|
90
|
+
readBytes() {
|
|
91
|
+
let L = this.read(1)[0];
|
|
92
|
+
let padding;
|
|
93
|
+
if (L > 253) {
|
|
94
|
+
L = this.readInt24();
|
|
95
|
+
padding = L % 4;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
padding = (L + 1) % 4;
|
|
99
|
+
}
|
|
100
|
+
const bytes = this.read(L);
|
|
101
|
+
if (padding > 0) {
|
|
102
|
+
padding = 4 - padding;
|
|
103
|
+
this.read(padding);
|
|
104
|
+
}
|
|
105
|
+
return bytes;
|
|
106
|
+
}
|
|
107
|
+
readString() {
|
|
108
|
+
return new TextDecoder().decode(this.readBytes());
|
|
109
|
+
}
|
|
110
|
+
async readType(name, schema) {
|
|
111
|
+
if ((0, _0_utilities_js_1.isOptionalParam)(name)) {
|
|
112
|
+
name = (0, _0_utilities_js_1.getOptionalParamInnerType)(name);
|
|
113
|
+
}
|
|
114
|
+
const primitive = __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializePrimitive).call(this, name);
|
|
115
|
+
if (primitive !== undefined) {
|
|
116
|
+
return primitive;
|
|
117
|
+
}
|
|
118
|
+
const id = this.readInt32(false);
|
|
119
|
+
if (name == _0_utilities_js_1.X) {
|
|
120
|
+
const typeName = schema.identifierToName[id];
|
|
121
|
+
if (!typeName) {
|
|
122
|
+
throw new TLError(`Unknown constructor: ${id.toString(16)}`);
|
|
123
|
+
}
|
|
124
|
+
this.unreadInt32();
|
|
125
|
+
return await this.readType(typeName, schema);
|
|
126
|
+
}
|
|
127
|
+
if (id == _0_utilities_js_1.VECTOR) {
|
|
128
|
+
return await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeVector).call(this, name, schema);
|
|
129
|
+
}
|
|
130
|
+
const definition = schema.definitions[name];
|
|
131
|
+
if (definition) {
|
|
132
|
+
return await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeType).call(this, name, definition, id, schema);
|
|
133
|
+
}
|
|
134
|
+
const deserializedEnum = await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeEnum).call(this, name, id, schema);
|
|
135
|
+
if (deserializedEnum !== undefined) {
|
|
136
|
+
return deserializedEnum;
|
|
137
|
+
}
|
|
138
|
+
throw new TLError(`Unknown type: ${name} ID ${id}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.TLReader = TLReader;
|
|
142
|
+
_TLReader_instances = new WeakSet(), _TLReader_deserializeEnum = async function _TLReader_deserializeEnum(type, id, schema) {
|
|
143
|
+
const name = schema.identifierToName[id];
|
|
144
|
+
if (!name) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const definition = schema.definitions[name];
|
|
148
|
+
if (definition[2] != type) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
return await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeType).call(this, name, definition, id, schema);
|
|
152
|
+
}, _TLReader_deserializeType = async function _TLReader_deserializeType(type, desc, id, schema) {
|
|
153
|
+
if (desc[0] != id) {
|
|
154
|
+
throw new TLError(`Expected constructor ${desc[0].toString(16)} but got ${id}`);
|
|
155
|
+
}
|
|
156
|
+
const type_ = { _: type };
|
|
157
|
+
const flagFields = {};
|
|
158
|
+
for (const [name, type] of desc[1]) {
|
|
159
|
+
if ((0, _0_utilities_js_1.isOptionalParam)(type)) {
|
|
160
|
+
const { flagField, bitIndex } = (0, _0_utilities_js_1.analyzeOptionalParam)(type);
|
|
161
|
+
const bits = flagFields[flagField];
|
|
162
|
+
if ((bits & (1 << bitIndex)) == 0) {
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (type == "#") {
|
|
167
|
+
flagFields[name] = this.readInt32();
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const value = await this.readType(type, schema);
|
|
171
|
+
if (typeof value !== "boolean" || value) {
|
|
172
|
+
type_[name] = value;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return type_;
|
|
176
|
+
}, _TLReader_deserializeVector = async function _TLReader_deserializeVector(type, schema) {
|
|
177
|
+
const itemType = (0, _0_utilities_js_1.getVectorItemType)(type);
|
|
178
|
+
if (!itemType) {
|
|
179
|
+
throw new TLError(`Expected Vector but received ${type}`);
|
|
180
|
+
}
|
|
181
|
+
const size = this.readInt32();
|
|
182
|
+
const array = new Array();
|
|
183
|
+
for (let i = 0; i < size; ++i) {
|
|
184
|
+
array.push(await this.readType(itemType, schema));
|
|
185
|
+
}
|
|
186
|
+
return array;
|
|
187
|
+
}, _TLReader_deserializePrimitive = function _TLReader_deserializePrimitive(type) {
|
|
188
|
+
switch (type) {
|
|
189
|
+
case "bytes":
|
|
190
|
+
return this.readBytes();
|
|
191
|
+
case "int128":
|
|
192
|
+
return this.readInt128();
|
|
193
|
+
case "int256":
|
|
194
|
+
return this.readInt256();
|
|
195
|
+
case "double":
|
|
196
|
+
return this.readDouble();
|
|
197
|
+
case "long":
|
|
198
|
+
return this.readInt64();
|
|
199
|
+
case "true":
|
|
200
|
+
return true;
|
|
201
|
+
case "int":
|
|
202
|
+
return this.readInt32();
|
|
203
|
+
case "Bool": {
|
|
204
|
+
const id = this.readInt32(false);
|
|
205
|
+
if (id == _0_utilities_js_1.BOOL_TRUE) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
else if (id == _0_utilities_js_1.BOOL_FALSE) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
throw new TLError(`Expected boolTrue or boolFalse but got ${id}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
case "string":
|
|
216
|
+
return this.readString();
|
|
217
|
+
}
|
|
218
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_tl_reader_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_reader_test.ts"],"names":[],"mappings":""}
|
|
@@ -17,7 +17,9 @@
|
|
|
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
|
-
|
|
20
|
+
import { Schema } from "./0_types.js";
|
|
21
|
+
export declare class TLWriter {
|
|
22
|
+
#private;
|
|
21
23
|
protected _buffer: Uint8Array;
|
|
22
24
|
constructor();
|
|
23
25
|
get buffer(): Uint8Array;
|
|
@@ -30,5 +32,6 @@ export declare class TLRawWriter {
|
|
|
30
32
|
writeInt256(int: bigint, signed?: boolean): typeof this;
|
|
31
33
|
writeBytes(bytes: Uint8Array): typeof this;
|
|
32
34
|
writeString(string: string): typeof this;
|
|
35
|
+
writeObject(value: any, schema: Schema): typeof this;
|
|
33
36
|
}
|
|
34
|
-
//# sourceMappingURL=
|
|
37
|
+
//# sourceMappingURL=1_tl_writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_tl_writer.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAMH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAGtC,qBAAa,QAAQ;;IACnB,SAAS,CAAC,OAAO,EAAE,UAAU,CAAoB;;IAKjD,IAAI,MAAM,IAAI,UAAU,CAEvB;IAED,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,IAAI;IAKtC,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,OAAO,IAAI;IAKnD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,OAAO,IAAI;IAKnD,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,OAAO,IAAI;IAKnD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,IAAI;IAOxC,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,OAAO,IAAI;IAKpD,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,OAAO,IAAI;IAKpD,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,IAAI;IAkB1C,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,IAAI;IAKxC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,IAAI;CAkLrD"}
|
|
@@ -18,6 +18,7 @@
|
|
|
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
|
+
// deno-lint-ignore-file no-explicit-any
|
|
21
22
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
22
23
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
23
24
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
@@ -26,43 +27,100 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
26
27
|
var _TLWriter_instances, _TLWriter_serialize, _TLWriter_serializeVector, _TLWriter_serializePrimitive, _TLWriter_isTypeValid;
|
|
27
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
29
|
exports.TLWriter = void 0;
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
class TLWriter extends _0_tl_raw_writer_js_1.TLRawWriter {
|
|
30
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
31
|
+
const _0_tl_error_js_1 = require("./0_tl_error.js");
|
|
32
|
+
const _0_utilities_js_1 = require("./0_utilities.js");
|
|
33
|
+
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
34
|
+
class TLWriter {
|
|
35
35
|
constructor() {
|
|
36
|
-
super(...arguments);
|
|
37
36
|
_TLWriter_instances.add(this);
|
|
37
|
+
Object.defineProperty(this, "_buffer", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true,
|
|
41
|
+
value: new Uint8Array()
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
get buffer() {
|
|
45
|
+
return this._buffer;
|
|
46
|
+
}
|
|
47
|
+
write(buffer) {
|
|
48
|
+
this._buffer = (0, _0_deps_js_1.concat)([this._buffer, buffer]);
|
|
49
|
+
return this;
|
|
50
|
+
}
|
|
51
|
+
writeInt24(int, signed = true) {
|
|
52
|
+
this.write((0, _0_buffer_js_1.bufferFromBigInt)(int, 24 / 8, true, signed));
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
writeInt32(int, signed = true) {
|
|
56
|
+
this.write((0, _0_buffer_js_1.bufferFromBigInt)(int, 32 / 8, true, signed));
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
writeInt64(int, signed = true) {
|
|
60
|
+
this.write((0, _0_buffer_js_1.bufferFromBigInt)(int, 64 / 8, true, signed));
|
|
61
|
+
return this;
|
|
62
|
+
}
|
|
63
|
+
writeDouble(double) {
|
|
64
|
+
const buffer = new Uint8Array(8);
|
|
65
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength).setFloat64(0, double, true);
|
|
66
|
+
this.write(buffer);
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
writeInt128(int, signed = true) {
|
|
70
|
+
this.write((0, _0_buffer_js_1.bufferFromBigInt)(int, 128 / 8, true, signed));
|
|
71
|
+
return this;
|
|
72
|
+
}
|
|
73
|
+
writeInt256(int, signed = true) {
|
|
74
|
+
this.write((0, _0_buffer_js_1.bufferFromBigInt)(int, 256 / 8, true, signed));
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
writeBytes(bytes) {
|
|
78
|
+
let padding;
|
|
79
|
+
if (bytes.length > 253) {
|
|
80
|
+
this.write(new Uint8Array([254]));
|
|
81
|
+
this.writeInt24(bytes.length);
|
|
82
|
+
padding = bytes.length % 4;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.write(new Uint8Array([bytes.length]));
|
|
86
|
+
padding = (bytes.length + 1) % 4;
|
|
87
|
+
}
|
|
88
|
+
this.write(bytes);
|
|
89
|
+
if (padding > 0) {
|
|
90
|
+
padding = 4 - padding;
|
|
91
|
+
this.write(new Uint8Array(padding));
|
|
92
|
+
}
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
writeString(string) {
|
|
96
|
+
this.writeBytes(new TextEncoder().encode(string));
|
|
97
|
+
return this;
|
|
38
98
|
}
|
|
39
|
-
|
|
40
|
-
(
|
|
41
|
-
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, value._, value, "");
|
|
99
|
+
writeObject(value, schema) {
|
|
100
|
+
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, value._, value, "", schema);
|
|
42
101
|
return this;
|
|
43
102
|
}
|
|
44
103
|
}
|
|
45
104
|
exports.TLWriter = TLWriter;
|
|
46
|
-
_TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_serialize(type, value, debugInfo) {
|
|
105
|
+
_TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_serialize(type, value, debugInfo, schema) {
|
|
47
106
|
if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializePrimitive).call(this, type, value, debugInfo)) {
|
|
48
107
|
return;
|
|
49
108
|
}
|
|
50
|
-
if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializeVector).call(this, type, value, debugInfo)) {
|
|
109
|
+
if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializeVector).call(this, type, value, debugInfo, schema)) {
|
|
51
110
|
return;
|
|
52
111
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
throw new _0_tl_raw_reader_js_1.TLError(`Unknown type: ${value._}`);
|
|
112
|
+
const maybeDefinition = schema.definitions[value._];
|
|
113
|
+
if (!maybeDefinition) {
|
|
114
|
+
throw new _0_tl_error_js_1.TLError(`Unknown type: ${value._}`);
|
|
57
115
|
}
|
|
58
|
-
if (type != "!X" && !__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_isTypeValid).call(this, type, value)) {
|
|
59
|
-
throw new
|
|
116
|
+
if (type != "!X" && !__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_isTypeValid).call(this, type, value, schema)) {
|
|
117
|
+
throw new _0_tl_error_js_1.TLError(`Expected ${type} but got ${value._}`);
|
|
60
118
|
}
|
|
61
119
|
const type__ = value;
|
|
62
|
-
const [id, parameters_] =
|
|
120
|
+
const [id, parameters_] = maybeDefinition;
|
|
63
121
|
this.writeInt32(id, false);
|
|
64
122
|
for (let [i, [name, type]] of parameters_.entries()) {
|
|
65
|
-
if ((0,
|
|
123
|
+
if ((0, _0_utilities_js_1.isOptionalParam)(type) && type__[name] === undefined) {
|
|
66
124
|
continue;
|
|
67
125
|
}
|
|
68
126
|
const debugInfo = ` [0x${id.toString(16).toUpperCase()}::${i}]`;
|
|
@@ -70,8 +128,8 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
70
128
|
let flags = 0;
|
|
71
129
|
const flagField_ = name;
|
|
72
130
|
for (const [name, type] of parameters_) {
|
|
73
|
-
if ((0,
|
|
74
|
-
const { flagField, bitIndex } = (0,
|
|
131
|
+
if ((0, _0_utilities_js_1.isOptionalParam)(type)) {
|
|
132
|
+
const { flagField, bitIndex } = (0, _0_utilities_js_1.analyzeOptionalParam)(type);
|
|
75
133
|
if (flagField == flagField_) {
|
|
76
134
|
if (type__[name] !== undefined) {
|
|
77
135
|
flags |= 1 << bitIndex;
|
|
@@ -82,38 +140,38 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
82
140
|
this.writeInt32(flags);
|
|
83
141
|
continue;
|
|
84
142
|
}
|
|
85
|
-
if (type__[name] === undefined && !(0,
|
|
143
|
+
if (type__[name] === undefined && !(0, _0_utilities_js_1.isOptionalParam)(type)) {
|
|
86
144
|
throw new Error(`Missing required parameter: ${name}`);
|
|
87
145
|
}
|
|
88
|
-
if ((0,
|
|
89
|
-
type = (0,
|
|
146
|
+
if ((0, _0_utilities_js_1.isOptionalParam)(type)) {
|
|
147
|
+
type = (0, _0_utilities_js_1.getOptionalParamInnerType)(type);
|
|
90
148
|
}
|
|
91
|
-
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, type, type__[name], debugInfo);
|
|
149
|
+
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, type, type__[name], debugInfo, schema);
|
|
92
150
|
}
|
|
93
151
|
return;
|
|
94
|
-
}, _TLWriter_serializeVector = function _TLWriter_serializeVector(type, value, debugInfo) {
|
|
95
|
-
const itemType = (0,
|
|
152
|
+
}, _TLWriter_serializeVector = function _TLWriter_serializeVector(type, value, debugInfo, schema) {
|
|
153
|
+
const itemType = (0, _0_utilities_js_1.getVectorItemType)(type);
|
|
96
154
|
if (!itemType) {
|
|
97
155
|
return false;
|
|
98
156
|
}
|
|
99
157
|
if (!Array.isArray(value)) {
|
|
100
|
-
throw new TypeError(`Expected array but received ${(0,
|
|
158
|
+
throw new TypeError(`Expected array but received ${(0, _0_utilities_js_1.repr)(value)}${debugInfo}`);
|
|
101
159
|
}
|
|
102
|
-
this.writeInt32(
|
|
160
|
+
this.writeInt32(_0_utilities_js_1.VECTOR, false);
|
|
103
161
|
this.writeInt32(value.length);
|
|
104
162
|
for (const item of value) {
|
|
105
|
-
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, itemType, item, debugInfo);
|
|
163
|
+
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, itemType, item, debugInfo, schema);
|
|
106
164
|
}
|
|
107
165
|
return true;
|
|
108
166
|
}, _TLWriter_serializePrimitive = function _TLWriter_serializePrimitive(type, value, debugInfo) {
|
|
109
|
-
const valueRepr = (0,
|
|
167
|
+
const valueRepr = (0, _0_utilities_js_1.repr)(value);
|
|
110
168
|
switch (type) {
|
|
111
169
|
case "bytes":
|
|
112
170
|
if ((value instanceof Uint8Array)) {
|
|
113
171
|
this.writeBytes(value);
|
|
114
172
|
}
|
|
115
173
|
else {
|
|
116
|
-
throw new
|
|
174
|
+
throw new _0_tl_error_js_1.TLError(`Expected Uint8Array but received ${valueRepr}${debugInfo}`);
|
|
117
175
|
}
|
|
118
176
|
return true;
|
|
119
177
|
case "int128":
|
|
@@ -121,7 +179,7 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
121
179
|
this.writeInt128(value);
|
|
122
180
|
}
|
|
123
181
|
else {
|
|
124
|
-
throw new
|
|
182
|
+
throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
125
183
|
}
|
|
126
184
|
return true;
|
|
127
185
|
case "int256":
|
|
@@ -129,7 +187,7 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
129
187
|
this.writeInt256(value);
|
|
130
188
|
}
|
|
131
189
|
else {
|
|
132
|
-
throw new
|
|
190
|
+
throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
133
191
|
}
|
|
134
192
|
return true;
|
|
135
193
|
case "long":
|
|
@@ -137,20 +195,20 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
137
195
|
this.writeInt64(value);
|
|
138
196
|
}
|
|
139
197
|
else {
|
|
140
|
-
throw new
|
|
198
|
+
throw new _0_tl_error_js_1.TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
141
199
|
}
|
|
142
200
|
return true;
|
|
143
201
|
case "Bool":
|
|
144
202
|
if (typeof value === "boolean") {
|
|
145
203
|
if (value) {
|
|
146
|
-
this.writeInt32(
|
|
204
|
+
this.writeInt32(_0_utilities_js_1.BOOL_TRUE);
|
|
147
205
|
}
|
|
148
206
|
else {
|
|
149
|
-
this.writeInt32(
|
|
207
|
+
this.writeInt32(_0_utilities_js_1.BOOL_FALSE);
|
|
150
208
|
}
|
|
151
209
|
}
|
|
152
210
|
else {
|
|
153
|
-
throw new
|
|
211
|
+
throw new _0_tl_error_js_1.TLError(`Expected boolean but received ${valueRepr}${debugInfo}`);
|
|
154
212
|
}
|
|
155
213
|
return true;
|
|
156
214
|
case "int":
|
|
@@ -163,7 +221,7 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
163
221
|
this.writeInt32(value);
|
|
164
222
|
}
|
|
165
223
|
else {
|
|
166
|
-
throw new
|
|
224
|
+
throw new _0_tl_error_js_1.TLError(`Expected number but received ${valueRepr}${debugInfo}`);
|
|
167
225
|
}
|
|
168
226
|
return true;
|
|
169
227
|
case "double":
|
|
@@ -176,7 +234,7 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
176
234
|
this.writeDouble(value);
|
|
177
235
|
}
|
|
178
236
|
else {
|
|
179
|
-
throw new
|
|
237
|
+
throw new _0_tl_error_js_1.TLError(`Expected number but received ${valueRepr}${debugInfo}`);
|
|
180
238
|
}
|
|
181
239
|
return true;
|
|
182
240
|
case "string":
|
|
@@ -195,16 +253,15 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
195
253
|
return true;
|
|
196
254
|
case "true":
|
|
197
255
|
if (value !== true) {
|
|
198
|
-
throw new
|
|
256
|
+
throw new _0_tl_error_js_1.TLError(`Expected true but received ${valueRepr}${debugInfo}`);
|
|
199
257
|
}
|
|
200
258
|
return true;
|
|
201
259
|
default:
|
|
202
260
|
return false;
|
|
203
261
|
}
|
|
204
|
-
}, _TLWriter_isTypeValid = function _TLWriter_isTypeValid(type, value) {
|
|
262
|
+
}, _TLWriter_isTypeValid = function _TLWriter_isTypeValid(type, value, schema) {
|
|
205
263
|
if (type == value._) {
|
|
206
264
|
return true;
|
|
207
265
|
}
|
|
208
|
-
|
|
209
|
-
return enum_?.includes(value._) || false;
|
|
266
|
+
return schema.definitions[value._]?.[2] === type;
|
|
210
267
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_tl_writer_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer_test.ts"],"names":[],"mappings":""}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* This program is free software: you can redistribute it and/or modify
|
|
8
8
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
9
|
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version
|
|
10
|
+
* (at your option) any later version.
|
|
11
11
|
*
|
|
12
12
|
* This program is distributed in the hope that it will be useful,
|
|
13
13
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
@@ -17,27 +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
|
-
import {
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
23
|
-
export declare function
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function assertIsValidType(object: any): void;
|
|
29
|
-
export declare function is<S extends keyof (Types & Functions)>(typeName: S, value: unknown): value is S extends keyof Types ? Types[S] : S extends keyof Functions ? Functions[S] : never;
|
|
30
|
-
export declare function isOneOf<S extends keyof (Types & Functions)>(typeNames: S[] | readonly S[], value: unknown): value is S extends keyof Types ? Types[S] : S extends keyof Functions ? Functions[S] : never;
|
|
31
|
-
export declare function isOfEnum<S extends keyof Enums>(enumName: S, value: unknown): value is Enums[S];
|
|
32
|
-
export declare function as<S extends keyof Types>(typeName: S, value: unknown): Types[S];
|
|
33
|
-
export declare function isGenericFunction(value: unknown): boolean;
|
|
34
|
-
export declare function mustGetReturnType(name: string): string;
|
|
35
|
-
export declare function repr(value: unknown): string | null;
|
|
36
|
-
export declare function getVectorItemType(type: string): string | null;
|
|
37
|
-
export declare const X = "X";
|
|
38
|
-
export declare const VECTOR = 481674261;
|
|
39
|
-
export declare const BOOL_TRUE = 2574415285;
|
|
40
|
-
export declare const BOOL_FALSE = 3162085175;
|
|
41
|
-
export declare const GZIP_PACKED = 812830625;
|
|
42
|
-
export declare const RPC_RESULT = 4082920705;
|
|
20
|
+
import { Schema } from "./0_types.js";
|
|
21
|
+
export declare function isValidObject(object: any, schema: Schema): boolean;
|
|
22
|
+
export declare function assertIsValidObject(object: any, schema: Schema): void;
|
|
23
|
+
export declare function is(typeName: string, value: any, schema: Schema): boolean;
|
|
24
|
+
export declare function isOneOf(names: string[], value: unknown, schema: Schema): boolean;
|
|
25
|
+
export declare function isOfEnum(name: string, value: any, schema: Schema): boolean;
|
|
26
|
+
export declare function as(name: string, value: unknown, schema: Schema): unknown;
|
|
27
|
+
export declare function mustGetReturnType(name: string, schema: Schema): string;
|
|
43
28
|
//# sourceMappingURL=1_utilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/1_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"1_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/1_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,wBAAgB,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,WAExD;AACD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,QAI9D;AAED,wBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,WAM9D;AACD,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAEtE;AACD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,WAEhE;AACD,wBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAM9D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMtE"}
|