@tgsnake/skema 1.0.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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/Logger.d.ts +3 -0
- package/dist/Logger.js +9 -0
- package/dist/deps.d.ts +8 -0
- package/dist/deps.js +19 -0
- package/dist/errors/Base.d.ts +9 -0
- package/dist/errors/Base.js +50 -0
- package/dist/errors/Client.d.ts +21 -0
- package/dist/errors/Client.js +29 -0
- package/dist/errors/File.d.ts +13 -0
- package/dist/errors/File.js +30 -0
- package/dist/errors/RpcError.d.ts +22 -0
- package/dist/errors/RpcError.js +120 -0
- package/dist/errors/SecretChat.d.ts +13 -0
- package/dist/errors/SecretChat.js +30 -0
- package/dist/errors/WebSocket.d.ts +13 -0
- package/dist/errors/WebSocket.js +30 -0
- package/dist/errors/exceptions/All.d.ts +774 -0
- package/dist/errors/exceptions/All.js +778 -0
- package/dist/errors/exceptions/BadRequest400.d.ts +2345 -0
- package/dist/errors/exceptions/BadRequest400.js +2945 -0
- package/dist/errors/exceptions/Flood420.d.ts +37 -0
- package/dist/errors/exceptions/Flood420.js +49 -0
- package/dist/errors/exceptions/Forbidden403.d.ts +205 -0
- package/dist/errors/exceptions/Forbidden403.js +260 -0
- package/dist/errors/exceptions/InternalServerError500.d.ts +221 -0
- package/dist/errors/exceptions/InternalServerError500.js +280 -0
- package/dist/errors/exceptions/NotAcceptable406.d.ts +117 -0
- package/dist/errors/exceptions/NotAcceptable406.js +149 -0
- package/dist/errors/exceptions/NotFound404.d.ts +9 -0
- package/dist/errors/exceptions/NotFound404.js +14 -0
- package/dist/errors/exceptions/SeeOther303.d.ts +25 -0
- package/dist/errors/exceptions/SeeOther303.js +34 -0
- package/dist/errors/exceptions/ServiceUnavailable503.d.ts +17 -0
- package/dist/errors/exceptions/ServiceUnavailable503.js +24 -0
- package/dist/errors/exceptions/Unauthorized401.d.ts +41 -0
- package/dist/errors/exceptions/Unauthorized401.js +54 -0
- package/dist/errors/exceptions/index.d.ts +10 -0
- package/dist/errors/exceptions/index.js +48 -0
- package/dist/errors/index.d.ts +31 -0
- package/dist/errors/index.js +111 -0
- package/dist/helpers.d.ts +6 -0
- package/dist/helpers.js +85 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +34 -0
- package/dist/raw/All.d.ts +2258 -0
- package/dist/raw/All.js +2261 -0
- package/dist/raw/Raw.d.ts +27354 -0
- package/dist/raw/Raw.js +91005 -0
- package/dist/raw/UpdateSecretChat.d.ts +43 -0
- package/dist/raw/UpdateSecretChat.js +91 -0
- package/dist/raw/core/GzipPacked.d.ts +9 -0
- package/dist/raw/core/GzipPacked.js +59 -0
- package/dist/raw/core/Message.d.ts +12 -0
- package/dist/raw/core/Message.js +80 -0
- package/dist/raw/core/MsgContainer.d.ts +10 -0
- package/dist/raw/core/MsgContainer.js +68 -0
- package/dist/raw/core/TLObject.d.ts +18 -0
- package/dist/raw/core/TLObject.js +108 -0
- package/dist/raw/core/index.d.ts +6 -0
- package/dist/raw/core/index.js +46 -0
- package/dist/raw/core/primitive/Bool.d.ts +19 -0
- package/dist/raw/core/primitive/Bool.js +41 -0
- package/dist/raw/core/primitive/Bytes.d.ts +6 -0
- package/dist/raw/core/primitive/Bytes.js +41 -0
- package/dist/raw/core/primitive/Double.d.ts +6 -0
- package/dist/raw/core/primitive/Double.js +24 -0
- package/dist/raw/core/primitive/Float.d.ts +6 -0
- package/dist/raw/core/primitive/Float.js +24 -0
- package/dist/raw/core/primitive/Int.d.ts +22 -0
- package/dist/raw/core/primitive/Int.js +122 -0
- package/dist/raw/core/primitive/String.d.ts +6 -0
- package/dist/raw/core/primitive/String.js +15 -0
- package/dist/raw/core/primitive/Vector.d.ts +8 -0
- package/dist/raw/core/primitive/Vector.js +49 -0
- package/dist/raw/core/primitive/index.d.ts +7 -0
- package/dist/raw/core/primitive/index.js +22 -0
- package/dist/raw/index.d.ts +4 -0
- package/dist/raw/index.js +17 -0
- package/package.json +48 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserRestricted = exports.UserpicUploadRequired = exports.UserpicPrivacyRequired = exports.UpdateAppToLogin = exports.TopicDeleted = exports.TopicClosed = exports.StickersetOwnerAnonymous = exports.StickersetInvalid = exports.SendCodeUnavailable = exports.PrivacyPremiumRequired = exports.PreviousChatImportActiveWaitmin = exports.PremiumCurrentlyUnavailable = exports.PhonePasswordFlood = exports.PhoneNumberInvalid = exports.PaymentUnsupported = exports.InviteHashExpired = exports.GiftcodeNotAllowed = exports.FreshResetAuthorisationForbidden = exports.FreshChangePhoneForbidden = exports.FreshChangeAdminsForbidden = exports.FilerefUpgradeNeeded = exports.ChatForwardsRestricted = exports.ChannelTooLarge = exports.ChannelPrivate = exports.CallProtocolCompatLayerInvalid = exports.BusinessAddressActive = exports.BannedRightsInvalid = exports.AuthKeyDuplicated = exports.NotAcceptable = void 0;
|
|
4
|
+
const RpcError_js_1 = require("@/errors/RpcError.js");
|
|
5
|
+
class NotAcceptable extends RpcError_js_1.RPCError {
|
|
6
|
+
code = 406;
|
|
7
|
+
name = 'NOT_ACCEPTABLE';
|
|
8
|
+
}
|
|
9
|
+
exports.NotAcceptable = NotAcceptable;
|
|
10
|
+
class AuthKeyDuplicated extends NotAcceptable {
|
|
11
|
+
id = 'AUTH_KEY_DUPLICATED';
|
|
12
|
+
message = 'Concurrent usage of the current session from multiple connections was detected, the current session was invalidated by the server for security reasons!';
|
|
13
|
+
}
|
|
14
|
+
exports.AuthKeyDuplicated = AuthKeyDuplicated;
|
|
15
|
+
class BannedRightsInvalid extends NotAcceptable {
|
|
16
|
+
id = 'BANNED_RIGHTS_INVALID';
|
|
17
|
+
message = 'You provided some invalid flags in the banned rights.';
|
|
18
|
+
}
|
|
19
|
+
exports.BannedRightsInvalid = BannedRightsInvalid;
|
|
20
|
+
class BusinessAddressActive extends NotAcceptable {
|
|
21
|
+
id = 'BUSINESS_ADDRESS_ACTIVE';
|
|
22
|
+
message = 'The user is currently advertising a [Business Location](https://core.telegram.org/api/business#location), the location may only be changed (or removed) using [account.updateBusinessLocation »](https://core.telegram.org/method/account.updateBusinessLocation). .';
|
|
23
|
+
}
|
|
24
|
+
exports.BusinessAddressActive = BusinessAddressActive;
|
|
25
|
+
class CallProtocolCompatLayerInvalid extends NotAcceptable {
|
|
26
|
+
id = 'CALL_PROTOCOL_COMPAT_LAYER_INVALID';
|
|
27
|
+
message = 'The other side of the call does not support any of the VoIP protocols supported by the local client, as specified by the `protocol.layer` and `protocol.library_versions` fields.';
|
|
28
|
+
}
|
|
29
|
+
exports.CallProtocolCompatLayerInvalid = CallProtocolCompatLayerInvalid;
|
|
30
|
+
class ChannelPrivate extends NotAcceptable {
|
|
31
|
+
id = 'CHANNEL_PRIVATE';
|
|
32
|
+
message = "You haven't joined this channel/supergroup.";
|
|
33
|
+
}
|
|
34
|
+
exports.ChannelPrivate = ChannelPrivate;
|
|
35
|
+
class ChannelTooLarge extends NotAcceptable {
|
|
36
|
+
id = 'CHANNEL_TOO_LARGE';
|
|
37
|
+
message = 'Channel is too large to be deleted; this error is issued when trying to delete channels with more than 1000 members (subject to change).';
|
|
38
|
+
}
|
|
39
|
+
exports.ChannelTooLarge = ChannelTooLarge;
|
|
40
|
+
class ChatForwardsRestricted extends NotAcceptable {
|
|
41
|
+
id = 'CHAT_FORWARDS_RESTRICTED';
|
|
42
|
+
message = "You can't forward messages from a protected chat.";
|
|
43
|
+
}
|
|
44
|
+
exports.ChatForwardsRestricted = ChatForwardsRestricted;
|
|
45
|
+
class FilerefUpgradeNeeded extends NotAcceptable {
|
|
46
|
+
id = 'FILEREF_UPGRADE_NEEDED';
|
|
47
|
+
message = 'The client has to be updated in order to support [file references](https://core.telegram.org/api/file_reference).';
|
|
48
|
+
}
|
|
49
|
+
exports.FilerefUpgradeNeeded = FilerefUpgradeNeeded;
|
|
50
|
+
class FreshChangeAdminsForbidden extends NotAcceptable {
|
|
51
|
+
id = 'FRESH_CHANGE_ADMINS_FORBIDDEN';
|
|
52
|
+
message = "You were just elected admin, you can't add or modify other admins yet.";
|
|
53
|
+
}
|
|
54
|
+
exports.FreshChangeAdminsForbidden = FreshChangeAdminsForbidden;
|
|
55
|
+
class FreshChangePhoneForbidden extends NotAcceptable {
|
|
56
|
+
id = 'FRESH_CHANGE_PHONE_FORBIDDEN';
|
|
57
|
+
message = "You can't change phone number right after logging in, please wait at least 24 hours.";
|
|
58
|
+
}
|
|
59
|
+
exports.FreshChangePhoneForbidden = FreshChangePhoneForbidden;
|
|
60
|
+
class FreshResetAuthorisationForbidden extends NotAcceptable {
|
|
61
|
+
id = 'FRESH_RESET_AUTHORISATION_FORBIDDEN';
|
|
62
|
+
message = "You can't logout other sessions if less than 24 hours have passed since you logged on the current session.";
|
|
63
|
+
}
|
|
64
|
+
exports.FreshResetAuthorisationForbidden = FreshResetAuthorisationForbidden;
|
|
65
|
+
class GiftcodeNotAllowed extends NotAcceptable {
|
|
66
|
+
id = 'GIFTCODE_NOT_ALLOWED';
|
|
67
|
+
message = '';
|
|
68
|
+
}
|
|
69
|
+
exports.GiftcodeNotAllowed = GiftcodeNotAllowed;
|
|
70
|
+
class InviteHashExpired extends NotAcceptable {
|
|
71
|
+
id = 'INVITE_HASH_EXPIRED';
|
|
72
|
+
message = 'The invite link has expired.';
|
|
73
|
+
}
|
|
74
|
+
exports.InviteHashExpired = InviteHashExpired;
|
|
75
|
+
class PaymentUnsupported extends NotAcceptable {
|
|
76
|
+
id = 'PAYMENT_UNSUPPORTED';
|
|
77
|
+
message = 'A detailed description of the error will be received separately as described [here »](https://core.telegram.org/api/errors#406-not-acceptable).';
|
|
78
|
+
}
|
|
79
|
+
exports.PaymentUnsupported = PaymentUnsupported;
|
|
80
|
+
class PhoneNumberInvalid extends NotAcceptable {
|
|
81
|
+
id = 'PHONE_NUMBER_INVALID';
|
|
82
|
+
message = 'The phone number is invalid.';
|
|
83
|
+
}
|
|
84
|
+
exports.PhoneNumberInvalid = PhoneNumberInvalid;
|
|
85
|
+
class PhonePasswordFlood extends NotAcceptable {
|
|
86
|
+
id = 'PHONE_PASSWORD_FLOOD';
|
|
87
|
+
message = 'You have tried logging in too many times.';
|
|
88
|
+
}
|
|
89
|
+
exports.PhonePasswordFlood = PhonePasswordFlood;
|
|
90
|
+
class PremiumCurrentlyUnavailable extends NotAcceptable {
|
|
91
|
+
id = 'PREMIUM_CURRENTLY_UNAVAILABLE';
|
|
92
|
+
message = 'You cannot currently purchase a Premium subscription.';
|
|
93
|
+
}
|
|
94
|
+
exports.PremiumCurrentlyUnavailable = PremiumCurrentlyUnavailable;
|
|
95
|
+
class PreviousChatImportActiveWaitmin extends NotAcceptable {
|
|
96
|
+
id = 'PREVIOUS_CHAT_IMPORT_ACTIVE_WAIT_XMIN';
|
|
97
|
+
message = 'Import for this chat is already in progress, wait {value} minutes before starting a new one.';
|
|
98
|
+
}
|
|
99
|
+
exports.PreviousChatImportActiveWaitmin = PreviousChatImportActiveWaitmin;
|
|
100
|
+
class PrivacyPremiumRequired extends NotAcceptable {
|
|
101
|
+
id = 'PRIVACY_PREMIUM_REQUIRED';
|
|
102
|
+
message = 'You need a [Telegram Premium subscription](https://core.telegram.org/api/premium) to send a message to this user.';
|
|
103
|
+
}
|
|
104
|
+
exports.PrivacyPremiumRequired = PrivacyPremiumRequired;
|
|
105
|
+
class SendCodeUnavailable extends NotAcceptable {
|
|
106
|
+
id = 'SEND_CODE_UNAVAILABLE';
|
|
107
|
+
message = 'Returned when all available options for this type of number were already used (e.g. flash-call, then SMS, then this error might be returned to trigger a second resend).';
|
|
108
|
+
}
|
|
109
|
+
exports.SendCodeUnavailable = SendCodeUnavailable;
|
|
110
|
+
class StickersetInvalid extends NotAcceptable {
|
|
111
|
+
id = 'STICKERSET_INVALID';
|
|
112
|
+
message = 'The provided sticker set is invalid.';
|
|
113
|
+
}
|
|
114
|
+
exports.StickersetInvalid = StickersetInvalid;
|
|
115
|
+
class StickersetOwnerAnonymous extends NotAcceptable {
|
|
116
|
+
id = 'STICKERSET_OWNER_ANONYMOUS';
|
|
117
|
+
message = "Provided stickerset can't be installed as group stickerset to prevent admin deanonymization.";
|
|
118
|
+
}
|
|
119
|
+
exports.StickersetOwnerAnonymous = StickersetOwnerAnonymous;
|
|
120
|
+
class TopicClosed extends NotAcceptable {
|
|
121
|
+
id = 'TOPIC_CLOSED';
|
|
122
|
+
message = "This topic was closed, you can't send messages to it anymore.";
|
|
123
|
+
}
|
|
124
|
+
exports.TopicClosed = TopicClosed;
|
|
125
|
+
class TopicDeleted extends NotAcceptable {
|
|
126
|
+
id = 'TOPIC_DELETED';
|
|
127
|
+
message = 'The specified topic was deleted.';
|
|
128
|
+
}
|
|
129
|
+
exports.TopicDeleted = TopicDeleted;
|
|
130
|
+
class UpdateAppToLogin extends NotAcceptable {
|
|
131
|
+
id = 'UPDATE_APP_TO_LOGIN';
|
|
132
|
+
message = 'Please update your client to login.';
|
|
133
|
+
}
|
|
134
|
+
exports.UpdateAppToLogin = UpdateAppToLogin;
|
|
135
|
+
class UserpicPrivacyRequired extends NotAcceptable {
|
|
136
|
+
id = 'USERPIC_PRIVACY_REQUIRED';
|
|
137
|
+
message = 'You need to disable privacy settings for your profile picture in order to make your geolocation public.';
|
|
138
|
+
}
|
|
139
|
+
exports.UserpicPrivacyRequired = UserpicPrivacyRequired;
|
|
140
|
+
class UserpicUploadRequired extends NotAcceptable {
|
|
141
|
+
id = 'USERPIC_UPLOAD_REQUIRED';
|
|
142
|
+
message = 'You must have a profile picture to publish your geolocation.';
|
|
143
|
+
}
|
|
144
|
+
exports.UserpicUploadRequired = UserpicUploadRequired;
|
|
145
|
+
class UserRestricted extends NotAcceptable {
|
|
146
|
+
id = 'USER_RESTRICTED';
|
|
147
|
+
message = "You're spamreported, you can't create channels or chats.";
|
|
148
|
+
}
|
|
149
|
+
exports.UserRestricted = UserRestricted;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PeerIdInvalid = exports.NotFound = void 0;
|
|
4
|
+
const RpcError_js_1 = require("@/errors/RpcError.js");
|
|
5
|
+
class NotFound extends RpcError_js_1.RPCError {
|
|
6
|
+
code = 404;
|
|
7
|
+
name = 'NOT_FOUND';
|
|
8
|
+
}
|
|
9
|
+
exports.NotFound = NotFound;
|
|
10
|
+
class PeerIdInvalid extends NotFound {
|
|
11
|
+
id = 'PEER_ID_INVALID';
|
|
12
|
+
message = 'The provided peer id is invalid.';
|
|
13
|
+
}
|
|
14
|
+
exports.PeerIdInvalid = PeerIdInvalid;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { RPCError } from '@/errors/RpcError.js';
|
|
2
|
+
export declare class SeeOther extends RPCError {
|
|
3
|
+
code: number;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class FileMigrate extends SeeOther {
|
|
7
|
+
id: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class NetworkMigrate extends SeeOther {
|
|
11
|
+
id: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class PhoneMigrate extends SeeOther {
|
|
15
|
+
id: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class StatsMigrate extends SeeOther {
|
|
19
|
+
id: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class UserMigrate extends SeeOther {
|
|
23
|
+
id: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserMigrate = exports.StatsMigrate = exports.PhoneMigrate = exports.NetworkMigrate = exports.FileMigrate = exports.SeeOther = void 0;
|
|
4
|
+
const RpcError_js_1 = require("@/errors/RpcError.js");
|
|
5
|
+
class SeeOther extends RpcError_js_1.RPCError {
|
|
6
|
+
code = 303;
|
|
7
|
+
name = 'SEE_OTHER';
|
|
8
|
+
}
|
|
9
|
+
exports.SeeOther = SeeOther;
|
|
10
|
+
class FileMigrate extends SeeOther {
|
|
11
|
+
id = 'FILE_MIGRATE_X';
|
|
12
|
+
message = 'The file to be accessed is currently stored in DC{value}';
|
|
13
|
+
}
|
|
14
|
+
exports.FileMigrate = FileMigrate;
|
|
15
|
+
class NetworkMigrate extends SeeOther {
|
|
16
|
+
id = 'NETWORK_MIGRATE_X';
|
|
17
|
+
message = 'Your IP address is associated to DC {value}, please re-send the query to that DC.';
|
|
18
|
+
}
|
|
19
|
+
exports.NetworkMigrate = NetworkMigrate;
|
|
20
|
+
class PhoneMigrate extends SeeOther {
|
|
21
|
+
id = 'PHONE_MIGRATE_X';
|
|
22
|
+
message = 'Your phone number is associated to DC {value}, please re-send the query to that DC.';
|
|
23
|
+
}
|
|
24
|
+
exports.PhoneMigrate = PhoneMigrate;
|
|
25
|
+
class StatsMigrate extends SeeOther {
|
|
26
|
+
id = 'STATS_MIGRATE_X';
|
|
27
|
+
message = 'Channel statistics for the specified channel are stored on DC {value}, please re-send the query to that DC.';
|
|
28
|
+
}
|
|
29
|
+
exports.StatsMigrate = StatsMigrate;
|
|
30
|
+
class UserMigrate extends SeeOther {
|
|
31
|
+
id = 'USER_MIGRATE_X';
|
|
32
|
+
message = 'Your account is associated to DC {value}, please re-send the query to that DC.';
|
|
33
|
+
}
|
|
34
|
+
exports.UserMigrate = UserMigrate;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RPCError } from '@/errors/RpcError.js';
|
|
2
|
+
export declare class ServiceUnavailable extends RPCError {
|
|
3
|
+
code: number;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ApiCallError extends ServiceUnavailable {
|
|
7
|
+
id: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class MsgWaitTimeout extends ServiceUnavailable {
|
|
11
|
+
id: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class Timeout extends ServiceUnavailable {
|
|
15
|
+
id: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Timeout = exports.MsgWaitTimeout = exports.ApiCallError = exports.ServiceUnavailable = void 0;
|
|
4
|
+
const RpcError_js_1 = require("@/errors/RpcError.js");
|
|
5
|
+
class ServiceUnavailable extends RpcError_js_1.RPCError {
|
|
6
|
+
code = 503;
|
|
7
|
+
name = 'SERVICE_UNAVAILABLE';
|
|
8
|
+
}
|
|
9
|
+
exports.ServiceUnavailable = ServiceUnavailable;
|
|
10
|
+
class ApiCallError extends ServiceUnavailable {
|
|
11
|
+
id = 'ApiCallError';
|
|
12
|
+
message = 'Telegram is having internal problems. Please try again later.';
|
|
13
|
+
}
|
|
14
|
+
exports.ApiCallError = ApiCallError;
|
|
15
|
+
class MsgWaitTimeout extends ServiceUnavailable {
|
|
16
|
+
id = 'MSG_WAIT_TIMEOUT';
|
|
17
|
+
message = 'Spent too much time waiting for a previous query in the invokeAfterMsg request queue, aborting!';
|
|
18
|
+
}
|
|
19
|
+
exports.MsgWaitTimeout = MsgWaitTimeout;
|
|
20
|
+
class Timeout extends ServiceUnavailable {
|
|
21
|
+
id = 'Timeout';
|
|
22
|
+
message = 'Timeout while fetching data.';
|
|
23
|
+
}
|
|
24
|
+
exports.Timeout = Timeout;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { RPCError } from '@/errors/RpcError.js';
|
|
2
|
+
export declare class Unauthorized extends RPCError {
|
|
3
|
+
code: number;
|
|
4
|
+
name: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class ActiveUserRequired extends Unauthorized {
|
|
7
|
+
id: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class AuthKeyInvalid extends Unauthorized {
|
|
11
|
+
id: string;
|
|
12
|
+
message: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class AuthKeyPermEmpty extends Unauthorized {
|
|
15
|
+
id: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class AuthKeyUnregistered extends Unauthorized {
|
|
19
|
+
id: string;
|
|
20
|
+
message: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class SessionExpired extends Unauthorized {
|
|
23
|
+
id: string;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
26
|
+
export declare class SessionPasswordNeeded extends Unauthorized {
|
|
27
|
+
id: string;
|
|
28
|
+
message: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class SessionRevoked extends Unauthorized {
|
|
31
|
+
id: string;
|
|
32
|
+
message: string;
|
|
33
|
+
}
|
|
34
|
+
export declare class UserDeactivated extends Unauthorized {
|
|
35
|
+
id: string;
|
|
36
|
+
message: string;
|
|
37
|
+
}
|
|
38
|
+
export declare class UserDeactivatedBan extends Unauthorized {
|
|
39
|
+
id: string;
|
|
40
|
+
message: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UserDeactivatedBan = exports.UserDeactivated = exports.SessionRevoked = exports.SessionPasswordNeeded = exports.SessionExpired = exports.AuthKeyUnregistered = exports.AuthKeyPermEmpty = exports.AuthKeyInvalid = exports.ActiveUserRequired = exports.Unauthorized = void 0;
|
|
4
|
+
const RpcError_js_1 = require("@/errors/RpcError.js");
|
|
5
|
+
class Unauthorized extends RpcError_js_1.RPCError {
|
|
6
|
+
code = 401;
|
|
7
|
+
name = 'UNAUTHORIZED';
|
|
8
|
+
}
|
|
9
|
+
exports.Unauthorized = Unauthorized;
|
|
10
|
+
class ActiveUserRequired extends Unauthorized {
|
|
11
|
+
id = 'ACTIVE_USER_REQUIRED';
|
|
12
|
+
message = 'The method is only available to already activated users';
|
|
13
|
+
}
|
|
14
|
+
exports.ActiveUserRequired = ActiveUserRequired;
|
|
15
|
+
class AuthKeyInvalid extends Unauthorized {
|
|
16
|
+
id = 'AUTH_KEY_INVALID';
|
|
17
|
+
message = 'The specified auth key is invalid.';
|
|
18
|
+
}
|
|
19
|
+
exports.AuthKeyInvalid = AuthKeyInvalid;
|
|
20
|
+
class AuthKeyPermEmpty extends Unauthorized {
|
|
21
|
+
id = 'AUTH_KEY_PERM_EMPTY';
|
|
22
|
+
message = 'The method is unavailable for temporary authorization keys, not bound to a permanent authorization key.';
|
|
23
|
+
}
|
|
24
|
+
exports.AuthKeyPermEmpty = AuthKeyPermEmpty;
|
|
25
|
+
class AuthKeyUnregistered extends Unauthorized {
|
|
26
|
+
id = 'AUTH_KEY_UNREGISTERED';
|
|
27
|
+
message = 'The specified authorization key is not registered in the system (for example, a PFS temporary key has expired).';
|
|
28
|
+
}
|
|
29
|
+
exports.AuthKeyUnregistered = AuthKeyUnregistered;
|
|
30
|
+
class SessionExpired extends Unauthorized {
|
|
31
|
+
id = 'SESSION_EXPIRED';
|
|
32
|
+
message = 'The session has expired.';
|
|
33
|
+
}
|
|
34
|
+
exports.SessionExpired = SessionExpired;
|
|
35
|
+
class SessionPasswordNeeded extends Unauthorized {
|
|
36
|
+
id = 'SESSION_PASSWORD_NEEDED';
|
|
37
|
+
message = '2FA is enabled, use a password to login.';
|
|
38
|
+
}
|
|
39
|
+
exports.SessionPasswordNeeded = SessionPasswordNeeded;
|
|
40
|
+
class SessionRevoked extends Unauthorized {
|
|
41
|
+
id = 'SESSION_REVOKED';
|
|
42
|
+
message = 'The session was revoked by the user.';
|
|
43
|
+
}
|
|
44
|
+
exports.SessionRevoked = SessionRevoked;
|
|
45
|
+
class UserDeactivated extends Unauthorized {
|
|
46
|
+
id = 'USER_DEACTIVATED';
|
|
47
|
+
message = 'The current account was deleted by the user.';
|
|
48
|
+
}
|
|
49
|
+
exports.UserDeactivated = UserDeactivated;
|
|
50
|
+
class UserDeactivatedBan extends Unauthorized {
|
|
51
|
+
id = 'USER_DEACTIVATED_BAN';
|
|
52
|
+
message = "The current account was deleted and banned by Telegram's antispam system.";
|
|
53
|
+
}
|
|
54
|
+
exports.UserDeactivatedBan = UserDeactivatedBan;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { count, Exceptions } from '@/errors/exceptions/All.js';
|
|
2
|
+
export * as SeeOther from '@/errors/exceptions/SeeOther303.js';
|
|
3
|
+
export * as BadRequest from '@/errors/exceptions/BadRequest400.js';
|
|
4
|
+
export * as Unauthorized from '@/errors/exceptions/Unauthorized401.js';
|
|
5
|
+
export * as Forbidden from '@/errors/exceptions/Forbidden403.js';
|
|
6
|
+
export * as NotFound from '@/errors/exceptions/NotFound404.js';
|
|
7
|
+
export * as NotAcceptable from '@/errors/exceptions/NotAcceptable406.js';
|
|
8
|
+
export * as Flood from '@/errors/exceptions/Flood420.js';
|
|
9
|
+
export * as InternalServerError from '@/errors/exceptions/InternalServerError500.js';
|
|
10
|
+
export * as ServiceUnavailable from '@/errors/exceptions/ServiceUnavailable503.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.ServiceUnavailable = exports.InternalServerError = exports.Flood = exports.NotAcceptable = exports.NotFound = exports.Forbidden = exports.Unauthorized = exports.BadRequest = exports.SeeOther = exports.Exceptions = exports.count = void 0;
|
|
37
|
+
var All_js_1 = require("@/errors/exceptions/All.js");
|
|
38
|
+
Object.defineProperty(exports, "count", { enumerable: true, get: function () { return All_js_1.count; } });
|
|
39
|
+
Object.defineProperty(exports, "Exceptions", { enumerable: true, get: function () { return All_js_1.Exceptions; } });
|
|
40
|
+
exports.SeeOther = __importStar(require("@/errors/exceptions/SeeOther303.js"));
|
|
41
|
+
exports.BadRequest = __importStar(require("@/errors/exceptions/BadRequest400.js"));
|
|
42
|
+
exports.Unauthorized = __importStar(require("@/errors/exceptions/Unauthorized401.js"));
|
|
43
|
+
exports.Forbidden = __importStar(require("@/errors/exceptions/Forbidden403.js"));
|
|
44
|
+
exports.NotFound = __importStar(require("@/errors/exceptions/NotFound404.js"));
|
|
45
|
+
exports.NotAcceptable = __importStar(require("@/errors/exceptions/NotAcceptable406.js"));
|
|
46
|
+
exports.Flood = __importStar(require("@/errors/exceptions/Flood420.js"));
|
|
47
|
+
exports.InternalServerError = __importStar(require("@/errors/exceptions/InternalServerError500.js"));
|
|
48
|
+
exports.ServiceUnavailable = __importStar(require("@/errors/exceptions/ServiceUnavailable503.js"));
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export * as Exceptions from '@/errors/exceptions/index.js';
|
|
2
|
+
export * as ClientError from '@/errors/Client.js';
|
|
3
|
+
export * as WSError from '@/errors/WebSocket.js';
|
|
4
|
+
export * as SecretChatError from '@/errors/SecretChat.js';
|
|
5
|
+
export * as FileErrors from '@/errors/File.js';
|
|
6
|
+
export { RPCError, UnknownError } from '@/errors/RpcError.js';
|
|
7
|
+
import { BaseError } from '@/errors/Base.js';
|
|
8
|
+
export declare class TimeoutError extends BaseError {
|
|
9
|
+
timeout: number;
|
|
10
|
+
constructor(timeout: number);
|
|
11
|
+
}
|
|
12
|
+
export declare class NotAFunctionClass extends BaseError {
|
|
13
|
+
message: string;
|
|
14
|
+
description: string;
|
|
15
|
+
constructor(className: string);
|
|
16
|
+
}
|
|
17
|
+
export declare class BadMsgNotification extends BaseError {
|
|
18
|
+
constructor(code: number);
|
|
19
|
+
}
|
|
20
|
+
export declare class SecurityError extends BaseError {
|
|
21
|
+
constructor(description?: string);
|
|
22
|
+
static check(cond: boolean, description?: string): void;
|
|
23
|
+
}
|
|
24
|
+
export declare class SecurityCheckMismatch extends SecurityError {
|
|
25
|
+
message: string;
|
|
26
|
+
static check(cond: boolean, description?: string): void;
|
|
27
|
+
}
|
|
28
|
+
export declare class CDNFileHashMismatch extends SecurityError {
|
|
29
|
+
message: string;
|
|
30
|
+
static check(cond: boolean, description?: string): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
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
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.CDNFileHashMismatch = exports.SecurityCheckMismatch = exports.SecurityError = exports.BadMsgNotification = exports.NotAFunctionClass = exports.TimeoutError = exports.UnknownError = exports.RPCError = exports.FileErrors = exports.SecretChatError = exports.WSError = exports.ClientError = exports.Exceptions = void 0;
|
|
37
|
+
exports.Exceptions = __importStar(require("@/errors/exceptions/index.js"));
|
|
38
|
+
exports.ClientError = __importStar(require("@/errors/Client.js"));
|
|
39
|
+
exports.WSError = __importStar(require("@/errors/WebSocket.js"));
|
|
40
|
+
exports.SecretChatError = __importStar(require("@/errors/SecretChat.js"));
|
|
41
|
+
exports.FileErrors = __importStar(require("@/errors/File.js"));
|
|
42
|
+
var RpcError_js_1 = require("@/errors/RpcError.js");
|
|
43
|
+
Object.defineProperty(exports, "RPCError", { enumerable: true, get: function () { return RpcError_js_1.RPCError; } });
|
|
44
|
+
Object.defineProperty(exports, "UnknownError", { enumerable: true, get: function () { return RpcError_js_1.UnknownError; } });
|
|
45
|
+
const Base_js_1 = require("@/errors/Base.js");
|
|
46
|
+
class TimeoutError extends Base_js_1.BaseError {
|
|
47
|
+
timeout;
|
|
48
|
+
constructor(timeout) {
|
|
49
|
+
super();
|
|
50
|
+
this.message = `Running timeout after ${timeout} ms`;
|
|
51
|
+
this.timeout = timeout;
|
|
52
|
+
this.description = `The function is running too long, until it reaches the time limit that has been given.`;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.TimeoutError = TimeoutError;
|
|
56
|
+
class NotAFunctionClass extends Base_js_1.BaseError {
|
|
57
|
+
message = '{value} is not a function.';
|
|
58
|
+
description = "The provided class {value} is not a function constructor, can't sending request with that class.";
|
|
59
|
+
constructor(className) {
|
|
60
|
+
super();
|
|
61
|
+
this.message = this.message.replace('{value}', className);
|
|
62
|
+
this.description = this.description.replace('{value}', className);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.NotAFunctionClass = NotAFunctionClass;
|
|
66
|
+
class BadMsgNotification extends Base_js_1.BaseError {
|
|
67
|
+
constructor(code) {
|
|
68
|
+
const description = {
|
|
69
|
+
16: 'The msg_id is too low, the client time has to be synchronized.',
|
|
70
|
+
17: 'The msg_id is too high, the client time has to be synchronized.',
|
|
71
|
+
18: 'Incorrect two lower order of the msg_id bits, the server expects the client message\nmsg_id to be divisible by 4.',
|
|
72
|
+
19: 'The container msg_id is the same as the msg_id of a previously received message.',
|
|
73
|
+
20: 'The message is too old, it cannot be verified by the server.',
|
|
74
|
+
32: 'The msg_seqno is too low.',
|
|
75
|
+
33: 'The msg_seqno is too high.',
|
|
76
|
+
34: 'An even msg_seqno was expected, but an odd one was received.',
|
|
77
|
+
35: 'An odd msg_seqno was expected, but an even one was received.',
|
|
78
|
+
48: 'Incorrect server salt.',
|
|
79
|
+
64: 'Invalid container.',
|
|
80
|
+
};
|
|
81
|
+
super(`[${code}] ${description[code] ?? 'Unknown Error'}`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.BadMsgNotification = BadMsgNotification;
|
|
85
|
+
class SecurityError extends Base_js_1.BaseError {
|
|
86
|
+
constructor(description) {
|
|
87
|
+
super();
|
|
88
|
+
this.description = description;
|
|
89
|
+
}
|
|
90
|
+
static check(cond, description) {
|
|
91
|
+
if (!cond)
|
|
92
|
+
throw new SecurityError(description);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.SecurityError = SecurityError;
|
|
96
|
+
class SecurityCheckMismatch extends SecurityError {
|
|
97
|
+
message = 'A security check mismatch has occurred.';
|
|
98
|
+
static check(cond, description) {
|
|
99
|
+
if (!cond)
|
|
100
|
+
throw new SecurityCheckMismatch(description);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.SecurityCheckMismatch = SecurityCheckMismatch;
|
|
104
|
+
class CDNFileHashMismatch extends SecurityError {
|
|
105
|
+
message = 'A CDN file hash mismatch has occurred.';
|
|
106
|
+
static check(cond, description) {
|
|
107
|
+
if (!cond)
|
|
108
|
+
throw new CDNFileHashMismatch(description);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.CDNFileHashMismatch = CDNFileHashMismatch;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Buffer } from '@/deps.js';
|
|
2
|
+
export declare function bigintToBuffer(int: bigint, padding: number, litte?: boolean, signed?: boolean): Buffer<ArrayBuffer>;
|
|
3
|
+
export declare function bigIntPow(x: bigint, y: bigint, z?: bigint): bigint;
|
|
4
|
+
export declare function mod(n: number, m: number): number;
|
|
5
|
+
export declare function bigIntMod(n: bigint, m: bigint): bigint;
|
|
6
|
+
export declare function bufferToBigint(buffer: Buffer, little?: boolean, signed?: boolean): bigint;
|