@mtkruto/node 0.0.801 → 0.0.821
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/_dnt.test_shims.d.ts +10 -0
- package/esm/client/client_plain.js +4 -3
- package/esm/connection/connection_web_socket.js +3 -1
- package/{types → esm}/mod.d.ts +1 -0
- package/esm/mod.js +1 -0
- package/esm/tl/0_tl_raw_reader_test.d.ts +1 -0
- package/esm/tl/0_tl_raw_writer_test.d.ts +1 -0
- package/{types → esm}/tl/1_tl_object.d.ts +5 -2
- package/esm/tl/1_tl_object.js +14 -7
- package/esm/tl/1_tl_object_test.d.ts +1 -0
- package/esm/tl/2_types_test.d.ts +1 -0
- package/esm/tl/3_deserialize_test.d.ts +1 -0
- package/esm/tl/3_functions_test.d.ts +1 -0
- package/esm/tl/3_tl_reader.js +1 -1
- package/esm/tl/3_tl_writer.js +2 -1
- package/esm/tl/5_message.js +2 -2
- package/esm/utilities/0_bigint_test.d.ts +1 -0
- package/esm/utilities/0_buffer_test.d.ts +1 -0
- package/esm/utilities/1_message.js +2 -2
- package/esm/utilities/1_password_test.d.ts +1 -0
- package/package.json +5 -12
- package/script/_dnt.shims.d.ts +10 -0
- package/script/_dnt.test_shims.d.ts +10 -0
- package/script/client/client.d.ts +50 -0
- package/script/client/client_abstract.d.ts +16 -0
- package/script/client/client_plain.d.ts +9 -0
- package/script/client/client_plain.js +4 -3
- package/script/connection/connection.d.ts +7 -0
- package/script/connection/connection_web_socket.d.ts +13 -0
- package/script/connection/connection_web_socket.js +3 -1
- package/script/constants.d.ts +12 -0
- package/script/deps/deno.land/std@0.186.0/fmt/colors.d.ts +270 -0
- package/script/deps/deno.land/std@0.186.0/testing/_diff.d.ts +26 -0
- package/script/deps/deno.land/std@0.186.0/testing/_format.d.ts +1 -0
- package/script/deps/deno.land/std@0.186.0/testing/asserts.d.ts +284 -0
- package/script/deps/deno.land/x/crc32@v0.2.0/mod.d.ts +15 -0
- package/script/deps/deno.land/x/tgcrypto@0.1.3/mod.d.ts +47 -0
- package/script/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +2 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.d.ts +16 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/utils/uint8.d.ts +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/deflate.d.ts +29 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/inflate.d.ts +23 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/mod.d.ts +2 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/adler32.d.ts +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/crc32.d.ts +2 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/deflate.d.ts +78 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/gzheader.d.ts +12 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inffast.d.ts +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inflate.d.ts +47 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inftrees.d.ts +1 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/messages.d.ts +12 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/status.d.ts +30 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/trees.d.ts +5 -0
- package/script/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/zstream.d.ts +14 -0
- package/script/deps.d.ts +4 -0
- package/script/mod.d.ts +24 -0
- package/script/mod.js +3 -1
- package/script/session/session.d.ts +12 -0
- package/script/session/session_local_storage.d.ts +7 -0
- package/script/session/session_memory.d.ts +5 -0
- package/script/tl/0_tl_raw_reader.d.ts +13 -0
- package/script/tl/0_tl_raw_reader_test.d.ts +1 -0
- package/script/tl/0_tl_raw_writer.d.ts +13 -0
- package/script/tl/0_tl_raw_writer_test.d.ts +1 -0
- package/script/tl/1_tl_object.d.ts +40 -0
- package/script/tl/1_tl_object.js +15 -8
- package/script/tl/1_tl_object_test.d.ts +1 -0
- package/script/tl/2_types.d.ts +14815 -0
- package/script/tl/2_types_test.d.ts +1 -0
- package/script/tl/3_deserialize.d.ts +3 -0
- package/script/tl/3_deserialize_test.d.ts +1 -0
- package/script/tl/3_functions.d.ts +6122 -0
- package/script/tl/3_functions_test.d.ts +1 -0
- package/script/tl/3_tl_reader.d.ts +6 -0
- package/script/tl/3_tl_reader.js +2 -2
- package/script/tl/3_tl_writer.d.ts +5 -0
- package/script/tl/3_tl_writer.js +2 -1
- package/script/tl/4_rpc_result.d.ts +8 -0
- package/script/tl/5_message.d.ts +11 -0
- package/script/tl/5_message.js +1 -1
- package/script/tl/6_message_container.d.ts +9 -0
- package/script/transport/transport.d.ts +15 -0
- package/script/transport/transport_abridged.d.ts +11 -0
- package/script/transport/transport_intermediate.d.ts +11 -0
- package/script/transport/transport_provider.d.ts +17 -0
- package/script/types.d.ts +1 -0
- package/script/utilities/0_bigint.d.ts +5 -0
- package/script/utilities/0_bigint_test.d.ts +1 -0
- package/script/utilities/0_buffer.d.ts +2 -0
- package/script/utilities/0_buffer_test.d.ts +1 -0
- package/script/utilities/0_crypto.d.ts +8 -0
- package/script/utilities/0_hash.d.ts +2 -0
- package/script/utilities/1_auth.d.ts +1 -0
- package/script/utilities/1_message.d.ts +10 -0
- package/script/utilities/1_message.js +1 -1
- package/script/utilities/1_obfuscation.d.ts +6 -0
- package/script/utilities/1_password.d.ts +11 -0
- package/script/utilities/1_password_test.d.ts +1 -0
- /package/{types → esm}/_dnt.shims.d.ts +0 -0
- /package/{types → esm}/client/client.d.ts +0 -0
- /package/{types → esm}/client/client_abstract.d.ts +0 -0
- /package/{types → esm}/client/client_plain.d.ts +0 -0
- /package/{types → esm}/connection/connection.d.ts +0 -0
- /package/{types → esm}/connection/connection_web_socket.d.ts +0 -0
- /package/{types → esm}/constants.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/std@0.186.0/fmt/colors.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/std@0.186.0/testing/_diff.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/std@0.186.0/testing/_format.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/std@0.186.0/testing/asserts.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/crc32@v0.2.0/mod.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/tgcrypto@0.1.3/mod.d.ts +0 -0
- /package/{types → esm}/deps/deno.land/x/tgcrypto@0.1.3/tgcrypto.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/utils/uint8.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/deflate.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/inflate.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/mod.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/adler32.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/crc32.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/deflate.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/gzheader.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inffast.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inflate.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/inftrees.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/messages.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/status.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/trees.d.ts +0 -0
- /package/{types → esm}/deps/raw.githubusercontent.com/MTKruto/compress/master/zlib/zlib/zstream.d.ts +0 -0
- /package/{types → esm}/deps.d.ts +0 -0
- /package/{types → esm}/session/session.d.ts +0 -0
- /package/{types → esm}/session/session_local_storage.d.ts +0 -0
- /package/{types → esm}/session/session_memory.d.ts +0 -0
- /package/{types → esm}/tl/0_tl_raw_reader.d.ts +0 -0
- /package/{types → esm}/tl/0_tl_raw_writer.d.ts +0 -0
- /package/{types → esm}/tl/2_types.d.ts +0 -0
- /package/{types/tl/3_tl_object_deserializer.d.ts → esm/tl/3_deserialize.d.ts} +0 -0
- /package/esm/tl/{3_tl_object_deserializer.js → 3_deserialize.js} +0 -0
- /package/{types → esm}/tl/3_functions.d.ts +0 -0
- /package/{types → esm}/tl/3_tl_reader.d.ts +0 -0
- /package/{types → esm}/tl/3_tl_writer.d.ts +0 -0
- /package/{types → esm}/tl/4_rpc_result.d.ts +0 -0
- /package/{types → esm}/tl/5_message.d.ts +0 -0
- /package/{types → esm}/tl/6_message_container.d.ts +0 -0
- /package/{types → esm}/transport/transport.d.ts +0 -0
- /package/{types → esm}/transport/transport_abridged.d.ts +0 -0
- /package/{types → esm}/transport/transport_intermediate.d.ts +0 -0
- /package/{types → esm}/transport/transport_provider.d.ts +0 -0
- /package/{types → esm}/types.d.ts +0 -0
- /package/{types → esm}/utilities/0_bigint.d.ts +0 -0
- /package/{types → esm}/utilities/0_buffer.d.ts +0 -0
- /package/{types → esm}/utilities/0_crypto.d.ts +0 -0
- /package/{types → esm}/utilities/0_hash.d.ts +0 -0
- /package/{types → esm}/utilities/1_auth.d.ts +0 -0
- /package/{types → esm}/utilities/1_message.d.ts +0 -0
- /package/{types → esm}/utilities/1_obfuscation.d.ts +0 -0
- /package/{types → esm}/utilities/1_password.d.ts +0 -0
- /package/script/tl/{3_tl_object_deserializer.js → 3_deserialize.js} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import STATUS from "./zlib/status.js";
|
|
2
|
+
import ZStream from "./zlib/zstream.js";
|
|
3
|
+
import GZheader from "./zlib/gzheader.js";
|
|
4
|
+
export interface InflateOptions {
|
|
5
|
+
windowBits?: number;
|
|
6
|
+
dictionary?: Uint8Array;
|
|
7
|
+
chunkSize?: number;
|
|
8
|
+
to?: string;
|
|
9
|
+
raw?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare class Inflate {
|
|
12
|
+
err: STATUS;
|
|
13
|
+
msg: string;
|
|
14
|
+
ended: boolean;
|
|
15
|
+
strm: ZStream;
|
|
16
|
+
options: any;
|
|
17
|
+
header: GZheader;
|
|
18
|
+
constructor(options: InflateOptions);
|
|
19
|
+
push(data: Uint8Array, mode: boolean | number): Uint8Array;
|
|
20
|
+
}
|
|
21
|
+
export declare function inflate(input: Uint8Array, options?: InflateOptions): Uint8Array;
|
|
22
|
+
export declare function inflateRaw(input: Uint8Array, options?: InflateOptions): Uint8Array;
|
|
23
|
+
export declare const gunzip: typeof inflate;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function adler32(adler: any, buf: any, len: any, pos: any): number;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { CODE } from "./messages.js";
|
|
2
|
+
import type ZStream from "./zstream.js";
|
|
3
|
+
import STATUS from "./status.js";
|
|
4
|
+
export interface Header {
|
|
5
|
+
text: boolean;
|
|
6
|
+
time: number;
|
|
7
|
+
os: number;
|
|
8
|
+
extra: string[];
|
|
9
|
+
name: string;
|
|
10
|
+
comment: string;
|
|
11
|
+
hcrc: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare class DeflateState {
|
|
14
|
+
strm: ZStream | null;
|
|
15
|
+
status: number;
|
|
16
|
+
pending_buf: any;
|
|
17
|
+
pending_buf_size: number;
|
|
18
|
+
pending_out: number;
|
|
19
|
+
pending: number;
|
|
20
|
+
wrap: number;
|
|
21
|
+
gzhead: Header | null;
|
|
22
|
+
gzindex: number;
|
|
23
|
+
method: number;
|
|
24
|
+
last_flush: number;
|
|
25
|
+
w_size: number;
|
|
26
|
+
w_bits: number;
|
|
27
|
+
w_mask: number;
|
|
28
|
+
window: any;
|
|
29
|
+
window_size: number;
|
|
30
|
+
prev: any;
|
|
31
|
+
head: any;
|
|
32
|
+
ins_h: number;
|
|
33
|
+
hash_size: number;
|
|
34
|
+
hash_bits: number;
|
|
35
|
+
hash_mask: number;
|
|
36
|
+
hash_shift: number;
|
|
37
|
+
block_start: number;
|
|
38
|
+
match_length: number;
|
|
39
|
+
prev_match: number;
|
|
40
|
+
match_available: number;
|
|
41
|
+
strstart: number;
|
|
42
|
+
match_start: number;
|
|
43
|
+
lookahead: number;
|
|
44
|
+
prev_length: number;
|
|
45
|
+
max_chain_length: number;
|
|
46
|
+
max_lazy_match: number;
|
|
47
|
+
level: number;
|
|
48
|
+
strategy: number;
|
|
49
|
+
good_match: number;
|
|
50
|
+
nice_match: number;
|
|
51
|
+
dyn_ltree: Uint16Array;
|
|
52
|
+
dyn_dtree: Uint16Array;
|
|
53
|
+
bl_tree: Uint16Array;
|
|
54
|
+
l_desc: null;
|
|
55
|
+
d_desc: null;
|
|
56
|
+
bl_desc: null;
|
|
57
|
+
bl_count: Uint16Array;
|
|
58
|
+
heap: Uint16Array;
|
|
59
|
+
heap_len: number;
|
|
60
|
+
heap_max: number;
|
|
61
|
+
depth: Uint16Array;
|
|
62
|
+
l_buf: number;
|
|
63
|
+
lit_bufsize: number;
|
|
64
|
+
last_lit: number;
|
|
65
|
+
d_buf: number;
|
|
66
|
+
opt_len: number;
|
|
67
|
+
static_len: number;
|
|
68
|
+
matches: number;
|
|
69
|
+
insert: number;
|
|
70
|
+
bi_buf: number;
|
|
71
|
+
bi_valid: number;
|
|
72
|
+
constructor();
|
|
73
|
+
}
|
|
74
|
+
export declare function deflateSetHeader(strm: ZStream, head: Header): 0 | -2;
|
|
75
|
+
export declare function deflateInit2(strm: ZStream, level: number, method: number, windowBits: number, memLevel: number, strategy: number): CODE;
|
|
76
|
+
export declare function deflate(strm: ZStream, flush: number): CODE | -2 | STATUS.Z_NO_FLUSH | STATUS.Z_PARTIAL_FLUSH;
|
|
77
|
+
export declare function deflateEnd(strm: ZStream): any;
|
|
78
|
+
export declare function deflateSetDictionary(strm: ZStream, dictionary: Uint8Array): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function inflate_fast(strm: any, start: number): void;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type ZStream from "./zstream.js";
|
|
2
|
+
export declare class InflateState {
|
|
3
|
+
mode: number;
|
|
4
|
+
last: boolean;
|
|
5
|
+
wrap: number;
|
|
6
|
+
havedict: boolean;
|
|
7
|
+
flags: number;
|
|
8
|
+
dmax: number;
|
|
9
|
+
check: number;
|
|
10
|
+
total: number;
|
|
11
|
+
head: null;
|
|
12
|
+
wbits: number;
|
|
13
|
+
wsize: number;
|
|
14
|
+
whave: number;
|
|
15
|
+
wnext: number;
|
|
16
|
+
window: null;
|
|
17
|
+
hold: number;
|
|
18
|
+
bits: number;
|
|
19
|
+
length: number;
|
|
20
|
+
offset: number;
|
|
21
|
+
extra: number;
|
|
22
|
+
lencode: null;
|
|
23
|
+
distcode: null;
|
|
24
|
+
lenbits: number;
|
|
25
|
+
distbits: number;
|
|
26
|
+
ncode: number;
|
|
27
|
+
nlen: number;
|
|
28
|
+
ndist: number;
|
|
29
|
+
have: number;
|
|
30
|
+
next: null;
|
|
31
|
+
lens: Uint16Array;
|
|
32
|
+
work: Uint16Array;
|
|
33
|
+
lendyn: null;
|
|
34
|
+
distdyn: null;
|
|
35
|
+
sane: number;
|
|
36
|
+
back: number;
|
|
37
|
+
was: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function inflateResetKeep(strm: ZStream): 0 | -2;
|
|
40
|
+
export declare function inflateReset(strm: ZStream): 0 | -2;
|
|
41
|
+
export declare function inflateReset2(strm: any, windowBits: any): 0 | -2;
|
|
42
|
+
export declare function inflateInit2(strm: ZStream, windowBits: any): number;
|
|
43
|
+
export declare function inflateInit(strm: ZStream): number;
|
|
44
|
+
export declare function inflate(strm: ZStream, flush: any): number;
|
|
45
|
+
export declare function inflateEnd(strm: ZStream): 0 | -2;
|
|
46
|
+
export declare function inflateGetHeader(strm: ZStream, head: any): 0 | -2;
|
|
47
|
+
export declare function inflateSetDictionary(strm: ZStream, dictionary: any): 0 | -2 | -3 | -4;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function inflate_table(type: any, lens: any, lens_index: any, codes: any, table: any, table_index: any, work: any, opts: any): 0 | 1 | -1;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
declare enum STATUS {
|
|
2
|
+
Z_NO_FLUSH = 0,
|
|
3
|
+
Z_PARTIAL_FLUSH = 1,
|
|
4
|
+
Z_SYNC_FLUSH = 2,
|
|
5
|
+
Z_FULL_FLUSH = 3,
|
|
6
|
+
Z_FINISH = 4,
|
|
7
|
+
Z_BLOCK = 5,
|
|
8
|
+
Z_TREES = 6,
|
|
9
|
+
Z_OK = 0,
|
|
10
|
+
Z_STREAM_END = 1,
|
|
11
|
+
Z_NEED_DICT = 2,
|
|
12
|
+
Z_ERRNO = -1,
|
|
13
|
+
Z_STREAM_ERROR = -2,
|
|
14
|
+
Z_DATA_ERROR = -3,
|
|
15
|
+
Z_BUF_ERROR = -5,
|
|
16
|
+
Z_NO_COMPRESSION = 0,
|
|
17
|
+
Z_BEST_SPEED = 1,
|
|
18
|
+
Z_BEST_COMPRESSION = 9,
|
|
19
|
+
Z_DEFAULT_COMPRESSION = -1,
|
|
20
|
+
Z_FILTERED = 1,
|
|
21
|
+
Z_HUFFMAN_ONLY = 2,
|
|
22
|
+
Z_RLE = 3,
|
|
23
|
+
Z_FIXED = 4,
|
|
24
|
+
Z_DEFAULT_STRATEGY = 0,
|
|
25
|
+
Z_BINARY = 0,
|
|
26
|
+
Z_TEXT = 1,
|
|
27
|
+
Z_UNKNOWN = 2,
|
|
28
|
+
Z_DEFLATED = 8
|
|
29
|
+
}
|
|
30
|
+
export default STATUS;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function _tr_init(s: any): void;
|
|
2
|
+
export declare function _tr_stored_block(s: any, buf: any, stored_len: any, last: any): void;
|
|
3
|
+
export declare function _tr_align(s: any): void;
|
|
4
|
+
export declare function _tr_flush_block(s: any, buf: any, stored_len: any, last: any): void;
|
|
5
|
+
export declare function _tr_tally(s: any, dist: any, lc: any): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export default class ZStream {
|
|
2
|
+
input: Uint8Array | null;
|
|
3
|
+
next_in: number;
|
|
4
|
+
avail_in: number;
|
|
5
|
+
total_in: number;
|
|
6
|
+
output: Uint8Array | null;
|
|
7
|
+
next_out: number;
|
|
8
|
+
avail_out: number;
|
|
9
|
+
total_out: number;
|
|
10
|
+
msg: string;
|
|
11
|
+
state: any;
|
|
12
|
+
data_type: number;
|
|
13
|
+
adler: number;
|
|
14
|
+
}
|
package/script/deps.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from "./deps/deno.land/std@0.186.0/testing/asserts.js";
|
|
2
|
+
export { ctr256Decrypt, ctr256Encrypt, factorize, ige256Decrypt, ige256Encrypt, init as initTgCrypto } from "./deps/deno.land/x/tgcrypto@0.1.3/mod.js";
|
|
3
|
+
export { gunzip, gzip } from "./deps/raw.githubusercontent.com/MTKruto/compress/master/gzip/gzip.js";
|
|
4
|
+
export { Mutex } from "async-mutex";
|
package/script/mod.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { checkPassword } from "./utilities/1_password.js";
|
|
2
|
+
import { getRandomId } from "./utilities/0_bigint.js";
|
|
3
|
+
export declare const utils: {
|
|
4
|
+
checkPassword: typeof checkPassword;
|
|
5
|
+
getRandomId: typeof getRandomId;
|
|
6
|
+
};
|
|
7
|
+
export { as } from "./tl/1_tl_object.js";
|
|
8
|
+
export * as types from "./tl/2_types.js";
|
|
9
|
+
export * as functions from "./tl/3_functions.js";
|
|
10
|
+
export * from "./tl/4_rpc_result.js";
|
|
11
|
+
export * from "./tl/5_message.js";
|
|
12
|
+
export * from "./tl/6_message_container.js";
|
|
13
|
+
export * from "./client/client_plain.js";
|
|
14
|
+
export * from "./client/client.js";
|
|
15
|
+
export * from "./session/session.js";
|
|
16
|
+
export * from "./session/session_memory.js";
|
|
17
|
+
export * from "./session/session_local_storage.js";
|
|
18
|
+
export * from "./transport/transport_abridged.js";
|
|
19
|
+
export * from "./transport/transport_intermediate.js";
|
|
20
|
+
export * from "./transport/transport.js";
|
|
21
|
+
export * from "./transport/transport_provider.js";
|
|
22
|
+
export * from "./connection/connection.js";
|
|
23
|
+
export * from "./connection/connection_web_socket.js";
|
|
24
|
+
export { DEFAULT_APP_VERSION, DEFAULT_DEVICE_MODEL, DEFAULT_INITIAL_DC, DEFAULT_LANG_CODE, DEFAULT_LANG_PACK, DEFAULT_SYSTEM_LANG_CODE, DEFAULT_SYSTEM_VERSION, LAYER } from "./constants.js";
|
package/script/mod.js
CHANGED
|
@@ -26,10 +26,12 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
26
26
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.LAYER = exports.DEFAULT_SYSTEM_VERSION = exports.DEFAULT_SYSTEM_LANG_CODE = exports.DEFAULT_LANG_PACK = exports.DEFAULT_LANG_CODE = exports.DEFAULT_INITIAL_DC = exports.DEFAULT_DEVICE_MODEL = exports.DEFAULT_APP_VERSION = exports.functions = exports.types = exports.utils = void 0;
|
|
29
|
+
exports.LAYER = exports.DEFAULT_SYSTEM_VERSION = exports.DEFAULT_SYSTEM_LANG_CODE = exports.DEFAULT_LANG_PACK = exports.DEFAULT_LANG_CODE = exports.DEFAULT_INITIAL_DC = exports.DEFAULT_DEVICE_MODEL = exports.DEFAULT_APP_VERSION = exports.functions = exports.types = exports.as = exports.utils = void 0;
|
|
30
30
|
const _1_password_js_1 = require("./utilities/1_password.js");
|
|
31
31
|
const _0_bigint_js_1 = require("./utilities/0_bigint.js");
|
|
32
32
|
exports.utils = { checkPassword: _1_password_js_1.checkPassword, getRandomId: _0_bigint_js_1.getRandomId };
|
|
33
|
+
var _1_tl_object_js_1 = require("./tl/1_tl_object.js");
|
|
34
|
+
Object.defineProperty(exports, "as", { enumerable: true, get: function () { return _1_tl_object_js_1.as; } });
|
|
33
35
|
exports.types = __importStar(require("./tl/2_types.js"));
|
|
34
36
|
exports.functions = __importStar(require("./tl/3_functions.js"));
|
|
35
37
|
__exportStar(require("./tl/4_rpc_result.js"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { MaybePromise } from "../types.js";
|
|
2
|
+
import { DC } from "../transport/transport_provider.js";
|
|
3
|
+
export declare abstract class Session {
|
|
4
|
+
dc: DC | null;
|
|
5
|
+
private _authKeyId;
|
|
6
|
+
private _authKey;
|
|
7
|
+
abstract load(): MaybePromise<void>;
|
|
8
|
+
abstract save(): MaybePromise<void>;
|
|
9
|
+
get authKeyId(): Promise<bigint | null>;
|
|
10
|
+
set authKey(authKey: Uint8Array | null);
|
|
11
|
+
get authKey(): Uint8Array | null;
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class TLRawReader {
|
|
2
|
+
protected _buffer: Uint8Array;
|
|
3
|
+
constructor(_buffer: Uint8Array);
|
|
4
|
+
get buffer(): Uint8Array;
|
|
5
|
+
read(count: number): Uint8Array;
|
|
6
|
+
readInt24(signed?: boolean): number;
|
|
7
|
+
readInt32(signed?: boolean): number;
|
|
8
|
+
readInt64(signed?: boolean): bigint;
|
|
9
|
+
readInt128(signed?: boolean): bigint;
|
|
10
|
+
readInt256(signed?: boolean): bigint;
|
|
11
|
+
readBytes(): Uint8Array;
|
|
12
|
+
readString(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class TLRawWriter {
|
|
2
|
+
protected _buffer: Uint8Array;
|
|
3
|
+
constructor();
|
|
4
|
+
get buffer(): Uint8Array;
|
|
5
|
+
write(buffer: Uint8Array): this;
|
|
6
|
+
writeInt24(int: number, signed?: boolean): this;
|
|
7
|
+
writeInt32(int: number, signed?: boolean): this;
|
|
8
|
+
writeInt64(int: bigint, signed?: boolean): this;
|
|
9
|
+
writeInt128(int: bigint, signed?: boolean): this;
|
|
10
|
+
writeInt256(int: bigint, signed?: boolean): this;
|
|
11
|
+
writeBytes(bytes: Uint8Array): this;
|
|
12
|
+
writeString(string: string): this;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type MaybeArrayOf<T> = T | T[];
|
|
2
|
+
type MaybeInArray<T> = T | [T];
|
|
3
|
+
export type ParamDesc = ([
|
|
4
|
+
string,
|
|
5
|
+
MaybeInArray<typeof TLObject | typeof Uint8Array | "string" | "number" | "bigint" | "boolean" | "true">,
|
|
6
|
+
string
|
|
7
|
+
] | [string, typeof flags, "#"])[];
|
|
8
|
+
export type Param = null | MaybeArrayOf<string | number | bigint | boolean | Uint8Array | TLObject>;
|
|
9
|
+
export declare const flags: unique symbol;
|
|
10
|
+
export type Params = ([
|
|
11
|
+
Param,
|
|
12
|
+
MaybeInArray<typeof TLObject | typeof Uint8Array | "string" | "number" | "bigint" | "boolean" | "true">,
|
|
13
|
+
string
|
|
14
|
+
] | [string, typeof flags, "#"])[];
|
|
15
|
+
export declare const id: unique symbol;
|
|
16
|
+
export declare const params: unique symbol;
|
|
17
|
+
export declare const paramDesc: unique symbol;
|
|
18
|
+
export declare const length: unique symbol;
|
|
19
|
+
export declare const serialize: unique symbol;
|
|
20
|
+
export declare const as: unique symbol;
|
|
21
|
+
export declare function isOptionalParam(ntype: string): boolean;
|
|
22
|
+
export declare function analyzeOptionalParam(ntype: string): {
|
|
23
|
+
flagField: string;
|
|
24
|
+
bitIndex: number;
|
|
25
|
+
};
|
|
26
|
+
export declare abstract class TLObject {
|
|
27
|
+
protected abstract get [id](): number;
|
|
28
|
+
protected abstract get [params](): Params;
|
|
29
|
+
protected static get [paramDesc](): ParamDesc;
|
|
30
|
+
get [length](): number;
|
|
31
|
+
[serialize](): Uint8Array;
|
|
32
|
+
[as]<T extends TLObjectConstructor<InstanceType<T>>>(constructor: T): InstanceType<T>;
|
|
33
|
+
}
|
|
34
|
+
export type MaybeVectorTLObject = TLObject | Array<MaybeVectorTLObject | TLObject>;
|
|
35
|
+
export interface TLObjectConstructor<T = TLObject> {
|
|
36
|
+
new (params: any): T;
|
|
37
|
+
[paramDesc]: ParamDesc;
|
|
38
|
+
}
|
|
39
|
+
export declare function isTLObjectConstructor(t: unknown): t is typeof TLObject;
|
|
40
|
+
export {};
|
package/script/tl/1_tl_object.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isTLObjectConstructor = exports.TLObject = exports.analyzeOptionalParam = exports.isOptionalParam = exports.length = exports.paramDesc = exports.params = exports.id = exports.flags = void 0;
|
|
3
|
+
exports.isTLObjectConstructor = exports.TLObject = exports.analyzeOptionalParam = exports.isOptionalParam = exports.as = exports.serialize = exports.length = exports.paramDesc = exports.params = exports.id = exports.flags = void 0;
|
|
4
4
|
const deps_js_1 = require("../deps.js");
|
|
5
5
|
const _0_tl_raw_writer_js_1 = require("./0_tl_raw_writer.js");
|
|
6
6
|
exports.flags = Symbol("flags");
|
|
@@ -8,6 +8,8 @@ exports.id = Symbol("id");
|
|
|
8
8
|
exports.params = Symbol("params");
|
|
9
9
|
exports.paramDesc = Symbol("paramDesc");
|
|
10
10
|
exports.length = Symbol("length");
|
|
11
|
+
exports.serialize = Symbol();
|
|
12
|
+
exports.as = Symbol();
|
|
11
13
|
function isOptionalParam(ntype) {
|
|
12
14
|
return ntype.includes("?");
|
|
13
15
|
}
|
|
@@ -27,7 +29,7 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
27
29
|
if (isTLObjectConstructor(type)) {
|
|
28
30
|
if ((type.name == "TypeX" && value instanceof TLObject) ||
|
|
29
31
|
value instanceof type) {
|
|
30
|
-
writer.write(value.serialize());
|
|
32
|
+
writer.write(value[exports.serialize]());
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
35
|
else {
|
|
@@ -92,10 +94,7 @@ function serializeSingleParam(writer, value, type, ntype) {
|
|
|
92
94
|
}
|
|
93
95
|
break;
|
|
94
96
|
case "true":
|
|
95
|
-
if (value
|
|
96
|
-
writer.writeInt32(0x997275B5);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
97
|
+
if (value !== true) {
|
|
99
98
|
throw new TypeError("Expected true");
|
|
100
99
|
}
|
|
101
100
|
}
|
|
@@ -106,9 +105,9 @@ class TLObject {
|
|
|
106
105
|
return [];
|
|
107
106
|
}
|
|
108
107
|
get [exports.length]() {
|
|
109
|
-
return this.serialize().byteLength;
|
|
108
|
+
return this[exports.serialize]().byteLength;
|
|
110
109
|
}
|
|
111
|
-
serialize() {
|
|
110
|
+
[exports.serialize]() {
|
|
112
111
|
const writer = new _0_tl_raw_writer_js_1.TLRawWriter();
|
|
113
112
|
writer.writeInt32(this[exports.id], false);
|
|
114
113
|
for (const [value, type, ntype] of this[exports.params]) {
|
|
@@ -147,6 +146,14 @@ class TLObject {
|
|
|
147
146
|
}
|
|
148
147
|
return writer.buffer;
|
|
149
148
|
}
|
|
149
|
+
[exports.as](constructor) {
|
|
150
|
+
if (this instanceof constructor) {
|
|
151
|
+
return this;
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
throw new TypeError(`Expected ${constructor.name}, got ${this.constructor.name}`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
150
157
|
}
|
|
151
158
|
exports.TLObject = TLObject;
|
|
152
159
|
function isTLObjectConstructor(t) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|