@mtkruto/node 0.1.190 → 0.1.200
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.d.ts +12 -0
- package/esm/0_errors.js +19 -0
- package/esm/1_utilities.d.ts +1 -1
- package/esm/1_utilities.js +1 -1
- package/esm/2_tl.d.ts +6 -6
- package/esm/2_tl.js +6 -6
- package/esm/3_storage.d.ts +5 -5
- package/esm/3_storage.js +5 -5
- package/esm/3_types.d.ts +6 -5
- package/esm/3_types.js +6 -5
- package/esm/4_constants.d.ts +2 -2
- package/esm/4_constants.js +2 -2
- package/esm/5_client.d.ts +1 -1
- package/esm/5_client.js +1 -1
- package/esm/client/0_client_abstract.js +3 -2
- package/esm/client/0_html.js +4 -3
- package/esm/client/0_markdown.js +6 -5
- package/esm/client/0_params.d.ts +7 -1
- package/esm/client/0_types.d.ts +1 -2
- package/esm/client/0_types.js +1 -2
- package/esm/client/0_utilities.d.ts +0 -3
- package/esm/client/0_utilities.js +2 -21
- package/esm/client/1_business_connection_manager.d.ts +11 -0
- package/esm/client/1_business_connection_manager.js +47 -0
- package/esm/client/1_client_encrypted.js +1 -1
- package/esm/client/1_client_plain.js +3 -4
- package/esm/client/1_composer.js +3 -2
- package/esm/client/1_file_manager.js +4 -4
- package/esm/client/1_update_manager.d.ts +8 -1
- package/esm/client/1_update_manager.js +88 -8
- package/esm/client/2_message_manager.d.ts +7 -6
- package/esm/client/2_message_manager.js +89 -74
- package/esm/client/3_chat_list_manager.js +3 -2
- package/esm/client/3_story_manager.js +2 -1
- package/esm/client/4_client.d.ts +422 -421
- package/esm/client/4_client.js +578 -520
- package/esm/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/storage/0_storage.d.ts +5 -0
- package/esm/storage/0_storage.js +20 -0
- package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
- package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
- package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
- package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
- package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
- package/esm/tl/2_types.d.ts +1071 -183
- package/esm/tl/2_types.js +2916 -464
- package/esm/tl/3_functions.d.ts +381 -17
- package/esm/tl/3_functions.js +1002 -120
- package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
- package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
- package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
- package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
- package/esm/tl/{6_message.js → 7_message.js} +3 -3
- package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
- package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
- package/esm/types/0_chat_photo.d.ts +1 -0
- package/esm/types/0_chat_photo.js +8 -5
- package/esm/types/0_message_entity.d.ts +1 -1
- package/esm/types/0_thumbnail.js +1 -1
- package/esm/types/1_bot_command_scope.d.ts +1 -1
- package/esm/types/1_photo.js +2 -2
- package/esm/types/1_story_privacy.d.ts +1 -1
- package/esm/types/2_business_connection.d.ts +11 -0
- package/esm/types/2_business_connection.js +12 -0
- package/esm/types/2_chat_member.d.ts +1 -1
- package/esm/types/2_chosen_inline_result.d.ts +1 -1
- package/esm/types/2_game.js +1 -1
- package/esm/types/2_inline_keyboard_button.d.ts +1 -1
- package/esm/types/2_inline_query.d.ts +1 -1
- package/esm/types/2_invite_link.d.ts +1 -1
- package/esm/types/2_message_reaction_count.d.ts +1 -1
- package/esm/types/2_message_reactions.d.ts +1 -1
- package/esm/types/2_story_content.js +1 -1
- package/{script/types/1_story_interactive_area.d.ts → esm/types/2_story_interactive_area.d.ts} +2 -2
- package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
- package/esm/types/3_chat_member_updated.d.ts +1 -1
- package/esm/types/3_reply_markup.d.ts +1 -1
- package/esm/types/3_story.d.ts +2 -2
- package/esm/types/3_story.js +1 -1
- package/esm/types/4_inline_query_result.d.ts +1 -1
- package/esm/types/4_inline_query_result.js +1 -1
- package/esm/types/4_message.d.ts +9 -3
- package/esm/types/4_message.js +22 -5
- package/esm/types/5_callback_query.d.ts +1 -1
- package/esm/types/5_callback_query.js +2 -1
- package/esm/types/5_chat.d.ts +1 -1
- package/esm/types/6_update.d.ts +12 -2
- package/esm/types/{0__file_id.js → _file_id.js} +2 -1
- package/package.json +1 -1
- package/script/0_errors.d.ts +12 -0
- package/script/0_errors.js +27 -0
- package/script/1_utilities.d.ts +1 -1
- package/script/1_utilities.js +1 -1
- package/script/2_tl.d.ts +6 -6
- package/script/2_tl.js +6 -6
- package/script/3_storage.d.ts +5 -5
- package/script/3_storage.js +5 -5
- package/script/3_types.d.ts +6 -5
- package/script/3_types.js +6 -5
- package/script/4_constants.d.ts +2 -2
- package/script/4_constants.js +2 -2
- package/script/5_client.d.ts +1 -1
- package/script/5_client.js +1 -1
- package/script/client/0_client_abstract.js +3 -2
- package/script/client/0_html.js +4 -3
- package/script/client/0_markdown.js +6 -5
- package/script/client/0_params.d.ts +7 -1
- package/script/client/0_types.d.ts +1 -2
- package/script/client/0_types.js +0 -4
- package/script/client/0_utilities.d.ts +0 -3
- package/script/client/0_utilities.js +3 -24
- package/script/client/1_business_connection_manager.d.ts +11 -0
- package/script/client/1_business_connection_manager.js +51 -0
- package/script/client/1_client_encrypted.js +2 -2
- package/script/client/1_client_plain.js +3 -4
- package/script/client/1_composer.js +3 -2
- package/script/client/1_file_manager.js +5 -5
- package/script/client/1_update_manager.d.ts +8 -1
- package/script/client/1_update_manager.js +88 -8
- package/script/client/2_message_manager.d.ts +7 -6
- package/script/client/2_message_manager.js +88 -73
- package/script/client/3_chat_list_manager.js +3 -2
- package/script/client/3_story_manager.js +2 -1
- package/script/client/4_client.d.ts +422 -421
- package/script/client/4_client.js +578 -520
- package/script/mod.d.ts +1 -0
- package/script/mod.js +1 -0
- package/script/storage/0_storage.d.ts +5 -0
- package/script/storage/0_storage.js +20 -0
- package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
- package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
- package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
- package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
- package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
- package/script/tl/2_types.d.ts +1071 -183
- package/script/tl/2_types.js +3028 -504
- package/script/tl/3_functions.d.ts +381 -17
- package/script/tl/3_functions.js +1047 -143
- package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
- package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
- package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
- package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
- package/script/tl/{6_message.js → 7_message.js} +8 -8
- package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
- package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
- package/script/types/0_chat_photo.d.ts +1 -0
- package/script/types/0_chat_photo.js +16 -13
- package/script/types/0_message_entity.d.ts +1 -1
- package/script/types/0_thumbnail.js +6 -6
- package/script/types/1_bot_command_scope.d.ts +1 -1
- package/script/types/1_photo.js +7 -7
- package/script/types/1_story_privacy.d.ts +1 -1
- package/script/types/2_business_connection.d.ts +11 -0
- package/script/types/2_business_connection.js +16 -0
- package/script/types/2_chat_member.d.ts +1 -1
- package/script/types/2_chosen_inline_result.d.ts +1 -1
- package/script/types/2_game.js +3 -3
- package/script/types/2_inline_keyboard_button.d.ts +1 -1
- package/script/types/2_inline_query.d.ts +1 -1
- package/script/types/2_invite_link.d.ts +1 -1
- package/script/types/2_message_reaction_count.d.ts +1 -1
- package/script/types/2_message_reactions.d.ts +1 -1
- package/script/types/2_story_content.js +4 -4
- package/{esm/types/1_story_interactive_area.d.ts → script/types/2_story_interactive_area.d.ts} +2 -2
- package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
- package/script/types/3_chat_member_updated.d.ts +1 -1
- package/script/types/3_reply_markup.d.ts +1 -1
- package/script/types/3_story.d.ts +2 -2
- package/script/types/3_story.js +2 -2
- package/script/types/4_inline_query_result.d.ts +1 -1
- package/script/types/4_inline_query_result.js +2 -2
- package/script/types/4_message.d.ts +9 -3
- package/script/types/4_message.js +37 -20
- package/script/types/5_callback_query.d.ts +1 -1
- package/script/types/5_callback_query.js +2 -1
- package/script/types/5_chat.d.ts +1 -1
- package/script/types/6_update.d.ts +12 -2
- package/script/types/{0__file_id.js → _file_id.js} +2 -1
- /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
- /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
- /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
- /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
- /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
- /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
- /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
- /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
- /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
- /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
- /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
- /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
- /package/esm/types/{1__getters.js → _getters.js} +0 -0
- /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
- /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
- /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
- /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
- /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
- /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
- /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
- /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
- /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
- /package/script/types/{0_venue.js → 1_venue.js} +0 -0
- /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
- /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
- /package/script/types/{1__getters.js → _getters.js} +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class MtkrutoError extends Error {
|
|
2
|
+
}
|
|
3
|
+
export declare class ConnectionError extends MtkrutoError {
|
|
4
|
+
}
|
|
5
|
+
export declare class AccessError extends MtkrutoError {
|
|
6
|
+
}
|
|
7
|
+
export declare class InputError extends MtkrutoError {
|
|
8
|
+
}
|
|
9
|
+
export declare class TransportError extends MtkrutoError {
|
|
10
|
+
readonly code: number;
|
|
11
|
+
constructor(code: number);
|
|
12
|
+
}
|
package/esm/0_errors.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class MtkrutoError extends Error {
|
|
2
|
+
}
|
|
3
|
+
export class ConnectionError extends MtkrutoError {
|
|
4
|
+
}
|
|
5
|
+
export class AccessError extends MtkrutoError {
|
|
6
|
+
}
|
|
7
|
+
export class InputError extends MtkrutoError {
|
|
8
|
+
}
|
|
9
|
+
export class TransportError extends MtkrutoError {
|
|
10
|
+
constructor(code) {
|
|
11
|
+
super(`Transport error: ${code}`);
|
|
12
|
+
Object.defineProperty(this, "code", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
configurable: true,
|
|
15
|
+
writable: true,
|
|
16
|
+
value: code
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
package/esm/1_utilities.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./utilities/1_base64.js";
|
|
2
1
|
export * from "./utilities/0_bigint.js";
|
|
3
2
|
export * from "./utilities/0_buffer.js";
|
|
4
3
|
export * from "./utilities/0_cache_map.js";
|
|
@@ -12,5 +11,6 @@ export * from "./utilities/0_object.js";
|
|
|
12
11
|
export * from "./utilities/0_rle.js";
|
|
13
12
|
export * from "./utilities/0_types.js";
|
|
14
13
|
export * from "./utilities/1_auth.js";
|
|
14
|
+
export * from "./utilities/1_base64.js";
|
|
15
15
|
export * from "./utilities/1_misc.js";
|
|
16
16
|
export * from "./utilities/1_queue.js";
|
package/esm/1_utilities.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export * from "./utilities/1_base64.js";
|
|
2
1
|
export * from "./utilities/0_bigint.js";
|
|
3
2
|
export * from "./utilities/0_buffer.js";
|
|
4
3
|
export * from "./utilities/0_cache_map.js";
|
|
@@ -12,5 +11,6 @@ export * from "./utilities/0_object.js";
|
|
|
12
11
|
export * from "./utilities/0_rle.js";
|
|
13
12
|
export * from "./utilities/0_types.js";
|
|
14
13
|
export * from "./utilities/1_auth.js";
|
|
14
|
+
export * from "./utilities/1_base64.js";
|
|
15
15
|
export * from "./utilities/1_misc.js";
|
|
16
16
|
export * from "./utilities/1_queue.js";
|
package/esm/2_tl.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { TLError } from "./tl/0_tl_raw_reader.js";
|
|
2
2
|
export * from "./tl/1_tl_object.js";
|
|
3
3
|
export { type enums, types } from "./tl/2_types.js";
|
|
4
|
-
export { functions } from "./tl/3_functions.js";
|
|
5
|
-
export * from "./tl/3_tl_reader.js";
|
|
6
4
|
export * from "./tl/3_utilities.js";
|
|
7
|
-
export
|
|
8
|
-
export * from "./tl/
|
|
9
|
-
export * from "./tl/
|
|
10
|
-
export * from "./tl/
|
|
5
|
+
export { functions } from "./tl/3_functions.js";
|
|
6
|
+
export * from "./tl/4_tl_reader.js";
|
|
7
|
+
export * from "./tl/5_tl_writer.js";
|
|
8
|
+
export * from "./tl/6_rpc_result.js";
|
|
9
|
+
export * from "./tl/7_message.js";
|
|
10
|
+
export * from "./tl/8_message_container.js";
|
package/esm/2_tl.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { TLError } from "./tl/0_tl_raw_reader.js";
|
|
2
2
|
export * from "./tl/1_tl_object.js";
|
|
3
3
|
export { types } from "./tl/2_types.js";
|
|
4
|
-
export { functions } from "./tl/3_functions.js";
|
|
5
|
-
export * from "./tl/3_tl_reader.js";
|
|
6
4
|
export * from "./tl/3_utilities.js";
|
|
7
|
-
export
|
|
8
|
-
export * from "./tl/
|
|
9
|
-
export * from "./tl/
|
|
10
|
-
export * from "./tl/
|
|
5
|
+
export { functions } from "./tl/3_functions.js";
|
|
6
|
+
export * from "./tl/4_tl_reader.js";
|
|
7
|
+
export * from "./tl/5_tl_writer.js";
|
|
8
|
+
export * from "./tl/6_rpc_result.js";
|
|
9
|
+
export * from "./tl/7_message.js";
|
|
10
|
+
export * from "./tl/8_message_container.js";
|
package/esm/3_storage.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./storage/0_storage.js";
|
|
2
|
-
export * from "./storage/
|
|
3
|
-
export * from "./storage/
|
|
4
|
-
export * from "./storage/
|
|
5
|
-
export * from "./storage/
|
|
6
|
-
export * from "./storage/
|
|
2
|
+
export * from "./storage/1_utilities.js";
|
|
3
|
+
export * from "./storage/2_storage_indexed_db.js";
|
|
4
|
+
export * from "./storage/2_storage_local_storage.js";
|
|
5
|
+
export * from "./storage/2_storage_memory.js";
|
|
6
|
+
export * from "./storage/2_storage_session_storage.js";
|
package/esm/3_storage.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export * from "./storage/0_storage.js";
|
|
2
|
-
export * from "./storage/
|
|
3
|
-
export * from "./storage/
|
|
4
|
-
export * from "./storage/
|
|
5
|
-
export * from "./storage/
|
|
6
|
-
export * from "./storage/
|
|
2
|
+
export * from "./storage/1_utilities.js";
|
|
3
|
+
export * from "./storage/2_storage_indexed_db.js";
|
|
4
|
+
export * from "./storage/2_storage_local_storage.js";
|
|
5
|
+
export * from "./storage/2_storage_memory.js";
|
|
6
|
+
export * from "./storage/2_storage_session_storage.js";
|
package/esm/3_types.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from "./types/_file_id.js";
|
|
2
|
+
export * from "./types/_getters.js";
|
|
1
3
|
export * from "./types/0_authorization_state.js";
|
|
2
4
|
export * from "./types/0_bot_command.js";
|
|
3
5
|
export * from "./types/0_chat_action.js";
|
|
@@ -7,7 +9,6 @@ export * from "./types/0_chat_photo.js";
|
|
|
7
9
|
export * from "./types/0_connection_state.js";
|
|
8
10
|
export * from "./types/0_contact.js";
|
|
9
11
|
export * from "./types/0_dice.js";
|
|
10
|
-
export * from "./types/0__file_id.js";
|
|
11
12
|
export * from "./types/0_file_source.js";
|
|
12
13
|
export * from "./types/0_giveaway_parameters.js";
|
|
13
14
|
export * from "./types/0_id.js";
|
|
@@ -28,14 +29,12 @@ export * from "./types/0_reaction.js";
|
|
|
28
29
|
export * from "./types/0_restriction_reason.js";
|
|
29
30
|
export * from "./types/0_story_reference.js";
|
|
30
31
|
export * from "./types/0_thumbnail.js";
|
|
31
|
-
export * from "./types/0_venue.js";
|
|
32
32
|
export * from "./types/0_voice.js";
|
|
33
33
|
export * from "./types/1_animation.js";
|
|
34
34
|
export * from "./types/1_audio.js";
|
|
35
35
|
export * from "./types/1_bot_command_scope.js";
|
|
36
36
|
export * from "./types/1_chat_p.js";
|
|
37
37
|
export * from "./types/1_document.js";
|
|
38
|
-
export * from "./types/1__getters.js";
|
|
39
38
|
export * from "./types/1_giveaway.js";
|
|
40
39
|
export * from "./types/1_inline_query_result_button.js";
|
|
41
40
|
export * from "./types/1_input_message_content.js";
|
|
@@ -48,12 +47,13 @@ export * from "./types/1_poll.js";
|
|
|
48
47
|
export * from "./types/1_reaction_count.js";
|
|
49
48
|
export * from "./types/1_reply_quote.js";
|
|
50
49
|
export * from "./types/1_sticker.js";
|
|
51
|
-
export * from "./types/1_story_interactive_area.js";
|
|
52
50
|
export * from "./types/1_story_privacy.js";
|
|
53
51
|
export * from "./types/1_story_reaction.js";
|
|
54
52
|
export * from "./types/1_user.js";
|
|
55
|
-
export * from "./types/
|
|
53
|
+
export * from "./types/1_venue.js";
|
|
56
54
|
export * from "./types/1_video.js";
|
|
55
|
+
export * from "./types/1_video_note.js";
|
|
56
|
+
export * from "./types/2_business_connection.js";
|
|
57
57
|
export * from "./types/2_chat_member.js";
|
|
58
58
|
export * from "./types/2_chosen_inline_result.js";
|
|
59
59
|
export * from "./types/2_game.js";
|
|
@@ -66,6 +66,7 @@ export * from "./types/2_message_reaction_count.js";
|
|
|
66
66
|
export * from "./types/2_message_reactions.js";
|
|
67
67
|
export * from "./types/2_story_content.js";
|
|
68
68
|
export * from "./types/2_story_interactions.js";
|
|
69
|
+
export * from "./types/2_story_interactive_area.js";
|
|
69
70
|
export * from "./types/3_chat_member_updated.js";
|
|
70
71
|
export * from "./types/3_reply_markup.js";
|
|
71
72
|
export * from "./types/3_story.js";
|
package/esm/3_types.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export * from "./types/_file_id.js";
|
|
2
|
+
export * from "./types/_getters.js";
|
|
1
3
|
export * from "./types/0_authorization_state.js";
|
|
2
4
|
export * from "./types/0_bot_command.js";
|
|
3
5
|
export * from "./types/0_chat_action.js";
|
|
@@ -7,7 +9,6 @@ export * from "./types/0_chat_photo.js";
|
|
|
7
9
|
export * from "./types/0_connection_state.js";
|
|
8
10
|
export * from "./types/0_contact.js";
|
|
9
11
|
export * from "./types/0_dice.js";
|
|
10
|
-
export * from "./types/0__file_id.js";
|
|
11
12
|
export * from "./types/0_file_source.js";
|
|
12
13
|
export * from "./types/0_giveaway_parameters.js";
|
|
13
14
|
export * from "./types/0_id.js";
|
|
@@ -28,14 +29,12 @@ export * from "./types/0_reaction.js";
|
|
|
28
29
|
export * from "./types/0_restriction_reason.js";
|
|
29
30
|
export * from "./types/0_story_reference.js";
|
|
30
31
|
export * from "./types/0_thumbnail.js";
|
|
31
|
-
export * from "./types/0_venue.js";
|
|
32
32
|
export * from "./types/0_voice.js";
|
|
33
33
|
export * from "./types/1_animation.js";
|
|
34
34
|
export * from "./types/1_audio.js";
|
|
35
35
|
export * from "./types/1_bot_command_scope.js";
|
|
36
36
|
export * from "./types/1_chat_p.js";
|
|
37
37
|
export * from "./types/1_document.js";
|
|
38
|
-
export * from "./types/1__getters.js";
|
|
39
38
|
export * from "./types/1_giveaway.js";
|
|
40
39
|
export * from "./types/1_inline_query_result_button.js";
|
|
41
40
|
export * from "./types/1_input_message_content.js";
|
|
@@ -48,12 +47,13 @@ export * from "./types/1_poll.js";
|
|
|
48
47
|
export * from "./types/1_reaction_count.js";
|
|
49
48
|
export * from "./types/1_reply_quote.js";
|
|
50
49
|
export * from "./types/1_sticker.js";
|
|
51
|
-
export * from "./types/1_story_interactive_area.js";
|
|
52
50
|
export * from "./types/1_story_privacy.js";
|
|
53
51
|
export * from "./types/1_story_reaction.js";
|
|
54
52
|
export * from "./types/1_user.js";
|
|
55
|
-
export * from "./types/
|
|
53
|
+
export * from "./types/1_venue.js";
|
|
56
54
|
export * from "./types/1_video.js";
|
|
55
|
+
export * from "./types/1_video_note.js";
|
|
56
|
+
export * from "./types/2_business_connection.js";
|
|
57
57
|
export * from "./types/2_chat_member.js";
|
|
58
58
|
export * from "./types/2_chosen_inline_result.js";
|
|
59
59
|
export * from "./types/2_game.js";
|
|
@@ -66,6 +66,7 @@ export * from "./types/2_message_reaction_count.js";
|
|
|
66
66
|
export * from "./types/2_message_reactions.js";
|
|
67
67
|
export * from "./types/2_story_content.js";
|
|
68
68
|
export * from "./types/2_story_interactions.js";
|
|
69
|
+
export * from "./types/2_story_interactive_area.js";
|
|
69
70
|
export * from "./types/3_chat_member_updated.js";
|
|
70
71
|
export * from "./types/3_reply_markup.js";
|
|
71
72
|
export * from "./types/3_story.js";
|
package/esm/4_constants.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { DC } from "./3_transport.js";
|
|
|
2
2
|
export type PublicKeys = readonly [bigint, [bigint, bigint]][];
|
|
3
3
|
export declare const PUBLIC_KEYS: PublicKeys;
|
|
4
4
|
export declare const INITIAL_DC: DC;
|
|
5
|
-
export declare const LAYER =
|
|
6
|
-
export declare const APP_VERSION = "MTKruto
|
|
5
|
+
export declare const LAYER = 177;
|
|
6
|
+
export declare const APP_VERSION = "MTKruto";
|
|
7
7
|
export declare const DEVICE_MODEL: string;
|
|
8
8
|
export declare const LANG_CODE: string;
|
|
9
9
|
export declare const LANG_PACK = "";
|
package/esm/4_constants.js
CHANGED
|
@@ -51,8 +51,8 @@ export const PUBLIC_KEYS = Object.freeze([
|
|
|
51
51
|
],
|
|
52
52
|
]);
|
|
53
53
|
export const INITIAL_DC = "2";
|
|
54
|
-
export const LAYER =
|
|
55
|
-
export const APP_VERSION = "MTKruto
|
|
54
|
+
export const LAYER = 177;
|
|
55
|
+
export const APP_VERSION = "MTKruto";
|
|
56
56
|
// @ts-ignore: lib
|
|
57
57
|
export const DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : (navigator.userAgent.split(" ")[0] || "Unknown") : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
58
58
|
export const LANG_CODE = typeof navigator === "undefined" || typeof navigator.language !== "string" ? "en" : navigator.language.split("-")[0];
|
package/esm/5_client.d.ts
CHANGED
package/esm/5_client.js
CHANGED
|
@@ -11,6 +11,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _ClientAbstract_dc;
|
|
13
13
|
import { initTgCrypto } from "../0_deps.js";
|
|
14
|
+
import { ConnectionError } from "../0_errors.js";
|
|
14
15
|
import { transportProviderWebSocket } from "../3_transport.js";
|
|
15
16
|
import { INITIAL_DC } from "../4_constants.js";
|
|
16
17
|
export class ClientAbstract {
|
|
@@ -55,7 +56,7 @@ export class ClientAbstract {
|
|
|
55
56
|
}
|
|
56
57
|
get dcId() {
|
|
57
58
|
if (!this.transport) {
|
|
58
|
-
throw new
|
|
59
|
+
throw new ConnectionError("Not connected.");
|
|
59
60
|
}
|
|
60
61
|
return this.transport.dcId;
|
|
61
62
|
}
|
|
@@ -82,7 +83,7 @@ export class ClientAbstract {
|
|
|
82
83
|
}
|
|
83
84
|
async disconnect() {
|
|
84
85
|
if (!this.transport) {
|
|
85
|
-
throw new
|
|
86
|
+
throw new ConnectionError("Not connected.");
|
|
86
87
|
}
|
|
87
88
|
await this.transport.transport.deinitialize();
|
|
88
89
|
await this.transport.connection.close();
|
package/esm/client/0_html.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Parser } from "../0_deps.js";
|
|
2
|
+
import { InputError } from "../0_errors.js";
|
|
2
3
|
export function parseHtml(html) {
|
|
3
4
|
html = html.trim();
|
|
4
5
|
let text = "";
|
|
@@ -26,7 +27,7 @@ export function parseHtml(html) {
|
|
|
26
27
|
case "a": {
|
|
27
28
|
const url = attribs.href;
|
|
28
29
|
if (!url) {
|
|
29
|
-
throw new
|
|
30
|
+
throw new InputError("Missing attribute: href");
|
|
30
31
|
}
|
|
31
32
|
stack.push({ type: "textLink", offset: text.length, length: 0, url });
|
|
32
33
|
break;
|
|
@@ -41,7 +42,7 @@ export function parseHtml(html) {
|
|
|
41
42
|
break;
|
|
42
43
|
case "span":
|
|
43
44
|
if (attribs.class != "tg-spoiler") {
|
|
44
|
-
throw new
|
|
45
|
+
throw new InputError('The class attribute must be "tg-spoiler."');
|
|
45
46
|
}
|
|
46
47
|
// falls through
|
|
47
48
|
case "tg-spoiler":
|
|
@@ -49,7 +50,7 @@ export function parseHtml(html) {
|
|
|
49
50
|
break;
|
|
50
51
|
case "tg-emoji":
|
|
51
52
|
if (!attribs["emoji-id"]) {
|
|
52
|
-
throw new
|
|
53
|
+
throw new InputError("Missing attribute: emoji-id");
|
|
53
54
|
}
|
|
54
55
|
stack.push({ type: "spoiler", offset: text.length, length: 0 });
|
|
55
56
|
break;
|
package/esm/client/0_markdown.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { UNREACHABLE } from "../1_utilities.js";
|
|
6
6
|
import { sortMessageEntities } from "../3_types.js";
|
|
7
|
+
import { InputError } from "../0_errors.js";
|
|
7
8
|
const enc = new TextEncoder();
|
|
8
9
|
const dec = new TextDecoder();
|
|
9
10
|
export const CODEPOINTS = {
|
|
@@ -165,7 +166,7 @@ export function parseMarkdown(text_) {
|
|
|
165
166
|
type = "spoiler";
|
|
166
167
|
}
|
|
167
168
|
else {
|
|
168
|
-
throw new
|
|
169
|
+
throw new InputError(`The character "${String.fromCharCode(c)}" is reserved and must be escaped with a preceding backslash.`);
|
|
169
170
|
}
|
|
170
171
|
break;
|
|
171
172
|
case CODEPOINTS["["]:
|
|
@@ -250,7 +251,7 @@ export function parseMarkdown(text_) {
|
|
|
250
251
|
}
|
|
251
252
|
url = Uint8Array.from(url_);
|
|
252
253
|
if (text[i] !== CODEPOINTS[")"]) {
|
|
253
|
-
throw new Error(
|
|
254
|
+
throw new Error(`Can't find the end of the URL that starts at offset ${urlBeginPos}.`);
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
257
|
userId = getLinkUserId(dec.decode(url));
|
|
@@ -267,7 +268,7 @@ export function parseMarkdown(text_) {
|
|
|
267
268
|
}
|
|
268
269
|
case "customEmoji": {
|
|
269
270
|
if (text[i + 1] !== CODEPOINTS["("]) {
|
|
270
|
-
throw new
|
|
271
|
+
throw new InputError("Custom emoji entities must contain a tg://emoji URL.");
|
|
271
272
|
}
|
|
272
273
|
i += 2;
|
|
273
274
|
const url_ = [];
|
|
@@ -282,7 +283,7 @@ export function parseMarkdown(text_) {
|
|
|
282
283
|
}
|
|
283
284
|
const url = Uint8Array.from(url_);
|
|
284
285
|
if (text[i] !== CODEPOINTS[")"]) {
|
|
285
|
-
throw new
|
|
286
|
+
throw new InputError(`Can't find the end of the custom emoji URL that starts at offset ${urlBeginPos}.`);
|
|
286
287
|
}
|
|
287
288
|
customEmojiId = getLinkCustomEmojiId(dec.decode(url));
|
|
288
289
|
break;
|
|
@@ -314,7 +315,7 @@ export function parseMarkdown(text_) {
|
|
|
314
315
|
}
|
|
315
316
|
if (nestedEntities.length !== 0) {
|
|
316
317
|
const last = nestedEntities[nestedEntities.length - 1];
|
|
317
|
-
throw new
|
|
318
|
+
throw new InputError(`Can't find the end of the ${last.type} entity that starts at offset ${last.entityByteOffset}.`);
|
|
318
319
|
}
|
|
319
320
|
entities = sortMessageEntities(entities);
|
|
320
321
|
return [dec.decode(text.slice(0, resultSize)), entities];
|
package/esm/client/0_params.d.ts
CHANGED
|
@@ -15,7 +15,10 @@ export interface AuthorizeUserParams<S = string> {
|
|
|
15
15
|
code: S | (() => MaybePromise<S>);
|
|
16
16
|
password: S | ((hint: string | null) => MaybePromise<S>);
|
|
17
17
|
}
|
|
18
|
-
export interface
|
|
18
|
+
export interface _BusinessConnectionIdCommon {
|
|
19
|
+
businessConnectionId?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface _SendCommon extends _BusinessConnectionIdCommon {
|
|
19
22
|
/** Whether to send the message in a silent way without making a sound on the recipients' clients. */
|
|
20
23
|
disableNotification?: boolean;
|
|
21
24
|
/** Whether to protect the contents of the message from copying and forwarding. */
|
|
@@ -39,6 +42,9 @@ export interface SendMessageParams extends _SendCommon {
|
|
|
39
42
|
/** The message's link preview. */
|
|
40
43
|
linkPreview?: LinkPreview;
|
|
41
44
|
}
|
|
45
|
+
export interface SendChatActionParams extends _BusinessConnectionIdCommon {
|
|
46
|
+
messageThreadId?: number;
|
|
47
|
+
}
|
|
42
48
|
export interface EditMessageParams {
|
|
43
49
|
/** The parse mode to use. If not provided, the default parse mode will be used. */
|
|
44
50
|
parseMode?: ParseMode;
|
package/esm/client/0_types.d.ts
CHANGED
|
@@ -40,7 +40,6 @@ export interface C {
|
|
|
40
40
|
ignoreOutgoing: boolean | null;
|
|
41
41
|
cdn: boolean;
|
|
42
42
|
dropPendingUpdates?: boolean;
|
|
43
|
-
|
|
44
|
-
export declare class ConnectionError extends Error {
|
|
43
|
+
invoke<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T, businessConnectionId: string | undefined): Promise<T extends functions.Function<unknown> ? T["__R"] : void>;
|
|
45
44
|
}
|
|
46
45
|
export {};
|
package/esm/client/0_types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
}
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { enums, types } from "../2_tl.js";
|
|
2
1
|
import { FileSource } from "../3_types.js";
|
|
3
2
|
export declare const resolve: () => Promise<void>;
|
|
4
|
-
export declare function isPtsUpdate(v: enums.Update): v is types.UpdateNewMessage | types.UpdateDeleteMessages | types.UpdateReadHistoryInbox | types.UpdateReadHistoryOutbox | types.UpdatePinnedChannelMessages | types.UpdatePinnedMessages | types.UpdateFolderPeers | types.UpdateChannelWebPage | types.UpdateEditMessage | types.UpdateReadMessagesContents | types.UpdateWebPage;
|
|
5
|
-
export declare function isChannelPtsUpdate(v: enums.Update | enums.Updates): v is types.UpdateNewChannelMessage | types.UpdateEditChannelMessage | types.UpdateDeleteChannelMessages | types.UpdateChannelTooLong;
|
|
6
3
|
export declare function getFileContents(source: FileSource, fileName?: string): Promise<readonly [Uint8Array, string]>;
|
|
7
4
|
export declare function isHttpUrl(string: string): boolean;
|
|
8
5
|
export declare function getUsername(string: string): string;
|
|
@@ -1,27 +1,8 @@
|
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
|
2
2
|
import { path } from "../0_deps.js";
|
|
3
|
+
import { InputError } from "../0_errors.js";
|
|
3
4
|
import { UNREACHABLE } from "../1_utilities.js";
|
|
4
|
-
import { types } from "../2_tl.js";
|
|
5
5
|
export const resolve = () => Promise.resolve();
|
|
6
|
-
export function isPtsUpdate(v) {
|
|
7
|
-
return v instanceof types.UpdateNewMessage ||
|
|
8
|
-
v instanceof types.UpdateDeleteMessages ||
|
|
9
|
-
v instanceof types.UpdateReadHistoryInbox ||
|
|
10
|
-
v instanceof types.UpdateReadHistoryOutbox ||
|
|
11
|
-
v instanceof types.UpdatePinnedChannelMessages ||
|
|
12
|
-
v instanceof types.UpdatePinnedMessages ||
|
|
13
|
-
v instanceof types.UpdateFolderPeers ||
|
|
14
|
-
v instanceof types.UpdateChannelWebPage ||
|
|
15
|
-
v instanceof types.UpdateEditMessage ||
|
|
16
|
-
v instanceof types.UpdateReadMessagesContents ||
|
|
17
|
-
v instanceof types.UpdateWebPage;
|
|
18
|
-
}
|
|
19
|
-
export function isChannelPtsUpdate(v) {
|
|
20
|
-
return v instanceof types.UpdateNewChannelMessage ||
|
|
21
|
-
v instanceof types.UpdateEditChannelMessage ||
|
|
22
|
-
v instanceof types.UpdateDeleteChannelMessages ||
|
|
23
|
-
v instanceof types.UpdateChannelTooLong;
|
|
24
|
-
}
|
|
25
6
|
export async function getFileContents(source, fileName = "") {
|
|
26
7
|
fileName = fileName.trim() || "file";
|
|
27
8
|
let contents;
|
|
@@ -80,7 +61,7 @@ function isDigit(string) {
|
|
|
80
61
|
const c = string.charCodeAt(0);
|
|
81
62
|
return "0".charCodeAt(0) <= c && c <= "9".charCodeAt(0);
|
|
82
63
|
}
|
|
83
|
-
const errInvalidUsername = (u) => new
|
|
64
|
+
const errInvalidUsername = (u) => new InputError(`Invalid username: ${u}`);
|
|
84
65
|
function validateUsername(string, ignoreAt = false) {
|
|
85
66
|
string = string.trim();
|
|
86
67
|
if (ignoreAt && string.startsWith("@")) {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { enums, types } from "../2_tl.js";
|
|
2
|
+
import { Update } from "../3_types.js";
|
|
3
|
+
import { C } from "./0_types.js";
|
|
4
|
+
export type BusinessConnectionManagerUpdate = types.UpdateBotBusinessConnect;
|
|
5
|
+
export declare class BusinessConnectionManager {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(c: C);
|
|
8
|
+
getBusinessConnection(id: string): Promise<import("../3_types.js").BusinessConnection>;
|
|
9
|
+
static canHandleUpdate(update: enums.Update): update is BusinessConnectionManagerUpdate;
|
|
10
|
+
handleUpdate(update: BusinessConnectionManagerUpdate): Promise<Update>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
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");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
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");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _BusinessConnectionManager_c;
|
|
13
|
+
import { as, types } from "../2_tl.js";
|
|
14
|
+
import { constructBusinessConnection } from "../3_types.js";
|
|
15
|
+
export class BusinessConnectionManager {
|
|
16
|
+
constructor(c) {
|
|
17
|
+
_BusinessConnectionManager_c.set(this, void 0);
|
|
18
|
+
__classPrivateFieldSet(this, _BusinessConnectionManager_c, c, "f");
|
|
19
|
+
}
|
|
20
|
+
async getBusinessConnection(id) {
|
|
21
|
+
const connection_ = await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.getBusinessConnection(id);
|
|
22
|
+
if (!connection_) {
|
|
23
|
+
const connection_ = await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").api.account.getBotBusinessConnection({ connection_id: id })
|
|
24
|
+
.then((v) => v[as](types.Updates))
|
|
25
|
+
.then((v) => v.updates[0][as](types.UpdateBotBusinessConnect).connection);
|
|
26
|
+
await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(id, connection_);
|
|
27
|
+
return await constructBusinessConnection(connection_, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return await constructBusinessConnection(connection_, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
static canHandleUpdate(update) {
|
|
34
|
+
return update instanceof types.UpdateBotBusinessConnect;
|
|
35
|
+
}
|
|
36
|
+
async handleUpdate(update) {
|
|
37
|
+
if (update.connection.disabled) {
|
|
38
|
+
await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(update.connection.connection_id, null);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
await __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").messageStorage.setBusinessConnection(update.connection.connection_id, update.connection);
|
|
42
|
+
}
|
|
43
|
+
const businessConnection = await constructBusinessConnection(update.connection, __classPrivateFieldGet(this, _BusinessConnectionManager_c, "f").getEntity);
|
|
44
|
+
return { businessConnection };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
_BusinessConnectionManager_c = new WeakMap();
|
|
@@ -11,12 +11,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _ClientEncrypted_instances, _ClientEncrypted_authKey, _ClientEncrypted_authKeyId, _ClientEncrypted_sessionId, _ClientEncrypted_state, _ClientEncrypted_toAcknowledge, _ClientEncrypted_recentAcks, _ClientEncrypted_promises, _ClientEncrypted_L, _ClientEncrypted_LreceiveLoop, _ClientEncrypted_Linvoke, _ClientEncrypted_nextMessageId, _ClientEncrypted_nextSeqNo, _ClientEncrypted_sendMessage, _ClientEncrypted_receiveLoop;
|
|
13
13
|
import { gunzip } from "../0_deps.js";
|
|
14
|
+
import { ConnectionError } from "../0_errors.js";
|
|
14
15
|
import { bigIntFromBuffer, CacheMap, drop, getLogger, getRandomBigInt, sha1, UNREACHABLE } from "../1_utilities.js";
|
|
15
16
|
import { Message_, MessageContainer, name, RPCResult, TLError, TLReader, types } from "../2_tl.js";
|
|
16
17
|
import { upgradeInstance } from "../4_errors.js";
|
|
17
18
|
import { ClientAbstract } from "./0_client_abstract.js";
|
|
18
19
|
import { decryptMessage, encryptMessage, getMessageId } from "./0_message.js";
|
|
19
|
-
import { ConnectionError } from "./0_types.js";
|
|
20
20
|
// global ClientEncrypted ID counter for logs
|
|
21
21
|
let id = 0;
|
|
22
22
|
/**
|
|
@@ -11,6 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _ClientPlain_publicKeys, _ClientPlain_lastMsgId;
|
|
13
13
|
import { assertEquals, assertInstanceOf, factorize, ige256Decrypt, ige256Encrypt } from "../0_deps.js";
|
|
14
|
+
import { ConnectionError, TransportError } from "../0_errors.js";
|
|
14
15
|
import { bigIntFromBuffer, bufferFromBigInt, concat, getLogger, getRandomBigInt, modExp, rsaPad, sha1, UNREACHABLE } from "../1_utilities.js";
|
|
15
16
|
import { functions, serialize, TLReader, types } from "../2_tl.js";
|
|
16
17
|
import { PUBLIC_KEYS } from "../4_constants.js";
|
|
@@ -30,7 +31,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
30
31
|
}
|
|
31
32
|
async invoke(function_) {
|
|
32
33
|
if (!this.transport) {
|
|
33
|
-
throw new
|
|
34
|
+
throw new ConnectionError("Not connected.");
|
|
34
35
|
}
|
|
35
36
|
const msgId = __classPrivateFieldSet(this, _ClientPlain_lastMsgId, getMessageId(__classPrivateFieldGet(this, _ClientPlain_lastMsgId, "f")), "f");
|
|
36
37
|
const payload = packUnencryptedMessage(function_[serialize](), msgId);
|
|
@@ -41,9 +42,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
41
42
|
L.inBin(payload);
|
|
42
43
|
if (buffer.length == 4) {
|
|
43
44
|
const int = bigIntFromBuffer(buffer, true, true);
|
|
44
|
-
|
|
45
|
-
throw new Error("-404");
|
|
46
|
-
}
|
|
45
|
+
throw new TransportError(Number(int));
|
|
47
46
|
}
|
|
48
47
|
const { message } = unpackUnencryptedMessage(buffer);
|
|
49
48
|
const reader = new TLReader(message);
|
package/esm/client/1_composer.js
CHANGED
|
@@ -10,6 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
|
|
|
10
10
|
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
11
|
};
|
|
12
12
|
var _Composer_handle, _Composer_prefixes;
|
|
13
|
+
import { InputError } from "../0_errors.js";
|
|
13
14
|
import { match } from "./0_filters.js";
|
|
14
15
|
export function flatten(mw) {
|
|
15
16
|
return typeof mw === "function" ? mw : (ctx, next) => mw.middleware()(ctx, next);
|
|
@@ -34,7 +35,7 @@ export function skip(_ctx, next) {
|
|
|
34
35
|
export class Composer {
|
|
35
36
|
set prefixes(value) {
|
|
36
37
|
if (__classPrivateFieldGet(this, _Composer_prefixes, "f") !== undefined) {
|
|
37
|
-
throw new
|
|
38
|
+
throw new InputError("Prefixes already set");
|
|
38
39
|
}
|
|
39
40
|
__classPrivateFieldSet(this, _Composer_prefixes, value, "f");
|
|
40
41
|
}
|
|
@@ -84,7 +85,7 @@ export class Composer {
|
|
|
84
85
|
continue;
|
|
85
86
|
}
|
|
86
87
|
if (left.startsWith(right) || right.startsWith(left)) {
|
|
87
|
-
throw new
|
|
88
|
+
throw new InputError("Intersecting prefixes");
|
|
88
89
|
}
|
|
89
90
|
}
|
|
90
91
|
}
|
|
@@ -10,12 +10,12 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _FileManager_instances, _FileManager_c, _FileManager_Lupload, _FileManager_downloadInner;
|
|
13
|
+
import { ConnectionError, InputError } from "../0_errors.js";
|
|
13
14
|
import { drop, getLogger, getRandomId, mod, UNREACHABLE } from "../1_utilities.js";
|
|
14
15
|
import { as, types } from "../2_tl.js";
|
|
15
16
|
import { constructSticker, deserializeFileId, FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "../3_types.js";
|
|
16
17
|
import { STICKER_SET_NAME_TTL } from "../4_constants.js";
|
|
17
18
|
import { FloodWait } from "../4_errors.js";
|
|
18
|
-
import { ConnectionError } from "./0_types.js";
|
|
19
19
|
export class FileManager {
|
|
20
20
|
constructor(c) {
|
|
21
21
|
_FileManager_instances.add(this);
|
|
@@ -29,7 +29,7 @@ export class FileManager {
|
|
|
29
29
|
const isBig = contents.length > 1048576; // 10 MB
|
|
30
30
|
const chunkSize = params?.chunkSize ?? 512 * 1024;
|
|
31
31
|
if (mod(chunkSize, 1024) != 0) {
|
|
32
|
-
throw new
|
|
32
|
+
throw new InputError("chunkSize must be divisible by 1024.");
|
|
33
33
|
}
|
|
34
34
|
const signal = params?.signal;
|
|
35
35
|
__classPrivateFieldGet(this, _FileManager_Lupload, "f").debug("uploading " + (isBig ? "big " : "") + "file of size " + contents.length + " with chunk size of " + chunkSize);
|
|
@@ -170,7 +170,7 @@ export class FileManager {
|
|
|
170
170
|
async getCustomEmojiStickers(id) {
|
|
171
171
|
id = Array.isArray(id) ? id : [id];
|
|
172
172
|
if (!id.length) {
|
|
173
|
-
|
|
173
|
+
return [];
|
|
174
174
|
}
|
|
175
175
|
const stickers = new Array();
|
|
176
176
|
let shouldFetch = false;
|
|
@@ -228,7 +228,7 @@ _FileManager_c = new WeakMap(), _FileManager_Lupload = new WeakMap(), _FileManag
|
|
|
228
228
|
}
|
|
229
229
|
const chunkSize = params?.chunkSize ?? 1024 * 1024;
|
|
230
230
|
if (mod(chunkSize, 1024) != 0) {
|
|
231
|
-
throw new
|
|
231
|
+
throw new InputError("chunkSize must be divisible by 1024.");
|
|
232
232
|
}
|
|
233
233
|
const { api, connect, disconnect } = __classPrivateFieldGet(this, _FileManager_c, "f").apiFactory(dcId);
|
|
234
234
|
await connect();
|