@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_utilities_test.d.ts","sourceRoot":"","sources":["../../src/storage/1_utilities_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"1_utilities_test.d.ts","sourceRoot":"","sources":["../../src/storage/1_utilities_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -17,45 +17,27 @@
|
|
|
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 _StorageIndexedDB_instances, _StorageIndexedDB_name, _StorageIndexedDB_id, _StorageIndexedDB_supportsFiles, _StorageIndexedDB_fixKey;
|
|
32
20
|
import { fixKey, getPrefixKeyRange, restoreKey } from "./1_utilities.js";
|
|
33
21
|
const VERSION = 1;
|
|
34
22
|
const KV_OBJECT_STORE = "kv";
|
|
35
23
|
export class StorageIndexedDB {
|
|
24
|
+
database = null;
|
|
25
|
+
#name;
|
|
26
|
+
#id = null;
|
|
27
|
+
#supportsFiles;
|
|
36
28
|
constructor(name, params) {
|
|
37
|
-
_StorageIndexedDB_instances.add(this);
|
|
38
|
-
Object.defineProperty(this, "database", {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
configurable: true,
|
|
41
|
-
writable: true,
|
|
42
|
-
value: null
|
|
43
|
-
});
|
|
44
|
-
_StorageIndexedDB_name.set(this, void 0);
|
|
45
|
-
_StorageIndexedDB_id.set(this, null);
|
|
46
|
-
_StorageIndexedDB_supportsFiles.set(this, void 0);
|
|
47
29
|
if (typeof indexedDB == "undefined") {
|
|
48
30
|
throw new Error("Unavailable in current environment");
|
|
49
31
|
}
|
|
50
|
-
|
|
51
|
-
|
|
32
|
+
this.#name = name;
|
|
33
|
+
this.#supportsFiles = params?.storeFiles ?? true;
|
|
52
34
|
}
|
|
53
35
|
get name() {
|
|
54
|
-
return
|
|
36
|
+
return this.#name;
|
|
55
37
|
}
|
|
56
38
|
branch(id) {
|
|
57
|
-
const storage = new StorageIndexedDB(this.name, { storeFiles:
|
|
58
|
-
|
|
39
|
+
const storage = new StorageIndexedDB(this.name, { storeFiles: this.#supportsFiles });
|
|
40
|
+
storage.#id = id;
|
|
59
41
|
return storage;
|
|
60
42
|
}
|
|
61
43
|
initialize() {
|
|
@@ -73,13 +55,21 @@ export class StorageIndexedDB {
|
|
|
73
55
|
});
|
|
74
56
|
}
|
|
75
57
|
get supportsFiles() {
|
|
76
|
-
return
|
|
58
|
+
return this.#supportsFiles;
|
|
77
59
|
}
|
|
78
60
|
get mustSerialize() {
|
|
79
61
|
return true;
|
|
80
62
|
}
|
|
63
|
+
#fixKey(key) {
|
|
64
|
+
if (this.#id !== null) {
|
|
65
|
+
return ["__S" + this.#id, ...key];
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
return key;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
81
71
|
set(k, v, tx_) {
|
|
82
|
-
k =
|
|
72
|
+
k = this.#fixKey(k);
|
|
83
73
|
if (!this.database) {
|
|
84
74
|
throw new Error("Not initialized");
|
|
85
75
|
}
|
|
@@ -103,7 +93,7 @@ export class StorageIndexedDB {
|
|
|
103
93
|
}
|
|
104
94
|
get(k, tx_, fix = true) {
|
|
105
95
|
if (fix) {
|
|
106
|
-
k =
|
|
96
|
+
k = this.#fixKey(k);
|
|
107
97
|
}
|
|
108
98
|
if (!this.database) {
|
|
109
99
|
throw new Error("Not initialized");
|
|
@@ -120,14 +110,14 @@ export class StorageIndexedDB {
|
|
|
120
110
|
});
|
|
121
111
|
}
|
|
122
112
|
async *getMany(filter, params, tx_) {
|
|
123
|
-
if ("prefix" in filter &&
|
|
124
|
-
filter.prefix =
|
|
113
|
+
if ("prefix" in filter && this.#id !== null) {
|
|
114
|
+
filter.prefix = this.#fixKey(filter.prefix);
|
|
125
115
|
}
|
|
126
|
-
if ("start" in filter &&
|
|
127
|
-
filter.start =
|
|
116
|
+
if ("start" in filter && this.#id !== null) {
|
|
117
|
+
filter.start = this.#fixKey(filter.start);
|
|
128
118
|
}
|
|
129
|
-
if ("end" in filter &&
|
|
130
|
-
filter.end =
|
|
119
|
+
if ("end" in filter && this.#id !== null) {
|
|
120
|
+
filter.end = this.#fixKey(filter.end);
|
|
131
121
|
}
|
|
132
122
|
if (!this.database) {
|
|
133
123
|
throw new Error("Not initialized");
|
|
@@ -177,11 +167,3 @@ export class StorageIndexedDB {
|
|
|
177
167
|
await this.set(key, (currentValue || 0) + by, tx);
|
|
178
168
|
}
|
|
179
169
|
}
|
|
180
|
-
_StorageIndexedDB_name = new WeakMap(), _StorageIndexedDB_id = new WeakMap(), _StorageIndexedDB_supportsFiles = new WeakMap(), _StorageIndexedDB_instances = new WeakSet(), _StorageIndexedDB_fixKey = function _StorageIndexedDB_fixKey(key) {
|
|
181
|
-
if (__classPrivateFieldGet(this, _StorageIndexedDB_id, "f") !== null) {
|
|
182
|
-
return ["__S" + __classPrivateFieldGet(this, _StorageIndexedDB_id, "f"), ...key];
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
return key;
|
|
186
|
-
}
|
|
187
|
-
};
|
|
@@ -17,34 +17,22 @@
|
|
|
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 _StorageLocalStorage_prefix, _StorageLocalStorage_path, _StorageLocalStorage_storage;
|
|
32
20
|
import { LocalStorage } from "node-localstorage";
|
|
33
21
|
import { fromString, isInRange, toString } from "./1_utilities.js";
|
|
34
22
|
export class StorageLocalStorage {
|
|
23
|
+
#prefix;
|
|
24
|
+
#path;
|
|
25
|
+
#storage;
|
|
35
26
|
constructor(path) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
_StorageLocalStorage_storage.set(this, void 0);
|
|
39
|
-
__classPrivateFieldSet(this, _StorageLocalStorage_prefix, "main", "f");
|
|
40
|
-
__classPrivateFieldSet(this, _StorageLocalStorage_storage, new LocalStorage(__classPrivateFieldSet(this, _StorageLocalStorage_path, path, "f")), "f");
|
|
27
|
+
this.#prefix = "main";
|
|
28
|
+
this.#storage = new LocalStorage(this.#path = path);
|
|
41
29
|
}
|
|
42
30
|
get prefix() {
|
|
43
|
-
return
|
|
31
|
+
return this.#prefix;
|
|
44
32
|
}
|
|
45
33
|
branch(id) {
|
|
46
|
-
const storage = new StorageLocalStorage(
|
|
47
|
-
|
|
34
|
+
const storage = new StorageLocalStorage(this.#path);
|
|
35
|
+
storage.#prefix = this.prefix + "S__" + id;
|
|
48
36
|
return storage;
|
|
49
37
|
}
|
|
50
38
|
initialize() {
|
|
@@ -57,7 +45,7 @@ export class StorageLocalStorage {
|
|
|
57
45
|
}
|
|
58
46
|
get(key_) {
|
|
59
47
|
const key = this.prefix + toString(key_);
|
|
60
|
-
const value =
|
|
48
|
+
const value = this.#storage.getItem(key);
|
|
61
49
|
if (value != null) {
|
|
62
50
|
return fromString(value);
|
|
63
51
|
}
|
|
@@ -66,7 +54,7 @@ export class StorageLocalStorage {
|
|
|
66
54
|
}
|
|
67
55
|
}
|
|
68
56
|
*getMany(filter, params) {
|
|
69
|
-
let entries = Object.entries(
|
|
57
|
+
let entries = Object.entries(this.#storage).sort(([a], [b]) => a.localeCompare(b));
|
|
70
58
|
if (params?.reverse) {
|
|
71
59
|
entries.reverse();
|
|
72
60
|
}
|
|
@@ -98,14 +86,13 @@ export class StorageLocalStorage {
|
|
|
98
86
|
set(key_, value) {
|
|
99
87
|
const key = this.prefix + toString(key_);
|
|
100
88
|
if (value != null) {
|
|
101
|
-
|
|
89
|
+
this.#storage.setItem(key, toString(value));
|
|
102
90
|
}
|
|
103
91
|
else {
|
|
104
|
-
|
|
92
|
+
this.#storage.removeItem(key);
|
|
105
93
|
}
|
|
106
94
|
}
|
|
107
95
|
incr(key, by) {
|
|
108
96
|
this.set(key, (this.get(key) || 0) + by);
|
|
109
97
|
}
|
|
110
98
|
}
|
|
111
|
-
_StorageLocalStorage_prefix = new WeakMap(), _StorageLocalStorage_path = new WeakMap(), _StorageLocalStorage_storage = new WeakMap();
|
|
@@ -17,49 +17,49 @@
|
|
|
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 __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
21
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
22
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
23
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
24
|
-
};
|
|
25
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
-
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");
|
|
29
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
-
};
|
|
31
|
-
var _StorageMemory_instances, _StorageMemory_id, _StorageMemory_fixKey, _StorageMemory_getEntries;
|
|
32
20
|
import { fromString, isInRange, toString } from "./1_utilities.js";
|
|
33
21
|
export class StorageMemory {
|
|
22
|
+
map = new Map();
|
|
23
|
+
#id = null;
|
|
34
24
|
constructor() {
|
|
35
|
-
_StorageMemory_instances.add(this);
|
|
36
|
-
Object.defineProperty(this, "map", {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
configurable: true,
|
|
39
|
-
writable: true,
|
|
40
|
-
value: new Map()
|
|
41
|
-
});
|
|
42
|
-
_StorageMemory_id.set(this, null);
|
|
43
25
|
}
|
|
44
26
|
get mustSerialize() {
|
|
45
27
|
return false;
|
|
46
28
|
}
|
|
47
29
|
initialize() {
|
|
48
30
|
}
|
|
31
|
+
#fixKey(key) {
|
|
32
|
+
if (this.#id !== null) {
|
|
33
|
+
return ["__S" + this.#id, ...key];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return key;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
49
39
|
branch(id) {
|
|
50
40
|
const storage = new StorageMemory();
|
|
51
|
-
|
|
41
|
+
storage.#id = id;
|
|
52
42
|
return storage;
|
|
53
43
|
}
|
|
54
44
|
get supportsFiles() {
|
|
55
45
|
return false;
|
|
56
46
|
}
|
|
57
47
|
get(key) {
|
|
58
|
-
key =
|
|
48
|
+
key = this.#fixKey(key);
|
|
59
49
|
return this.map.get(toString(key)) ?? null;
|
|
60
50
|
}
|
|
51
|
+
#getEntries() {
|
|
52
|
+
const entries = new Array();
|
|
53
|
+
for (const entry of this.map.entries()) {
|
|
54
|
+
if (this.#id !== null && !entry[0].startsWith("__S" + this.#id)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
entries.push(entry);
|
|
58
|
+
}
|
|
59
|
+
return entries;
|
|
60
|
+
}
|
|
61
61
|
*getMany(filter, params) {
|
|
62
|
-
let entries =
|
|
62
|
+
let entries = this.#getEntries();
|
|
63
63
|
if (params?.reverse) {
|
|
64
64
|
entries.reverse();
|
|
65
65
|
}
|
|
@@ -86,7 +86,7 @@ export class StorageMemory {
|
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
set(key_, value) {
|
|
89
|
-
key_ =
|
|
89
|
+
key_ = this.#fixKey(key_);
|
|
90
90
|
const key = toString(key_);
|
|
91
91
|
if (value != null) {
|
|
92
92
|
this.map.set(key, value);
|
|
@@ -99,20 +99,3 @@ export class StorageMemory {
|
|
|
99
99
|
this.set(key, (this.get(key) || 0) + by);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
_StorageMemory_id = new WeakMap(), _StorageMemory_instances = new WeakSet(), _StorageMemory_fixKey = function _StorageMemory_fixKey(key) {
|
|
103
|
-
if (__classPrivateFieldGet(this, _StorageMemory_id, "f") !== null) {
|
|
104
|
-
return ["__S" + __classPrivateFieldGet(this, _StorageMemory_id, "f"), ...key];
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
return key;
|
|
108
|
-
}
|
|
109
|
-
}, _StorageMemory_getEntries = function _StorageMemory_getEntries() {
|
|
110
|
-
const entries = new Array();
|
|
111
|
-
for (const entry of this.map.entries()) {
|
|
112
|
-
if (__classPrivateFieldGet(this, _StorageMemory_id, "f") !== null && !entry[0].startsWith("__S" + __classPrivateFieldGet(this, _StorageMemory_id, "f"))) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
entries.push(entry);
|
|
116
|
-
}
|
|
117
|
-
return entries;
|
|
118
|
-
};
|
|
@@ -17,35 +17,23 @@
|
|
|
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 _StorageSessionStorage_prefix;
|
|
32
20
|
import { fromString, isInRange, toString } from "./1_utilities.js";
|
|
33
21
|
export class StorageSessionStorage {
|
|
22
|
+
#prefix;
|
|
34
23
|
constructor(prefix) {
|
|
35
|
-
_StorageSessionStorage_prefix.set(this, void 0);
|
|
36
24
|
if (typeof sessionStorage === "undefined") {
|
|
37
25
|
throw new Error("Unavailable in current environment");
|
|
38
26
|
}
|
|
39
27
|
if (prefix.length <= 0) {
|
|
40
28
|
throw new Error("Empty prefix");
|
|
41
29
|
}
|
|
42
|
-
|
|
30
|
+
this.#prefix = prefix;
|
|
43
31
|
}
|
|
44
32
|
get mustSerialize() {
|
|
45
33
|
return true;
|
|
46
34
|
}
|
|
47
35
|
get prefix() {
|
|
48
|
-
return
|
|
36
|
+
return this.#prefix;
|
|
49
37
|
}
|
|
50
38
|
branch(id) {
|
|
51
39
|
return new StorageSessionStorage(this.prefix + "S__" + id);
|
|
@@ -108,4 +96,3 @@ export class StorageSessionStorage {
|
|
|
108
96
|
this.set(key, (this.get(key) || 0) + by);
|
|
109
97
|
}
|
|
110
98
|
}
|
|
111
|
-
_StorageSessionStorage_prefix = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_utilities_test.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"0_utilities_test.d.ts","sourceRoot":"","sources":["../../src/tl/0_utilities_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
package/esm/tl/1_tl_reader.js
CHANGED
|
@@ -18,25 +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 _TLReader_instances, _TLReader_deserializeEnum, _TLReader_deserializeType, _TLReader_deserializeVector, _TLReader_deserializePrimitive;
|
|
27
21
|
import { bigIntFromBuffer, decodeText } from "../1_utilities.js";
|
|
28
22
|
import { analyzeOptionalParam, BOOL_FALSE, BOOL_TRUE, getOptionalParamInnerType, getVectorItemType, isOptionalParam, VECTOR, X } from "./0_utilities.js";
|
|
29
23
|
export class TLError extends Error {
|
|
30
24
|
}
|
|
31
25
|
export class TLReader {
|
|
26
|
+
_buffer;
|
|
32
27
|
constructor(_buffer) {
|
|
33
|
-
|
|
34
|
-
Object.defineProperty(this, "_buffer", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
configurable: true,
|
|
37
|
-
writable: true,
|
|
38
|
-
value: _buffer
|
|
39
|
-
});
|
|
28
|
+
this._buffer = _buffer;
|
|
40
29
|
}
|
|
41
30
|
get buffer() {
|
|
42
31
|
return this._buffer;
|
|
@@ -107,7 +96,7 @@ export class TLReader {
|
|
|
107
96
|
if (isOptionalParam(name)) {
|
|
108
97
|
name = getOptionalParamInnerType(name);
|
|
109
98
|
}
|
|
110
|
-
const primitive =
|
|
99
|
+
const primitive = this.#deserializePrimitive(name);
|
|
111
100
|
if (primitive !== undefined) {
|
|
112
101
|
return primitive;
|
|
113
102
|
}
|
|
@@ -121,93 +110,96 @@ export class TLReader {
|
|
|
121
110
|
return await this.readType(typeName, schema);
|
|
122
111
|
}
|
|
123
112
|
if (id == VECTOR) {
|
|
124
|
-
return await
|
|
113
|
+
return await this.#deserializeVector(name, schema);
|
|
125
114
|
}
|
|
126
115
|
const definition = schema.definitions[name];
|
|
127
116
|
if (definition) {
|
|
128
|
-
return await
|
|
117
|
+
return await this.#deserializeType(name, definition, id, schema);
|
|
129
118
|
}
|
|
130
|
-
const deserializedEnum = await
|
|
119
|
+
const deserializedEnum = await this.#deserializeEnum(name, id, schema);
|
|
131
120
|
if (deserializedEnum !== undefined) {
|
|
132
121
|
return deserializedEnum;
|
|
133
122
|
}
|
|
134
123
|
throw new TLError(`Unknown type: ${name} ID ${id}`);
|
|
135
124
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
125
|
+
async #deserializeEnum(type, id, schema) {
|
|
126
|
+
const name = schema.identifierToName[id];
|
|
127
|
+
if (!name) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const definition = schema.definitions[name];
|
|
131
|
+
if (definition[2] != type) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
return await this.#deserializeType(name, definition, id, schema);
|
|
135
|
+
}
|
|
136
|
+
async #deserializeType(type, desc, id, schema) {
|
|
137
|
+
if (desc[0] != id) {
|
|
138
|
+
throw new TLError(`Expected constructor ${desc[0].toString(16)} but got ${id}`);
|
|
139
|
+
}
|
|
140
|
+
const type_ = { _: type };
|
|
141
|
+
const flagFields = {};
|
|
142
|
+
for (const [name, type] of desc[1]) {
|
|
143
|
+
if (isOptionalParam(type)) {
|
|
144
|
+
const { flagField, bitIndex } = analyzeOptionalParam(type);
|
|
145
|
+
const bits = flagFields[flagField];
|
|
146
|
+
if ((bits & (1 << bitIndex)) == 0) {
|
|
147
|
+
continue;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (type == "#") {
|
|
151
|
+
flagFields[name] = this.readInt32();
|
|
158
152
|
continue;
|
|
159
153
|
}
|
|
154
|
+
const value = await this.readType(type, schema);
|
|
155
|
+
if (typeof value !== "boolean" || value) {
|
|
156
|
+
type_[name] = value;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return type_;
|
|
160
|
+
}
|
|
161
|
+
async #deserializeVector(type, schema) {
|
|
162
|
+
const itemType = getVectorItemType(type);
|
|
163
|
+
if (!itemType) {
|
|
164
|
+
throw new TLError(`Expected Vector but received ${type}`);
|
|
165
|
+
}
|
|
166
|
+
const size = this.readInt32();
|
|
167
|
+
const array = new Array();
|
|
168
|
+
for (let i = 0; i < size; ++i) {
|
|
169
|
+
array.push(await this.readType(itemType, schema));
|
|
160
170
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
const size = this.readInt32();
|
|
177
|
-
const array = new Array();
|
|
178
|
-
for (let i = 0; i < size; ++i) {
|
|
179
|
-
array.push(await this.readType(itemType, schema));
|
|
180
|
-
}
|
|
181
|
-
return array;
|
|
182
|
-
}, _TLReader_deserializePrimitive = function _TLReader_deserializePrimitive(type) {
|
|
183
|
-
switch (type) {
|
|
184
|
-
case "bytes":
|
|
185
|
-
return this.readBytes();
|
|
186
|
-
case "int128":
|
|
187
|
-
return this.readInt128();
|
|
188
|
-
case "int256":
|
|
189
|
-
return this.readInt256();
|
|
190
|
-
case "double":
|
|
191
|
-
return this.readDouble();
|
|
192
|
-
case "long":
|
|
193
|
-
return this.readInt64();
|
|
194
|
-
case "true":
|
|
195
|
-
return true;
|
|
196
|
-
case "int":
|
|
197
|
-
return this.readInt32();
|
|
198
|
-
case "Bool": {
|
|
199
|
-
const id = this.readInt32(false);
|
|
200
|
-
if (id == BOOL_TRUE) {
|
|
171
|
+
return array;
|
|
172
|
+
}
|
|
173
|
+
#deserializePrimitive(type) {
|
|
174
|
+
switch (type) {
|
|
175
|
+
case "bytes":
|
|
176
|
+
return this.readBytes();
|
|
177
|
+
case "int128":
|
|
178
|
+
return this.readInt128();
|
|
179
|
+
case "int256":
|
|
180
|
+
return this.readInt256();
|
|
181
|
+
case "double":
|
|
182
|
+
return this.readDouble();
|
|
183
|
+
case "long":
|
|
184
|
+
return this.readInt64();
|
|
185
|
+
case "true":
|
|
201
186
|
return true;
|
|
187
|
+
case "int":
|
|
188
|
+
return this.readInt32();
|
|
189
|
+
case "Bool": {
|
|
190
|
+
const id = this.readInt32(false);
|
|
191
|
+
if (id == BOOL_TRUE) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
else if (id == BOOL_FALSE) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
throw new TLError(`Expected boolTrue or boolFalse but got ${id}`);
|
|
199
|
+
}
|
|
202
200
|
}
|
|
203
|
-
|
|
204
|
-
return
|
|
205
|
-
}
|
|
206
|
-
else {
|
|
207
|
-
throw new TLError(`Expected boolTrue or boolFalse but got ${id}`);
|
|
208
|
-
}
|
|
201
|
+
case "string":
|
|
202
|
+
return this.readString();
|
|
209
203
|
}
|
|
210
|
-
case "string":
|
|
211
|
-
return this.readString();
|
|
212
204
|
}
|
|
213
|
-
}
|
|
205
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_tl_reader_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_reader_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"1_tl_reader_test.d.ts","sourceRoot":"","sources":["../../src/tl/1_tl_reader_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|