@mtkruto/node 0.0.905 → 0.0.910
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/esm/client/{client_abstract.d.ts → 1_client_abstract.d.ts} +5 -5
- package/esm/client/{client_abstract.js → 1_client_abstract.js} +1 -1
- 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} +3 -3
- package/esm/client/{client.js → 3_client.js} +7 -7
- 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/mod.d.ts +13 -13
- package/esm/mod.js +13 -13
- package/{script/storage/storage.d.ts → esm/storage/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 +372 -0
- package/esm/types/0_chat_photo.d.ts +7 -15
- package/esm/types/0_chat_photo.js +30 -17
- package/esm/types/1_chat.d.ts +1 -0
- package/esm/types/1_chat.js +25 -6
- package/esm/types/1_user.js +2 -2
- package/esm/types/3_message.js +12 -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/{client_abstract.d.ts → 1_client_abstract.d.ts} +5 -5
- package/script/client/{client_abstract.js → 1_client_abstract.js} +2 -2
- 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} +3 -3
- package/script/client/{client.js → 3_client.js} +10 -10
- 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/mod.d.ts +13 -13
- package/script/mod.js +13 -13
- package/{esm/storage/storage.d.ts → script/storage/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 +376 -0
- package/script/types/0_chat_photo.d.ts +7 -15
- package/script/types/0_chat_photo.js +31 -18
- package/script/types/1_chat.d.ts +1 -0
- package/script/types/1_chat.js +25 -6
- package/script/types/1_user.js +2 -2
- package/script/types/3_message.js +12 -0
- /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 → 0_password_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
|
@@ -1,15 +1,15 @@
|
|
|
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
7
|
protected connection: Connection;
|
|
8
8
|
protected transport: Transport;
|
|
9
9
|
private _dcId;
|
|
10
10
|
private _initialDc;
|
|
11
11
|
get initialDc(): DC;
|
|
12
|
-
constructor(transportProvider?: import("../transport/
|
|
12
|
+
constructor(transportProvider?: import("../transport/2_transport_provider.js").TransportProvider);
|
|
13
13
|
get dcId(): number;
|
|
14
14
|
setDc(dc: DC): MaybePromise<void>;
|
|
15
15
|
get connected(): boolean;
|
|
@@ -3,12 +3,12 @@ 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 })) {
|
|
12
12
|
Object.defineProperty(this, "transportProvider", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
configurable: true,
|
|
@@ -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 {
|
|
@@ -36,18 +36,18 @@ const _3_tl_reader_js_1 = require("../tl/3_tl_reader.js");
|
|
|
36
36
|
const _5_rpc_result_js_1 = require("../tl/5_rpc_result.js");
|
|
37
37
|
const _6_message_js_1 = require("../tl/6_message.js"); // MTProto API message
|
|
38
38
|
const _7_message_container_js_1 = require("../tl/7_message_container.js");
|
|
39
|
-
const
|
|
40
|
-
const client_plain_js_1 = require("./client_plain.js");
|
|
41
|
-
const storage_memory_js_1 = require("../storage/storage_memory.js");
|
|
42
|
-
const _0_html_js_1 = require("../types/utilities/0_html.js");
|
|
39
|
+
const _1_storage_memory_js_1 = require("../storage/1_storage_memory.js");
|
|
43
40
|
const _0_message_entity_js_1 = require("../types/0_message_entity.js");
|
|
44
41
|
const _0_reply_keyboard_remove_js_1 = require("../types/0_reply_keyboard_remove.js");
|
|
45
42
|
const _0_force_reply_js_1 = require("../types/0_force_reply.js");
|
|
46
43
|
const _2_reply_keyboard_markup_js_1 = require("../types/2_reply_keyboard_markup.js");
|
|
47
44
|
const _2_inline_keyboard_markup_js_1 = require("../types/2_inline_keyboard_markup.js");
|
|
48
45
|
const _3_message_js_1 = require("../types/3_message.js"); // high-level wrapper for Telegram API's message
|
|
49
|
-
const _0_message_js_1 = require("./
|
|
50
|
-
const
|
|
46
|
+
const _0_message_js_1 = require("./0_message.js");
|
|
47
|
+
const _0_html_js_1 = require("./0_html.js");
|
|
48
|
+
const _0_password_js_1 = require("./0_password.js");
|
|
49
|
+
const _1_client_abstract_js_1 = require("./1_client_abstract.js");
|
|
50
|
+
const _2_client_plain_js_1 = require("./2_client_plain.js");
|
|
51
51
|
const d = (0, deps_js_1.debug)("Client");
|
|
52
52
|
const dGap = (0, deps_js_1.debug)("Client/recoverUpdateGap");
|
|
53
53
|
const dGapC = (0, deps_js_1.debug)("Client/recoverChannelUpdateGap");
|
|
@@ -61,7 +61,7 @@ var ParseMode;
|
|
|
61
61
|
ParseMode["None"] = "none";
|
|
62
62
|
ParseMode["HTML"] = "html";
|
|
63
63
|
})(ParseMode = exports.ParseMode || (exports.ParseMode = {}));
|
|
64
|
-
class Client extends
|
|
64
|
+
class Client extends _1_client_abstract_js_1.ClientAbstract {
|
|
65
65
|
/**
|
|
66
66
|
* Constructs the client.
|
|
67
67
|
*
|
|
@@ -70,7 +70,7 @@ class Client extends client_abstract_js_1.ClientAbstract {
|
|
|
70
70
|
* @param apiHash App's API hash from [my.telegram.org/apps](https://my.telegram.org/apps). Default to empty string (unset).
|
|
71
71
|
* @param params Other parameters.
|
|
72
72
|
*/
|
|
73
|
-
constructor(storage = new
|
|
73
|
+
constructor(storage = new _1_storage_memory_js_1.StorageMemory(), apiId = 0, apiHash = "", params) {
|
|
74
74
|
super(params?.transportProvider);
|
|
75
75
|
Object.defineProperty(this, "storage", {
|
|
76
76
|
enumerable: true,
|
|
@@ -296,7 +296,7 @@ class Client extends client_abstract_js_1.ClientAbstract {
|
|
|
296
296
|
}
|
|
297
297
|
const authKey = await this.storage.getAuthKey();
|
|
298
298
|
if (authKey == null) {
|
|
299
|
-
const plain = new
|
|
299
|
+
const plain = new _2_client_plain_js_1.ClientPlain(this.transportProvider);
|
|
300
300
|
const dc = await this.storage.getDc();
|
|
301
301
|
if (dc != null) {
|
|
302
302
|
plain.setDc(dc);
|
|
@@ -833,7 +833,7 @@ class Client extends client_abstract_js_1.ClientAbstract {
|
|
|
833
833
|
try {
|
|
834
834
|
let state = await this.getLocalState();
|
|
835
835
|
while (true) {
|
|
836
|
-
const difference = await this.invoke(new functions.UpdatesGetDifference({ pts: state.pts, date: state.date, qts: state.qts }));
|
|
836
|
+
const difference = await this.invoke(new functions.UpdatesGetDifference({ pts: state.pts, date: state.date, qts: state.qts ?? 0 }));
|
|
837
837
|
if (difference instanceof types.UpdatesDifference || difference instanceof types.UpdatesDifferenceSlice) {
|
|
838
838
|
await this.processChats(difference.chats);
|
|
839
839
|
await this.processUsers(difference.users);
|
package/script/constants.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DC } from "./transport/
|
|
1
|
+
import { DC } from "./transport/2_transport_provider.js";
|
|
2
2
|
export declare const ackThreshold = 10;
|
|
3
3
|
export declare const publicKeys: Map<bigint, [bigint, bigint]>;
|
|
4
4
|
export declare const VECTOR_CONSTRUCTOR = 481674261;
|
|
5
5
|
export declare const DEFAULT_INITIAL_DC: DC;
|
|
6
6
|
export declare const LAYER = 158;
|
|
7
|
-
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
7
|
+
export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.910";
|
|
8
8
|
export declare const DEFAULT_DEVICE_MODEL: string;
|
|
9
9
|
export declare const DEFAULT_LANG_CODE: string;
|
|
10
10
|
export declare const DEFAULT_LANG_PACK = "";
|
package/script/constants.js
CHANGED
|
@@ -88,7 +88,7 @@ exports.publicKeys = new Map([
|
|
|
88
88
|
exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
|
|
89
89
|
exports.DEFAULT_INITIAL_DC = "2-test";
|
|
90
90
|
exports.LAYER = 158;
|
|
91
|
-
exports.DEFAULT_APP_VERSION = "MTKruto 0.0.
|
|
91
|
+
exports.DEFAULT_APP_VERSION = "MTKruto 0.0.910";
|
|
92
92
|
// @ts-ignore: lib
|
|
93
93
|
exports.DEFAULT_DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
|
|
94
94
|
exports.DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
|
package/script/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getRandomId } from "./utilities/0_bigint.js";
|
|
2
|
-
import { checkPassword } from "./client/
|
|
2
|
+
import { checkPassword } from "./client/0_password.js";
|
|
3
3
|
export declare const utils: {
|
|
4
4
|
checkPassword: typeof checkPassword;
|
|
5
5
|
getRandomId: typeof getRandomId;
|
|
@@ -10,16 +10,16 @@ export * as functions from "./tl/3_functions.js";
|
|
|
10
10
|
export * from "./tl/5_rpc_result.js";
|
|
11
11
|
export * from "./tl/6_message.js";
|
|
12
12
|
export * from "./tl/7_message_container.js";
|
|
13
|
-
export * from "./client/
|
|
14
|
-
export * from "./client/
|
|
15
|
-
export * from "./storage/
|
|
16
|
-
export * from "./storage/
|
|
17
|
-
export * from "./storage/
|
|
18
|
-
export * from "./storage/
|
|
19
|
-
export * from "./transport/
|
|
20
|
-
export * from "./transport/
|
|
21
|
-
export * from "./transport/
|
|
22
|
-
export * from "./transport/
|
|
23
|
-
export * from "./connection/
|
|
24
|
-
export * from "./connection/
|
|
13
|
+
export * from "./client/2_client_plain.js";
|
|
14
|
+
export * from "./client/3_client.js";
|
|
15
|
+
export * from "./storage/0_storage.js";
|
|
16
|
+
export * from "./storage/1_storage_memory.js";
|
|
17
|
+
export * from "./storage/1_storage_local_storage.js";
|
|
18
|
+
export * from "./storage/1_storage_session_storage.js";
|
|
19
|
+
export * from "./transport/1_transport_abridged.js";
|
|
20
|
+
export * from "./transport/1_transport_intermediate.js";
|
|
21
|
+
export * from "./transport/0_transport.js";
|
|
22
|
+
export * from "./transport/2_transport_provider.js";
|
|
23
|
+
export * from "./connection/0_connection.js";
|
|
24
|
+
export * from "./connection/1_connection_web_socket.js";
|
|
25
25
|
export { DEFAULT_APP_VERSION, DEFAULT_DEVICE_MODEL, DEFAULT_INITIAL_DC, DEFAULT_LANG_CODE, DEFAULT_LANG_PACK, DEFAULT_SYSTEM_LANG_CODE, DEFAULT_SYSTEM_VERSION, LAYER } from "./constants.js";
|
package/script/mod.js
CHANGED
|
@@ -28,7 +28,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.LAYER = exports.DEFAULT_SYSTEM_VERSION = exports.DEFAULT_SYSTEM_LANG_CODE = exports.DEFAULT_LANG_PACK = exports.DEFAULT_LANG_CODE = exports.DEFAULT_INITIAL_DC = exports.DEFAULT_DEVICE_MODEL = exports.DEFAULT_APP_VERSION = exports.functions = exports.types = exports.as = exports.utils = void 0;
|
|
30
30
|
const _0_bigint_js_1 = require("./utilities/0_bigint.js");
|
|
31
|
-
const _0_password_js_1 = require("./client/
|
|
31
|
+
const _0_password_js_1 = require("./client/0_password.js");
|
|
32
32
|
exports.utils = { checkPassword: _0_password_js_1.checkPassword, getRandomId: _0_bigint_js_1.getRandomId };
|
|
33
33
|
var _1_tl_object_js_1 = require("./tl/1_tl_object.js");
|
|
34
34
|
Object.defineProperty(exports, "as", { enumerable: true, get: function () { return _1_tl_object_js_1.as; } });
|
|
@@ -37,18 +37,18 @@ exports.functions = __importStar(require("./tl/3_functions.js"));
|
|
|
37
37
|
__exportStar(require("./tl/5_rpc_result.js"), exports);
|
|
38
38
|
__exportStar(require("./tl/6_message.js"), exports);
|
|
39
39
|
__exportStar(require("./tl/7_message_container.js"), exports);
|
|
40
|
-
__exportStar(require("./client/
|
|
41
|
-
__exportStar(require("./client/
|
|
42
|
-
__exportStar(require("./storage/
|
|
43
|
-
__exportStar(require("./storage/
|
|
44
|
-
__exportStar(require("./storage/
|
|
45
|
-
__exportStar(require("./storage/
|
|
46
|
-
__exportStar(require("./transport/
|
|
47
|
-
__exportStar(require("./transport/
|
|
48
|
-
__exportStar(require("./transport/
|
|
49
|
-
__exportStar(require("./transport/
|
|
50
|
-
__exportStar(require("./connection/
|
|
51
|
-
__exportStar(require("./connection/
|
|
40
|
+
__exportStar(require("./client/2_client_plain.js"), exports);
|
|
41
|
+
__exportStar(require("./client/3_client.js"), exports);
|
|
42
|
+
__exportStar(require("./storage/0_storage.js"), exports);
|
|
43
|
+
__exportStar(require("./storage/1_storage_memory.js"), exports);
|
|
44
|
+
__exportStar(require("./storage/1_storage_local_storage.js"), exports);
|
|
45
|
+
__exportStar(require("./storage/1_storage_session_storage.js"), exports);
|
|
46
|
+
__exportStar(require("./transport/1_transport_abridged.js"), exports);
|
|
47
|
+
__exportStar(require("./transport/1_transport_intermediate.js"), exports);
|
|
48
|
+
__exportStar(require("./transport/0_transport.js"), exports);
|
|
49
|
+
__exportStar(require("./transport/2_transport_provider.js"), exports);
|
|
50
|
+
__exportStar(require("./connection/0_connection.js"), exports);
|
|
51
|
+
__exportStar(require("./connection/1_connection_web_socket.js"), exports);
|
|
52
52
|
var constants_js_1 = require("./constants.js");
|
|
53
53
|
Object.defineProperty(exports, "DEFAULT_APP_VERSION", { enumerable: true, get: function () { return constants_js_1.DEFAULT_APP_VERSION; } });
|
|
54
54
|
Object.defineProperty(exports, "DEFAULT_DEVICE_MODEL", { enumerable: true, get: function () { return constants_js_1.DEFAULT_DEVICE_MODEL; } });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { DC } from "../transport/
|
|
2
|
+
import { DC } from "../transport/2_transport_provider.js";
|
|
3
3
|
import * as types from "../tl/2_types.js";
|
|
4
4
|
export declare abstract class Storage {
|
|
5
5
|
private _authKeyId;
|
package/{esm/storage/storage_local_storage.d.ts → script/storage/1_storage_local_storage.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { Storage } from "./
|
|
2
|
+
import { Storage } from "./0_storage.js";
|
|
3
3
|
export declare class StorageLocalStorage extends Storage implements Storage {
|
|
4
4
|
private readonly prefix;
|
|
5
5
|
constructor(prefix: string);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StorageLocalStorage = void 0;
|
|
4
|
-
const
|
|
5
|
-
class StorageLocalStorage extends
|
|
4
|
+
const _0_storage_js_1 = require("./0_storage.js");
|
|
5
|
+
class StorageLocalStorage extends _0_storage_js_1.Storage {
|
|
6
6
|
constructor(prefix) {
|
|
7
7
|
if (typeof localStorage === "undefined") {
|
|
8
8
|
throw new Error("Unavailable in current environment");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StorageMemory = void 0;
|
|
4
|
-
const
|
|
5
|
-
class StorageMemory extends
|
|
4
|
+
const _0_storage_js_1 = require("./0_storage.js");
|
|
5
|
+
class StorageMemory extends _0_storage_js_1.Storage {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
8
|
Object.defineProperty(this, "map", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MaybePromise } from "../utilities/0_types.js";
|
|
2
|
-
import { Storage } from "./
|
|
2
|
+
import { Storage } from "./0_storage.js";
|
|
3
3
|
export declare class StorageSessionStorage extends Storage implements Storage {
|
|
4
4
|
private readonly prefix;
|
|
5
5
|
constructor(prefix: string);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StorageSessionStorage = void 0;
|
|
4
|
-
const
|
|
5
|
-
class StorageSessionStorage extends
|
|
4
|
+
const _0_storage_js_1 = require("./0_storage.js");
|
|
5
|
+
class StorageSessionStorage extends _0_storage_js_1.Storage {
|
|
6
6
|
constructor(prefix) {
|
|
7
7
|
if (typeof sessionStorage === "undefined") {
|
|
8
8
|
throw new Error("Unavailable in current environment");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CTR } from "
|
|
2
|
-
import { Connection } from "
|
|
1
|
+
import { CTR } from "../utilities/0_crypto.js";
|
|
2
|
+
import { Connection } from "../connection/0_connection.js";
|
|
3
3
|
export declare function getObfuscationParameters(protocol: number, connection: Connection): Promise<{
|
|
4
4
|
encryptionCTR: CTR;
|
|
5
5
|
decryptionCTR: CTR;
|
|
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.getObfuscationParameters = void 0;
|
|
27
|
-
const dntShim = __importStar(require("
|
|
28
|
-
const _0_buffer_js_1 = require("
|
|
29
|
-
const _0_crypto_js_1 = require("
|
|
27
|
+
const dntShim = __importStar(require("../_dnt.shims.js"));
|
|
28
|
+
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
29
|
+
const _0_crypto_js_1 = require("../utilities/0_crypto.js");
|
|
30
30
|
async function getObfuscationParameters(protocol, connection) {
|
|
31
31
|
const dc = 0xFCFF;
|
|
32
32
|
let init;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Connection } from "../connection/
|
|
2
|
-
import { Transport } from "./
|
|
1
|
+
import { Connection } from "../connection/0_connection.js";
|
|
2
|
+
import { Transport } from "./0_transport.js";
|
|
3
3
|
export declare class TransportAbridged extends Transport implements Transport {
|
|
4
4
|
private readonly connection;
|
|
5
5
|
private readonly obfuscated;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransportAbridged = void 0;
|
|
4
4
|
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
5
|
-
const _0_obfuscation_js_1 = require("./
|
|
6
|
-
const
|
|
7
|
-
class TransportAbridged extends
|
|
5
|
+
const _0_obfuscation_js_1 = require("./0_obfuscation.js");
|
|
6
|
+
const _0_transport_js_1 = require("./0_transport.js");
|
|
7
|
+
class TransportAbridged extends _0_transport_js_1.Transport {
|
|
8
8
|
constructor(connection, obfuscated = false) {
|
|
9
9
|
super();
|
|
10
10
|
Object.defineProperty(this, "connection", {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Connection } from "../connection/
|
|
2
|
-
import { Transport } from "./
|
|
1
|
+
import { Connection } from "../connection/0_connection.js";
|
|
2
|
+
import { Transport } from "./0_transport.js";
|
|
3
3
|
export declare class TransportIntermediate extends Transport implements Transport {
|
|
4
4
|
private readonly connection;
|
|
5
5
|
private readonly obfuscated;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransportIntermediate = void 0;
|
|
4
4
|
const _0_buffer_js_1 = require("../utilities/0_buffer.js");
|
|
5
|
-
const _0_obfuscation_js_1 = require("./
|
|
6
|
-
const
|
|
7
|
-
class TransportIntermediate extends
|
|
5
|
+
const _0_obfuscation_js_1 = require("./0_obfuscation.js");
|
|
6
|
+
const _0_transport_js_1 = require("./0_transport.js");
|
|
7
|
+
class TransportIntermediate extends _0_transport_js_1.Transport {
|
|
8
8
|
constructor(connection, obfuscated = false) {
|
|
9
9
|
super();
|
|
10
10
|
Object.defineProperty(this, "connection", {
|
package/{esm/transport/transport_provider.d.ts → script/transport/2_transport_provider.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Connection } from "../connection/
|
|
2
|
-
import { Transport } from "./
|
|
1
|
+
import { Connection } from "../connection/0_connection.js";
|
|
2
|
+
import { Transport } from "./0_transport.js";
|
|
3
3
|
export type DC = "1" | "2" | "3" | "4" | "5" | "1-test" | "2-test" | "3-test";
|
|
4
4
|
export interface TransportProviderParams {
|
|
5
5
|
dc?: DC;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defaultTransportProvider = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const _1_connection_web_socket_js_1 = require("../connection/1_connection_web_socket.js");
|
|
5
|
+
const _1_transport_intermediate_js_1 = require("./1_transport_intermediate.js");
|
|
6
6
|
const dcToNameMap = {
|
|
7
7
|
"1": "pluto",
|
|
8
8
|
"1-test": "pluto",
|
|
@@ -20,8 +20,8 @@ const defaultTransportProvider = ({ initialDc, wss }) => {
|
|
|
20
20
|
dc ??= initialDc;
|
|
21
21
|
wss ??= typeof location !== "undefined" && location.protocol == "http:" ? false : true;
|
|
22
22
|
const url = `${wss ? "wss" : "ws"}://${dcToNameMap[dc]}${cdn ? "-1" : ""}.web.telegram.org/${dc.endsWith("-test") ? "apiws_test" : "apiws"}`;
|
|
23
|
-
const connection = new
|
|
24
|
-
const transport = new
|
|
23
|
+
const connection = new _1_connection_web_socket_js_1.ConnectionWebSocket(url);
|
|
24
|
+
const transport = new _1_transport_intermediate_js_1.TransportIntermediate(connection, true);
|
|
25
25
|
const dcId = Number(dc[0]) + (dc.endsWith("-test") ? 10000 : 0) * (cdn ? -1 : 1);
|
|
26
26
|
return { connection, transport, dcId };
|
|
27
27
|
},
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export declare enum FileType {
|
|
2
|
+
Thumbnail = 0,
|
|
3
|
+
ChatPhoto = 1,
|
|
4
|
+
Photo = 2,
|
|
5
|
+
Voice = 3,
|
|
6
|
+
Video = 4,
|
|
7
|
+
Document = 5,
|
|
8
|
+
Encrypted = 6,
|
|
9
|
+
Temp = 7,
|
|
10
|
+
Sticker = 8,
|
|
11
|
+
Audio = 9,
|
|
12
|
+
Animation = 10,
|
|
13
|
+
EncryptedThumbnail = 11,
|
|
14
|
+
Wallpaper = 12,
|
|
15
|
+
VideoNote = 13,
|
|
16
|
+
SecureRaw = 14,
|
|
17
|
+
Secure = 15,
|
|
18
|
+
Background = 16,
|
|
19
|
+
DocumentAsFile = 17
|
|
20
|
+
}
|
|
21
|
+
export declare enum ThumbnailSource {
|
|
22
|
+
Legacy = 0,
|
|
23
|
+
Thumbnail = 1,
|
|
24
|
+
ChatPhotoSmall = 2,
|
|
25
|
+
ChatPhotoBig = 3,
|
|
26
|
+
StickerSetThumbnail = 4
|
|
27
|
+
}
|
|
28
|
+
interface FileIDParams {
|
|
29
|
+
fileReference?: Uint8Array;
|
|
30
|
+
url?: string;
|
|
31
|
+
mediaId?: bigint;
|
|
32
|
+
accessHash?: bigint;
|
|
33
|
+
volumeId?: bigint;
|
|
34
|
+
thumbnailSource?: ThumbnailSource;
|
|
35
|
+
thumbnailFileType?: FileType;
|
|
36
|
+
thumbnailSize?: string;
|
|
37
|
+
secret?: bigint;
|
|
38
|
+
localId?: number;
|
|
39
|
+
chatId?: bigint;
|
|
40
|
+
chatAccessHash?: bigint;
|
|
41
|
+
stickerSetId?: bigint;
|
|
42
|
+
stickerSetAccessHash?: bigint;
|
|
43
|
+
}
|
|
44
|
+
export declare class FileID {
|
|
45
|
+
private readonly fileType;
|
|
46
|
+
private readonly dcId;
|
|
47
|
+
private readonly params;
|
|
48
|
+
static MAJOR: number;
|
|
49
|
+
static MINOR: number;
|
|
50
|
+
private readonly major;
|
|
51
|
+
private readonly minor;
|
|
52
|
+
constructor(major: number | null | undefined, minor: number | null | undefined, fileType: FileType, dcId: number, params: FileIDParams);
|
|
53
|
+
static decode(fileId: string): FileID;
|
|
54
|
+
encode(major?: number, minor?: number): string;
|
|
55
|
+
}
|
|
56
|
+
export declare enum FileUniqueType {
|
|
57
|
+
Web = 0,
|
|
58
|
+
Photo = 1,
|
|
59
|
+
Document = 2,
|
|
60
|
+
Secure = 3,
|
|
61
|
+
Encrypted = 4,
|
|
62
|
+
Temp = 5
|
|
63
|
+
}
|
|
64
|
+
interface FileUniqueParams {
|
|
65
|
+
url?: string;
|
|
66
|
+
mediaId?: bigint;
|
|
67
|
+
volumeId?: bigint;
|
|
68
|
+
localId?: number;
|
|
69
|
+
}
|
|
70
|
+
export declare class FileUniqueID {
|
|
71
|
+
private readonly fileUniqueType;
|
|
72
|
+
private readonly params;
|
|
73
|
+
constructor(fileUniqueType: FileUniqueType, params: FileUniqueParams);
|
|
74
|
+
static decode(fileId: string): FileUniqueID;
|
|
75
|
+
encode(): string;
|
|
76
|
+
}
|
|
77
|
+
export {};
|