@mtkruto/node 0.1.201 → 0.1.300
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_deps.d.ts +1 -1
- package/esm/0_deps.js +2 -1
- package/esm/1_utilities.d.ts +1 -1
- package/esm/1_utilities.js +1 -1
- package/esm/4_errors.js +3 -3
- package/esm/client/0_markdown.js +5 -5
- package/esm/client/0_utilities.d.ts +6 -0
- package/esm/client/0_utilities.js +35 -4
- package/esm/client/1_account_manager.js +4 -4
- package/esm/client/1_client_encrypted.js +4 -4
- package/esm/client/1_client_plain.js +3 -3
- package/esm/client/1_file_manager.js +6 -5
- package/esm/client/1_reaction_manager.js +2 -2
- package/esm/client/1_update_manager.js +9 -8
- package/esm/client/2_message_manager.js +47 -24
- package/esm/client/3_callback_query_manager.js +2 -0
- package/esm/client/3_chat_list_manager.js +13 -12
- package/esm/client/3_inline_query_manager.js +4 -2
- package/esm/client/3_story_manager.js +7 -5
- package/esm/client/4_client.js +14 -13
- package/esm/connection/1_connection_web_socket.js +3 -2
- package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
- package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/storage/0_storage.js +6 -5
- package/esm/storage/1_utilities.d.ts +0 -1
- package/esm/storage/1_utilities.js +2 -3
- package/esm/storage/2_storage_local_storage.js +1 -4
- package/esm/storage/2_storage_session_storage.js +1 -4
- package/esm/tl/3_utilities.js +5 -4
- package/esm/transport/2_transport_provider.js +4 -4
- package/esm/types/0_message_entity.js +3 -3
- package/esm/types/0_message_search_filter.js +2 -2
- package/esm/types/0_reaction.js +2 -2
- package/esm/types/1_bot_command_scope.js +3 -3
- package/esm/types/1_chat_p.js +3 -2
- package/esm/types/1_keyboard_button.js +3 -3
- package/esm/types/1_message_reaction.js +2 -2
- package/esm/types/1_story_privacy.js +3 -3
- package/esm/types/2_chat_member.js +6 -5
- package/esm/types/2_chosen_inline_result.js +3 -2
- package/esm/types/2_inactive_chat.js +3 -2
- package/esm/types/2_inline_keyboard_button.js +3 -3
- package/esm/types/2_inline_query.js +3 -3
- package/esm/types/2_invite_link.js +3 -2
- package/esm/types/2_story_content.js +5 -5
- package/esm/types/2_story_interactive_area.js +5 -5
- package/esm/types/3_chat_member_updated.js +4 -3
- package/esm/types/3_reply_markup.js +4 -3
- package/esm/types/3_story.js +3 -2
- package/esm/types/4_inline_query_result.js +5 -5
- package/esm/types/4_message.js +17 -16
- package/esm/types/5_callback_query.js +4 -3
- package/esm/types/5_chat.js +8 -7
- package/esm/types/_file_id.js +9 -8
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +25 -0
- package/esm/utilities/0_logger.d.ts +8 -0
- package/esm/utilities/0_logger.js +9 -5
- package/esm/utilities/1_math.d.ts +1 -0
- package/esm/utilities/1_math.js +51 -0
- package/esm/utilities/1_misc.js +2 -2
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -1
- package/script/0_deps.js +3 -3
- package/script/1_utilities.d.ts +1 -1
- package/script/1_utilities.js +1 -1
- package/script/4_errors.js +3 -3
- package/script/client/0_markdown.js +5 -5
- package/script/client/0_utilities.d.ts +6 -0
- package/script/client/0_utilities.js +41 -4
- package/script/client/1_account_manager.js +4 -4
- package/script/client/1_client_encrypted.js +2 -2
- package/script/client/1_client_plain.js +2 -2
- package/script/client/1_file_manager.js +5 -4
- package/script/client/1_reaction_manager.js +2 -2
- package/script/client/1_update_manager.js +8 -7
- package/script/client/2_message_manager.js +51 -28
- package/script/client/3_callback_query_manager.js +2 -0
- package/script/client/3_chat_list_manager.js +12 -11
- package/script/client/3_inline_query_manager.js +4 -2
- package/script/client/3_story_manager.js +4 -2
- package/script/client/4_client.js +13 -12
- package/script/connection/1_connection_web_socket.js +2 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
- package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
- package/script/mod.d.ts +1 -1
- package/script/mod.js +2 -1
- package/script/storage/0_storage.js +5 -4
- package/script/storage/1_utilities.d.ts +0 -1
- package/script/storage/1_utilities.js +3 -4
- package/script/storage/2_storage_local_storage.js +0 -3
- package/script/storage/2_storage_session_storage.js +0 -3
- package/script/tl/3_utilities.js +4 -3
- package/script/transport/2_transport_provider.js +4 -4
- package/script/types/0_message_entity.js +3 -3
- package/script/types/0_message_search_filter.js +2 -2
- package/script/types/0_reaction.js +2 -2
- package/script/types/1_bot_command_scope.js +3 -3
- package/script/types/1_chat_p.js +2 -1
- package/script/types/1_keyboard_button.js +3 -3
- package/script/types/1_message_reaction.js +2 -2
- package/script/types/1_story_privacy.js +3 -3
- package/script/types/2_chat_member.js +5 -4
- package/script/types/2_chosen_inline_result.js +2 -1
- package/script/types/2_inactive_chat.js +2 -1
- package/script/types/2_inline_keyboard_button.js +3 -3
- package/script/types/2_inline_query.js +3 -3
- package/script/types/2_invite_link.js +2 -1
- package/script/types/2_story_content.js +5 -5
- package/script/types/2_story_interactive_area.js +5 -5
- package/script/types/3_chat_member_updated.js +3 -2
- package/script/types/3_reply_markup.js +3 -2
- package/script/types/3_story.js +2 -1
- package/script/types/4_inline_query_result.js +5 -5
- package/script/types/4_message.js +16 -15
- package/script/types/5_callback_query.js +3 -2
- package/script/types/5_chat.js +7 -6
- package/script/types/_file_id.js +8 -7
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +27 -1
- package/script/utilities/0_logger.d.ts +8 -0
- package/script/utilities/0_logger.js +11 -6
- package/script/utilities/1_math.d.ts +1 -0
- package/script/utilities/1_math.js +55 -0
- package/script/utilities/1_misc.js +2 -2
- package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
- package/esm/utilities/0_control.d.ts +0 -1
- package/esm/utilities/0_control.js +0 -3
- package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
- package/script/utilities/0_control.d.ts +0 -1
- package/script/utilities/0_control.js +0 -7
- /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
package/esm/0_deps.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export { decodeBase64, encodeBase64 } from "./deps/deno.land/std@0.221.0/encodin
|
|
|
4
4
|
import { contentType as contentType_ } from "./deps/deno.land/std@0.221.0/media_types/content_type.js";
|
|
5
5
|
export declare const contentType: typeof contentType_;
|
|
6
6
|
export declare function extension(mimeType: string): string;
|
|
7
|
-
export { ctr256,
|
|
7
|
+
export { ctr256, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.4.0/mod.js";
|
|
8
8
|
export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/mod.js";
|
|
9
9
|
export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
|
package/esm/0_deps.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// connection/1_connection_tcp.ts must be updated too when updating std.
|
|
1
2
|
export * from "./deps/deno.land/std@0.221.0/assert/mod.js";
|
|
2
3
|
export * as path from "./deps/deno.land/std@0.221.0/path/mod.js";
|
|
3
4
|
export { decodeBase64, encodeBase64 } from "./deps/deno.land/std@0.221.0/encoding/base64.js";
|
|
@@ -19,6 +20,6 @@ export function extension(mimeType) {
|
|
|
19
20
|
return extension_(mimeType) || "unknown";
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
|
-
export { ctr256,
|
|
23
|
+
export { ctr256, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.4.0/mod.js";
|
|
23
24
|
export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/mod.js";
|
|
24
25
|
export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
|
package/esm/1_utilities.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ export * from "./utilities/0_bigint.js";
|
|
|
2
2
|
export * from "./utilities/0_buffer.js";
|
|
3
3
|
export * from "./utilities/0_cache_map.js";
|
|
4
4
|
export * from "./utilities/0_color.js";
|
|
5
|
-
export * from "./utilities/0_control.js";
|
|
6
5
|
export * from "./utilities/0_crypto.js";
|
|
7
6
|
export * from "./utilities/0_hash.js";
|
|
8
7
|
export * from "./utilities/0_logger.js";
|
|
@@ -12,5 +11,6 @@ export * from "./utilities/0_rle.js";
|
|
|
12
11
|
export * from "./utilities/0_types.js";
|
|
13
12
|
export * from "./utilities/1_auth.js";
|
|
14
13
|
export * from "./utilities/1_base64.js";
|
|
14
|
+
export * from "./utilities/1_math.js";
|
|
15
15
|
export * from "./utilities/1_misc.js";
|
|
16
16
|
export * from "./utilities/1_queue.js";
|
package/esm/1_utilities.js
CHANGED
|
@@ -2,7 +2,6 @@ export * from "./utilities/0_bigint.js";
|
|
|
2
2
|
export * from "./utilities/0_buffer.js";
|
|
3
3
|
export * from "./utilities/0_cache_map.js";
|
|
4
4
|
export * from "./utilities/0_color.js";
|
|
5
|
-
export * from "./utilities/0_control.js";
|
|
6
5
|
export * from "./utilities/0_crypto.js";
|
|
7
6
|
export * from "./utilities/0_hash.js";
|
|
8
7
|
export * from "./utilities/0_logger.js";
|
|
@@ -12,5 +11,6 @@ export * from "./utilities/0_rle.js";
|
|
|
12
11
|
export * from "./utilities/0_types.js";
|
|
13
12
|
export * from "./utilities/1_auth.js";
|
|
14
13
|
export * from "./utilities/1_base64.js";
|
|
14
|
+
export * from "./utilities/1_math.js";
|
|
15
15
|
export * from "./utilities/1_misc.js";
|
|
16
16
|
export * from "./utilities/1_queue.js";
|
package/esm/4_errors.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "./0_deps.js";
|
|
2
2
|
import { ErrorWithCall, map } from "./3_errors.js";
|
|
3
3
|
export * from "./3_errors.js";
|
|
4
4
|
export class FloodWait extends ErrorWithCall {
|
|
@@ -13,7 +13,7 @@ export class FloodWait extends ErrorWithCall {
|
|
|
13
13
|
const p = params.error_message.split("_");
|
|
14
14
|
this.seconds = Number(p[p.length - 1]);
|
|
15
15
|
if (isNaN(this.seconds)) {
|
|
16
|
-
|
|
16
|
+
unreachable();
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -29,7 +29,7 @@ export class Migrate extends ErrorWithCall {
|
|
|
29
29
|
const p = params.error_message.split("_");
|
|
30
30
|
this.dc = Number(p[p.length - 1]);
|
|
31
31
|
if (isNaN(this.dc)) {
|
|
32
|
-
|
|
32
|
+
unreachable();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
package/esm/client/0_markdown.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (
|
|
3
|
-
* Copyright (
|
|
2
|
+
* Copyright (C) 2023 Dunkan
|
|
3
|
+
* Copyright (C) 2024 Roj
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { unreachable } from "../0_deps.js";
|
|
6
6
|
import { sortMessageEntities } from "../3_types.js";
|
|
7
7
|
import { InputError } from "../0_errors.js";
|
|
8
8
|
const enc = new TextEncoder();
|
|
@@ -136,7 +136,7 @@ export function parseMarkdown(text_) {
|
|
|
136
136
|
case "customEmoji":
|
|
137
137
|
return c === CODEPOINTS["]"];
|
|
138
138
|
default:
|
|
139
|
-
|
|
139
|
+
unreachable();
|
|
140
140
|
}
|
|
141
141
|
})();
|
|
142
142
|
}
|
|
@@ -289,7 +289,7 @@ export function parseMarkdown(text_) {
|
|
|
289
289
|
break;
|
|
290
290
|
}
|
|
291
291
|
default:
|
|
292
|
-
|
|
292
|
+
unreachable();
|
|
293
293
|
}
|
|
294
294
|
if (!skipEntity) {
|
|
295
295
|
const entityOffset = nestedEntities.at(-1).entityOffset;
|
|
@@ -4,3 +4,9 @@ export declare function getFileContents(source: FileSource, fileName?: string):
|
|
|
4
4
|
export declare function isHttpUrl(string: string): boolean;
|
|
5
5
|
export declare function getUsername(string: string): string;
|
|
6
6
|
export declare function getChatListId(chatList: string): 0 | 1;
|
|
7
|
+
export declare function checkMessageId(messageId: number): number;
|
|
8
|
+
export declare function checkStoryId(storyId: number): number;
|
|
9
|
+
export declare function checkPollOption(option: string): void;
|
|
10
|
+
export declare function checkArray<T>(array: T[], check: (value: T) => void): void;
|
|
11
|
+
export declare function checkCallbackQueryId(id: string): void;
|
|
12
|
+
export declare function checkInlineQueryId(id: string): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
|
2
|
-
import { path } from "../0_deps.js";
|
|
2
|
+
import { path, unreachable } from "../0_deps.js";
|
|
3
3
|
import { InputError } from "../0_errors.js";
|
|
4
|
-
import { UNREACHABLE } from "../1_utilities.js";
|
|
5
4
|
export const resolve = () => Promise.resolve();
|
|
6
5
|
export async function getFileContents(source, fileName = "") {
|
|
7
6
|
fileName = fileName.trim() || "file";
|
|
@@ -28,7 +27,7 @@ export async function getFileContents(source, fileName = "") {
|
|
|
28
27
|
fileName = path.basename(path_);
|
|
29
28
|
}
|
|
30
29
|
else {
|
|
31
|
-
|
|
30
|
+
unreachable();
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
const res = await fetch(url);
|
|
@@ -123,6 +122,38 @@ export function getChatListId(chatList) {
|
|
|
123
122
|
case "archived":
|
|
124
123
|
return 1;
|
|
125
124
|
default:
|
|
126
|
-
|
|
125
|
+
unreachable();
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export function checkMessageId(messageId) {
|
|
129
|
+
if (typeof messageId !== "number" || isNaN(messageId) || !messageId) {
|
|
130
|
+
throw new InputError("Invalid message ID");
|
|
131
|
+
}
|
|
132
|
+
return messageId;
|
|
133
|
+
}
|
|
134
|
+
export function checkStoryId(storyId) {
|
|
135
|
+
if (typeof storyId !== "number" || isNaN(storyId) || !storyId) {
|
|
136
|
+
throw new InputError("Invalid story ID");
|
|
137
|
+
}
|
|
138
|
+
return storyId;
|
|
139
|
+
}
|
|
140
|
+
export function checkPollOption(option) {
|
|
141
|
+
if (!option.trim()) {
|
|
142
|
+
throw new InputError("Poll option must not be empty.");
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
export function checkArray(array, check) {
|
|
146
|
+
for (const item of array) {
|
|
147
|
+
check(item);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
export function checkCallbackQueryId(id) {
|
|
151
|
+
if (typeof id !== "string" || !id.trim()) {
|
|
152
|
+
throw new InputError("Invalid callback query ID.");
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
export function checkInlineQueryId(id) {
|
|
156
|
+
if (typeof id !== "string" || !id.trim()) {
|
|
157
|
+
throw new InputError("Invalid inline query ID.");
|
|
127
158
|
}
|
|
128
159
|
}
|
|
@@ -10,7 +10,7 @@ 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 _AccountManager_instances, _AccountManager_c, _AccountManager_toggleUsername;
|
|
13
|
-
import {
|
|
13
|
+
import { unreachable } from "../0_deps.js";
|
|
14
14
|
import { types } from "../2_tl.js";
|
|
15
15
|
import { constructInactiveChat } from "../3_types.js";
|
|
16
16
|
export class AccountManager {
|
|
@@ -40,7 +40,7 @@ export class AccountManager {
|
|
|
40
40
|
return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.reorderUsernames({ channel: new types.InputChannel(peer), order });
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
|
|
43
|
+
unreachable();
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
async hideUsernames(id) {
|
|
@@ -50,7 +50,7 @@ export class AccountManager {
|
|
|
50
50
|
return await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.deactivateAllUsernames({ channel: new types.InputChannel(peer) });
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
|
|
53
|
+
unreachable();
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async getInactiveChats() {
|
|
@@ -71,6 +71,6 @@ _AccountManager_c = new WeakMap(), _AccountManager_instances = new WeakSet(), _A
|
|
|
71
71
|
await __classPrivateFieldGet(this, _AccountManager_c, "f").api.channels.toggleUsername({ channel: new types.InputChannel(peer), username, active });
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
74
|
-
|
|
74
|
+
unreachable();
|
|
75
75
|
}
|
|
76
76
|
};
|
|
@@ -10,9 +10,9 @@ 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 _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
|
-
import { gunzip } from "../0_deps.js";
|
|
13
|
+
import { gunzip, unreachable } from "../0_deps.js";
|
|
14
14
|
import { ConnectionError } from "../0_errors.js";
|
|
15
|
-
import { bigIntFromBuffer, CacheMap, drop, getLogger, getRandomBigInt, sha1
|
|
15
|
+
import { bigIntFromBuffer, CacheMap, drop, getLogger, getRandomBigInt, sha1 } from "../1_utilities.js";
|
|
16
16
|
import { Message_, MessageContainer, name, RPCResult, TLError, TLReader, types } from "../2_tl.js";
|
|
17
17
|
import { upgradeInstance } from "../4_errors.js";
|
|
18
18
|
import { ClientAbstract } from "./0_client_abstract.js";
|
|
@@ -118,7 +118,7 @@ _ClientEncrypted_authKey = new WeakMap(), _ClientEncrypted_authKeyId = new WeakM
|
|
|
118
118
|
__classPrivateFieldGet(this, _ClientEncrypted_L, "f").outBin(payload);
|
|
119
119
|
}, _ClientEncrypted_receiveLoop = async function _ClientEncrypted_receiveLoop() {
|
|
120
120
|
if (!this.transport) {
|
|
121
|
-
|
|
121
|
+
unreachable();
|
|
122
122
|
}
|
|
123
123
|
while (this.connected) {
|
|
124
124
|
try {
|
|
@@ -234,6 +234,6 @@ _ClientEncrypted_authKey = new WeakMap(), _ClientEncrypted_authKeyId = new WeakM
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
else {
|
|
237
|
-
|
|
237
|
+
unreachable();
|
|
238
238
|
}
|
|
239
239
|
};
|
|
@@ -10,9 +10,9 @@ 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 _ClientPlain_publicKeys, _ClientPlain_lastMsgId;
|
|
13
|
-
import { assertEquals, assertInstanceOf,
|
|
13
|
+
import { assertEquals, assertInstanceOf, ige256Decrypt, ige256Encrypt, unreachable } from "../0_deps.js";
|
|
14
14
|
import { ConnectionError, TransportError } from "../0_errors.js";
|
|
15
|
-
import { bigIntFromBuffer, bufferFromBigInt, concat, getLogger, getRandomBigInt, modExp, rsaPad, sha1
|
|
15
|
+
import { bigIntFromBuffer, bufferFromBigInt, concat, factorize, getLogger, getRandomBigInt, modExp, rsaPad, sha1 } from "../1_utilities.js";
|
|
16
16
|
import { functions, serialize, TLReader, types } from "../2_tl.js";
|
|
17
17
|
import { PUBLIC_KEYS } from "../4_constants.js";
|
|
18
18
|
import { ClientAbstract } from "./0_client_abstract.js";
|
|
@@ -68,7 +68,7 @@ export class ClientPlain extends ClientAbstract {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
if (!resPq) {
|
|
71
|
-
|
|
71
|
+
unreachable();
|
|
72
72
|
}
|
|
73
73
|
const pq_ = bigIntFromBuffer(resPq.pq, false, false);
|
|
74
74
|
LcreateAuthKey.debug(`pq=${pq_}`);
|
|
@@ -10,8 +10,9 @@ 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 { unreachable } from "../0_deps.js";
|
|
13
14
|
import { ConnectionError, InputError } from "../0_errors.js";
|
|
14
|
-
import { drop, getLogger, getRandomId, mod
|
|
15
|
+
import { drop, getLogger, getRandomId, mod } from "../1_utilities.js";
|
|
15
16
|
import { as, types } from "../2_tl.js";
|
|
16
17
|
import { constructSticker, deserializeFileId, FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "../3_types.js";
|
|
17
18
|
import { STICKER_SET_NAME_TTL } from "../4_constants.js";
|
|
@@ -104,7 +105,7 @@ export class FileManager {
|
|
|
104
105
|
switch (fileId_.type) {
|
|
105
106
|
case FileType.ProfilePhoto: {
|
|
106
107
|
if (fileId_.location.source.type != PhotoSourceType.ChatPhotoBig && fileId_.location.source.type != PhotoSourceType.ChatPhotoSmall) {
|
|
107
|
-
|
|
108
|
+
unreachable();
|
|
108
109
|
}
|
|
109
110
|
const big = fileId_.location.source.type == PhotoSourceType.ChatPhotoBig;
|
|
110
111
|
const peer = await __classPrivateFieldGet(this, _FileManager_c, "f").getInputPeer(Number(fileId_.location.source.chatId)); // TODO: use access hash from source?
|
|
@@ -131,7 +132,7 @@ export class FileManager {
|
|
|
131
132
|
id: fileId_.location.id,
|
|
132
133
|
access_hash: fileId_.location.accessHash,
|
|
133
134
|
file_reference: fileId_.fileReference ?? new Uint8Array(),
|
|
134
|
-
thumb_size: "thumbnailType" in fileId_.location.source ? String.fromCharCode(fileId_.location.source.thumbnailType) :
|
|
135
|
+
thumb_size: "thumbnailType" in fileId_.location.source ? String.fromCharCode(fileId_.location.source.thumbnailType) : unreachable(),
|
|
135
136
|
});
|
|
136
137
|
for await (const chunk of __classPrivateFieldGet(this, _FileManager_instances, "m", _FileManager_downloadInner).call(this, location, fileId_.dcId, params)) {
|
|
137
138
|
yield chunk;
|
|
@@ -152,7 +153,7 @@ export class FileManager {
|
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
else {
|
|
155
|
-
|
|
156
|
+
unreachable();
|
|
156
157
|
}
|
|
157
158
|
}
|
|
158
159
|
async getStickerSetName(inputStickerSet, hash = 0) {
|
|
@@ -255,7 +256,7 @@ _FileManager_c = new WeakMap(), _FileManager_Lupload = new WeakMap(), _FileManag
|
|
|
255
256
|
}
|
|
256
257
|
}
|
|
257
258
|
else {
|
|
258
|
-
|
|
259
|
+
unreachable();
|
|
259
260
|
}
|
|
260
261
|
}
|
|
261
262
|
}
|
|
@@ -10,7 +10,7 @@ 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 _ReactionManager_c;
|
|
13
|
-
import {
|
|
13
|
+
import { unreachable } from "../0_deps.js";
|
|
14
14
|
import { peerToChatId, types } from "../2_tl.js";
|
|
15
15
|
import { constructMessageReaction, constructMessageReactionCount, constructMessageReactions } from "../3_types.js";
|
|
16
16
|
export class ReactionManager {
|
|
@@ -77,7 +77,7 @@ export class ReactionManager {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
else {
|
|
80
|
-
|
|
80
|
+
unreachable();
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -10,7 +10,8 @@ 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 _UpdateManager_instances, _a, _UpdateManager_c, _UpdateManager_updateState, _UpdateManager_updateHandler, _UpdateManager_LrecoverUpdateGap, _UpdateManager_LrecoverChannelUpdateGap, _UpdateManager_L$handleUpdate, _UpdateManager_L$processUpdates, _UpdateManager_LfetchState, _UpdateManager_defaultDropPendingUpdates, _UpdateManager_mustDropPendingUpdates, _UpdateManager_state, _UpdateManager_getState, _UpdateManager_setState, _UpdateManager_handleUpdateQueues, _UpdateManager_nonFirst, _UpdateManager_getChannelPtsWithDropPendingUpdatesCheck, _UpdateManager_checkGap, _UpdateManager_checkGapQts, _UpdateManager_checkChannelGap, _UpdateManager_channelUpdateQueues, _UpdateManager_processChannelPtsUpdateInner, _UpdateManager_queueUpdate, _UpdateManager_processChannelPtsUpdate, _UpdateManager_processPtsUpdateInner, _UpdateManager_ptsUpdateQueue, _UpdateManager_processPtsUpdate, _UpdateManager_processQtsUpdateInner, _UpdateManager_qtsUpdateQueue, _UpdateManager_processQtsUpdate, _UpdateManager_processUpdatesQueue, _UpdateManager_processUpdates, _UpdateManager_setUpdateStateDate, _UpdateManager_setUpdatePts, _UpdateManager_setUpdateQts, _UpdateManager_getLocalState, _UpdateManager_recoverChannelUpdateGap, _UpdateManager_handleUpdatesSet, _UpdateManager_handleStoredUpdates, _UpdateManager_handleUpdate;
|
|
13
|
-
import {
|
|
13
|
+
import { unreachable } from "../0_deps.js";
|
|
14
|
+
import { getLogger, Queue, ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
14
15
|
import { as, functions, inputPeerToPeer, peerToChatId, types } from "../2_tl.js";
|
|
15
16
|
import { CHANNEL_DIFFERENCE_LIMIT_BOT, CHANNEL_DIFFERENCE_LIMIT_USER } from "../4_constants.js";
|
|
16
17
|
export class UpdateManager {
|
|
@@ -250,7 +251,7 @@ export class UpdateManager {
|
|
|
250
251
|
state = difference.intermediate_state;
|
|
251
252
|
}
|
|
252
253
|
else {
|
|
253
|
-
|
|
254
|
+
unreachable();
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
257
|
else if (difference instanceof types.updates.DifferenceTooLong) {
|
|
@@ -266,7 +267,7 @@ export class UpdateManager {
|
|
|
266
267
|
break;
|
|
267
268
|
}
|
|
268
269
|
else {
|
|
269
|
-
|
|
270
|
+
unreachable();
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
273
|
}
|
|
@@ -511,7 +512,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
|
|
|
511
512
|
}
|
|
512
513
|
else if (updates_ instanceof types.UpdateShortSentMessage) {
|
|
513
514
|
if (!(call instanceof functions.messages.sendMessage)) {
|
|
514
|
-
|
|
515
|
+
unreachable();
|
|
515
516
|
}
|
|
516
517
|
updates = [
|
|
517
518
|
new types.UpdateNewMessage({
|
|
@@ -541,7 +542,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
|
|
|
541
542
|
updates = [updates_];
|
|
542
543
|
}
|
|
543
544
|
else {
|
|
544
|
-
|
|
545
|
+
unreachable();
|
|
545
546
|
}
|
|
546
547
|
/// We process the updates when we are sure there is no gap.
|
|
547
548
|
if (updates_ instanceof types.Updates || updates_ instanceof types.UpdatesCombined) {
|
|
@@ -562,7 +563,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
|
|
|
562
563
|
await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, __classPrivateFieldGet(this, _UpdateManager_updateState, "f"));
|
|
563
564
|
}
|
|
564
565
|
else {
|
|
565
|
-
|
|
566
|
+
unreachable();
|
|
566
567
|
}
|
|
567
568
|
}
|
|
568
569
|
else if (_a.isPtsUpdate(update)) {
|
|
@@ -604,7 +605,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
|
|
|
604
605
|
await __classPrivateFieldGet(this, _UpdateManager_instances, "m", _UpdateManager_setState).call(this, localState);
|
|
605
606
|
}
|
|
606
607
|
else {
|
|
607
|
-
|
|
608
|
+
unreachable();
|
|
608
609
|
}
|
|
609
610
|
}
|
|
610
611
|
}
|
|
@@ -647,7 +648,7 @@ _a = UpdateManager, _UpdateManager_c = new WeakMap(), _UpdateManager_updateState
|
|
|
647
648
|
pts = pts_;
|
|
648
649
|
}
|
|
649
650
|
else {
|
|
650
|
-
|
|
651
|
+
unreachable();
|
|
651
652
|
}
|
|
652
653
|
__classPrivateFieldGet(this, _UpdateManager_LrecoverChannelUpdateGap, "f").debug("processed channelDifferenceTooLong");
|
|
653
654
|
}
|