@tgsnake/skema 1.12.0 → 2.0.0-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.
Files changed (147) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +125 -16
  3. package/dist/mod.d.ts +10 -0
  4. package/dist/mod.js +10 -0
  5. package/dist/src/Logger.d.ts +20 -0
  6. package/dist/src/Logger.js +23 -0
  7. package/dist/src/deps.d.ts +29 -0
  8. package/dist/src/deps.js +34 -0
  9. package/dist/src/errors/Base.d.ts +53 -0
  10. package/dist/src/errors/Base.js +114 -0
  11. package/dist/src/errors/Client.d.ts +69 -0
  12. package/dist/src/errors/Client.js +69 -0
  13. package/dist/src/errors/File.d.ts +89 -0
  14. package/dist/src/errors/File.js +99 -0
  15. package/dist/src/errors/RpcError.d.ts +115 -0
  16. package/dist/src/errors/RpcError.js +226 -0
  17. package/dist/src/errors/SecretChat.d.ts +78 -0
  18. package/dist/src/errors/SecretChat.js +88 -0
  19. package/dist/src/errors/WebSocket.d.ts +70 -0
  20. package/dist/src/errors/WebSocket.js +80 -0
  21. package/dist/{errors → src/errors}/exceptions/All.d.ts +14 -0
  22. package/dist/{errors → src/errors}/exceptions/All.js +15 -5
  23. package/dist/{errors → src/errors}/exceptions/BadRequest400.d.ts +15 -1
  24. package/dist/src/errors/exceptions/BadRequest400.js +2683 -0
  25. package/dist/{errors → src/errors}/exceptions/Flood420.d.ts +15 -1
  26. package/dist/{errors → src/errors}/exceptions/Flood420.js +25 -24
  27. package/dist/{errors → src/errors}/exceptions/Forbidden403.d.ts +15 -1
  28. package/dist/src/errors/exceptions/Forbidden403.js +243 -0
  29. package/dist/{errors → src/errors}/exceptions/InternalServerError500.d.ts +15 -1
  30. package/dist/src/errors/exceptions/InternalServerError500.js +255 -0
  31. package/dist/{errors → src/errors}/exceptions/NotAcceptable406.d.ts +15 -1
  32. package/dist/{errors → src/errors}/exceptions/NotAcceptable406.js +51 -76
  33. package/dist/src/errors/exceptions/NotFound404.d.ts +27 -0
  34. package/dist/src/errors/exceptions/NotFound404.js +27 -0
  35. package/dist/src/errors/exceptions/SeeOther303.d.ts +39 -0
  36. package/dist/src/errors/exceptions/SeeOther303.js +39 -0
  37. package/dist/src/errors/exceptions/ServiceUnavailable503.d.ts +31 -0
  38. package/dist/src/errors/exceptions/ServiceUnavailable503.js +31 -0
  39. package/dist/{errors → src/errors}/exceptions/Unauthorized401.d.ts +15 -1
  40. package/dist/src/errors/exceptions/Unauthorized401.js +55 -0
  41. package/dist/src/errors/exceptions/index.d.ts +24 -0
  42. package/dist/src/errors/exceptions/index.js +24 -0
  43. package/dist/src/errors/index.d.ts +142 -0
  44. package/dist/src/errors/index.js +178 -0
  45. package/dist/src/helpers.d.ts +102 -0
  46. package/dist/src/helpers.js +176 -0
  47. package/dist/src/index.d.ts +12 -0
  48. package/dist/src/index.js +12 -0
  49. package/dist/{raw → src/raw}/All.d.ts +47 -5
  50. package/dist/{raw → src/raw}/All.js +48 -9
  51. package/dist/{raw → src/raw}/Raw.d.ts +17546 -9
  52. package/dist/{raw → src/raw}/Raw.js +44899 -21694
  53. package/dist/src/raw/UpdateSecretChat.d.ts +186 -0
  54. package/dist/src/raw/UpdateSecretChat.js +215 -0
  55. package/dist/src/raw/core/GzipPacked.d.ts +63 -0
  56. package/dist/src/raw/core/GzipPacked.js +76 -0
  57. package/dist/src/raw/core/Message.d.ts +68 -0
  58. package/dist/src/raw/core/Message.js +105 -0
  59. package/dist/src/raw/core/MsgContainer.d.ts +56 -0
  60. package/dist/src/raw/core/MsgContainer.js +77 -0
  61. package/dist/src/raw/core/TLObject.d.ts +108 -0
  62. package/dist/src/raw/core/TLObject.js +209 -0
  63. package/dist/src/raw/core/index.d.ts +19 -0
  64. package/dist/src/raw/core/index.js +19 -0
  65. package/dist/src/raw/core/primitive/Bool.d.ts +104 -0
  66. package/dist/src/raw/core/primitive/Bool.js +120 -0
  67. package/dist/src/raw/core/primitive/Bytes.d.ts +45 -0
  68. package/dist/src/raw/core/primitive/Bytes.js +76 -0
  69. package/dist/src/raw/core/primitive/Double.d.ts +37 -0
  70. package/dist/src/raw/core/primitive/Double.js +51 -0
  71. package/dist/src/raw/core/primitive/Float.d.ts +37 -0
  72. package/dist/src/raw/core/primitive/Float.js +51 -0
  73. package/dist/src/raw/core/primitive/Int.d.ts +144 -0
  74. package/dist/src/raw/core/primitive/Int.js +237 -0
  75. package/dist/src/raw/core/primitive/String.d.ts +37 -0
  76. package/dist/src/raw/core/primitive/String.js +42 -0
  77. package/dist/src/raw/core/primitive/Vector.d.ts +56 -0
  78. package/dist/src/raw/core/primitive/Vector.js +93 -0
  79. package/dist/src/raw/core/primitive/index.d.ts +20 -0
  80. package/dist/src/raw/core/primitive/index.js +20 -0
  81. package/dist/src/raw/index.d.ts +17 -0
  82. package/dist/src/raw/index.js +17 -0
  83. package/package.json +54 -50
  84. package/dist/Logger.d.ts +0 -3
  85. package/dist/Logger.js +0 -9
  86. package/dist/deps.d.ts +0 -8
  87. package/dist/deps.js +0 -19
  88. package/dist/errors/Base.d.ts +0 -9
  89. package/dist/errors/Base.js +0 -50
  90. package/dist/errors/Client.d.ts +0 -21
  91. package/dist/errors/Client.js +0 -29
  92. package/dist/errors/File.d.ts +0 -13
  93. package/dist/errors/File.js +0 -30
  94. package/dist/errors/RpcError.d.ts +0 -22
  95. package/dist/errors/RpcError.js +0 -120
  96. package/dist/errors/SecretChat.d.ts +0 -13
  97. package/dist/errors/SecretChat.js +0 -30
  98. package/dist/errors/WebSocket.d.ts +0 -13
  99. package/dist/errors/WebSocket.js +0 -30
  100. package/dist/errors/exceptions/BadRequest400.js +0 -3352
  101. package/dist/errors/exceptions/Forbidden403.js +0 -290
  102. package/dist/errors/exceptions/InternalServerError500.js +0 -305
  103. package/dist/errors/exceptions/NotFound404.d.ts +0 -13
  104. package/dist/errors/exceptions/NotFound404.js +0 -19
  105. package/dist/errors/exceptions/SeeOther303.d.ts +0 -25
  106. package/dist/errors/exceptions/SeeOther303.js +0 -34
  107. package/dist/errors/exceptions/ServiceUnavailable503.d.ts +0 -17
  108. package/dist/errors/exceptions/ServiceUnavailable503.js +0 -24
  109. package/dist/errors/exceptions/Unauthorized401.js +0 -54
  110. package/dist/errors/exceptions/index.d.ts +0 -10
  111. package/dist/errors/exceptions/index.js +0 -48
  112. package/dist/errors/index.d.ts +0 -31
  113. package/dist/errors/index.js +0 -111
  114. package/dist/helpers.d.ts +0 -6
  115. package/dist/helpers.js +0 -85
  116. package/dist/index.d.ts +0 -3
  117. package/dist/index.js +0 -34
  118. package/dist/raw/UpdateSecretChat.d.ts +0 -43
  119. package/dist/raw/UpdateSecretChat.js +0 -91
  120. package/dist/raw/core/GzipPacked.d.ts +0 -9
  121. package/dist/raw/core/GzipPacked.js +0 -59
  122. package/dist/raw/core/Message.d.ts +0 -12
  123. package/dist/raw/core/Message.js +0 -80
  124. package/dist/raw/core/MsgContainer.d.ts +0 -10
  125. package/dist/raw/core/MsgContainer.js +0 -68
  126. package/dist/raw/core/TLObject.d.ts +0 -18
  127. package/dist/raw/core/TLObject.js +0 -108
  128. package/dist/raw/core/index.d.ts +0 -6
  129. package/dist/raw/core/index.js +0 -46
  130. package/dist/raw/core/primitive/Bool.d.ts +0 -19
  131. package/dist/raw/core/primitive/Bool.js +0 -41
  132. package/dist/raw/core/primitive/Bytes.d.ts +0 -6
  133. package/dist/raw/core/primitive/Bytes.js +0 -41
  134. package/dist/raw/core/primitive/Double.d.ts +0 -6
  135. package/dist/raw/core/primitive/Double.js +0 -24
  136. package/dist/raw/core/primitive/Float.d.ts +0 -6
  137. package/dist/raw/core/primitive/Float.js +0 -24
  138. package/dist/raw/core/primitive/Int.d.ts +0 -22
  139. package/dist/raw/core/primitive/Int.js +0 -122
  140. package/dist/raw/core/primitive/String.d.ts +0 -6
  141. package/dist/raw/core/primitive/String.js +0 -15
  142. package/dist/raw/core/primitive/Vector.d.ts +0 -8
  143. package/dist/raw/core/primitive/Vector.js +0 -49
  144. package/dist/raw/core/primitive/index.d.ts +0 -7
  145. package/dist/raw/core/primitive/index.js +0 -22
  146. package/dist/raw/index.d.ts +0 -4
  147. package/dist/raw/index.js +0 -17
package/dist/deps.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export { BytesIO } from '@tgsnake/bytesio';
2
- export { Logger } from '@tgsnake/log';
3
- export { gzipSync, gunzipSync } from 'node:zlib';
4
- export { Buffer } from 'node:buffer';
5
- import { inspect as nodeInspect } from 'node:util';
6
- import bigInt from 'big-integer';
7
- export declare const inspect: typeof nodeInspect;
8
- export { bigInt };
package/dist/deps.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.bigInt = exports.inspect = exports.Buffer = exports.gunzipSync = exports.gzipSync = exports.Logger = exports.BytesIO = void 0;
7
- var bytesio_1 = require("@tgsnake/bytesio");
8
- Object.defineProperty(exports, "BytesIO", { enumerable: true, get: function () { return bytesio_1.BytesIO; } });
9
- var log_1 = require("@tgsnake/log");
10
- Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return log_1.Logger; } });
11
- var node_zlib_1 = require("node:zlib");
12
- Object.defineProperty(exports, "gzipSync", { enumerable: true, get: function () { return node_zlib_1.gzipSync; } });
13
- Object.defineProperty(exports, "gunzipSync", { enumerable: true, get: function () { return node_zlib_1.gunzipSync; } });
14
- var node_buffer_1 = require("node:buffer");
15
- Object.defineProperty(exports, "Buffer", { enumerable: true, get: function () { return node_buffer_1.Buffer; } });
16
- const node_util_1 = require("node:util");
17
- const big_integer_1 = __importDefault(require("big-integer"));
18
- exports.bigInt = big_integer_1.default;
19
- exports.inspect = 'Deno' in globalThis && 'inspect' in globalThis.Deno ? globalThis.Deno.inspect : node_util_1.inspect;
@@ -1,9 +0,0 @@
1
- export declare class BaseError extends Error {
2
- message: string;
3
- description?: string;
4
- constructor(message?: string);
5
- toJSON(): {
6
- [key: string]: unknown;
7
- };
8
- toString(): string;
9
- }
@@ -1,50 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BaseError = void 0;
4
- const deps_js_1 = require("@/deps.js");
5
- class BaseError extends Error {
6
- message;
7
- description;
8
- constructor(message) {
9
- super(message);
10
- }
11
- [Symbol.for('nodejs.util.inspect.custom')]() {
12
- const toPrint = {
13
- _: this.constructor.name,
14
- };
15
- for (const key in this) {
16
- if (Object.prototype.hasOwnProperty.call(this, key)) {
17
- const value = this[key];
18
- if (!key.startsWith('_')) {
19
- toPrint[key] = value;
20
- }
21
- }
22
- }
23
- Object.setPrototypeOf(toPrint, {
24
- stack: this.stack,
25
- });
26
- return toPrint;
27
- }
28
- [Symbol.for('Deno.customInspect')]() {
29
- return String((0, deps_js_1.inspect)(this[Symbol.for('nodejs.util.inspect.custom')](), { colors: true }));
30
- }
31
- toJSON() {
32
- const toPrint = {
33
- _: this.constructor.name,
34
- stack: this.stack,
35
- };
36
- for (const key in this) {
37
- if (Object.prototype.hasOwnProperty.call(this, key)) {
38
- const value = this[key];
39
- if (!key.startsWith('_')) {
40
- toPrint[key] = typeof value === 'bigint' ? String(value) : value;
41
- }
42
- }
43
- }
44
- return toPrint;
45
- }
46
- toString() {
47
- return `[constructor of ${this.constructor.name}] ${JSON.stringify(this, null, 2)}`;
48
- }
49
- }
50
- exports.BaseError = BaseError;
@@ -1,21 +0,0 @@
1
- import { BaseError } from '@/errors/Base.js';
2
- export declare class ClientDisconnected extends BaseError {
3
- message: string;
4
- description: string;
5
- }
6
- export declare class ClientFailed extends BaseError {
7
- message: string;
8
- description: string;
9
- }
10
- export declare class ClientReady extends BaseError {
11
- message: string;
12
- description: string;
13
- }
14
- export declare class ClientNotReady extends BaseError {
15
- message: string;
16
- description: string;
17
- }
18
- export declare class AuthKeyMissing extends BaseError {
19
- message: string;
20
- description: string;
21
- }
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthKeyMissing = exports.ClientNotReady = exports.ClientReady = exports.ClientFailed = exports.ClientDisconnected = void 0;
4
- const Base_js_1 = require("@/errors/Base.js");
5
- class ClientDisconnected extends Base_js_1.BaseError {
6
- message = "Can't send request to telegram when client is unconnected.";
7
- description = 'The provided telegram client is unconnected, make sure to start the telegram client first before sending request.';
8
- }
9
- exports.ClientDisconnected = ClientDisconnected;
10
- class ClientFailed extends Base_js_1.BaseError {
11
- message = 'Client failed to connect to server.';
12
- description = 'The provided telegram client failed to connect to the telegram data center server. Attempts to connect to the telegram server have exceeded the specified maximum limit.';
13
- }
14
- exports.ClientFailed = ClientFailed;
15
- class ClientReady extends Base_js_1.BaseError {
16
- message = 'Client is already connected to server.';
17
- description = 'The provided telegram client has been already connected to the telegram data center server.';
18
- }
19
- exports.ClientReady = ClientReady;
20
- class ClientNotReady extends Base_js_1.BaseError {
21
- message = 'Client is already disconnected to server.';
22
- description = 'The provided telegram client has been already disconnected to the telegram data center server.';
23
- }
24
- exports.ClientNotReady = ClientNotReady;
25
- class AuthKeyMissing extends Base_js_1.BaseError {
26
- message = 'Auth key unavailable';
27
- description = 'Auth key is unavailable, this can happen because at when the client is run, the user does not provide information to login.';
28
- }
29
- exports.AuthKeyMissing = AuthKeyMissing;
@@ -1,13 +0,0 @@
1
- import { BaseError } from '@/errors/Base.js';
2
- export declare class FileError extends BaseError {
3
- constructor(message: string, description?: string);
4
- }
5
- export declare class FileUploadZero extends FileError {
6
- constructor();
7
- }
8
- export declare class FileUploadBigger extends FileError {
9
- constructor(limit: number, size: number);
10
- }
11
- export declare class FileIsNotReadable extends FileError {
12
- constructor();
13
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FileIsNotReadable = exports.FileUploadBigger = exports.FileUploadZero = exports.FileError = void 0;
4
- const Base_js_1 = require("@/errors/Base.js");
5
- class FileError extends Base_js_1.BaseError {
6
- constructor(message, description) {
7
- super();
8
- this.message = message;
9
- this.description = description;
10
- }
11
- }
12
- exports.FileError = FileError;
13
- class FileUploadZero extends FileError {
14
- constructor() {
15
- super("Can't upload file when it zero bytes.", 'Provided file has zero bytes (0 B) file size.');
16
- }
17
- }
18
- exports.FileUploadZero = FileUploadZero;
19
- class FileUploadBigger extends FileError {
20
- constructor(limit, size) {
21
- super(`File greater than ${limit} B.`, `The provided file has ${size} B file size, it greater than ${limit} B`);
22
- }
23
- }
24
- exports.FileUploadBigger = FileUploadBigger;
25
- class FileIsNotReadable extends FileError {
26
- constructor() {
27
- super('FILE_IS_NOT_READABLE', 'The argument provided is not a Readable stream.');
28
- }
29
- }
30
- exports.FileIsNotReadable = FileIsNotReadable;
@@ -1,22 +0,0 @@
1
- import { Raw, TLObject } from '@/raw/index.js';
2
- export declare class RPCError extends Error {
3
- id: string;
4
- code: number;
5
- message: string;
6
- name: string;
7
- value?: number | string | Raw.RpcError;
8
- _isSigned?: boolean;
9
- _isUnknown?: boolean;
10
- _rpcName?: string;
11
- constructor(value?: number | string | Raw.RpcError, rpcName?: string, isUnknown?: boolean, isSigned?: boolean);
12
- protected _format(): void;
13
- static raise(rpcError: Raw.RpcError, rpcType: TLObject): Promise<void>;
14
- toJSON(): {
15
- [key: string]: unknown;
16
- };
17
- toString(): string;
18
- }
19
- export declare class UnknownError extends RPCError {
20
- code: number;
21
- name: string;
22
- }
@@ -1,120 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnknownError = exports.RPCError = void 0;
4
- const Logger_js_1 = require("@/Logger.js");
5
- const All_js_1 = require("@/errors/exceptions/All.js");
6
- const deps_js_1 = require("@/deps.js");
7
- const index_js_1 = require("@/errors/index.js");
8
- function getModule(name) {
9
- const [namespace, mod] = name.split('.');
10
- if (index_js_1.Exceptions[namespace] &&
11
- index_js_1.Exceptions[namespace][mod]) {
12
- return index_js_1.Exceptions[namespace][mod];
13
- }
14
- return UnknownError;
15
- }
16
- class RPCError extends Error {
17
- id;
18
- code;
19
- message;
20
- name;
21
- value;
22
- _isSigned;
23
- _isUnknown;
24
- _rpcName;
25
- constructor(value, rpcName, isUnknown, isSigned) {
26
- super();
27
- Logger_js_1.Logger.debug(`[8] Creating new instance RPCError(${rpcName ?? this.name})`);
28
- this._isSigned = isSigned;
29
- this._isUnknown = isUnknown;
30
- this._rpcName = rpcName;
31
- if (!Number.isNaN(value)) {
32
- this.value = Number(value);
33
- }
34
- else {
35
- this.value = value;
36
- }
37
- if (isUnknown) {
38
- Logger_js_1.Logger.debug(`[9] UnknownError : ${this.name}`);
39
- }
40
- }
41
- _format() {
42
- this.message = `Telegram Says: [${this._isSigned ? '-' : ''}${this.code} ${this.id || this.name}] - ${(this.message || '').replace(/\{value\}/g, String(this.value))} ${this._rpcName ? `(caused by ${this._rpcName})` : ''}`;
43
- }
44
- static async raise(rpcError, rpcType) {
45
- let code = rpcError.errorCode;
46
- const message = rpcError.errorMessage;
47
- const isSigned = code < 0;
48
- const name = rpcType.className;
49
- if (isSigned)
50
- code = -code;
51
- if (!(code in All_js_1.Exceptions)) {
52
- throw new UnknownError(`[${code} ${message}]`, name, true, isSigned);
53
- }
54
- let id = message.replace(/\_\d+/gm, '_X');
55
- const regexMatch = message.match(/\_(\d+)/gm);
56
- let value = '';
57
- if (regexMatch) {
58
- value = regexMatch[0].replace(/\_/g, '');
59
- }
60
- if (!(id in All_js_1.Exceptions[code])) {
61
- id = id.split('_').splice(-1, 1, '*').join('_');
62
- if (!(id in All_js_1.Exceptions[code])) {
63
- const modules = getModule(All_js_1.Exceptions[code]['_']);
64
- const _module = new modules(value, name, true, isSigned);
65
- _module.message = `[${code} ${message}]`;
66
- _module.id = message.replace(/\_\d+/gm, '_X');
67
- _module._format();
68
- throw _module;
69
- }
70
- }
71
- const modules = await getModule(All_js_1.Exceptions[code][id]);
72
- const _module = new modules(value, name, false, isSigned);
73
- _module._format();
74
- throw _module;
75
- }
76
- [Symbol.for('nodejs.util.inspect.custom')]() {
77
- const toPrint = {
78
- _: this.constructor.name,
79
- };
80
- for (const key in this) {
81
- if (Object.prototype.hasOwnProperty.call(this, key)) {
82
- const value = this[key];
83
- if (!key.startsWith('_') && value !== undefined && value !== null) {
84
- toPrint[key] = value;
85
- }
86
- }
87
- }
88
- Object.setPrototypeOf(toPrint, {
89
- stack: this.stack,
90
- });
91
- return toPrint;
92
- }
93
- [Symbol.for('Deno.customInspect')]() {
94
- return String((0, deps_js_1.inspect)(this[Symbol.for('nodejs.util.inspect.custom')](), { colors: true }));
95
- }
96
- toJSON() {
97
- const toPrint = {
98
- _: this.constructor.name,
99
- stack: this.stack,
100
- };
101
- for (const key in this) {
102
- if (Object.prototype.hasOwnProperty.call(this, key)) {
103
- const value = this[key];
104
- if (!key.startsWith('_')) {
105
- toPrint[key] = typeof value === 'bigint' ? String(value) : value;
106
- }
107
- }
108
- }
109
- return toPrint;
110
- }
111
- toString() {
112
- return `[constructor of ${this.constructor.name}] ${JSON.stringify(this, null, 2)}`;
113
- }
114
- }
115
- exports.RPCError = RPCError;
116
- class UnknownError extends RPCError {
117
- code = 520;
118
- name = 'Unknown Error';
119
- }
120
- exports.UnknownError = UnknownError;
@@ -1,13 +0,0 @@
1
- import { BaseError } from '@/errors/Base.js';
2
- export declare class SecretChatError extends BaseError {
3
- constructor(message: string, description?: string);
4
- }
5
- export declare class FingerprintMismatch extends SecretChatError {
6
- constructor();
7
- }
8
- export declare class ChatNotFound extends SecretChatError {
9
- constructor(chatId: number);
10
- }
11
- export declare class AlreadyAccepted extends SecretChatError {
12
- constructor();
13
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AlreadyAccepted = exports.ChatNotFound = exports.FingerprintMismatch = exports.SecretChatError = void 0;
4
- const Base_js_1 = require("@/errors/Base.js");
5
- class SecretChatError extends Base_js_1.BaseError {
6
- constructor(message, description) {
7
- super();
8
- this.message = message;
9
- this.description = description;
10
- }
11
- }
12
- exports.SecretChatError = SecretChatError;
13
- class FingerprintMismatch extends SecretChatError {
14
- constructor() {
15
- super('Fingerprint key mismatch', 'Given fingerprint key from message is mismatch. So the message is not secure and the secret chat should be closed.');
16
- }
17
- }
18
- exports.FingerprintMismatch = FingerprintMismatch;
19
- class ChatNotFound extends SecretChatError {
20
- constructor(chatId) {
21
- super('Secret chat not found', `Provided chatId (${chatId}) is not found in session. Make sure the chatId is correct and already saved in session.`);
22
- }
23
- }
24
- exports.ChatNotFound = ChatNotFound;
25
- class AlreadyAccepted extends SecretChatError {
26
- constructor() {
27
- super('Secret chat already accepted');
28
- }
29
- }
30
- exports.AlreadyAccepted = AlreadyAccepted;
@@ -1,13 +0,0 @@
1
- import { BaseError } from '@/errors/Base.js';
2
- export declare class WebSocketError extends BaseError {
3
- constructor(message: string, description?: string);
4
- }
5
- export declare class Disconnected extends WebSocketError {
6
- constructor();
7
- }
8
- export declare class ReadClosed extends WebSocketError {
9
- constructor();
10
- }
11
- export declare class ProxyUnsupported extends WebSocketError {
12
- constructor();
13
- }
@@ -1,30 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ProxyUnsupported = exports.ReadClosed = exports.Disconnected = exports.WebSocketError = void 0;
4
- const Base_js_1 = require("@/errors/Base.js");
5
- class WebSocketError extends Base_js_1.BaseError {
6
- constructor(message, description) {
7
- super();
8
- this.message = message;
9
- this.description = description;
10
- }
11
- }
12
- exports.WebSocketError = WebSocketError;
13
- class Disconnected extends WebSocketError {
14
- constructor() {
15
- super('WebSocket Disconnected', "This happen when you trying to send request or receive update from websocket server hut the websocket client is doesn't ready. Make sure the websocket client is connected to server.");
16
- }
17
- }
18
- exports.Disconnected = Disconnected;
19
- class ReadClosed extends WebSocketError {
20
- constructor() {
21
- super('WebSocket connection closed when reading data', 'This happen when suddenly the connection between the websocket client and the server is lost when fetching data updates from the server.');
22
- }
23
- }
24
- exports.ReadClosed = ReadClosed;
25
- class ProxyUnsupported extends WebSocketError {
26
- constructor() {
27
- super('WebSocket proxy unsupported', 'This is because browser telegram or websocket proxy are not supported by the framework at this time.');
28
- }
29
- }
30
- exports.ProxyUnsupported = ProxyUnsupported;