@mtkruto/browser 0.119.0 → 0.119.1
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.d.ts.map +1 -1
- package/esm/0_errors.js +9 -31
- package/esm/3_errors.js +2 -12
- package/esm/4_errors.js +2 -12
- package/esm/_dnt.polyfills.d.ts +0 -99
- package/esm/_dnt.polyfills.d.ts.map +1 -1
- package/esm/_dnt.polyfills.js +1 -127
- package/esm/client/0_abortable_loop.js +26 -39
- package/esm/client/0_storage_operations.js +179 -218
- package/esm/client/1_client_plain.js +4 -22
- package/esm/client/2_account_manager.js +140 -149
- 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 +198 -215
- package/esm/client/2_file_manager.js +255 -262
- package/esm/client/2_network_statistics_manager.js +31 -44
- 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 +101 -111
- package/esm/client/2_update_manager.js +750 -745
- package/esm/client/3_client_encrypted_pool.js +10 -26
- package/esm/client/3_message_manager.js +503 -508
- 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 +140 -146
- package/esm/client/4_chat_manager.js +161 -169
- package/esm/client/4_checklist_manager.js +26 -39
- package/esm/client/4_context.js +244 -259
- package/esm/client/4_forum_manager.js +67 -73
- package/esm/client/4_gift_manager.js +22 -35
- 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_composer.js +13 -26
- package/esm/client/6_client.js +866 -896
- package/esm/client/6_client_dispatcher.js +308 -325
- package/esm/client/7_client_worker.js +16 -29
- package/esm/connection/1_connection_tcp.js +55 -82
- 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.2.0/mux_async_iterator.js +31 -47
- package/esm/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
- package/esm/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
- package/esm/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
- package/esm/session/0_session_state.js +12 -38
- package/esm/session/1_session.js +49 -72
- package/esm/session/2_session_encrypted.js +422 -420
- package/esm/storage/2_storage_indexed_db.js +26 -44
- package/esm/storage/2_storage_local_storage.js +3 -16
- package/esm/storage/2_storage_memory.js +24 -41
- package/esm/storage/2_storage_session_storage.js +3 -16
- package/esm/tl/1_tl_reader.d.ts +1 -1
- package/esm/tl/1_tl_reader.d.ts.map +1 -1
- package/esm/tl/1_tl_reader.js +95 -103
- package/esm/tl/1_tl_writer.js +169 -178
- 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/utilities/0_mutex.js +4 -19
- package/esm/utilities/0_part_stream.js +11 -25
- package/esm/utilities/1_crypto.js +42 -53
- package/esm/utilities/2_queue.js +29 -47
- package/package.json +1 -1
- package/script/0_errors.d.ts.map +1 -1
- package/script/0_errors.js +9 -31
- package/script/3_errors.js +2 -12
- package/script/4_errors.js +2 -12
- package/script/_dnt.polyfills.d.ts +0 -99
- package/script/_dnt.polyfills.d.ts.map +1 -1
- package/script/_dnt.polyfills.js +0 -128
- package/script/client/0_abortable_loop.js +27 -40
- package/script/client/0_storage_operations.js +179 -218
- package/script/client/1_client_plain.js +4 -22
- package/script/client/2_account_manager.js +140 -149
- 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 +199 -216
- package/script/client/2_file_manager.js +255 -262
- package/script/client/2_network_statistics_manager.js +32 -45
- 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 +102 -112
- package/script/client/2_update_manager.js +750 -745
- package/script/client/3_client_encrypted_pool.js +10 -26
- package/script/client/3_message_manager.js +503 -508
- 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 +140 -146
- package/script/client/4_chat_manager.js +161 -169
- package/script/client/4_checklist_manager.js +26 -39
- package/script/client/4_context.js +244 -259
- package/script/client/4_forum_manager.js +67 -73
- package/script/client/4_gift_manager.js +22 -35
- 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_composer.js +13 -26
- package/script/client/6_client.js +866 -896
- package/script/client/6_client_dispatcher.js +308 -325
- package/script/client/7_client_worker.js +16 -29
- package/script/connection/1_connection_tcp.js +55 -82
- package/script/connection/1_connection_web_socket.js +75 -91
- package/script/deps/jsr.io/@roj/tgcrypto/1.0.1/dist/tgcrypto.js +3 -11
- package/script/deps/jsr.io/@std/async/1.2.0/mux_async_iterator.js +31 -47
- package/script/deps/jsr.io/@std/async/1.2.0/tee.js +11 -34
- package/script/deps/jsr.io/@std/cache/0.2.2/lru_cache.js +30 -47
- package/script/deps/jsr.io/@std/datetime/0.225.7/_date_time_formatter.js +4 -17
- package/script/session/0_session_state.js +12 -38
- package/script/session/1_session.js +49 -72
- package/script/session/2_session_encrypted.js +423 -421
- package/script/storage/2_storage_indexed_db.js +26 -44
- package/script/storage/2_storage_local_storage.js +3 -16
- package/script/storage/2_storage_memory.js +24 -41
- package/script/storage/2_storage_session_storage.js +3 -16
- package/script/tl/1_tl_reader.d.ts +1 -1
- package/script/tl/1_tl_reader.d.ts.map +1 -1
- package/script/tl/1_tl_reader.js +96 -104
- package/script/tl/1_tl_writer.js +170 -179
- 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/utilities/0_mutex.js +4 -19
- package/script/utilities/0_part_stream.js +11 -25
- package/script/utilities/1_crypto.js +43 -54
- package/script/utilities/2_queue.js +30 -48
package/script/_dnt.polyfills.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.import_meta_ponyfill = exports.import_meta_ponyfill_esmodule = exports.import_meta_ponyfill_commonjs = void 0;
|
|
4
3
|
// https://github.com/tc39/proposal-promise-with-resolvers/blob/3a78801e073e99217dbeb2c43ba7212f3bdc8b83/polyfills.js#L1C1-L9C2
|
|
5
4
|
if (Promise.withResolvers === undefined) {
|
|
6
5
|
Promise.withResolvers = () => {
|
|
@@ -121,130 +120,3 @@ async function fromAsync(items, mapfn, thisArg) {
|
|
|
121
120
|
if (!Array.fromAsync) {
|
|
122
121
|
Array.fromAsync = fromAsync;
|
|
123
122
|
}
|
|
124
|
-
/**
|
|
125
|
-
* Based on [import-meta-ponyfill](https://github.com/gaubee/import-meta-ponyfill),
|
|
126
|
-
* but instead of using npm to install additional dependencies,
|
|
127
|
-
* this approach manually consolidates cjs/mjs/d.ts into a single file.
|
|
128
|
-
*
|
|
129
|
-
* Note that this code might be imported multiple times
|
|
130
|
-
* (for example, both dnt.test.polyfills.ts and dnt.polyfills.ts contain this code;
|
|
131
|
-
* or Node.js might dynamically clear the cache and then force a require).
|
|
132
|
-
* Therefore, it's important to avoid redundant writes to global objects.
|
|
133
|
-
* Additionally, consider that commonjs is used alongside esm,
|
|
134
|
-
* so the two ponyfill functions are stored independently in two separate global objects.
|
|
135
|
-
*/
|
|
136
|
-
//@ts-ignore
|
|
137
|
-
const node_module_1 = require("node:module");
|
|
138
|
-
//@ts-ignore
|
|
139
|
-
const node_url_1 = require("node:url");
|
|
140
|
-
//@ts-ignore
|
|
141
|
-
const node_path_1 = require("node:path");
|
|
142
|
-
const defineGlobalPonyfill = (symbolFor, fn) => {
|
|
143
|
-
if (!Reflect.has(globalThis, Symbol.for(symbolFor))) {
|
|
144
|
-
Object.defineProperty(globalThis, Symbol.for(symbolFor), {
|
|
145
|
-
configurable: true,
|
|
146
|
-
get() {
|
|
147
|
-
return fn;
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
exports.import_meta_ponyfill_commonjs = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-commonjs")) ??
|
|
153
|
-
(() => {
|
|
154
|
-
const moduleImportMetaWM = new WeakMap();
|
|
155
|
-
return (require, module) => {
|
|
156
|
-
let importMetaCache = moduleImportMetaWM.get(module);
|
|
157
|
-
if (importMetaCache == null) {
|
|
158
|
-
const importMeta = Object.assign(Object.create(null), {
|
|
159
|
-
url: (0, node_url_1.pathToFileURL)(module.filename).href,
|
|
160
|
-
main: require.main == module,
|
|
161
|
-
resolve: (specifier, parentURL = importMeta.url) => {
|
|
162
|
-
return (0, node_url_1.pathToFileURL)((importMeta.url === parentURL
|
|
163
|
-
? require
|
|
164
|
-
: (0, node_module_1.createRequire)(parentURL))
|
|
165
|
-
.resolve(specifier)).href;
|
|
166
|
-
},
|
|
167
|
-
filename: module.filename,
|
|
168
|
-
dirname: module.path,
|
|
169
|
-
});
|
|
170
|
-
moduleImportMetaWM.set(module, importMeta);
|
|
171
|
-
importMetaCache = importMeta;
|
|
172
|
-
}
|
|
173
|
-
return importMetaCache;
|
|
174
|
-
};
|
|
175
|
-
})());
|
|
176
|
-
defineGlobalPonyfill("import-meta-ponyfill-commonjs", exports.import_meta_ponyfill_commonjs);
|
|
177
|
-
exports.import_meta_ponyfill_esmodule = (Reflect.get(globalThis, Symbol.for("import-meta-ponyfill-esmodule")) ??
|
|
178
|
-
((importMeta) => {
|
|
179
|
-
const resolveFunStr = String(importMeta.resolve);
|
|
180
|
-
const shimWs = new WeakSet();
|
|
181
|
-
//@ts-ignore
|
|
182
|
-
const mainUrl = ("file:///" + process.argv[1].replace(/\\/g, "/"))
|
|
183
|
-
.replace(/\/{3,}/, "///");
|
|
184
|
-
const commonShim = (importMeta) => {
|
|
185
|
-
if (typeof importMeta.main !== "boolean") {
|
|
186
|
-
importMeta.main = importMeta.url === mainUrl;
|
|
187
|
-
}
|
|
188
|
-
if (typeof importMeta.filename !== "string") {
|
|
189
|
-
importMeta.filename = (0, node_url_1.fileURLToPath)(importMeta.url);
|
|
190
|
-
importMeta.dirname = (0, node_path_1.dirname)(importMeta.filename);
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
if (
|
|
194
|
-
// v16.2.0+, v14.18.0+: Add support for WHATWG URL object to parentURL parameter.
|
|
195
|
-
resolveFunStr === "undefined" ||
|
|
196
|
-
// v20.0.0+, v18.19.0+"" This API now returns a string synchronously instead of a Promise.
|
|
197
|
-
resolveFunStr.startsWith("async")
|
|
198
|
-
// enable by --experimental-import-meta-resolve flag
|
|
199
|
-
) {
|
|
200
|
-
exports.import_meta_ponyfill_esmodule = (importMeta) => {
|
|
201
|
-
if (!shimWs.has(importMeta)) {
|
|
202
|
-
shimWs.add(importMeta);
|
|
203
|
-
const importMetaUrlRequire = {
|
|
204
|
-
url: importMeta.url,
|
|
205
|
-
require: (0, node_module_1.createRequire)(importMeta.url),
|
|
206
|
-
};
|
|
207
|
-
importMeta.resolve = function resolve(specifier, parentURL = importMeta.url) {
|
|
208
|
-
return (0, node_url_1.pathToFileURL)((importMetaUrlRequire.url === parentURL
|
|
209
|
-
? importMetaUrlRequire.require
|
|
210
|
-
: (0, node_module_1.createRequire)(parentURL)).resolve(specifier)).href;
|
|
211
|
-
};
|
|
212
|
-
commonShim(importMeta);
|
|
213
|
-
}
|
|
214
|
-
return importMeta;
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
else {
|
|
218
|
-
/// native support
|
|
219
|
-
exports.import_meta_ponyfill_esmodule = (importMeta) => {
|
|
220
|
-
if (!shimWs.has(importMeta)) {
|
|
221
|
-
shimWs.add(importMeta);
|
|
222
|
-
commonShim(importMeta);
|
|
223
|
-
}
|
|
224
|
-
return importMeta;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
return (0, exports.import_meta_ponyfill_esmodule)(importMeta);
|
|
228
|
-
}));
|
|
229
|
-
defineGlobalPonyfill("import-meta-ponyfill-esmodule", exports.import_meta_ponyfill_esmodule);
|
|
230
|
-
exports.import_meta_ponyfill = ((...args) => {
|
|
231
|
-
const _MODULE = (() => {
|
|
232
|
-
if (typeof require === "function" && typeof module === "object") {
|
|
233
|
-
return "commonjs";
|
|
234
|
-
}
|
|
235
|
-
else {
|
|
236
|
-
// eval("typeof import.meta");
|
|
237
|
-
return "esmodule";
|
|
238
|
-
}
|
|
239
|
-
})();
|
|
240
|
-
if (_MODULE === "commonjs") {
|
|
241
|
-
//@ts-ignore
|
|
242
|
-
exports.import_meta_ponyfill = (r, m) => (0, exports.import_meta_ponyfill_commonjs)(r, m);
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
//@ts-ignore
|
|
246
|
-
exports.import_meta_ponyfill = (im) => (0, exports.import_meta_ponyfill_esmodule)(im);
|
|
247
|
-
}
|
|
248
|
-
//@ts-ignore
|
|
249
|
-
return (0, exports.import_meta_ponyfill)(...args);
|
|
250
|
-
});
|
|
@@ -18,56 +18,43 @@
|
|
|
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 __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
22
|
-
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
23
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
24
|
-
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");
|
|
25
|
-
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
26
|
-
};
|
|
27
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
28
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
29
|
-
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");
|
|
30
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
31
|
-
};
|
|
32
|
-
var _AbortableLoop_instances, _AbortableLoop_body, _AbortableLoop_onError, _AbortableLoop_controller, _AbortableLoop_loop;
|
|
33
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
22
|
exports.AbortableLoop = void 0;
|
|
35
23
|
const _1_utilities_js_1 = require("../1_utilities.js");
|
|
36
24
|
class AbortableLoop {
|
|
25
|
+
#body;
|
|
26
|
+
#onError;
|
|
37
27
|
constructor(body, onError) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_AbortableLoop_onError.set(this, void 0);
|
|
41
|
-
_AbortableLoop_controller.set(this, void 0);
|
|
42
|
-
__classPrivateFieldSet(this, _AbortableLoop_body, body, "f");
|
|
43
|
-
__classPrivateFieldSet(this, _AbortableLoop_onError, onError, "f");
|
|
28
|
+
this.#body = body;
|
|
29
|
+
this.#onError = onError;
|
|
44
30
|
}
|
|
31
|
+
#controller;
|
|
45
32
|
abort() {
|
|
46
|
-
|
|
33
|
+
this.#controller?.abort();
|
|
47
34
|
}
|
|
48
35
|
start() {
|
|
49
|
-
if (
|
|
50
|
-
(0, _1_utilities_js_1.drop)(
|
|
36
|
+
if (this.#controller === undefined) {
|
|
37
|
+
(0, _1_utilities_js_1.drop)(this.#loop());
|
|
51
38
|
}
|
|
52
39
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
try {
|
|
61
|
-
await __classPrivateFieldGet(this, _AbortableLoop_body, "f").call(this, this, controller.signal);
|
|
62
|
-
}
|
|
63
|
-
catch (err) {
|
|
64
|
-
if (!controller.signal.aborted) {
|
|
65
|
-
__classPrivateFieldGet(this, _AbortableLoop_onError, "f").call(this, this, err);
|
|
40
|
+
async #loop() {
|
|
41
|
+
this.#controller?.abort();
|
|
42
|
+
const controller = this.#controller = new AbortController();
|
|
43
|
+
try {
|
|
44
|
+
do {
|
|
45
|
+
try {
|
|
46
|
+
await this.#body(this, controller.signal);
|
|
66
47
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
48
|
+
catch (err) {
|
|
49
|
+
if (!controller.signal.aborted) {
|
|
50
|
+
this.#onError(this, err);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
} while (!controller.signal.aborted);
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
this.#controller = undefined;
|
|
57
|
+
}
|
|
72
58
|
}
|
|
73
|
-
}
|
|
59
|
+
}
|
|
60
|
+
exports.AbortableLoop = AbortableLoop;
|