@mtkruto/node 0.0.999 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/0_deps.d.ts +1 -1
- package/esm/0_deps.js +1 -1
- package/esm/3_errors.d.ts +1531 -0
- package/esm/3_errors.js +1531 -0
- package/esm/4_constants.d.ts +1 -1
- package/esm/4_constants.js +1 -1
- package/esm/4_errors.d.ts +25 -0
- package/esm/4_errors.js +64 -0
- package/esm/client/2_client_plain.js +1 -1
- package/esm/client/4_client.d.ts +2 -1
- package/esm/client/4_client.js +24 -41
- package/esm/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.d.ts +2 -2
- package/esm/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.js +19 -6
- package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.d.ts +2 -0
- package/esm/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +991 -0
- package/esm/mod.d.ts +3 -2
- package/esm/mod.js +3 -2
- package/esm/tl/2_types.d.ts +1 -1
- package/esm/tl/2_types.js +1 -2
- package/esm/tl/3_functions.d.ts +1 -1
- package/esm/tl/3_functions.js +1 -2
- package/esm/types/0__file_id.js +0 -1
- package/esm/types/1_bot_command_scope.d.ts +1 -1
- package/esm/types/1_bot_command_scope.js +1 -1
- package/esm/types/1_chat.d.ts +1 -1
- package/esm/types/1_chat.js +1 -1
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_sticker.js +1 -1
- package/esm/types/1_user.d.ts +1 -1
- package/esm/types/1_user.js +1 -1
- package/esm/types/2_inline_keyboard_button.d.ts +1 -1
- package/esm/types/3_message.d.ts +12 -12
- package/esm/types/3_message.js +12 -12
- package/esm/types/5_inline_query_result.d.ts +1 -1
- package/esm/types/5_inline_query_result.js +1 -1
- package/esm/utilities/0_crypto.js +6 -4
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -1
- package/script/0_deps.js +1 -1
- package/script/3_errors.d.ts +1531 -0
- package/script/3_errors.js +2053 -0
- package/script/4_constants.d.ts +1 -1
- package/script/4_constants.js +1 -1
- package/script/4_errors.d.ts +25 -0
- package/script/4_errors.js +88 -0
- package/script/client/2_client_plain.js +1 -1
- package/script/client/4_client.d.ts +2 -1
- package/script/client/4_client.js +24 -41
- package/script/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.d.ts +2 -2
- package/script/deps/deno.land/x/{tgcrypto@0.1.3 → tgcrypto@0.2.1}/mod.js +19 -6
- package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.d.ts +2 -0
- package/script/deps/deno.land/x/tgcrypto@0.2.1/tgcrypto.js +993 -0
- package/script/mod.d.ts +3 -2
- package/script/mod.js +16 -3
- package/script/tl/2_types.d.ts +1 -1
- package/script/tl/2_types.js +0 -1
- package/script/tl/3_functions.d.ts +1 -1
- package/script/tl/3_functions.js +0 -1
- package/script/types/0__file_id.js +0 -1
- package/script/types/1_bot_command_scope.d.ts +1 -1
- package/script/types/1_bot_command_scope.js +1 -1
- package/script/types/1_chat.d.ts +1 -1
- package/script/types/1_chat.js +1 -1
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_sticker.js +1 -1
- package/script/types/1_user.d.ts +1 -1
- package/script/types/1_user.js +1 -1
- package/script/types/2_inline_keyboard_button.d.ts +1 -1
- package/script/types/3_message.d.ts +12 -12
- package/script/types/3_message.js +12 -12
- package/script/types/5_inline_query_result.d.ts +1 -1
- package/script/types/5_inline_query_result.js +1 -1
- package/script/utilities/0_crypto.js +6 -4
- package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
- package/esm/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1078
- package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -2
- package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.js +0 -1080
package/esm/mod.d.ts
CHANGED
|
@@ -4,10 +4,11 @@ export declare const utils: {
|
|
|
4
4
|
checkPassword: typeof checkPassword;
|
|
5
5
|
getRandomId: typeof getRandomId;
|
|
6
6
|
};
|
|
7
|
-
export * from "./2_tl.js";
|
|
8
7
|
export * from "./2_connection.js";
|
|
9
8
|
export * from "./3_storage.js";
|
|
10
9
|
export * from "./3_transport.js";
|
|
10
|
+
export * from "./2_tl.js";
|
|
11
|
+
export * from "./3_types.js";
|
|
11
12
|
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, LAYER, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./4_constants.js";
|
|
13
|
+
export * as errors from "./4_errors.js";
|
|
12
14
|
export * from "./5_client.js";
|
|
13
|
-
export * from "./3_types.js";
|
package/esm/mod.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { getRandomId } from "./1_utilities.js";
|
|
2
2
|
import { checkPassword } from "./client/0_password.js";
|
|
3
3
|
export const utils = { checkPassword, getRandomId };
|
|
4
|
-
export * from "./2_tl.js";
|
|
5
4
|
export * from "./2_connection.js";
|
|
6
5
|
export * from "./3_storage.js";
|
|
7
6
|
export * from "./3_transport.js";
|
|
7
|
+
export * from "./2_tl.js";
|
|
8
|
+
export * from "./3_types.js";
|
|
8
9
|
export { APP_VERSION, DEVICE_MODEL, INITIAL_DC, LANG_CODE, LANG_PACK, LAYER, SYSTEM_LANG_CODE, SYSTEM_VERSION } from "./4_constants.js";
|
|
10
|
+
export * as errors from "./4_errors.js";
|
|
9
11
|
export * from "./5_client.js";
|
|
10
|
-
export * from "./3_types.js";
|
package/esm/tl/2_types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { id,
|
|
1
|
+
import { id, ParamDesc, paramDesc, Params, params, TLObject, TLObjectConstructor } from "./1_tl_object.js";
|
|
2
2
|
export declare abstract class Type extends TLObject {
|
|
3
3
|
}
|
|
4
4
|
export declare abstract class TypeX extends Type {
|
package/esm/tl/2_types.js
CHANGED
package/esm/tl/3_functions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { id,
|
|
1
|
+
import { id, ParamDesc, paramDesc, Params, params, TLObject } from "./1_tl_object.js";
|
|
2
2
|
import * as types from "./2_types.js";
|
|
3
3
|
export declare abstract class Function<T> extends TLObject {
|
|
4
4
|
__R: T;
|
package/esm/tl/3_functions.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { id, params, TLObject, paramDesc, flags } from "./1_tl_object.js";
|
|
1
|
+
import { flags, id, paramDesc, params, TLObject } from "./1_tl_object.js";
|
|
3
2
|
import * as types from "./2_types.js";
|
|
4
3
|
export class Function extends TLObject {
|
|
5
4
|
constructor() {
|
package/esm/types/0__file_id.js
CHANGED
package/esm/types/1_chat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
-
import { Color } from "./0_color.js";
|
|
3
2
|
import { ChatPhoto } from "./0_chat_photo.js";
|
|
3
|
+
import { Color } from "./0_color.js";
|
|
4
4
|
export type ChatType = "private" | "group" | "supergroup" | "channel";
|
|
5
5
|
export declare namespace Chat {
|
|
6
6
|
interface Base {
|
package/esm/types/1_chat.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cleanObject, UNREACHABLE } from "../1_utilities.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
import { ZERO_CHANNEL_ID } from "../4_constants.js";
|
|
4
|
-
import { getColor } from "./0_color.js";
|
|
5
4
|
import { constructChatPhoto } from "./0_chat_photo.js";
|
|
5
|
+
import { getColor } from "./0_color.js";
|
|
6
6
|
export function constructChat(chat) {
|
|
7
7
|
if (chat instanceof types.User) {
|
|
8
8
|
const id = Number(chat.id);
|
package/esm/types/1_sticker.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
|
-
import { Thumbnail } from "./0_thumbnail.js";
|
|
4
3
|
import { MaskPosition } from "./0_mask_position.js";
|
|
4
|
+
import { Thumbnail } from "./0_thumbnail.js";
|
|
5
5
|
/** This object represents a sticker. */
|
|
6
6
|
export interface Sticker {
|
|
7
7
|
/** Identifier for this file, which can be used to download or reuse the file */
|
package/esm/types/1_sticker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { as, types } from "../2_tl.js";
|
|
2
|
-
import { constructThumbnail } from "./0_thumbnail.js";
|
|
3
2
|
import { constructMaskPosition } from "./0_mask_position.js";
|
|
3
|
+
import { constructThumbnail } from "./0_thumbnail.js";
|
|
4
4
|
export async function constructSticker(document, fileId, fileUniqueId, getStickerSetName) {
|
|
5
5
|
const stickerAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeSticker);
|
|
6
6
|
const imageSizeAttribute = document.attributes.find((v) => v instanceof types.DocumentAttributeImageSize);
|
package/esm/types/1_user.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
-
import { Color } from "./0_color.js";
|
|
3
2
|
import { ChatPhoto } from "./0_chat_photo.js";
|
|
3
|
+
import { Color } from "./0_color.js";
|
|
4
4
|
/** This object represents a Telegram user or bot. */
|
|
5
5
|
export interface User {
|
|
6
6
|
/** Unique identifier for this user or bot */
|
package/esm/types/1_user.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cleanObject } from "../1_utilities.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
|
-
import { getColor } from "./0_color.js";
|
|
4
3
|
import { constructChatPhoto } from "./0_chat_photo.js";
|
|
4
|
+
import { getColor } from "./0_color.js";
|
|
5
5
|
export function constructUser(user_) {
|
|
6
6
|
const id = Number(user_.id);
|
|
7
7
|
const user = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
|
-
import { WebAppInfo } from "./0_web_app_info.js";
|
|
3
2
|
import { LoginUrl } from "./0_login_url.js";
|
|
3
|
+
import { WebAppInfo } from "./0_web_app_info.js";
|
|
4
4
|
import { UsernameResolver } from "./1__getters.js";
|
|
5
5
|
export declare namespace InlineKeyboardButton {
|
|
6
6
|
interface Base {
|
package/esm/types/3_message.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { MaybePromise } from "../1_utilities.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
|
-
import { ForceReply } from "./0_force_reply.js";
|
|
4
|
-
import { MessageEntity } from "./0_message_entity.js";
|
|
5
3
|
import { Audio } from "./0_audio.js";
|
|
6
4
|
import { Contact } from "./0_contact.js";
|
|
7
|
-
import { Voice } from "./0_voice.js";
|
|
8
|
-
import { Venue } from "./0_venue.js";
|
|
9
|
-
import { Location } from "./0_location.js";
|
|
10
5
|
import { Dice } from "./0_dice.js";
|
|
6
|
+
import { ForceReply } from "./0_force_reply.js";
|
|
7
|
+
import { Location } from "./0_location.js";
|
|
8
|
+
import { MessageEntity } from "./0_message_entity.js";
|
|
11
9
|
import { ReplyKeyboardRemove } from "./0_reply_keyboard_remove.js";
|
|
10
|
+
import { Venue } from "./0_venue.js";
|
|
11
|
+
import { Voice } from "./0_voice.js";
|
|
12
12
|
import { EntityGetter } from "./1__getters.js";
|
|
13
|
+
import { Animation } from "./1_animation.js";
|
|
13
14
|
import { Chat } from "./1_chat.js";
|
|
14
|
-
import { Photo } from "./1_photo.js";
|
|
15
15
|
import { Document } from "./1_document.js";
|
|
16
|
-
import {
|
|
17
|
-
import { VideoNote } from "./1_video_note.js";
|
|
18
|
-
import { Animation } from "./1_animation.js";
|
|
19
|
-
import { User } from "./1_user.js";
|
|
16
|
+
import { Photo } from "./1_photo.js";
|
|
20
17
|
import { Poll } from "./1_poll.js";
|
|
21
18
|
import { Sticker, StickerSetNameGetter } from "./1_sticker.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
19
|
+
import { User } from "./1_user.js";
|
|
20
|
+
import { VideoNote } from "./1_video_note.js";
|
|
21
|
+
import { Video } from "./1_video.js";
|
|
24
22
|
import { Game } from "./2_game.js";
|
|
23
|
+
import { ReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
|
|
24
|
+
import { InlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
|
|
25
25
|
/** This object represents a message. */
|
|
26
26
|
export interface Message {
|
|
27
27
|
/** Whether the message is outgoing */
|
package/esm/types/3_message.js
CHANGED
|
@@ -3,27 +3,27 @@ import { cleanObject, UNREACHABLE } from "../1_utilities.js";
|
|
|
3
3
|
import { as, types } from "../2_tl.js";
|
|
4
4
|
import { ZERO_CHANNEL_ID } from "../4_constants.js";
|
|
5
5
|
import { FileID, FileType, FileUniqueID, FileUniqueType } from "./0__file_id.js";
|
|
6
|
-
import { constructForceReply } from "./0_force_reply.js";
|
|
7
|
-
import { constructMessageEntity } from "./0_message_entity.js";
|
|
8
6
|
import { constructAudio } from "./0_audio.js";
|
|
9
7
|
import { constructContact } from "./0_contact.js";
|
|
10
|
-
import { constructVoice } from "./0_voice.js";
|
|
11
|
-
import { constructVenue } from "./0_venue.js";
|
|
12
|
-
import { constructLocation } from "./0_location.js";
|
|
13
8
|
import { constructDice } from "./0_dice.js";
|
|
9
|
+
import { constructForceReply } from "./0_force_reply.js";
|
|
10
|
+
import { constructLocation } from "./0_location.js";
|
|
11
|
+
import { constructMessageEntity } from "./0_message_entity.js";
|
|
14
12
|
import { constructReplyKeyboardRemove } from "./0_reply_keyboard_remove.js";
|
|
13
|
+
import { constructVenue } from "./0_venue.js";
|
|
14
|
+
import { constructVoice } from "./0_voice.js";
|
|
15
|
+
import { constructAnimation } from "./1_animation.js";
|
|
15
16
|
import { constructChat } from "./1_chat.js";
|
|
16
|
-
import { constructPhoto } from "./1_photo.js";
|
|
17
17
|
import { constructDocument } from "./1_document.js";
|
|
18
|
-
import {
|
|
19
|
-
import { constructVideoNote } from "./1_video_note.js";
|
|
20
|
-
import { constructAnimation } from "./1_animation.js";
|
|
21
|
-
import { constructUser } from "./1_user.js";
|
|
18
|
+
import { constructPhoto } from "./1_photo.js";
|
|
22
19
|
import { constructPoll } from "./1_poll.js";
|
|
23
20
|
import { constructSticker } from "./1_sticker.js";
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
21
|
+
import { constructUser } from "./1_user.js";
|
|
22
|
+
import { constructVideoNote } from "./1_video_note.js";
|
|
23
|
+
import { constructVideo } from "./1_video.js";
|
|
26
24
|
import { constructGame } from "./2_game.js";
|
|
25
|
+
import { constructReplyKeyboardMarkup } from "./2_reply_keyboard_markup.js";
|
|
26
|
+
import { constructInlineKeyboardMarkup } from "./3_inline_keyboard_markup.js";
|
|
27
27
|
const d = debug("types/Message");
|
|
28
28
|
async function getSender(message_, getEntity) {
|
|
29
29
|
if (message_.fromId instanceof types.PeerUser) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { types } from "../2_tl.js";
|
|
2
2
|
import { MessageEntity } from "./0_message_entity.js";
|
|
3
3
|
import { ParseMode } from "./0_parse_mode.js";
|
|
4
|
+
import { UsernameResolver } from "./1__getters.js";
|
|
4
5
|
import { InlineQueryResultArticle } from "./4_inline_query_result_article.js";
|
|
5
6
|
import { InlineQueryResultAudio } from "./4_inline_query_result_audio.js";
|
|
6
7
|
import { InlineQueryResultCachedAudio } from "./4_inline_query_result_cached_audio.js";
|
|
@@ -21,7 +22,6 @@ import { InlineQueryResultPhoto } from "./4_inline_query_result_photo.js";
|
|
|
21
22
|
import { InlineQueryResultVenue } from "./4_inline_query_result_venue.js";
|
|
22
23
|
import { InlineQueryResultVideo } from "./4_inline_query_result_video.js";
|
|
23
24
|
import { InlineQueryResultVoice } from "./4_inline_query_result_voice.js";
|
|
24
|
-
import { UsernameResolver } from "./1__getters.js";
|
|
25
25
|
export type InlineQueryResult = InlineQueryResultCachedAudio | InlineQueryResultCachedDocument | InlineQueryResultCachedGif | InlineQueryResultCachedMpeg4Gif | InlineQueryResultCachedPhoto | InlineQueryResultCachedSticker | InlineQueryResultCachedVideo | InlineQueryResultCachedVoice | InlineQueryResultArticle | InlineQueryResultAudio | InlineQueryResultContact | InlineQueryResultGame | InlineQueryResultDocument | InlineQueryResultGif | InlineQueryResultLocation | InlineQueryResultMpeg4Gif | InlineQueryResultPhoto | InlineQueryResultVenue | InlineQueryResultVideo | InlineQueryResultVoice;
|
|
26
26
|
export declare function inlineQueryResultToTlObject(result_: InlineQueryResult, parseText: (text: string, params?: {
|
|
27
27
|
parseMode?: ParseMode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { UNREACHABLE } from "../1_utilities.js";
|
|
1
2
|
import { types } from "../2_tl.js";
|
|
2
3
|
import { FileID } from "./0__file_id.js";
|
|
3
|
-
import { UNREACHABLE } from "../1_utilities.js";
|
|
4
4
|
import { replyMarkupToTlObject } from "./4_reply_markup.js";
|
|
5
5
|
// deno-lint-ignore no-explicit-any
|
|
6
6
|
export async function inlineQueryResultToTlObject(result_, parseText, usernameResolver) {
|
|
@@ -21,15 +21,17 @@ export class CTR {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
encrypt(data) {
|
|
24
|
-
const
|
|
24
|
+
const v = new Uint8Array(data); // TODO: don't copy
|
|
25
|
+
const [iv, state] = ctr256Encrypt(v, this.key, this.iv, this.state);
|
|
25
26
|
this.iv = iv;
|
|
26
27
|
this.state = state;
|
|
27
|
-
return
|
|
28
|
+
return v;
|
|
28
29
|
}
|
|
29
30
|
decrypt(data) {
|
|
30
|
-
const
|
|
31
|
+
const v = new Uint8Array(data); // TODO: don't copy
|
|
32
|
+
const [iv, state] = ctr256Decrypt(v, this.key, this.iv, this.state);
|
|
31
33
|
this.iv = iv;
|
|
32
34
|
this.state = state;
|
|
33
|
-
return
|
|
35
|
+
return v;
|
|
34
36
|
}
|
|
35
37
|
}
|
package/package.json
CHANGED
package/script/0_deps.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "./deps/deno.land/std@0.201.0/assert/mod.js";
|
|
2
|
-
export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.1
|
|
2
|
+
export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.2.1/mod.js";
|
|
3
3
|
export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/main/gzip/gzip.js";
|
|
4
4
|
export { Mutex, type MutexInterface } from "async-mutex";
|
|
5
5
|
export { Parser } from "./deps/deno.land/x/html_parser@v0.1.3/src/mod.js";
|
package/script/0_deps.js
CHANGED
|
@@ -16,7 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.base64Encode = exports.base64Decode = exports.debug = exports.Parser = exports.Mutex = exports.gzip = exports.gunzip = exports.initTgCrypto = exports.ige256Encrypt = exports.ige256Decrypt = exports.factorize = exports.ctr256Encrypt = exports.ctr256Decrypt = void 0;
|
|
18
18
|
__exportStar(require("./deps/deno.land/std@0.201.0/assert/mod.js"), exports);
|
|
19
|
-
var mod_js_1 = require("./deps/deno.land/x/tgcrypto@0.1
|
|
19
|
+
var mod_js_1 = require("./deps/deno.land/x/tgcrypto@0.2.1/mod.js");
|
|
20
20
|
Object.defineProperty(exports, "ctr256Decrypt", { enumerable: true, get: function () { return mod_js_1.ctr256Decrypt; } });
|
|
21
21
|
Object.defineProperty(exports, "ctr256Encrypt", { enumerable: true, get: function () { return mod_js_1.ctr256Encrypt; } });
|
|
22
22
|
Object.defineProperty(exports, "factorize", { enumerable: true, get: function () { return mod_js_1.factorize; } });
|