@mtkruto/node 0.67.2 → 0.68.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_errors.js +2 -6
- package/esm/3_errors.js +2 -12
- package/esm/3_types.d.ts +1 -0
- package/esm/3_types.d.ts.map +1 -1
- package/esm/3_types.js +1 -0
- package/esm/4_errors.js +2 -12
- package/esm/_dnt.polyfills.d.ts +99 -0
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +127 -1
- package/esm/_dnt.test_polyfills.d.ts.map +1 -0
- package/esm/client/0_filters_test.d.ts.map +1 -1
- package/esm/client/0_markdown_test.d.ts.map +1 -1
- package/esm/client/0_params.d.ts +2 -0
- package/esm/client/0_params.d.ts.map +1 -1
- package/esm/client/0_password.d.ts +5 -5
- package/esm/client/0_password.d.ts.map +1 -1
- package/esm/client/0_password_test.d.ts.map +1 -1
- package/esm/client/0_storage_operations.js +143 -155
- package/esm/client/0_storage_operations_test.d.ts.map +1 -1
- package/esm/client/0_utilities.d.ts +1 -1
- package/esm/client/0_utilities_test.d.ts.map +1 -1
- package/esm/client/1_client_plain.js +4 -22
- package/esm/client/1_composer.js +8 -21
- package/esm/client/2_account_manager.js +85 -97
- package/esm/client/2_bot_info_manager.js +26 -38
- package/esm/client/2_business_connection_manager.js +10 -23
- package/esm/client/2_client_encrypted.js +194 -211
- package/esm/client/2_file_manager.d.ts +4 -3
- package/esm/client/2_file_manager.d.ts.map +1 -1
- package/esm/client/2_file_manager.js +268 -224
- package/esm/client/2_file_manager_test.d.ts.map +1 -1
- package/esm/client/2_network_statistics_manager.js +8 -21
- package/esm/client/2_payment_manager.js +7 -20
- package/esm/client/2_reaction_manager.js +7 -20
- package/esm/client/2_translations_manager.js +97 -107
- package/esm/client/2_update_manager.js +764 -759
- package/esm/client/3_client_encrypted_pool.js +10 -26
- package/esm/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/esm/client/3_message_manager.d.ts +1 -1
- package/esm/client/3_message_manager.js +441 -448
- package/esm/client/3_message_manager_test.d.ts.map +1 -1
- package/esm/client/3_video_chat_manager.d.ts +1 -1
- package/esm/client/3_video_chat_manager.js +57 -68
- package/esm/client/4_callback_query_manager.js +18 -30
- package/esm/client/4_chat_list_manager.js +322 -318
- package/esm/client/4_chat_manager.js +118 -131
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.js +16 -29
- package/esm/client/4_inline_query_manager.js +16 -28
- package/esm/client/4_link_preview_manager.js +6 -19
- package/esm/client/4_poll_manager.js +44 -57
- package/esm/client/4_story_manager.js +41 -53
- package/esm/client/5_client.d.ts +7 -0
- package/esm/client/5_client.d.ts.map +1 -1
- package/esm/client/5_client.js +1269 -1288
- package/esm/connection/1_connection_tcp.node.js +48 -65
- package/esm/connection/1_connection_web_socket.js +75 -91
- package/esm/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/esm/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- package/esm/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/esm/mod.js +2 -12
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.js +324 -320
- package/esm/storage/1_utilities_test.d.ts.map +1 -1
- package/esm/storage/2_storage_indexed_db.js +26 -44
- package/esm/storage/2_storage_local_storage.node.js +12 -25
- package/esm/storage/2_storage_memory.js +24 -41
- package/esm/storage/2_storage_session_storage.js +3 -16
- package/esm/tl/0_utilities_test.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +80 -88
- package/esm/tl/1_tl_reader_test.d.ts.map +1 -1
- package/esm/tl/1_tl_writer.js +155 -164
- package/esm/tl/1_tl_writer_test.d.ts.map +1 -1
- package/esm/transport/0_transport.js +1 -8
- package/esm/transport/1_transport_abridged.js +11 -24
- package/esm/transport/1_transport_intermediate.js +10 -23
- package/esm/transport/2_transport_provider_web_socket.d.ts.map +1 -1
- package/esm/types/0_upload_progress.d.ts +29 -0
- package/esm/types/0_upload_progress.d.ts.map +1 -0
- package/esm/types/0_upload_progress.js +20 -0
- package/esm/types/1_sticker.d.ts +1 -1
- package/esm/types/1_sticker.d.ts.map +1 -1
- package/esm/types/2_poll_answer.d.ts +19 -0
- package/esm/types/2_poll_answer.d.ts.map +1 -1
- package/esm/types/2_poll_answer.js +19 -0
- package/esm/types/7_update.d.ts +21 -2
- package/esm/types/7_update.d.ts.map +1 -1
- package/esm/utilities/0_bigint_test.d.ts.map +1 -1
- package/esm/utilities/0_buffer.d.ts +1 -1
- package/esm/utilities/0_buffer.d.ts.map +1 -1
- package/esm/utilities/0_buffer_test.d.ts.map +1 -1
- package/esm/utilities/0_hash.d.ts +2 -2
- package/esm/utilities/0_hash.d.ts.map +1 -1
- package/esm/utilities/0_mutex.js +4 -19
- package/esm/utilities/0_part_stream.js +11 -25
- package/esm/utilities/0_part_stream_test.d.ts.map +1 -1
- package/esm/utilities/0_rle.d.ts +2 -2
- package/esm/utilities/0_rle.d.ts.map +1 -1
- package/esm/utilities/0_rle_test.d.ts.map +1 -1
- package/esm/utilities/0_text.d.ts +20 -1
- package/esm/utilities/0_text.d.ts.map +1 -1
- package/esm/utilities/0_text.js +19 -0
- package/esm/utilities/1_auth.d.ts +1 -1
- package/esm/utilities/1_auth.d.ts.map +1 -1
- package/esm/utilities/1_base64.d.ts +1 -1
- package/esm/utilities/1_base64.d.ts.map +1 -1
- package/esm/utilities/1_base64_test.d.ts.map +1 -1
- package/esm/utilities/1_crypto.js +42 -53
- package/esm/utilities/1_crypto_test.d.ts.map +1 -1
- package/esm/utilities/1_logger.d.ts +2 -2
- package/esm/utilities/1_math_test.d.ts.map +1 -1
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_errors.js +2 -6
- package/script/2_tl.js +17 -7
- package/script/3_errors.js +2 -12
- package/script/3_types.d.ts +1 -0
- package/script/3_types.d.ts.map +1 -1
- package/script/3_types.js +1 -0
- package/script/4_constants.js +17 -7
- package/script/4_errors.js +2 -12
- package/script/_dnt.polyfills.d.ts +99 -0
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +128 -0
- package/script/_dnt.test_polyfills.d.ts.map +1 -0
- package/script/client/0_filters_test.d.ts.map +1 -1
- package/script/client/0_markdown_test.d.ts.map +1 -1
- package/script/client/0_params.d.ts +2 -0
- package/script/client/0_params.d.ts.map +1 -1
- package/script/client/0_password.d.ts +5 -5
- package/script/client/0_password.d.ts.map +1 -1
- package/script/client/0_password.js +17 -7
- package/script/client/0_password_test.d.ts.map +1 -1
- package/script/client/0_storage_operations.js +143 -155
- package/script/client/0_storage_operations_test.d.ts.map +1 -1
- package/script/client/0_utilities.d.ts +1 -1
- package/script/client/0_utilities_test.d.ts.map +1 -1
- package/script/client/1_client_plain.js +4 -22
- package/script/client/1_composer.js +8 -21
- package/script/client/2_account_manager.js +85 -97
- package/script/client/2_bot_info_manager.js +26 -38
- package/script/client/2_business_connection_manager.js +10 -23
- package/script/client/2_client_encrypted.js +195 -212
- package/script/client/2_file_manager.d.ts +4 -3
- package/script/client/2_file_manager.d.ts.map +1 -1
- package/script/client/2_file_manager.js +285 -231
- package/script/client/2_file_manager_test.d.ts.map +1 -1
- package/script/client/2_network_statistics_manager.js +8 -21
- package/script/client/2_payment_manager.js +7 -20
- package/script/client/2_reaction_manager.js +7 -20
- package/script/client/2_translations_manager.js +98 -108
- package/script/client/2_update_manager.js +764 -759
- package/script/client/3_client_encrypted_pool.js +10 -26
- package/script/client/3_client_encrypted_pool_test.d.ts.map +1 -1
- package/script/client/3_message_manager.d.ts +1 -1
- package/script/client/3_message_manager.js +441 -448
- package/script/client/3_message_manager_test.d.ts.map +1 -1
- package/script/client/3_video_chat_manager.d.ts +1 -1
- package/script/client/3_video_chat_manager.js +57 -68
- package/script/client/4_callback_query_manager.js +18 -30
- package/script/client/4_chat_list_manager.js +322 -318
- package/script/client/4_chat_manager.js +118 -131
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.js +16 -29
- package/script/client/4_inline_query_manager.js +16 -28
- package/script/client/4_link_preview_manager.js +6 -19
- package/script/client/4_poll_manager.js +44 -57
- package/script/client/4_story_manager.js +41 -53
- package/script/client/5_client.d.ts +7 -0
- package/script/client/5_client.d.ts.map +1 -1
- package/script/client/5_client.js +1269 -1288
- package/script/connection/1_connection_tcp.node.js +48 -65
- package/script/connection/1_connection_web_socket.js +92 -98
- package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/script/deps/jsr.io/@std/assert/1.0.13/equal.js +17 -7
- package/script/deps/jsr.io/@std/async/1.0.13/delay.js +17 -7
- package/script/deps/jsr.io/@std/async/1.0.13/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/1.0.13/tee.js +11 -34
- package/script/deps/jsr.io/@std/datetime/0.225.5/_date_time_formatter.js +4 -17
- package/script/deps/jsr.io/@std/internal/1.0.10/format.js +17 -7
- package/script/deps/jsr.io/@std/internal/1.0.10/styles.js +17 -7
- package/script/deps/jsr.io/@std/path/1.1.0/_os.js +17 -7
- package/script/mod.js +19 -19
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.js +66 -79
- package/script/session/2_session_encrypted.js +325 -321
- package/script/storage/1_utilities_test.d.ts.map +1 -1
- package/script/storage/2_storage_indexed_db.js +26 -44
- package/script/storage/2_storage_local_storage.node.js +12 -25
- package/script/storage/2_storage_memory.js +24 -41
- package/script/storage/2_storage_session_storage.js +3 -16
- package/script/tl/0_utilities_test.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +81 -89
- package/script/tl/1_tl_reader_test.d.ts.map +1 -1
- package/script/tl/1_tl_writer.js +156 -165
- package/script/tl/1_tl_writer_test.d.ts.map +1 -1
- package/script/tl/2_telegram.js +17 -7
- package/script/transport/0_obfuscation.js +17 -7
- package/script/transport/0_transport.js +1 -8
- package/script/transport/1_transport_abridged.js +11 -24
- package/script/transport/1_transport_intermediate.js +10 -23
- package/script/transport/2_transport_provider_web_socket.d.ts.map +1 -1
- package/script/types/0_upload_progress.d.ts +29 -0
- package/script/types/0_upload_progress.d.ts.map +1 -0
- package/script/types/0_upload_progress.js +21 -0
- package/script/types/1_sticker.d.ts +1 -1
- package/script/types/1_sticker.d.ts.map +1 -1
- package/script/types/2_poll_answer.d.ts +19 -0
- package/script/types/2_poll_answer.d.ts.map +1 -1
- package/script/types/2_poll_answer.js +19 -0
- package/script/types/7_update.d.ts +21 -2
- package/script/types/7_update.d.ts.map +1 -1
- package/script/utilities/0_bigint.js +17 -7
- package/script/utilities/0_bigint_test.d.ts.map +1 -1
- package/script/utilities/0_buffer.d.ts +1 -1
- package/script/utilities/0_buffer.d.ts.map +1 -1
- package/script/utilities/0_buffer_test.d.ts.map +1 -1
- package/script/utilities/0_env.js +17 -7
- package/script/utilities/0_hash.d.ts +2 -2
- package/script/utilities/0_hash.d.ts.map +1 -1
- package/script/utilities/0_hash.js +17 -7
- package/script/utilities/0_misc.js +17 -7
- package/script/utilities/0_mutex.js +4 -19
- package/script/utilities/0_part_stream.js +11 -25
- package/script/utilities/0_part_stream_test.d.ts.map +1 -1
- package/script/utilities/0_rle.d.ts +2 -2
- package/script/utilities/0_rle.d.ts.map +1 -1
- package/script/utilities/0_rle_test.d.ts.map +1 -1
- package/script/utilities/0_text.d.ts +20 -1
- package/script/utilities/0_text.d.ts.map +1 -1
- package/script/utilities/0_text.js +19 -0
- package/script/utilities/1_auth.d.ts +1 -1
- package/script/utilities/1_auth.d.ts.map +1 -1
- package/script/utilities/1_auth.js +17 -7
- package/script/utilities/1_base64.d.ts +1 -1
- package/script/utilities/1_base64.d.ts.map +1 -1
- package/script/utilities/1_base64_test.d.ts.map +1 -1
- package/script/utilities/1_crypto.js +60 -61
- package/script/utilities/1_crypto_test.d.ts.map +1 -1
- package/script/utilities/1_logger.d.ts +2 -2
- package/script/utilities/1_math_test.d.ts.map +1 -1
- package/script/utilities/2_queue.js +30 -48
|
@@ -1,60 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
5
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
6
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
8
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
9
|
-
};
|
|
10
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
-
};
|
|
15
|
-
var _Queue_source, _Queue_queue;
|
|
16
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
5
|
exports.tee = tee;
|
|
18
6
|
class Queue {
|
|
7
|
+
#source;
|
|
8
|
+
#queue;
|
|
9
|
+
head;
|
|
10
|
+
done;
|
|
19
11
|
constructor(iterable) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.defineProperty(this, "head", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
configurable: true,
|
|
25
|
-
writable: true,
|
|
26
|
-
value: void 0
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(this, "done", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
configurable: true,
|
|
31
|
-
writable: true,
|
|
32
|
-
value: void 0
|
|
33
|
-
});
|
|
34
|
-
__classPrivateFieldSet(this, _Queue_source, iterable[Symbol.asyncIterator](), "f");
|
|
35
|
-
__classPrivateFieldSet(this, _Queue_queue, {
|
|
12
|
+
this.#source = iterable[Symbol.asyncIterator]();
|
|
13
|
+
this.#queue = {
|
|
36
14
|
value: undefined,
|
|
37
15
|
next: undefined,
|
|
38
|
-
}
|
|
39
|
-
this.head =
|
|
16
|
+
};
|
|
17
|
+
this.head = this.#queue;
|
|
40
18
|
this.done = false;
|
|
41
19
|
}
|
|
42
20
|
async next() {
|
|
43
|
-
const result = await
|
|
21
|
+
const result = await this.#source.next();
|
|
44
22
|
if (!result.done) {
|
|
45
23
|
const nextNode = {
|
|
46
24
|
value: result.value,
|
|
47
25
|
next: undefined,
|
|
48
26
|
};
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
this.#queue.next = nextNode;
|
|
28
|
+
this.#queue = nextNode;
|
|
51
29
|
}
|
|
52
30
|
else {
|
|
53
31
|
this.done = true;
|
|
54
32
|
}
|
|
55
33
|
}
|
|
56
34
|
}
|
|
57
|
-
_Queue_source = new WeakMap(), _Queue_queue = new WeakMap();
|
|
58
35
|
/**
|
|
59
36
|
* Branches the given async iterable into the `n` branches.
|
|
60
37
|
*
|
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright 2018-2025 the Deno authors. MIT license.
|
|
3
3
|
// This module is browser compatible.
|
|
4
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
5
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
6
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
7
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
8
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
9
|
-
};
|
|
10
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
11
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
12
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
13
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
14
|
-
};
|
|
15
|
-
var _DateTimeFormatter_formatParts;
|
|
16
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
5
|
exports.DateTimeFormatter = void 0;
|
|
18
6
|
function digits(value, count = 2) {
|
|
@@ -137,14 +125,14 @@ function sortDateTimeFormatParts(parts) {
|
|
|
137
125
|
return result;
|
|
138
126
|
}
|
|
139
127
|
class DateTimeFormatter {
|
|
128
|
+
#formatParts;
|
|
140
129
|
constructor(formatString) {
|
|
141
|
-
|
|
142
|
-
__classPrivateFieldSet(this, _DateTimeFormatter_formatParts, formatToFormatParts(formatString), "f");
|
|
130
|
+
this.#formatParts = formatToFormatParts(formatString);
|
|
143
131
|
}
|
|
144
132
|
format(date, options = {}) {
|
|
145
133
|
let string = "";
|
|
146
134
|
const utc = options.timeZone === "UTC";
|
|
147
|
-
for (const part of
|
|
135
|
+
for (const part of this.#formatParts) {
|
|
148
136
|
const type = part.type;
|
|
149
137
|
switch (type) {
|
|
150
138
|
case "year": {
|
|
@@ -277,7 +265,7 @@ class DateTimeFormatter {
|
|
|
277
265
|
}
|
|
278
266
|
formatToParts(string) {
|
|
279
267
|
const parts = [];
|
|
280
|
-
for (const part of
|
|
268
|
+
for (const part of this.#formatParts) {
|
|
281
269
|
const type = part.type;
|
|
282
270
|
let length = 0;
|
|
283
271
|
let value = "";
|
|
@@ -551,4 +539,3 @@ class DateTimeFormatter {
|
|
|
551
539
|
}
|
|
552
540
|
}
|
|
553
541
|
exports.DateTimeFormatter = DateTimeFormatter;
|
|
554
|
-
_DateTimeFormatter_formatParts = new WeakMap();
|
|
@@ -17,13 +17,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
17
17
|
}) : function(o, v) {
|
|
18
18
|
o["default"] = v;
|
|
19
19
|
});
|
|
20
|
-
var __importStar = (this && this.__importStar) || function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
};
|
|
20
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
21
|
+
var ownKeys = function(o) {
|
|
22
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
23
|
+
var ar = [];
|
|
24
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
25
|
+
return ar;
|
|
26
|
+
};
|
|
27
|
+
return ownKeys(o);
|
|
28
|
+
};
|
|
29
|
+
return function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
27
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
38
|
exports.format = format;
|
|
29
39
|
/** An inspect function conforming to the shape of `Deno.inspect` and `node:util`'s `inspect` */
|
|
@@ -19,13 +19,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
19
19
|
}) : function(o, v) {
|
|
20
20
|
o["default"] = v;
|
|
21
21
|
});
|
|
22
|
-
var __importStar = (this && this.__importStar) || function (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
29
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
40
|
exports.bold = bold;
|
|
31
41
|
exports.red = red;
|
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
}) : function(o, v) {
|
|
19
19
|
o["default"] = v;
|
|
20
20
|
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.isWindows = void 0;
|
|
30
40
|
// Check Deno, then the remaining runtimes (e.g. Node, Bun and the browser)
|
package/script/mod.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
|
@@ -78,19 +88,9 @@ if (!("CompressionStream" in dntShim.dntGlobalThis)) {
|
|
|
78
88
|
// original idea: MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource>
|
|
79
89
|
// @see https://github.com/oven-sh/bun/issues/1723#issuecomment-1774174194
|
|
80
90
|
class Stream {
|
|
91
|
+
readable;
|
|
92
|
+
writable;
|
|
81
93
|
constructor(compress, format) {
|
|
82
|
-
Object.defineProperty(this, "readable", {
|
|
83
|
-
enumerable: true,
|
|
84
|
-
configurable: true,
|
|
85
|
-
writable: true,
|
|
86
|
-
value: void 0
|
|
87
|
-
});
|
|
88
|
-
Object.defineProperty(this, "writable", {
|
|
89
|
-
enumerable: true,
|
|
90
|
-
configurable: true,
|
|
91
|
-
writable: true,
|
|
92
|
-
value: void 0
|
|
93
|
-
});
|
|
94
94
|
let handler;
|
|
95
95
|
if (format === "gzip") {
|
|
96
96
|
handler = compress ? (0, node_zlib_1.createGzip)() : (0, node_zlib_1.createGunzip)();
|
|
@@ -18,64 +18,38 @@
|
|
|
18
18
|
* You should have received a copy of the GNU Lesser General Public License
|
|
19
19
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
20
20
|
*/
|
|
21
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
22
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
23
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
24
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
25
|
-
};
|
|
26
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
27
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
29
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
30
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
31
|
-
};
|
|
32
|
-
var _SessionState_seqNo, _SessionState_messageId;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.SessionState = void 0;
|
|
35
23
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
36
24
|
class SessionState {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
writable: true,
|
|
42
|
-
value: 0
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(this, "serverSalt", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
configurable: true,
|
|
47
|
-
writable: true,
|
|
48
|
-
value: 0n
|
|
49
|
-
});
|
|
50
|
-
_SessionState_seqNo.set(this, 0);
|
|
51
|
-
_SessionState_messageId.set(this, 0n);
|
|
52
|
-
}
|
|
25
|
+
timeDifference = 0;
|
|
26
|
+
serverSalt = 0n;
|
|
27
|
+
#seqNo = 0;
|
|
28
|
+
#messageId = 0n;
|
|
53
29
|
nextMessageId() {
|
|
54
30
|
const now = (0, _1_utilities_js_1.toUnixTimestamp)(new Date()) + this.timeDifference;
|
|
55
31
|
const nanoseconds = Math.floor((now - Math.floor(now)) * 1e9);
|
|
56
32
|
const newMessageId = (BigInt(Math.floor(now)) << 32n) || (BigInt(nanoseconds) << 2n);
|
|
57
|
-
if (
|
|
58
|
-
|
|
33
|
+
if (this.#messageId >= newMessageId) {
|
|
34
|
+
this.#messageId += 4n;
|
|
59
35
|
}
|
|
60
36
|
else {
|
|
61
|
-
|
|
37
|
+
this.#messageId = newMessageId;
|
|
62
38
|
}
|
|
63
|
-
return
|
|
39
|
+
return this.#messageId;
|
|
64
40
|
}
|
|
65
41
|
nextSeqNo(contentRelated) {
|
|
66
|
-
|
|
67
|
-
let seqNo = __classPrivateFieldGet(this, _SessionState_seqNo, "f") * 2;
|
|
42
|
+
let seqNo = this.#seqNo * 2;
|
|
68
43
|
if (contentRelated) {
|
|
69
44
|
seqNo++;
|
|
70
|
-
|
|
45
|
+
this.#seqNo++;
|
|
71
46
|
}
|
|
72
47
|
return seqNo;
|
|
73
48
|
}
|
|
74
49
|
reset() {
|
|
75
50
|
this.serverSalt = 0n;
|
|
76
|
-
|
|
77
|
-
|
|
51
|
+
this.#seqNo = 0;
|
|
52
|
+
this.#messageId = 0n;
|
|
78
53
|
}
|
|
79
54
|
}
|
|
80
55
|
exports.SessionState = SessionState;
|
|
81
|
-
_SessionState_seqNo = new WeakMap(), _SessionState_messageId = new WeakMap();
|
|
@@ -15,25 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
36
|
-
var _Session_instances, _Session_dc, _Session_cdn, _Session_lastConnect, _Session_disconnected, _Session_L, _Session_onConnectionStateChange, _Session_lastState, _Session_stateChangeHandler, _Session_connectMutex;
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
37
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
36
|
exports.Session = void 0;
|
|
39
37
|
/**
|
|
@@ -65,108 +63,97 @@ let id = 0;
|
|
|
65
63
|
// @ts-ignore: lib
|
|
66
64
|
const defaultTransportProvider = typeof dntShim.Deno === "undefined" ? _3_transport_js_1.transportProviderWebSocket : _3_transport_js_1.transportProviderTcp;
|
|
67
65
|
class Session {
|
|
66
|
+
#dc;
|
|
67
|
+
#cdn;
|
|
68
|
+
state = new _0_session_state_js_1.SessionState();
|
|
69
|
+
transport;
|
|
70
|
+
#lastConnect;
|
|
71
|
+
#disconnected = true;
|
|
72
|
+
#L;
|
|
73
|
+
#onConnectionStateChange;
|
|
68
74
|
constructor(dc, params) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
_Session_cdn.set(this, void 0);
|
|
72
|
-
Object.defineProperty(this, "state", {
|
|
73
|
-
enumerable: true,
|
|
74
|
-
configurable: true,
|
|
75
|
-
writable: true,
|
|
76
|
-
value: new _0_session_state_js_1.SessionState()
|
|
77
|
-
});
|
|
78
|
-
Object.defineProperty(this, "transport", {
|
|
79
|
-
enumerable: true,
|
|
80
|
-
configurable: true,
|
|
81
|
-
writable: true,
|
|
82
|
-
value: void 0
|
|
83
|
-
});
|
|
84
|
-
_Session_lastConnect.set(this, void 0);
|
|
85
|
-
_Session_disconnected.set(this, true);
|
|
86
|
-
_Session_L.set(this, void 0);
|
|
87
|
-
_Session_onConnectionStateChange.set(this, void 0);
|
|
88
|
-
_Session_lastState.set(this, void 0);
|
|
89
|
-
_Session_connectMutex.set(this, new _1_utilities_js_1.Mutex());
|
|
90
|
-
__classPrivateFieldSet(this, _Session_dc, dc, "f");
|
|
91
|
-
__classPrivateFieldSet(this, _Session_cdn, params?.cdn ?? false, "f");
|
|
75
|
+
this.#dc = dc;
|
|
76
|
+
this.#cdn = params?.cdn ?? false;
|
|
92
77
|
const transportProvider = params?.transportProvider ?? defaultTransportProvider();
|
|
93
|
-
this.transport = transportProvider({ dc:
|
|
78
|
+
this.transport = transportProvider({ dc: this.#dc, cdn: this.#cdn });
|
|
94
79
|
this.transport.connection.stateChangeHandler = (connected) => {
|
|
95
80
|
setTimeout(() => {
|
|
96
|
-
(0, _1_utilities_js_1.drop)(
|
|
81
|
+
(0, _1_utilities_js_1.drop)(this.#stateChangeHandler(connected));
|
|
97
82
|
});
|
|
98
83
|
};
|
|
99
|
-
|
|
84
|
+
this.#L = (0, _1_utilities_js_1.getLogger)("Session").client(id++);
|
|
100
85
|
}
|
|
101
86
|
set onConnectionStateChange(onConnectionStateChange) {
|
|
102
|
-
|
|
87
|
+
this.#onConnectionStateChange = onConnectionStateChange;
|
|
103
88
|
}
|
|
104
89
|
set connectionCallback(connectionCallback) {
|
|
105
90
|
this.transport.connection.callback = connectionCallback;
|
|
106
91
|
}
|
|
107
92
|
get dc() {
|
|
108
|
-
return
|
|
93
|
+
return this.#dc;
|
|
109
94
|
}
|
|
110
95
|
get cdn() {
|
|
111
|
-
return
|
|
96
|
+
return this.#cdn;
|
|
112
97
|
}
|
|
113
98
|
set serverSalt(serverSalt) {
|
|
114
99
|
this.state.serverSalt = serverSalt;
|
|
115
100
|
}
|
|
101
|
+
#lastState;
|
|
102
|
+
async #stateChangeHandler(connected) {
|
|
103
|
+
if (this.#lastState !== connected) {
|
|
104
|
+
setTimeout(() => {
|
|
105
|
+
this.#onConnectionStateChange?.(connected);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (this.#lastState === connected) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
this.#lastState = connected;
|
|
112
|
+
if (connected || this.#disconnected) {
|
|
113
|
+
if (this.#disconnected) {
|
|
114
|
+
this.#L.debug("not reconnecting because explicitly disconnected");
|
|
115
|
+
}
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (this.#lastConnect && Date.now() - this.#lastConnect.getTime() <= 10 * _0_deps_js_1.SECOND) {
|
|
119
|
+
this.#L.debug("reconnecting after a delay");
|
|
120
|
+
await (0, _0_deps_js_1.delay)(3 * _0_deps_js_1.SECOND);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
this.#L.debug("reconnecting");
|
|
124
|
+
}
|
|
125
|
+
await this.connect();
|
|
126
|
+
}
|
|
116
127
|
get connected() {
|
|
117
128
|
return this.transport.connection.connected;
|
|
118
129
|
}
|
|
130
|
+
#connectMutex = new _1_utilities_js_1.Mutex();
|
|
119
131
|
async connect() {
|
|
120
|
-
const unlock = await
|
|
132
|
+
const unlock = await this.#connectMutex.lock();
|
|
121
133
|
try {
|
|
122
134
|
if (this.connected) {
|
|
123
135
|
return;
|
|
124
136
|
}
|
|
125
137
|
await this.transport.connection.open();
|
|
126
138
|
await this.transport.transport.initialize();
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
this.#lastConnect = new Date();
|
|
140
|
+
this.#disconnected = false;
|
|
129
141
|
}
|
|
130
142
|
finally {
|
|
131
143
|
unlock();
|
|
132
144
|
}
|
|
133
145
|
}
|
|
134
146
|
async waitUntilConnected() {
|
|
135
|
-
(await
|
|
147
|
+
(await this.#connectMutex.lock())();
|
|
136
148
|
}
|
|
137
149
|
get disconnected() {
|
|
138
|
-
return
|
|
150
|
+
return this.#disconnected;
|
|
139
151
|
}
|
|
140
152
|
disconnect() {
|
|
141
|
-
|
|
153
|
+
this.#disconnected = true;
|
|
142
154
|
if (this.transport.connection.connected) {
|
|
143
155
|
this.transport.connection.close();
|
|
144
156
|
}
|
|
145
157
|
}
|
|
146
158
|
}
|
|
147
159
|
exports.Session = Session;
|
|
148
|
-
_Session_dc = new WeakMap(), _Session_cdn = new WeakMap(), _Session_lastConnect = new WeakMap(), _Session_disconnected = new WeakMap(), _Session_L = new WeakMap(), _Session_onConnectionStateChange = new WeakMap(), _Session_lastState = new WeakMap(), _Session_connectMutex = new WeakMap(), _Session_instances = new WeakSet(), _Session_stateChangeHandler = async function _Session_stateChangeHandler(connected) {
|
|
149
|
-
if (__classPrivateFieldGet(this, _Session_lastState, "f") !== connected) {
|
|
150
|
-
setTimeout(() => {
|
|
151
|
-
__classPrivateFieldGet(this, _Session_onConnectionStateChange, "f")?.call(this, connected);
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
if (__classPrivateFieldGet(this, _Session_lastState, "f") === connected) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
__classPrivateFieldSet(this, _Session_lastState, connected, "f");
|
|
158
|
-
if (connected || __classPrivateFieldGet(this, _Session_disconnected, "f")) {
|
|
159
|
-
if (__classPrivateFieldGet(this, _Session_disconnected, "f")) {
|
|
160
|
-
__classPrivateFieldGet(this, _Session_L, "f").debug("not reconnecting because explicitly disconnected");
|
|
161
|
-
}
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
if (__classPrivateFieldGet(this, _Session_lastConnect, "f") && Date.now() - __classPrivateFieldGet(this, _Session_lastConnect, "f").getTime() <= 10 * _0_deps_js_1.SECOND) {
|
|
165
|
-
__classPrivateFieldGet(this, _Session_L, "f").debug("reconnecting after a delay");
|
|
166
|
-
await (0, _0_deps_js_1.delay)(3 * _0_deps_js_1.SECOND);
|
|
167
|
-
}
|
|
168
|
-
else {
|
|
169
|
-
__classPrivateFieldGet(this, _Session_L, "f").debug("reconnecting");
|
|
170
|
-
}
|
|
171
|
-
await this.connect();
|
|
172
|
-
};
|