@mtkruto/node 0.0.906 → 0.0.920
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/{types/utilities → client}/0_html.d.ts +1 -1
- package/esm/{types/utilities → client}/0_html.js +2 -2
- package/esm/client/{utilities/0_message.d.ts → 0_message.d.ts} +2 -2
- package/esm/client/{utilities/0_message.js → 0_message.js} +10 -10
- package/esm/client/{utilities/0_password.d.ts → 0_password.d.ts} +2 -2
- package/esm/client/{utilities/0_password.js → 0_password.js} +5 -5
- package/{script/client/client_abstract.d.ts → esm/client/1_client_abstract.d.ts} +6 -5
- package/esm/client/{client_abstract.js → 1_client_abstract.js} +10 -4
- package/esm/client/{client_plain.d.ts → 2_client_plain.d.ts} +1 -1
- package/esm/client/{client_plain.js → 2_client_plain.js} +2 -2
- package/esm/client/{client.d.ts → 3_client.d.ts} +7 -5
- package/esm/client/{client.js → 3_client.js} +145 -83
- package/{script/connection/connection_web_socket.d.ts → esm/connection/1_connection_web_socket.d.ts} +1 -1
- package/esm/constants.d.ts +2 -2
- package/esm/constants.js +1 -1
- package/esm/deps.d.ts +1 -2
- package/esm/deps.js +0 -1
- package/esm/mod.d.ts +13 -13
- package/esm/mod.js +13 -13
- package/esm/storage/{storage.d.ts → 0_storage.d.ts} +1 -1
- package/{script/storage/storage_local_storage.d.ts → esm/storage/1_storage_local_storage.d.ts} +1 -1
- package/esm/storage/{storage_local_storage.js → 1_storage_local_storage.js} +1 -1
- package/{script/storage/storage_memory.d.ts → esm/storage/1_storage_memory.d.ts} +1 -1
- package/esm/storage/{storage_memory.js → 1_storage_memory.js} +1 -1
- package/esm/storage/{storage_session_storage.d.ts → 1_storage_session_storage.d.ts} +1 -1
- package/esm/storage/{storage_session_storage.js → 1_storage_session_storage.js} +1 -1
- package/esm/transport/{utilities/0_obfuscation.d.ts → 0_obfuscation.d.ts} +2 -2
- package/esm/transport/{utilities/0_obfuscation.js → 0_obfuscation.js} +3 -3
- package/esm/transport/{transport_abridged.d.ts → 1_transport_abridged.d.ts} +2 -2
- package/esm/transport/{transport_abridged.js → 1_transport_abridged.js} +2 -2
- package/esm/transport/{transport_intermediate.d.ts → 1_transport_intermediate.d.ts} +2 -2
- package/esm/transport/{transport_intermediate.js → 1_transport_intermediate.js} +2 -2
- package/{script/transport/transport_provider.d.ts → esm/transport/2_transport_provider.d.ts} +2 -2
- package/esm/transport/{transport_provider.js → 2_transport_provider.js} +2 -2
- package/esm/types/!0_file_id.d.ts +77 -0
- package/esm/types/!0_file_id.js +325 -0
- package/esm/types/0_chat_photo.d.ts +7 -14
- package/esm/types/0_chat_photo.js +32 -17
- package/esm/types/1_chat.js +4 -4
- package/esm/types/1_user.js +2 -2
- package/esm/types/3_message.js +9 -0
- package/esm/utilities/0_base64.d.ts +2 -0
- package/esm/utilities/0_base64.js +9 -0
- package/esm/utilities/0_rle.d.ts +2 -0
- package/esm/utilities/0_rle.js +49 -0
- package/package.json +1 -1
- package/script/{types/utilities → client}/0_html.d.ts +1 -1
- package/script/{types/utilities → client}/0_html.js +2 -2
- package/script/client/{utilities/0_message.d.ts → 0_message.d.ts} +2 -2
- package/script/client/{utilities/0_message.js → 0_message.js} +10 -10
- package/script/client/{utilities/0_password.d.ts → 0_password.d.ts} +2 -2
- package/script/client/{utilities/0_password.js → 0_password.js} +5 -5
- package/script/client/0_password_test.d.ts +1 -0
- package/{esm/client/client_abstract.d.ts → script/client/1_client_abstract.d.ts} +6 -5
- package/script/client/{client_abstract.js → 1_client_abstract.js} +10 -4
- package/script/client/{client_plain.d.ts → 2_client_plain.d.ts} +1 -1
- package/script/client/{client_plain.js → 2_client_plain.js} +3 -3
- package/script/client/{client.d.ts → 3_client.d.ts} +7 -5
- package/script/client/{client.js → 3_client.js} +146 -84
- package/{esm/connection/connection_web_socket.d.ts → script/connection/1_connection_web_socket.d.ts} +1 -1
- package/script/constants.d.ts +2 -2
- package/script/constants.js +1 -1
- package/script/deps.d.ts +1 -2
- package/script/deps.js +1 -3
- package/script/mod.d.ts +13 -13
- package/script/mod.js +13 -13
- package/script/storage/{storage.d.ts → 0_storage.d.ts} +1 -1
- package/{esm/storage/storage_local_storage.d.ts → script/storage/1_storage_local_storage.d.ts} +1 -1
- package/script/storage/{storage_local_storage.js → 1_storage_local_storage.js} +2 -2
- package/{esm/storage/storage_memory.d.ts → script/storage/1_storage_memory.d.ts} +1 -1
- package/script/storage/{storage_memory.js → 1_storage_memory.js} +2 -2
- package/script/storage/{storage_session_storage.d.ts → 1_storage_session_storage.d.ts} +1 -1
- package/script/storage/{storage_session_storage.js → 1_storage_session_storage.js} +2 -2
- package/script/transport/{utilities/0_obfuscation.d.ts → 0_obfuscation.d.ts} +2 -2
- package/script/transport/{utilities/0_obfuscation.js → 0_obfuscation.js} +3 -3
- package/script/transport/{transport_abridged.d.ts → 1_transport_abridged.d.ts} +2 -2
- package/script/transport/{transport_abridged.js → 1_transport_abridged.js} +3 -3
- package/script/transport/{transport_intermediate.d.ts → 1_transport_intermediate.d.ts} +2 -2
- package/script/transport/{transport_intermediate.js → 1_transport_intermediate.js} +3 -3
- package/{esm/transport/transport_provider.d.ts → script/transport/2_transport_provider.d.ts} +2 -2
- package/script/transport/{transport_provider.js → 2_transport_provider.js} +4 -4
- package/script/types/!0_file_id.d.ts +77 -0
- package/script/types/!0_file_id.js +329 -0
- package/script/types/0_chat_photo.d.ts +7 -14
- package/script/types/0_chat_photo.js +33 -18
- package/script/types/1_chat.js +4 -4
- package/script/types/1_user.js +2 -2
- package/script/types/3_message.js +9 -0
- package/script/utilities/0_base64.d.ts +2 -0
- package/script/utilities/0_base64.js +14 -0
- package/script/utilities/0_rle.d.ts +2 -0
- package/script/utilities/0_rle.js +54 -0
- package/script/utilities/0_rle_test.d.ts +1 -0
- package/esm/deps/deno.land/x/q@v0.0.1/mod.d.ts +0 -6
- package/esm/deps/deno.land/x/q@v0.0.1/mod.js +0 -71
- package/script/deps/deno.land/x/q@v0.0.1/mod.d.ts +0 -6
- package/script/deps/deno.land/x/q@v0.0.1/mod.js +0 -75
- /package/esm/client/{utilities/0_password_test.d.ts → 0_password_test.d.ts} +0 -0
- /package/esm/connection/{connection.d.ts → 0_connection.d.ts} +0 -0
- /package/esm/connection/{connection.js → 0_connection.js} +0 -0
- /package/esm/connection/{connection_web_socket.js → 1_connection_web_socket.js} +0 -0
- /package/esm/storage/{storage.js → 0_storage.js} +0 -0
- /package/esm/transport/{transport.d.ts → 0_transport.d.ts} +0 -0
- /package/esm/transport/{transport.js → 0_transport.js} +0 -0
- /package/esm/types/{utilities/0_id_color.d.ts → !0_id_color.d.ts} +0 -0
- /package/esm/types/{utilities/0_id_color.js → !0_id_color.js} +0 -0
- /package/{script/client/utilities/0_password_test.d.ts → esm/utilities/0_rle_test.d.ts} +0 -0
- /package/script/connection/{connection.d.ts → 0_connection.d.ts} +0 -0
- /package/script/connection/{connection.js → 0_connection.js} +0 -0
- /package/script/connection/{connection_web_socket.js → 1_connection_web_socket.js} +0 -0
- /package/script/storage/{storage.js → 0_storage.js} +0 -0
- /package/script/transport/{transport.d.ts → 0_transport.d.ts} +0 -0
- /package/script/transport/{transport.js → 0_transport.js} +0 -0
- /package/script/types/{utilities/0_id_color.d.ts → !0_id_color.d.ts} +0 -0
- /package/script/types/{utilities/0_id_color.js → !0_id_color.js} +0 -0
package/esm/types/1_chat.js
CHANGED
|
@@ -3,8 +3,8 @@ import { UNREACHABLE } from "../utilities/0_control.js";
|
|
|
3
3
|
import { cleanObject } from "../utilities/0_object.js";
|
|
4
4
|
import { as } from "../tl/1_tl_object.js";
|
|
5
5
|
import * as types from "../tl/2_types.js";
|
|
6
|
+
import { getIdColor } from "./!0_id_color.js";
|
|
6
7
|
import { constructChatPhoto } from "./0_chat_photo.js";
|
|
7
|
-
import { getIdColor } from "./utilities/0_id_color.js";
|
|
8
8
|
export var ChatType;
|
|
9
9
|
(function (ChatType) {
|
|
10
10
|
ChatType["Private"] = "private";
|
|
@@ -32,7 +32,7 @@ export function constructChat(chat) {
|
|
|
32
32
|
chat_.restrictionReason = chat.restrictionReason?.map((v) => v[as](types.RestrictionReason));
|
|
33
33
|
}
|
|
34
34
|
if (chat.photo instanceof types.UserProfilePhoto) {
|
|
35
|
-
chat_.photo = constructChatPhoto(chat.photo);
|
|
35
|
+
chat_.photo = constructChatPhoto(chat.photo, chat_.id, chat.accessHash ?? 0n);
|
|
36
36
|
}
|
|
37
37
|
return cleanObject(chat_);
|
|
38
38
|
}
|
|
@@ -46,7 +46,7 @@ export function constructChat(chat) {
|
|
|
46
46
|
isCreator: chat.creator || false,
|
|
47
47
|
};
|
|
48
48
|
if (chat.photo instanceof types.ChatPhoto) {
|
|
49
|
-
chat_.photo = constructChatPhoto(chat.photo);
|
|
49
|
+
chat_.photo = constructChatPhoto(chat.photo, chat_.id, 0n);
|
|
50
50
|
}
|
|
51
51
|
return cleanObject(chat_);
|
|
52
52
|
}
|
|
@@ -86,7 +86,7 @@ export function constructChat(chat) {
|
|
|
86
86
|
chat_.restrictionReason = chat.restrictionReason?.map((v) => v[as](types.RestrictionReason));
|
|
87
87
|
}
|
|
88
88
|
if (chat.photo instanceof types.ChatPhoto) {
|
|
89
|
-
chat_.photo = constructChatPhoto(chat.photo);
|
|
89
|
+
chat_.photo = constructChatPhoto(chat.photo, chat_.id, chat.accessHash ?? 0n);
|
|
90
90
|
}
|
|
91
91
|
return cleanObject(chat_);
|
|
92
92
|
}
|
package/esm/types/1_user.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cleanObject } from "../utilities/0_object.js";
|
|
2
2
|
import { as } from "../tl/1_tl_object.js";
|
|
3
3
|
import * as types from "../tl/2_types.js";
|
|
4
|
+
import { getIdColor } from "./!0_id_color.js";
|
|
4
5
|
import { constructChatPhoto } from "./0_chat_photo.js";
|
|
5
|
-
import { getIdColor } from "./utilities/0_id_color.js";
|
|
6
6
|
export function constructUser(user_) {
|
|
7
7
|
const id = Number(user_.id);
|
|
8
8
|
const user = {
|
|
@@ -22,7 +22,7 @@ export function constructUser(user_) {
|
|
|
22
22
|
addedToAttachmentMenu: user_.attachMenuEnabled || false,
|
|
23
23
|
};
|
|
24
24
|
if (user_.photo instanceof types.UserProfilePhoto) {
|
|
25
|
-
user.photo = constructChatPhoto(user_.photo);
|
|
25
|
+
user.photo = constructChatPhoto(user_.photo, user.id, user_.accessHash ?? 0n);
|
|
26
26
|
}
|
|
27
27
|
return cleanObject(user);
|
|
28
28
|
}
|
package/esm/types/3_message.js
CHANGED
|
@@ -64,6 +64,15 @@ export async function constructMessage(message_, getEntity, getMessage) {
|
|
|
64
64
|
UNREACHABLE();
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
else if (message_.fromId instanceof types.PeerChannel) {
|
|
68
|
+
const entity = await getEntity(message_.fromId);
|
|
69
|
+
if (entity) {
|
|
70
|
+
message.senderChat = constructChat(entity);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
UNREACHABLE();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
67
76
|
if (message_.message) {
|
|
68
77
|
if (message_.media == undefined) {
|
|
69
78
|
message.text = message_.message;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { base64Decode, base64Encode } from "../deps.js";
|
|
2
|
+
// TODO: test
|
|
3
|
+
export function base64EncodeUrlSafe(data) {
|
|
4
|
+
return base64Encode(data).replace(/=*$/, "").replaceAll("+", "-").replaceAll("/", "_");
|
|
5
|
+
}
|
|
6
|
+
export function base64DecodeUrlSafe(data) {
|
|
7
|
+
data = data.replaceAll("_", "/").replaceAll("-", "+");
|
|
8
|
+
return base64Decode(data + "=".repeat(data.length % 4));
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export function rleEncode(s) {
|
|
2
|
+
const r = new Array();
|
|
3
|
+
let n = 0;
|
|
4
|
+
for (const b of s) {
|
|
5
|
+
if (!b) {
|
|
6
|
+
if (n == 255) {
|
|
7
|
+
r.push(0);
|
|
8
|
+
r.push(n);
|
|
9
|
+
n = 1;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
n++;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
if (n) {
|
|
17
|
+
r.push(0);
|
|
18
|
+
r.push(n);
|
|
19
|
+
n = 0;
|
|
20
|
+
}
|
|
21
|
+
r.push(b);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (n) {
|
|
25
|
+
r.push(0);
|
|
26
|
+
r.push(n);
|
|
27
|
+
}
|
|
28
|
+
return new Uint8Array(r);
|
|
29
|
+
}
|
|
30
|
+
export function rleDecode(s) {
|
|
31
|
+
const r = new Array();
|
|
32
|
+
let z = false;
|
|
33
|
+
for (const b of s) {
|
|
34
|
+
if (!b) {
|
|
35
|
+
z = true;
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (z) {
|
|
39
|
+
for (let i = 0; i < b; i++) {
|
|
40
|
+
r.push(0);
|
|
41
|
+
}
|
|
42
|
+
z = false;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
r.push(b);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return new Uint8Array(r);
|
|
49
|
+
}
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MessageEntity } from "../0_message_entity.js";
|
|
1
|
+
import { MessageEntity } from "../types/0_message_entity.js";
|
|
2
2
|
export declare function parseHtml(html: string): readonly [string, MessageEntity[]];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseHtml = void 0;
|
|
4
|
-
const deps_js_1 = require("
|
|
5
|
-
const _0_message_entity_js_1 = require("../0_message_entity.js");
|
|
4
|
+
const deps_js_1 = require("../deps.js");
|
|
5
|
+
const _0_message_entity_js_1 = require("../types/0_message_entity.js");
|
|
6
6
|
function parseHtml(html) {
|
|
7
7
|
let text = "";
|
|
8
8
|
const entities = new Array();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Message } from "
|
|
2
|
-
import { MessageContainer } from "
|
|
1
|
+
import { Message } from "../tl/6_message.js";
|
|
2
|
+
import { MessageContainer } from "../tl/7_message_container.js";
|
|
3
3
|
export declare function getMessageId(): bigint;
|
|
4
4
|
export declare function packUnencryptedMessage(data: Uint8Array): Uint8Array;
|
|
5
5
|
export declare function unpackUnencryptedMessage(buffer: Uint8Array): {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.decryptMessage = exports.encryptMessage = exports.unpackUnencryptedMessage = exports.packUnencryptedMessage = exports.getMessageId = void 0;
|
|
4
|
-
const deps_js_1 = require("
|
|
5
|
-
const _0_tl_raw_reader_js_1 = require("
|
|
6
|
-
const _0_tl_raw_writer_js_1 = require("
|
|
7
|
-
const _1_tl_object_js_1 = require("
|
|
8
|
-
const _3_tl_reader_js_1 = require("
|
|
9
|
-
const _5_rpc_result_js_1 = require("
|
|
10
|
-
const _6_message_js_1 = require("
|
|
11
|
-
const _7_message_container_js_1 = require("
|
|
12
|
-
const _0_buffer_js_1 = require("
|
|
13
|
-
const _0_hash_js_1 = require("
|
|
4
|
+
const deps_js_1 = require("../deps.js");
|
|
5
|
+
const _0_tl_raw_reader_js_1 = require("../tl/0_tl_raw_reader.js");
|
|
6
|
+
const _0_tl_raw_writer_js_1 = require("../tl/0_tl_raw_writer.js");
|
|
7
|
+
const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
|
|
8
|
+
const _3_tl_reader_js_1 = require("../tl/3_tl_reader.js");
|
|
9
|
+
const _5_rpc_result_js_1 = require("../tl/5_rpc_result.js");
|
|
10
|
+
const _6_message_js_1 = require("../tl/6_message.js");
|
|
11
|
+
const _7_message_container_js_1 = require("../tl/7_message_container.js");
|
|
12
|
+
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
13
|
+
const _0_hash_js_1 = require("../utilities/0_hash.js");
|
|
14
14
|
let lastMsgId = 0n;
|
|
15
15
|
function getMessageId() {
|
|
16
16
|
const now = new Date().getTime() / 1000 + 0;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as types from "
|
|
2
|
-
import { sha256 } from "
|
|
1
|
+
import * as types from "../tl/2_types.js";
|
|
2
|
+
import { sha256 } from "../utilities/0_hash.js";
|
|
3
3
|
export declare function isSafePrime(primeBytes: Uint8Array, g: number): boolean;
|
|
4
4
|
export declare const h: typeof sha256;
|
|
5
5
|
export declare const sh: (data: Uint8Array, salt: Uint8Array) => Promise<Uint8Array>;
|
|
@@ -24,11 +24,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.checkPassword = exports.pad = exports.isGoodModExpFirst = exports.ph2 = exports.pbkdf2 = exports.ph1 = exports.sh = exports.h = exports.isSafePrime = void 0;
|
|
27
|
-
const dntShim = __importStar(require("
|
|
28
|
-
const types = __importStar(require("
|
|
29
|
-
const _0_buffer_js_1 = require("
|
|
30
|
-
const _0_hash_js_1 = require("
|
|
31
|
-
const _0_bigint_js_1 = require("
|
|
27
|
+
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
|
+
const types = __importStar(require("../tl/2_types.js"));
|
|
29
|
+
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
30
|
+
const _0_hash_js_1 = require("../utilities/0_hash.js");
|
|
31
|
+
const _0_bigint_js_1 = require("../utilities/0_bigint.js");
|
|
32
32
|
function isSafePrime(primeBytes, g) {
|
|
33
33
|
// deno-fmt-ignore
|
|
34
34
|
const goodPrime = new Uint8Array([
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { Connection } from "../connection/
|
|
3
|
-
import { Transport } from "../transport/
|
|
4
|
-
import { DC } from "../transport/
|
|
2
|
+
import { Connection } from "../connection/0_connection.js";
|
|
3
|
+
import { Transport } from "../transport/0_transport.js";
|
|
4
|
+
import { DC } from "../transport/2_transport_provider.js";
|
|
5
5
|
export declare abstract class ClientAbstract {
|
|
6
|
-
protected transportProvider: import("../transport/
|
|
6
|
+
protected transportProvider: import("../transport/2_transport_provider.js").TransportProvider;
|
|
7
|
+
protected readonly cdn: boolean;
|
|
7
8
|
protected connection: Connection;
|
|
8
9
|
protected transport: Transport;
|
|
9
10
|
private _dcId;
|
|
10
11
|
private _initialDc;
|
|
11
12
|
get initialDc(): DC;
|
|
12
|
-
constructor(transportProvider?: import("../transport/
|
|
13
|
+
constructor(transportProvider?: import("../transport/2_transport_provider.js").TransportProvider, cdn?: boolean);
|
|
13
14
|
get dcId(): number;
|
|
14
15
|
setDc(dc: DC): MaybePromise<void>;
|
|
15
16
|
get connected(): boolean;
|
|
@@ -3,18 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ClientAbstract = void 0;
|
|
4
4
|
const deps_js_1 = require("../deps.js");
|
|
5
5
|
const constants_js_1 = require("../constants.js");
|
|
6
|
-
const
|
|
6
|
+
const _2_transport_provider_js_1 = require("../transport/2_transport_provider.js");
|
|
7
7
|
class ClientAbstract {
|
|
8
8
|
get initialDc() {
|
|
9
9
|
return this._initialDc;
|
|
10
10
|
}
|
|
11
|
-
constructor(transportProvider = (0,
|
|
11
|
+
constructor(transportProvider = (0, _2_transport_provider_js_1.defaultTransportProvider)({ initialDc: constants_js_1.DEFAULT_INITIAL_DC }), cdn = false) {
|
|
12
12
|
Object.defineProperty(this, "transportProvider", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
configurable: true,
|
|
15
15
|
writable: true,
|
|
16
16
|
value: transportProvider
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(this, "cdn", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
configurable: true,
|
|
21
|
+
writable: true,
|
|
22
|
+
value: cdn
|
|
23
|
+
});
|
|
18
24
|
Object.defineProperty(this, "connection", {
|
|
19
25
|
enumerable: true,
|
|
20
26
|
configurable: true,
|
|
@@ -41,7 +47,7 @@ class ClientAbstract {
|
|
|
41
47
|
});
|
|
42
48
|
const { initialDc, createTransport } = transportProvider;
|
|
43
49
|
this._initialDc = initialDc;
|
|
44
|
-
const { connection, transport, dcId } = createTransport({ cdn:
|
|
50
|
+
const { connection, transport, dcId } = createTransport({ cdn: this.cdn });
|
|
45
51
|
this.connection = connection;
|
|
46
52
|
this.transport = transport;
|
|
47
53
|
this._dcId = dcId;
|
|
@@ -51,7 +57,7 @@ class ClientAbstract {
|
|
|
51
57
|
}
|
|
52
58
|
// MaybePromise since `Client` has to deal with `Storage.set()`
|
|
53
59
|
setDc(dc) {
|
|
54
|
-
const { connection, transport, dcId } = this.transportProvider.createTransport({ dc, cdn:
|
|
60
|
+
const { connection, transport, dcId } = this.transportProvider.createTransport({ dc, cdn: this.cdn });
|
|
55
61
|
this.connection = connection;
|
|
56
62
|
this.transport = transport;
|
|
57
63
|
this._dcId = dcId;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Function } from "../tl/3_functions.js";
|
|
2
|
-
import { ClientAbstract } from "./
|
|
2
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
3
3
|
export declare class ClientPlain extends ClientAbstract {
|
|
4
4
|
invoke<T extends Function<unknown>>(function_: T): Promise<T["__R"]>;
|
|
5
5
|
createAuthKey(): Promise<{
|
|
@@ -12,10 +12,10 @@ const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
|
|
|
12
12
|
const _2_types_js_1 = require("../tl/2_types.js");
|
|
13
13
|
const _3_functions_js_1 = require("../tl/3_functions.js");
|
|
14
14
|
const _3_tl_reader_js_1 = require("../tl/3_tl_reader.js");
|
|
15
|
-
const
|
|
16
|
-
const _0_message_js_1 = require("./
|
|
15
|
+
const _1_client_abstract_js_1 = require("./1_client_abstract.js");
|
|
16
|
+
const _0_message_js_1 = require("./0_message.js");
|
|
17
17
|
const d = (0, deps_js_1.debug)("ClientPlain/createAuthKey");
|
|
18
|
-
class ClientPlain extends
|
|
18
|
+
class ClientPlain extends _1_client_abstract_js_1.ClientAbstract {
|
|
19
19
|
async invoke(function_) {
|
|
20
20
|
await this.transport.send((0, _0_message_js_1.packUnencryptedMessage)(function_[_1_tl_object_js_1.serialize]()));
|
|
21
21
|
const buffer = await this.transport.receive();
|
|
@@ -2,15 +2,15 @@ import { MaybePromise } from "../utilities/0_types.js";
|
|
|
2
2
|
import * as types from "../tl/2_types.js";
|
|
3
3
|
import * as functions from "../tl/3_functions.js";
|
|
4
4
|
import { ReadObject } from "../tl/3_tl_reader.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { DC, TransportProvider } from "../transport/transport_provider.js";
|
|
5
|
+
import { Storage } from "../storage/0_storage.js";
|
|
6
|
+
import { DC, TransportProvider } from "../transport/2_transport_provider.js";
|
|
8
7
|
import { MessageEntity } from "../types/0_message_entity.js";
|
|
9
8
|
import { ReplyKeyboardRemove } from "../types/0_reply_keyboard_remove.js";
|
|
10
9
|
import { ForceReply } from "../types/0_force_reply.js";
|
|
11
10
|
import { ReplyKeyboardMarkup } from "../types/2_reply_keyboard_markup.js";
|
|
12
11
|
import { InlineKeyboardMarkup } from "../types/2_inline_keyboard_markup.js";
|
|
13
12
|
import { Message } from "../types/3_message.js";
|
|
13
|
+
import { ClientAbstract } from "./1_client_abstract.js";
|
|
14
14
|
export declare const getEntity: unique symbol;
|
|
15
15
|
export declare const restartAuth: unique symbol;
|
|
16
16
|
export declare enum ParseMode {
|
|
@@ -83,7 +83,7 @@ export declare class Client extends ClientAbstract {
|
|
|
83
83
|
* @param apiHash App's API hash from [my.telegram.org/apps](https://my.telegram.org/apps). Default to empty string (unset).
|
|
84
84
|
* @param params Other parameters.
|
|
85
85
|
*/
|
|
86
|
-
constructor(storage?: Storage, apiId?: number, apiHash?: string, params?: ClientParams);
|
|
86
|
+
constructor(storage?: Storage, apiId?: number, apiHash?: string, params?: ClientParams, cdn?: boolean);
|
|
87
87
|
private storageInited;
|
|
88
88
|
/**
|
|
89
89
|
* Sets the DC and resets the auth key stored in the session provider
|
|
@@ -118,7 +118,6 @@ export declare class Client extends ClientAbstract {
|
|
|
118
118
|
* [2]: https://core.telegram.org/method/updates.getState
|
|
119
119
|
*/
|
|
120
120
|
authorize(params: string | types.AuthExportedAuthorization | AuthorizeUserParams): Promise<void>;
|
|
121
|
-
private messageProcessQueue;
|
|
122
121
|
private receiveLoop;
|
|
123
122
|
private pingLoop;
|
|
124
123
|
/**
|
|
@@ -138,6 +137,7 @@ export declare class Client extends ClientAbstract {
|
|
|
138
137
|
private updateApplicationMutex;
|
|
139
138
|
private applyUpdateNoGap;
|
|
140
139
|
private applyUpdate;
|
|
140
|
+
private updateProcessLock;
|
|
141
141
|
private processUpdates;
|
|
142
142
|
private setUpdateStateDate;
|
|
143
143
|
private getLocalState;
|
|
@@ -162,4 +162,6 @@ export declare class Client extends ClientAbstract {
|
|
|
162
162
|
}): Promise<Omit<Message, "replyToMessage">>;
|
|
163
163
|
getMessages(chatId: number | string, messageIds: number[]): Promise<Omit<Message, "replyToMessage">[]>;
|
|
164
164
|
getMessage(chatId: number | string, messageId: number): Promise<Omit<Message, "replyToMessage"> | null>;
|
|
165
|
+
private downloadInner;
|
|
166
|
+
download(fileId_: string): Promise<AsyncGenerator<Uint8Array, void, unknown>>;
|
|
165
167
|
}
|