@mtkruto/node 0.0.906 → 0.0.920
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/{types/utilities → client}/0_html.d.ts +1 -1
- package/esm/{types/utilities → client}/0_html.js +2 -2
- package/esm/client/{utilities/0_message.d.ts → 0_message.d.ts} +2 -2
- package/esm/client/{utilities/0_message.js → 0_message.js} +10 -10
- package/esm/client/{utilities/0_password.d.ts → 0_password.d.ts} +2 -2
- package/esm/client/{utilities/0_password.js → 0_password.js} +5 -5
- package/{script/client/client_abstract.d.ts → esm/client/1_client_abstract.d.ts} +6 -5
- package/esm/client/{client_abstract.js → 1_client_abstract.js} +10 -4
- package/esm/client/{client_plain.d.ts → 2_client_plain.d.ts} +1 -1
- package/esm/client/{client_plain.js → 2_client_plain.js} +2 -2
- package/esm/client/{client.d.ts → 3_client.d.ts} +7 -5
- package/esm/client/{client.js → 3_client.js} +145 -83
- package/{script/connection/connection_web_socket.d.ts → esm/connection/1_connection_web_socket.d.ts} +1 -1
- package/esm/constants.d.ts +2 -2
- package/esm/constants.js +1 -1
- package/esm/deps.d.ts +1 -2
- package/esm/deps.js +0 -1
- package/esm/mod.d.ts +13 -13
- package/esm/mod.js +13 -13
- package/esm/storage/{storage.d.ts → 0_storage.d.ts} +1 -1
- package/{script/storage/storage_local_storage.d.ts → esm/storage/1_storage_local_storage.d.ts} +1 -1
- package/esm/storage/{storage_local_storage.js → 1_storage_local_storage.js} +1 -1
- package/{script/storage/storage_memory.d.ts → esm/storage/1_storage_memory.d.ts} +1 -1
- package/esm/storage/{storage_memory.js → 1_storage_memory.js} +1 -1
- package/esm/storage/{storage_session_storage.d.ts → 1_storage_session_storage.d.ts} +1 -1
- package/esm/storage/{storage_session_storage.js → 1_storage_session_storage.js} +1 -1
- package/esm/transport/{utilities/0_obfuscation.d.ts → 0_obfuscation.d.ts} +2 -2
- package/esm/transport/{utilities/0_obfuscation.js → 0_obfuscation.js} +3 -3
- package/esm/transport/{transport_abridged.d.ts → 1_transport_abridged.d.ts} +2 -2
- package/esm/transport/{transport_abridged.js → 1_transport_abridged.js} +2 -2
- package/esm/transport/{transport_intermediate.d.ts → 1_transport_intermediate.d.ts} +2 -2
- package/esm/transport/{transport_intermediate.js → 1_transport_intermediate.js} +2 -2
- package/{script/transport/transport_provider.d.ts → esm/transport/2_transport_provider.d.ts} +2 -2
- package/esm/transport/{transport_provider.js → 2_transport_provider.js} +2 -2
- package/esm/types/!0_file_id.d.ts +77 -0
- package/esm/types/!0_file_id.js +325 -0
- package/esm/types/0_chat_photo.d.ts +7 -14
- package/esm/types/0_chat_photo.js +32 -17
- package/esm/types/1_chat.js +4 -4
- package/esm/types/1_user.js +2 -2
- package/esm/types/3_message.js +9 -0
- package/esm/utilities/0_base64.d.ts +2 -0
- package/esm/utilities/0_base64.js +9 -0
- package/esm/utilities/0_rle.d.ts +2 -0
- package/esm/utilities/0_rle.js +49 -0
- package/package.json +1 -1
- package/script/{types/utilities → client}/0_html.d.ts +1 -1
- package/script/{types/utilities → client}/0_html.js +2 -2
- package/script/client/{utilities/0_message.d.ts → 0_message.d.ts} +2 -2
- package/script/client/{utilities/0_message.js → 0_message.js} +10 -10
- package/script/client/{utilities/0_password.d.ts → 0_password.d.ts} +2 -2
- package/script/client/{utilities/0_password.js → 0_password.js} +5 -5
- package/script/client/0_password_test.d.ts +1 -0
- package/{esm/client/client_abstract.d.ts → script/client/1_client_abstract.d.ts} +6 -5
- package/script/client/{client_abstract.js → 1_client_abstract.js} +10 -4
- package/script/client/{client_plain.d.ts → 2_client_plain.d.ts} +1 -1
- package/script/client/{client_plain.js → 2_client_plain.js} +3 -3
- package/script/client/{client.d.ts → 3_client.d.ts} +7 -5
- package/script/client/{client.js → 3_client.js} +146 -84
- package/{esm/connection/connection_web_socket.d.ts → script/connection/1_connection_web_socket.d.ts} +1 -1
- package/script/constants.d.ts +2 -2
- package/script/constants.js +1 -1
- package/script/deps.d.ts +1 -2
- package/script/deps.js +1 -3
- package/script/mod.d.ts +13 -13
- package/script/mod.js +13 -13
- package/script/storage/{storage.d.ts → 0_storage.d.ts} +1 -1
- package/{esm/storage/storage_local_storage.d.ts → script/storage/1_storage_local_storage.d.ts} +1 -1
- package/script/storage/{storage_local_storage.js → 1_storage_local_storage.js} +2 -2
- package/{esm/storage/storage_memory.d.ts → script/storage/1_storage_memory.d.ts} +1 -1
- package/script/storage/{storage_memory.js → 1_storage_memory.js} +2 -2
- package/script/storage/{storage_session_storage.d.ts → 1_storage_session_storage.d.ts} +1 -1
- package/script/storage/{storage_session_storage.js → 1_storage_session_storage.js} +2 -2
- package/script/transport/{utilities/0_obfuscation.d.ts → 0_obfuscation.d.ts} +2 -2
- package/script/transport/{utilities/0_obfuscation.js → 0_obfuscation.js} +3 -3
- package/script/transport/{transport_abridged.d.ts → 1_transport_abridged.d.ts} +2 -2
- package/script/transport/{transport_abridged.js → 1_transport_abridged.js} +3 -3
- package/script/transport/{transport_intermediate.d.ts → 1_transport_intermediate.d.ts} +2 -2
- package/script/transport/{transport_intermediate.js → 1_transport_intermediate.js} +3 -3
- package/{esm/transport/transport_provider.d.ts → script/transport/2_transport_provider.d.ts} +2 -2
- package/script/transport/{transport_provider.js → 2_transport_provider.js} +4 -4
- package/script/types/!0_file_id.d.ts +77 -0
- package/script/types/!0_file_id.js +329 -0
- package/script/types/0_chat_photo.d.ts +7 -14
- package/script/types/0_chat_photo.js +33 -18
- package/script/types/1_chat.js +4 -4
- package/script/types/1_user.js +2 -2
- package/script/types/3_message.js +9 -0
- package/script/utilities/0_base64.d.ts +2 -0
- package/script/utilities/0_base64.js +14 -0
- package/script/utilities/0_rle.d.ts +2 -0
- package/script/utilities/0_rle.js +54 -0
- package/script/utilities/0_rle_test.d.ts +1 -0
- package/esm/deps/deno.land/x/q@v0.0.1/mod.d.ts +0 -6
- package/esm/deps/deno.land/x/q@v0.0.1/mod.js +0 -71
- package/script/deps/deno.land/x/q@v0.0.1/mod.d.ts +0 -6
- package/script/deps/deno.land/x/q@v0.0.1/mod.js +0 -75
- /package/esm/client/{utilities/0_password_test.d.ts → 0_password_test.d.ts} +0 -0
- /package/esm/connection/{connection.d.ts → 0_connection.d.ts} +0 -0
- /package/esm/connection/{connection.js → 0_connection.js} +0 -0
- /package/esm/connection/{connection_web_socket.js → 1_connection_web_socket.js} +0 -0
- /package/esm/storage/{storage.js → 0_storage.js} +0 -0
- /package/esm/transport/{transport.d.ts → 0_transport.d.ts} +0 -0
- /package/esm/transport/{transport.js → 0_transport.js} +0 -0
- /package/esm/types/{utilities/0_id_color.d.ts → !0_id_color.d.ts} +0 -0
- /package/esm/types/{utilities/0_id_color.js → !0_id_color.js} +0 -0
- /package/{script/client/utilities/0_password_test.d.ts → esm/utilities/0_rle_test.d.ts} +0 -0
- /package/script/connection/{connection.d.ts → 0_connection.d.ts} +0 -0
- /package/script/connection/{connection.js → 0_connection.js} +0 -0
- /package/script/connection/{connection_web_socket.js → 1_connection_web_socket.js} +0 -0
- /package/script/storage/{storage.js → 0_storage.js} +0 -0
- /package/script/transport/{transport.d.ts → 0_transport.d.ts} +0 -0
- /package/script/transport/{transport.js → 0_transport.js} +0 -0
- /package/script/types/{utilities/0_id_color.d.ts → !0_id_color.d.ts} +0 -0
- /package/script/types/{utilities/0_id_color.js → !0_id_color.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function queue<T, R>(runner: (task: T) => R, concurrency: number): {
|
|
2
|
-
push: (task: T | T[]) => void;
|
|
3
|
-
drain: (fn?: any) => void | Promise<any>;
|
|
4
|
-
onError: (fn: (task: T, error: Error) => any) => (task: T, error: Error) => any;
|
|
5
|
-
onDone: (fn: (task: T, result: R) => any) => (task: T, result: R) => any;
|
|
6
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
export function queue(runner, concurrency) {
|
|
2
|
-
if (concurrency <= 0) {
|
|
3
|
-
throw new RangeError('concurrency can only be a positive integer');
|
|
4
|
-
}
|
|
5
|
-
if (!Number.isInteger(concurrency)) {
|
|
6
|
-
throw new RangeError('concurrency can only be a positive integer');
|
|
7
|
-
}
|
|
8
|
-
const tasks = [];
|
|
9
|
-
let running = 0;
|
|
10
|
-
let drains = [];
|
|
11
|
-
let onError = () => { };
|
|
12
|
-
let onDone = () => { };
|
|
13
|
-
let drainAwaiters = [];
|
|
14
|
-
function drained() {
|
|
15
|
-
drains.forEach((d) => d());
|
|
16
|
-
drains = [];
|
|
17
|
-
drainAwaiters.forEach((s) => s());
|
|
18
|
-
drainAwaiters = [];
|
|
19
|
-
}
|
|
20
|
-
async function runNext() {
|
|
21
|
-
if (running < concurrency && tasks.length > 0) {
|
|
22
|
-
running++;
|
|
23
|
-
const task = tasks.shift();
|
|
24
|
-
if (task) {
|
|
25
|
-
try {
|
|
26
|
-
const result = await runner(task);
|
|
27
|
-
onDone(task, result);
|
|
28
|
-
}
|
|
29
|
-
catch (err) {
|
|
30
|
-
onError(task, err);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
running--;
|
|
34
|
-
if (tasks.length > 0) {
|
|
35
|
-
queueMicrotask(runNext); // to prevent "Maximum call stack size exceeded"
|
|
36
|
-
}
|
|
37
|
-
else if (running === 0) {
|
|
38
|
-
drained();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return {
|
|
43
|
-
push: (task) => {
|
|
44
|
-
let needed = 1;
|
|
45
|
-
if (Array.isArray(task)) {
|
|
46
|
-
tasks.push(...task);
|
|
47
|
-
needed = task.length;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
tasks.push(task);
|
|
51
|
-
}
|
|
52
|
-
const free = concurrency - running;
|
|
53
|
-
for (let i = 0; i < Math.max(free, needed); i++) {
|
|
54
|
-
runNext();
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
drain: (fn) => {
|
|
58
|
-
if (fn) {
|
|
59
|
-
drains.push(fn);
|
|
60
|
-
}
|
|
61
|
-
else if (tasks.length > 0 || running > 0) {
|
|
62
|
-
return new Promise((resolve) => drainAwaiters.push(resolve));
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
return Promise.resolve();
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
onError: (fn) => (onError = fn),
|
|
69
|
-
onDone: (fn) => (onDone = fn),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare function queue<T, R>(runner: (task: T) => R, concurrency: number): {
|
|
2
|
-
push: (task: T | T[]) => void;
|
|
3
|
-
drain: (fn?: any) => void | Promise<any>;
|
|
4
|
-
onError: (fn: (task: T, error: Error) => any) => (task: T, error: Error) => any;
|
|
5
|
-
onDone: (fn: (task: T, result: R) => any) => (task: T, result: R) => any;
|
|
6
|
-
};
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.queue = void 0;
|
|
4
|
-
function queue(runner, concurrency) {
|
|
5
|
-
if (concurrency <= 0) {
|
|
6
|
-
throw new RangeError('concurrency can only be a positive integer');
|
|
7
|
-
}
|
|
8
|
-
if (!Number.isInteger(concurrency)) {
|
|
9
|
-
throw new RangeError('concurrency can only be a positive integer');
|
|
10
|
-
}
|
|
11
|
-
const tasks = [];
|
|
12
|
-
let running = 0;
|
|
13
|
-
let drains = [];
|
|
14
|
-
let onError = () => { };
|
|
15
|
-
let onDone = () => { };
|
|
16
|
-
let drainAwaiters = [];
|
|
17
|
-
function drained() {
|
|
18
|
-
drains.forEach((d) => d());
|
|
19
|
-
drains = [];
|
|
20
|
-
drainAwaiters.forEach((s) => s());
|
|
21
|
-
drainAwaiters = [];
|
|
22
|
-
}
|
|
23
|
-
async function runNext() {
|
|
24
|
-
if (running < concurrency && tasks.length > 0) {
|
|
25
|
-
running++;
|
|
26
|
-
const task = tasks.shift();
|
|
27
|
-
if (task) {
|
|
28
|
-
try {
|
|
29
|
-
const result = await runner(task);
|
|
30
|
-
onDone(task, result);
|
|
31
|
-
}
|
|
32
|
-
catch (err) {
|
|
33
|
-
onError(task, err);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
running--;
|
|
37
|
-
if (tasks.length > 0) {
|
|
38
|
-
queueMicrotask(runNext); // to prevent "Maximum call stack size exceeded"
|
|
39
|
-
}
|
|
40
|
-
else if (running === 0) {
|
|
41
|
-
drained();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
push: (task) => {
|
|
47
|
-
let needed = 1;
|
|
48
|
-
if (Array.isArray(task)) {
|
|
49
|
-
tasks.push(...task);
|
|
50
|
-
needed = task.length;
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
tasks.push(task);
|
|
54
|
-
}
|
|
55
|
-
const free = concurrency - running;
|
|
56
|
-
for (let i = 0; i < Math.max(free, needed); i++) {
|
|
57
|
-
runNext();
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
drain: (fn) => {
|
|
61
|
-
if (fn) {
|
|
62
|
-
drains.push(fn);
|
|
63
|
-
}
|
|
64
|
-
else if (tasks.length > 0 || running > 0) {
|
|
65
|
-
return new Promise((resolve) => drainAwaiters.push(resolve));
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
return Promise.resolve();
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
onError: (fn) => (onError = fn),
|
|
72
|
-
onDone: (fn) => (onDone = fn),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
exports.queue = queue;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|