@mtkruto/node 0.1.300 → 0.1.301

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.
@@ -10,3 +10,4 @@ export declare function checkPollOption(option: string): void;
10
10
  export declare function checkArray<T>(array: T[], check: (value: T) => void): void;
11
11
  export declare function checkCallbackQueryId(id: string): void;
12
12
  export declare function checkInlineQueryId(id: string): void;
13
+ export declare function isMtprotoFunction(value: unknown): boolean;
@@ -1,6 +1,7 @@
1
1
  import * as dntShim from "../_dnt.shims.js";
2
2
  import { path, unreachable } from "../0_deps.js";
3
3
  import { InputError } from "../0_errors.js";
4
+ import { functions } from "../2_tl.js";
4
5
  export const resolve = () => Promise.resolve();
5
6
  export async function getFileContents(source, fileName = "") {
6
7
  fileName = fileName.trim() || "file";
@@ -157,3 +158,14 @@ export function checkInlineQueryId(id) {
157
158
  throw new InputError("Invalid inline query ID.");
158
159
  }
159
160
  }
161
+ export function isMtprotoFunction(value) {
162
+ return value instanceof functions.ping ||
163
+ value instanceof functions.ping_delay_disconnect ||
164
+ value instanceof functions.req_pq_multi ||
165
+ value instanceof functions.rpc_drop_answer ||
166
+ value instanceof functions.get_future_salts ||
167
+ value instanceof functions.destroy_session ||
168
+ value instanceof functions.destroy_auth_key ||
169
+ value instanceof functions.req_DH_params ||
170
+ value instanceof functions.set_client_DH_params;
171
+ }
@@ -19,7 +19,7 @@ import { constructUser } from "../3_types.js";
19
19
  import { APP_VERSION, DEVICE_MODEL, LANG_CODE, LANG_PACK, LAYER, MAX_CHANNEL_ID, MAX_CHAT_ID, SYSTEM_LANG_CODE, SYSTEM_VERSION, USERNAME_TTL } from "../4_constants.js";
20
20
  import { AuthKeyUnregistered, ConnectionNotInited, FloodWait, Migrate, PasswordHashInvalid, PhoneNumberInvalid, SessionPasswordNeeded } from "../4_errors.js";
21
21
  import { checkPassword } from "./0_password.js";
22
- import { getUsername, resolve } from "./0_utilities.js";
22
+ import { getUsername, isMtprotoFunction, resolve } from "./0_utilities.js";
23
23
  import { AccountManager } from "./1_account_manager.js";
24
24
  import { BotInfoManager } from "./1_bot_info_manager.js";
25
25
  import { BusinessConnectionManager } from "./1_business_connection_manager.js";
@@ -1139,7 +1139,7 @@ export class Client extends Composer {
1139
1139
  let n = 1;
1140
1140
  while (true) {
1141
1141
  try {
1142
- if (function_ instanceof functions.Function && !__classPrivateFieldGet(this, _Client_connectionInited, "f")) {
1142
+ if (function_ instanceof functions.Function && !__classPrivateFieldGet(this, _Client_connectionInited, "f") && !isMtprotoFunction(function_)) {
1143
1143
  const result = await __classPrivateFieldGet(this, _Client_client, "f").invoke(new functions.initConnection({
1144
1144
  api_id: await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getApiId).call(this),
1145
1145
  app_version: this.appVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mtkruto/node",
3
- "version": "0.1.300",
3
+ "version": "0.1.301",
4
4
  "description": "MTKruto for Node.js",
5
5
  "author": "Roj <rojvv@icloud.com>",
6
6
  "repository": {
@@ -10,3 +10,4 @@ export declare function checkPollOption(option: string): void;
10
10
  export declare function checkArray<T>(array: T[], check: (value: T) => void): void;
11
11
  export declare function checkCallbackQueryId(id: string): void;
12
12
  export declare function checkInlineQueryId(id: string): void;
13
+ export declare function isMtprotoFunction(value: unknown): boolean;
@@ -23,10 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.checkInlineQueryId = exports.checkCallbackQueryId = exports.checkArray = exports.checkPollOption = exports.checkStoryId = exports.checkMessageId = exports.getChatListId = exports.getUsername = exports.isHttpUrl = exports.getFileContents = exports.resolve = void 0;
26
+ exports.isMtprotoFunction = exports.checkInlineQueryId = exports.checkCallbackQueryId = exports.checkArray = exports.checkPollOption = exports.checkStoryId = exports.checkMessageId = exports.getChatListId = exports.getUsername = exports.isHttpUrl = exports.getFileContents = exports.resolve = void 0;
27
27
  const dntShim = __importStar(require("../_dnt.shims.js"));
28
28
  const _0_deps_js_1 = require("../0_deps.js");
29
29
  const _0_errors_js_1 = require("../0_errors.js");
30
+ const _2_tl_js_1 = require("../2_tl.js");
30
31
  const resolve = () => Promise.resolve();
31
32
  exports.resolve = resolve;
32
33
  async function getFileContents(source, fileName = "") {
@@ -194,3 +195,15 @@ function checkInlineQueryId(id) {
194
195
  }
195
196
  }
196
197
  exports.checkInlineQueryId = checkInlineQueryId;
198
+ function isMtprotoFunction(value) {
199
+ return value instanceof _2_tl_js_1.functions.ping ||
200
+ value instanceof _2_tl_js_1.functions.ping_delay_disconnect ||
201
+ value instanceof _2_tl_js_1.functions.req_pq_multi ||
202
+ value instanceof _2_tl_js_1.functions.rpc_drop_answer ||
203
+ value instanceof _2_tl_js_1.functions.get_future_salts ||
204
+ value instanceof _2_tl_js_1.functions.destroy_session ||
205
+ value instanceof _2_tl_js_1.functions.destroy_auth_key ||
206
+ value instanceof _2_tl_js_1.functions.req_DH_params ||
207
+ value instanceof _2_tl_js_1.functions.set_client_DH_params;
208
+ }
209
+ exports.isMtprotoFunction = isMtprotoFunction;
@@ -1143,7 +1143,7 @@ class Client extends Composer {
1143
1143
  let n = 1;
1144
1144
  while (true) {
1145
1145
  try {
1146
- if (function_ instanceof _2_tl_js_1.functions.Function && !__classPrivateFieldGet(this, _Client_connectionInited, "f")) {
1146
+ if (function_ instanceof _2_tl_js_1.functions.Function && !__classPrivateFieldGet(this, _Client_connectionInited, "f") && !(0, _0_utilities_js_1.isMtprotoFunction)(function_)) {
1147
1147
  const result = await __classPrivateFieldGet(this, _Client_client, "f").invoke(new _2_tl_js_1.functions.initConnection({
1148
1148
  api_id: await __classPrivateFieldGet(this, _Client_instances, "m", _Client_getApiId).call(this),
1149
1149
  app_version: this.appVersion,