@mtkruto/node 0.1.190 → 0.1.200

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/esm/0_errors.d.ts +12 -0
  2. package/esm/0_errors.js +19 -0
  3. package/esm/1_utilities.d.ts +1 -1
  4. package/esm/1_utilities.js +1 -1
  5. package/esm/2_tl.d.ts +6 -6
  6. package/esm/2_tl.js +6 -6
  7. package/esm/3_storage.d.ts +5 -5
  8. package/esm/3_storage.js +5 -5
  9. package/esm/3_types.d.ts +6 -5
  10. package/esm/3_types.js +6 -5
  11. package/esm/4_constants.d.ts +2 -2
  12. package/esm/4_constants.js +2 -2
  13. package/esm/5_client.d.ts +1 -1
  14. package/esm/5_client.js +1 -1
  15. package/esm/client/0_client_abstract.js +3 -2
  16. package/esm/client/0_html.js +4 -3
  17. package/esm/client/0_markdown.js +6 -5
  18. package/esm/client/0_params.d.ts +7 -1
  19. package/esm/client/0_types.d.ts +1 -2
  20. package/esm/client/0_types.js +1 -2
  21. package/esm/client/0_utilities.d.ts +0 -3
  22. package/esm/client/0_utilities.js +2 -21
  23. package/esm/client/1_business_connection_manager.d.ts +11 -0
  24. package/esm/client/1_business_connection_manager.js +47 -0
  25. package/esm/client/1_client_encrypted.js +1 -1
  26. package/esm/client/1_client_plain.js +3 -4
  27. package/esm/client/1_composer.js +3 -2
  28. package/esm/client/1_file_manager.js +4 -4
  29. package/esm/client/1_update_manager.d.ts +8 -1
  30. package/esm/client/1_update_manager.js +88 -8
  31. package/esm/client/2_message_manager.d.ts +7 -6
  32. package/esm/client/2_message_manager.js +89 -74
  33. package/esm/client/3_chat_list_manager.js +3 -2
  34. package/esm/client/3_story_manager.js +2 -1
  35. package/esm/client/4_client.d.ts +422 -421
  36. package/esm/client/4_client.js +578 -520
  37. package/esm/mod.d.ts +1 -0
  38. package/esm/mod.js +1 -0
  39. package/esm/storage/0_storage.d.ts +5 -0
  40. package/esm/storage/0_storage.js +20 -0
  41. package/esm/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +1 -1
  42. package/esm/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +1 -1
  43. package/{script/storage/1_storage_memory.d.ts → esm/storage/2_storage_memory.d.ts} +1 -4
  44. package/esm/storage/{1_storage_memory.js → 2_storage_memory.js} +8 -28
  45. package/esm/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +1 -1
  46. package/esm/tl/2_types.d.ts +1071 -183
  47. package/esm/tl/2_types.js +2916 -464
  48. package/esm/tl/3_functions.d.ts +381 -17
  49. package/esm/tl/3_functions.js +1002 -120
  50. package/{script/tl/4_tl_writer.d.ts → esm/tl/5_tl_writer.d.ts} +1 -1
  51. package/{script/tl/4_rpc_result.d.ts → esm/tl/6_rpc_result.d.ts} +1 -1
  52. package/esm/tl/{4_rpc_result.js → 6_rpc_result.js} +1 -1
  53. package/esm/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  54. package/esm/tl/{6_message.js → 7_message.js} +3 -3
  55. package/esm/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  56. package/esm/tl/{7_message_container.js → 8_message_container.js} +3 -3
  57. package/esm/types/0_chat_photo.d.ts +1 -0
  58. package/esm/types/0_chat_photo.js +8 -5
  59. package/esm/types/0_message_entity.d.ts +1 -1
  60. package/esm/types/0_thumbnail.js +1 -1
  61. package/esm/types/1_bot_command_scope.d.ts +1 -1
  62. package/esm/types/1_photo.js +2 -2
  63. package/esm/types/1_story_privacy.d.ts +1 -1
  64. package/esm/types/2_business_connection.d.ts +11 -0
  65. package/esm/types/2_business_connection.js +12 -0
  66. package/esm/types/2_chat_member.d.ts +1 -1
  67. package/esm/types/2_chosen_inline_result.d.ts +1 -1
  68. package/esm/types/2_game.js +1 -1
  69. package/esm/types/2_inline_keyboard_button.d.ts +1 -1
  70. package/esm/types/2_inline_query.d.ts +1 -1
  71. package/esm/types/2_invite_link.d.ts +1 -1
  72. package/esm/types/2_message_reaction_count.d.ts +1 -1
  73. package/esm/types/2_message_reactions.d.ts +1 -1
  74. package/esm/types/2_story_content.js +1 -1
  75. package/{script/types/1_story_interactive_area.d.ts → esm/types/2_story_interactive_area.d.ts} +2 -2
  76. package/esm/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +1 -1
  77. package/esm/types/3_chat_member_updated.d.ts +1 -1
  78. package/esm/types/3_reply_markup.d.ts +1 -1
  79. package/esm/types/3_story.d.ts +2 -2
  80. package/esm/types/3_story.js +1 -1
  81. package/esm/types/4_inline_query_result.d.ts +1 -1
  82. package/esm/types/4_inline_query_result.js +1 -1
  83. package/esm/types/4_message.d.ts +9 -3
  84. package/esm/types/4_message.js +22 -5
  85. package/esm/types/5_callback_query.d.ts +1 -1
  86. package/esm/types/5_callback_query.js +2 -1
  87. package/esm/types/5_chat.d.ts +1 -1
  88. package/esm/types/6_update.d.ts +12 -2
  89. package/esm/types/{0__file_id.js → _file_id.js} +2 -1
  90. package/package.json +1 -1
  91. package/script/0_errors.d.ts +12 -0
  92. package/script/0_errors.js +27 -0
  93. package/script/1_utilities.d.ts +1 -1
  94. package/script/1_utilities.js +1 -1
  95. package/script/2_tl.d.ts +6 -6
  96. package/script/2_tl.js +6 -6
  97. package/script/3_storage.d.ts +5 -5
  98. package/script/3_storage.js +5 -5
  99. package/script/3_types.d.ts +6 -5
  100. package/script/3_types.js +6 -5
  101. package/script/4_constants.d.ts +2 -2
  102. package/script/4_constants.js +2 -2
  103. package/script/5_client.d.ts +1 -1
  104. package/script/5_client.js +1 -1
  105. package/script/client/0_client_abstract.js +3 -2
  106. package/script/client/0_html.js +4 -3
  107. package/script/client/0_markdown.js +6 -5
  108. package/script/client/0_params.d.ts +7 -1
  109. package/script/client/0_types.d.ts +1 -2
  110. package/script/client/0_types.js +0 -4
  111. package/script/client/0_utilities.d.ts +0 -3
  112. package/script/client/0_utilities.js +3 -24
  113. package/script/client/1_business_connection_manager.d.ts +11 -0
  114. package/script/client/1_business_connection_manager.js +51 -0
  115. package/script/client/1_client_encrypted.js +2 -2
  116. package/script/client/1_client_plain.js +3 -4
  117. package/script/client/1_composer.js +3 -2
  118. package/script/client/1_file_manager.js +5 -5
  119. package/script/client/1_update_manager.d.ts +8 -1
  120. package/script/client/1_update_manager.js +88 -8
  121. package/script/client/2_message_manager.d.ts +7 -6
  122. package/script/client/2_message_manager.js +88 -73
  123. package/script/client/3_chat_list_manager.js +3 -2
  124. package/script/client/3_story_manager.js +2 -1
  125. package/script/client/4_client.d.ts +422 -421
  126. package/script/client/4_client.js +578 -520
  127. package/script/mod.d.ts +1 -0
  128. package/script/mod.js +1 -0
  129. package/script/storage/0_storage.d.ts +5 -0
  130. package/script/storage/0_storage.js +20 -0
  131. package/script/storage/{1_storage_indexed_db.js → 2_storage_indexed_db.js} +7 -7
  132. package/script/storage/{1_storage_local_storage.js → 2_storage_local_storage.js} +10 -10
  133. package/{esm/storage/1_storage_memory.d.ts → script/storage/2_storage_memory.d.ts} +1 -4
  134. package/script/storage/{1_storage_memory.js → 2_storage_memory.js} +12 -32
  135. package/script/storage/{1_storage_session_storage.js → 2_storage_session_storage.js} +10 -10
  136. package/script/tl/2_types.d.ts +1071 -183
  137. package/script/tl/2_types.js +3028 -504
  138. package/script/tl/3_functions.d.ts +381 -17
  139. package/script/tl/3_functions.js +1047 -143
  140. package/{esm/tl/4_tl_writer.d.ts → script/tl/5_tl_writer.d.ts} +1 -1
  141. package/{esm/tl/4_rpc_result.d.ts → script/tl/6_rpc_result.d.ts} +1 -1
  142. package/script/tl/{4_rpc_result.js → 6_rpc_result.js} +2 -2
  143. package/script/tl/{6_message.d.ts → 7_message.d.ts} +2 -2
  144. package/script/tl/{6_message.js → 7_message.js} +8 -8
  145. package/script/tl/{7_message_container.d.ts → 8_message_container.d.ts} +1 -1
  146. package/script/tl/{7_message_container.js → 8_message_container.js} +7 -7
  147. package/script/types/0_chat_photo.d.ts +1 -0
  148. package/script/types/0_chat_photo.js +16 -13
  149. package/script/types/0_message_entity.d.ts +1 -1
  150. package/script/types/0_thumbnail.js +6 -6
  151. package/script/types/1_bot_command_scope.d.ts +1 -1
  152. package/script/types/1_photo.js +7 -7
  153. package/script/types/1_story_privacy.d.ts +1 -1
  154. package/script/types/2_business_connection.d.ts +11 -0
  155. package/script/types/2_business_connection.js +16 -0
  156. package/script/types/2_chat_member.d.ts +1 -1
  157. package/script/types/2_chosen_inline_result.d.ts +1 -1
  158. package/script/types/2_game.js +3 -3
  159. package/script/types/2_inline_keyboard_button.d.ts +1 -1
  160. package/script/types/2_inline_query.d.ts +1 -1
  161. package/script/types/2_invite_link.d.ts +1 -1
  162. package/script/types/2_message_reaction_count.d.ts +1 -1
  163. package/script/types/2_message_reactions.d.ts +1 -1
  164. package/script/types/2_story_content.js +4 -4
  165. package/{esm/types/1_story_interactive_area.d.ts → script/types/2_story_interactive_area.d.ts} +2 -2
  166. package/script/types/{1_story_interactive_area.js → 2_story_interactive_area.js} +2 -2
  167. package/script/types/3_chat_member_updated.d.ts +1 -1
  168. package/script/types/3_reply_markup.d.ts +1 -1
  169. package/script/types/3_story.d.ts +2 -2
  170. package/script/types/3_story.js +2 -2
  171. package/script/types/4_inline_query_result.d.ts +1 -1
  172. package/script/types/4_inline_query_result.js +2 -2
  173. package/script/types/4_message.d.ts +9 -3
  174. package/script/types/4_message.js +37 -20
  175. package/script/types/5_callback_query.d.ts +1 -1
  176. package/script/types/5_callback_query.js +2 -1
  177. package/script/types/5_chat.d.ts +1 -1
  178. package/script/types/6_update.d.ts +12 -2
  179. package/script/types/{0__file_id.js → _file_id.js} +2 -1
  180. /package/esm/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  181. /package/esm/storage/{0_utilities.js → 1_utilities.js} +0 -0
  182. /package/esm/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  183. /package/esm/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  184. /package/esm/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  185. /package/esm/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  186. /package/esm/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  187. /package/esm/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  188. /package/esm/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  189. /package/esm/types/{0_venue.js → 1_venue.js} +0 -0
  190. /package/esm/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  191. /package/esm/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  192. /package/esm/types/{1__getters.js → _getters.js} +0 -0
  193. /package/script/storage/{0_utilities.d.ts → 1_utilities.d.ts} +0 -0
  194. /package/script/storage/{0_utilities.js → 1_utilities.js} +0 -0
  195. /package/script/storage/{1_storage_indexed_db.d.ts → 2_storage_indexed_db.d.ts} +0 -0
  196. /package/script/storage/{1_storage_local_storage.d.ts → 2_storage_local_storage.d.ts} +0 -0
  197. /package/script/storage/{1_storage_session_storage.d.ts → 2_storage_session_storage.d.ts} +0 -0
  198. /package/script/tl/{3_tl_reader.d.ts → 4_tl_reader.d.ts} +0 -0
  199. /package/script/tl/{3_tl_reader.js → 4_tl_reader.js} +0 -0
  200. /package/script/tl/{4_tl_writer.js → 5_tl_writer.js} +0 -0
  201. /package/script/types/{0_venue.d.ts → 1_venue.d.ts} +0 -0
  202. /package/script/types/{0_venue.js → 1_venue.js} +0 -0
  203. /package/script/types/{0__file_id.d.ts → _file_id.d.ts} +0 -0
  204. /package/script/types/{1__getters.d.ts → _getters.d.ts} +0 -0
  205. /package/script/types/{1__getters.js → _getters.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { TLRawWriter } from "./0_tl_raw_writer.js";
2
- import { ReadObject } from "./3_tl_reader.js";
2
+ import { ReadObject } from "./4_tl_reader.js";
3
3
  export declare class TLWriter extends TLRawWriter {
4
4
  writeObject(object: ReadObject): typeof this;
5
5
  }
@@ -1,5 +1,5 @@
1
1
  import { id, name } from "./1_tl_object.js";
2
- import { ReadObject } from "./3_tl_reader.js";
2
+ import { ReadObject } from "./4_tl_reader.js";
3
3
  export declare class RPCResult {
4
4
  readonly messageId: bigint;
5
5
  readonly result: ReadObject;
@@ -1,5 +1,5 @@
1
1
  import { id, name } from "./1_tl_object.js";
2
- import { TLReader } from "./3_tl_reader.js";
2
+ import { TLReader } from "./4_tl_reader.js";
3
3
  export class RPCResult {
4
4
  static get [id]() {
5
5
  return 0xF35C6D01;
@@ -1,6 +1,6 @@
1
1
  import { serialize } from "./1_tl_object.js";
2
- import { ReadObject, TLReader } from "./3_tl_reader.js";
3
- import { RPCResult } from "./4_rpc_result.js";
2
+ import { ReadObject, TLReader } from "./4_tl_reader.js";
3
+ import { RPCResult } from "./6_rpc_result.js";
4
4
  export declare function calculateLength(object: Message_ | ReadObject): number;
5
5
  export declare class Message_ {
6
6
  readonly id: bigint;
@@ -1,7 +1,7 @@
1
1
  import { id, serialize } from "./1_tl_object.js";
2
- import { TLReader } from "./3_tl_reader.js";
3
- import { RPCResult } from "./4_rpc_result.js";
4
- import { TLWriter } from "./4_tl_writer.js";
2
+ import { TLReader } from "./4_tl_reader.js";
3
+ import { TLWriter } from "./5_tl_writer.js";
4
+ import { RPCResult } from "./6_rpc_result.js";
5
5
  export function calculateLength(object) {
6
6
  let length = 0;
7
7
  if (Array.isArray(object)) {
@@ -1,5 +1,5 @@
1
1
  import { id, name, serialize } from "./1_tl_object.js";
2
- import { Message_ } from "./6_message.js";
2
+ import { Message_ } from "./7_message.js";
3
3
  export declare class MessageContainer {
4
4
  readonly id: bigint;
5
5
  readonly seqNo: number;
@@ -1,7 +1,7 @@
1
1
  import { id, name, serialize } from "./1_tl_object.js";
2
- import { TLReader } from "./3_tl_reader.js";
3
- import { TLWriter } from "./4_tl_writer.js";
4
- import { calculateLength, Message_ } from "./6_message.js";
2
+ import { TLReader } from "./4_tl_reader.js";
3
+ import { TLWriter } from "./5_tl_writer.js";
4
+ import { calculateLength, Message_ } from "./7_message.js";
5
5
  export class MessageContainer {
6
6
  static get [id]() {
7
7
  return 0x73F1F8DC;
@@ -11,6 +11,7 @@ export interface _ChatPhotoBase {
11
11
  bigFileUniqueId: string;
12
12
  /** Whether the chat photo is animated. */
13
13
  hasVideo: boolean;
14
+ strippedThumbnail?: Uint8Array;
14
15
  }
15
16
  /** @unlisted */
16
17
  export interface ChatPhotoUser extends _ChatPhotoBase {
@@ -1,5 +1,6 @@
1
+ import { cleanObject } from "../1_utilities.js";
1
2
  import { types } from "../2_tl.js";
2
- import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./0__file_id.js";
3
+ import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./_file_id.js";
3
4
  export function constructChatPhoto(photo, chatId, chatAccessHash) {
4
5
  const smallFileId_ = {
5
6
  type: FileType.ProfilePhoto,
@@ -16,22 +17,24 @@ export function constructChatPhoto(photo, chatId, chatAccessHash) {
16
17
  const bigFileId = serializeFileId(bigFileId_);
17
18
  const bigFileUniqueId = toUniqueFileId(bigFileId_);
18
19
  if (photo instanceof types.ChatPhoto) {
19
- return {
20
+ return cleanObject({
20
21
  smallFileId,
21
22
  smallFileUniqueId,
22
23
  bigFileId,
23
24
  bigFileUniqueId,
24
25
  hasVideo: photo.has_video || false,
25
- };
26
+ strippedThumbnail: photo.stripped_thumb,
27
+ });
26
28
  }
27
29
  else {
28
- return {
30
+ return cleanObject({
29
31
  personal: photo.personal ? true : undefined,
30
32
  smallFileId,
31
33
  smallFileUniqueId,
32
34
  bigFileId,
33
35
  bigFileUniqueId,
34
36
  hasVideo: photo.has_video || false,
35
- };
37
+ strippedThumbnail: photo.stripped_thumb,
38
+ });
36
39
  }
37
40
  }
@@ -1,5 +1,5 @@
1
1
  import { enums } from "../2_tl.js";
2
- import { EntityGetter } from "./1__getters.js";
2
+ import { EntityGetter } from "./_getters.js";
3
3
  /** @unlisted */
4
4
  export type MessageEntityType = "mention" | "hashtag" | "botCommand" | "url" | "email" | "bold" | "italic" | "code" | "pre" | "textLink" | "textMention" | "cashtag" | "phoneNumber" | "underline" | "strikethrough" | "blockquote" | "bankCard" | "spoiler" | "customEmoji";
5
5
  /** @unlisted */
@@ -1,5 +1,5 @@
1
1
  import { types } from "../2_tl.js";
2
- import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./0__file_id.js";
2
+ import { FileType, PhotoSourceType, serializeFileId, toUniqueFileId } from "./_file_id.js";
3
3
  export function constructThumbnail(size, file) {
4
4
  const type = file instanceof types.Photo ? FileType.Photo : FileType.Thumbnail;
5
5
  const fileType = file instanceof types.Photo ? FileType.Photo : FileType.Document;
@@ -1,6 +1,6 @@
1
1
  import { enums } from "../2_tl.js";
2
+ import { InputPeerGetter } from "./_getters.js";
2
3
  import { ID } from "./0_id.js";
3
- import { InputPeerGetter } from "./1__getters.js";
4
4
  /** @unlisted */
5
5
  export interface BotCommandScopeDefault {
6
6
  type: "default";
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
- import { PhotoSourceType } from "./0__file_id.js";
3
- import { FileType, serializeFileId, toUniqueFileId } from "./0__file_id.js";
2
+ import { PhotoSourceType } from "./_file_id.js";
3
+ import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
4
4
  import { constructThumbnail } from "./0_thumbnail.js";
5
5
  export function constructPhoto(photo) {
6
6
  const sizes = photo.sizes
@@ -1,5 +1,5 @@
1
1
  import { enums } from "../2_tl.js";
2
- import { EntityGetter } from "./1__getters.js";
2
+ import { EntityGetter } from "./_getters.js";
3
3
  /** @unlisted */
4
4
  export interface StoryPrivacyEveryone {
5
5
  everyoneExcept: number[];
@@ -0,0 +1,11 @@
1
+ import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
3
+ import { User } from "./1_user.js";
4
+ export interface BusinessConnection {
5
+ id: string;
6
+ user: User;
7
+ date: Date;
8
+ canReply: boolean;
9
+ isEnabled: boolean;
10
+ }
11
+ export declare function constructBusinessConnection(connection: types.BotBusinessConnection, getEntity: EntityGetter): Promise<BusinessConnection>;
@@ -0,0 +1,12 @@
1
+ import { fromUnixTimestamp } from "../1_utilities.js";
2
+ import { types } from "../2_tl.js";
3
+ import { constructUser } from "./1_user.js";
4
+ export async function constructBusinessConnection(connection, getEntity) {
5
+ return {
6
+ id: connection.connection_id,
7
+ user: constructUser((await getEntity(new types.PeerUser(connection)))),
8
+ date: fromUnixTimestamp(connection.date),
9
+ canReply: !!connection.can_reply,
10
+ isEnabled: !connection.disabled,
11
+ };
12
+ }
@@ -1,7 +1,7 @@
1
1
  import { enums } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
2
3
  import { ChatAdministratorRights } from "./0_chat_administrator_rights.js";
3
4
  import { ChatMemberRights } from "./0_chat_member_rights.js";
4
- import { EntityGetter } from "./1__getters.js";
5
5
  import { User } from "./1_user.js";
6
6
  /** @unlisted */
7
7
  export type ChatMemberStatus = "creator" | "administrator" | "member" | "restricted" | "left" | "banned";
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
2
3
  import { Location } from "./0_location.js";
3
- import { EntityGetter } from "./1__getters.js";
4
4
  import { User } from "./1_user.js";
5
5
  /** A chosen inline result. */
6
6
  export interface ChosenInlineResult {
@@ -1,6 +1,6 @@
1
1
  import { cleanObject } from "../1_utilities.js";
2
2
  import { as, types } from "../2_tl.js";
3
- import { FileType, serializeFileId, toUniqueFileId } from "./0__file_id.js";
3
+ import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
4
4
  import { constructAnimation } from "./1_animation.js";
5
5
  import { constructPhoto } from "./1_photo.js";
6
6
  export function constructGame(media_) {
@@ -1,7 +1,7 @@
1
1
  import { enums } from "../2_tl.js";
2
+ import { UsernameResolver } from "./_getters.js";
2
3
  import { LoginUrl } from "./0_login_url.js";
3
4
  import { MiniAppInfo } from "./0_mini_app_info.js";
4
- import { UsernameResolver } from "./1__getters.js";
5
5
  /** @unlisted */
6
6
  export interface _InlineKeyboardButtonBase {
7
7
  text: string;
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
2
3
  import { Location } from "./0_location.js";
3
- import { EntityGetter } from "./1__getters.js";
4
4
  import { User } from "./1_user.js";
5
5
  /** An incoming inline query. */
6
6
  export interface InlineQuery {
@@ -1,5 +1,5 @@
1
1
  import { types } from "../2_tl.js";
2
- import { EntityGetter } from "./1__getters.js";
2
+ import { EntityGetter } from "./_getters.js";
3
3
  import { User } from "./1_user.js";
4
4
  /** A chat invite link. */
5
5
  export interface InviteLink {
@@ -1,5 +1,5 @@
1
1
  import { types } from "../2_tl.js";
2
- import { EntityGetter } from "./1__getters.js";
2
+ import { EntityGetter } from "./_getters.js";
3
3
  import { ChatP } from "./1_chat_p.js";
4
4
  import { ReactionCount } from "./1_reaction_count.js";
5
5
  /** Information on the reactions made to a channel post. */
@@ -1,6 +1,6 @@
1
1
  import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
2
3
  import { Reaction } from "./0_reaction.js";
3
- import { EntityGetter } from "./1__getters.js";
4
4
  import { ChatP } from "./1_chat_p.js";
5
5
  import { User } from "./1_user.js";
6
6
  /** The reactions of a user to a messages in a group. */
@@ -1,6 +1,6 @@
1
1
  import { UNREACHABLE } from "../1_utilities.js";
2
2
  import { as, types } from "../2_tl.js";
3
- import { FileType, serializeFileId, toUniqueFileId } from "./0__file_id.js";
3
+ import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
4
4
  import { constructPhoto } from "./1_photo.js";
5
5
  import { constructVideo } from "./1_video.js";
6
6
  export function constructStoryContent(media) {
@@ -1,9 +1,9 @@
1
1
  import { enums } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
2
3
  import { Location } from "./0_location.js";
3
4
  import { MessageReference } from "./0_message_reference.js";
4
5
  import { Reaction } from "./0_reaction.js";
5
- import { Venue } from "./0_venue.js";
6
- import { EntityGetter } from "./1__getters.js";
6
+ import { Venue } from "./1_venue.js";
7
7
  /** @unlisted */
8
8
  export interface StoryInteractiveAreaPosition {
9
9
  xPercentage: number;
@@ -2,7 +2,7 @@ import { UNREACHABLE } from "../1_utilities.js";
2
2
  import { chatIdToPeer, peerToChatId, types } from "../2_tl.js";
3
3
  import { constructLocation } from "./0_location.js";
4
4
  import { constructReaction, reactionToTlObject } from "./0_reaction.js";
5
- import { constructVenue } from "./0_venue.js";
5
+ import { constructVenue } from "./1_venue.js";
6
6
  function constructStoryInteractiveAreaPosition(position) {
7
7
  return {
8
8
  xPercentage: position.x,
@@ -1,5 +1,5 @@
1
1
  import { types } from "../2_tl.js";
2
- import { EntityGetter } from "./1__getters.js";
2
+ import { EntityGetter } from "./_getters.js";
3
3
  import { ChatP } from "./1_chat_p.js";
4
4
  import { User } from "./1_user.js";
5
5
  import { ChatMember } from "./2_chat_member.js";
@@ -1,5 +1,5 @@
1
1
  import { enums } from "../2_tl.js";
2
- import { UsernameResolver } from "./1__getters.js";
2
+ import { UsernameResolver } from "./_getters.js";
3
3
  import { KeyboardButton } from "./1_keyboard_button.js";
4
4
  import { InlineKeyboardButton } from "./2_inline_keyboard_button.js";
5
5
  /** @unlisted */
@@ -1,11 +1,11 @@
1
1
  import { types } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
2
3
  import { MessageEntity } from "./0_message_entity.js";
3
- import { EntityGetter } from "./1__getters.js";
4
4
  import { ChatP } from "./1_chat_p.js";
5
- import { StoryInteractiveArea } from "./1_story_interactive_area.js";
6
5
  import { StoryPrivacy } from "./1_story_privacy.js";
7
6
  import { StoryContent } from "./2_story_content.js";
8
7
  import { StoryInteractions } from "./2_story_interactions.js";
8
+ import { StoryInteractiveArea } from "./2_story_interactive_area.js";
9
9
  /** A story. */
10
10
  export interface Story {
11
11
  out: boolean;
@@ -1,10 +1,10 @@
1
1
  import { cleanObject, fromUnixTimestamp, UNREACHABLE } from "../1_utilities.js";
2
2
  import { constructMessageEntity } from "./0_message_entity.js";
3
3
  import { constructChatP } from "./1_chat_p.js";
4
- import { constructStoryInteractiveArea } from "./1_story_interactive_area.js";
5
4
  import { constructStoryPrivacy } from "./1_story_privacy.js";
6
5
  import { constructStoryContent } from "./2_story_content.js";
7
6
  import { constructStoryInteractions } from "./2_story_interactions.js";
7
+ import { constructStoryInteractiveArea } from "./2_story_interactive_area.js";
8
8
  export async function constructStory(story, peer, getEntity) {
9
9
  const id = story.id;
10
10
  const entity = await getEntity(peer);
@@ -1,7 +1,7 @@
1
1
  import { enums } from "../2_tl.js";
2
+ import { UsernameResolver } from "./_getters.js";
2
3
  import { MessageEntity } from "./0_message_entity.js";
3
4
  import { ParseMode } from "./0_parse_mode.js";
4
- import { UsernameResolver } from "./1__getters.js";
5
5
  import { InputMessageContent } from "./1_input_message_content.js";
6
6
  import { ReplyMarkupInlineKeyboard } from "./3_reply_markup.js";
7
7
  /** @unlisted */
@@ -1,6 +1,6 @@
1
1
  import { UNREACHABLE } from "../1_utilities.js";
2
2
  import { types } from "../2_tl.js";
3
- import { deserializeFileId } from "./0__file_id.js";
3
+ import { deserializeFileId } from "./_file_id.js";
4
4
  import { replyMarkupToTlObject } from "./3_reply_markup.js";
5
5
  // deno-lint-ignore no-explicit-any
6
6
  export async function inlineQueryResultToTlObject(result_, parseText, usernameResolver) {
@@ -1,13 +1,12 @@
1
1
  import { MaybePromise } from "../1_utilities.js";
2
2
  import { enums } from "../2_tl.js";
3
+ import { EntityGetter } from "./_getters.js";
3
4
  import { Contact } from "./0_contact.js";
4
5
  import { Dice } from "./0_dice.js";
5
6
  import { LinkPreview } from "./0_link_preview.js";
6
7
  import { Location } from "./0_location.js";
7
8
  import { MessageEntity } from "./0_message_entity.js";
8
- import { Venue } from "./0_venue.js";
9
9
  import { Voice } from "./0_voice.js";
10
- import { EntityGetter } from "./1__getters.js";
11
10
  import { Animation } from "./1_animation.js";
12
11
  import { Audio } from "./1_audio.js";
13
12
  import { ChatP } from "./1_chat_p.js";
@@ -19,6 +18,7 @@ import { Poll } from "./1_poll.js";
19
18
  import { ReplyQuote } from "./1_reply_quote.js";
20
19
  import { Sticker, StickerSetNameGetter } from "./1_sticker.js";
21
20
  import { User } from "./1_user.js";
21
+ import { Venue } from "./1_venue.js";
22
22
  import { VideoNote } from "./1_video_note.js";
23
23
  import { Video } from "./1_video.js";
24
24
  import { Game } from "./2_game.js";
@@ -84,6 +84,9 @@ export interface _MessageBase {
84
84
  forwards?: number;
85
85
  /** The message's reply markup. */
86
86
  replyMarkup?: ReplyMarkup;
87
+ businessConnectionId?: string;
88
+ senderBoostCount?: number;
89
+ viaBusinessBot?: User;
87
90
  }
88
91
  /**
89
92
  * Properties shared between media message types.
@@ -464,5 +467,8 @@ export interface MessageGetter {
464
467
  (chatId: number, messageId: number): MaybePromise<Message | null>;
465
468
  }
466
469
  type Message_MessageGetter = MessageGetter | null;
467
- export declare function constructMessage(message_: enums.Message, getEntity: EntityGetter, getMessage: Message_MessageGetter, getStickerSetName: StickerSetNameGetter, getReply_?: boolean): Promise<Message>;
470
+ export declare function constructMessage(message_: enums.Message, getEntity: EntityGetter, getMessage: Message_MessageGetter, getStickerSetName: StickerSetNameGetter, getReply_?: boolean, business?: {
471
+ connectionId: string;
472
+ replyToMessage?: enums.Message;
473
+ }): Promise<Message>;
468
474
  export {};
@@ -1,13 +1,12 @@
1
1
  import { cleanObject, fromUnixTimestamp, getLogger, UNREACHABLE, ZERO_CHANNEL_ID } from "../1_utilities.js";
2
2
  import { as, types } from "../2_tl.js";
3
- import { FileType, toUniqueFileId } from "./0__file_id.js";
4
- import { serializeFileId } from "./0__file_id.js";
3
+ import { FileType, toUniqueFileId } from "./_file_id.js";
4
+ import { serializeFileId } from "./_file_id.js";
5
5
  import { constructContact } from "./0_contact.js";
6
6
  import { constructDice } from "./0_dice.js";
7
7
  import { constructLinkPreview } from "./0_link_preview.js";
8
8
  import { constructLocation } from "./0_location.js";
9
9
  import { constructMessageEntity } from "./0_message_entity.js";
10
- import { constructVenue } from "./0_venue.js";
11
10
  import { constructVoice } from "./0_voice.js";
12
11
  import { constructAnimation } from "./1_animation.js";
13
12
  import { constructAudio } from "./1_audio.js";
@@ -20,6 +19,7 @@ import { constructPoll } from "./1_poll.js";
20
19
  import { constructReplyQuote } from "./1_reply_quote.js";
21
20
  import { constructSticker } from "./1_sticker.js";
22
21
  import { constructUser } from "./1_user.js";
22
+ import { constructVenue } from "./1_venue.js";
23
23
  import { constructVideoNote } from "./1_video_note.js";
24
24
  import { constructVideo } from "./1_video.js";
25
25
  import { constructGame } from "./2_game.js";
@@ -249,7 +249,7 @@ async function constructServiceMessage(message_, chat, getEntity, getMessage) {
249
249
  }
250
250
  return { ...message, unsupported: true };
251
251
  }
252
- export async function constructMessage(message_, getEntity, getMessage, getStickerSetName, getReply_ = true) {
252
+ export async function constructMessage(message_, getEntity, getMessage, getStickerSetName, getReply_ = true, business) {
253
253
  if (!(message_ instanceof types.Message) && !(message_ instanceof types.MessageService)) {
254
254
  UNREACHABLE();
255
255
  }
@@ -299,6 +299,7 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
299
299
  forwards: message_.forwards,
300
300
  isTopicMessage: false,
301
301
  hasProtectedContent: message_.noforwards || false,
302
+ senderBoostCount: message_.from_boosts_applied,
302
303
  };
303
304
  if (message_.reactions) {
304
305
  const recentReactions = message_.reactions.recent_reactions ?? [];
@@ -310,7 +311,14 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
310
311
  }
311
312
  message.replyToMessageId = message_.reply_to.reply_to_msg_id;
312
313
  }
313
- if (getReply_) {
314
+ if (business) {
315
+ message.businessConnectionId = business.connectionId;
316
+ if (business.replyToMessage) {
317
+ message.replyToMessageId = business.replyToMessage.id;
318
+ message.replyToMessage = await constructMessage(business.replyToMessage, getEntity, getMessage, getStickerSetName, false, { connectionId: business.connectionId });
319
+ }
320
+ }
321
+ else if (getReply_) {
314
322
  Object.assign(message, await getReply(message_, chat_, getMessage));
315
323
  }
316
324
  Object.assign(message, await getSender(message_, getEntity));
@@ -326,6 +334,15 @@ export async function constructMessage(message_, getEntity, getMessage, getStick
326
334
  UNREACHABLE();
327
335
  }
328
336
  }
337
+ if (message_.via_business_bot_id != undefined) {
338
+ const viaBusinessBot = await getEntity(new types.PeerUser({ user_id: message_.via_business_bot_id }));
339
+ if (viaBusinessBot) {
340
+ message.viaBusinessBot = constructUser(viaBusinessBot);
341
+ }
342
+ else {
343
+ UNREACHABLE();
344
+ }
345
+ }
329
346
  if (message_.post_author != undefined) {
330
347
  message.authorSignature = message_.post_author;
331
348
  }
@@ -1,5 +1,5 @@
1
1
  import { enums, types } from "../2_tl.js";
2
- import { EntityGetter } from "./1__getters.js";
2
+ import { EntityGetter } from "./_getters.js";
3
3
  import { User } from "./1_user.js";
4
4
  import { Message, MessageGetter } from "./4_message.js";
5
5
  /** A received callback query. */
@@ -1,7 +1,8 @@
1
+ import { InputError } from "../0_errors.js";
1
2
  import { base64DecodeUrlSafe, base64EncodeUrlSafe, cleanObject, UNREACHABLE } from "../1_utilities.js";
2
3
  import { peerToChatId, serialize, TLReader, types } from "../2_tl.js";
3
4
  import { constructUser } from "./1_user.js";
4
- const ERR_INVALID_INLINE_MESSAGE_ID = new Error("Invalid inline message ID");
5
+ const ERR_INVALID_INLINE_MESSAGE_ID = new InputError("Invalid inline message ID");
5
6
  export function deserializeInlineMessageId(inlineMessageId) {
6
7
  try {
7
8
  const buffer = base64DecodeUrlSafe(inlineMessageId);
@@ -1,6 +1,6 @@
1
1
  import { enums, types } from "../2_tl.js";
2
+ import { EntityGetter } from "./_getters.js";
2
3
  import { ChatPhotoChat, ChatPhotoUser } from "./0_chat_photo.js";
3
- import { EntityGetter } from "./1__getters.js";
4
4
  import { ChatPChannel, ChatPGroup, ChatPPrivate, ChatPSupergroup } from "./1_chat_p.js";
5
5
  import { StickerSetNameGetter } from "./1_sticker.js";
6
6
  import { Message, MessageGetter } from "./4_message.js";
@@ -2,6 +2,7 @@ import { AuthorizationState } from "./0_authorization_state.js";
2
2
  import { ConnectionState } from "./0_connection_state.js";
3
3
  import { MessageReference } from "./0_message_reference.js";
4
4
  import { StoryReference } from "./0_story_reference.js";
5
+ import { BusinessConnection } from "./2_business_connection.js";
5
6
  import { ChosenInlineResult } from "./2_chosen_inline_result.js";
6
7
  import { InlineQuery } from "./2_inline_query.js";
7
8
  import { MessageInteractions } from "./2_message_interactions.js";
@@ -100,6 +101,7 @@ export interface UpdateEditedMessage {
100
101
  export interface UpdateDeletedMessages {
101
102
  /** The deleted messages. */
102
103
  deletedMessages: MessageReference[];
104
+ businessConnectionId?: string;
103
105
  }
104
106
  /**
105
107
  * A callback query was made (a user presses an inline button). Bot-only.
@@ -214,6 +216,13 @@ export interface UpdateDeletedStory {
214
216
  export interface UpdateNewStory {
215
217
  story: Story;
216
218
  }
219
+ /**
220
+ * A business connection was added, modified, or removed.
221
+ * @unlisted
222
+ */
223
+ export interface UpdateBusinessConnection {
224
+ businessConnection: BusinessConnection;
225
+ }
217
226
  /** @unlisted */
218
227
  export interface UpdateMap {
219
228
  message: UpdateNewMessage;
@@ -234,8 +243,9 @@ export interface UpdateMap {
234
243
  myChatMember: UpdateMyChatMember;
235
244
  deletedStory: UpdateDeletedStory;
236
245
  story: UpdateNewStory;
246
+ businessConnection: UpdateBusinessConnection;
237
247
  }
238
248
  /** @unlisted */
239
- export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory>;
249
+ export type UpdateIntersection<T> = T & Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateEditedMessage & UpdateDeletedMessages & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory & UpdateBusinessConnection>;
240
250
  /** An incoming update. */
241
- export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory;
251
+ export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateEditedMessage | UpdateDeletedMessages | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory | UpdateBusinessConnection;
@@ -1,3 +1,4 @@
1
+ import { InputError } from "../0_errors.js";
1
2
  import { base64DecodeUrlSafe, base64EncodeUrlSafe, rleDecode, rleEncode, UNREACHABLE } from "../1_utilities.js";
2
3
  import { TLReader, TLWriter } from "../2_tl.js";
3
4
  const NEXT_VERSION = 53;
@@ -215,7 +216,7 @@ function hasFileReference(fileType) {
215
216
  export function deserializeFileId(fileId) {
216
217
  const reader = new TLReader(rleDecode(base64DecodeUrlSafe(fileId)));
217
218
  if (reader.buffer[reader.buffer.length - 1] != PERSISTENT_ID_VERSION) {
218
- throw new Error("Unsupported version");
219
+ throw new InputError("Unsupported file ID format");
219
220
  }
220
221
  const originalType = reader.readInt32();
221
222
  const type = ((originalType & ~WEB_LOCATION_FLAG) & ~FILE_REFERENCE_FLAG);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtkruto/node",
3
- "version": "0.1.190",
3
+ "version": "0.1.200",
4
4
  "description": "MTKruto for Node.js",
5
5
  "author": "Roj <rojvv@icloud.com>",
6
6
  "repository": {
@@ -0,0 +1,12 @@
1
+ export declare class MtkrutoError extends Error {
2
+ }
3
+ export declare class ConnectionError extends MtkrutoError {
4
+ }
5
+ export declare class AccessError extends MtkrutoError {
6
+ }
7
+ export declare class InputError extends MtkrutoError {
8
+ }
9
+ export declare class TransportError extends MtkrutoError {
10
+ readonly code: number;
11
+ constructor(code: number);
12
+ }
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TransportError = exports.InputError = exports.AccessError = exports.ConnectionError = exports.MtkrutoError = void 0;
4
+ class MtkrutoError extends Error {
5
+ }
6
+ exports.MtkrutoError = MtkrutoError;
7
+ class ConnectionError extends MtkrutoError {
8
+ }
9
+ exports.ConnectionError = ConnectionError;
10
+ class AccessError extends MtkrutoError {
11
+ }
12
+ exports.AccessError = AccessError;
13
+ class InputError extends MtkrutoError {
14
+ }
15
+ exports.InputError = InputError;
16
+ class TransportError extends MtkrutoError {
17
+ constructor(code) {
18
+ super(`Transport error: ${code}`);
19
+ Object.defineProperty(this, "code", {
20
+ enumerable: true,
21
+ configurable: true,
22
+ writable: true,
23
+ value: code
24
+ });
25
+ }
26
+ }
27
+ exports.TransportError = TransportError;
@@ -1,4 +1,3 @@
1
- export * from "./utilities/1_base64.js";
2
1
  export * from "./utilities/0_bigint.js";
3
2
  export * from "./utilities/0_buffer.js";
4
3
  export * from "./utilities/0_cache_map.js";
@@ -12,5 +11,6 @@ export * from "./utilities/0_object.js";
12
11
  export * from "./utilities/0_rle.js";
13
12
  export * from "./utilities/0_types.js";
14
13
  export * from "./utilities/1_auth.js";
14
+ export * from "./utilities/1_base64.js";
15
15
  export * from "./utilities/1_misc.js";
16
16
  export * from "./utilities/1_queue.js";