@mtkruto/node 0.1.600 → 0.1.701

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.
Files changed (115) hide show
  1. package/esm/4_errors.js +2 -4
  2. package/esm/5_client.d.ts +1 -1
  3. package/esm/5_client.js +1 -1
  4. package/esm/client/0_params.d.ts +5 -1
  5. package/esm/client/0_storage_operations.d.ts +182 -0
  6. package/esm/client/0_storage_operations.js +611 -0
  7. package/esm/client/1_composer.d.ts +2 -0
  8. package/esm/client/1_composer.js +28 -0
  9. package/{script/client/0_types.d.ts → esm/client/1_types.d.ts} +3 -3
  10. package/{script/client/1_account_manager.d.ts → esm/client/2_account_manager.d.ts} +1 -1
  11. package/{script/client/1_bot_info_manager.d.ts → esm/client/2_bot_info_manager.d.ts} +1 -1
  12. package/esm/client/{1_business_connection_manager.d.ts → 2_business_connection_manager.d.ts} +1 -1
  13. package/{script/client/1_file_manager.d.ts → esm/client/2_file_manager.d.ts} +1 -1
  14. package/esm/client/{1_file_manager.js → 2_file_manager.js} +5 -3
  15. package/esm/client/{1_network_statistics_manager.d.ts → 2_network_statistics_manager.d.ts} +1 -1
  16. package/{script/client/1_reaction_manager.d.ts → esm/client/2_reaction_manager.d.ts} +1 -1
  17. package/{script/client/1_update_manager.d.ts → esm/client/2_update_manager.d.ts} +1 -1
  18. package/{script/client/2_message_manager.d.ts → esm/client/3_message_manager.d.ts} +2 -2
  19. package/esm/client/{2_video_chat_manager.d.ts → 3_video_chat_manager.d.ts} +2 -2
  20. package/{script/client/3_callback_query_manager.d.ts → esm/client/4_callback_query_manager.d.ts} +2 -2
  21. package/{script/client/3_chat_list_manager.d.ts → esm/client/4_chat_list_manager.d.ts} +3 -3
  22. package/{script/client/3_inline_query_manager.d.ts → esm/client/4_inline_query_manager.d.ts} +2 -2
  23. package/esm/client/{3_story_manager.d.ts → 4_story_manager.d.ts} +3 -3
  24. package/{script/client/4_client.d.ts → esm/client/5_client.d.ts} +39 -29
  25. package/esm/client/{4_client.js → 5_client.js} +83 -73
  26. package/esm/connection/0_connection.d.ts +6 -15
  27. package/esm/connection/0_connection.js +1 -38
  28. package/esm/connection/1_connection_web_socket.d.ts +3 -2
  29. package/esm/connection/1_connection_web_socket.js +7 -3
  30. package/esm/mod.d.ts +1 -1
  31. package/esm/mod.js +1 -1
  32. package/esm/storage/0_storage.d.ts +9 -159
  33. package/esm/storage/0_storage.js +1 -563
  34. package/esm/storage/2_storage_indexed_db.d.ts +3 -2
  35. package/esm/storage/2_storage_indexed_db.js +9 -8
  36. package/esm/storage/2_storage_local_storage.d.ts +3 -2
  37. package/esm/storage/2_storage_local_storage.js +5 -4
  38. package/esm/storage/2_storage_memory.d.ts +4 -4
  39. package/esm/storage/2_storage_memory.js +12 -19
  40. package/esm/storage/2_storage_session_storage.d.ts +2 -1
  41. package/esm/storage/2_storage_session_storage.js +5 -4
  42. package/esm/types/0_id.d.ts +1 -1
  43. package/package.json +1 -1
  44. package/script/4_errors.js +2 -4
  45. package/script/5_client.d.ts +1 -1
  46. package/script/5_client.js +1 -1
  47. package/script/client/0_params.d.ts +5 -1
  48. package/script/client/0_storage_operations.d.ts +182 -0
  49. package/script/client/0_storage_operations.js +615 -0
  50. package/script/client/1_composer.d.ts +2 -0
  51. package/script/client/1_composer.js +28 -0
  52. package/{esm/client/0_types.d.ts → script/client/1_types.d.ts} +3 -3
  53. package/{esm/client/1_account_manager.d.ts → script/client/2_account_manager.d.ts} +1 -1
  54. package/{esm/client/1_bot_info_manager.d.ts → script/client/2_bot_info_manager.d.ts} +1 -1
  55. package/script/client/{1_business_connection_manager.d.ts → 2_business_connection_manager.d.ts} +1 -1
  56. package/{esm/client/1_file_manager.d.ts → script/client/2_file_manager.d.ts} +1 -1
  57. package/script/client/{1_file_manager.js → 2_file_manager.js} +4 -2
  58. package/script/client/{1_network_statistics_manager.d.ts → 2_network_statistics_manager.d.ts} +1 -1
  59. package/{esm/client/1_reaction_manager.d.ts → script/client/2_reaction_manager.d.ts} +1 -1
  60. package/{esm/client/1_update_manager.d.ts → script/client/2_update_manager.d.ts} +1 -1
  61. package/{esm/client/2_message_manager.d.ts → script/client/3_message_manager.d.ts} +2 -2
  62. package/script/client/{2_video_chat_manager.d.ts → 3_video_chat_manager.d.ts} +2 -2
  63. package/{esm/client/3_callback_query_manager.d.ts → script/client/4_callback_query_manager.d.ts} +2 -2
  64. package/{esm/client/3_chat_list_manager.d.ts → script/client/4_chat_list_manager.d.ts} +3 -3
  65. package/{esm/client/3_inline_query_manager.d.ts → script/client/4_inline_query_manager.d.ts} +2 -2
  66. package/script/client/{3_story_manager.d.ts → 4_story_manager.d.ts} +3 -3
  67. package/{esm/client/4_client.d.ts → script/client/5_client.d.ts} +39 -29
  68. package/script/client/{4_client.js → 5_client.js} +105 -95
  69. package/script/connection/0_connection.d.ts +6 -15
  70. package/script/connection/0_connection.js +0 -41
  71. package/script/connection/1_connection_web_socket.d.ts +3 -2
  72. package/script/connection/1_connection_web_socket.js +7 -3
  73. package/script/mod.d.ts +1 -1
  74. package/script/mod.js +1 -1
  75. package/script/storage/0_storage.d.ts +9 -159
  76. package/script/storage/0_storage.js +0 -565
  77. package/script/storage/2_storage_indexed_db.d.ts +3 -2
  78. package/script/storage/2_storage_indexed_db.js +9 -8
  79. package/script/storage/2_storage_local_storage.d.ts +3 -2
  80. package/script/storage/2_storage_local_storage.js +5 -4
  81. package/script/storage/2_storage_memory.d.ts +4 -4
  82. package/script/storage/2_storage_memory.js +12 -19
  83. package/script/storage/2_storage_session_storage.d.ts +2 -1
  84. package/script/storage/2_storage_session_storage.js +5 -4
  85. package/script/types/0_id.d.ts +1 -1
  86. /package/esm/{3_storage.d.ts → 2_storage.d.ts} +0 -0
  87. /package/esm/{3_storage.js → 2_storage.js} +0 -0
  88. /package/esm/client/{0_types.js → 1_types.js} +0 -0
  89. /package/esm/client/{1_account_manager.js → 2_account_manager.js} +0 -0
  90. /package/esm/client/{1_bot_info_manager.js → 2_bot_info_manager.js} +0 -0
  91. /package/esm/client/{1_business_connection_manager.js → 2_business_connection_manager.js} +0 -0
  92. /package/esm/client/{1_network_statistics_manager.js → 2_network_statistics_manager.js} +0 -0
  93. /package/esm/client/{1_reaction_manager.js → 2_reaction_manager.js} +0 -0
  94. /package/esm/client/{1_update_manager.js → 2_update_manager.js} +0 -0
  95. /package/esm/client/{2_message_manager.js → 3_message_manager.js} +0 -0
  96. /package/esm/client/{2_video_chat_manager.js → 3_video_chat_manager.js} +0 -0
  97. /package/esm/client/{3_callback_query_manager.js → 4_callback_query_manager.js} +0 -0
  98. /package/esm/client/{3_chat_list_manager.js → 4_chat_list_manager.js} +0 -0
  99. /package/esm/client/{3_inline_query_manager.js → 4_inline_query_manager.js} +0 -0
  100. /package/esm/client/{3_story_manager.js → 4_story_manager.js} +0 -0
  101. /package/script/{3_storage.d.ts → 2_storage.d.ts} +0 -0
  102. /package/script/{3_storage.js → 2_storage.js} +0 -0
  103. /package/script/client/{0_types.js → 1_types.js} +0 -0
  104. /package/script/client/{1_account_manager.js → 2_account_manager.js} +0 -0
  105. /package/script/client/{1_bot_info_manager.js → 2_bot_info_manager.js} +0 -0
  106. /package/script/client/{1_business_connection_manager.js → 2_business_connection_manager.js} +0 -0
  107. /package/script/client/{1_network_statistics_manager.js → 2_network_statistics_manager.js} +0 -0
  108. /package/script/client/{1_reaction_manager.js → 2_reaction_manager.js} +0 -0
  109. /package/script/client/{1_update_manager.js → 2_update_manager.js} +0 -0
  110. /package/script/client/{2_message_manager.js → 3_message_manager.js} +0 -0
  111. /package/script/client/{2_video_chat_manager.js → 3_video_chat_manager.js} +0 -0
  112. /package/script/client/{3_callback_query_manager.js → 4_callback_query_manager.js} +0 -0
  113. /package/script/client/{3_chat_list_manager.js → 4_chat_list_manager.js} +0 -0
  114. /package/script/client/{3_inline_query_manager.js → 4_inline_query_manager.js} +0 -0
  115. /package/script/client/{3_story_manager.js → 4_story_manager.js} +0 -0
@@ -19,12 +19,12 @@
19
19
  */
20
20
  import { MaybePromise } from "../1_utilities.js";
21
21
  import { GetManyFilter, Storage, StorageKeyPart } from "./0_storage.js";
22
- export declare class StorageMemory extends Storage implements Storage {
22
+ export declare class StorageMemory implements Storage {
23
23
  #private;
24
24
  protected map: Map<string, unknown>;
25
- constructor(authString?: string);
26
- get isMemoryStorage(): boolean;
27
- initialize(): Promise<void>;
25
+ constructor();
26
+ get mustSerialize(): boolean;
27
+ initialize(): void;
28
28
  branch(id: string): Storage;
29
29
  get supportsFiles(): boolean;
30
30
  get<T>(key: readonly StorageKeyPart[]): T | null;
@@ -17,23 +17,21 @@
17
17
  * You should have received a copy of the GNU Lesser General Public License
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
21
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
22
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
23
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
24
+ };
20
25
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
21
26
  if (kind === "m") throw new TypeError("Private method is not writable");
22
27
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
23
28
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
24
29
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
25
30
  };
26
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
27
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
28
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
29
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
- };
31
- var _StorageMemory_instances, _StorageMemory_id, _StorageMemory_authString, _StorageMemory_fixKey, _StorageMemory_getEntries;
32
- import { Storage } from "./0_storage.js";
31
+ var _StorageMemory_instances, _StorageMemory_id, _StorageMemory_fixKey, _StorageMemory_getEntries;
33
32
  import { fromString, isInRange, toString } from "./1_utilities.js";
34
- export class StorageMemory extends Storage {
35
- constructor(authString) {
36
- super();
33
+ export class StorageMemory {
34
+ constructor() {
37
35
  _StorageMemory_instances.add(this);
38
36
  Object.defineProperty(this, "map", {
39
37
  enumerable: true,
@@ -42,16 +40,11 @@ export class StorageMemory extends Storage {
42
40
  value: new Map()
43
41
  });
44
42
  _StorageMemory_id.set(this, null);
45
- _StorageMemory_authString.set(this, void 0);
46
- __classPrivateFieldSet(this, _StorageMemory_authString, authString, "f");
47
43
  }
48
- get isMemoryStorage() {
49
- return true;
44
+ get mustSerialize() {
45
+ return false;
50
46
  }
51
- async initialize() {
52
- if (__classPrivateFieldGet(this, _StorageMemory_authString, "f")) {
53
- await this.importAuthString(__classPrivateFieldGet(this, _StorageMemory_authString, "f"));
54
- }
47
+ initialize() {
55
48
  }
56
49
  branch(id) {
57
50
  const storage = new StorageMemory();
@@ -106,7 +99,7 @@ export class StorageMemory extends Storage {
106
99
  this.set(key, (this.get(key) || 0) + by);
107
100
  }
108
101
  }
109
- _StorageMemory_id = new WeakMap(), _StorageMemory_authString = new WeakMap(), _StorageMemory_instances = new WeakSet(), _StorageMemory_fixKey = function _StorageMemory_fixKey(key) {
102
+ _StorageMemory_id = new WeakMap(), _StorageMemory_instances = new WeakSet(), _StorageMemory_fixKey = function _StorageMemory_fixKey(key) {
110
103
  if (__classPrivateFieldGet(this, _StorageMemory_id, "f") !== null) {
111
104
  return ["__S" + __classPrivateFieldGet(this, _StorageMemory_id, "f"), ...key];
112
105
  }
@@ -19,9 +19,10 @@
19
19
  */
20
20
  import { MaybePromise } from "../1_utilities.js";
21
21
  import { GetManyFilter, Storage, StorageKeyPart } from "./0_storage.js";
22
- export declare class StorageSessionStorage extends Storage implements Storage {
22
+ export declare class StorageSessionStorage implements Storage {
23
23
  #private;
24
24
  constructor(prefix: string);
25
+ get mustSerialize(): boolean;
25
26
  get prefix(): string;
26
27
  branch(id: string): StorageSessionStorage;
27
28
  initialize(): void;
@@ -29,20 +29,21 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
29
29
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
30
30
  };
31
31
  var _StorageSessionStorage_prefix;
32
- import { Storage } from "./0_storage.js";
33
32
  import { fromString, isInRange, toString } from "./1_utilities.js";
34
- export class StorageSessionStorage extends Storage {
33
+ export class StorageSessionStorage {
35
34
  constructor(prefix) {
35
+ _StorageSessionStorage_prefix.set(this, void 0);
36
36
  if (typeof sessionStorage === "undefined") {
37
37
  throw new Error("Unavailable in current environment");
38
38
  }
39
39
  if (prefix.length <= 0) {
40
40
  throw new Error("Empty prefix");
41
41
  }
42
- super();
43
- _StorageSessionStorage_prefix.set(this, void 0);
44
42
  __classPrivateFieldSet(this, _StorageSessionStorage_prefix, prefix, "f");
45
43
  }
44
+ get mustSerialize() {
45
+ return true;
46
+ }
46
47
  get prefix() {
47
48
  return __classPrivateFieldGet(this, _StorageSessionStorage_prefix, "f");
48
49
  }
@@ -18,6 +18,6 @@
18
18
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
19
  */
20
20
  /**
21
- * The identifier of a channel, a group, or a user (as provided by MTKruto), a username, or a chat link (e.g., https://mtkruto.t.me, https://telegram.me/mtkruto). `"me"` resolves to the currently authorized account.
21
+ * The identifier of a channel, a group, or a user (as provided by MTKruto), a username, or a chat link (e.g., https://mtkruto.t.me, https://telegram.me/mtkruto). `"me"` resolves to current the account.
22
22
  */
23
23
  export type ID = number | string | "me";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtkruto/node",
3
- "version": "0.1.600",
3
+ "version": "0.1.701",
4
4
  "description": "MTKruto for Node.js",
5
5
  "author": "Roj <rojvv@icloud.com>",
6
6
  "repository": {
@@ -96,10 +96,8 @@ function upgradeInstance(error, call) {
96
96
  return new v({ ...error, call });
97
97
  }
98
98
  }
99
- for (const [k, v] of Object.entries(_3_errors_js_1.map)) {
100
- if (error.error_message == k) {
101
- return new v({ ...error, call });
102
- }
99
+ if (error.error_message in _3_errors_js_1.map) {
100
+ return new _3_errors_js_1.map[error.error_message]({ ...error, call });
103
101
  }
104
102
  return error;
105
103
  }
@@ -20,4 +20,4 @@
20
20
  export * from "./client/0_params.js";
21
21
  export * from "./client/1_client_encrypted.js";
22
22
  export * from "./client/1_client_plain.js";
23
- export * from "./client/4_client.js";
23
+ export * from "./client/5_client.js";
@@ -36,4 +36,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  __exportStar(require("./client/0_params.js"), exports);
37
37
  __exportStar(require("./client/1_client_encrypted.js"), exports);
38
38
  __exportStar(require("./client/1_client_plain.js"), exports);
39
- __exportStar(require("./client/4_client.js"), exports);
39
+ __exportStar(require("./client/5_client.js"), exports);
@@ -29,11 +29,15 @@ export interface AnswerCallbackQueryParams {
29
29
  /** TTL of answer caches in seconds. */
30
30
  cacheTime?: number;
31
31
  }
32
- export interface AuthorizeUserParams<S = string> {
32
+ export interface SignInParamsUser<S = string> {
33
33
  phone: S | (() => MaybePromise<S>);
34
34
  code: S | (() => MaybePromise<S>);
35
35
  password: S | ((hint: string | null) => MaybePromise<S>);
36
36
  }
37
+ export interface SignInParamsBot {
38
+ botToken: string;
39
+ }
40
+ export type SignInParams = SignInParamsUser | SignInParamsBot;
37
41
  export interface _BusinessConnectionIdCommon {
38
42
  businessConnectionId?: string;
39
43
  }
@@ -0,0 +1,182 @@
1
+ /**
2
+ * MTKruto - Cross-runtime JavaScript library for building Telegram clients
3
+ * Copyright (C) 2023-2024 Roj <https://roj.im/>
4
+ *
5
+ * This file is part of MTKruto.
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU Lesser General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ * GNU Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public License
18
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+ import { MaybePromise } from "../1_utilities.js";
21
+ import { AnyEntity, enums, ReadObject, TLObject, types } from "../2_tl.js";
22
+ import { DC } from "../3_transport.js";
23
+ import { Storage, StorageKeyPart } from "../2_storage.js";
24
+ export declare const K: {
25
+ connection: {
26
+ P: (string: string) => string;
27
+ apiId: () => StorageKeyPart[];
28
+ };
29
+ session: {
30
+ P: (string: string) => string;
31
+ serverSalt: () => StorageKeyPart[];
32
+ };
33
+ auth: {
34
+ P: (string: string) => string;
35
+ dc: () => StorageKeyPart[];
36
+ key: () => StorageKeyPart[];
37
+ accountId: () => StorageKeyPart[];
38
+ accountType: () => StorageKeyPart[];
39
+ };
40
+ updates: {
41
+ P: (string: string) => string;
42
+ state: () => StorageKeyPart[];
43
+ all: () => StorageKeyPart[];
44
+ updates: (boxId: bigint) => StorageKeyPart[];
45
+ update: (boxId: bigint, id: bigint) => StorageKeyPart[];
46
+ channelPts: (channelId: bigint) => StorageKeyPart[];
47
+ };
48
+ cache: {
49
+ P: (string: string) => string;
50
+ usernames: () => StorageKeyPart[];
51
+ username: (v: string) => StorageKeyPart[];
52
+ peers: () => StorageKeyPart[];
53
+ peer: (id: number) => StorageKeyPart[];
54
+ stickerSetNames: () => StorageKeyPart[];
55
+ stickerSetName: (id: bigint, accessHash: bigint) => StorageKeyPart[];
56
+ files: () => StorageKeyPart[];
57
+ file: (fileId: bigint) => StorageKeyPart[];
58
+ fileParts: () => StorageKeyPart[];
59
+ filePart: (fileId: bigint, n: number) => StorageKeyPart[];
60
+ customEmojiDocuments: () => StorageKeyPart[];
61
+ customEmojiDocument: (id: bigint) => StorageKeyPart[];
62
+ businessConnections: () => StorageKeyPart[];
63
+ businessConnection: (id: string) => StorageKeyPart[];
64
+ inlineQueryAnswers: () => StorageKeyPart[];
65
+ inlineQueryAnswer: (userId: number, chatId: number, query: string, offset: string) => StorageKeyPart[];
66
+ callbackQueryAnswers: () => StorageKeyPart[];
67
+ callbackQueryAnswer: (chatId: number, messageId: number, question: string) => StorageKeyPart[];
68
+ fullChats: () => StorageKeyPart[];
69
+ fullChat: (chatId: number) => StorageKeyPart[];
70
+ groupCalls: () => StorageKeyPart[];
71
+ groupCall: (id: bigint) => StorageKeyPart[];
72
+ groupCallAccessHashes: () => StorageKeyPart[];
73
+ groupCallAccessHash: (id: bigint) => StorageKeyPart[];
74
+ };
75
+ messages: {
76
+ P: (string: string) => string;
77
+ messages: (chatId: number) => StorageKeyPart[];
78
+ message: (chatId: number, messageId: number) => StorageKeyPart[];
79
+ allMessageRefs: () => StorageKeyPart[];
80
+ messageRef: (messageId: number) => StorageKeyPart[];
81
+ };
82
+ chatlists: {
83
+ P: (string: string) => string;
84
+ hasAllChats: (listId: number) => StorageKeyPart[];
85
+ chats: (listId: number) => StorageKeyPart[];
86
+ chat: (listId: number, chatId: number) => StorageKeyPart[];
87
+ pinnedChats: (listId: number) => StorageKeyPart[];
88
+ };
89
+ };
90
+ export declare class StorageOperations {
91
+ #private;
92
+ constructor(storage: Storage);
93
+ get provider(): Storage;
94
+ get supportsFiles(): boolean;
95
+ initialize(): Promise<void>;
96
+ set(...args: Parameters<Storage["set"]>): ReturnType<Storage["set"]>;
97
+ incr(...args: Parameters<Storage["incr"]>): ReturnType<Storage["incr"]>;
98
+ get<T>(...args: Parameters<Storage["get"]>): ReturnType<Storage["get"]>;
99
+ getMany<T>(...args: Parameters<Storage["getMany"]>): ReturnType<Storage["getMany"]>;
100
+ setDc(dc: DC | null): Promise<void>;
101
+ getDc(): MaybePromise<DC | null>;
102
+ getAuthKey(): Promise<Uint8Array | null>;
103
+ setAuthKey(authKey: Uint8Array | null): Promise<void>;
104
+ get authKeyId(): bigint | null;
105
+ exportAuthString(apiId_?: number | null): Promise<string>;
106
+ importAuthString(string: string): Promise<void>;
107
+ getChannelAccessHash(id: number): Promise<bigint | null>;
108
+ getUserAccessHash(id: number): Promise<bigint | null>;
109
+ updateUsernames(id: number, usernames: string[]): Promise<void>;
110
+ getUsername(username: string): Promise<[number, Date] | null>;
111
+ setTlObject(key: readonly StorageKeyPart[], value: TLObject | null): Promise<void>;
112
+ getTlObject(keyOrBuffer: TLObject | Uint8Array | readonly StorageKeyPart[]): Promise<ReadObject | null>;
113
+ setState(state: enums.updates.State): Promise<void>;
114
+ getState(): Promise<enums.updates.State | null>;
115
+ setMessage(chatId: number, messageId: number, message: enums.Message | null): Promise<void>;
116
+ deleteMessages(): Promise<void>;
117
+ getMessageChat(messageId: number): MaybePromise<number | null>;
118
+ getMessage(chatId: number, messageId: number): Promise<enums.Message | null>;
119
+ getLastMessage(chatId: number): Promise<enums.Message | null>;
120
+ setChannelPts(channelId: bigint, pts: number): Promise<void>;
121
+ getChannelPts(channelId: bigint): MaybePromise<number | null>;
122
+ setEntity(entity: AnyEntity): Promise<void>;
123
+ getEntity(key: number): Promise<ReadObject | null>;
124
+ setAccountId(accountId: number): Promise<void>;
125
+ getAccountId(): Promise<number | null>;
126
+ setAccountType(type: "user" | "bot"): Promise<void>;
127
+ getAccountType(): Promise<"user" | "bot" | null>;
128
+ updateStickerSetName(id: bigint, accessHash: bigint, name: string): Promise<void>;
129
+ getStickerSetName(id: bigint, accessHash: bigint): MaybePromise<[string, Date] | null>;
130
+ setServerSalt(serverSalt: bigint): Promise<void>;
131
+ getServerSalt(): MaybePromise<bigint | null>;
132
+ setChat(listId: number, chatId: number, pinned: number, topMessageId: number, topMessageDate: Date): Promise<void>;
133
+ getChats(listId: number): Promise<{
134
+ chatId: number;
135
+ pinned: number;
136
+ topMessageId: number;
137
+ topMessageDate: Date;
138
+ }[]>;
139
+ removeChats(listId: number): Promise<void>;
140
+ setHasAllChats(listId: number, hasAllChats: boolean): Promise<void>;
141
+ hasAllChats(listId: number): Promise<boolean>;
142
+ setPinnedChats(listId: number, chatIds: number[] | null): Promise<void>;
143
+ getPinnedChats(listId: number): Promise<number[] | null>;
144
+ getHistory(chatId: number, offsetId: number, limit: number): Promise<enums.Message[]>;
145
+ getFile(id: bigint): Promise<[number, number] | null>;
146
+ iterFileParts(id: bigint, partCount: number, offset: number): AsyncGenerator<Uint8Array>;
147
+ saveFilePart(id: bigint, index: number, bytes: Uint8Array): Promise<void>;
148
+ setFilePartCount(id: bigint, partCount: number, chunkSize: number): Promise<void>;
149
+ setCustomEmojiDocument(id: bigint, document: types.Document): Promise<void>;
150
+ getCustomEmojiDocument(id: bigint): Promise<[types.Document, Date] | null>;
151
+ setBusinessConnection(id: string, connection: types.BotBusinessConnection | null): Promise<void>;
152
+ getBusinessConnection(id: string): Promise<types.BotBusinessConnection | null>;
153
+ setInlineQueryAnswer(userId: number, chatId: number, query: string, offset: string, results: types.messages.BotResults, date: Date): Promise<void>;
154
+ getInlineQueryAnswer(userId: number, chatId: number, query: string, offset: string): Promise<[types.messages.BotResults, Date] | null>;
155
+ setCallbackQueryAnswer(chatId: number, messageId: number, question: string, answer: types.messages.BotCallbackAnswer): Promise<void>;
156
+ getCallbackQueryAnswer(chatId: number, messageId: number, question: string): Promise<[types.messages.BotCallbackAnswer, Date] | null>;
157
+ setFullChat(chatId: number, fullChat: types.UserFull | types.ChannelFull | types.ChatFull | null): Promise<void>;
158
+ getFullChat(chatId: number): Promise<types.UserFull | types.ChannelFull | types.ChatFull | null>;
159
+ setGroupCall(id: bigint, groupCall: types.GroupCall | null): Promise<void>;
160
+ getGroupCall(id: bigint): Promise<types.GroupCall | null>;
161
+ setGroupCallAccessHash(id: bigint, accessHash: bigint | null): Promise<void>;
162
+ getGroupCallAccessHash(id: bigint): Promise<bigint | null>;
163
+ setUpdate(boxId: bigint, update: enums.Update): Promise<void>;
164
+ deleteUpdates(): Promise<void>;
165
+ getFirstUpdate(boxId: bigint): Promise<[readonly StorageKeyPart[], enums.Update] | null>;
166
+ assertUser(source: string): Promise<void>;
167
+ assertBot(source: string): Promise<void>;
168
+ deleteFiles(): Promise<void>;
169
+ deleteCustomEmojiDocuments(): Promise<void>;
170
+ deleteBusinessConnections(): Promise<void>;
171
+ deleteInlineQueryAnswers(): Promise<void>;
172
+ deleteCallbackQueryAnswers(): Promise<void>;
173
+ deleteFullChats(): Promise<void>;
174
+ deleteGroupCalls(): Promise<void>;
175
+ deleteStickerSetNames(): Promise<void>;
176
+ deletePeers(): Promise<void>;
177
+ deleteUsernames(): Promise<void>;
178
+ clear(): Promise<void>;
179
+ setApiId(apiId: number): Promise<void>;
180
+ getApiId(): Promise<number | null>;
181
+ reset(): Promise<void>;
182
+ }