@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"}
|
|
@@ -24,59 +24,127 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
24
24
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
25
25
|
};
|
|
26
26
|
var _TLReader_instances, _TLReader_deserializeEnum, _TLReader_deserializeType, _TLReader_deserializeVector, _TLReader_deserializePrimitive;
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
constructor() {
|
|
34
|
-
super(...arguments);
|
|
27
|
+
import { bigIntFromBuffer } from "../1_utilities.js";
|
|
28
|
+
import { analyzeOptionalParam, BOOL_FALSE, BOOL_TRUE, getOptionalParamInnerType, getVectorItemType, isOptionalParam, VECTOR, X } from "./0_utilities.js";
|
|
29
|
+
export class TLError extends Error {
|
|
30
|
+
}
|
|
31
|
+
export class TLReader {
|
|
32
|
+
constructor(_buffer) {
|
|
35
33
|
_TLReader_instances.add(this);
|
|
34
|
+
Object.defineProperty(this, "_buffer", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: _buffer
|
|
39
|
+
});
|
|
36
40
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
get buffer() {
|
|
42
|
+
return this._buffer;
|
|
43
|
+
}
|
|
44
|
+
read(count) {
|
|
45
|
+
if (this._buffer.length < count) {
|
|
46
|
+
throw new TLError("No data remaining");
|
|
47
|
+
}
|
|
48
|
+
const buffer = this._buffer.slice(0, count);
|
|
49
|
+
this._buffer = this._buffer.subarray(count);
|
|
50
|
+
return buffer;
|
|
51
|
+
}
|
|
52
|
+
unread(count) {
|
|
53
|
+
const newOffest = this._buffer.byteOffset - count;
|
|
54
|
+
if (newOffest < 0) {
|
|
55
|
+
throw new TLError("No data has been read");
|
|
56
|
+
}
|
|
57
|
+
this._buffer = new Uint8Array(this._buffer.buffer, newOffest);
|
|
58
|
+
}
|
|
59
|
+
readInt24(signed = true) {
|
|
60
|
+
const buffer = this.read(24 / 8);
|
|
61
|
+
return Number(bigIntFromBuffer(buffer, true, signed));
|
|
62
|
+
}
|
|
63
|
+
readInt32(signed = true) {
|
|
64
|
+
const buffer = this.read(32 / 8);
|
|
65
|
+
return Number(bigIntFromBuffer(buffer, true, signed));
|
|
66
|
+
}
|
|
67
|
+
unreadInt32() {
|
|
68
|
+
this.unread(32 / 8);
|
|
69
|
+
}
|
|
70
|
+
readInt64(signed = true) {
|
|
71
|
+
const buffer = this.read(64 / 8);
|
|
72
|
+
return bigIntFromBuffer(buffer, true, signed);
|
|
73
|
+
}
|
|
74
|
+
readDouble() {
|
|
75
|
+
const buffer = this.read(8);
|
|
76
|
+
return new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength).getFloat64(0, true);
|
|
77
|
+
}
|
|
78
|
+
readInt128(signed = true) {
|
|
79
|
+
const buffer = this.read(128 / 8);
|
|
80
|
+
return bigIntFromBuffer(buffer, true, signed);
|
|
81
|
+
}
|
|
82
|
+
readInt256(signed = true) {
|
|
83
|
+
const buffer = this.read(256 / 8);
|
|
84
|
+
return bigIntFromBuffer(buffer, true, signed);
|
|
85
|
+
}
|
|
86
|
+
readBytes() {
|
|
87
|
+
let L = this.read(1)[0];
|
|
88
|
+
let padding;
|
|
89
|
+
if (L > 253) {
|
|
90
|
+
L = this.readInt24();
|
|
91
|
+
padding = L % 4;
|
|
40
92
|
}
|
|
41
|
-
|
|
93
|
+
else {
|
|
94
|
+
padding = (L + 1) % 4;
|
|
95
|
+
}
|
|
96
|
+
const bytes = this.read(L);
|
|
97
|
+
if (padding > 0) {
|
|
98
|
+
padding = 4 - padding;
|
|
99
|
+
this.read(padding);
|
|
100
|
+
}
|
|
101
|
+
return bytes;
|
|
102
|
+
}
|
|
103
|
+
readString() {
|
|
104
|
+
return new TextDecoder().decode(this.readBytes());
|
|
105
|
+
}
|
|
106
|
+
async readType(name, schema) {
|
|
107
|
+
if (isOptionalParam(name)) {
|
|
108
|
+
name = getOptionalParamInnerType(name);
|
|
109
|
+
}
|
|
110
|
+
const primitive = __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializePrimitive).call(this, name);
|
|
42
111
|
if (primitive !== undefined) {
|
|
43
112
|
return primitive;
|
|
44
113
|
}
|
|
45
114
|
const id = this.readInt32(false);
|
|
46
|
-
if (
|
|
47
|
-
const
|
|
48
|
-
return await new TLReader(buffer).deserialize(type);
|
|
49
|
-
}
|
|
50
|
-
if (type == X) {
|
|
51
|
-
const typeName = getTypeName(id);
|
|
115
|
+
if (name == X) {
|
|
116
|
+
const typeName = schema.identifierToName[id];
|
|
52
117
|
if (!typeName) {
|
|
53
118
|
throw new TLError(`Unknown constructor: ${id.toString(16)}`);
|
|
54
119
|
}
|
|
55
120
|
this.unreadInt32();
|
|
56
|
-
return await this.
|
|
121
|
+
return await this.readType(typeName, schema);
|
|
57
122
|
}
|
|
58
123
|
if (id == VECTOR) {
|
|
59
|
-
return await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeVector).call(this,
|
|
124
|
+
return await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeVector).call(this, name, schema);
|
|
60
125
|
}
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
63
|
-
return await __classPrivateFieldGet(this, _TLReader_instances, "m",
|
|
126
|
+
const definition = schema.definitions[name];
|
|
127
|
+
if (definition) {
|
|
128
|
+
return await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeType).call(this, name, definition, id, schema);
|
|
64
129
|
}
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
return
|
|
130
|
+
const deserializedEnum = await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeEnum).call(this, name, id, schema);
|
|
131
|
+
if (deserializedEnum !== undefined) {
|
|
132
|
+
return deserializedEnum;
|
|
68
133
|
}
|
|
69
|
-
|
|
134
|
+
throw new TLError(`Unknown type: ${name} ID ${id}`);
|
|
70
135
|
}
|
|
71
136
|
}
|
|
72
|
-
_TLReader_instances = new WeakSet(), _TLReader_deserializeEnum = async function _TLReader_deserializeEnum(
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
137
|
+
_TLReader_instances = new WeakSet(), _TLReader_deserializeEnum = async function _TLReader_deserializeEnum(type, id, schema) {
|
|
138
|
+
const name = schema.identifierToName[id];
|
|
139
|
+
if (!name) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const definition = schema.definitions[name];
|
|
143
|
+
if (definition[2] != type) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
return await __classPrivateFieldGet(this, _TLReader_instances, "m", _TLReader_deserializeType).call(this, name, definition, id, schema);
|
|
147
|
+
}, _TLReader_deserializeType = async function _TLReader_deserializeType(type, desc, id, schema) {
|
|
80
148
|
if (desc[0] != id) {
|
|
81
149
|
throw new TLError(`Expected constructor ${desc[0].toString(16)} but got ${id}`);
|
|
82
150
|
}
|
|
@@ -94,13 +162,13 @@ _TLReader_instances = new WeakSet(), _TLReader_deserializeEnum = async function
|
|
|
94
162
|
flagFields[name] = this.readInt32();
|
|
95
163
|
continue;
|
|
96
164
|
}
|
|
97
|
-
const value = await this.
|
|
165
|
+
const value = await this.readType(type, schema);
|
|
98
166
|
if (typeof value !== "boolean" || value) {
|
|
99
167
|
type_[name] = value;
|
|
100
168
|
}
|
|
101
169
|
}
|
|
102
170
|
return type_;
|
|
103
|
-
}, _TLReader_deserializeVector = async function _TLReader_deserializeVector(type) {
|
|
171
|
+
}, _TLReader_deserializeVector = async function _TLReader_deserializeVector(type, schema) {
|
|
104
172
|
const itemType = getVectorItemType(type);
|
|
105
173
|
if (!itemType) {
|
|
106
174
|
throw new TLError(`Expected Vector but received ${type}`);
|
|
@@ -108,7 +176,7 @@ _TLReader_instances = new WeakSet(), _TLReader_deserializeEnum = async function
|
|
|
108
176
|
const size = this.readInt32();
|
|
109
177
|
const array = new Array();
|
|
110
178
|
for (let i = 0; i < size; ++i) {
|
|
111
|
-
array.push(await this.
|
|
179
|
+
array.push(await this.readType(itemType, schema));
|
|
112
180
|
}
|
|
113
181
|
return array;
|
|
114
182
|
}, _TLReader_deserializePrimitive = function _TLReader_deserializePrimitive(type) {
|
|
@@ -136,9 +204,8 @@ _TLReader_instances = new WeakSet(), _TLReader_deserializeEnum = async function
|
|
|
136
204
|
return false;
|
|
137
205
|
}
|
|
138
206
|
else {
|
|
139
|
-
|
|
207
|
+
throw new TLError(`Expected boolTrue or boolFalse but got ${id}`);
|
|
140
208
|
}
|
|
141
|
-
break;
|
|
142
209
|
}
|
|
143
210
|
case "string":
|
|
144
211
|
return this.readString();
|
|
@@ -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"}
|
|
@@ -17,45 +17,103 @@
|
|
|
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
|
+
// deno-lint-ignore-file no-explicit-any
|
|
20
21
|
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
21
22
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
22
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");
|
|
23
24
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
24
25
|
};
|
|
25
26
|
var _TLWriter_instances, _TLWriter_serialize, _TLWriter_serializeVector, _TLWriter_serializePrimitive, _TLWriter_isTypeValid;
|
|
26
|
-
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
|
|
31
|
-
export class TLWriter extends TLRawWriter {
|
|
27
|
+
import { concat } from "../0_deps.js";
|
|
28
|
+
import { TLError } from "./0_tl_error.js";
|
|
29
|
+
import { analyzeOptionalParam, BOOL_FALSE, BOOL_TRUE, getOptionalParamInnerType, getVectorItemType, isOptionalParam, repr, VECTOR } from "./0_utilities.js";
|
|
30
|
+
import { bufferFromBigInt } from "../utilities/0_buffer.js";
|
|
31
|
+
export class TLWriter {
|
|
32
32
|
constructor() {
|
|
33
|
-
super(...arguments);
|
|
34
33
|
_TLWriter_instances.add(this);
|
|
34
|
+
Object.defineProperty(this, "_buffer", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true,
|
|
38
|
+
value: new Uint8Array()
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
get buffer() {
|
|
42
|
+
return this._buffer;
|
|
43
|
+
}
|
|
44
|
+
write(buffer) {
|
|
45
|
+
this._buffer = concat([this._buffer, buffer]);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
writeInt24(int, signed = true) {
|
|
49
|
+
this.write(bufferFromBigInt(int, 24 / 8, true, signed));
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
writeInt32(int, signed = true) {
|
|
53
|
+
this.write(bufferFromBigInt(int, 32 / 8, true, signed));
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
writeInt64(int, signed = true) {
|
|
57
|
+
this.write(bufferFromBigInt(int, 64 / 8, true, signed));
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
writeDouble(double) {
|
|
61
|
+
const buffer = new Uint8Array(8);
|
|
62
|
+
new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength).setFloat64(0, double, true);
|
|
63
|
+
this.write(buffer);
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
writeInt128(int, signed = true) {
|
|
67
|
+
this.write(bufferFromBigInt(int, 128 / 8, true, signed));
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
writeInt256(int, signed = true) {
|
|
71
|
+
this.write(bufferFromBigInt(int, 256 / 8, true, signed));
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
writeBytes(bytes) {
|
|
75
|
+
let padding;
|
|
76
|
+
if (bytes.length > 253) {
|
|
77
|
+
this.write(new Uint8Array([254]));
|
|
78
|
+
this.writeInt24(bytes.length);
|
|
79
|
+
padding = bytes.length % 4;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
this.write(new Uint8Array([bytes.length]));
|
|
83
|
+
padding = (bytes.length + 1) % 4;
|
|
84
|
+
}
|
|
85
|
+
this.write(bytes);
|
|
86
|
+
if (padding > 0) {
|
|
87
|
+
padding = 4 - padding;
|
|
88
|
+
this.write(new Uint8Array(padding));
|
|
89
|
+
}
|
|
90
|
+
return this;
|
|
91
|
+
}
|
|
92
|
+
writeString(string) {
|
|
93
|
+
this.writeBytes(new TextEncoder().encode(string));
|
|
94
|
+
return this;
|
|
35
95
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, value._, value, "");
|
|
96
|
+
writeObject(value, schema) {
|
|
97
|
+
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, value._, value, "", schema);
|
|
39
98
|
return this;
|
|
40
99
|
}
|
|
41
100
|
}
|
|
42
|
-
_TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_serialize(type, value, debugInfo) {
|
|
101
|
+
_TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_serialize(type, value, debugInfo, schema) {
|
|
43
102
|
if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializePrimitive).call(this, type, value, debugInfo)) {
|
|
44
103
|
return;
|
|
45
104
|
}
|
|
46
|
-
if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializeVector).call(this, type, value, debugInfo)) {
|
|
105
|
+
if (__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serializeVector).call(this, type, value, debugInfo, schema)) {
|
|
47
106
|
return;
|
|
48
107
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (!maybeParameters) {
|
|
108
|
+
const maybeDefinition = schema.definitions[value._];
|
|
109
|
+
if (!maybeDefinition) {
|
|
52
110
|
throw new TLError(`Unknown type: ${value._}`);
|
|
53
111
|
}
|
|
54
|
-
if (type != "!X" && !__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_isTypeValid).call(this, type, value)) {
|
|
112
|
+
if (type != "!X" && !__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_isTypeValid).call(this, type, value, schema)) {
|
|
55
113
|
throw new TLError(`Expected ${type} but got ${value._}`);
|
|
56
114
|
}
|
|
57
115
|
const type__ = value;
|
|
58
|
-
const [id, parameters_] =
|
|
116
|
+
const [id, parameters_] = maybeDefinition;
|
|
59
117
|
this.writeInt32(id, false);
|
|
60
118
|
for (let [i, [name, type]] of parameters_.entries()) {
|
|
61
119
|
if (isOptionalParam(type) && type__[name] === undefined) {
|
|
@@ -84,10 +142,10 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
84
142
|
if (isOptionalParam(type)) {
|
|
85
143
|
type = getOptionalParamInnerType(type);
|
|
86
144
|
}
|
|
87
|
-
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, type, type__[name], debugInfo);
|
|
145
|
+
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, type, type__[name], debugInfo, schema);
|
|
88
146
|
}
|
|
89
147
|
return;
|
|
90
|
-
}, _TLWriter_serializeVector = function _TLWriter_serializeVector(type, value, debugInfo) {
|
|
148
|
+
}, _TLWriter_serializeVector = function _TLWriter_serializeVector(type, value, debugInfo, schema) {
|
|
91
149
|
const itemType = getVectorItemType(type);
|
|
92
150
|
if (!itemType) {
|
|
93
151
|
return false;
|
|
@@ -98,7 +156,7 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
98
156
|
this.writeInt32(VECTOR, false);
|
|
99
157
|
this.writeInt32(value.length);
|
|
100
158
|
for (const item of value) {
|
|
101
|
-
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, itemType, item, debugInfo);
|
|
159
|
+
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, itemType, item, debugInfo, schema);
|
|
102
160
|
}
|
|
103
161
|
return true;
|
|
104
162
|
}, _TLWriter_serializePrimitive = function _TLWriter_serializePrimitive(type, value, debugInfo) {
|
|
@@ -197,10 +255,9 @@ _TLWriter_instances = new WeakSet(), _TLWriter_serialize = function _TLWriter_se
|
|
|
197
255
|
default:
|
|
198
256
|
return false;
|
|
199
257
|
}
|
|
200
|
-
}, _TLWriter_isTypeValid = function _TLWriter_isTypeValid(type, value) {
|
|
258
|
+
}, _TLWriter_isTypeValid = function _TLWriter_isTypeValid(type, value, schema) {
|
|
201
259
|
if (type == value._) {
|
|
202
260
|
return true;
|
|
203
261
|
}
|
|
204
|
-
|
|
205
|
-
return enum_?.includes(value._) || false;
|
|
262
|
+
return schema.definitions[value._]?.[2] === type;
|
|
206
263
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"1_tl_writer_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer_test.ts"],"names":[],"mappings":""}
|
package/esm/tl/1_utilities.d.ts
CHANGED
|
@@ -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"}
|
package/esm/tl/1_utilities.js
CHANGED
|
@@ -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
|
|
@@ -18,87 +18,41 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
// deno-lint-ignore-file no-explicit-any
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return ntype.includes("?");
|
|
21
|
+
import { unreachable } from "../0_deps.js";
|
|
22
|
+
export function isValidObject(object, schema) {
|
|
23
|
+
return object != null && typeof object === "object" && typeof object._ === "string" && schema.definitions[object._] !== undefined;
|
|
25
24
|
}
|
|
26
|
-
export function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export function analyzeOptionalParam(ntype) {
|
|
30
|
-
if (!isOptionalParam(ntype)) {
|
|
31
|
-
throw new Error("Parameter not optional");
|
|
32
|
-
}
|
|
33
|
-
const flagField = ntype.split(".")[0];
|
|
34
|
-
assertEquals(typeof flagField, "string");
|
|
35
|
-
const bitIndex = Number(ntype.split("?")[0].split(".")[1]);
|
|
36
|
-
assertFalse(isNaN(bitIndex));
|
|
37
|
-
return { flagField, bitIndex };
|
|
38
|
-
}
|
|
39
|
-
export function isValidType(object) {
|
|
40
|
-
return object != null && typeof object === "object" && typeof object._ === "string" && getType(object._) !== undefined;
|
|
41
|
-
}
|
|
42
|
-
export function assertIsValidType(object) {
|
|
43
|
-
if (!isValidType(object)) {
|
|
44
|
-
throw new Error("Invalid object");
|
|
25
|
+
export function assertIsValidObject(object, schema) {
|
|
26
|
+
if (!isValidObject(object, schema)) {
|
|
27
|
+
unreachable();
|
|
45
28
|
}
|
|
46
29
|
}
|
|
47
|
-
export function is(typeName, value) {
|
|
48
|
-
if (!
|
|
30
|
+
export function is(typeName, value, schema) {
|
|
31
|
+
if (!isValidObject(value, schema)) {
|
|
49
32
|
return false;
|
|
50
33
|
}
|
|
51
34
|
else {
|
|
52
35
|
return value._ === typeName;
|
|
53
36
|
}
|
|
54
37
|
}
|
|
55
|
-
export function isOneOf(
|
|
56
|
-
return
|
|
38
|
+
export function isOneOf(names, value, schema) {
|
|
39
|
+
return names.some((v) => is(v, value, schema));
|
|
57
40
|
}
|
|
58
|
-
export function isOfEnum(
|
|
59
|
-
return
|
|
41
|
+
export function isOfEnum(name, value, schema) {
|
|
42
|
+
return isValidObject(value, schema) && schema.definitions[value._][2] == name;
|
|
60
43
|
}
|
|
61
|
-
export function as(
|
|
62
|
-
if (is(
|
|
44
|
+
export function as(name, value, schema) {
|
|
45
|
+
if (is(name, value, schema)) {
|
|
63
46
|
return value;
|
|
64
47
|
}
|
|
65
48
|
else {
|
|
66
49
|
unreachable();
|
|
67
50
|
}
|
|
68
51
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"initConnection",
|
|
73
|
-
"invokeWithLayer",
|
|
74
|
-
"invokeWithoutUpdates",
|
|
75
|
-
"invokeWithMessagesRange",
|
|
76
|
-
"invokeWithTakeout",
|
|
77
|
-
];
|
|
78
|
-
export function isGenericFunction(value) {
|
|
79
|
-
return isOneOf(GENERIC_FUNCTIONS, value);
|
|
80
|
-
}
|
|
81
|
-
export function mustGetReturnType(name) {
|
|
82
|
-
const type = getType(name);
|
|
83
|
-
if (!type || type.length < 3 || !type[2]) {
|
|
52
|
+
export function mustGetReturnType(name, schema) {
|
|
53
|
+
const type = schema.definitions[name];
|
|
54
|
+
if (!type || !type[2]) {
|
|
84
55
|
unreachable();
|
|
85
56
|
}
|
|
86
57
|
return type[2];
|
|
87
58
|
}
|
|
88
|
-
export function repr(value) {
|
|
89
|
-
return value == null ? null : (typeof value === "object" && "_" in value) ? value._ : value.constructor.name;
|
|
90
|
-
}
|
|
91
|
-
export function getVectorItemType(type) {
|
|
92
|
-
if (!type.startsWith(VECTOR_PREFIX) || !type.endsWith(VECTOR_SUFFIX)) {
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
return type.slice(VECTOR_PREFIX.length).slice(0, -1 * VECTOR_SUFFIX.length);
|
|
96
|
-
}
|
|
97
|
-
const VECTOR_PREFIX = "Vector<";
|
|
98
|
-
const VECTOR_SUFFIX = ">";
|
|
99
|
-
export const X = "X";
|
|
100
|
-
export const VECTOR = 0x1CB5C415;
|
|
101
|
-
export const BOOL_TRUE = 0x997275b5;
|
|
102
|
-
export const BOOL_FALSE = 0xbc799737;
|
|
103
|
-
export const GZIP_PACKED = 0x3072CFA1;
|
|
104
|
-
export const RPC_RESULT = 0xF35C6D01;
|
package/esm/tl/2_message.d.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
import {
|
|
20
|
+
import { TLReader } from "./1_tl_reader.js";
|
|
21
21
|
export interface message {
|
|
22
22
|
_: "message";
|
|
23
23
|
msg_id: bigint;
|
|
@@ -25,7 +25,7 @@ export interface message {
|
|
|
25
25
|
body: Uint8Array | msg_container;
|
|
26
26
|
}
|
|
27
27
|
export declare function serializeMessage(message: message): Promise<Uint8Array>;
|
|
28
|
-
export declare function deserializeMessage(reader:
|
|
28
|
+
export declare function deserializeMessage(reader: TLReader): Promise<message>;
|
|
29
29
|
export interface msg_container {
|
|
30
30
|
_: "msg_container";
|
|
31
31
|
messages: message[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_message.d.ts","sourceRoot":"","sources":["../../src/tl/2_message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"2_message.d.ts","sourceRoot":"","sources":["../../src/tl/2_message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAK5C,MAAM,WAAW,OAAO;IACtB,CAAC,EAAE,SAAS,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,UAAU,GAAG,aAAa,CAAC;CAClC;AAED,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAa5E;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,CAgB3E;AAID,MAAM,WAAW,aAAa;IAC5B,CAAC,EAAE,eAAe,CAAC;IACnB,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,yBAAyB,aAAa,CAAC;AAEpD,wBAAsB,qBAAqB,CAAC,YAAY,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC,CAQ5F;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAQxF"}
|