@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,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
1
20
|
import { unreachable } from "../0_deps.js";
|
|
2
21
|
import { decodeText } from "../1_utilities.js";
|
|
3
22
|
import { constructChatP } from "./1_chat_p.js";
|
package/esm/types/7_update.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ import { ConnectionState } from "./0_connection_state.js";
|
|
|
22
22
|
import { MessageReference } from "./0_message_reference.js";
|
|
23
23
|
import { StoryReference } from "./0_story_reference.js";
|
|
24
24
|
import { Translation } from "./0_translation.js";
|
|
25
|
+
import { UploadProgress } from "./0_upload_progress.js";
|
|
25
26
|
import { VideoChat } from "./0_video_chat.js";
|
|
26
27
|
import { VoiceTranscription } from "./0_voice_transcription.js";
|
|
27
28
|
import { BusinessConnection } from "./2_business_connection.js";
|
|
@@ -452,6 +453,23 @@ export interface UpdateLinkPreview {
|
|
|
452
453
|
*/
|
|
453
454
|
linkPreview: LinkPreview;
|
|
454
455
|
}
|
|
456
|
+
/**
|
|
457
|
+
* An upload has progressed.
|
|
458
|
+
*
|
|
459
|
+
* ```
|
|
460
|
+
* client.on("uploadProgress", (ctx) => {
|
|
461
|
+
* // ctx.uploadProgress
|
|
462
|
+
* });
|
|
463
|
+
* ```
|
|
464
|
+
* @unlisted
|
|
465
|
+
*/
|
|
466
|
+
export interface UpdateUploadProgress {
|
|
467
|
+
/**
|
|
468
|
+
* The new progress of the upload.
|
|
469
|
+
* @discriminator
|
|
470
|
+
*/
|
|
471
|
+
uploadProgress: UploadProgress;
|
|
472
|
+
}
|
|
455
473
|
/** @unlisted */
|
|
456
474
|
export interface UpdateMap {
|
|
457
475
|
message: UpdateNewMessage;
|
|
@@ -482,9 +500,10 @@ export interface UpdateMap {
|
|
|
482
500
|
pollAnswer: UpdatePollAnswer;
|
|
483
501
|
voiceTranscription: UpdateVoiceTranscription;
|
|
484
502
|
linkPreview: UpdateLinkPreview;
|
|
503
|
+
uploadProgress: UpdateUploadProgress;
|
|
485
504
|
}
|
|
486
505
|
/** @unlisted */
|
|
487
|
-
export type UpdateIntersection = Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateMessageEdited & UpdateMessageScheduled & UpdateMessagesDeleted & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory & UpdateBusinessConnection & UpdateVideoChat & UpdatePreCheckoutQuery & UpdateJoinRequest & UpdateTranslations & UpdatePoll & UpdatePollAnswer & UpdateVoiceTranscription & UpdateLinkPreview>;
|
|
506
|
+
export type UpdateIntersection = Partial<UpdateConnectionState & UpdateAuthorizationState & UpdateNewMessage & UpdateMessageEdited & UpdateMessageScheduled & UpdateMessagesDeleted & UpdateCallbackQuery & UpdateInlineQuery & UpdateChosenInlineResult & UpdateNewChat & UpdateEditedChat & UpdateDeletedChat & UpdateMessageInteractions & UpdateMessageReactionCount & UpdateMessageReactions & UpdateChatMember & UpdateMyChatMember & UpdateDeletedStory & UpdateNewStory & UpdateBusinessConnection & UpdateVideoChat & UpdatePreCheckoutQuery & UpdateJoinRequest & UpdateTranslations & UpdatePoll & UpdatePollAnswer & UpdateVoiceTranscription & UpdateLinkPreview & UpdateUploadProgress>;
|
|
488
507
|
/** An incoming update. */
|
|
489
|
-
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateMessageEdited | UpdateMessageScheduled | UpdateMessagesDeleted | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory | UpdateBusinessConnection | UpdateVideoChat | UpdatePreCheckoutQuery | UpdateJoinRequest | UpdateTranslations | UpdatePoll | UpdatePollAnswer | UpdateVoiceTranscription | UpdateLinkPreview;
|
|
508
|
+
export type Update = UpdateConnectionState | UpdateAuthorizationState | UpdateNewMessage | UpdateMessageEdited | UpdateMessageScheduled | UpdateMessagesDeleted | UpdateCallbackQuery | UpdateInlineQuery | UpdateChosenInlineResult | UpdateNewChat | UpdateEditedChat | UpdateDeletedChat | UpdateMessageInteractions | UpdateMessageReactionCount | UpdateMessageReactions | UpdateChatMember | UpdateMyChatMember | UpdateDeletedStory | UpdateNewStory | UpdateBusinessConnection | UpdateVideoChat | UpdatePreCheckoutQuery | UpdateJoinRequest | UpdateTranslations | UpdatePoll | UpdatePollAnswer | UpdateVoiceTranscription | UpdateLinkPreview | UpdateUploadProgress;
|
|
490
509
|
//# sourceMappingURL=7_update.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"7_update.d.ts","sourceRoot":"","sources":["../../src/types/7_update.ts"],"names":[],"mappings":"AAA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,aAAa,GACb,gBAAgB,GAChB,iBAAiB,GACjB,yBAAyB,GACzB,0BAA0B,GAC1B,sBAAsB,GACtB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,wBAAwB,GACxB,eAAe,GACf,sBAAsB,GACtB,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,gBAAgB,GAChB,wBAAwB,GACxB,iBAAiB,GACjB,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_bigint_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_bigint_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"0_bigint_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_bigint_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -17,5 +17,5 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
export declare function bufferFromBigInt(int: bigint | number, byteCount: number, littleEndian?: boolean, signed?: boolean): Uint8Array
|
|
20
|
+
export declare function bufferFromBigInt(int: bigint | number, byteCount: number, littleEndian?: boolean, signed?: boolean): Uint8Array<ArrayBuffer>;
|
|
21
21
|
//# sourceMappingURL=0_buffer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_buffer.d.ts","sourceRoot":"","sources":["../../src/utilities/0_buffer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,UAAO,EAAE,MAAM,UAAQ,
|
|
1
|
+
{"version":3,"file":"0_buffer.d.ts","sourceRoot":"","sources":["../../src/utilities/0_buffer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,UAAO,EAAE,MAAM,UAAQ,2BAoC5G"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_buffer_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_buffer_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"0_buffer_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_buffer_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare function sha256(payload: Uint8Array): Promise<Uint8Array
|
|
2
|
-
export declare function sha1(payload: Uint8Array): Promise<Uint8Array
|
|
1
|
+
export declare function sha256(payload: Uint8Array): Promise<Uint8Array<ArrayBuffer>>;
|
|
2
|
+
export declare function sha1(payload: Uint8Array): Promise<Uint8Array<ArrayBuffer>>;
|
|
3
3
|
//# sourceMappingURL=0_hash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_hash.d.ts","sourceRoot":"","sources":["../../src/utilities/0_hash.ts"],"names":[],"mappings":"AAsBA,wBAAsB,MAAM,CAAC,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"0_hash.d.ts","sourceRoot":"","sources":["../../src/utilities/0_hash.ts"],"names":[],"mappings":"AAsBA,wBAAsB,MAAM,CAAC,OAAO,EAAE,UAAU,oCAE/C;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,UAAU,oCAE7C"}
|
package/esm/utilities/0_mutex.js
CHANGED
|
@@ -17,29 +17,14 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
21
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
22
|
-
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");
|
|
23
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
24
|
-
};
|
|
25
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
-
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");
|
|
29
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
-
};
|
|
31
|
-
var _Mutex_untilUnlock;
|
|
32
20
|
export class Mutex {
|
|
33
|
-
|
|
34
|
-
_Mutex_untilUnlock.set(this, Promise.resolve());
|
|
35
|
-
}
|
|
21
|
+
#untilUnlock = Promise.resolve();
|
|
36
22
|
async lock() {
|
|
37
|
-
await
|
|
23
|
+
await this.#untilUnlock;
|
|
38
24
|
return new Promise((resolve0) => {
|
|
39
|
-
|
|
25
|
+
this.#untilUnlock = new Promise((resolve1) => {
|
|
40
26
|
resolve0(resolve1);
|
|
41
|
-
})
|
|
27
|
+
});
|
|
42
28
|
});
|
|
43
29
|
}
|
|
44
30
|
}
|
|
45
|
-
_Mutex_untilUnlock = new WeakMap();
|
|
@@ -17,49 +17,35 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
21
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
22
|
-
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");
|
|
23
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
24
|
-
};
|
|
25
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
26
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
28
|
-
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");
|
|
29
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
30
|
-
};
|
|
31
|
-
var _PartStream_buffer, _PartStream_totalRead, _PartStream_part;
|
|
32
20
|
import { concat } from "../0_deps.js";
|
|
33
21
|
export class PartStream extends TransformStream {
|
|
22
|
+
#buffer = new Uint8Array();
|
|
23
|
+
#totalRead = 0;
|
|
24
|
+
#part = 0;
|
|
34
25
|
constructor(chunkSize) {
|
|
35
26
|
super({
|
|
36
27
|
transform: (chunk, controller) => {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
chunk = concat([__classPrivateFieldGet(this, _PartStream_buffer, "f"), chunk]);
|
|
28
|
+
this.#totalRead += chunk.byteLength;
|
|
29
|
+
chunk = concat([this.#buffer, chunk]);
|
|
40
30
|
while (chunk.byteLength > chunkSize) {
|
|
41
31
|
controller.enqueue({
|
|
42
32
|
small: false,
|
|
43
|
-
part:
|
|
33
|
+
part: this.#part++,
|
|
44
34
|
totalParts: -1,
|
|
45
35
|
bytes: chunk.slice(0, chunkSize),
|
|
46
36
|
});
|
|
47
37
|
chunk = chunk.slice(chunkSize);
|
|
48
38
|
}
|
|
49
|
-
|
|
39
|
+
this.#buffer = chunk;
|
|
50
40
|
},
|
|
51
41
|
flush: (controller) => {
|
|
52
42
|
controller.enqueue({
|
|
53
|
-
small:
|
|
54
|
-
part:
|
|
55
|
-
totalParts: Math.ceil(
|
|
56
|
-
bytes:
|
|
43
|
+
small: this.#totalRead <= chunkSize,
|
|
44
|
+
part: this.#part,
|
|
45
|
+
totalParts: Math.ceil(this.#totalRead / chunkSize),
|
|
46
|
+
bytes: this.#buffer,
|
|
57
47
|
});
|
|
58
48
|
},
|
|
59
49
|
});
|
|
60
|
-
_PartStream_buffer.set(this, new Uint8Array());
|
|
61
|
-
_PartStream_totalRead.set(this, 0);
|
|
62
|
-
_PartStream_part.set(this, 0);
|
|
63
50
|
}
|
|
64
51
|
}
|
|
65
|
-
_PartStream_buffer = new WeakMap(), _PartStream_totalRead = new WeakMap(), _PartStream_part = new WeakMap();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_part_stream_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_part_stream_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"0_part_stream_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_part_stream_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
package/esm/utilities/0_rle.d.ts
CHANGED
|
@@ -17,6 +17,6 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
export declare function rleEncode(s: Uint8Array): Uint8Array
|
|
21
|
-
export declare function rleDecode(s: Uint8Array): Uint8Array
|
|
20
|
+
export declare function rleEncode(s: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
21
|
+
export declare function rleDecode(s: Uint8Array): Uint8Array<ArrayBuffer>;
|
|
22
22
|
//# sourceMappingURL=0_rle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_rle.d.ts","sourceRoot":"","sources":["../../src/utilities/0_rle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"0_rle.d.ts","sourceRoot":"","sources":["../../src/utilities/0_rle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,2BA8BtC;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,UAAU,2BAqBtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_rle_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_rle_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"0_rle_test.d.ts","sourceRoot":"","sources":["../../src/utilities/0_rle_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
20
|
+
export declare function encodeText(decoded: string): Uint8Array<ArrayBufferLike>;
|
|
2
21
|
export declare function decodeText(encoded: Uint8Array): string;
|
|
3
22
|
//# sourceMappingURL=0_text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0_text.d.ts","sourceRoot":"","sources":["../../src/utilities/0_text.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"0_text.d.ts","sourceRoot":"","sources":["../../src/utilities/0_text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,+BAEzC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,UAAU,UAE7C"}
|
package/esm/utilities/0_text.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
3
|
+
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
4
|
+
*
|
|
5
|
+
* This file is part of MTKruto.
|
|
6
|
+
*
|
|
7
|
+
* This program is free software: you can redistribute it and/or modify
|
|
8
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
9
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
10
|
+
* (at your option) any later version.
|
|
11
|
+
*
|
|
12
|
+
* This program is distributed in the hope that it will be useful,
|
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15
|
+
* GNU Lesser General Public License for more details.
|
|
16
|
+
*
|
|
17
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
18
|
+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
|
+
*/
|
|
1
20
|
const encoder = new TextEncoder();
|
|
2
21
|
const decoder = new TextDecoder();
|
|
3
22
|
export function encodeText(decoded) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function rsaPad(data: Uint8Array, [serverKey, exponent]: [bigint, bigint]): Promise<Uint8Array
|
|
1
|
+
export declare function rsaPad(data: Uint8Array, [serverKey, exponent]: [bigint, bigint]): Promise<Uint8Array<ArrayBuffer>>;
|
|
2
2
|
//# sourceMappingURL=1_auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_auth.d.ts","sourceRoot":"","sources":["../../src/utilities/1_auth.ts"],"names":[],"mappings":"AA2BA,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"1_auth.d.ts","sourceRoot":"","sources":["../../src/utilities/1_auth.ts"],"names":[],"mappings":"AA2BA,wBAAsB,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,oCAiCrF"}
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
export declare function base64EncodeUrlSafe(data: Uint8Array | ArrayBuffer | string): string;
|
|
21
|
-
export declare function base64DecodeUrlSafe(data: string): Uint8Array
|
|
21
|
+
export declare function base64DecodeUrlSafe(data: string): Uint8Array<ArrayBuffer>;
|
|
22
22
|
//# sourceMappingURL=1_base64.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_base64.d.ts","sourceRoot":"","sources":["../../src/utilities/1_base64.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,MAAM,UAE1E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"1_base64.d.ts","sourceRoot":"","sources":["../../src/utilities/1_base64.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,MAAM,UAE1E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,2BAM/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_base64_test.d.ts","sourceRoot":"","sources":["../../src/utilities/1_base64_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"1_base64_test.d.ts","sourceRoot":"","sources":["../../src/utilities/1_base64_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
2
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
3
|
-
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");
|
|
4
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
5
|
-
};
|
|
6
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
7
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
8
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
9
|
-
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");
|
|
10
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
11
|
-
};
|
|
12
|
-
var _CTR_instances, _CTR_key, _CTR_iv, _CTR_bytesUntilNextBlock, _CTR_promise, _CTR_call, _CTR_encrypt, _CTR_increaseIv;
|
|
13
1
|
/**
|
|
14
2
|
* MTKruto - Cross-runtime JavaScript library for building Telegram clients
|
|
15
3
|
* Copyright (C) 2023-2025 Roj <https://roj.im/>
|
|
@@ -34,59 +22,60 @@ import { concat } from "../0_deps.js";
|
|
|
34
22
|
import { bigIntFromBuffer } from "./0_bigint.js";
|
|
35
23
|
import { bufferFromBigInt } from "./0_buffer.js";
|
|
36
24
|
export class CTR {
|
|
25
|
+
#key;
|
|
26
|
+
#iv;
|
|
27
|
+
#bytesUntilNextBlock = 0;
|
|
28
|
+
#promise;
|
|
37
29
|
get _state() {
|
|
38
|
-
return { iv: new Uint8Array(
|
|
30
|
+
return { iv: new Uint8Array(this.#iv), state: this.#bytesUntilNextBlock };
|
|
39
31
|
}
|
|
40
32
|
constructor(key, iv) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_CTR_iv.set(this, void 0);
|
|
44
|
-
_CTR_bytesUntilNextBlock.set(this, 0);
|
|
45
|
-
_CTR_promise.set(this, void 0);
|
|
46
|
-
__classPrivateFieldSet(this, _CTR_key, key, "f");
|
|
47
|
-
__classPrivateFieldSet(this, _CTR_iv, iv, "f");
|
|
33
|
+
this.#key = key;
|
|
34
|
+
this.#iv = iv;
|
|
48
35
|
}
|
|
49
36
|
static async importKey(key) {
|
|
50
37
|
return await dntShim.crypto.subtle.importKey("raw", key, "AES-CTR", false, ["encrypt"]);
|
|
51
38
|
}
|
|
52
39
|
async call(data) {
|
|
53
|
-
if (
|
|
54
|
-
await Promise.allSettled([
|
|
40
|
+
if (this.#promise) {
|
|
41
|
+
await Promise.allSettled([this.#promise]);
|
|
55
42
|
}
|
|
56
|
-
return await (
|
|
43
|
+
return await (this.#promise = this.#call(data));
|
|
57
44
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
45
|
+
async #call(data) {
|
|
46
|
+
let header;
|
|
47
|
+
if (this.#bytesUntilNextBlock) {
|
|
48
|
+
const headerLength = Math.min(data.length, this.#iv.length - this.#bytesUntilNextBlock);
|
|
49
|
+
const encrypted = await this.#encrypt(concat([new Uint8Array(this.#bytesUntilNextBlock), data.subarray(0, headerLength)]));
|
|
50
|
+
header = encrypted.subarray(this.#bytesUntilNextBlock);
|
|
51
|
+
data = data.subarray(headerLength);
|
|
52
|
+
if (encrypted.length === this.#iv.length) {
|
|
53
|
+
this.#increaseIv(1);
|
|
54
|
+
this.#bytesUntilNextBlock = 0;
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.#bytesUntilNextBlock += headerLength;
|
|
58
|
+
}
|
|
69
59
|
}
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
if (!data.length && header) {
|
|
61
|
+
return header;
|
|
72
62
|
}
|
|
63
|
+
const encrypted = await this.#encrypt(data);
|
|
64
|
+
this.#bytesUntilNextBlock = encrypted.length % this.#iv.length;
|
|
65
|
+
this.#increaseIv((encrypted.length - this.#bytesUntilNextBlock) / this.#iv.length);
|
|
66
|
+
return header ? concat([header, encrypted]) : encrypted;
|
|
73
67
|
}
|
|
74
|
-
|
|
75
|
-
return
|
|
68
|
+
async #encrypt(data) {
|
|
69
|
+
return new Uint8Array(await dntShim.crypto.subtle.encrypt({
|
|
70
|
+
name: "AES-CTR",
|
|
71
|
+
counter: new Uint8Array(this.#iv),
|
|
72
|
+
length: this.#iv.length * 8,
|
|
73
|
+
}, this.#key, data));
|
|
76
74
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return new Uint8Array(await dntShim.crypto.subtle.encrypt({
|
|
83
|
-
name: "AES-CTR",
|
|
84
|
-
counter: new Uint8Array(__classPrivateFieldGet(this, _CTR_iv, "f")),
|
|
85
|
-
length: __classPrivateFieldGet(this, _CTR_iv, "f").length * 8,
|
|
86
|
-
}, __classPrivateFieldGet(this, _CTR_key, "f"), data));
|
|
87
|
-
}, _CTR_increaseIv = function _CTR_increaseIv(amount) {
|
|
88
|
-
if (amount < 1) {
|
|
89
|
-
return;
|
|
75
|
+
#increaseIv(amount) {
|
|
76
|
+
if (amount < 1) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.#iv = bufferFromBigInt(bigIntFromBuffer(this.#iv, false, false) + BigInt(amount), this.#iv.length, false, false);
|
|
90
80
|
}
|
|
91
|
-
|
|
92
|
-
};
|
|
81
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_crypto_test.d.ts","sourceRoot":"","sources":["../../src/utilities/1_crypto_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"1_crypto_test.d.ts","sourceRoot":"","sources":["../../src/utilities/1_crypto_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
|
@@ -37,8 +37,8 @@ export declare const OUT = 10;
|
|
|
37
37
|
export declare const IN_BIN = 20;
|
|
38
38
|
export declare const OUT_BIN = 20;
|
|
39
39
|
export declare function getLogger(scope: string): {
|
|
40
|
-
client(id: number): any;
|
|
41
|
-
branch(name: string): any;
|
|
40
|
+
client(id: number): /*elided*/ any;
|
|
41
|
+
branch(name: string): /*elided*/ any;
|
|
42
42
|
error(...args: any[]): void;
|
|
43
43
|
warning(...args: any[]): void;
|
|
44
44
|
info(...args: any[]): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_math_test.d.ts","sourceRoot":"","sources":["../../src/utilities/1_math_test.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"1_math_test.d.ts","sourceRoot":"","sources":["../../src/utilities/1_math_test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,2BAA2B,CAAC"}
|
package/esm/utilities/2_queue.js
CHANGED
|
@@ -17,60 +17,42 @@
|
|
|
17
17
|
* You should have received a copy of the GNU Lesser General Public License
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
|
-
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
21
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
22
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
23
|
-
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");
|
|
24
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
25
|
-
};
|
|
26
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
27
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
28
|
-
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");
|
|
29
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
30
|
-
};
|
|
31
|
-
var _Queue_instances, _Queue_logger, _Queue_throw, _Queue_busy, _Queue_check;
|
|
32
20
|
import { getLogger } from "./1_logger.js";
|
|
33
21
|
export class Queue {
|
|
22
|
+
#logger;
|
|
23
|
+
functions = new Array();
|
|
24
|
+
#throw;
|
|
34
25
|
constructor(name, throw_ = false) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Object.defineProperty(this, "functions", {
|
|
38
|
-
enumerable: true,
|
|
39
|
-
configurable: true,
|
|
40
|
-
writable: true,
|
|
41
|
-
value: new Array()
|
|
42
|
-
});
|
|
43
|
-
_Queue_throw.set(this, void 0);
|
|
44
|
-
_Queue_busy.set(this, false);
|
|
45
|
-
__classPrivateFieldSet(this, _Queue_logger, getLogger(`q/${name}`), "f");
|
|
46
|
-
__classPrivateFieldSet(this, _Queue_throw, throw_, "f");
|
|
26
|
+
this.#logger = getLogger(`q/${name}`);
|
|
27
|
+
this.#throw = throw_;
|
|
47
28
|
}
|
|
48
29
|
add(fn) {
|
|
49
30
|
this.functions.push(fn);
|
|
50
|
-
|
|
31
|
+
this.#check();
|
|
51
32
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
});
|
|
67
|
-
if (!__classPrivateFieldGet(this, _Queue_throw, "f")) {
|
|
68
|
-
promise.catch((err) => {
|
|
69
|
-
__classPrivateFieldGet(this, _Queue_logger, "f").error((typeof err === "object" && err != null && "stack" in err) ? err.stack : err);
|
|
33
|
+
#busy = false;
|
|
34
|
+
#check() {
|
|
35
|
+
if (this.#busy) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
this.#busy = true;
|
|
40
|
+
}
|
|
41
|
+
const fn = this.functions.shift();
|
|
42
|
+
if (fn !== undefined) {
|
|
43
|
+
const promise = fn()
|
|
44
|
+
.finally(() => {
|
|
45
|
+
this.#busy = false;
|
|
46
|
+
this.#check();
|
|
70
47
|
});
|
|
48
|
+
if (!this.#throw) {
|
|
49
|
+
promise.catch((err) => {
|
|
50
|
+
this.#logger.error((typeof err === "object" && err != null && "stack" in err) ? err.stack : err);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this.#busy = false;
|
|
71
56
|
}
|
|
72
57
|
}
|
|
73
|
-
|
|
74
|
-
__classPrivateFieldSet(this, _Queue_busy, false, "f");
|
|
75
|
-
}
|
|
76
|
-
};
|
|
58
|
+
}
|
package/package.json
CHANGED
package/script/0_errors.js
CHANGED
|
@@ -45,14 +45,10 @@ class InputError extends MtkrutoError {
|
|
|
45
45
|
}
|
|
46
46
|
exports.InputError = InputError;
|
|
47
47
|
class TransportError extends MtkrutoError {
|
|
48
|
+
code;
|
|
48
49
|
constructor(code) {
|
|
49
50
|
super(`Transport error: ${code}`);
|
|
50
|
-
|
|
51
|
-
enumerable: true,
|
|
52
|
-
configurable: true,
|
|
53
|
-
writable: true,
|
|
54
|
-
value: code
|
|
55
|
-
});
|
|
51
|
+
this.code = code;
|
|
56
52
|
this.name = "TransportError";
|
|
57
53
|
}
|
|
58
54
|
}
|