@mtkruto/node 0.1.800 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_deps.d.ts +2 -0
- package/esm/0_deps.d.ts.map +1 -1
- package/esm/0_deps.js +2 -1
- package/esm/2_tl.d.ts +7 -8
- package/esm/2_tl.d.ts.map +1 -1
- package/esm/2_tl.js +7 -8
- package/esm/3_errors.d.ts +519 -515
- package/esm/3_errors.d.ts.map +1 -1
- package/esm/3_errors.js +527 -512
- package/esm/3_transport.d.ts +1 -0
- package/esm/3_transport.d.ts.map +1 -1
- package/esm/3_transport.js +1 -0
- package/esm/4_errors.d.ts +7 -7
- package/esm/4_errors.d.ts.map +1 -1
- package/esm/4_errors.js +5 -5
- package/esm/client/0_client_abstract.d.ts +1 -21
- package/esm/client/0_client_abstract.d.ts.map +1 -1
- package/esm/client/0_client_abstract.js +17 -15
- package/esm/client/0_message.d.ts +3 -3
- package/esm/client/0_message.d.ts.map +1 -1
- package/esm/client/0_message.js +4 -20
- package/esm/client/0_params.d.ts +1 -1
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts +2 -2
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password.js +3 -8
- package/esm/client/0_storage_operations.d.ts +23 -23
- package/esm/client/0_storage_operations.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +13 -12
- package/esm/client/0_utilities.d.ts.map +1 -1
- package/esm/client/0_utilities.js +13 -10
- package/esm/client/1_client_encrypted.d.ts +3 -5
- package/esm/client/1_client_encrypted.d.ts.map +1 -1
- package/esm/client/1_client_encrypted.js +44 -28
- package/esm/client/1_client_plain.d.ts +2 -2
- package/esm/client/1_client_plain.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +27 -19
- package/esm/client/1_types.d.ts +9 -22
- package/esm/client/1_types.d.ts.map +1 -1
- package/esm/client/2_account_manager.d.ts +2 -2
- package/esm/client/2_account_manager.js +16 -16
- package/esm/client/2_bot_info_manager.d.ts.map +1 -1
- package/esm/client/2_bot_info_manager.js +7 -6
- package/esm/client/2_business_connection_manager.d.ts +3 -3
- package/esm/client/2_business_connection_manager.d.ts.map +1 -1
- package/esm/client/2_business_connection_manager.js +6 -5
- package/esm/client/2_file_manager.d.ts +4 -4
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +26 -23
- package/esm/client/2_reaction_manager.d.ts +3 -3
- package/esm/client/2_reaction_manager.d.ts.map +1 -1
- package/esm/client/2_reaction_manager.js +16 -10
- package/esm/client/2_update_manager.d.ts +11 -11
- package/esm/client/2_update_manager.d.ts.map +1 -1
- package/esm/client/2_update_manager.js +185 -164
- package/esm/client/3_message_manager.d.ts +8 -9
- package/esm/client/3_message_manager.d.ts.map +1 -1
- package/esm/client/3_message_manager.js +205 -474
- package/esm/client/3_video_chat_manager.d.ts +3 -3
- package/esm/client/3_video_chat_manager.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.js +26 -36
- package/esm/client/4_callback_query_manager.d.ts +3 -3
- package/esm/client/4_callback_query_manager.d.ts.map +1 -1
- package/esm/client/4_callback_query_manager.js +5 -16
- package/esm/client/4_chat_list_manager.d.ts +5 -4
- package/esm/client/4_chat_list_manager.d.ts.map +1 -1
- package/esm/client/4_chat_list_manager.js +56 -34
- package/esm/client/4_inline_query_manager.d.ts +3 -3
- package/esm/client/4_inline_query_manager.d.ts.map +1 -1
- package/esm/client/4_inline_query_manager.js +6 -15
- package/esm/client/4_story_manager.d.ts +3 -3
- package/esm/client/4_story_manager.d.ts.map +1 -1
- package/esm/client/4_story_manager.js +15 -32
- package/esm/client/5_client.d.ts +10 -12
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +60 -114
- package/esm/{tl/7_message.d.ts → connection/1_connection_tcp.d.ts} +14 -12
- package/esm/connection/1_connection_tcp.d.ts.map +1 -0
- package/esm/connection/1_connection_tcp.js +169 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/_constants.js +4 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/iterate_reader.js +86 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/types.js +3 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
- package/esm/deps/deno.land/std@0.224.0/io/write_all.js +49 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +253 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +13 -0
- package/esm/mod.d.ts +0 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +0 -1
- package/esm/tl/0_api.d.ts +14813 -0
- package/esm/tl/0_api.d.ts.map +1 -0
- package/esm/tl/0_api.js +23222 -0
- package/esm/tl/1_utilities.d.ts +32 -0
- package/esm/tl/1_utilities.d.ts.map +1 -0
- package/esm/tl/1_utilities.js +65 -0
- package/esm/tl/1_utilities_test.d.ts.map +1 -0
- package/esm/tl/2_deserialize.d.ts +23 -0
- package/esm/tl/2_deserialize.d.ts.map +1 -0
- package/esm/tl/{3_deserialize.js → 2_deserialize.js} +16 -17
- package/esm/tl/2_serialize.d.ts +22 -0
- package/esm/tl/2_serialize.d.ts.map +1 -0
- package/esm/tl/2_serialize.js +160 -0
- package/esm/tl/2_serialize_test.d.ts.map +1 -0
- package/esm/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
- package/esm/tl/3_tl_reader.d.ts.map +1 -0
- package/esm/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
- package/esm/tl/3_utilities.d.ts +5 -5
- package/esm/tl/3_utilities.d.ts.map +1 -1
- package/esm/tl/3_utilities.js +9 -10
- package/esm/tl/4_rpc_result.d.ts +27 -0
- package/esm/tl/4_rpc_result.d.ts.map +1 -0
- package/esm/tl/4_rpc_result.js +28 -0
- package/{script/tl/5_tl_writer.d.ts → esm/tl/4_tl_writer.d.ts} +2 -2
- package/esm/tl/4_tl_writer.d.ts.map +1 -0
- package/esm/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
- package/esm/tl/5_message.d.ts +39 -0
- package/esm/tl/5_message.d.ts.map +1 -0
- package/esm/tl/5_message.js +98 -0
- package/esm/tl/5_message_test.d.ts.map +1 -0
- package/esm/transport/3_transport_provider_tcp.d.ts +14 -0
- package/esm/transport/3_transport_provider_tcp.d.ts.map +1 -0
- package/esm/transport/3_transport_provider_tcp.js +15 -0
- package/esm/types/0_birthday.d.ts +2 -2
- package/esm/types/0_birthday.d.ts.map +1 -1
- package/esm/types/0_callback_query_answer.d.ts +2 -2
- package/esm/types/0_callback_query_answer.d.ts.map +1 -1
- package/esm/types/0_chat_administrator_rights.d.ts +3 -3
- package/esm/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/esm/types/0_chat_administrator_rights.js +1 -11
- package/esm/types/0_chat_member_rights.d.ts +3 -3
- package/esm/types/0_chat_member_rights.d.ts.map +1 -1
- package/esm/types/0_chat_member_rights.js +3 -3
- package/esm/types/0_chat_photo.d.ts +2 -2
- package/esm/types/0_chat_photo.d.ts.map +1 -1
- package/esm/types/0_chat_photo.js +2 -2
- package/esm/types/0_contact.d.ts +2 -2
- package/esm/types/0_contact.d.ts.map +1 -1
- package/esm/types/0_dice.d.ts +2 -2
- package/esm/types/0_dice.d.ts.map +1 -1
- package/esm/types/0_giveaway_parameters.d.ts +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_link_preview.d.ts +2 -2
- package/esm/types/0_link_preview.d.ts.map +1 -1
- package/esm/types/0_live_stream_channel.d.ts +2 -2
- package/esm/types/0_live_stream_channel.d.ts.map +1 -1
- package/esm/types/0_location.d.ts +2 -2
- package/esm/types/0_location.d.ts.map +1 -1
- package/esm/types/0_location.js +5 -5
- package/esm/types/0_mask_position.d.ts +2 -2
- package/esm/types/0_mask_position.d.ts.map +1 -1
- package/esm/types/0_message_entity.d.ts +3 -3
- package/esm/types/0_message_entity.d.ts.map +1 -1
- package/esm/types/0_message_entity.js +42 -42
- package/esm/types/0_message_search_filter.d.ts +2 -2
- package/esm/types/0_message_search_filter.d.ts.map +1 -1
- package/esm/types/0_message_search_filter.js +14 -15
- package/esm/types/0_opening_hours.d.ts +2 -2
- package/esm/types/0_opening_hours.d.ts.map +1 -1
- package/esm/types/0_poll_option.d.ts +2 -2
- package/esm/types/0_poll_option.d.ts.map +1 -1
- package/esm/types/0_reaction.d.ts +3 -3
- package/esm/types/0_reaction.d.ts.map +1 -1
- package/esm/types/0_reaction.js +4 -4
- package/esm/types/0_restriction_reason.d.ts +2 -2
- package/esm/types/0_restriction_reason.d.ts.map +1 -1
- package/esm/types/0_thumbnail.d.ts +2 -2
- package/esm/types/0_thumbnail.d.ts.map +1 -1
- package/esm/types/0_thumbnail.js +3 -3
- package/esm/types/0_video_chat.d.ts +2 -2
- package/esm/types/0_video_chat.d.ts.map +1 -1
- package/esm/types/0_video_chat.js +2 -2
- package/esm/types/0_voice.d.ts +2 -2
- package/esm/types/0_voice.d.ts.map +1 -1
- package/esm/types/1_animation.d.ts +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 +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 +9 -2
- package/esm/types/1_bot_command_scope.d.ts.map +1 -1
- package/esm/types/1_bot_command_scope.js +9 -9
- package/esm/types/1_chat_p.d.ts +5 -5
- 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 +2 -2
- package/esm/types/1_document.d.ts.map +1 -1
- package/esm/types/1_document.js +2 -2
- package/esm/types/1_giveaway.d.ts +2 -2
- package/esm/types/1_giveaway.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.d.ts +3 -3
- package/esm/types/1_keyboard_button.d.ts.map +1 -1
- package/esm/types/1_keyboard_button.js +18 -45
- package/esm/types/1_message_reaction.d.ts +2 -2
- package/esm/types/1_message_reaction.d.ts.map +1 -1
- package/esm/types/1_message_reaction.js +5 -5
- package/esm/types/1_photo.d.ts +5 -5
- package/esm/types/1_photo.d.ts.map +1 -1
- package/esm/types/1_photo.js +4 -4
- package/esm/types/1_poll.d.ts +2 -2
- package/esm/types/1_poll.d.ts.map +1 -1
- package/esm/types/1_reaction_count.d.ts +2 -2
- package/esm/types/1_reaction_count.d.ts.map +1 -1
- package/esm/types/1_reply_quote.d.ts +2 -2
- package/esm/types/1_reply_quote.d.ts.map +1 -1
- package/esm/types/1_sticker.d.ts +3 -3
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/1_sticker.js +9 -9
- package/esm/types/1_story_privacy.d.ts +3 -3
- package/esm/types/1_story_privacy.d.ts.map +1 -1
- package/esm/types/1_story_privacy.js +14 -14
- package/esm/types/1_story_reaction.d.ts +2 -2
- package/esm/types/1_story_reaction.d.ts.map +1 -1
- package/esm/types/1_user.d.ts +2 -2
- 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 +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 +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 +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_business_connection.d.ts +2 -2
- package/esm/types/2_business_connection.d.ts.map +1 -1
- package/esm/types/2_business_connection.js +1 -2
- package/esm/types/2_chat.d.ts +2 -2
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_chat.js +11 -11
- package/esm/types/2_chat_member.d.ts +2 -2
- package/esm/types/2_chat_member.d.ts.map +1 -1
- package/esm/types/2_chat_member.js +10 -10
- package/esm/types/2_chosen_inline_result.d.ts +2 -2
- package/esm/types/2_chosen_inline_result.d.ts.map +1 -1
- package/esm/types/2_chosen_inline_result.js +5 -5
- package/esm/types/2_game.d.ts +2 -2
- package/esm/types/2_game.d.ts.map +1 -1
- package/esm/types/2_game.js +4 -4
- package/esm/types/2_inactive_chat.d.ts +2 -2
- 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 +3 -3
- package/esm/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/esm/types/2_inline_keyboard_button.js +15 -21
- package/esm/types/2_inline_query.d.ts +2 -2
- package/esm/types/2_inline_query.d.ts.map +1 -1
- package/esm/types/2_inline_query.js +8 -8
- package/esm/types/2_invite_link.d.ts +2 -2
- package/esm/types/2_invite_link.d.ts.map +1 -1
- package/esm/types/2_invite_link.js +1 -2
- package/esm/types/2_message_reaction_count.d.ts +2 -2
- package/esm/types/2_message_reaction_count.d.ts.map +1 -1
- package/esm/types/2_message_reactions.d.ts +2 -2
- 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 +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_interactions.d.ts +2 -2
- package/esm/types/2_story_interactions.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.d.ts +3 -3
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/2_story_interactive_area.js +19 -29
- package/esm/types/3_chat_member_updated.d.ts +2 -2
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.js +7 -7
- package/esm/types/3_reply_markup.d.ts +3 -3
- package/esm/types/3_reply_markup.d.ts.map +1 -1
- package/esm/types/3_reply_markup.js +12 -22
- package/esm/types/3_story.d.ts +2 -2
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.d.ts +3 -3
- package/esm/types/4_inline_query_result.d.ts.map +1 -1
- package/esm/types/4_inline_query_result.js +53 -161
- package/esm/types/4_message.d.ts +3 -3
- package/esm/types/4_message.d.ts.map +1 -1
- package/esm/types/4_message.js +68 -59
- package/esm/types/5_callback_query.d.ts +3 -3
- package/esm/types/5_callback_query.d.ts.map +1 -1
- package/esm/types/5_callback_query.js +5 -5
- package/esm/types/5_chat_list_item.d.ts +3 -3
- package/esm/types/5_chat_list_item.d.ts.map +1 -1
- package/esm/types/5_chat_list_item.js +2 -2
- package/esm/types/5_inline_query_answer.d.ts +2 -2
- package/esm/types/5_inline_query_answer.d.ts.map +1 -1
- package/esm/types/_file_id.d.ts +2 -2
- package/esm/types/_file_id.d.ts.map +1 -1
- package/esm/types/_file_id.js +4 -4
- package/esm/types/_getters.d.ts +7 -7
- package/esm/types/_getters.d.ts.map +1 -1
- package/package.json +1 -1
- package/script/0_deps.d.ts +2 -0
- package/script/0_deps.d.ts.map +1 -1
- package/script/0_deps.js +5 -2
- package/script/2_tl.d.ts +7 -8
- package/script/2_tl.d.ts.map +1 -1
- package/script/2_tl.js +20 -11
- package/script/3_errors.d.ts +519 -515
- package/script/3_errors.d.ts.map +1 -1
- package/script/3_errors.js +543 -514
- package/script/3_transport.d.ts +1 -0
- package/script/3_transport.d.ts.map +1 -1
- package/script/3_transport.js +1 -0
- package/script/4_errors.d.ts +7 -7
- package/script/4_errors.d.ts.map +1 -1
- package/script/4_errors.js +6 -6
- package/script/client/0_client_abstract.d.ts +1 -21
- package/script/client/0_client_abstract.d.ts.map +1 -1
- package/script/client/0_client_abstract.js +41 -16
- package/script/client/0_message.d.ts +3 -3
- package/script/client/0_message.d.ts.map +1 -1
- package/script/client/0_message.js +3 -19
- package/script/client/0_params.d.ts +1 -1
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts +2 -2
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +2 -7
- package/script/client/0_storage_operations.d.ts +23 -23
- package/script/client/0_storage_operations.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +12 -11
- package/script/client/0_utilities.d.ts.map +1 -1
- package/script/client/0_utilities.js +12 -9
- package/script/client/1_client_encrypted.d.ts +3 -5
- package/script/client/1_client_encrypted.d.ts.map +1 -1
- package/script/client/1_client_encrypted.js +42 -26
- package/script/client/1_client_plain.d.ts +2 -2
- package/script/client/1_client_plain.d.ts.map +1 -1
- package/script/client/1_client_plain.js +25 -17
- package/script/client/1_types.d.ts +9 -22
- package/script/client/1_types.d.ts.map +1 -1
- package/script/client/2_account_manager.d.ts +2 -2
- package/script/client/2_account_manager.js +15 -15
- package/script/client/2_bot_info_manager.d.ts.map +1 -1
- package/script/client/2_bot_info_manager.js +7 -6
- package/script/client/2_business_connection_manager.d.ts +3 -3
- package/script/client/2_business_connection_manager.d.ts.map +1 -1
- package/script/client/2_business_connection_manager.js +5 -4
- package/script/client/2_file_manager.d.ts +4 -4
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +25 -22
- package/script/client/2_reaction_manager.d.ts +3 -3
- package/script/client/2_reaction_manager.d.ts.map +1 -1
- package/script/client/2_reaction_manager.js +15 -9
- package/script/client/2_update_manager.d.ts +11 -11
- package/script/client/2_update_manager.d.ts.map +1 -1
- package/script/client/2_update_manager.js +183 -162
- package/script/client/3_message_manager.d.ts +8 -9
- package/script/client/3_message_manager.d.ts.map +1 -1
- package/script/client/3_message_manager.js +204 -473
- package/script/client/3_video_chat_manager.d.ts +3 -3
- package/script/client/3_video_chat_manager.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.js +25 -35
- package/script/client/4_callback_query_manager.d.ts +3 -3
- package/script/client/4_callback_query_manager.d.ts.map +1 -1
- package/script/client/4_callback_query_manager.js +4 -15
- package/script/client/4_chat_list_manager.d.ts +5 -4
- package/script/client/4_chat_list_manager.d.ts.map +1 -1
- package/script/client/4_chat_list_manager.js +54 -32
- package/script/client/4_inline_query_manager.d.ts +3 -3
- package/script/client/4_inline_query_manager.d.ts.map +1 -1
- package/script/client/4_inline_query_manager.js +5 -14
- package/script/client/4_story_manager.d.ts +3 -3
- package/script/client/4_story_manager.d.ts.map +1 -1
- package/script/client/4_story_manager.js +14 -31
- package/script/client/5_client.d.ts +10 -12
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +59 -113
- package/{esm/tl/6_rpc_result.d.ts → script/connection/1_connection_tcp.d.ts} +14 -10
- package/script/connection/1_connection_tcp.d.ts.map +1 -0
- package/script/connection/1_connection_tcp.js +196 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts +3 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/_constants.js +7 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts +70 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/iterate_reader.js +91 -0
- package/script/deps/deno.land/std@0.224.0/io/types.d.ts +95 -0
- package/script/deps/deno.land/std@0.224.0/io/types.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/types.js +4 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts +39 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.d.ts.map +1 -0
- package/script/deps/deno.land/std@0.224.0/io/write_all.js +54 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts +45 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/client.js +280 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts +3 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/deps.js +5 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts +3 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.d.ts.map +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/socks5/main/utils.js +40 -0
- package/script/mod.d.ts +0 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +0 -1
- package/script/tl/0_api.d.ts +14813 -0
- package/script/tl/0_api.d.ts.map +1 -0
- package/script/tl/0_api.js +23248 -0
- package/script/tl/1_utilities.d.ts +32 -0
- package/script/tl/1_utilities.d.ts.map +1 -0
- package/script/tl/1_utilities.js +76 -0
- package/script/tl/1_utilities_test.d.ts.map +1 -0
- package/script/tl/2_deserialize.d.ts +23 -0
- package/script/tl/2_deserialize.d.ts.map +1 -0
- package/script/tl/{3_deserialize.js → 2_deserialize.js} +19 -20
- package/script/tl/2_serialize.d.ts +22 -0
- package/script/tl/2_serialize.d.ts.map +1 -0
- package/script/tl/2_serialize.js +164 -0
- package/script/tl/2_serialize_test.d.ts.map +1 -0
- package/script/tl/{4_tl_reader.d.ts → 3_tl_reader.d.ts} +3 -3
- package/script/tl/3_tl_reader.d.ts.map +1 -0
- package/script/tl/{4_tl_reader.js → 3_tl_reader.js} +5 -5
- package/script/tl/3_utilities.d.ts +5 -5
- package/script/tl/3_utilities.d.ts.map +1 -1
- package/script/tl/3_utilities.js +9 -10
- package/script/tl/4_rpc_result.d.ts +27 -0
- package/script/tl/4_rpc_result.d.ts.map +1 -0
- package/{esm/tl/8_message_container.d.ts → script/tl/4_rpc_result.js} +12 -12
- package/{esm/tl/5_tl_writer.d.ts → script/tl/4_tl_writer.d.ts} +2 -2
- package/script/tl/4_tl_writer.d.ts.map +1 -0
- package/script/tl/{5_tl_writer.js → 4_tl_writer.js} +4 -4
- package/script/tl/5_message.d.ts +39 -0
- package/script/tl/5_message.d.ts.map +1 -0
- package/script/tl/5_message.js +106 -0
- package/script/tl/5_message_test.d.ts.map +1 -0
- package/script/transport/3_transport_provider_tcp.d.ts +14 -0
- package/script/transport/3_transport_provider_tcp.d.ts.map +1 -0
- package/script/transport/3_transport_provider_tcp.js +19 -0
- package/script/types/0_birthday.d.ts +2 -2
- package/script/types/0_birthday.d.ts.map +1 -1
- package/script/types/0_callback_query_answer.d.ts +2 -2
- package/script/types/0_callback_query_answer.d.ts.map +1 -1
- package/script/types/0_chat_administrator_rights.d.ts +3 -3
- package/script/types/0_chat_administrator_rights.d.ts.map +1 -1
- package/script/types/0_chat_administrator_rights.js +1 -11
- package/script/types/0_chat_member_rights.d.ts +3 -3
- package/script/types/0_chat_member_rights.d.ts.map +1 -1
- package/script/types/0_chat_member_rights.js +3 -3
- package/script/types/0_chat_photo.d.ts +2 -2
- package/script/types/0_chat_photo.d.ts.map +1 -1
- package/script/types/0_chat_photo.js +1 -1
- package/script/types/0_contact.d.ts +2 -2
- package/script/types/0_contact.d.ts.map +1 -1
- package/script/types/0_dice.d.ts +2 -2
- package/script/types/0_dice.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.d.ts +2 -2
- package/script/types/0_giveaway_parameters.d.ts.map +1 -1
- package/script/types/0_giveaway_parameters.js +2 -2
- package/script/types/0_link_preview.d.ts +2 -2
- package/script/types/0_link_preview.d.ts.map +1 -1
- package/script/types/0_live_stream_channel.d.ts +2 -2
- package/script/types/0_live_stream_channel.d.ts.map +1 -1
- package/script/types/0_location.d.ts +2 -2
- package/script/types/0_location.d.ts.map +1 -1
- package/script/types/0_location.js +4 -4
- package/script/types/0_mask_position.d.ts +2 -2
- package/script/types/0_mask_position.d.ts.map +1 -1
- package/script/types/0_message_entity.d.ts +3 -3
- package/script/types/0_message_entity.d.ts.map +1 -1
- package/script/types/0_message_entity.js +41 -41
- package/script/types/0_message_search_filter.d.ts +2 -2
- package/script/types/0_message_search_filter.d.ts.map +1 -1
- package/script/types/0_message_search_filter.js +14 -15
- package/script/types/0_opening_hours.d.ts +2 -2
- package/script/types/0_opening_hours.d.ts.map +1 -1
- package/script/types/0_poll_option.d.ts +2 -2
- package/script/types/0_poll_option.d.ts.map +1 -1
- package/script/types/0_reaction.d.ts +3 -3
- package/script/types/0_reaction.d.ts.map +1 -1
- package/script/types/0_reaction.js +3 -3
- package/script/types/0_restriction_reason.d.ts +2 -2
- package/script/types/0_restriction_reason.d.ts.map +1 -1
- package/script/types/0_thumbnail.d.ts +2 -2
- package/script/types/0_thumbnail.d.ts.map +1 -1
- package/script/types/0_thumbnail.js +2 -2
- package/script/types/0_video_chat.d.ts +2 -2
- package/script/types/0_video_chat.d.ts.map +1 -1
- package/script/types/0_video_chat.js +1 -1
- package/script/types/0_voice.d.ts +2 -2
- package/script/types/0_voice.d.ts.map +1 -1
- package/script/types/1_animation.d.ts +2 -2
- 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 +2 -2
- 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 +9 -2
- package/script/types/1_bot_command_scope.d.ts.map +1 -1
- package/script/types/1_bot_command_scope.js +8 -8
- package/script/types/1_chat_p.d.ts +5 -5
- 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 +2 -2
- package/script/types/1_document.d.ts.map +1 -1
- package/script/types/1_document.js +1 -1
- package/script/types/1_giveaway.d.ts +2 -2
- package/script/types/1_giveaway.d.ts.map +1 -1
- package/script/types/1_keyboard_button.d.ts +3 -3
- package/script/types/1_keyboard_button.d.ts.map +1 -1
- package/script/types/1_keyboard_button.js +17 -44
- package/script/types/1_message_reaction.d.ts +2 -2
- package/script/types/1_message_reaction.d.ts.map +1 -1
- package/script/types/1_message_reaction.js +4 -4
- package/script/types/1_photo.d.ts +5 -5
- package/script/types/1_photo.d.ts.map +1 -1
- package/script/types/1_photo.js +3 -3
- package/script/types/1_poll.d.ts +2 -2
- package/script/types/1_poll.d.ts.map +1 -1
- package/script/types/1_reaction_count.d.ts +2 -2
- package/script/types/1_reaction_count.d.ts.map +1 -1
- package/script/types/1_reply_quote.d.ts +2 -2
- package/script/types/1_reply_quote.d.ts.map +1 -1
- package/script/types/1_sticker.d.ts +3 -3
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/1_sticker.js +8 -8
- package/script/types/1_story_privacy.d.ts +3 -3
- package/script/types/1_story_privacy.d.ts.map +1 -1
- package/script/types/1_story_privacy.js +13 -13
- package/script/types/1_story_reaction.d.ts +2 -2
- package/script/types/1_story_reaction.d.ts.map +1 -1
- package/script/types/1_user.d.ts +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- package/script/types/1_video_note.d.ts.map +1 -1
- package/script/types/1_video_note.js +1 -1
- package/script/types/2_business_connection.d.ts +2 -2
- package/script/types/2_business_connection.d.ts.map +1 -1
- package/script/types/2_business_connection.js +1 -2
- package/script/types/2_chat.d.ts +2 -2
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_chat.js +10 -10
- package/script/types/2_chat_member.d.ts +2 -2
- package/script/types/2_chat_member.d.ts.map +1 -1
- package/script/types/2_chat_member.js +9 -9
- package/script/types/2_chosen_inline_result.d.ts +2 -2
- package/script/types/2_chosen_inline_result.d.ts.map +1 -1
- package/script/types/2_chosen_inline_result.js +4 -4
- package/script/types/2_game.d.ts +2 -2
- package/script/types/2_game.d.ts.map +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_inactive_chat.d.ts +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 +3 -3
- package/script/types/2_inline_keyboard_button.d.ts.map +1 -1
- package/script/types/2_inline_keyboard_button.js +14 -20
- package/script/types/2_inline_query.d.ts +2 -2
- package/script/types/2_inline_query.d.ts.map +1 -1
- package/script/types/2_inline_query.js +7 -7
- package/script/types/2_invite_link.d.ts +2 -2
- package/script/types/2_invite_link.d.ts.map +1 -1
- package/script/types/2_invite_link.js +1 -2
- package/script/types/2_message_reaction_count.d.ts +2 -2
- package/script/types/2_message_reaction_count.d.ts.map +1 -1
- package/script/types/2_message_reactions.d.ts +2 -2
- 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 +2 -2
- 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_interactions.d.ts +2 -2
- package/script/types/2_story_interactions.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.d.ts +3 -3
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/2_story_interactive_area.js +18 -28
- package/script/types/3_chat_member_updated.d.ts +2 -2
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.js +6 -6
- package/script/types/3_reply_markup.d.ts +3 -3
- package/script/types/3_reply_markup.d.ts.map +1 -1
- package/script/types/3_reply_markup.js +11 -21
- package/script/types/3_story.d.ts +2 -2
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/4_inline_query_result.d.ts +3 -3
- package/script/types/4_inline_query_result.d.ts.map +1 -1
- package/script/types/4_inline_query_result.js +52 -160
- package/script/types/4_message.d.ts +3 -3
- package/script/types/4_message.d.ts.map +1 -1
- package/script/types/4_message.js +67 -58
- package/script/types/5_callback_query.d.ts +3 -3
- package/script/types/5_callback_query.d.ts.map +1 -1
- package/script/types/5_callback_query.js +4 -4
- package/script/types/5_chat_list_item.d.ts +3 -3
- package/script/types/5_chat_list_item.d.ts.map +1 -1
- package/script/types/5_chat_list_item.js +1 -1
- package/script/types/5_inline_query_answer.d.ts +2 -2
- package/script/types/5_inline_query_answer.d.ts.map +1 -1
- package/script/types/_file_id.d.ts +2 -2
- package/script/types/_file_id.d.ts.map +1 -1
- package/script/types/_file_id.js +3 -3
- package/script/types/_getters.d.ts +7 -7
- package/script/types/_getters.d.ts.map +1 -1
- package/esm/tl/1_tl_object.d.ts +0 -64
- package/esm/tl/1_tl_object.d.ts.map +0 -1
- package/esm/tl/1_tl_object.js +0 -221
- package/esm/tl/1_tl_object_test.d.ts.map +0 -1
- package/esm/tl/2_types.d.ts +0 -28060
- package/esm/tl/2_types.d.ts.map +0 -1
- package/esm/tl/2_types.js +0 -68685
- package/esm/tl/2_types_test.d.ts.map +0 -1
- package/esm/tl/3_deserialize.d.ts +0 -23
- package/esm/tl/3_deserialize.d.ts.map +0 -1
- package/esm/tl/3_functions.d.ts +0 -14094
- package/esm/tl/3_functions.d.ts.map +0 -1
- package/esm/tl/3_functions.js +0 -28475
- package/esm/tl/3_functions_test.d.ts.map +0 -1
- package/esm/tl/4_tl_reader.d.ts.map +0 -1
- package/esm/tl/5_tl_writer.d.ts.map +0 -1
- package/esm/tl/6_rpc_result.d.ts.map +0 -1
- package/esm/tl/6_rpc_result.js +0 -49
- package/esm/tl/7_message.d.ts.map +0 -1
- package/esm/tl/7_message.js +0 -90
- package/esm/tl/7_message_test.d.ts.map +0 -1
- package/esm/tl/8_message_container.d.ts.map +0 -1
- package/esm/tl/8_message_container.js +0 -72
- package/script/tl/1_tl_object.d.ts +0 -64
- package/script/tl/1_tl_object.d.ts.map +0 -1
- package/script/tl/1_tl_object.js +0 -228
- package/script/tl/1_tl_object_test.d.ts.map +0 -1
- package/script/tl/2_types.d.ts +0 -28060
- package/script/tl/2_types.d.ts.map +0 -1
- package/script/tl/2_types.js +0 -70558
- package/script/tl/2_types_test.d.ts.map +0 -1
- package/script/tl/3_deserialize.d.ts +0 -23
- package/script/tl/3_deserialize.d.ts.map +0 -1
- package/script/tl/3_functions.d.ts +0 -14094
- package/script/tl/3_functions.d.ts.map +0 -1
- package/script/tl/3_functions.js +0 -29121
- package/script/tl/3_functions_test.d.ts.map +0 -1
- package/script/tl/4_tl_reader.d.ts.map +0 -1
- package/script/tl/5_tl_writer.d.ts.map +0 -1
- package/script/tl/6_rpc_result.d.ts +0 -30
- package/script/tl/6_rpc_result.d.ts.map +0 -1
- package/script/tl/6_rpc_result.js +0 -53
- package/script/tl/7_message.d.ts +0 -32
- package/script/tl/7_message.d.ts.map +0 -1
- package/script/tl/7_message.js +0 -95
- package/script/tl/7_message_test.d.ts.map +0 -1
- package/script/tl/8_message_container.d.ts +0 -32
- package/script/tl/8_message_container.d.ts.map +0 -1
- package/script/tl/8_message_container.js +0 -76
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"3_functions_test.d.ts","sourceRoot":"","sources":["../../src/tl/3_functions_test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"4_tl_reader.d.ts","sourceRoot":"","sources":["../../src/tl/4_tl_reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAW,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAa,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAIvD,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC;AAE3E,qBAAa,QAAS,SAAQ,WAAW;IACvC,UAAU,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,UAAU;CAsBpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"5_tl_writer.d.ts","sourceRoot":"","sources":["../../src/tl/5_tl_writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,qBAAa,QAAS,SAAQ,WAAW;IACvC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,IAAI;CAkB7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"6_rpc_result.d.ts","sourceRoot":"","sources":["../../src/tl/6_rpc_result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAY,MAAM,kBAAkB,CAAC;AAExD,qBAAa,SAAS;aAUF,SAAS,EAAE,MAAM;aACjB,MAAM,EAAE,UAAU;IAVpC,MAAM,KAAK,CAAC,EAAE,CAAC,IAAI,MAAM,CAExB;IAED,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAEnB;gBAGiB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,UAAU;IAIpC,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS;CAMlD"}
|
package/esm/tl/6_rpc_result.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
-
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
-
*
|
|
5
|
-
* This file is part of MTKruto.
|
|
6
|
-
*
|
|
7
|
-
* This program is free software: you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU Lesser General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
-
*/
|
|
20
|
-
import { id, name } from "./1_tl_object.js";
|
|
21
|
-
import { TLReader } from "./4_tl_reader.js";
|
|
22
|
-
export class RPCResult {
|
|
23
|
-
static get [id]() {
|
|
24
|
-
return 0xF35C6D01;
|
|
25
|
-
}
|
|
26
|
-
get [name]() {
|
|
27
|
-
return "rpc_result";
|
|
28
|
-
}
|
|
29
|
-
constructor(messageId, result) {
|
|
30
|
-
Object.defineProperty(this, "messageId", {
|
|
31
|
-
enumerable: true,
|
|
32
|
-
configurable: true,
|
|
33
|
-
writable: true,
|
|
34
|
-
value: messageId
|
|
35
|
-
});
|
|
36
|
-
Object.defineProperty(this, "result", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
configurable: true,
|
|
39
|
-
writable: true,
|
|
40
|
-
value: result
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
static deserialize(buffer) {
|
|
44
|
-
const reader = new TLReader(buffer);
|
|
45
|
-
const messageId = reader.readInt64();
|
|
46
|
-
const result = reader.readObject();
|
|
47
|
-
return new RPCResult(messageId, result);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"7_message.d.ts","sourceRoot":"","sources":["../../src/tl/7_message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAM,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,wBAAgB,eAAe,CAAC,MAAM,EAAE,QAAQ,GAAG,UAAU,GAAG,MAAM,CAcrE;AAED,qBAAa,QAAQ;aAED,EAAE,EAAE,MAAM;aACV,KAAK,EAAE,MAAM;aACb,IAAI,EAAE,UAAU,GAAG,SAAS;gBAF5B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,UAAU,GAAG,SAAS;IAI9C,CAAC,SAAS,CAAC,IAAI,UAAU;IAYzB,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,GAAG,QAAQ;CAgB/C"}
|
package/esm/tl/7_message.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
-
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
-
*
|
|
5
|
-
* This file is part of MTKruto.
|
|
6
|
-
*
|
|
7
|
-
* This program is free software: you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU Lesser General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
-
*/
|
|
20
|
-
import { id, serialize } from "./1_tl_object.js";
|
|
21
|
-
import { TLReader } from "./4_tl_reader.js";
|
|
22
|
-
import { TLWriter } from "./5_tl_writer.js";
|
|
23
|
-
import { RPCResult } from "./6_rpc_result.js";
|
|
24
|
-
export function calculateLength(object) {
|
|
25
|
-
let length = 0;
|
|
26
|
-
if (Array.isArray(object)) {
|
|
27
|
-
length += 32 / 8; // vector constructor
|
|
28
|
-
length += 32 / 8; // number of items
|
|
29
|
-
for (const item of object) {
|
|
30
|
-
length += calculateLength(item);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else if (typeof object === "boolean") {
|
|
34
|
-
length += 32 / 8; // constructor
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
length += object[serialize]().length;
|
|
38
|
-
}
|
|
39
|
-
return length;
|
|
40
|
-
}
|
|
41
|
-
export class Message_ {
|
|
42
|
-
constructor(id, seqNo, body) {
|
|
43
|
-
Object.defineProperty(this, "id", {
|
|
44
|
-
enumerable: true,
|
|
45
|
-
configurable: true,
|
|
46
|
-
writable: true,
|
|
47
|
-
value: id
|
|
48
|
-
});
|
|
49
|
-
Object.defineProperty(this, "seqNo", {
|
|
50
|
-
enumerable: true,
|
|
51
|
-
configurable: true,
|
|
52
|
-
writable: true,
|
|
53
|
-
value: seqNo
|
|
54
|
-
});
|
|
55
|
-
Object.defineProperty(this, "body", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: body
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
[serialize]() {
|
|
63
|
-
if (this.body instanceof RPCResult) {
|
|
64
|
-
throw new Error("Not applicable");
|
|
65
|
-
}
|
|
66
|
-
return new TLWriter()
|
|
67
|
-
.writeInt64(this.id)
|
|
68
|
-
.writeInt32(this.seqNo)
|
|
69
|
-
.writeInt32(calculateLength(this.body))
|
|
70
|
-
.writeObject(this.body)
|
|
71
|
-
.buffer;
|
|
72
|
-
}
|
|
73
|
-
static deserialize(reader) {
|
|
74
|
-
const id_ = reader.readInt64();
|
|
75
|
-
const seqNo = reader.readInt32();
|
|
76
|
-
const length = reader.readInt32();
|
|
77
|
-
reader = new TLReader(reader.read(length));
|
|
78
|
-
const cid = reader.readInt32(false);
|
|
79
|
-
let body;
|
|
80
|
-
{
|
|
81
|
-
if (cid == RPCResult[id]) {
|
|
82
|
-
body = RPCResult.deserialize(reader.buffer);
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
body = reader.readObject(cid);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return new Message_(id_, seqNo, body);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"7_message_test.d.ts","sourceRoot":"","sources":["../../src/tl/7_message_test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"8_message_container.d.ts","sourceRoot":"","sources":["../../src/tl/8_message_container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAmB,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE3D,qBAAa,gBAAgB;aASC,EAAE,EAAE,MAAM;aAAkB,KAAK,EAAE,MAAM;IAAS,QAAQ,EAAE,QAAQ,EAAE;IARlG,MAAM,KAAK,CAAC,EAAE,CAAC,IAAI,MAAM,CAExB;IAED,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAEnB;gBAE2B,EAAE,EAAE,MAAM,EAAkB,KAAK,EAAE,MAAM,EAAS,QAAQ,EAAE,QAAQ,EAAE;IAGlG,CAAC,SAAS,CAAC,IAAI,UAAU;IAazB,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,EAAE;CASnD"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
-
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
-
*
|
|
5
|
-
* This file is part of MTKruto.
|
|
6
|
-
*
|
|
7
|
-
* This program is free software: you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU Lesser General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
-
*/
|
|
20
|
-
import { id, name, serialize } from "./1_tl_object.js";
|
|
21
|
-
import { TLReader } from "./4_tl_reader.js";
|
|
22
|
-
import { TLWriter } from "./5_tl_writer.js";
|
|
23
|
-
import { calculateLength, Message_ } from "./7_message.js";
|
|
24
|
-
export class MessageContainer {
|
|
25
|
-
static get [id]() {
|
|
26
|
-
return 0x73F1F8DC;
|
|
27
|
-
}
|
|
28
|
-
get [name]() {
|
|
29
|
-
return "msg_container";
|
|
30
|
-
}
|
|
31
|
-
constructor(id, seqNo, messages) {
|
|
32
|
-
Object.defineProperty(this, "id", {
|
|
33
|
-
enumerable: true,
|
|
34
|
-
configurable: true,
|
|
35
|
-
writable: true,
|
|
36
|
-
value: id
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(this, "seqNo", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: seqNo
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(this, "messages", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
configurable: true,
|
|
47
|
-
writable: true,
|
|
48
|
-
value: messages
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
[serialize]() {
|
|
52
|
-
const writer = new TLWriter();
|
|
53
|
-
writer.writeInt64(this.id);
|
|
54
|
-
writer.writeInt32(this.seqNo);
|
|
55
|
-
writer.writeInt32(8 + this.messages.map(calculateLength).reduce((a, b) => a + b));
|
|
56
|
-
writer.writeInt32(MessageContainer[id], false);
|
|
57
|
-
writer.writeInt32(this.messages.length);
|
|
58
|
-
for (const message of this.messages) {
|
|
59
|
-
writer.write(message[serialize]());
|
|
60
|
-
}
|
|
61
|
-
return writer.buffer;
|
|
62
|
-
}
|
|
63
|
-
static deserialize(buffer) {
|
|
64
|
-
const reader = new TLReader(buffer);
|
|
65
|
-
const length = reader.readInt32();
|
|
66
|
-
const messages = new Array();
|
|
67
|
-
for (let i = 0; i < length; i++) {
|
|
68
|
-
messages.push(Message_.deserialize(reader));
|
|
69
|
-
}
|
|
70
|
-
return messages;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
-
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
4
|
-
*
|
|
5
|
-
* This file is part of MTKruto.
|
|
6
|
-
*
|
|
7
|
-
* This program is free software: you can redistribute it and/or modify
|
|
8
|
-
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
-
* (at your option) any later version.
|
|
11
|
-
*
|
|
12
|
-
* This program is distributed in the hope that it will be useful,
|
|
13
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
-
* GNU Lesser General Public License for more details.
|
|
16
|
-
*
|
|
17
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
-
*/
|
|
20
|
-
type MaybeArrayOf<T> = T | T[];
|
|
21
|
-
type MaybeInArray<T> = T | [T];
|
|
22
|
-
export type ParamDesc = ([
|
|
23
|
-
string,
|
|
24
|
-
MaybeInArray<typeof TLObject | typeof Uint8Array | "string" | "number" | "bigint" | "boolean" | "true">,
|
|
25
|
-
string
|
|
26
|
-
] | [string, typeof flags, "#"])[];
|
|
27
|
-
export type Param = null | MaybeArrayOf<string | number | bigint | boolean | Uint8Array | TLObject>;
|
|
28
|
-
export declare const flags: unique symbol;
|
|
29
|
-
export type Params = ([
|
|
30
|
-
Param,
|
|
31
|
-
MaybeInArray<typeof TLObject | typeof Uint8Array | "string" | "number" | "bigint" | "boolean" | "true">,
|
|
32
|
-
string
|
|
33
|
-
] | [string, typeof flags, "#"])[];
|
|
34
|
-
export declare const id: unique symbol;
|
|
35
|
-
export declare const params: unique symbol;
|
|
36
|
-
export declare const paramDesc: unique symbol;
|
|
37
|
-
export declare const length: unique symbol;
|
|
38
|
-
export declare const serialize: unique symbol;
|
|
39
|
-
export declare const as: unique symbol;
|
|
40
|
-
export declare const name: unique symbol;
|
|
41
|
-
export declare function isOptionalParam(ntype: string): boolean;
|
|
42
|
-
export declare function analyzeOptionalParam(ntype: string): {
|
|
43
|
-
flagField: string;
|
|
44
|
-
bitIndex: number;
|
|
45
|
-
};
|
|
46
|
-
export declare abstract class TLObject {
|
|
47
|
-
protected abstract get [id](): number;
|
|
48
|
-
protected abstract get [params](): Params;
|
|
49
|
-
static get [name](): string;
|
|
50
|
-
get [name](): string;
|
|
51
|
-
protected static get [paramDesc](): ParamDesc;
|
|
52
|
-
get [length](): number;
|
|
53
|
-
[serialize](): Uint8Array;
|
|
54
|
-
[as]<T extends TLObjectConstructor<InstanceType<T>>>(constructor: T): InstanceType<T>;
|
|
55
|
-
toJSON(): object;
|
|
56
|
-
}
|
|
57
|
-
export interface TLObjectConstructor<T = TLObject> {
|
|
58
|
-
new (params: any): T;
|
|
59
|
-
[name]: string;
|
|
60
|
-
[paramDesc]: ParamDesc;
|
|
61
|
-
}
|
|
62
|
-
export declare function isTLObjectConstructor(t: unknown): t is typeof TLObject;
|
|
63
|
-
export {};
|
|
64
|
-
//# sourceMappingURL=1_tl_object.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1_tl_object.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_object.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/B,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAE/B,MAAM,MAAM,SAAS,GAAG,CAAC;IACvB,MAAM;IACN,YAAY,CACR,OAAO,QAAQ,GACf,OAAO,UAAU,GACjB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,CACT;IACD,MAAM;CACP,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AAEnC,MAAM,MAAM,KAAK,GACb,IAAI,GACJ,YAAY,CACV,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,UAAU,GACV,QAAQ,CACX,CAAC;AAEJ,eAAO,MAAM,KAAK,eAAkB,CAAC;AAErC,MAAM,MAAM,MAAM,GAAG,CAAC;IACpB,KAAK;IACL,YAAY,CACR,OAAO,QAAQ,GACf,OAAO,UAAU,GACjB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,CACT;IACD,MAAM;CACP,GAAG,CAAC,MAAM,EAAE,OAAO,KAAK,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AAEnC,eAAO,MAAM,EAAE,eAAe,CAAC;AAE/B,eAAO,MAAM,MAAM,eAAmB,CAAC;AAEvC,eAAO,MAAM,SAAS,eAAsB,CAAC;AAE7C,eAAO,MAAM,MAAM,eAAmB,CAAC;AAEvC,eAAO,MAAM,SAAS,eAAsB,CAAC;AAE7C,eAAO,MAAM,EAAE,eAAe,CAAC;AAE/B,eAAO,MAAM,IAAI,eAAiB,CAAC;AAEnC,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAY3F;AAgGD,8BAAsB,QAAQ;IAC5B,SAAS,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC;IACtC,SAAS,CAAC,QAAQ,KAAK,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;IAE1C,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,MAAM,CAE1B;IAED,IAAI,CAAC,IAAI,CAAC,IAAI,MAAM,CAEnB;IAED,SAAS,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,IAAI,SAAS,CAG5C;IAED,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,CAErB;IAED,CAAC,SAAS,CAAC,IAAI,UAAU;IAiDzB,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,mBAAmB,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC;IAQrF,MAAM,IAAI,MAAM;CAsBjB;AAED,MAAM,WAAW,mBAAmB,CAAC,CAAC,GAAG,QAAQ;IAE/C,KAAK,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC;IACrB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACf,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CACxB;AACD,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,OAAO,QAAQ,CAGtE"}
|
package/script/tl/1_tl_object.js
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
4
|
-
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
5
|
-
*
|
|
6
|
-
* This file is part of MTKruto.
|
|
7
|
-
*
|
|
8
|
-
* This program is free software: you can redistribute it and/or modify
|
|
9
|
-
* it under the terms of the GNU Lesser General Public License as published by
|
|
10
|
-
* the Free Software Foundation, either version 3 of the License, or
|
|
11
|
-
* (at your option) any later version.
|
|
12
|
-
*
|
|
13
|
-
* This program is distributed in the hope that it will be useful,
|
|
14
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
-
* GNU Lesser General Public License for more details.
|
|
17
|
-
*
|
|
18
|
-
* You should have received a copy of the GNU Lesser General Public License
|
|
19
|
-
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
|
-
*/
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.isTLObjectConstructor = exports.TLObject = exports.analyzeOptionalParam = exports.isOptionalParam = exports.name = exports.as = exports.serialize = exports.length = exports.paramDesc = exports.params = exports.id = exports.flags = void 0;
|
|
23
|
-
const _0_deps_js_1 = require("../0_deps.js");
|
|
24
|
-
const _0_tl_raw_writer_js_1 = require("./0_tl_raw_writer.js");
|
|
25
|
-
exports.flags = Symbol("flags");
|
|
26
|
-
exports.id = Symbol("id");
|
|
27
|
-
exports.params = Symbol("params");
|
|
28
|
-
exports.paramDesc = Symbol("paramDesc");
|
|
29
|
-
exports.length = Symbol("length");
|
|
30
|
-
exports.serialize = Symbol("serialize");
|
|
31
|
-
exports.as = Symbol("as");
|
|
32
|
-
exports.name = Symbol("name");
|
|
33
|
-
function isOptionalParam(ntype) {
|
|
34
|
-
return ntype.includes("?");
|
|
35
|
-
}
|
|
36
|
-
exports.isOptionalParam = isOptionalParam;
|
|
37
|
-
function analyzeOptionalParam(ntype) {
|
|
38
|
-
if (!isOptionalParam(ntype)) {
|
|
39
|
-
throw new Error("Parameter not optional");
|
|
40
|
-
}
|
|
41
|
-
const flagField = ntype.split(".")[0];
|
|
42
|
-
(0, _0_deps_js_1.assertEquals)(typeof flagField, "string");
|
|
43
|
-
const bitIndex = Number(ntype.split("?")[0].split(".")[1]);
|
|
44
|
-
(0, _0_deps_js_1.assertFalse)(isNaN(bitIndex));
|
|
45
|
-
return { flagField, bitIndex };
|
|
46
|
-
}
|
|
47
|
-
exports.analyzeOptionalParam = analyzeOptionalParam;
|
|
48
|
-
function serializeSingleParam(writer, value, type, ntype, debugInfo) {
|
|
49
|
-
const valueRepr = value == null ? null : (typeof value === "object" && exports.name in value) ? value[exports.name] : value.constructor.name;
|
|
50
|
-
if (isTLObjectConstructor(type)) {
|
|
51
|
-
if ((type[exports.name] == "TypeX" && value instanceof TLObject) ||
|
|
52
|
-
value instanceof type) {
|
|
53
|
-
writer.write(value[exports.serialize]());
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
throw new TypeError(`Expected ${type[exports.name]} but received ${valueRepr} ${debugInfo}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
if (type == Uint8Array) {
|
|
61
|
-
if ((value instanceof Uint8Array)) {
|
|
62
|
-
writer.writeBytes(value);
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
throw new TypeError(`Expected Uint8Array but received ${valueRepr} ${debugInfo}`);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
switch (type) {
|
|
69
|
-
case "bigint":
|
|
70
|
-
if (typeof value === "bigint") {
|
|
71
|
-
if (ntype == "int128") {
|
|
72
|
-
writer.writeInt128(value);
|
|
73
|
-
}
|
|
74
|
-
else if (ntype === "int256") {
|
|
75
|
-
writer.writeInt256(value);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
writer.writeInt64(value);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
throw new TypeError(`Expected bigint but received ${valueRepr} ${debugInfo}`);
|
|
83
|
-
}
|
|
84
|
-
break;
|
|
85
|
-
case "boolean":
|
|
86
|
-
if (typeof value === "boolean") {
|
|
87
|
-
if (value) {
|
|
88
|
-
writer.writeInt32(0x997275B5);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
writer.writeInt32(0xBC799737);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
throw new TypeError(`Expected boolean but received ${valueRepr} ${debugInfo}`);
|
|
96
|
-
}
|
|
97
|
-
break;
|
|
98
|
-
case "number":
|
|
99
|
-
//
|
|
100
|
-
if (value == null) {
|
|
101
|
-
value = 0;
|
|
102
|
-
}
|
|
103
|
-
//
|
|
104
|
-
if (typeof value === "number") {
|
|
105
|
-
if (ntype == "double") {
|
|
106
|
-
writer.writeDouble(value);
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
writer.writeInt32(value);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
throw new TypeError(`Expected number but received ${valueRepr} ${debugInfo}`);
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
case "string":
|
|
117
|
-
if (typeof value === "string") {
|
|
118
|
-
writer.writeString(value);
|
|
119
|
-
}
|
|
120
|
-
else if (value instanceof Uint8Array) {
|
|
121
|
-
writer.writeBytes(value);
|
|
122
|
-
}
|
|
123
|
-
else {
|
|
124
|
-
writer.writeString("");
|
|
125
|
-
}
|
|
126
|
-
// else {
|
|
127
|
-
// throw new TypeError(`Expected string or Uint8Array but received ${valueRepr}`);
|
|
128
|
-
// }
|
|
129
|
-
break;
|
|
130
|
-
case "true":
|
|
131
|
-
if (value !== true) {
|
|
132
|
-
throw new TypeError(`Expected true but received ${valueRepr} ${debugInfo}`);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
class TLObject {
|
|
137
|
-
static get [exports.name]() {
|
|
138
|
-
return `ctor_${this.constructor.name}`;
|
|
139
|
-
}
|
|
140
|
-
get [exports.name]() {
|
|
141
|
-
return this.constructor[exports.name];
|
|
142
|
-
}
|
|
143
|
-
static get [exports.paramDesc]() {
|
|
144
|
-
// unimpl
|
|
145
|
-
return [];
|
|
146
|
-
}
|
|
147
|
-
get [exports.length]() {
|
|
148
|
-
return this[exports.serialize]().byteLength;
|
|
149
|
-
}
|
|
150
|
-
[exports.serialize]() {
|
|
151
|
-
const writer = new _0_tl_raw_writer_js_1.TLRawWriter();
|
|
152
|
-
writer.writeInt32(this[exports.id], false);
|
|
153
|
-
for (const [i, [value, type, ntype]] of this[exports.params].entries()) {
|
|
154
|
-
if (isOptionalParam(ntype) && value == null) {
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
const debugInfo = `[${this[exports.id].toString(16).toUpperCase()} ${i}]`;
|
|
158
|
-
if (type == exports.flags) {
|
|
159
|
-
let flags = 0;
|
|
160
|
-
const flagField_ = value;
|
|
161
|
-
for (const [value, _, ntype] of this[exports.params]) {
|
|
162
|
-
if (isOptionalParam(ntype)) {
|
|
163
|
-
const { flagField, bitIndex } = analyzeOptionalParam(ntype);
|
|
164
|
-
if (flagField == flagField_) {
|
|
165
|
-
if (value != null) {
|
|
166
|
-
flags |= 1 << bitIndex;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
writer.writeInt32(flags);
|
|
172
|
-
continue;
|
|
173
|
-
}
|
|
174
|
-
if (type instanceof Array) {
|
|
175
|
-
const itemsType = type[0];
|
|
176
|
-
if (!Array.isArray(value)) {
|
|
177
|
-
throw new TypeError("Expected array");
|
|
178
|
-
}
|
|
179
|
-
writer.writeInt32(0x1CB5C415); // vector constructor
|
|
180
|
-
writer.writeInt32(value.length);
|
|
181
|
-
for (const item of value) {
|
|
182
|
-
serializeSingleParam(writer, item, itemsType, ntype, debugInfo);
|
|
183
|
-
}
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
serializeSingleParam(writer, value, type, ntype, debugInfo);
|
|
187
|
-
}
|
|
188
|
-
return writer.buffer;
|
|
189
|
-
}
|
|
190
|
-
[exports.as](constructor) {
|
|
191
|
-
if (this instanceof constructor) {
|
|
192
|
-
return this;
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
throw new TypeError(`Expected ${constructor[exports.name]} but received ${this[exports.name]}`);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
toJSON() {
|
|
199
|
-
// deno-lint-ignore no-explicit-any
|
|
200
|
-
const r = { _: this[exports.name] + `#${this[exports.id].toString(16).toUpperCase()}` };
|
|
201
|
-
const desc = this.constructor[exports.paramDesc];
|
|
202
|
-
for (const [name] of desc) {
|
|
203
|
-
const n = name;
|
|
204
|
-
if (n in this && this[n] !== undefined) {
|
|
205
|
-
if (typeof this[n] === "bigint") {
|
|
206
|
-
r[name] = String(this[n]);
|
|
207
|
-
}
|
|
208
|
-
else if (this[n] instanceof Uint8Array) {
|
|
209
|
-
const buffer = this[n];
|
|
210
|
-
r[name] = "";
|
|
211
|
-
for (const b of buffer) {
|
|
212
|
-
r[name] += b.toString(16).padStart(2, "0").toUpperCase();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
r[name] = this[n];
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return r;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
exports.TLObject = TLObject;
|
|
224
|
-
function isTLObjectConstructor(t) {
|
|
225
|
-
// deno-lint-ignore no-explicit-any
|
|
226
|
-
return t[exports.paramDesc] instanceof Array;
|
|
227
|
-
}
|
|
228
|
-
exports.isTLObjectConstructor = isTLObjectConstructor;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"1_tl_object_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_object_test.ts"],"names":[],"mappings":""}
|