@mtkruto/node 0.1.201 → 0.1.299
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/COPYING +674 -0
- package/README.md +77 -1
- package/esm/0_deps.d.ts +20 -1
- package/esm/0_deps.js +21 -1
- package/esm/0_errors.d.ts +19 -0
- package/esm/0_errors.js +19 -0
- package/esm/1_utilities.d.ts +20 -1
- package/esm/1_utilities.js +20 -1
- package/esm/2_connection.d.ts +19 -0
- package/esm/2_connection.js +19 -0
- package/esm/2_tl.d.ts +19 -0
- package/esm/2_tl.js +19 -0
- package/esm/3_errors.d.ts +19 -0
- package/esm/3_errors.js +19 -0
- package/esm/3_storage.d.ts +19 -0
- package/esm/3_storage.js +19 -0
- package/esm/3_transport.d.ts +19 -0
- package/esm/3_transport.js +19 -0
- package/esm/3_types.d.ts +19 -0
- package/esm/3_types.js +19 -0
- package/esm/4_constants.js +19 -0
- package/esm/4_errors.d.ts +19 -0
- package/esm/4_errors.js +22 -3
- package/esm/5_client.d.ts +19 -0
- package/esm/5_client.js +19 -0
- package/esm/client/0_client_abstract.d.ts +19 -0
- package/esm/client/0_client_abstract.js +19 -0
- package/esm/client/0_filters.d.ts +19 -0
- package/esm/client/0_filters.js +19 -0
- package/esm/client/0_html.d.ts +19 -0
- package/esm/client/0_html.js +19 -0
- package/esm/client/0_markdown.js +5 -5
- package/esm/client/0_message.d.ts +19 -0
- package/esm/client/0_message.js +19 -0
- package/esm/client/0_params.d.ts +19 -0
- package/esm/client/0_params.js +19 -0
- package/esm/client/0_password.js +19 -0
- package/esm/client/0_types.d.ts +19 -0
- package/esm/client/0_types.js +19 -0
- package/esm/client/0_utilities.d.ts +7 -0
- package/esm/client/0_utilities.js +66 -4
- package/esm/client/1_account_manager.d.ts +19 -0
- package/esm/client/1_account_manager.js +23 -4
- package/esm/client/1_bot_info_manager.d.ts +19 -0
- package/esm/client/1_bot_info_manager.js +19 -0
- package/esm/client/1_business_connection_manager.d.ts +19 -0
- package/esm/client/1_business_connection_manager.js +19 -0
- package/esm/client/1_client_encrypted.d.ts +19 -0
- package/esm/client/1_client_encrypted.js +23 -4
- package/esm/client/1_client_plain.d.ts +19 -0
- package/esm/client/1_client_plain.js +22 -3
- package/esm/client/1_composer.d.ts +19 -0
- package/esm/client/1_composer.js +19 -0
- package/esm/client/1_file_manager.d.ts +19 -0
- package/esm/client/1_file_manager.js +25 -5
- package/esm/client/1_network_statistics_manager.d.ts +19 -0
- package/esm/client/1_network_statistics_manager.js +19 -0
- package/esm/client/1_reaction_manager.d.ts +19 -0
- package/esm/client/1_reaction_manager.js +21 -2
- package/esm/client/1_update_manager.d.ts +19 -0
- package/esm/client/1_update_manager.js +28 -8
- package/esm/client/2_message_manager.d.ts +19 -0
- package/esm/client/2_message_manager.js +66 -24
- package/esm/client/3_callback_query_manager.d.ts +19 -0
- package/esm/client/3_callback_query_manager.js +21 -0
- package/esm/client/3_chat_list_manager.d.ts +19 -0
- package/esm/client/3_chat_list_manager.js +32 -12
- package/esm/client/3_inline_query_manager.d.ts +19 -0
- package/esm/client/3_inline_query_manager.js +23 -2
- package/esm/client/3_story_manager.d.ts +19 -0
- package/esm/client/3_story_manager.js +26 -5
- package/esm/client/4_client.d.ts +19 -0
- package/esm/client/4_client.js +37 -17
- package/esm/connection/0_connection.d.ts +19 -0
- package/esm/connection/0_connection.js +19 -0
- package/esm/connection/1_connection_web_socket.js +22 -2
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +83 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +203 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +50 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +274 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +47 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +51 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +66 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +191 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +168 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +385 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +159 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +431 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +181 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +1046 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +42 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +52 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +11 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +122 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +1 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +24 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +46 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +121 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +31 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +30 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +2128 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +2127 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +109 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +108 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +8 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +1 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +90 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +95 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +50 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +128 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +46 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +110 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +42 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +120 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +6 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +54 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +110 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +40 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +75 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +58 -0
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +101 -0
- package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
- package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.d.ts +2 -0
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.js +5 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.d.ts +2 -2
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.js +5 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/crc32.js +1 -1
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/deflate.js +8 -8
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inffast.js +2 -2
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inflate.js +19 -21
- package/esm/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/trees.js +3 -3
- package/esm/mod.d.ts +20 -1
- package/esm/mod.js +20 -1
- package/esm/storage/0_storage.d.ts +19 -0
- package/esm/storage/0_storage.js +25 -5
- package/esm/storage/1_utilities.d.ts +19 -1
- package/esm/storage/1_utilities.js +21 -3
- package/esm/storage/2_storage_indexed_db.d.ts +19 -0
- package/esm/storage/2_storage_indexed_db.js +19 -0
- package/esm/storage/2_storage_local_storage.d.ts +19 -0
- package/esm/storage/2_storage_local_storage.js +20 -4
- package/esm/storage/2_storage_memory.d.ts +19 -0
- package/esm/storage/2_storage_memory.js +19 -0
- package/esm/storage/2_storage_session_storage.d.ts +19 -0
- package/esm/storage/2_storage_session_storage.js +20 -4
- package/esm/tl/0_tl_raw_reader.d.ts +19 -0
- package/esm/tl/0_tl_raw_reader.js +19 -0
- package/esm/tl/0_tl_raw_writer.d.ts +19 -0
- package/esm/tl/0_tl_raw_writer.js +19 -0
- package/esm/tl/1_tl_object.d.ts +19 -0
- package/esm/tl/1_tl_object.js +19 -0
- package/esm/tl/2_types.d.ts +19 -0
- package/esm/tl/2_types.js +19 -0
- package/esm/tl/3_deserialize.d.ts +19 -0
- package/esm/tl/3_deserialize.js +19 -0
- package/esm/tl/3_functions.d.ts +19 -0
- package/esm/tl/3_functions.js +19 -0
- package/esm/tl/3_utilities.d.ts +19 -0
- package/esm/tl/3_utilities.js +24 -4
- package/esm/tl/4_tl_reader.d.ts +19 -0
- package/esm/tl/4_tl_reader.js +19 -0
- package/esm/tl/5_tl_writer.d.ts +19 -0
- package/esm/tl/5_tl_writer.js +19 -0
- package/esm/tl/6_rpc_result.d.ts +19 -0
- package/esm/tl/6_rpc_result.js +19 -0
- package/esm/tl/7_message.d.ts +19 -0
- package/esm/tl/7_message.js +19 -0
- package/esm/tl/8_message_container.d.ts +19 -0
- package/esm/tl/8_message_container.js +19 -0
- package/esm/transport/0_obfuscation.js +19 -0
- package/esm/transport/0_transport.d.ts +19 -0
- package/esm/transport/0_transport.js +19 -0
- package/esm/transport/1_transport_abridged.d.ts +19 -0
- package/esm/transport/1_transport_abridged.js +19 -0
- package/esm/transport/1_transport_intermediate.d.ts +19 -0
- package/esm/transport/1_transport_intermediate.js +19 -0
- package/esm/transport/2_transport_provider.d.ts +19 -0
- package/esm/transport/2_transport_provider.js +23 -4
- package/esm/transport/3_transport_provider_web_socket.d.ts +19 -0
- package/esm/transport/3_transport_provider_web_socket.js +19 -0
- package/esm/types/0_authorization_state.d.ts +19 -0
- package/esm/types/0_authorization_state.js +19 -0
- package/esm/types/0_bot_command.d.ts +19 -0
- package/esm/types/0_bot_command.js +19 -0
- package/esm/types/0_chat_action.d.ts +19 -0
- package/esm/types/0_chat_action.js +19 -0
- package/esm/types/0_chat_administrator_rights.d.ts +19 -0
- package/esm/types/0_chat_administrator_rights.js +19 -0
- package/esm/types/0_chat_member_rights.d.ts +19 -0
- package/esm/types/0_chat_member_rights.js +19 -0
- package/esm/types/0_chat_photo.d.ts +19 -1
- package/esm/types/0_chat_photo.js +19 -2
- package/esm/types/0_connection_state.d.ts +19 -0
- package/esm/types/0_connection_state.js +19 -0
- package/esm/types/0_contact.d.ts +19 -0
- package/esm/types/0_contact.js +19 -0
- package/esm/types/0_dice.d.ts +19 -0
- package/esm/types/0_dice.js +19 -0
- package/esm/types/0_file_source.d.ts +19 -0
- package/esm/types/0_file_source.js +19 -0
- package/esm/types/0_giveaway_parameters.d.ts +19 -0
- package/esm/types/0_giveaway_parameters.js +19 -0
- package/esm/types/0_id.d.ts +19 -0
- package/esm/types/0_id.js +19 -0
- package/esm/types/0_keyboard_button_poll_type.d.ts +19 -0
- package/esm/types/0_keyboard_button_poll_type.js +19 -0
- package/esm/types/0_link_preview.d.ts +19 -0
- package/esm/types/0_link_preview.js +19 -0
- package/esm/types/0_location.d.ts +19 -0
- package/esm/types/0_location.js +19 -0
- package/esm/types/0_login_url.d.ts +19 -0
- package/esm/types/0_login_url.js +19 -0
- package/esm/types/0_mask_position.d.ts +19 -0
- package/esm/types/0_mask_position.js +19 -0
- package/esm/types/0_message_entity.d.ts +19 -0
- package/esm/types/0_message_entity.js +22 -3
- package/esm/types/0_message_reference.d.ts +19 -0
- package/esm/types/0_message_reference.js +19 -0
- package/esm/types/0_message_search_filter.d.ts +19 -0
- package/esm/types/0_message_search_filter.js +21 -2
- package/esm/types/0_mini_app_info.d.ts +19 -0
- package/esm/types/0_mini_app_info.js +19 -0
- package/esm/types/0_network_statistics_entry.d.ts +19 -0
- package/esm/types/0_network_statistics_entry.js +19 -0
- package/esm/types/0_parse_mode.d.ts +19 -0
- package/esm/types/0_parse_mode.js +19 -0
- package/esm/types/0_poll_option.d.ts +19 -0
- package/esm/types/0_poll_option.js +19 -0
- package/esm/types/0_price_tag.d.ts +19 -0
- package/esm/types/0_price_tag.js +19 -0
- package/esm/types/0_reaction.d.ts +19 -0
- package/esm/types/0_reaction.js +21 -2
- package/esm/types/0_restriction_reason.d.ts +19 -0
- package/esm/types/0_restriction_reason.js +19 -0
- package/esm/types/0_story_reference.d.ts +19 -0
- package/esm/types/0_story_reference.js +19 -0
- package/esm/types/0_thumbnail.d.ts +19 -0
- package/esm/types/0_thumbnail.js +19 -0
- package/esm/types/0_voice.d.ts +19 -0
- package/esm/types/0_voice.js +19 -0
- package/esm/types/1_animation.d.ts +19 -0
- package/esm/types/1_animation.js +19 -0
- package/esm/types/1_audio.d.ts +19 -0
- package/esm/types/1_audio.js +19 -0
- package/esm/types/1_bot_command_scope.d.ts +19 -0
- package/esm/types/1_bot_command_scope.js +22 -3
- package/esm/types/1_chat_p.d.ts +19 -0
- package/esm/types/1_chat_p.js +22 -2
- package/esm/types/1_document.d.ts +19 -0
- package/esm/types/1_document.js +19 -0
- package/esm/types/1_giveaway.d.ts +19 -0
- package/esm/types/1_giveaway.js +19 -0
- package/esm/types/1_inline_query_result_button.d.ts +19 -0
- package/esm/types/1_inline_query_result_button.js +19 -0
- package/esm/types/1_input_message_content.d.ts +19 -0
- package/esm/types/1_input_message_content.js +19 -0
- package/esm/types/1_input_story_content.d.ts +19 -0
- package/esm/types/1_input_story_content.js +19 -0
- package/esm/types/1_keyboard_button.d.ts +19 -0
- package/esm/types/1_keyboard_button.js +22 -3
- package/esm/types/1_message_reaction.d.ts +19 -0
- package/esm/types/1_message_reaction.js +21 -2
- package/esm/types/1_network_statistics.d.ts +19 -0
- package/esm/types/1_network_statistics.js +19 -0
- package/esm/types/1_photo.d.ts +19 -0
- package/esm/types/1_photo.js +19 -0
- package/esm/types/1_poll.d.ts +19 -0
- package/esm/types/1_poll.js +19 -0
- package/esm/types/1_reaction_count.d.ts +19 -0
- package/esm/types/1_reaction_count.js +19 -0
- package/esm/types/1_reply_quote.d.ts +19 -0
- package/esm/types/1_reply_quote.js +19 -0
- package/esm/types/1_sticker.d.ts +19 -0
- package/esm/types/1_sticker.js +19 -0
- package/esm/types/1_story_privacy.d.ts +19 -0
- package/esm/types/1_story_privacy.js +22 -3
- package/esm/types/1_story_reaction.d.ts +19 -0
- package/esm/types/1_story_reaction.js +19 -0
- package/esm/types/1_user.d.ts +19 -0
- package/esm/types/1_user.js +19 -0
- package/esm/types/1_venue.d.ts +19 -0
- package/esm/types/1_venue.js +19 -0
- package/esm/types/1_video.d.ts +19 -0
- package/esm/types/1_video.js +19 -0
- package/esm/types/1_video_note.d.ts +19 -0
- package/esm/types/1_video_note.js +19 -0
- package/esm/types/2_business_connection.d.ts +19 -0
- package/esm/types/2_business_connection.js +19 -0
- package/esm/types/2_chat_member.d.ts +19 -0
- package/esm/types/2_chat_member.js +25 -5
- package/esm/types/2_chosen_inline_result.d.ts +19 -0
- package/esm/types/2_chosen_inline_result.js +22 -2
- package/esm/types/2_game.d.ts +19 -0
- package/esm/types/2_game.js +19 -0
- package/esm/types/2_inactive_chat.d.ts +19 -0
- package/esm/types/2_inactive_chat.js +22 -2
- package/esm/types/2_inline_keyboard_button.d.ts +19 -0
- package/esm/types/2_inline_keyboard_button.js +22 -3
- package/esm/types/2_inline_query.d.ts +19 -0
- package/esm/types/2_inline_query.js +22 -3
- package/esm/types/2_invite_link.d.ts +19 -0
- package/esm/types/2_invite_link.js +22 -2
- package/esm/types/2_message_interactions.d.ts +19 -0
- package/esm/types/2_message_interactions.js +19 -0
- package/esm/types/2_message_reaction_count.d.ts +19 -0
- package/esm/types/2_message_reaction_count.js +19 -0
- package/esm/types/2_message_reactions.d.ts +19 -0
- package/esm/types/2_message_reactions.js +19 -0
- package/esm/types/2_story_content.d.ts +19 -0
- package/esm/types/2_story_content.js +24 -5
- package/esm/types/2_story_interactions.d.ts +19 -0
- package/esm/types/2_story_interactions.js +19 -0
- package/esm/types/2_story_interactive_area.d.ts +19 -0
- package/esm/types/2_story_interactive_area.js +24 -5
- package/esm/types/3_chat_member_updated.d.ts +19 -0
- package/esm/types/3_chat_member_updated.js +23 -3
- package/esm/types/3_reply_markup.d.ts +19 -0
- package/esm/types/3_reply_markup.js +23 -3
- package/esm/types/3_story.d.ts +19 -0
- package/esm/types/3_story.js +22 -2
- package/esm/types/4_inline_query_result.d.ts +19 -0
- package/esm/types/4_inline_query_result.js +24 -5
- package/esm/types/4_message.d.ts +19 -0
- package/esm/types/4_message.js +36 -16
- package/esm/types/5_callback_query.d.ts +19 -0
- package/esm/types/5_callback_query.js +23 -3
- package/esm/types/5_chat.d.ts +19 -0
- package/esm/types/5_chat.js +27 -7
- package/esm/types/6_update.d.ts +19 -0
- package/esm/types/6_update.js +19 -0
- package/esm/types/_file_id.d.ts +19 -0
- package/esm/types/_file_id.js +28 -8
- package/esm/types/_getters.d.ts +19 -0
- package/esm/types/_getters.js +19 -0
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +44 -0
- package/esm/utilities/0_buffer.d.ts +19 -0
- package/esm/utilities/0_buffer.js +19 -0
- package/esm/utilities/0_cache_map.d.ts +19 -0
- package/esm/utilities/0_cache_map.js +19 -0
- package/esm/utilities/0_color.d.ts +19 -0
- package/esm/utilities/0_color.js +19 -0
- package/esm/utilities/0_crypto.d.ts +19 -0
- package/esm/utilities/0_crypto.js +19 -0
- package/esm/utilities/0_hash.js +19 -0
- package/esm/utilities/0_logger.d.ts +27 -0
- package/esm/utilities/0_logger.js +28 -5
- package/esm/utilities/0_mutex.d.ts +19 -0
- package/esm/utilities/0_mutex.js +19 -0
- package/esm/utilities/0_object.d.ts +19 -0
- package/esm/utilities/0_object.js +19 -0
- package/esm/utilities/0_rle.d.ts +19 -0
- package/esm/utilities/0_rle.js +19 -0
- package/esm/utilities/0_types.d.ts +19 -0
- package/esm/utilities/0_types.js +19 -0
- package/esm/utilities/1_auth.js +19 -0
- package/esm/utilities/1_base64.d.ts +19 -0
- package/esm/utilities/1_base64.js +19 -0
- package/esm/utilities/1_math.d.ts +20 -0
- package/esm/utilities/1_math.js +70 -0
- package/esm/utilities/1_misc.d.ts +19 -0
- package/esm/utilities/1_misc.js +21 -2
- package/esm/utilities/1_queue.d.ts +19 -0
- package/esm/utilities/1_queue.js +19 -0
- package/package.json +1 -1
- package/script/0_deps.d.ts +20 -1
- package/script/0_deps.js +22 -3
- package/script/0_errors.d.ts +19 -0
- package/script/0_errors.js +19 -0
- package/script/1_utilities.d.ts +20 -1
- package/script/1_utilities.js +20 -1
- package/script/2_connection.d.ts +19 -0
- package/script/2_connection.js +19 -0
- package/script/2_tl.d.ts +19 -0
- package/script/2_tl.js +19 -0
- package/script/3_errors.d.ts +19 -0
- package/script/3_errors.js +19 -0
- package/script/3_storage.d.ts +19 -0
- package/script/3_storage.js +19 -0
- package/script/3_transport.d.ts +19 -0
- package/script/3_transport.js +19 -0
- package/script/3_types.d.ts +19 -0
- package/script/3_types.js +19 -0
- package/script/4_constants.js +19 -0
- package/script/4_errors.d.ts +19 -0
- package/script/4_errors.js +22 -3
- package/script/5_client.d.ts +19 -0
- package/script/5_client.js +19 -0
- package/script/client/0_client_abstract.d.ts +19 -0
- package/script/client/0_client_abstract.js +19 -0
- package/script/client/0_filters.d.ts +19 -0
- package/script/client/0_filters.js +19 -0
- package/script/client/0_html.d.ts +19 -0
- package/script/client/0_html.js +19 -0
- package/script/client/0_markdown.js +5 -5
- package/script/client/0_message.d.ts +19 -0
- package/script/client/0_message.js +19 -0
- package/script/client/0_params.d.ts +19 -0
- package/script/client/0_params.js +19 -0
- package/script/client/0_password.js +19 -0
- package/script/client/0_types.d.ts +19 -0
- package/script/client/0_types.js +19 -0
- package/script/client/0_utilities.d.ts +7 -0
- package/script/client/0_utilities.js +73 -4
- package/script/client/1_account_manager.d.ts +19 -0
- package/script/client/1_account_manager.js +23 -4
- package/script/client/1_bot_info_manager.d.ts +19 -0
- package/script/client/1_bot_info_manager.js +19 -0
- package/script/client/1_business_connection_manager.d.ts +19 -0
- package/script/client/1_business_connection_manager.js +19 -0
- package/script/client/1_client_encrypted.d.ts +19 -0
- package/script/client/1_client_encrypted.js +21 -2
- package/script/client/1_client_plain.d.ts +19 -0
- package/script/client/1_client_plain.js +21 -2
- package/script/client/1_composer.d.ts +19 -0
- package/script/client/1_composer.js +19 -0
- package/script/client/1_file_manager.d.ts +19 -0
- package/script/client/1_file_manager.js +24 -4
- package/script/client/1_network_statistics_manager.d.ts +19 -0
- package/script/client/1_network_statistics_manager.js +19 -0
- package/script/client/1_reaction_manager.d.ts +19 -0
- package/script/client/1_reaction_manager.js +21 -2
- package/script/client/1_update_manager.d.ts +19 -0
- package/script/client/1_update_manager.js +27 -7
- package/script/client/2_message_manager.d.ts +19 -0
- package/script/client/2_message_manager.js +70 -28
- package/script/client/3_callback_query_manager.d.ts +19 -0
- package/script/client/3_callback_query_manager.js +21 -0
- package/script/client/3_chat_list_manager.d.ts +19 -0
- package/script/client/3_chat_list_manager.js +31 -11
- package/script/client/3_inline_query_manager.d.ts +19 -0
- package/script/client/3_inline_query_manager.js +23 -2
- package/script/client/3_story_manager.d.ts +19 -0
- package/script/client/3_story_manager.js +23 -2
- package/script/client/4_client.d.ts +19 -0
- package/script/client/4_client.js +35 -15
- package/script/connection/0_connection.d.ts +19 -0
- package/script/connection/0_connection.js +19 -0
- package/script/connection/1_connection_web_socket.js +21 -1
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +83 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +207 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +50 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +301 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +47 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +55 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +66 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +222 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +168 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +404 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +159 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +438 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +181 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +1052 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +42 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +88 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +11 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +128 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +1 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +30 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +46 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +31 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +32 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +2128 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +2129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +109 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +110 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +8 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +3 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +90 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +114 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +50 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +134 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +46 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +118 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +42 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +129 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +6 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +22 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +54 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +119 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +40 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +86 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +58 -0
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +112 -0
- package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
- package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.d.ts +2 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/deflate.js +7 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.d.ts +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/inflate.js +7 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/crc32.js +1 -1
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/deflate.js +8 -8
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inffast.js +2 -2
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/inflate.js +19 -21
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/main/zlib/zlib/trees.js +3 -3
- package/script/mod.d.ts +20 -1
- package/script/mod.js +21 -1
- package/script/storage/0_storage.d.ts +19 -0
- package/script/storage/0_storage.js +24 -4
- package/script/storage/1_utilities.d.ts +19 -1
- package/script/storage/1_utilities.js +22 -4
- package/script/storage/2_storage_indexed_db.d.ts +19 -0
- package/script/storage/2_storage_indexed_db.js +19 -0
- package/script/storage/2_storage_local_storage.d.ts +19 -0
- package/script/storage/2_storage_local_storage.js +19 -3
- package/script/storage/2_storage_memory.d.ts +19 -0
- package/script/storage/2_storage_memory.js +19 -0
- package/script/storage/2_storage_session_storage.d.ts +19 -0
- package/script/storage/2_storage_session_storage.js +19 -3
- package/script/tl/0_tl_raw_reader.d.ts +19 -0
- package/script/tl/0_tl_raw_reader.js +19 -0
- package/script/tl/0_tl_raw_writer.d.ts +19 -0
- package/script/tl/0_tl_raw_writer.js +19 -0
- package/script/tl/1_tl_object.d.ts +19 -0
- package/script/tl/1_tl_object.js +19 -0
- package/script/tl/2_types.d.ts +19 -0
- package/script/tl/2_types.js +19 -0
- package/script/tl/3_deserialize.d.ts +19 -0
- package/script/tl/3_deserialize.js +19 -0
- package/script/tl/3_functions.d.ts +19 -0
- package/script/tl/3_functions.js +19 -0
- package/script/tl/3_utilities.d.ts +19 -0
- package/script/tl/3_utilities.js +23 -3
- package/script/tl/4_tl_reader.d.ts +19 -0
- package/script/tl/4_tl_reader.js +19 -0
- package/script/tl/5_tl_writer.d.ts +19 -0
- package/script/tl/5_tl_writer.js +19 -0
- package/script/tl/6_rpc_result.d.ts +19 -0
- package/script/tl/6_rpc_result.js +19 -0
- package/script/tl/7_message.d.ts +19 -0
- package/script/tl/7_message.js +19 -0
- package/script/tl/8_message_container.d.ts +19 -0
- package/script/tl/8_message_container.js +19 -0
- package/script/transport/0_obfuscation.js +19 -0
- package/script/transport/0_transport.d.ts +19 -0
- package/script/transport/0_transport.js +19 -0
- package/script/transport/1_transport_abridged.d.ts +19 -0
- package/script/transport/1_transport_abridged.js +19 -0
- package/script/transport/1_transport_intermediate.d.ts +19 -0
- package/script/transport/1_transport_intermediate.js +19 -0
- package/script/transport/2_transport_provider.d.ts +19 -0
- package/script/transport/2_transport_provider.js +23 -4
- package/script/transport/3_transport_provider_web_socket.d.ts +19 -0
- package/script/transport/3_transport_provider_web_socket.js +19 -0
- package/script/types/0_authorization_state.d.ts +19 -0
- package/script/types/0_authorization_state.js +19 -0
- package/script/types/0_bot_command.d.ts +19 -0
- package/script/types/0_bot_command.js +19 -0
- package/script/types/0_chat_action.d.ts +19 -0
- package/script/types/0_chat_action.js +19 -0
- package/script/types/0_chat_administrator_rights.d.ts +19 -0
- package/script/types/0_chat_administrator_rights.js +19 -0
- package/script/types/0_chat_member_rights.d.ts +19 -0
- package/script/types/0_chat_member_rights.js +19 -0
- package/script/types/0_chat_photo.d.ts +19 -1
- package/script/types/0_chat_photo.js +19 -2
- package/script/types/0_connection_state.d.ts +19 -0
- package/script/types/0_connection_state.js +19 -0
- package/script/types/0_contact.d.ts +19 -0
- package/script/types/0_contact.js +19 -0
- package/script/types/0_dice.d.ts +19 -0
- package/script/types/0_dice.js +19 -0
- package/script/types/0_file_source.d.ts +19 -0
- package/script/types/0_file_source.js +19 -0
- package/script/types/0_giveaway_parameters.d.ts +19 -0
- package/script/types/0_giveaway_parameters.js +19 -0
- package/script/types/0_id.d.ts +19 -0
- package/script/types/0_id.js +19 -0
- package/script/types/0_keyboard_button_poll_type.d.ts +19 -0
- package/script/types/0_keyboard_button_poll_type.js +19 -0
- package/script/types/0_link_preview.d.ts +19 -0
- package/script/types/0_link_preview.js +19 -0
- package/script/types/0_location.d.ts +19 -0
- package/script/types/0_location.js +19 -0
- package/script/types/0_login_url.d.ts +19 -0
- package/script/types/0_login_url.js +19 -0
- package/script/types/0_mask_position.d.ts +19 -0
- package/script/types/0_mask_position.js +19 -0
- package/script/types/0_message_entity.d.ts +19 -0
- package/script/types/0_message_entity.js +22 -3
- package/script/types/0_message_reference.d.ts +19 -0
- package/script/types/0_message_reference.js +19 -0
- package/script/types/0_message_search_filter.d.ts +19 -0
- package/script/types/0_message_search_filter.js +21 -2
- package/script/types/0_mini_app_info.d.ts +19 -0
- package/script/types/0_mini_app_info.js +19 -0
- package/script/types/0_network_statistics_entry.d.ts +19 -0
- package/script/types/0_network_statistics_entry.js +19 -0
- package/script/types/0_parse_mode.d.ts +19 -0
- package/script/types/0_parse_mode.js +19 -0
- package/script/types/0_poll_option.d.ts +19 -0
- package/script/types/0_poll_option.js +19 -0
- package/script/types/0_price_tag.d.ts +19 -0
- package/script/types/0_price_tag.js +19 -0
- package/script/types/0_reaction.d.ts +19 -0
- package/script/types/0_reaction.js +21 -2
- package/script/types/0_restriction_reason.d.ts +19 -0
- package/script/types/0_restriction_reason.js +19 -0
- package/script/types/0_story_reference.d.ts +19 -0
- package/script/types/0_story_reference.js +19 -0
- package/script/types/0_thumbnail.d.ts +19 -0
- package/script/types/0_thumbnail.js +19 -0
- package/script/types/0_voice.d.ts +19 -0
- package/script/types/0_voice.js +19 -0
- package/script/types/1_animation.d.ts +19 -0
- package/script/types/1_animation.js +19 -0
- package/script/types/1_audio.d.ts +19 -0
- package/script/types/1_audio.js +19 -0
- package/script/types/1_bot_command_scope.d.ts +19 -0
- package/script/types/1_bot_command_scope.js +22 -3
- package/script/types/1_chat_p.d.ts +19 -0
- package/script/types/1_chat_p.js +21 -1
- package/script/types/1_document.d.ts +19 -0
- package/script/types/1_document.js +19 -0
- package/script/types/1_giveaway.d.ts +19 -0
- package/script/types/1_giveaway.js +19 -0
- package/script/types/1_inline_query_result_button.d.ts +19 -0
- package/script/types/1_inline_query_result_button.js +19 -0
- package/script/types/1_input_message_content.d.ts +19 -0
- package/script/types/1_input_message_content.js +19 -0
- package/script/types/1_input_story_content.d.ts +19 -0
- package/script/types/1_input_story_content.js +19 -0
- package/script/types/1_keyboard_button.d.ts +19 -0
- package/script/types/1_keyboard_button.js +22 -3
- package/script/types/1_message_reaction.d.ts +19 -0
- package/script/types/1_message_reaction.js +21 -2
- package/script/types/1_network_statistics.d.ts +19 -0
- package/script/types/1_network_statistics.js +19 -0
- package/script/types/1_photo.d.ts +19 -0
- package/script/types/1_photo.js +19 -0
- package/script/types/1_poll.d.ts +19 -0
- package/script/types/1_poll.js +19 -0
- package/script/types/1_reaction_count.d.ts +19 -0
- package/script/types/1_reaction_count.js +19 -0
- package/script/types/1_reply_quote.d.ts +19 -0
- package/script/types/1_reply_quote.js +19 -0
- package/script/types/1_sticker.d.ts +19 -0
- package/script/types/1_sticker.js +19 -0
- package/script/types/1_story_privacy.d.ts +19 -0
- package/script/types/1_story_privacy.js +22 -3
- package/script/types/1_story_reaction.d.ts +19 -0
- package/script/types/1_story_reaction.js +19 -0
- package/script/types/1_user.d.ts +19 -0
- package/script/types/1_user.js +19 -0
- package/script/types/1_venue.d.ts +19 -0
- package/script/types/1_venue.js +19 -0
- package/script/types/1_video.d.ts +19 -0
- package/script/types/1_video.js +19 -0
- package/script/types/1_video_note.d.ts +19 -0
- package/script/types/1_video_note.js +19 -0
- package/script/types/2_business_connection.d.ts +19 -0
- package/script/types/2_business_connection.js +19 -0
- package/script/types/2_chat_member.d.ts +19 -0
- package/script/types/2_chat_member.js +24 -4
- package/script/types/2_chosen_inline_result.d.ts +19 -0
- package/script/types/2_chosen_inline_result.js +21 -1
- package/script/types/2_game.d.ts +19 -0
- package/script/types/2_game.js +19 -0
- package/script/types/2_inactive_chat.d.ts +19 -0
- package/script/types/2_inactive_chat.js +21 -1
- package/script/types/2_inline_keyboard_button.d.ts +19 -0
- package/script/types/2_inline_keyboard_button.js +22 -3
- package/script/types/2_inline_query.d.ts +19 -0
- package/script/types/2_inline_query.js +22 -3
- package/script/types/2_invite_link.d.ts +19 -0
- package/script/types/2_invite_link.js +21 -1
- package/script/types/2_message_interactions.d.ts +19 -0
- package/script/types/2_message_interactions.js +19 -0
- package/script/types/2_message_reaction_count.d.ts +19 -0
- package/script/types/2_message_reaction_count.js +19 -0
- package/script/types/2_message_reactions.d.ts +19 -0
- package/script/types/2_message_reactions.js +19 -0
- package/script/types/2_story_content.d.ts +19 -0
- package/script/types/2_story_content.js +24 -5
- package/script/types/2_story_interactions.d.ts +19 -0
- package/script/types/2_story_interactions.js +19 -0
- package/script/types/2_story_interactive_area.d.ts +19 -0
- package/script/types/2_story_interactive_area.js +24 -5
- package/script/types/3_chat_member_updated.d.ts +19 -0
- package/script/types/3_chat_member_updated.js +22 -2
- package/script/types/3_reply_markup.d.ts +19 -0
- package/script/types/3_reply_markup.js +22 -2
- package/script/types/3_story.d.ts +19 -0
- package/script/types/3_story.js +21 -1
- package/script/types/4_inline_query_result.d.ts +19 -0
- package/script/types/4_inline_query_result.js +24 -5
- package/script/types/4_message.d.ts +19 -0
- package/script/types/4_message.js +35 -15
- package/script/types/5_callback_query.d.ts +19 -0
- package/script/types/5_callback_query.js +22 -2
- package/script/types/5_chat.d.ts +19 -0
- package/script/types/5_chat.js +26 -6
- package/script/types/6_update.d.ts +19 -0
- package/script/types/6_update.js +19 -0
- package/script/types/_file_id.d.ts +19 -0
- package/script/types/_file_id.js +27 -7
- package/script/types/_getters.d.ts +19 -0
- package/script/types/_getters.js +19 -0
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +46 -1
- package/script/utilities/0_buffer.d.ts +19 -0
- package/script/utilities/0_buffer.js +19 -0
- package/script/utilities/0_cache_map.d.ts +19 -0
- package/script/utilities/0_cache_map.js +19 -0
- package/script/utilities/0_color.d.ts +19 -0
- package/script/utilities/0_color.js +19 -0
- package/script/utilities/0_crypto.d.ts +19 -0
- package/script/utilities/0_crypto.js +19 -0
- package/script/utilities/0_hash.js +19 -0
- package/script/utilities/0_logger.d.ts +27 -0
- package/script/utilities/0_logger.js +30 -6
- package/script/utilities/0_mutex.d.ts +19 -0
- package/script/utilities/0_mutex.js +19 -0
- package/script/utilities/0_object.d.ts +19 -0
- package/script/utilities/0_object.js +19 -0
- package/script/utilities/0_rle.d.ts +19 -0
- package/script/utilities/0_rle.js +19 -0
- package/script/utilities/0_types.d.ts +19 -0
- package/script/utilities/0_types.js +19 -0
- package/script/utilities/1_auth.js +19 -0
- package/script/utilities/1_base64.d.ts +19 -0
- package/script/utilities/1_base64.js +19 -0
- package/script/utilities/1_math.d.ts +20 -0
- package/script/utilities/1_math.js +74 -0
- package/script/utilities/1_misc.d.ts +19 -0
- package/script/utilities/1_misc.js +21 -2
- package/script/utilities/1_queue.d.ts +19 -0
- package/script/utilities/1_queue.js +19 -0
- package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
- package/esm/utilities/0_control.d.ts +0 -1
- package/esm/utilities/0_control.js +0 -3
- package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
- package/script/utilities/0_control.d.ts +0 -1
- package/script/utilities/0_control.js +0 -7
- /package/{LICENSE → COPYING.LESSER} +0 -0
- /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
|
@@ -1,4 +1,23 @@
|
|
|
1
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
|
+
*/
|
|
2
21
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
22
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
23
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -28,7 +47,7 @@ class StoryManager {
|
|
|
28
47
|
async createStory(chatId, content, params) {
|
|
29
48
|
await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("createStory");
|
|
30
49
|
let media = null;
|
|
31
|
-
const source = "video" in content ? content.video : "photo" in content ? content.photo : (0,
|
|
50
|
+
const source = "video" in content ? content.video : "photo" in content ? content.photo : (0, _0_deps_js_1.unreachable)();
|
|
32
51
|
if (typeof source === "string") {
|
|
33
52
|
const fileId = __classPrivateFieldGet(this, _StoryManager_c, "f").messageManager.resolveFileId(source, _3_types_js_1.FileType.Photo);
|
|
34
53
|
if (fileId != null) {
|
|
@@ -87,6 +106,7 @@ class StoryManager {
|
|
|
87
106
|
}
|
|
88
107
|
async getStories(chatId, storyIds) {
|
|
89
108
|
await __classPrivateFieldGet(this, _StoryManager_c, "f").storage.assertUser("getStories");
|
|
109
|
+
(0, _0_utilities_js_1.checkArray)(storyIds, _0_utilities_js_1.checkStoryId);
|
|
90
110
|
const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
|
|
91
111
|
const stories_ = await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.getStoriesByID({ peer, id: storyIds });
|
|
92
112
|
const stories = new Array();
|
|
@@ -150,8 +170,9 @@ _StoryManager_c = new WeakMap(), _StoryManager_instances = new WeakSet(), _Story
|
|
|
150
170
|
return await (0, _3_types_js_1.constructStory)(updateStory.story, updateStory.peer, __classPrivateFieldGet(this, _StoryManager_c, "f").getEntity);
|
|
151
171
|
}
|
|
152
172
|
}
|
|
153
|
-
(0,
|
|
173
|
+
(0, _0_deps_js_1.unreachable)();
|
|
154
174
|
}, _StoryManager_togglePinned = async function _StoryManager_togglePinned(chatId, storyIds, pinned) {
|
|
175
|
+
(0, _0_utilities_js_1.checkArray)(storyIds, _0_utilities_js_1.checkStoryId);
|
|
155
176
|
const peer = await __classPrivateFieldGet(this, _StoryManager_c, "f").getInputPeer(chatId);
|
|
156
177
|
await __classPrivateFieldGet(this, _StoryManager_c, "f").api.stories.togglePinned({ peer, id: storyIds, pinned });
|
|
157
178
|
};
|
|
@@ -1,3 +1,22 @@
|
|
|
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
|
+
*/
|
|
1
20
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
21
|
import { enums, functions, types } from "../2_tl.js";
|
|
3
22
|
import { Storage } from "../3_storage.js";
|
|
@@ -1,4 +1,23 @@
|
|
|
1
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
|
+
*/
|
|
2
21
|
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
22
|
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
23
|
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
@@ -13,6 +32,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
32
|
var _Client_instances, _Client_client, _Client_guaranteeUpdateDelivery, _Client_updateManager, _Client_networkStatisticsManager, _Client_botInfoManager, _Client_fileManager, _Client_reactionManager, _Client_businessConnectionManager, _Client_messageManager, _Client_storyManager, _Client_callbackQueryManager, _Client_inlineQueryManager, _Client_chatListManager, _Client_accountManager, _Client_parseMode, _Client_publicKeys, _Client_ignoreOutgoing, _Client_storeMessages, _Client_Lauthorize, _Client_LpingLoop, _Client_LhandleMigrationError, _Client_L$initConncetion, _Client_namespaceProxies, _Client_getApiId, _Client_constructContext, _Client_propagateConnectionState, _Client_lastPropagatedConnectionState, _Client_stateChangeHandler, _Client_storageInited, _Client_initStorage, _Client_connectionInited, _Client_lastPropagatedAuthorizationState, _Client_propagateAuthorizationState, _Client_getSelfId, _Client_pingLoopStarted, _Client_pingLoopAbortController, _Client_pingInterval, _Client_lastUpdates, _Client_startPingLoop, _Client_pingLoop, _Client_invoke, _Client_handleInvokeError, _Client_getUserAccessHash, _Client_getChannelAccessHash, _Client_getInputPeerInner, _Client_handleCtxUpdate, _Client_queueHandleCtxUpdate, _Client_handleUpdate, _Client_lastGetMe, _Client_getMe;
|
|
14
33
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
34
|
exports.Client = exports.handleMigrationError = exports.restartAuth = exports.Composer = void 0;
|
|
35
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
16
36
|
const _0_errors_js_1 = require("../0_errors.js");
|
|
17
37
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
18
38
|
const _2_tl_js_1 = require("../2_tl.js");
|
|
@@ -164,7 +184,7 @@ class Client extends Composer {
|
|
|
164
184
|
};
|
|
165
185
|
}
|
|
166
186
|
else {
|
|
167
|
-
(0,
|
|
187
|
+
(0, _0_deps_js_1.unreachable)();
|
|
168
188
|
}
|
|
169
189
|
}
|
|
170
190
|
},
|
|
@@ -212,7 +232,7 @@ class Client extends Composer {
|
|
|
212
232
|
return { chatId: reactions.chatId, messageId: reactions.messageId };
|
|
213
233
|
}
|
|
214
234
|
else {
|
|
215
|
-
(0,
|
|
235
|
+
(0, _0_deps_js_1.unreachable)();
|
|
216
236
|
}
|
|
217
237
|
};
|
|
218
238
|
const mustGetUserId = () => {
|
|
@@ -226,7 +246,7 @@ class Client extends Composer {
|
|
|
226
246
|
return update.chosenInlineResult.from.id;
|
|
227
247
|
}
|
|
228
248
|
else {
|
|
229
|
-
(0,
|
|
249
|
+
(0, _0_deps_js_1.unreachable)();
|
|
230
250
|
}
|
|
231
251
|
};
|
|
232
252
|
const mustGetInlineMsgId = () => {
|
|
@@ -240,7 +260,7 @@ class Client extends Composer {
|
|
|
240
260
|
return update.callbackQuery.inlineMessageId;
|
|
241
261
|
}
|
|
242
262
|
}
|
|
243
|
-
(0,
|
|
263
|
+
(0, _0_deps_js_1.unreachable)();
|
|
244
264
|
};
|
|
245
265
|
const chat_ = "messageReactions" in update ? update.messageReactions.chat : "messageReactionCount" in update ? update.messageReactionCount.chat : undefined;
|
|
246
266
|
const chat = chat_ ?? msg?.chat;
|
|
@@ -353,21 +373,21 @@ class Client extends Composer {
|
|
|
353
373
|
banSender: (params) => {
|
|
354
374
|
const { chatId, senderId } = mustGetMsg();
|
|
355
375
|
if (!senderId) {
|
|
356
|
-
(0,
|
|
376
|
+
(0, _0_deps_js_1.unreachable)();
|
|
357
377
|
}
|
|
358
378
|
return this.banChatMember(chatId, senderId, params);
|
|
359
379
|
},
|
|
360
380
|
kickSender: () => {
|
|
361
381
|
const { chatId, senderId } = mustGetMsg();
|
|
362
382
|
if (!senderId) {
|
|
363
|
-
(0,
|
|
383
|
+
(0, _0_deps_js_1.unreachable)();
|
|
364
384
|
}
|
|
365
385
|
return this.kickChatMember(chatId, senderId);
|
|
366
386
|
},
|
|
367
387
|
setSenderRights: (params) => {
|
|
368
388
|
const { chatId, senderId } = mustGetMsg();
|
|
369
389
|
if (!senderId) {
|
|
370
|
-
(0,
|
|
390
|
+
(0, _0_deps_js_1.unreachable)();
|
|
371
391
|
}
|
|
372
392
|
return this.setChatMemberRights(chatId, senderId, params);
|
|
373
393
|
},
|
|
@@ -381,13 +401,13 @@ class Client extends Composer {
|
|
|
381
401
|
},
|
|
382
402
|
answerCallbackQuery: (params) => {
|
|
383
403
|
if (!("callbackQuery" in update)) {
|
|
384
|
-
(0,
|
|
404
|
+
(0, _0_deps_js_1.unreachable)();
|
|
385
405
|
}
|
|
386
406
|
return this.answerCallbackQuery(update.callbackQuery.id, params);
|
|
387
407
|
},
|
|
388
408
|
answerInlineQuery: (results, params) => {
|
|
389
409
|
if (!("inlineQuery" in update)) {
|
|
390
|
-
(0,
|
|
410
|
+
(0, _0_deps_js_1.unreachable)();
|
|
391
411
|
}
|
|
392
412
|
return this.answerInlineQuery(update.inlineQuery.id, results, params);
|
|
393
413
|
},
|
|
@@ -540,7 +560,7 @@ class Client extends Composer {
|
|
|
540
560
|
getBusinessConnection: () => {
|
|
541
561
|
const { businessConnectionId } = mustGetMsg();
|
|
542
562
|
if (!businessConnectionId) {
|
|
543
|
-
(0,
|
|
563
|
+
(0, _0_deps_js_1.unreachable)();
|
|
544
564
|
}
|
|
545
565
|
return this.getBusinessConnection(businessConnectionId);
|
|
546
566
|
},
|
|
@@ -1069,7 +1089,7 @@ class Client extends Composer {
|
|
|
1069
1089
|
inputPeer.access_hash = await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getUserAccessHash).call(this, inputPeer.user_id);
|
|
1070
1090
|
}
|
|
1071
1091
|
}
|
|
1072
|
-
if ((inputPeer instanceof _2_tl_js_1.types.InputPeerUser || inputPeer instanceof _2_tl_js_1.types.InputPeerChannel && inputPeer.access_hash == 0n
|
|
1092
|
+
if ((inputPeer instanceof _2_tl_js_1.types.InputPeerUser || inputPeer instanceof _2_tl_js_1.types.InputPeerChannel) && inputPeer.access_hash == 0n && await this.storage.getAccountType() == "user") {
|
|
1073
1093
|
throw new _0_errors_js_1.AccessError(`Cannot access the chat ${id} because there is no access hash for it.`);
|
|
1074
1094
|
}
|
|
1075
1095
|
return inputPeer;
|
|
@@ -1125,7 +1145,7 @@ class Client extends Composer {
|
|
|
1125
1145
|
if (!this.connected) {
|
|
1126
1146
|
continue;
|
|
1127
1147
|
}
|
|
1128
|
-
__classPrivateFieldGet(this, _Client_pingLoopAbortController, "f")
|
|
1148
|
+
__classPrivateFieldGet(this, _Client_pingLoopAbortController, "f")?.signal.throwIfAborted();
|
|
1129
1149
|
await this.api.ping_delay_disconnect({ ping_id: (0, _1_utilities_js_1.getRandomId)(), disconnect_delay: __classPrivateFieldGet(this, _Client_pingInterval, "f") / 1000 + 15 });
|
|
1130
1150
|
if (Date.now() - __classPrivateFieldGet(this, _Client_lastUpdates, "f").getTime() >= 15 * 60 * 1000) {
|
|
1131
1151
|
(0, _1_utilities_js_1.drop)(__classPrivateFieldGet(this, _Client_updateManager, "f").recoverUpdateGap("lastUpdates"));
|
|
@@ -1142,7 +1162,7 @@ class Client extends Composer {
|
|
|
1142
1162
|
let n = 1;
|
|
1143
1163
|
while (true) {
|
|
1144
1164
|
try {
|
|
1145
|
-
if (function_ instanceof _2_tl_js_1.functions.Function && !__classPrivateFieldGet(this, _Client_connectionInited, "f")) {
|
|
1165
|
+
if (function_ instanceof _2_tl_js_1.functions.Function && !__classPrivateFieldGet(this, _Client_connectionInited, "f") && !(0, _0_utilities_js_1.isMtprotoFunction)(function_)) {
|
|
1146
1166
|
const result = await __classPrivateFieldGet(this, _Client_client, "f").invoke(new _2_tl_js_1.functions.initConnection({
|
|
1147
1167
|
api_id: await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getApiId).call(this),
|
|
1148
1168
|
app_version: this.appVersion,
|
|
@@ -1221,7 +1241,7 @@ class Client extends Composer {
|
|
|
1221
1241
|
resolvedId = (0, _2_tl_js_1.peerToChatId)(resolved.peer);
|
|
1222
1242
|
}
|
|
1223
1243
|
else {
|
|
1224
|
-
(0,
|
|
1244
|
+
(0, _0_deps_js_1.unreachable)();
|
|
1225
1245
|
}
|
|
1226
1246
|
}
|
|
1227
1247
|
const resolvedIdType = (0, _2_tl_js_1.getChatIdPeerType)(resolvedId);
|
|
@@ -1234,7 +1254,7 @@ class Client extends Composer {
|
|
|
1234
1254
|
return new _2_tl_js_1.types.InputPeerChannel({ channel_id: (0, _2_tl_js_1.chatIdToPeerId)(resolvedId), access_hash: accessHash ?? 0n });
|
|
1235
1255
|
}
|
|
1236
1256
|
else {
|
|
1237
|
-
(0,
|
|
1257
|
+
(0, _0_deps_js_1.unreachable)();
|
|
1238
1258
|
}
|
|
1239
1259
|
}
|
|
1240
1260
|
else if (id > 0) {
|
|
@@ -1,3 +1,22 @@
|
|
|
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
|
+
*/
|
|
1
20
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
21
|
declare abstract class Foundation {
|
|
3
22
|
abstract get connected(): boolean;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
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
|
+
*/
|
|
2
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
22
|
exports.ConnectionFramed = exports.ConnectionUnframed = void 0;
|
|
4
23
|
class Foundation {
|
|
@@ -36,7 +36,27 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
36
36
|
var _ConnectionWebSocket_instances, _ConnectionWebSocket_webSocket, _ConnectionWebSocket_rMutex, _ConnectionWebSocket_wMutex, _ConnectionWebSocket_buffer, _ConnectionWebSocket_nextResolve, _ConnectionWebSocket_initWs, _ConnectionWebSocket_wasConnected, _ConnectionWebSocket_isConnecting, _ConnectionWebSocket_connectionError, _ConnectionWebSocket_assertConnected, _ConnectionWebSocket_rejectRead;
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
38
|
exports.ConnectionWebSocket = void 0;
|
|
39
|
+
/**
|
|
40
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
41
|
+
* Copyright (C) 2023-2024 Roj <https://roj.im/>
|
|
42
|
+
*
|
|
43
|
+
* This file is part of MTKruto.
|
|
44
|
+
*
|
|
45
|
+
* This program is free software: you can redistribute it and/or modify
|
|
46
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
47
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
48
|
+
* (at your option) any later version.
|
|
49
|
+
*
|
|
50
|
+
* This program is distributed in the hope that it will be useful,
|
|
51
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
52
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
53
|
+
* GNU Lesser General Public License for more details.
|
|
54
|
+
*
|
|
55
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
56
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
57
|
+
*/
|
|
39
58
|
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
59
|
+
const _0_deps_js_1 = require("../0_deps.js");
|
|
40
60
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
41
61
|
const _0_connection_js_1 = require("./0_connection.js");
|
|
42
62
|
const L = (0, _1_utilities_js_1.getLogger)("ConnectionWebSocket");
|
|
@@ -142,7 +162,7 @@ _ConnectionWebSocket_webSocket = new WeakMap(), _ConnectionWebSocket_rMutex = ne
|
|
|
142
162
|
return;
|
|
143
163
|
}
|
|
144
164
|
const unlock = await mutex.lock();
|
|
145
|
-
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : (0,
|
|
165
|
+
const data = new Uint8Array(await new Blob([e.data].map((v) => v instanceof Blob || v instanceof Uint8Array ? v : v instanceof ArrayBuffer ? v : (0, _0_deps_js_1.unreachable)())).arrayBuffer());
|
|
146
166
|
__classPrivateFieldSet(this, _ConnectionWebSocket_buffer, (0, _1_utilities_js_1.concat)(__classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f"), data), "f");
|
|
147
167
|
if (__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f") != null && __classPrivateFieldGet(this, _ConnectionWebSocket_buffer, "f").length >= __classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[0]) {
|
|
148
168
|
__classPrivateFieldGet(this, _ConnectionWebSocket_nextResolve, "f")[1].resolve();
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Node, Element, Document, NodeWithChildren, DataNode } from './Node.js';
|
|
2
|
+
export interface DomHandlerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Add a `startIndex` property to nodes.
|
|
5
|
+
* When the parser is used in a non-streaming fashion, `startIndex` is an integer
|
|
6
|
+
* indicating the position of the start of the node in the document.
|
|
7
|
+
*
|
|
8
|
+
* @default false
|
|
9
|
+
*/
|
|
10
|
+
withStartIndices?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Add an `endIndex` property to nodes.
|
|
13
|
+
* When the parser is used in a non-streaming fashion, `endIndex` is an integer
|
|
14
|
+
* indicating the position of the end of the node in the document.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
withEndIndices?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Replace all whitespace with single spaces.
|
|
21
|
+
*
|
|
22
|
+
* **Note:** Enabling this might break your markup.
|
|
23
|
+
*
|
|
24
|
+
* @default false
|
|
25
|
+
* @deprecated
|
|
26
|
+
*/
|
|
27
|
+
normalizeWhitespace?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Treat the markup as XML.
|
|
30
|
+
*
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
xmlMode?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface ParserInterface {
|
|
36
|
+
startIndex: number | null;
|
|
37
|
+
endIndex: number | null;
|
|
38
|
+
}
|
|
39
|
+
type Callback = (error: Error | null, dom: Node[]) => void;
|
|
40
|
+
type ElementCallback = (element: Element) => void;
|
|
41
|
+
export declare class DomHandler {
|
|
42
|
+
/** The elements of the DOM */
|
|
43
|
+
dom: Node[];
|
|
44
|
+
/** The root element for the DOM */
|
|
45
|
+
root: Document;
|
|
46
|
+
/** Called once parsing has completed. */
|
|
47
|
+
private readonly callback;
|
|
48
|
+
/** Settings for the handler. */
|
|
49
|
+
private readonly options;
|
|
50
|
+
/** Callback whenever a tag is closed. */
|
|
51
|
+
private readonly elementCB;
|
|
52
|
+
/** Indicated whether parsing has been completed. */
|
|
53
|
+
private done;
|
|
54
|
+
/** Stack of open tags. */
|
|
55
|
+
protected tagStack: NodeWithChildren[];
|
|
56
|
+
/** A data node that is still being written to. */
|
|
57
|
+
protected lastNode: DataNode | null;
|
|
58
|
+
/** Reference to the parser instance. Used for location information. */
|
|
59
|
+
private parser;
|
|
60
|
+
/**
|
|
61
|
+
* @param callback Called once parsing has completed.
|
|
62
|
+
* @param options Settings for the handler.
|
|
63
|
+
* @param elementCB Callback whenever a tag is closed.
|
|
64
|
+
*/
|
|
65
|
+
constructor(callback?: Callback | null, options?: DomHandlerOptions | null, elementCB?: ElementCallback);
|
|
66
|
+
onparserinit(parser: ParserInterface): void;
|
|
67
|
+
onreset(): void;
|
|
68
|
+
onend(): void;
|
|
69
|
+
onerror(error: Error): void;
|
|
70
|
+
onclosetag(): void;
|
|
71
|
+
onopentag(name: string, attribs: {
|
|
72
|
+
[key: string]: string;
|
|
73
|
+
}): void;
|
|
74
|
+
ontext(data: string): void;
|
|
75
|
+
oncomment(data: string): void;
|
|
76
|
+
oncommentend(): void;
|
|
77
|
+
oncdatastart(): void;
|
|
78
|
+
oncdataend(): void;
|
|
79
|
+
onprocessinginstruction(name: string, data: string): void;
|
|
80
|
+
protected handleCallback(error: Error | null): void;
|
|
81
|
+
protected addNode(node: Node): void;
|
|
82
|
+
}
|
|
83
|
+
export default DomHandler;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DomHandler = void 0;
|
|
4
|
+
const Node_js_1 = require("./Node.js");
|
|
5
|
+
const ElementType_js_1 = require("./ElementType.js");
|
|
6
|
+
const reWhitespace = /\s+/g;
|
|
7
|
+
// Default options
|
|
8
|
+
const defaultOpts = {
|
|
9
|
+
normalizeWhitespace: false,
|
|
10
|
+
withStartIndices: false,
|
|
11
|
+
withEndIndices: false,
|
|
12
|
+
};
|
|
13
|
+
class DomHandler {
|
|
14
|
+
/**
|
|
15
|
+
* @param callback Called once parsing has completed.
|
|
16
|
+
* @param options Settings for the handler.
|
|
17
|
+
* @param elementCB Callback whenever a tag is closed.
|
|
18
|
+
*/
|
|
19
|
+
constructor(callback, options, elementCB) {
|
|
20
|
+
/** The elements of the DOM */
|
|
21
|
+
Object.defineProperty(this, "dom", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: []
|
|
26
|
+
});
|
|
27
|
+
/** The root element for the DOM */
|
|
28
|
+
Object.defineProperty(this, "root", {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true,
|
|
32
|
+
value: new Node_js_1.Document(this.dom)
|
|
33
|
+
});
|
|
34
|
+
/** Called once parsing has completed. */
|
|
35
|
+
Object.defineProperty(this, "callback", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true,
|
|
38
|
+
writable: true,
|
|
39
|
+
value: void 0
|
|
40
|
+
});
|
|
41
|
+
/** Settings for the handler. */
|
|
42
|
+
Object.defineProperty(this, "options", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: void 0
|
|
47
|
+
});
|
|
48
|
+
/** Callback whenever a tag is closed. */
|
|
49
|
+
Object.defineProperty(this, "elementCB", {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
configurable: true,
|
|
52
|
+
writable: true,
|
|
53
|
+
value: void 0
|
|
54
|
+
});
|
|
55
|
+
/** Indicated whether parsing has been completed. */
|
|
56
|
+
Object.defineProperty(this, "done", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: true,
|
|
59
|
+
writable: true,
|
|
60
|
+
value: false
|
|
61
|
+
});
|
|
62
|
+
/** Stack of open tags. */
|
|
63
|
+
Object.defineProperty(this, "tagStack", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
configurable: true,
|
|
66
|
+
writable: true,
|
|
67
|
+
value: [this.root]
|
|
68
|
+
});
|
|
69
|
+
/** A data node that is still being written to. */
|
|
70
|
+
Object.defineProperty(this, "lastNode", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
configurable: true,
|
|
73
|
+
writable: true,
|
|
74
|
+
value: null
|
|
75
|
+
});
|
|
76
|
+
/** Reference to the parser instance. Used for location information. */
|
|
77
|
+
Object.defineProperty(this, "parser", {
|
|
78
|
+
enumerable: true,
|
|
79
|
+
configurable: true,
|
|
80
|
+
writable: true,
|
|
81
|
+
value: null
|
|
82
|
+
});
|
|
83
|
+
// Make it possible to skip arguments, for backwards-compatibility
|
|
84
|
+
if (typeof options === 'function') {
|
|
85
|
+
elementCB = options;
|
|
86
|
+
options = defaultOpts;
|
|
87
|
+
}
|
|
88
|
+
if (typeof callback === 'object') {
|
|
89
|
+
options = callback;
|
|
90
|
+
callback = undefined;
|
|
91
|
+
}
|
|
92
|
+
this.callback = callback ?? null;
|
|
93
|
+
this.options = options ?? defaultOpts;
|
|
94
|
+
this.elementCB = elementCB ?? null;
|
|
95
|
+
}
|
|
96
|
+
onparserinit(parser) {
|
|
97
|
+
this.parser = parser;
|
|
98
|
+
}
|
|
99
|
+
// Resets the handler back to starting state
|
|
100
|
+
onreset() {
|
|
101
|
+
this.dom = [];
|
|
102
|
+
this.root = new Node_js_1.Document(this.dom);
|
|
103
|
+
this.done = false;
|
|
104
|
+
this.tagStack = [this.root];
|
|
105
|
+
this.lastNode = null;
|
|
106
|
+
this.parser = this.parser ?? null;
|
|
107
|
+
}
|
|
108
|
+
// Signals the handler that parsing is done
|
|
109
|
+
onend() {
|
|
110
|
+
if (this.done)
|
|
111
|
+
return;
|
|
112
|
+
this.done = true;
|
|
113
|
+
this.parser = null;
|
|
114
|
+
this.handleCallback(null);
|
|
115
|
+
}
|
|
116
|
+
onerror(error) {
|
|
117
|
+
this.handleCallback(error);
|
|
118
|
+
}
|
|
119
|
+
onclosetag() {
|
|
120
|
+
this.lastNode = null;
|
|
121
|
+
const elem = this.tagStack.pop();
|
|
122
|
+
if (this.options.withEndIndices) {
|
|
123
|
+
elem.endIndex = this.parser.endIndex;
|
|
124
|
+
}
|
|
125
|
+
if (this.elementCB)
|
|
126
|
+
this.elementCB(elem);
|
|
127
|
+
}
|
|
128
|
+
onopentag(name, attribs) {
|
|
129
|
+
const type = this.options.xmlMode ? ElementType_js_1.ElementType.Tag : undefined;
|
|
130
|
+
const element = new Node_js_1.Element(name, attribs, undefined, type);
|
|
131
|
+
this.addNode(element);
|
|
132
|
+
this.tagStack.push(element);
|
|
133
|
+
}
|
|
134
|
+
ontext(data) {
|
|
135
|
+
const { normalizeWhitespace } = this.options;
|
|
136
|
+
const { lastNode } = this;
|
|
137
|
+
if (lastNode && lastNode.type === ElementType_js_1.ElementType.Text) {
|
|
138
|
+
if (normalizeWhitespace) {
|
|
139
|
+
lastNode.data = (lastNode.data + data).replace(reWhitespace, ' ');
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
lastNode.data += data;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
if (normalizeWhitespace) {
|
|
147
|
+
data = data.replace(reWhitespace, ' ');
|
|
148
|
+
}
|
|
149
|
+
const node = new Node_js_1.Text(data);
|
|
150
|
+
this.addNode(node);
|
|
151
|
+
this.lastNode = node;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
oncomment(data) {
|
|
155
|
+
if (this.lastNode && this.lastNode.type === ElementType_js_1.ElementType.Comment) {
|
|
156
|
+
this.lastNode.data += data;
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const node = new Node_js_1.Comment(data);
|
|
160
|
+
this.addNode(node);
|
|
161
|
+
this.lastNode = node;
|
|
162
|
+
}
|
|
163
|
+
oncommentend() {
|
|
164
|
+
this.lastNode = null;
|
|
165
|
+
}
|
|
166
|
+
oncdatastart() {
|
|
167
|
+
const text = new Node_js_1.Text('');
|
|
168
|
+
const node = new Node_js_1.NodeWithChildren(ElementType_js_1.ElementType.CDATA, [text]);
|
|
169
|
+
this.addNode(node);
|
|
170
|
+
text.parent = node;
|
|
171
|
+
this.lastNode = text;
|
|
172
|
+
}
|
|
173
|
+
oncdataend() {
|
|
174
|
+
this.lastNode = null;
|
|
175
|
+
}
|
|
176
|
+
onprocessinginstruction(name, data) {
|
|
177
|
+
const node = new Node_js_1.ProcessingInstruction(name, data);
|
|
178
|
+
this.addNode(node);
|
|
179
|
+
}
|
|
180
|
+
handleCallback(error) {
|
|
181
|
+
if (typeof this.callback === 'function') {
|
|
182
|
+
this.callback(error, this.dom);
|
|
183
|
+
}
|
|
184
|
+
else if (error) {
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
addNode(node) {
|
|
189
|
+
const parent = this.tagStack[this.tagStack.length - 1];
|
|
190
|
+
const previousSibling = parent.children[parent.children.length - 1];
|
|
191
|
+
if (this.options.withStartIndices) {
|
|
192
|
+
node.startIndex = this.parser.startIndex;
|
|
193
|
+
}
|
|
194
|
+
if (this.options.withEndIndices) {
|
|
195
|
+
node.endIndex = this.parser.endIndex;
|
|
196
|
+
}
|
|
197
|
+
parent.children.push(node);
|
|
198
|
+
if (previousSibling) {
|
|
199
|
+
node.prev = previousSibling;
|
|
200
|
+
previousSibling.next = node;
|
|
201
|
+
}
|
|
202
|
+
node.parent = parent;
|
|
203
|
+
this.lastNode = null;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
exports.DomHandler = DomHandler;
|
|
207
|
+
exports.default = DomHandler;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Node } from './Node.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mixed-case SVG and MathML tags & attributes
|
|
4
|
+
* recognized by the HTML parser.
|
|
5
|
+
*
|
|
6
|
+
* @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
|
|
7
|
+
*/
|
|
8
|
+
export declare const elementNames: Map<string, string>;
|
|
9
|
+
export declare const attributeNames: Map<string, string>;
|
|
10
|
+
export interface DomSerializerOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Print an empty attribute's value.
|
|
13
|
+
*
|
|
14
|
+
* @default xmlMode
|
|
15
|
+
* @example With <code>emptyAttrs: false</code>: <code><input checked></code>
|
|
16
|
+
* @example With <code>emptyAttrs: true</code>: <code><input checked=""></code>
|
|
17
|
+
*/
|
|
18
|
+
emptyAttrs?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Print self-closing tags for tags without contents.
|
|
21
|
+
*
|
|
22
|
+
* @default xmlMode
|
|
23
|
+
* @example With <code>selfClosingTags: false</code>: <code><foo></foo></code>
|
|
24
|
+
* @example With <code>selfClosingTags: true</code>: <code><foo /></code>
|
|
25
|
+
*/
|
|
26
|
+
selfClosingTags?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Treat the input as an XML document; enables the `emptyAttrs` and `selfClosingTags` options.
|
|
29
|
+
*
|
|
30
|
+
* If the value is `"foreign"`, it will try to correct mixed-case attribute names.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
xmlMode?: boolean | 'foreign';
|
|
35
|
+
/**
|
|
36
|
+
* Encode characters that are either reserved in HTML or XML, or are outside of the ASCII range.
|
|
37
|
+
*
|
|
38
|
+
* @default true
|
|
39
|
+
*/
|
|
40
|
+
decodeEntities?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Renders a DOM node or an array of DOM nodes to a string.
|
|
44
|
+
*
|
|
45
|
+
* Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
|
|
46
|
+
*
|
|
47
|
+
* @param node Node to be rendered.
|
|
48
|
+
* @param options Changes serialization behavior
|
|
49
|
+
*/
|
|
50
|
+
export default function render(node: Node | ArrayLike<Node>, options?: DomSerializerOptions): string;
|