@tgsnake/skema 3.1.0 → 3.2.1-browser.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/README.md +1 -1
- package/dist/src/deps.d.ts +4 -3
- package/dist/src/deps.js +4 -4
- package/dist/src/errors/RpcError.js +3 -1
- package/dist/src/helpers.js +19 -34
- package/dist/src/raw/class/All.d.ts +49 -5
- package/dist/src/raw/class/All.js +2783 -2739
- package/dist/src/raw/class/Raw.d.ts +7856 -7518
- package/dist/src/raw/class/Raw.js +27367 -20433
- package/dist/src/raw/class/tl/account.d.ts +841 -841
- package/dist/src/raw/class/tl/account.js +1983 -1813
- package/dist/src/raw/class/tl/aicompose.d.ts +51 -51
- package/dist/src/raw/class/tl/aicompose.js +128 -117
- package/dist/src/raw/class/tl/auth.d.ts +296 -296
- package/dist/src/raw/class/tl/auth.js +849 -714
- package/dist/src/raw/class/tl/bots.d.ts +353 -232
- package/dist/src/raw/class/tl/bots.js +871 -504
- package/dist/src/raw/class/tl/channels.d.ts +351 -331
- package/dist/src/raw/class/tl/channels.js +873 -735
- package/dist/src/raw/class/tl/chatlists.d.ts +81 -81
- package/dist/src/raw/class/tl/chatlists.js +196 -183
- package/dist/src/raw/class/tl/communities.d.ts +56 -56
- package/dist/src/raw/class/tl/communities.js +159 -138
- package/dist/src/raw/class/tl/contacts.d.ts +216 -216
- package/dist/src/raw/class/tl/contacts.js +537 -492
- package/dist/src/raw/class/tl/ephemeral.d.ts +51 -51
- package/dist/src/raw/class/tl/ephemeral.js +204 -152
- package/dist/src/raw/class/tl/feed.d.ts +278 -0
- package/dist/src/raw/class/tl/feed.js +671 -0
- package/dist/src/raw/class/tl/folders.d.ts +6 -6
- package/dist/src/raw/class/tl/folders.js +11 -11
- package/dist/src/raw/class/tl/fragment.d.ts +11 -11
- package/dist/src/raw/class/tl/fragment.js +32 -25
- package/dist/src/raw/class/tl/help.d.ts +286 -286
- package/dist/src/raw/class/tl/help.js +686 -618
- package/dist/src/raw/class/tl/langpack.d.ts +26 -26
- package/dist/src/raw/class/tl/langpack.js +57 -57
- package/dist/src/raw/class/tl/messages.d.ts +1901 -1851
- package/dist/src/raw/class/tl/messages.js +6043 -4855
- package/dist/src/raw/class/tl/payments.d.ts +677 -641
- package/dist/src/raw/class/tl/payments.js +2312 -1734
- package/dist/src/raw/class/tl/phone.d.ts +256 -256
- package/dist/src/raw/class/tl/phone.js +779 -644
- package/dist/src/raw/class/tl/photos.d.ts +41 -41
- package/dist/src/raw/class/tl/photos.js +139 -116
- package/dist/src/raw/class/tl/premium.d.ts +41 -41
- package/dist/src/raw/class/tl/premium.js +133 -111
- package/dist/src/raw/class/tl/smsjobs.d.ts +46 -46
- package/dist/src/raw/class/tl/smsjobs.js +115 -97
- package/dist/src/raw/class/tl/stats.d.ts +71 -71
- package/dist/src/raw/class/tl/stats.js +268 -169
- package/dist/src/raw/class/tl/stickers.d.ts +61 -61
- package/dist/src/raw/class/tl/stickers.js +173 -144
- package/dist/src/raw/class/tl/storage.d.ts +51 -51
- package/dist/src/raw/class/tl/storage.js +71 -71
- package/dist/src/raw/class/tl/stories.d.ts +221 -221
- package/dist/src/raw/class/tl/stories.js +781 -622
- package/dist/src/raw/class/tl/toncenter.d.ts +21 -21
- package/dist/src/raw/class/tl/toncenter.js +52 -47
- package/dist/src/raw/class/tl/updates.d.ts +56 -56
- package/dist/src/raw/class/tl/updates.js +246 -175
- package/dist/src/raw/class/tl/upload.d.ts +66 -66
- package/dist/src/raw/class/tl/upload.js +178 -155
- package/dist/src/raw/class/tl/users.d.ts +61 -61
- package/dist/src/raw/class/tl/users.js +124 -124
- package/dist/src/raw/class/tl/wallet.d.ts +257 -206
- package/dist/src/raw/class/tl/wallet.js +701 -525
- package/dist/src/raw/class/types.d.ts +3 -2
- package/dist/src/raw/class/types.js +1 -1
- package/dist/src/raw/core/GzipPacked.d.ts +4 -0
- package/dist/src/raw/core/GzipPacked.js +9 -1
- package/dist/src/raw/core/primitive/Bytes.js +26 -4
- package/dist/src/raw/core/primitive/Vector.js +11 -3
- package/package.json +7 -5
package/README.md
CHANGED
package/dist/src/deps.d.ts
CHANGED
|
@@ -9,8 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { BytesIO } from '@tgsnake/bytesio';
|
|
11
11
|
export { Logger } from '@tgsnake/log';
|
|
12
|
-
export { gzipSync, gunzipSync } from '
|
|
13
|
-
export { Buffer } from '
|
|
12
|
+
export { gzipSync, gunzipSync } from 'browserify-zlib';
|
|
13
|
+
export { Buffer } from 'buffer';
|
|
14
|
+
import { inspect as nodeInspect } from 'util';
|
|
14
15
|
import bigInt from 'big-integer';
|
|
15
16
|
/**
|
|
16
17
|
* Identifies the runtime platform environment.
|
|
@@ -24,5 +25,5 @@ export declare const platform: string;
|
|
|
24
25
|
*
|
|
25
26
|
* @type {typeof nodeInspect}
|
|
26
27
|
*/
|
|
27
|
-
export declare const inspect:
|
|
28
|
+
export declare const inspect: typeof nodeInspect;
|
|
28
29
|
export { bigInt };
|
package/dist/src/deps.js
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { BytesIO } from '@tgsnake/bytesio';
|
|
11
11
|
export { Logger } from '@tgsnake/log';
|
|
12
|
-
export { gzipSync, gunzipSync } from '
|
|
13
|
-
export { Buffer } from '
|
|
14
|
-
import { inspect as nodeInspect } from '
|
|
12
|
+
export { gzipSync, gunzipSync } from 'browserify-zlib';
|
|
13
|
+
export { Buffer } from 'buffer';
|
|
14
|
+
import { inspect as nodeInspect } from 'util';
|
|
15
15
|
import bigInt from 'big-integer';
|
|
16
16
|
// Other platform compatibility
|
|
17
17
|
// After this line, we will provide some compatibility for Deno, Bun, and Browser so that the same code can run in both environments without modification.
|
|
@@ -30,5 +30,5 @@ export const platform = isDeno ? 'Deno' : isBun ? 'Bun' : isBrowser ? 'Browser'
|
|
|
30
30
|
*
|
|
31
31
|
* @type {typeof nodeInspect}
|
|
32
32
|
*/
|
|
33
|
-
export const inspect =
|
|
33
|
+
export const inspect = nodeInspect;
|
|
34
34
|
export { bigInt };
|
|
@@ -143,7 +143,9 @@ export class RPCError extends Error {
|
|
|
143
143
|
if (!(id in Exceptions[code])) {
|
|
144
144
|
// try to replace the last word with asterisk (*)
|
|
145
145
|
// example: FILE_REFERENCE_*
|
|
146
|
-
|
|
146
|
+
const parts = id.split('_');
|
|
147
|
+
parts.splice(-1, 1, '*');
|
|
148
|
+
id = parts.join('_');
|
|
147
149
|
if (!(id in Exceptions[code])) {
|
|
148
150
|
const modules = await getModule(Exceptions[code]['_']);
|
|
149
151
|
const _module = new modules(value, name, true, isSigned);
|
package/dist/src/helpers.js
CHANGED
|
@@ -33,48 +33,33 @@ import { bigInt, Buffer } from './deps.js';
|
|
|
33
33
|
* ```
|
|
34
34
|
*/
|
|
35
35
|
export function bigintToBuffer(int, padding, litte = true, signed = false) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if (padding < bytes) {
|
|
39
|
-
throw new Error("Too big, Can't convert it to buffer with that padding.");
|
|
36
|
+
if (padding <= 0) {
|
|
37
|
+
throw new Error('Padding must be greater than 0');
|
|
40
38
|
}
|
|
39
|
+
const bits = BigInt(padding * 8);
|
|
41
40
|
if (!signed && int < BigInt(0)) {
|
|
42
41
|
throw new Error('Too small, can convert it when unsigned.');
|
|
43
42
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
int
|
|
43
|
+
if (signed) {
|
|
44
|
+
const minSigned = -(BigInt(1) << (bits - BigInt(1)));
|
|
45
|
+
const maxSigned = (BigInt(1) << (bits - BigInt(1))) - BigInt(1);
|
|
46
|
+
if (int < minSigned || int > maxSigned) {
|
|
47
|
+
throw new Error("Too big, Can't convert it to buffer with that padding.");
|
|
48
|
+
}
|
|
49
|
+
if (int < BigInt(0)) {
|
|
50
|
+
int = (BigInt(1) << bits) + int;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
const maxUnsigned = (BigInt(1) << bits) - BigInt(1);
|
|
55
|
+
if (int > maxUnsigned) {
|
|
56
|
+
throw new Error("Too big, Can't convert it to buffer with that padding.");
|
|
57
|
+
}
|
|
48
58
|
}
|
|
49
59
|
const hex = int.toString(16).padStart(padding * 2, '0');
|
|
50
60
|
let buffer = Buffer.from(hex, 'hex');
|
|
51
61
|
if (litte)
|
|
52
62
|
buffer = buffer.reverse();
|
|
53
|
-
if (isBellow && signed) {
|
|
54
|
-
if (litte) {
|
|
55
|
-
let isReminder = false;
|
|
56
|
-
if (buffer[0])
|
|
57
|
-
buffer[0] -= 1;
|
|
58
|
-
for (let b = 0; b < Buffer.byteLength(buffer); b++) {
|
|
59
|
-
if (!buffer[b]) {
|
|
60
|
-
isReminder = true;
|
|
61
|
-
continue;
|
|
62
|
-
}
|
|
63
|
-
if (isReminder) {
|
|
64
|
-
buffer[b] -= 1;
|
|
65
|
-
isReminder = false;
|
|
66
|
-
}
|
|
67
|
-
buffer[b] = 255 - buffer[b];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
buffer[Buffer.byteLength(buffer) - 1] =
|
|
72
|
-
256 - buffer[Buffer.byteLength(buffer) - 1];
|
|
73
|
-
for (let b = 0; b < Buffer.byteLength(buffer); b++) {
|
|
74
|
-
buffer[b] = 255 - buffer[b];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
63
|
return buffer;
|
|
79
64
|
}
|
|
80
65
|
/**
|
|
@@ -166,7 +151,7 @@ export function bigIntMod(n, m) {
|
|
|
166
151
|
*/
|
|
167
152
|
export function bufferToBigint(buffer, little = true, signed = false) {
|
|
168
153
|
const length = Buffer.byteLength(buffer);
|
|
169
|
-
const value = little ? buffer.reverse().toString('hex') : buffer.toString('hex');
|
|
154
|
+
const value = little ? Buffer.from(buffer).reverse().toString('hex') : buffer.toString('hex');
|
|
170
155
|
const _bigint = bigInt(value, 16);
|
|
171
156
|
let bigint = BigInt(String(_bigint));
|
|
172
157
|
if (signed && Math.floor(bigint.toString(2).length / 8) >= length) {
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* tgsnake is a free software: you can redistribute it and/or modify
|
|
8
8
|
* it under the terms of the MIT License as published.
|
|
9
|
-
*/
|
|
9
|
+
*/
|
|
10
10
|
export declare const AllTLObject: {
|
|
11
11
|
3162085175: string;
|
|
12
12
|
2574415285: string;
|
|
@@ -296,7 +296,7 @@ export declare const AllTLObject: {
|
|
|
296
296
|
4124956391: string;
|
|
297
297
|
177124030: string;
|
|
298
298
|
2663876157: string;
|
|
299
|
-
|
|
299
|
+
315061421: string;
|
|
300
300
|
341499403: string;
|
|
301
301
|
3242081360: string;
|
|
302
302
|
383348795: string;
|
|
@@ -510,6 +510,10 @@ export declare const AllTLObject: {
|
|
|
510
510
|
4203331319: string;
|
|
511
511
|
3148904669: string;
|
|
512
512
|
1934372475: string;
|
|
513
|
+
2850092326: string;
|
|
514
|
+
3905297064: string;
|
|
515
|
+
2395732973: string;
|
|
516
|
+
1951948721: string;
|
|
513
517
|
2775329342: string;
|
|
514
518
|
1567990072: string;
|
|
515
519
|
3079653952: string;
|
|
@@ -1257,7 +1261,7 @@ export declare const AllTLObject: {
|
|
|
1257
1261
|
3759268292: string;
|
|
1258
1262
|
3188294003: string;
|
|
1259
1263
|
2109703795: string;
|
|
1260
|
-
|
|
1264
|
+
2594492063: string;
|
|
1261
1265
|
406407439: string;
|
|
1262
1266
|
3383776159: string;
|
|
1263
1267
|
343859772: string;
|
|
@@ -1677,7 +1681,7 @@ export declare const AllTLObject: {
|
|
|
1677
1681
|
2029777832: string;
|
|
1678
1682
|
3472353192: string;
|
|
1679
1683
|
1339896880: string;
|
|
1680
|
-
|
|
1684
|
+
3935290381: string;
|
|
1681
1685
|
1012971041: string;
|
|
1682
1686
|
4047224023: string;
|
|
1683
1687
|
2430053882: string;
|
|
@@ -1760,6 +1764,7 @@ export declare const AllTLObject: {
|
|
|
1760
1764
|
1424428081: string;
|
|
1761
1765
|
4101149849: string;
|
|
1762
1766
|
1257549816: string;
|
|
1767
|
+
2675409911: string;
|
|
1763
1768
|
2502803779: string;
|
|
1764
1769
|
1126356389: string;
|
|
1765
1770
|
3872452353: string;
|
|
@@ -1816,6 +1821,24 @@ export declare const AllTLObject: {
|
|
|
1816
1821
|
4267082191: string;
|
|
1817
1822
|
2820735472: string;
|
|
1818
1823
|
12676885: string;
|
|
1824
|
+
2082111522: string;
|
|
1825
|
+
1348066419: string;
|
|
1826
|
+
3675927811: string;
|
|
1827
|
+
3707196601: string;
|
|
1828
|
+
2121511845: string;
|
|
1829
|
+
1697598577: string;
|
|
1830
|
+
1810307195: string;
|
|
1831
|
+
3198250685: string;
|
|
1832
|
+
1816553187: string;
|
|
1833
|
+
2043617685: string;
|
|
1834
|
+
3971362720: string;
|
|
1835
|
+
1871255310: string;
|
|
1836
|
+
389459662: string;
|
|
1837
|
+
2012441587: string;
|
|
1838
|
+
1050820527: string;
|
|
1839
|
+
1438248251: string;
|
|
1840
|
+
253279603: string;
|
|
1841
|
+
887385256: string;
|
|
1819
1842
|
3416209197: string;
|
|
1820
1843
|
1036301552: string;
|
|
1821
1844
|
3251461801: string;
|
|
@@ -2293,6 +2316,9 @@ export declare const AllTLObject: {
|
|
|
2293
2316
|
3127695786: string;
|
|
2294
2317
|
498593787: string;
|
|
2295
2318
|
136274721: string;
|
|
2319
|
+
3835876816: string;
|
|
2320
|
+
3418396603: string;
|
|
2321
|
+
546169867: string;
|
|
2296
2322
|
3990128682: string;
|
|
2297
2323
|
432207715: string;
|
|
2298
2324
|
51854712: string;
|
|
@@ -2348,7 +2374,7 @@ export declare const AllTLObject: {
|
|
|
2348
2374
|
4046346185: string;
|
|
2349
2375
|
283557164: string;
|
|
2350
2376
|
890549214: string;
|
|
2351
|
-
|
|
2377
|
+
1097643276: string;
|
|
2352
2378
|
4164332181: string;
|
|
2353
2379
|
3387112788: string;
|
|
2354
2380
|
3222347747: string;
|
|
@@ -2392,6 +2418,7 @@ export declare const AllTLObject: {
|
|
|
2392
2418
|
3974275302: string;
|
|
2393
2419
|
576090389: string;
|
|
2394
2420
|
897842353: string;
|
|
2421
|
+
3607427461: string;
|
|
2395
2422
|
2854709741: string;
|
|
2396
2423
|
3860938573: string;
|
|
2397
2424
|
85399130: string;
|
|
@@ -2432,6 +2459,11 @@ export declare const AllTLObject: {
|
|
|
2432
2459
|
3877259280: string;
|
|
2433
2460
|
889307274: string;
|
|
2434
2461
|
3338933373: string;
|
|
2462
|
+
2093007050: string;
|
|
2463
|
+
2239004788: string;
|
|
2464
|
+
905942386: string;
|
|
2465
|
+
4240581465: string;
|
|
2466
|
+
1923143539: string;
|
|
2435
2467
|
924093883: string;
|
|
2436
2468
|
611897804: string;
|
|
2437
2469
|
3066622251: string;
|
|
@@ -2516,6 +2548,7 @@ export declare const AllTLObject: {
|
|
|
2516
2548
|
4223311582: string;
|
|
2517
2549
|
1511098022: string;
|
|
2518
2550
|
470989500: string;
|
|
2551
|
+
1831727789: string;
|
|
2519
2552
|
2418125671: string;
|
|
2520
2553
|
4151709521: string;
|
|
2521
2554
|
4290172106: string;
|
|
@@ -2694,6 +2727,17 @@ export declare const AllTLObject: {
|
|
|
2694
2727
|
3594478030: string;
|
|
2695
2728
|
2818553198: string;
|
|
2696
2729
|
109382060: string;
|
|
2730
|
+
2807927035: string;
|
|
2731
|
+
840788815: string;
|
|
2732
|
+
4100932396: string;
|
|
2733
|
+
2121717715: string;
|
|
2734
|
+
3023487487: string;
|
|
2735
|
+
867755499: string;
|
|
2736
|
+
3128565178: string;
|
|
2737
|
+
2670287068: string;
|
|
2738
|
+
457925246: string;
|
|
2739
|
+
1299191644: string;
|
|
2740
|
+
2276398804: string;
|
|
2697
2741
|
528568095: string;
|
|
2698
2742
|
2856858237: string;
|
|
2699
2743
|
144661578: string;
|