@mtkruto/node 0.67.1 → 0.68.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_errors.js +2 -6
- package/esm/3_errors.js +2 -12
- package/esm/3_transport.d.ts +3 -3
- package/esm/3_transport.js +3 -3
- package/esm/3_types.d.ts +8 -7
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +8 -7
- package/esm/4_errors.js +2 -12
- package/esm/_dnt.polyfills.d.ts +99 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +127 -1
- package/esm/_dnt.test_polyfills.d.ts.map +1 -0
- package/esm/client/0_filters_test.d.ts.map +1 -1
- package/esm/client/0_markdown_test.d.ts.map +1 -1
- package/esm/client/0_params.d.ts +2 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts +5 -5
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password_test.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +143 -155
- package/esm/client/0_storage_operations_test.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +1 -1
- package/esm/client/0_utilities_test.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +4 -22
- package/esm/client/1_composer.js +8 -21
- package/esm/client/2_account_manager.js +85 -97
- package/esm/client/2_bot_info_manager.js +26 -38
- package/esm/client/2_business_connection_manager.js +10 -23
- package/esm/client/2_client_encrypted.js +194 -211
- package/esm/client/2_file_manager.d.ts +4 -3
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +268 -224
- package/esm/client/2_file_manager_test.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +8 -21
- package/esm/client/2_payment_manager.js +7 -20
- package/esm/client/2_reaction_manager.js +7 -20
- package/esm/client/2_translations_manager.js +97 -107
- package/esm/client/2_update_manager.js +764 -759
- package/esm/client/3_client_encrypted_pool.js +10 -26
- package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts +1 -1
- package/esm/client/3_message_manager.js +441 -448
- package/esm/client/3_message_manager_test.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.d.ts +1 -1
- package/esm/client/3_video_chat_manager.js +57 -68
- package/esm/client/4_callback_query_manager.js +18 -30
- package/esm/client/4_chat_list_manager.js +322 -318
- package/esm/client/4_chat_manager.js +118 -131
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.js +16 -29
- package/esm/client/4_inline_query_manager.js +16 -28
- package/esm/client/4_link_preview_manager.js +6 -19
- package/esm/client/4_poll_manager.js +44 -57
- package/esm/client/4_story_manager.js +41 -53
- package/esm/client/5_client.d.ts +7 -0
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +1271 -1290
- package/esm/connection/1_connection_tcp.node.js +48 -65
- package/esm/connection/1_connection_web_socket.js +75 -91
- package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/esm/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
- package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/esm/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/format.js +70 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
- package/esm/mod.js +2 -12
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.js +324 -320
- package/esm/storage/1_utilities_test.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.js +26 -44
- package/esm/storage/2_storage_local_storage.node.js +12 -25
- package/esm/storage/2_storage_memory.js +24 -41
- package/esm/storage/2_storage_session_storage.js +3 -16
- package/esm/tl/0_utilities_test.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +80 -88
- package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
- package/esm/tl/1_tl_writer.js +155 -164
- package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
- package/esm/tl/2_telegram.d.ts +9 -10
- package/esm/tl/2_telegram.d.ts.map +1 -1
- package/esm/tl/2_telegram.js +10 -10
- package/esm/transport/0_transport.js +1 -8
- package/esm/transport/1_transport_abridged.js +11 -24
- package/esm/transport/1_transport_intermediate.js +10 -23
- package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts} +1 -1
- package/esm/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
- package/{script/transport/3_transport_provider_tcp.d.ts → esm/transport/2_transport_provider_tcp.d.ts} +2 -2
- package/esm/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
- package/esm/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +1 -1
- package/esm/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
- package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -0
- package/esm/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +1 -1
- package/esm/types/0_upload_progress.d.ts +29 -0
- package/esm/types/0_upload_progress.d.ts.map +1 -0
- package/esm/types/0_upload_progress.js +20 -0
- package/esm/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
- package/esm/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/2_chat.d.ts.map +1 -1
- package/esm/types/2_poll_answer.d.ts +19 -0
- package/esm/types/2_poll_answer.d.ts.map +1 -1
- package/esm/types/2_poll_answer.js +19 -0
- package/esm/types/2_pre_checkout_query.d.ts.map +1 -1
- package/esm/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
- package/esm/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
- package/esm/types/{3_reply_markup.js → 2_reply_markup.js} +1 -1
- package/esm/types/2_story_interactive_area.d.ts.map +1 -1
- package/esm/types/3_chat_member_updated.d.ts.map +1 -1
- package/esm/types/3_story.d.ts.map +1 -1
- package/esm/types/5_message.d.ts +1 -1
- package/esm/types/5_message.d.ts.map +1 -1
- package/esm/types/5_message.js +1 -1
- package/esm/types/6_inline_query_result.d.ts +1 -1
- package/esm/types/6_inline_query_result.js +1 -1
- package/esm/types/7_update.d.ts +21 -2
- package/esm/types/7_update.d.ts.map +1 -1
- package/esm/utilities/0_bigint_test.d.ts.map +1 -1
- package/esm/utilities/0_buffer.d.ts +1 -1
- package/esm/utilities/0_buffer.d.ts.map +1 -1
- package/esm/utilities/0_buffer_test.d.ts.map +1 -1
- package/esm/utilities/0_hash.d.ts +2 -2
- package/esm/utilities/0_hash.d.ts.map +1 -1
- package/esm/utilities/0_mutex.js +4 -19
- package/esm/utilities/0_part_stream.js +11 -25
- package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
- package/esm/utilities/0_rle.d.ts +2 -2
- package/esm/utilities/0_rle.d.ts.map +1 -1
- package/esm/utilities/0_rle_test.d.ts.map +1 -1
- package/esm/utilities/0_text.d.ts +20 -1
- package/esm/utilities/0_text.d.ts.map +1 -1
- package/esm/utilities/0_text.js +19 -0
- package/esm/utilities/1_auth.d.ts +1 -1
- package/esm/utilities/1_auth.d.ts.map +1 -1
- package/esm/utilities/1_base64.d.ts +1 -1
- package/esm/utilities/1_base64.d.ts.map +1 -1
- package/esm/utilities/1_base64_test.d.ts.map +1 -1
- package/esm/utilities/1_crypto.js +42 -53
- package/esm/utilities/1_crypto_test.d.ts.map +1 -1
- package/esm/utilities/1_logger.d.ts +2 -2
- package/esm/utilities/1_math_test.d.ts.map +1 -1
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_errors.js +2 -6
- package/script/2_tl.js +17 -7
- package/script/3_errors.js +2 -12
- package/script/3_transport.d.ts +3 -3
- package/script/3_transport.js +3 -3
- package/script/3_types.d.ts +8 -7
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +8 -7
- package/script/4_constants.js +17 -7
- package/script/4_errors.js +2 -12
- package/script/_dnt.polyfills.d.ts +99 -0
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +128 -0
- package/script/_dnt.test_polyfills.d.ts.map +1 -0
- package/script/client/0_filters_test.d.ts.map +1 -1
- package/script/client/0_markdown_test.d.ts.map +1 -1
- package/script/client/0_params.d.ts +2 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts +5 -5
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +17 -7
- package/script/client/0_password_test.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +143 -155
- package/script/client/0_storage_operations_test.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +1 -1
- package/script/client/0_utilities_test.d.ts.map +1 -1
- package/script/client/1_client_plain.js +4 -22
- package/script/client/1_composer.js +8 -21
- package/script/client/2_account_manager.js +85 -97
- package/script/client/2_bot_info_manager.js +26 -38
- package/script/client/2_business_connection_manager.js +10 -23
- package/script/client/2_client_encrypted.js +195 -212
- package/script/client/2_file_manager.d.ts +4 -3
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +285 -231
- package/script/client/2_file_manager_test.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +8 -21
- package/script/client/2_payment_manager.js +7 -20
- package/script/client/2_reaction_manager.js +7 -20
- package/script/client/2_translations_manager.js +98 -108
- package/script/client/2_update_manager.js +764 -759
- package/script/client/3_client_encrypted_pool.js +10 -26
- package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts +1 -1
- package/script/client/3_message_manager.js +441 -448
- package/script/client/3_message_manager_test.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.d.ts +1 -1
- package/script/client/3_video_chat_manager.js +57 -68
- package/script/client/4_callback_query_manager.js +18 -30
- package/script/client/4_chat_list_manager.js +322 -318
- package/script/client/4_chat_manager.js +118 -131
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.js +16 -29
- package/script/client/4_inline_query_manager.js +16 -28
- package/script/client/4_link_preview_manager.js +6 -19
- package/script/client/4_poll_manager.js +44 -57
- package/script/client/4_story_manager.js +41 -53
- package/script/client/5_client.d.ts +7 -0
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +1271 -1290
- package/script/connection/1_connection_tcp.node.js +48 -65
- package/script/connection/1_connection_web_socket.js +92 -98
- package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
- package/script/deps/jsr.io/@std/assert/1.0.13/equals.js +4 -4
- package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
- package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/script/deps/jsr.io/@std/internal/1.0.10/build_message.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/diff.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/diff_str.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts +29 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/format.js +106 -0
- package/script/deps/jsr.io/@std/internal/1.0.10/styles.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +17 -7
- package/script/deps/jsr.io/@std/internal/1.0.10/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
- package/script/mod.js +19 -19
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.js +66 -79
- package/script/session/2_session_encrypted.js +325 -321
- package/script/storage/1_utilities_test.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.js +26 -44
- package/script/storage/2_storage_local_storage.node.js +12 -25
- package/script/storage/2_storage_memory.js +24 -41
- package/script/storage/2_storage_session_storage.js +3 -16
- package/script/tl/0_utilities_test.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +81 -89
- package/script/tl/1_tl_reader_test.d.ts.map +1 -1
- package/script/tl/1_tl_writer.js +156 -165
- package/script/tl/1_tl_writer_test.d.ts.map +1 -1
- package/script/tl/2_telegram.d.ts +9 -10
- package/script/tl/2_telegram.d.ts.map +1 -1
- package/script/tl/2_telegram.js +32 -10
- package/script/transport/0_obfuscation.js +17 -7
- package/script/transport/0_transport.js +1 -8
- package/script/transport/1_transport_abridged.js +11 -24
- package/script/transport/1_transport_intermediate.js +10 -23
- package/{esm/transport/2_transport_provider.d.ts → script/transport/1_transport_provider.d.ts} +1 -1
- package/script/transport/{2_transport_provider.d.ts.map → 1_transport_provider.d.ts.map} +1 -1
- package/{esm/transport/3_transport_provider_tcp.d.ts → script/transport/2_transport_provider_tcp.d.ts} +2 -2
- package/script/transport/{3_transport_provider_tcp.d.ts.map → 2_transport_provider_tcp.d.ts.map} +1 -1
- package/script/transport/{3_transport_provider_tcp.js → 2_transport_provider_tcp.js} +3 -3
- package/script/transport/{3_transport_provider_web_socket.d.ts → 2_transport_provider_web_socket.d.ts} +2 -2
- package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -0
- package/script/transport/{3_transport_provider_web_socket.js → 2_transport_provider_web_socket.js} +2 -2
- package/script/types/0_upload_progress.d.ts +29 -0
- package/script/types/0_upload_progress.d.ts.map +1 -0
- package/script/types/0_upload_progress.js +21 -0
- package/script/types/{2_inline_keyboard_button.d.ts → 1_inline_keyboard_button.d.ts} +1 -1
- package/script/types/{2_inline_keyboard_button.d.ts.map → 1_inline_keyboard_button.d.ts.map} +1 -1
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/2_chat.d.ts.map +1 -1
- package/script/types/2_poll_answer.d.ts +19 -0
- package/script/types/2_poll_answer.d.ts.map +1 -1
- package/script/types/2_poll_answer.js +19 -0
- package/script/types/2_pre_checkout_query.d.ts.map +1 -1
- package/script/types/{3_reply_markup.d.ts → 2_reply_markup.d.ts} +2 -2
- package/script/types/{3_reply_markup.d.ts.map → 2_reply_markup.d.ts.map} +1 -1
- package/script/types/{3_reply_markup.js → 2_reply_markup.js} +3 -3
- package/script/types/2_story_interactive_area.d.ts.map +1 -1
- package/script/types/3_chat_member_updated.d.ts.map +1 -1
- package/script/types/3_story.d.ts.map +1 -1
- package/script/types/5_message.d.ts +1 -1
- package/script/types/5_message.d.ts.map +1 -1
- package/script/types/5_message.js +2 -2
- package/script/types/6_inline_query_result.d.ts +1 -1
- package/script/types/6_inline_query_result.js +4 -4
- package/script/types/7_update.d.ts +21 -2
- package/script/types/7_update.d.ts.map +1 -1
- package/script/utilities/0_bigint.js +17 -7
- package/script/utilities/0_bigint_test.d.ts.map +1 -1
- package/script/utilities/0_buffer.d.ts +1 -1
- package/script/utilities/0_buffer.d.ts.map +1 -1
- package/script/utilities/0_buffer_test.d.ts.map +1 -1
- package/script/utilities/0_env.js +17 -7
- package/script/utilities/0_hash.d.ts +2 -2
- package/script/utilities/0_hash.d.ts.map +1 -1
- package/script/utilities/0_hash.js +17 -7
- package/script/utilities/0_misc.js +17 -7
- package/script/utilities/0_mutex.js +4 -19
- package/script/utilities/0_part_stream.js +11 -25
- package/script/utilities/0_part_stream_test.d.ts.map +1 -1
- package/script/utilities/0_rle.d.ts +2 -2
- package/script/utilities/0_rle.d.ts.map +1 -1
- package/script/utilities/0_rle_test.d.ts.map +1 -1
- package/script/utilities/0_text.d.ts +20 -1
- package/script/utilities/0_text.d.ts.map +1 -1
- package/script/utilities/0_text.js +19 -0
- package/script/utilities/1_auth.d.ts +1 -1
- package/script/utilities/1_auth.d.ts.map +1 -1
- package/script/utilities/1_auth.js +17 -7
- package/script/utilities/1_base64.d.ts +1 -1
- package/script/utilities/1_base64.d.ts.map +1 -1
- package/script/utilities/1_base64_test.d.ts.map +1 -1
- package/script/utilities/1_crypto.js +60 -61
- package/script/utilities/1_crypto_test.d.ts.map +1 -1
- package/script/utilities/1_logger.d.ts +2 -2
- package/script/utilities/1_math_test.d.ts.map +1 -1
- package/script/utilities/2_queue.js +30 -48
- package/esm/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/format.js +0 -37
- package/esm/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
- package/esm/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
- package/esm/transport/3_transport_provider_web_socket.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/build_message.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/diff.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/diff_str.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts +0 -2
- package/script/deps/jsr.io/@std/internal/1.0.9/format.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/format.js +0 -63
- package/script/deps/jsr.io/@std/internal/1.0.9/styles.d.ts.map +0 -1
- package/script/deps/jsr.io/@std/internal/1.0.9/types.d.ts.map +0 -1
- package/script/transport/3_transport_provider_web_socket.d.ts.map +0 -1
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.js +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
- /package/esm/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
- /package/esm/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
- /package/esm/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/build_message.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/diff_str.js +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/styles.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.d.ts +0 -0
- /package/script/deps/jsr.io/@std/internal/{1.0.9 → 1.0.10}/types.js +0 -0
- /package/script/transport/{2_transport_provider.js → 1_transport_provider.js} +0 -0
- /package/script/types/{2_inline_keyboard_button.js → 1_inline_keyboard_button.js} +0 -0
package/esm/tl/1_tl_writer.js
CHANGED
|
@@ -18,26 +18,14 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
// deno-lint-ignore-file no-explicit-any
|
|
21
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
22
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
23
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
24
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
25
|
-
};
|
|
26
|
-
var _TLWriter_instances, _TLWriter_serialize, _TLWriter_serializeVector, _TLWriter_serializePrimitive, _TLWriter_isTypeValid;
|
|
27
21
|
import { concat } from "../0_deps.js";
|
|
28
22
|
import { TLError } from "./0_tl_error.js";
|
|
29
23
|
import { analyzeOptionalParam, BOOL_FALSE, BOOL_TRUE, getOptionalParamInnerType, getVectorItemType, isOptionalParam, repr, VECTOR } from "./0_utilities.js";
|
|
30
24
|
import { bufferFromBigInt } from "../utilities/0_buffer.js";
|
|
31
25
|
import { encodeText } from "../1_utilities.js";
|
|
32
26
|
export class TLWriter {
|
|
27
|
+
_buffer = new Uint8Array();
|
|
33
28
|
constructor() {
|
|
34
|
-
_TLWriter_instances.add(this);
|
|
35
|
-
Object.defineProperty(this, "_buffer", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: new Uint8Array()
|
|
40
|
-
});
|
|
41
29
|
}
|
|
42
30
|
get buffer() {
|
|
43
31
|
return this._buffer;
|
|
@@ -95,170 +83,173 @@ export class TLWriter {
|
|
|
95
83
|
return this;
|
|
96
84
|
}
|
|
97
85
|
writeObject(value, schema) {
|
|
98
|
-
|
|
86
|
+
this.#serialize(value._, value, "", schema);
|
|
99
87
|
return this;
|
|
100
88
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
throw new TLError(`Unknown type: ${value._}`);
|
|
112
|
-
}
|
|
113
|
-
if (type != "!X" && !__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_isTypeValid).call(this, type, value, schema)) {
|
|
114
|
-
throw new TLError(`Expected ${type} but got ${value._}`);
|
|
115
|
-
}
|
|
116
|
-
const type__ = value;
|
|
117
|
-
const [id, parameters_] = maybeDefinition;
|
|
118
|
-
this.writeInt32(id, false);
|
|
119
|
-
for (let [i, [name, type]] of parameters_.entries()) {
|
|
120
|
-
if (isOptionalParam(type) && type__[name] === undefined) {
|
|
121
|
-
continue;
|
|
89
|
+
#serialize(type, value, debugInfo, schema) {
|
|
90
|
+
if (this.#serializePrimitive(type, value, debugInfo)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (this.#serializeVector(type, value, debugInfo, schema)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const maybeDefinition = schema.definitions[value._];
|
|
97
|
+
if (!maybeDefinition) {
|
|
98
|
+
throw new TLError(`Unknown type: ${value._}`);
|
|
122
99
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
100
|
+
if (type != "!X" && !this.#isTypeValid(type, value, schema)) {
|
|
101
|
+
throw new TLError(`Expected ${type} but got ${value._}`);
|
|
102
|
+
}
|
|
103
|
+
const type__ = value;
|
|
104
|
+
const [id, parameters_] = maybeDefinition;
|
|
105
|
+
this.writeInt32(id, false);
|
|
106
|
+
for (let [i, [name, type]] of parameters_.entries()) {
|
|
107
|
+
if (isOptionalParam(type) && type__[name] === undefined) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const debugInfo = ` [0x${id.toString(16).toUpperCase()}::${i}]`;
|
|
111
|
+
if (type == "#") {
|
|
112
|
+
let flags = 0;
|
|
113
|
+
const flagField_ = name;
|
|
114
|
+
for (const [name, type] of parameters_) {
|
|
115
|
+
if (isOptionalParam(type)) {
|
|
116
|
+
const { flagField, bitIndex } = analyzeOptionalParam(type);
|
|
117
|
+
if (flagField == flagField_) {
|
|
118
|
+
if (type__[name] !== undefined) {
|
|
119
|
+
flags |= 1 << bitIndex;
|
|
120
|
+
}
|
|
133
121
|
}
|
|
134
122
|
}
|
|
135
123
|
}
|
|
124
|
+
this.writeInt32(flags);
|
|
125
|
+
continue;
|
|
126
|
+
}
|
|
127
|
+
if (type__[name] === undefined && !isOptionalParam(type)) {
|
|
128
|
+
throw new Error(`Missing required parameter: ${name}`);
|
|
136
129
|
}
|
|
137
|
-
|
|
138
|
-
|
|
130
|
+
if (isOptionalParam(type)) {
|
|
131
|
+
type = getOptionalParamInnerType(type);
|
|
132
|
+
}
|
|
133
|
+
this.#serialize(type, type__[name], debugInfo, schema);
|
|
139
134
|
}
|
|
140
|
-
|
|
141
|
-
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
#serializeVector(type, value, debugInfo, schema) {
|
|
138
|
+
const itemType = getVectorItemType(type);
|
|
139
|
+
if (!itemType) {
|
|
140
|
+
return false;
|
|
142
141
|
}
|
|
143
|
-
if (
|
|
144
|
-
|
|
142
|
+
if (!Array.isArray(value)) {
|
|
143
|
+
throw new TypeError(`Expected array but received ${repr(value)}${debugInfo}`);
|
|
145
144
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return false;
|
|
153
|
-
}
|
|
154
|
-
if (!Array.isArray(value)) {
|
|
155
|
-
throw new TypeError(`Expected array but received ${repr(value)}${debugInfo}`);
|
|
156
|
-
}
|
|
157
|
-
this.writeInt32(VECTOR, false);
|
|
158
|
-
this.writeInt32(value.length);
|
|
159
|
-
for (const item of value) {
|
|
160
|
-
__classPrivateFieldGet(this, _TLWriter_instances, "m", _TLWriter_serialize).call(this, itemType, item, debugInfo, schema);
|
|
145
|
+
this.writeInt32(VECTOR, false);
|
|
146
|
+
this.writeInt32(value.length);
|
|
147
|
+
for (const item of value) {
|
|
148
|
+
this.#serialize(itemType, item, debugInfo, schema);
|
|
149
|
+
}
|
|
150
|
+
return true;
|
|
161
151
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
this.writeBytes(value);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
throw new TLError(`Expected Uint8Array but received ${valueRepr}${debugInfo}`);
|
|
172
|
-
}
|
|
173
|
-
return true;
|
|
174
|
-
case "int128":
|
|
175
|
-
if (typeof value === "bigint") {
|
|
176
|
-
this.writeInt128(value);
|
|
177
|
-
}
|
|
178
|
-
else {
|
|
179
|
-
throw new TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
180
|
-
}
|
|
181
|
-
return true;
|
|
182
|
-
case "int256":
|
|
183
|
-
if (typeof value === "bigint") {
|
|
184
|
-
this.writeInt256(value);
|
|
185
|
-
}
|
|
186
|
-
else {
|
|
187
|
-
throw new TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
188
|
-
}
|
|
189
|
-
return true;
|
|
190
|
-
case "long":
|
|
191
|
-
if (typeof value === "bigint") {
|
|
192
|
-
this.writeInt64(value);
|
|
193
|
-
}
|
|
194
|
-
else {
|
|
195
|
-
throw new TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
196
|
-
}
|
|
197
|
-
return true;
|
|
198
|
-
case "Bool":
|
|
199
|
-
if (typeof value === "boolean") {
|
|
200
|
-
if (value) {
|
|
201
|
-
this.writeInt32(BOOL_TRUE);
|
|
152
|
+
#serializePrimitive(type, value, debugInfo) {
|
|
153
|
+
const valueRepr = repr(value);
|
|
154
|
+
switch (type) {
|
|
155
|
+
case "bytes":
|
|
156
|
+
if ((value instanceof Uint8Array)) {
|
|
157
|
+
this.writeBytes(value);
|
|
202
158
|
}
|
|
203
159
|
else {
|
|
204
|
-
|
|
160
|
+
throw new TLError(`Expected Uint8Array but received ${valueRepr}${debugInfo}`);
|
|
205
161
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
162
|
+
return true;
|
|
163
|
+
case "int128":
|
|
164
|
+
if (typeof value === "bigint") {
|
|
165
|
+
this.writeInt128(value);
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
throw new TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
169
|
+
}
|
|
170
|
+
return true;
|
|
171
|
+
case "int256":
|
|
172
|
+
if (typeof value === "bigint") {
|
|
173
|
+
this.writeInt256(value);
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
throw new TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
177
|
+
}
|
|
178
|
+
return true;
|
|
179
|
+
case "long":
|
|
180
|
+
if (typeof value === "bigint") {
|
|
181
|
+
this.writeInt64(value);
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
throw new TLError(`Expected bigint but received ${valueRepr}${debugInfo}`);
|
|
185
|
+
}
|
|
186
|
+
return true;
|
|
187
|
+
case "Bool":
|
|
188
|
+
if (typeof value === "boolean") {
|
|
189
|
+
if (value) {
|
|
190
|
+
this.writeInt32(BOOL_TRUE);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this.writeInt32(BOOL_FALSE);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
throw new TLError(`Expected boolean but received ${valueRepr}${debugInfo}`);
|
|
198
|
+
}
|
|
199
|
+
return true;
|
|
200
|
+
case "int":
|
|
201
|
+
//
|
|
202
|
+
if (value == null) {
|
|
203
|
+
value = 0;
|
|
204
|
+
}
|
|
205
|
+
//
|
|
206
|
+
if (typeof value === "number") {
|
|
207
|
+
this.writeInt32(value);
|
|
208
|
+
}
|
|
209
|
+
else {
|
|
210
|
+
throw new TLError(`Expected number but received ${valueRepr}${debugInfo}`);
|
|
211
|
+
}
|
|
212
|
+
return true;
|
|
213
|
+
case "double":
|
|
214
|
+
//
|
|
215
|
+
if (value == null) {
|
|
216
|
+
value = 0;
|
|
217
|
+
}
|
|
218
|
+
//
|
|
219
|
+
if (typeof value === "number") {
|
|
220
|
+
this.writeDouble(value);
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
throw new TLError(`Expected number but received ${valueRepr}${debugInfo}`);
|
|
224
|
+
}
|
|
225
|
+
return true;
|
|
226
|
+
case "string":
|
|
227
|
+
if (typeof value === "string") {
|
|
228
|
+
this.writeString(value);
|
|
229
|
+
}
|
|
230
|
+
else if (value instanceof Uint8Array) {
|
|
231
|
+
this.writeBytes(value);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
this.writeString("");
|
|
235
|
+
}
|
|
236
|
+
// else {
|
|
237
|
+
// throw new TypeError(`Expected string or Uint8Array but received ${valueRepr}`);
|
|
238
|
+
// }
|
|
239
|
+
return true;
|
|
240
|
+
case "true":
|
|
241
|
+
if (value !== true) {
|
|
242
|
+
throw new TLError(`Expected true but received ${valueRepr}${debugInfo}`);
|
|
243
|
+
}
|
|
244
|
+
return true;
|
|
245
|
+
default:
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
258
248
|
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
249
|
+
#isTypeValid(type, value, schema) {
|
|
250
|
+
if (type == value._) {
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
return schema.definitions[value._]?.[2] === type;
|
|
262
254
|
}
|
|
263
|
-
|
|
264
|
-
};
|
|
255
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_tl_writer_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"1_tl_writer_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_writer_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
package/esm/tl/2_telegram.d.ts
CHANGED
|
@@ -17,19 +17,18 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
import { AnyObject, AnyType, Enums, Functions, Types } from "./1_telegram_api.js";
|
|
21
20
|
import { TLReader } from "./1_tl_reader.js";
|
|
22
21
|
import * as Api from "./1_telegram_api.js";
|
|
23
22
|
export * from "./1_telegram_api.js";
|
|
24
|
-
export type DeserializedType = boolean | number | bigint | string | Uint8Array | AnyType | Array<DeserializedType>;
|
|
25
|
-
export declare function deserializeType<T extends (keyof Types) | "X" | string>(name: T, bufferOrReader: TLReader | Uint8Array): Promise<T extends keyof Types ? Types[T] : DeserializedType>;
|
|
26
|
-
export declare function serializeObject(object: AnyObject): Uint8Array;
|
|
27
|
-
export declare function isValidObject(object: any): object is AnyType;
|
|
28
|
-
export declare function assertIsValidObject(object: any): asserts object is AnyType;
|
|
29
|
-
export declare function is<S extends keyof (Types & Functions)>(name: S, value: unknown): value is S extends keyof Types ? Types[S] : S extends keyof Functions ? Functions[S] : never;
|
|
30
|
-
export declare function isOneOf<S extends keyof (Types & Functions)>(names: S[] | readonly S[], value: unknown): value is S extends keyof Types ? Types[S] : S extends keyof Functions ? Functions[S] : never;
|
|
31
|
-
export declare function isOfEnum<S extends keyof Enums>(name: S, value: unknown): value is Enums[S];
|
|
32
|
-
export declare function as<S extends keyof Types>(name: S, value: unknown): Types[S];
|
|
23
|
+
export type DeserializedType = boolean | number | bigint | string | Uint8Array | Api.AnyType | Array<DeserializedType>;
|
|
24
|
+
export declare function deserializeType<T extends (keyof Api.Types) | "X" | string>(name: T, bufferOrReader: TLReader | Uint8Array): Promise<T extends keyof Api.Types ? Api.Types[T] : DeserializedType>;
|
|
25
|
+
export declare function serializeObject(object: Api.AnyObject): Uint8Array;
|
|
26
|
+
export declare function isValidObject(object: any): object is Api.AnyType;
|
|
27
|
+
export declare function assertIsValidObject(object: any): asserts object is Api.AnyType;
|
|
28
|
+
export declare function is<S extends keyof (Api.Types & Api.Functions)>(name: S, value: unknown): value is S extends keyof Api.Types ? Api.Types[S] : S extends keyof Api.Functions ? Api.Functions[S] : never;
|
|
29
|
+
export declare function isOneOf<S extends keyof (Api.Types & Api.Functions)>(names: S[] | readonly S[], value: unknown): value is S extends keyof Api.Types ? Api.Types[S] : S extends keyof Api.Functions ? Api.Functions[S] : never;
|
|
30
|
+
export declare function isOfEnum<S extends keyof Api.Enums>(name: S, value: unknown): value is Api.Enums[S];
|
|
31
|
+
export declare function as<S extends keyof Api.Types>(name: S, value: unknown): Api.Types[S];
|
|
33
32
|
export declare function mustGetReturnType(name: string): string;
|
|
34
33
|
export declare function isGenericFunction(value: unknown): value is Api.AnyGenericFunction<Api.AnyFunction>;
|
|
35
34
|
export declare function getChannelChatId(channelId: bigint): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_telegram.d.ts","sourceRoot":"","sources":["../../src/tl/2_telegram.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"2_telegram.d.ts","sourceRoot":"","sources":["../../src/tl/2_telegram.ts"],"names":[],"mappings":"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"}
|
package/esm/tl/2_telegram.js
CHANGED
|
@@ -18,40 +18,40 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
// deno-lint-ignore-file no-explicit-any
|
|
21
|
-
import { schema } from "./1_telegram_api.js";
|
|
22
21
|
import { TLReader } from "./1_tl_reader.js";
|
|
23
22
|
import { TLWriter } from "./1_tl_writer.js";
|
|
24
23
|
import { unreachable } from "../0_deps.js";
|
|
25
24
|
import { ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
25
|
+
import * as Api from "./1_telegram_api.js";
|
|
26
26
|
import { as as as_, assertIsValidObject as assertIsValidObject_, is as is_, isOfEnum as isOfEnum_, isOneOf as isOneOf_, isValidObject as isValidObject_, mustGetReturnType as mustGetReturnType_ } from "./1_utilities.js";
|
|
27
27
|
export * from "./1_telegram_api.js";
|
|
28
28
|
export async function deserializeType(name, bufferOrReader) {
|
|
29
29
|
const reader = bufferOrReader instanceof Uint8Array ? new TLReader(bufferOrReader) : bufferOrReader;
|
|
30
|
-
return await reader.readType(name, schema);
|
|
30
|
+
return await reader.readType(name, Api.schema);
|
|
31
31
|
}
|
|
32
32
|
export function serializeObject(object) {
|
|
33
|
-
return new TLWriter().writeObject(object, schema).buffer;
|
|
33
|
+
return new TLWriter().writeObject(object, Api.schema).buffer;
|
|
34
34
|
}
|
|
35
35
|
export function isValidObject(object) {
|
|
36
|
-
return isValidObject_(object, schema);
|
|
36
|
+
return isValidObject_(object, Api.schema);
|
|
37
37
|
}
|
|
38
38
|
export function assertIsValidObject(object) {
|
|
39
|
-
return assertIsValidObject_(object, schema);
|
|
39
|
+
return assertIsValidObject_(object, Api.schema);
|
|
40
40
|
}
|
|
41
41
|
export function is(name, value) {
|
|
42
|
-
return is_(name, value, schema);
|
|
42
|
+
return is_(name, value, Api.schema);
|
|
43
43
|
}
|
|
44
44
|
export function isOneOf(names, value) {
|
|
45
|
-
return isOneOf_(names, value, schema);
|
|
45
|
+
return isOneOf_(names, value, Api.schema);
|
|
46
46
|
}
|
|
47
47
|
export function isOfEnum(name, value) {
|
|
48
|
-
return isOfEnum_(name, value, schema);
|
|
48
|
+
return isOfEnum_(name, value, Api.schema);
|
|
49
49
|
}
|
|
50
50
|
export function as(name, value) {
|
|
51
|
-
return as_(name, value, schema);
|
|
51
|
+
return as_(name, value, Api.schema);
|
|
52
52
|
}
|
|
53
53
|
export function mustGetReturnType(name) {
|
|
54
|
-
return mustGetReturnType_(name, schema);
|
|
54
|
+
return mustGetReturnType_(name, Api.schema);
|
|
55
55
|
}
|
|
56
56
|
const GENERIC_FUNCTIONS = [
|
|
57
57
|
"invokeAfterMsg",
|
|
@@ -18,14 +18,7 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
export class Transport {
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(this, "obfuscationParameters", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
value: null
|
|
27
|
-
});
|
|
28
|
-
}
|
|
21
|
+
obfuscationParameters = null;
|
|
29
22
|
async encrypt(buffer) {
|
|
30
23
|
if (this.obfuscationParameters) {
|
|
31
24
|
return await this.obfuscationParameters.encryptionCTR.call(buffer);
|
|
@@ -17,57 +17,45 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
21
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
22
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
23
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
24
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
25
|
-
};
|
|
26
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
28
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
29
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
-
};
|
|
31
|
-
var _TransportAbridged_connection, _TransportAbridged_obfuscated;
|
|
32
20
|
import { concat } from "../0_deps.js";
|
|
33
21
|
import { bigIntFromBuffer, bufferFromBigInt } from "../1_utilities.js";
|
|
34
22
|
import { getObfuscationParameters } from "./0_obfuscation.js";
|
|
35
23
|
import { Transport } from "./0_transport.js";
|
|
36
24
|
export class TransportAbridged extends Transport {
|
|
25
|
+
#connection;
|
|
26
|
+
#obfuscated;
|
|
37
27
|
constructor(connection, obfuscated = false) {
|
|
38
28
|
super();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
__classPrivateFieldSet(this, _TransportAbridged_connection, connection, "f");
|
|
42
|
-
__classPrivateFieldSet(this, _TransportAbridged_obfuscated, obfuscated, "f");
|
|
29
|
+
this.#connection = connection;
|
|
30
|
+
this.#obfuscated = obfuscated;
|
|
43
31
|
}
|
|
44
32
|
async initialize() {
|
|
45
|
-
if (
|
|
46
|
-
this.obfuscationParameters = await getObfuscationParameters(0xEFEFEFEF,
|
|
33
|
+
if (this.#obfuscated) {
|
|
34
|
+
this.obfuscationParameters = await getObfuscationParameters(0xEFEFEFEF, this.#connection);
|
|
47
35
|
}
|
|
48
36
|
else {
|
|
49
|
-
await
|
|
37
|
+
await this.#connection.write(new Uint8Array([0xEF]));
|
|
50
38
|
}
|
|
51
39
|
}
|
|
52
40
|
async receive() {
|
|
53
41
|
let length;
|
|
54
42
|
{
|
|
55
43
|
let buffer = new Uint8Array(1);
|
|
56
|
-
await
|
|
44
|
+
await this.#connection.read(buffer);
|
|
57
45
|
buffer = await this.decrypt(buffer);
|
|
58
46
|
if (buffer[0] < 0x7F) {
|
|
59
47
|
length = buffer[0];
|
|
60
48
|
}
|
|
61
49
|
else {
|
|
62
50
|
let buffer = new Uint8Array(3);
|
|
63
|
-
await
|
|
51
|
+
await this.#connection.read(buffer);
|
|
64
52
|
buffer = await this.decrypt(buffer);
|
|
65
53
|
length = Number(bigIntFromBuffer(buffer));
|
|
66
54
|
}
|
|
67
55
|
}
|
|
68
56
|
length *= 4;
|
|
69
57
|
const buffer = new Uint8Array(length);
|
|
70
|
-
await
|
|
58
|
+
await this.#connection.read(buffer);
|
|
71
59
|
return await this.decrypt(buffer);
|
|
72
60
|
}
|
|
73
61
|
async send(buffer) {
|
|
@@ -75,7 +63,6 @@ export class TransportAbridged extends Transport {
|
|
|
75
63
|
const header = new Uint8Array([bufferLength >= 0x7F ? 0x7F : bufferLength]);
|
|
76
64
|
const length = bufferLength >= 0x7F ? bufferFromBigInt(bufferLength, 3) : new Uint8Array();
|
|
77
65
|
const data = concat([header, length, buffer]);
|
|
78
|
-
await
|
|
66
|
+
await this.#connection.write(await this.encrypt(data));
|
|
79
67
|
}
|
|
80
68
|
}
|
|
81
|
-
_TransportAbridged_connection = new WeakMap(), _TransportAbridged_obfuscated = new WeakMap();
|
|
@@ -17,55 +17,42 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
21
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
22
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
23
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
24
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
25
|
-
};
|
|
26
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
28
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
29
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
-
};
|
|
31
|
-
var _TransportIntermediate_connection, _TransportIntermediate_obfuscated;
|
|
32
20
|
import { concat } from "../0_deps.js";
|
|
33
21
|
import { bufferFromBigInt } from "../1_utilities.js";
|
|
34
22
|
import { getObfuscationParameters } from "./0_obfuscation.js";
|
|
35
23
|
import { Transport } from "./0_transport.js";
|
|
36
24
|
export class TransportIntermediate extends Transport {
|
|
25
|
+
#connection;
|
|
26
|
+
#obfuscated;
|
|
37
27
|
constructor(connection, obfuscated = false) {
|
|
38
28
|
super();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
__classPrivateFieldSet(this, _TransportIntermediate_connection, connection, "f");
|
|
42
|
-
__classPrivateFieldSet(this, _TransportIntermediate_obfuscated, obfuscated, "f");
|
|
29
|
+
this.#connection = connection;
|
|
30
|
+
this.#obfuscated = obfuscated;
|
|
43
31
|
}
|
|
44
32
|
async initialize() {
|
|
45
|
-
if (
|
|
46
|
-
this.obfuscationParameters = await getObfuscationParameters(0xEEEEEEEE,
|
|
33
|
+
if (this.#obfuscated) {
|
|
34
|
+
this.obfuscationParameters = await getObfuscationParameters(0xEEEEEEEE, this.#connection);
|
|
47
35
|
}
|
|
48
36
|
else {
|
|
49
|
-
await
|
|
37
|
+
await this.#connection.write(new Uint8Array([0xEE, 0xEE, 0xEE, 0xEE]));
|
|
50
38
|
}
|
|
51
39
|
}
|
|
52
40
|
async receive() {
|
|
53
41
|
let length;
|
|
54
42
|
{
|
|
55
43
|
let buffer = new Uint8Array(4);
|
|
56
|
-
await
|
|
44
|
+
await this.#connection.read(buffer);
|
|
57
45
|
buffer = await this.decrypt(buffer);
|
|
58
46
|
const dataView = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
59
47
|
length = dataView.getUint32(0, true);
|
|
60
48
|
}
|
|
61
49
|
const buffer = new Uint8Array(length);
|
|
62
|
-
await
|
|
50
|
+
await this.#connection.read(buffer);
|
|
63
51
|
return await this.decrypt(buffer);
|
|
64
52
|
}
|
|
65
53
|
async send(buffer) {
|
|
66
54
|
const length = bufferFromBigInt(buffer.length, 4);
|
|
67
55
|
const data = concat([length, buffer]);
|
|
68
|
-
await
|
|
56
|
+
await this.#connection.write(await this.encrypt(data));
|
|
69
57
|
}
|
|
70
58
|
}
|
|
71
|
-
_TransportIntermediate_connection = new WeakMap(), _TransportIntermediate_obfuscated = new WeakMap();
|
package/{script/transport/2_transport_provider.d.ts → esm/transport/1_transport_provider.d.ts}
RENAMED
|
@@ -32,4 +32,4 @@ export type TransportProvider = (params: TransportProviderParams) => {
|
|
|
32
32
|
};
|
|
33
33
|
export declare function getDcId(dc: DC, cdn: boolean): number;
|
|
34
34
|
export declare function getDc(dcId: number): DC;
|
|
35
|
-
//# sourceMappingURL=
|
|
35
|
+
//# sourceMappingURL=1_transport_provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"1_transport_provider.d.ts","sourceRoot":"","sources":["../../src/transport/1_transport_provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,MAAM,MAAM,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC9E,wBAAgB,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAiDhF;AAED,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,EAAE,CAAC;IACP,GAAG,EAAE,OAAO,CAAC;CACd;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,uBAAuB,KAAK;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpI,wBAAgB,OAAO,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,EAAE,CAOtC"}
|