@mtkruto/node 0.1.200 → 0.1.300
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 +2 -1
- package/esm/1_utilities.d.ts +1 -1
- package/esm/1_utilities.js +1 -1
- package/esm/4_errors.js +3 -3
- package/esm/client/0_markdown.js +5 -5
- package/esm/client/0_utilities.d.ts +6 -0
- package/esm/client/0_utilities.js +35 -4
- package/esm/client/1_account_manager.js +4 -4
- package/esm/client/1_client_encrypted.js +4 -4
- package/esm/client/1_client_plain.js +3 -3
- package/esm/client/1_file_manager.js +6 -5
- package/esm/client/1_reaction_manager.js +2 -2
- package/esm/client/1_update_manager.js +9 -8
- package/esm/client/2_message_manager.js +47 -24
- package/esm/client/3_callback_query_manager.js +2 -0
- package/esm/client/3_chat_list_manager.js +13 -12
- package/esm/client/3_inline_query_manager.js +4 -2
- package/esm/client/3_story_manager.js +7 -5
- package/esm/client/4_client.d.ts +5 -8
- package/esm/client/4_client.js +19 -27
- package/esm/connection/1_connection_web_socket.js +3 -2
- package/{script/deps/deno.land/x/tgcrypto@0.3.3 → esm/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +0 -11
- package/esm/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +308 -0
- package/esm/mod.d.ts +1 -1
- package/esm/mod.js +1 -1
- package/esm/storage/0_storage.js +6 -5
- package/esm/storage/1_utilities.d.ts +0 -1
- package/esm/storage/1_utilities.js +2 -3
- package/esm/storage/2_storage_local_storage.js +1 -4
- package/esm/storage/2_storage_session_storage.js +1 -4
- package/esm/tl/3_utilities.js +5 -4
- package/esm/transport/2_transport_provider.js +4 -4
- package/esm/types/0_message_entity.js +3 -3
- package/esm/types/0_message_search_filter.js +2 -2
- package/esm/types/0_reaction.js +2 -2
- package/esm/types/1_bot_command_scope.js +3 -3
- package/esm/types/1_chat_p.js +3 -2
- package/esm/types/1_keyboard_button.js +3 -3
- package/esm/types/1_message_reaction.js +2 -2
- package/esm/types/1_story_privacy.js +3 -3
- package/esm/types/2_chat_member.js +6 -5
- package/esm/types/2_chosen_inline_result.js +3 -2
- package/esm/types/2_inactive_chat.js +3 -2
- package/esm/types/2_inline_keyboard_button.js +3 -3
- package/esm/types/2_inline_query.js +3 -3
- package/esm/types/2_invite_link.js +3 -2
- package/esm/types/2_story_content.js +5 -5
- package/esm/types/2_story_interactive_area.js +5 -5
- package/esm/types/3_chat_member_updated.js +4 -3
- package/esm/types/3_reply_markup.js +4 -3
- package/esm/types/3_story.js +3 -2
- package/esm/types/4_inline_query_result.js +5 -5
- package/esm/types/4_message.js +17 -16
- package/esm/types/5_callback_query.js +4 -3
- package/esm/types/5_chat.js +8 -7
- package/esm/types/_file_id.js +9 -8
- package/esm/utilities/0_bigint.d.ts +1 -0
- package/esm/utilities/0_bigint.js +25 -0
- package/esm/utilities/0_logger.d.ts +8 -0
- package/esm/utilities/0_logger.js +9 -5
- package/esm/utilities/1_math.d.ts +1 -0
- package/esm/utilities/1_math.js +51 -0
- package/esm/utilities/1_misc.js +2 -2
- package/package.json +1 -1
- package/script/0_deps.d.ts +1 -1
- package/script/0_deps.js +3 -3
- package/script/1_utilities.d.ts +1 -1
- package/script/1_utilities.js +1 -1
- package/script/4_errors.js +3 -3
- package/script/client/0_markdown.js +5 -5
- package/script/client/0_utilities.d.ts +6 -0
- package/script/client/0_utilities.js +41 -4
- package/script/client/1_account_manager.js +4 -4
- package/script/client/1_client_encrypted.js +2 -2
- package/script/client/1_client_plain.js +2 -2
- package/script/client/1_file_manager.js +5 -4
- package/script/client/1_reaction_manager.js +2 -2
- package/script/client/1_update_manager.js +8 -7
- package/script/client/2_message_manager.js +51 -28
- package/script/client/3_callback_query_manager.js +2 -0
- package/script/client/3_chat_list_manager.js +12 -11
- package/script/client/3_inline_query_manager.js +4 -2
- package/script/client/3_story_manager.js +4 -2
- package/script/client/4_client.d.ts +5 -8
- package/script/client/4_client.js +18 -26
- package/script/connection/1_connection_web_socket.js +2 -1
- package/{esm/deps/deno.land/x/tgcrypto@0.3.3 → script/deps/deno.land/x/tgcrypto@0.4.0}/mod.d.ts +0 -1
- package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/mod.js +1 -13
- package/script/deps/deno.land/x/tgcrypto@0.4.0/tgcrypto.js +310 -0
- package/script/mod.d.ts +1 -1
- package/script/mod.js +2 -1
- package/script/storage/0_storage.js +5 -4
- package/script/storage/1_utilities.d.ts +0 -1
- package/script/storage/1_utilities.js +3 -4
- package/script/storage/2_storage_local_storage.js +0 -3
- package/script/storage/2_storage_session_storage.js +0 -3
- package/script/tl/3_utilities.js +4 -3
- package/script/transport/2_transport_provider.js +4 -4
- package/script/types/0_message_entity.js +3 -3
- package/script/types/0_message_search_filter.js +2 -2
- package/script/types/0_reaction.js +2 -2
- package/script/types/1_bot_command_scope.js +3 -3
- package/script/types/1_chat_p.js +2 -1
- package/script/types/1_keyboard_button.js +3 -3
- package/script/types/1_message_reaction.js +2 -2
- package/script/types/1_story_privacy.js +3 -3
- package/script/types/2_chat_member.js +5 -4
- package/script/types/2_chosen_inline_result.js +2 -1
- package/script/types/2_inactive_chat.js +2 -1
- package/script/types/2_inline_keyboard_button.js +3 -3
- package/script/types/2_inline_query.js +3 -3
- package/script/types/2_invite_link.js +2 -1
- package/script/types/2_story_content.js +5 -5
- package/script/types/2_story_interactive_area.js +5 -5
- package/script/types/3_chat_member_updated.js +3 -2
- package/script/types/3_reply_markup.js +3 -2
- package/script/types/3_story.js +2 -1
- package/script/types/4_inline_query_result.js +5 -5
- package/script/types/4_message.js +16 -15
- package/script/types/5_callback_query.js +3 -2
- package/script/types/5_chat.js +7 -6
- package/script/types/_file_id.js +8 -7
- package/script/utilities/0_bigint.d.ts +1 -0
- package/script/utilities/0_bigint.js +27 -1
- package/script/utilities/0_logger.d.ts +8 -0
- package/script/utilities/0_logger.js +11 -6
- package/script/utilities/1_math.d.ts +1 -0
- package/script/utilities/1_math.js +55 -0
- package/script/utilities/1_misc.js +2 -2
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -203
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -274
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -51
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -191
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -385
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -431
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1046
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -52
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -122
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -24
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -121
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -30
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2127
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -108
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -1
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -95
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -128
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -110
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -120
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -6
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -110
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -75
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
- package/esm/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -101
- package/esm/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -324
- package/esm/utilities/0_control.d.ts +0 -1
- package/esm/utilities/0_control.js +0 -3
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.d.ts +0 -83
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomHandler.js +0 -207
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.d.ts +0 -50
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/DomSerializer.js +0 -301
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.d.ts +0 -47
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/ElementType.js +0 -55
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.d.ts +0 -66
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/FeedHandler.js +0 -222
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.d.ts +0 -168
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Node.js +0 -404
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.d.ts +0 -159
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Parser.js +0 -438
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.d.ts +0 -181
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/Tokenizer.js +0 -1052
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.d.ts +0 -42
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/mod.js +0 -88
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.d.ts +0 -11
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode.js +0 -128
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.d.ts +0 -1
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/decode_codepoint.js +0 -30
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.d.ts +0 -46
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/encode.js +0 -129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.d.ts +0 -31
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/decode.js +0 -32
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.d.ts +0 -2128
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/entities.js +0 -2129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.d.ts +0 -109
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/legacy.js +0 -110
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.d.ts +0 -8
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/maps/xml.js +0 -3
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.d.ts +0 -90
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/entities/mod.js +0 -114
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.d.ts +0 -50
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/helpers.js +0 -134
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.d.ts +0 -46
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/legacy.js +0 -118
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.d.ts +0 -42
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/manipulation.js +0 -129
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.d.ts +0 -6
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/mod.js +0 -22
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.d.ts +0 -54
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/querying.js +0 -119
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.d.ts +0 -40
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/stringify.js +0 -86
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.d.ts +0 -58
- package/script/deps/deno.land/x/html_parser@v0.1.3/src/utils/traversal.js +0 -112
- package/script/deps/deno.land/x/tgcrypto@0.3.3/tgcrypto.js +0 -326
- package/script/utilities/0_control.d.ts +0 -1
- package/script/utilities/0_control.js +0 -7
- /package/esm/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
- /package/script/deps/deno.land/x/{tgcrypto@0.3.3 → tgcrypto@0.4.0}/tgcrypto.d.ts +0 -0
package/esm/storage/0_storage.js
CHANGED
|
@@ -10,7 +10,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _Storage_instances, _Storage_authKeyId, _Storage_resetAuthKeyId, _Storage_accountId, _Storage_accountType, _Storage_getUpdateId;
|
|
13
|
-
import {
|
|
13
|
+
import { AssertionError, unreachable } from "../0_deps.js";
|
|
14
|
+
import { base64DecodeUrlSafe, base64EncodeUrlSafe, bigIntFromBuffer, rleDecode, rleEncode, sha1, ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
14
15
|
import { peerToChatId, serialize, TLObject, TLReader, TLWriter, types } from "../2_tl.js";
|
|
15
16
|
// key parts
|
|
16
17
|
export const K = {
|
|
@@ -132,7 +133,7 @@ export class Storage {
|
|
|
132
133
|
const channel = await this.getEntity(id);
|
|
133
134
|
if (channel) {
|
|
134
135
|
if (!(channel instanceof types.Channel) && !(channel instanceof types.ChannelForbidden)) {
|
|
135
|
-
|
|
136
|
+
unreachable();
|
|
136
137
|
}
|
|
137
138
|
return typeof channel.access_hash === "bigint" ? channel.access_hash : null;
|
|
138
139
|
}
|
|
@@ -144,7 +145,7 @@ export class Storage {
|
|
|
144
145
|
const user = await this.getEntity(id);
|
|
145
146
|
if (user) {
|
|
146
147
|
if (!(user instanceof types.User)) {
|
|
147
|
-
|
|
148
|
+
unreachable();
|
|
148
149
|
}
|
|
149
150
|
return typeof user.access_hash === "bigint" ? user.access_hash : null;
|
|
150
151
|
}
|
|
@@ -248,10 +249,10 @@ export class Storage {
|
|
|
248
249
|
async setAccountType(type) {
|
|
249
250
|
try {
|
|
250
251
|
await this.getAccountType();
|
|
251
|
-
|
|
252
|
+
unreachable();
|
|
252
253
|
}
|
|
253
254
|
catch (err) {
|
|
254
|
-
if (!(err instanceof
|
|
255
|
+
if (!(err instanceof AssertionError)) {
|
|
255
256
|
throw err;
|
|
256
257
|
}
|
|
257
258
|
else {
|
|
@@ -8,7 +8,6 @@ export declare enum ValueType {
|
|
|
8
8
|
Uint8Array = 5,
|
|
9
9
|
Array = 6
|
|
10
10
|
}
|
|
11
|
-
export declare const WEB_STORAGE_PREFIX_EXP: RegExp;
|
|
12
11
|
export declare function toString(value: unknown): string;
|
|
13
12
|
export declare function fromString<T>(string: string): T;
|
|
14
13
|
export declare function fixKey(key: readonly StorageKeyPart[]): IDBValidKey[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { decodeBase64, encodeBase64 } from "../0_deps.js";
|
|
2
|
-
import {
|
|
2
|
+
import { unreachable } from "../0_deps.js";
|
|
3
3
|
export var ValueType;
|
|
4
4
|
(function (ValueType) {
|
|
5
5
|
ValueType[ValueType["Boolean"] = 0] = "Boolean";
|
|
@@ -10,7 +10,6 @@ export var ValueType;
|
|
|
10
10
|
ValueType[ValueType["Uint8Array"] = 5] = "Uint8Array";
|
|
11
11
|
ValueType[ValueType["Array"] = 6] = "Array";
|
|
12
12
|
})(ValueType || (ValueType = {}));
|
|
13
|
-
export const WEB_STORAGE_PREFIX_EXP = /^[\d\w]+$/;
|
|
14
13
|
export function toString(value) {
|
|
15
14
|
if (typeof value === "boolean") {
|
|
16
15
|
return `${ValueType.Boolean}${Number(value)}`;
|
|
@@ -43,7 +42,7 @@ export function toString(value) {
|
|
|
43
42
|
return `${ValueType.Array}${items.join("\n")}`;
|
|
44
43
|
}
|
|
45
44
|
else {
|
|
46
|
-
|
|
45
|
+
unreachable();
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
export function fromString(string) {
|
|
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _StorageLocalStorage_prefix;
|
|
13
13
|
import { Storage } from "./0_storage.js";
|
|
14
|
-
import { fromString, isInRange, toString
|
|
14
|
+
import { fromString, isInRange, toString } from "./1_utilities.js";
|
|
15
15
|
export class StorageLocalStorage extends Storage {
|
|
16
16
|
constructor(prefix) {
|
|
17
17
|
if (typeof localStorage === "undefined") {
|
|
@@ -20,9 +20,6 @@ export class StorageLocalStorage extends Storage {
|
|
|
20
20
|
if (prefix.length <= 0) {
|
|
21
21
|
throw new Error("Empty prefix");
|
|
22
22
|
}
|
|
23
|
-
else if (!WEB_STORAGE_PREFIX_EXP.test(prefix)) {
|
|
24
|
-
throw new Error("Unallowed prefix");
|
|
25
|
-
}
|
|
26
23
|
super();
|
|
27
24
|
_StorageLocalStorage_prefix.set(this, void 0);
|
|
28
25
|
__classPrivateFieldSet(this, _StorageLocalStorage_prefix, prefix, "f");
|
|
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _StorageSessionStorage_prefix;
|
|
13
13
|
import { Storage } from "./0_storage.js";
|
|
14
|
-
import { fromString, isInRange, toString
|
|
14
|
+
import { fromString, isInRange, toString } from "./1_utilities.js";
|
|
15
15
|
export class StorageSessionStorage extends Storage {
|
|
16
16
|
constructor(prefix) {
|
|
17
17
|
if (typeof sessionStorage === "undefined") {
|
|
@@ -20,9 +20,6 @@ export class StorageSessionStorage extends Storage {
|
|
|
20
20
|
if (prefix.length <= 0) {
|
|
21
21
|
throw new Error("Empty prefix");
|
|
22
22
|
}
|
|
23
|
-
else if (!WEB_STORAGE_PREFIX_EXP.test(prefix)) {
|
|
24
|
-
throw new Error("Unallowed prefix");
|
|
25
|
-
}
|
|
26
23
|
super();
|
|
27
24
|
_StorageSessionStorage_prefix.set(this, void 0);
|
|
28
25
|
__classPrivateFieldSet(this, _StorageSessionStorage_prefix, prefix, "f");
|
package/esm/tl/3_utilities.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
2
3
|
import { types } from "./2_types.js";
|
|
3
4
|
export function getChannelChatId(channelId) {
|
|
4
5
|
return ZERO_CHANNEL_ID + -Number(channelId);
|
|
@@ -14,7 +15,7 @@ export function peerToChatId(peer) {
|
|
|
14
15
|
return getChannelChatId("id" in peer ? peer.id : peer.channel_id);
|
|
15
16
|
}
|
|
16
17
|
else {
|
|
17
|
-
|
|
18
|
+
unreachable();
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
export function chatIdToPeer(chatId) {
|
|
@@ -40,7 +41,7 @@ export function chatIdToPeerId(chatId) {
|
|
|
40
41
|
return peer.channel_id;
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
|
-
|
|
44
|
+
unreachable();
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
export function getChatIdPeerType(chatId) {
|
|
@@ -65,6 +66,6 @@ export function inputPeerToPeer(inputPeer) {
|
|
|
65
66
|
return new types.PeerChannel(inputPeer);
|
|
66
67
|
}
|
|
67
68
|
else {
|
|
68
|
-
|
|
69
|
+
unreachable();
|
|
69
70
|
}
|
|
70
71
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
export function getDcIps(dc, version) {
|
|
3
3
|
switch (version) {
|
|
4
4
|
case "ipv4":
|
|
@@ -20,7 +20,7 @@ export function getDcIps(dc, version) {
|
|
|
20
20
|
case "3-test":
|
|
21
21
|
return ["149.154.175.117"];
|
|
22
22
|
default:
|
|
23
|
-
|
|
23
|
+
unreachable();
|
|
24
24
|
}
|
|
25
25
|
break;
|
|
26
26
|
case "ipv6":
|
|
@@ -42,11 +42,11 @@ export function getDcIps(dc, version) {
|
|
|
42
42
|
case "3-test":
|
|
43
43
|
return ["2001:b28:f23d:f003::e"];
|
|
44
44
|
default:
|
|
45
|
-
|
|
45
|
+
unreachable();
|
|
46
46
|
}
|
|
47
47
|
break;
|
|
48
48
|
default:
|
|
49
|
-
|
|
49
|
+
unreachable();
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
export function getDcId(dc, cdn) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
export function constructMessageEntity(obj) {
|
|
4
4
|
if (obj instanceof types.MessageEntityMention) {
|
|
@@ -91,7 +91,7 @@ export async function messageEntityToTlObject(entity, getEntity) {
|
|
|
91
91
|
if (!isNaN(id)) {
|
|
92
92
|
const entity_ = await getEntity(new types.PeerUser({ user_id: BigInt(id) }));
|
|
93
93
|
if (!entity_) {
|
|
94
|
-
|
|
94
|
+
unreachable();
|
|
95
95
|
}
|
|
96
96
|
return new types.InputMessageEntityMentionName({ offset, length, user_id: new types.InputUser({ user_id: entity_.id, access_hash: entity_.access_hash ?? 0n }) });
|
|
97
97
|
}
|
|
@@ -105,7 +105,7 @@ export async function messageEntityToTlObject(entity, getEntity) {
|
|
|
105
105
|
case "textMention": {
|
|
106
106
|
const entity_ = await getEntity(new types.PeerUser({ user_id: BigInt(entity.userId) }));
|
|
107
107
|
if (!entity_) {
|
|
108
|
-
|
|
108
|
+
unreachable();
|
|
109
109
|
}
|
|
110
110
|
return new types.InputMessageEntityMentionName({ offset, length, user_id: new types.InputUser({ user_id: entity_.id, access_hash: entity_.access_hash ?? 0n }) });
|
|
111
111
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
export function messageSearchFilterToTlObject(filter) {
|
|
4
4
|
switch (filter) {
|
|
@@ -31,6 +31,6 @@ export function messageSearchFilterToTlObject(filter) {
|
|
|
31
31
|
case "pinned":
|
|
32
32
|
return new types.InputMessagesFilterPinned();
|
|
33
33
|
default:
|
|
34
|
-
|
|
34
|
+
unreachable();
|
|
35
35
|
}
|
|
36
36
|
}
|
package/esm/types/0_reaction.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
export function constructReaction(reaction) {
|
|
4
4
|
if (reaction instanceof types.ReactionEmoji) {
|
|
@@ -8,7 +8,7 @@ export function constructReaction(reaction) {
|
|
|
8
8
|
return { type: "customEmoji", id: String(reaction.document_id) };
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
|
-
|
|
11
|
+
unreachable();
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
export function reactionToTlObject(reaction) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
export async function botCommandScopeToTlObject(scope, getInputPeer) {
|
|
4
4
|
switch (scope.type) {
|
|
@@ -17,11 +17,11 @@ export async function botCommandScopeToTlObject(scope, getInputPeer) {
|
|
|
17
17
|
case "chatMember": {
|
|
18
18
|
const user = await getInputPeer(scope.userId);
|
|
19
19
|
if (!(user instanceof types.InputPeerUser)) {
|
|
20
|
-
|
|
20
|
+
unreachable();
|
|
21
21
|
}
|
|
22
22
|
return new types.BotCommandScopePeerUser({ peer: await getInputPeer(scope.chatId), user_id: new types.InputUser({ user_id: user.user_id, access_hash: user.access_hash }) });
|
|
23
23
|
}
|
|
24
24
|
default:
|
|
25
|
-
|
|
25
|
+
unreachable();
|
|
26
26
|
}
|
|
27
27
|
}
|
package/esm/types/1_chat_p.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { cleanObject, getColorFromPeerId, ZERO_CHANNEL_ID } from "../1_utilities.js";
|
|
2
3
|
import { types } from "../2_tl.js";
|
|
3
4
|
import { constructRestrictionReason } from "./0_restriction_reason.js";
|
|
4
5
|
export function constructChatP(chat) {
|
|
@@ -82,6 +83,6 @@ export function constructChatP(chat) {
|
|
|
82
83
|
return cleanObject(chat_);
|
|
83
84
|
}
|
|
84
85
|
else {
|
|
85
|
-
|
|
86
|
+
unreachable();
|
|
86
87
|
}
|
|
87
88
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
import { chatAdministratorRightsToTlObject, constructChatAdministratorRights } from "./0_chat_administrator_rights.js";
|
|
4
4
|
export function constructKeyboardButton(button_) {
|
|
@@ -55,7 +55,7 @@ export function constructKeyboardButton(button_) {
|
|
|
55
55
|
return button;
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
|
|
58
|
+
unreachable();
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
else if (button_ instanceof types.KeyboardButtonRequestPhone) {
|
|
@@ -75,7 +75,7 @@ export function constructKeyboardButton(button_) {
|
|
|
75
75
|
return { text: button_.text, miniApp: { url: button_.url } };
|
|
76
76
|
}
|
|
77
77
|
else {
|
|
78
|
-
|
|
78
|
+
unreachable();
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
export function keyboardButtonToTlObject(button) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { peerToChatId, types } from "../2_tl.js";
|
|
3
3
|
import { constructReaction } from "./0_reaction.js";
|
|
4
4
|
export function constructMessageReaction(reaction_, recentReactions) {
|
|
@@ -11,7 +11,7 @@ export function constructMessageReaction(reaction_, recentReactions) {
|
|
|
11
11
|
return v.reaction instanceof types.ReactionCustomEmoji && v.reaction.document_id == reaction_.reaction.document_id;
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
|
-
|
|
14
|
+
unreachable();
|
|
15
15
|
}
|
|
16
16
|
})
|
|
17
17
|
.map((v) => peerToChatId(v.peer_id));
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
async function resolveUsers(ids, getEntity) {
|
|
4
4
|
const users = new Array();
|
|
5
5
|
for (const id of ids) {
|
|
6
6
|
const entity = await getEntity(new types.PeerUser({ user_id: BigInt(id) }));
|
|
7
7
|
if (!(entity instanceof types.User)) {
|
|
8
|
-
|
|
8
|
+
unreachable();
|
|
9
9
|
}
|
|
10
10
|
else {
|
|
11
11
|
users.push(new types.InputUser({ user_id: entity.id, access_hash: entity.access_hash ?? 0n }));
|
|
@@ -34,7 +34,7 @@ export async function storyPrivacyToTlObject(privacy, getEntity) {
|
|
|
34
34
|
}
|
|
35
35
|
else if ("only" in privacy) {
|
|
36
36
|
if (!privacy.only.length) {
|
|
37
|
-
|
|
37
|
+
unreachable();
|
|
38
38
|
}
|
|
39
39
|
const users = await resolveUsers(privacy.only, getEntity);
|
|
40
40
|
rules.push(new types.InputPrivacyValueAllowUsers({ users }));
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
|
|
2
3
|
import { types } from "../2_tl.js";
|
|
3
4
|
import { constructChatAdministratorRights } from "./0_chat_administrator_rights.js";
|
|
4
5
|
import { constructChatMemberRights } from "./0_chat_member_rights.js";
|
|
5
6
|
import { constructUser } from "./1_user.js";
|
|
6
7
|
export async function constructChatMember(participant, getEntity) {
|
|
7
|
-
const user_ = "user_id" in participant ? await getEntity(new types.PeerUser(participant)) : "peer" in participant ? participant.peer instanceof types.PeerUser ? await getEntity(participant.peer) :
|
|
8
|
+
const user_ = "user_id" in participant ? await getEntity(new types.PeerUser(participant)) : "peer" in participant ? participant.peer instanceof types.PeerUser ? await getEntity(participant.peer) : unreachable() : unreachable(); // TODO: support other peer types
|
|
8
9
|
if (user_ == null)
|
|
9
|
-
|
|
10
|
+
unreachable();
|
|
10
11
|
const user = constructUser(user_);
|
|
11
12
|
if (participant instanceof types.ChannelParticipant || participant instanceof types.ChatParticipant) {
|
|
12
13
|
return {
|
|
@@ -51,7 +52,7 @@ export async function constructChatMember(participant, getEntity) {
|
|
|
51
52
|
});
|
|
52
53
|
}
|
|
53
54
|
else if (participant instanceof types.ChannelParticipantSelf) {
|
|
54
|
-
|
|
55
|
+
unreachable(); // TODO: implement
|
|
55
56
|
}
|
|
56
57
|
else if (participant instanceof types.ChannelParticipantLeft) {
|
|
57
58
|
return { status: "left", user };
|
|
@@ -84,6 +85,6 @@ export async function constructChatMember(participant, getEntity) {
|
|
|
84
85
|
});
|
|
85
86
|
}
|
|
86
87
|
else {
|
|
87
|
-
|
|
88
|
+
unreachable();
|
|
88
89
|
}
|
|
89
90
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { base64EncodeUrlSafe, cleanObject } from "../1_utilities.js";
|
|
2
3
|
import { serialize, types } from "../2_tl.js";
|
|
3
4
|
import { constructLocation } from "./0_location.js";
|
|
4
5
|
import { constructUser } from "./1_user.js";
|
|
5
6
|
export async function constructChosenInlineResult(ubis, getEntity) {
|
|
6
7
|
const entity = await getEntity(new types.PeerUser(ubis));
|
|
7
8
|
if (!entity || !(entity instanceof types.User)) {
|
|
8
|
-
|
|
9
|
+
unreachable();
|
|
9
10
|
}
|
|
10
11
|
return cleanObject({
|
|
11
12
|
resultId: ubis.id,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { fromUnixTimestamp } from "../1_utilities.js";
|
|
2
3
|
import { types } from "../2_tl.js";
|
|
3
4
|
import { constructChatP } from "./1_chat_p.js";
|
|
4
5
|
export function constructInactiveChat(chat_, lastActivity) {
|
|
5
6
|
if (chat_ instanceof types.ChatEmpty) {
|
|
6
|
-
|
|
7
|
+
unreachable();
|
|
7
8
|
}
|
|
8
9
|
const chat = constructChatP(chat_);
|
|
9
10
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
import { constructMiniAppInfo } from "./0_mini_app_info.js";
|
|
4
4
|
export function constructInlineKeyboardButton(button_) {
|
|
@@ -29,7 +29,7 @@ export function constructInlineKeyboardButton(button_) {
|
|
|
29
29
|
return { text: button_.text, callbackGame: {} };
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
|
|
32
|
+
unreachable();
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
export async function inlineKeyboardButtonToTlObject(button, usernameResolver) {
|
|
@@ -61,6 +61,6 @@ export async function inlineKeyboardButtonToTlObject(button, usernameResolver) {
|
|
|
61
61
|
return new types.KeyboardButtonBuy({ text: button.text });
|
|
62
62
|
}
|
|
63
63
|
else {
|
|
64
|
-
|
|
64
|
+
unreachable();
|
|
65
65
|
}
|
|
66
66
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
import { constructLocation } from "./0_location.js";
|
|
4
4
|
import { constructUser } from "./1_user.js";
|
|
5
5
|
export async function constructInlineQuery(query_, getEntity) {
|
|
6
6
|
const user_ = await getEntity(new types.PeerUser({ user_id: query_.user_id }));
|
|
7
7
|
if (user_ == null) {
|
|
8
|
-
|
|
8
|
+
unreachable();
|
|
9
9
|
}
|
|
10
10
|
const user = constructUser(user_);
|
|
11
11
|
let chatType;
|
|
@@ -26,7 +26,7 @@ export async function constructInlineQuery(query_, getEntity) {
|
|
|
26
26
|
chatType = "channel";
|
|
27
27
|
}
|
|
28
28
|
else {
|
|
29
|
-
|
|
29
|
+
unreachable();
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
const location = query_.geo !== undefined && query_.geo instanceof types.GeoPoint ? constructLocation(query_.geo) : undefined;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
|
|
2
3
|
import { types } from "../2_tl.js";
|
|
3
4
|
import { constructUser } from "./1_user.js";
|
|
4
5
|
export async function constructInviteLink(inviteLink_, getEntity) {
|
|
5
6
|
const entity = await getEntity(new types.PeerUser({ user_id: inviteLink_.admin_id }));
|
|
6
7
|
if (!entity) {
|
|
7
|
-
|
|
8
|
+
unreachable();
|
|
8
9
|
}
|
|
9
10
|
const inviteLink = inviteLink_.link;
|
|
10
11
|
const creator = constructUser(entity);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { as, types } from "../2_tl.js";
|
|
3
3
|
import { FileType, serializeFileId, toUniqueFileId } from "./_file_id.js";
|
|
4
4
|
import { constructPhoto } from "./1_photo.js";
|
|
@@ -6,7 +6,7 @@ import { constructVideo } from "./1_video.js";
|
|
|
6
6
|
export function constructStoryContent(media) {
|
|
7
7
|
if (media instanceof types.MessageMediaPhoto) {
|
|
8
8
|
if (!media.photo) {
|
|
9
|
-
|
|
9
|
+
unreachable();
|
|
10
10
|
}
|
|
11
11
|
const photo = constructPhoto(media.photo[as](types.Photo));
|
|
12
12
|
return { photo };
|
|
@@ -14,11 +14,11 @@ export function constructStoryContent(media) {
|
|
|
14
14
|
else if (media instanceof types.MessageMediaDocument) {
|
|
15
15
|
const document = media.document;
|
|
16
16
|
if (!(document instanceof types.Document)) {
|
|
17
|
-
|
|
17
|
+
unreachable();
|
|
18
18
|
}
|
|
19
19
|
const video = document.attributes.find((v) => v instanceof types.DocumentAttributeVideo);
|
|
20
20
|
if (!video) {
|
|
21
|
-
|
|
21
|
+
unreachable();
|
|
22
22
|
}
|
|
23
23
|
const fileId_ = { type: FileType.Video, dcId: document.dc_id, fileReference: document.file_reference, location: { type: "common", id: document.id, accessHash: document.access_hash } };
|
|
24
24
|
const fileUniqueId = toUniqueFileId(fileId_);
|
|
@@ -27,6 +27,6 @@ export function constructStoryContent(media) {
|
|
|
27
27
|
return { video: video_ };
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
|
-
|
|
30
|
+
unreachable();
|
|
31
31
|
}
|
|
32
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.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";
|
|
@@ -16,7 +16,7 @@ export function constructStoryInteractiveArea(area) {
|
|
|
16
16
|
const position = constructStoryInteractiveAreaPosition(area.coordinates);
|
|
17
17
|
if (area instanceof types.MediaAreaGeoPoint) {
|
|
18
18
|
if (area.geo instanceof types.GeoPointEmpty) {
|
|
19
|
-
|
|
19
|
+
unreachable(); // will this ever be empty?
|
|
20
20
|
}
|
|
21
21
|
const location = constructLocation(area.geo);
|
|
22
22
|
return { position, location };
|
|
@@ -45,7 +45,7 @@ export function constructStoryInteractiveArea(area) {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
else {
|
|
48
|
-
|
|
48
|
+
unreachable();
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
function storyInteractiveAreaPositionToTlObject(position) {
|
|
@@ -87,12 +87,12 @@ export async function storyInteractiveAreaToTlObject(area, getEntity) {
|
|
|
87
87
|
else if ("messageReference" in area) {
|
|
88
88
|
const entity = await getEntity(chatIdToPeer(area.messageReference.chatId));
|
|
89
89
|
if (!(entity instanceof types.Channel)) {
|
|
90
|
-
|
|
90
|
+
unreachable();
|
|
91
91
|
}
|
|
92
92
|
const channel = new types.InputChannel({ channel_id: entity.id, access_hash: entity.access_hash ?? 0n });
|
|
93
93
|
return new types.InputMediaAreaChannelPost({ coordinates, channel, msg_id: area.messageReference.messageId });
|
|
94
94
|
}
|
|
95
95
|
else {
|
|
96
|
-
|
|
96
|
+
unreachable();
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
|
|
2
3
|
import { types } from "../2_tl.js";
|
|
3
4
|
import { constructChatP } from "./1_chat_p.js";
|
|
4
5
|
import { constructUser } from "./1_user.js";
|
|
@@ -6,12 +7,12 @@ import { constructChatMember } from "./2_chat_member.js";
|
|
|
6
7
|
import { constructInviteLink } from "./2_invite_link.js";
|
|
7
8
|
export async function constructChatMemberUpdated(update, getEntity) {
|
|
8
9
|
if (!update.prev_participant && !update.new_participant) {
|
|
9
|
-
|
|
10
|
+
unreachable();
|
|
10
11
|
}
|
|
11
12
|
const chat_ = await getEntity("channel_id" in update ? new types.PeerChannel(update) : new types.PeerChat(update));
|
|
12
13
|
const from_ = await getEntity(new types.PeerUser({ user_id: update.actor_id }));
|
|
13
14
|
if (!chat_ || !from_) {
|
|
14
|
-
|
|
15
|
+
unreachable();
|
|
15
16
|
}
|
|
16
17
|
const userPeer = new types.PeerUser(update);
|
|
17
18
|
const chat = constructChatP(chat_);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { cleanObject } from "../1_utilities.js";
|
|
2
3
|
import { types } from "../2_tl.js";
|
|
3
4
|
import { constructKeyboardButton, keyboardButtonToTlObject } from "./1_keyboard_button.js";
|
|
4
5
|
import { constructInlineKeyboardButton, inlineKeyboardButtonToTlObject } from "./2_inline_keyboard_button.js";
|
|
@@ -95,7 +96,7 @@ export function constructReplyMarkup(replyMarkup) {
|
|
|
95
96
|
return constructForceReply(replyMarkup);
|
|
96
97
|
}
|
|
97
98
|
else {
|
|
98
|
-
|
|
99
|
+
unreachable();
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
export async function replyMarkupToTlObject(replyMarkup, usernameResolver) {
|
|
@@ -112,6 +113,6 @@ export async function replyMarkupToTlObject(replyMarkup, usernameResolver) {
|
|
|
112
113
|
return forceReplyToTlObject(replyMarkup);
|
|
113
114
|
}
|
|
114
115
|
else {
|
|
115
|
-
|
|
116
|
+
unreachable();
|
|
116
117
|
}
|
|
117
118
|
}
|
package/esm/types/3_story.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
|
+
import { cleanObject, fromUnixTimestamp } from "../1_utilities.js";
|
|
2
3
|
import { constructMessageEntity } from "./0_message_entity.js";
|
|
3
4
|
import { constructChatP } from "./1_chat_p.js";
|
|
4
5
|
import { constructStoryPrivacy } from "./1_story_privacy.js";
|
|
@@ -9,7 +10,7 @@ export async function constructStory(story, peer, getEntity) {
|
|
|
9
10
|
const id = story.id;
|
|
10
11
|
const entity = await getEntity(peer);
|
|
11
12
|
if (!entity) {
|
|
12
|
-
|
|
13
|
+
unreachable();
|
|
13
14
|
}
|
|
14
15
|
const chat = constructChatP(entity);
|
|
15
16
|
const date = fromUnixTimestamp(story.date);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { unreachable } from "../0_deps.js";
|
|
2
2
|
import { types } from "../2_tl.js";
|
|
3
3
|
import { deserializeFileId } from "./_file_id.js";
|
|
4
4
|
import { replyMarkupToTlObject } from "./3_reply_markup.js";
|
|
@@ -182,7 +182,7 @@ export async function inlineQueryResultToTlObject(result_, parseText, usernameRe
|
|
|
182
182
|
title,
|
|
183
183
|
description,
|
|
184
184
|
document: new types.InputDocument({
|
|
185
|
-
id: "id" in fileId.location ? fileId.location.id :
|
|
185
|
+
id: "id" in fileId.location ? fileId.location.id : unreachable(),
|
|
186
186
|
access_hash: fileId.location.accessHash,
|
|
187
187
|
file_reference: fileId.fileReference ?? new Uint8Array(),
|
|
188
188
|
}),
|
|
@@ -223,7 +223,7 @@ export async function inlineQueryResultToTlObject(result_, parseText, usernameRe
|
|
|
223
223
|
}
|
|
224
224
|
else if (result_.type == "article") {
|
|
225
225
|
if (!("messageText" in result_.inputMessageContent)) {
|
|
226
|
-
|
|
226
|
+
unreachable();
|
|
227
227
|
}
|
|
228
228
|
const [message, entities] = await parseText(result_.inputMessageContent.messageText, { entities: result_.inputMessageContent.entities, parseMode: result_.inputMessageContent.parseMode });
|
|
229
229
|
const noWebpage = result_.inputMessageContent?.linkPreview?.disable ? true : undefined;
|
|
@@ -261,7 +261,7 @@ export async function inlineQueryResultToTlObject(result_, parseText, usernameRe
|
|
|
261
261
|
}
|
|
262
262
|
else if (result_.type == "venue") {
|
|
263
263
|
if (!result_.fourSquareId || !result_.foursquareType) {
|
|
264
|
-
|
|
264
|
+
unreachable();
|
|
265
265
|
}
|
|
266
266
|
return new types.InputBotInlineResult({
|
|
267
267
|
id,
|
|
@@ -281,6 +281,6 @@ export async function inlineQueryResultToTlObject(result_, parseText, usernameRe
|
|
|
281
281
|
});
|
|
282
282
|
}
|
|
283
283
|
else {
|
|
284
|
-
|
|
284
|
+
unreachable();
|
|
285
285
|
}
|
|
286
286
|
}
|