@mtkruto/node 0.0.835 → 0.0.900
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/client/client.d.ts +23 -3
- package/esm/client/client.js +495 -75
- package/esm/constants.d.ts +2 -0
- package/esm/constants.js +2 -0
- package/esm/deps/deno.land/std@0.190.0/encoding/base64.d.ts +11 -0
- package/esm/deps/deno.land/std@0.190.0/encoding/base64.js +140 -0
- package/esm/deps/deno.land/x/q@v0.0.1/mod.d.ts +6 -0
- package/esm/deps/deno.land/x/q@v0.0.1/mod.js +71 -0
- package/esm/deps.d.ts +2 -0
- package/esm/deps.js +2 -0
- package/esm/mod.d.ts +3 -3
- package/esm/mod.js +3 -3
- package/esm/storage/storage.d.ts +18 -0
- package/esm/storage/storage.js +103 -0
- package/esm/tl/1_tl_object.d.ts +0 -1
- package/esm/tl/1_tl_object.js +1 -1
- package/esm/tl/4_tl_writer.d.ts +5 -0
- package/esm/tl/5_rpc_result.d.ts +9 -0
- package/esm/tl/6_message.d.ts +10 -0
- package/esm/tl/{5_message.js → 6_message.js} +2 -2
- package/esm/tl/{6_message_container.d.ts → 7_message_container.d.ts} +1 -1
- package/esm/tl/{6_message_container.js → 7_message_container.js} +2 -2
- package/esm/types/3_message.d.ts +5 -1
- package/esm/types/3_message.js +26 -22
- package/esm/utilities/1_message.d.ts +2 -2
- package/esm/utilities/1_message.js +3 -3
- package/esm/utilities/1_password.js +1 -1
- package/package.json +1 -1
- package/script/client/client.d.ts +23 -3
- package/script/client/client.js +495 -75
- package/script/constants.d.ts +2 -0
- package/script/constants.js +3 -1
- package/script/deps/deno.land/std@0.190.0/encoding/base64.d.ts +11 -0
- package/script/deps/deno.land/std@0.190.0/encoding/base64.js +145 -0
- package/script/deps/deno.land/x/q@v0.0.1/mod.d.ts +6 -0
- package/script/deps/deno.land/x/q@v0.0.1/mod.js +75 -0
- package/script/deps.d.ts +2 -0
- package/script/deps.js +6 -1
- package/script/mod.d.ts +3 -3
- package/script/mod.js +3 -3
- package/script/storage/storage.d.ts +18 -0
- package/script/storage/storage.js +126 -0
- package/script/tl/1_tl_object.d.ts +0 -1
- package/script/tl/1_tl_object.js +1 -1
- package/script/tl/4_tl_writer.d.ts +5 -0
- package/script/tl/5_rpc_result.d.ts +9 -0
- package/script/tl/6_message.d.ts +10 -0
- package/script/tl/{5_message.js → 6_message.js} +6 -6
- package/script/tl/{6_message_container.d.ts → 7_message_container.d.ts} +1 -1
- package/script/tl/{6_message_container.js → 7_message_container.js} +4 -4
- package/script/types/3_message.d.ts +5 -1
- package/script/types/3_message.js +26 -22
- package/script/utilities/1_message.d.ts +2 -2
- package/script/utilities/1_message.js +9 -9
- package/script/utilities/1_password.js +1 -1
- package/esm/tl/3_tl_writer.d.ts +0 -5
- package/esm/tl/4_rpc_result.d.ts +0 -8
- package/esm/tl/5_message.d.ts +0 -11
- package/script/tl/3_tl_writer.d.ts +0 -5
- package/script/tl/4_rpc_result.d.ts +0 -8
- package/script/tl/5_message.d.ts +0 -11
- /package/esm/tl/{3_tl_writer.js → 4_tl_writer.js} +0 -0
- /package/esm/tl/{4_rpc_result.js → 5_rpc_result.js} +0 -0
- /package/script/tl/{3_tl_writer.js → 4_tl_writer.js} +0 -0
- /package/script/tl/{4_rpc_result.js → 5_rpc_result.js} +0 -0
package/esm/client/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
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
|
+
import { ReadObject } from "../tl/3_tl_reader.js";
|
|
4
5
|
import { ClientAbstract } from "./client_abstract.js";
|
|
5
6
|
import { Storage } from "../storage/storage.js";
|
|
6
7
|
import { DC, TransportProvider } from "../transport/transport_provider.js";
|
|
@@ -9,6 +10,8 @@ import { ReplyKeyboardRemove } from "../types/0_reply_keyboard_remove.js";
|
|
|
9
10
|
import { ForceReply } from "../types/0_force_reply.js";
|
|
10
11
|
import { ReplyKeyboardMarkup } from "../types/2_reply_keyboard_markup.js";
|
|
11
12
|
import { InlineKeyboardMarkup } from "../types/2_inline_keyboard_markup.js";
|
|
13
|
+
import { Message } from "../types/3_message.js";
|
|
14
|
+
export declare const getEntity: unique symbol;
|
|
12
15
|
export declare const restartAuth: unique symbol;
|
|
13
16
|
export declare enum ParseMode {
|
|
14
17
|
None = "none",
|
|
@@ -19,7 +22,7 @@ export interface AuthorizeUserParams<S = string> {
|
|
|
19
22
|
code: S | (() => MaybePromise<S>);
|
|
20
23
|
password: S | (() => MaybePromise<S>);
|
|
21
24
|
}
|
|
22
|
-
export type
|
|
25
|
+
export type UpdateHandler = null | ((client: Client, update: types.TypeUpdate) => MaybePromise<void>);
|
|
23
26
|
export interface ClientParams {
|
|
24
27
|
/**
|
|
25
28
|
* Default parse mode. Defauls to `ParseMode.None`.
|
|
@@ -63,7 +66,8 @@ export declare class Client extends ClientAbstract {
|
|
|
63
66
|
private state;
|
|
64
67
|
private promises;
|
|
65
68
|
private toAcknowledge;
|
|
66
|
-
|
|
69
|
+
private updateState?;
|
|
70
|
+
updateHandler: UpdateHandler;
|
|
67
71
|
readonly parseMode: ParseMode;
|
|
68
72
|
readonly appVersion: string;
|
|
69
73
|
readonly deviceModel: string;
|
|
@@ -95,6 +99,7 @@ export declare class Client extends ClientAbstract {
|
|
|
95
99
|
* Before establishing the connection, the session is saved.
|
|
96
100
|
*/
|
|
97
101
|
connect(): Promise<void>;
|
|
102
|
+
private fetchState;
|
|
98
103
|
/**
|
|
99
104
|
* Calls [initConnection](1) and authorizes the client with one of the following:
|
|
100
105
|
*
|
|
@@ -113,6 +118,7 @@ export declare class Client extends ClientAbstract {
|
|
|
113
118
|
* [2]: https://core.telegram.org/method/updates.getState
|
|
114
119
|
*/
|
|
115
120
|
authorize(params: string | types.AuthExportedAuthorization | AuthorizeUserParams): Promise<void>;
|
|
121
|
+
private messageProcessQueue;
|
|
116
122
|
private receiveLoop;
|
|
117
123
|
private pingLoop;
|
|
118
124
|
/**
|
|
@@ -129,8 +135,20 @@ export declare class Client extends ClientAbstract {
|
|
|
129
135
|
send<T extends (functions.Function<unknown> | types.Type) = functions.Function<unknown>>(function_: T): Promise<void>;
|
|
130
136
|
private processChats;
|
|
131
137
|
private processUsers;
|
|
138
|
+
private updateApplicationMutex;
|
|
139
|
+
private applyUpdateNoGap;
|
|
140
|
+
private applyUpdate;
|
|
132
141
|
private processUpdates;
|
|
142
|
+
private setUpdateStateDate;
|
|
143
|
+
private getLocalState;
|
|
144
|
+
private updateGapRecoveryMutex;
|
|
145
|
+
private recoverUpdateGap;
|
|
146
|
+
private recoverChannelUpdateGap;
|
|
133
147
|
getInputPeer(id: string | number): Promise<types.InputPeerChat | types.InputPeerUser | types.InputPeerChannel>;
|
|
148
|
+
[getEntity](peer: types.PeerUser): Promise<types.User | null>;
|
|
149
|
+
[getEntity](peer: types.PeerChat): Promise<types.Chat | null>;
|
|
150
|
+
[getEntity](peer: types.PeerChannel): Promise<types.Channel | null>;
|
|
151
|
+
processResult(result: ReadObject): Promise<void>;
|
|
134
152
|
sendMessage(chatId: number | string, text: string, params?: {
|
|
135
153
|
parseMode?: ParseMode;
|
|
136
154
|
entities?: MessageEntity[];
|
|
@@ -141,5 +159,7 @@ export declare class Client extends ClientAbstract {
|
|
|
141
159
|
messageThreadId?: number;
|
|
142
160
|
sendAs?: number | string;
|
|
143
161
|
replyMarkup?: InlineKeyboardMarkup | ReplyKeyboardMarkup | ReplyKeyboardRemove | ForceReply;
|
|
144
|
-
}): Promise<
|
|
162
|
+
}): Promise<Message>;
|
|
163
|
+
getMessages(chatId: number | string, messageIds: number[]): Promise<Message[]>;
|
|
164
|
+
getMessage(chatId: number | string, messageId: number): Promise<Message | null>;
|
|
145
165
|
}
|