@mtcute/core 0.28.0 → 0.28.1

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 (55) hide show
  1. package/client.cjs +8 -0
  2. package/client.js +8 -0
  3. package/highlevel/base.cjs +2 -0
  4. package/highlevel/base.js +2 -0
  5. package/highlevel/client.d.cts +19 -2
  6. package/highlevel/client.d.ts +19 -2
  7. package/highlevel/methods/chats/batched-queries.cjs +2 -4
  8. package/highlevel/methods/chats/batched-queries.d.cts +1 -1
  9. package/highlevel/methods/chats/batched-queries.d.ts +1 -1
  10. package/highlevel/methods/chats/batched-queries.js +2 -4
  11. package/highlevel/methods/chats/get-chats.cjs +27 -0
  12. package/highlevel/methods/chats/get-chats.d.cts +9 -0
  13. package/highlevel/methods/chats/get-chats.d.ts +9 -0
  14. package/highlevel/methods/chats/get-chats.js +22 -0
  15. package/highlevel/methods/chats/get-chats.test.d.cts +1 -0
  16. package/highlevel/methods/chats/get-chats.test.d.ts +1 -0
  17. package/highlevel/methods/chats/get-peers.cjs +16 -0
  18. package/highlevel/methods/chats/get-peers.d.cts +9 -0
  19. package/highlevel/methods/chats/get-peers.d.ts +9 -0
  20. package/highlevel/methods/chats/get-peers.js +11 -0
  21. package/highlevel/methods/chats/get-peers.test.d.cts +1 -0
  22. package/highlevel/methods/chats/get-peers.test.d.ts +1 -0
  23. package/highlevel/methods/contacts/set-contact-note.cjs +2 -0
  24. package/highlevel/methods/contacts/set-contact-note.js +2 -0
  25. package/highlevel/methods/users/get-users.d.cts +1 -2
  26. package/highlevel/methods/users/get-users.d.ts +1 -2
  27. package/highlevel/methods.d.cts +2 -0
  28. package/highlevel/methods.d.ts +2 -0
  29. package/highlevel/types/peers/peer.cjs +13 -3
  30. package/highlevel/types/peers/peer.d.cts +4 -0
  31. package/highlevel/types/peers/peer.d.ts +4 -0
  32. package/highlevel/types/peers/peer.js +13 -3
  33. package/highlevel/updates/manager.cjs +2 -0
  34. package/highlevel/updates/manager.js +2 -0
  35. package/methods.cjs +4 -0
  36. package/methods.js +4 -0
  37. package/network/mtproto-session.cjs +2 -0
  38. package/network/mtproto-session.js +2 -0
  39. package/network/network-manager.cjs +1 -1
  40. package/network/network-manager.js +1 -1
  41. package/network/session-connection.cjs +2 -0
  42. package/network/session-connection.js +2 -0
  43. package/network/transports/intermediate.cjs +2 -0
  44. package/network/transports/intermediate.js +2 -0
  45. package/package.json +2 -2
  46. package/storage/storage.cjs +2 -0
  47. package/storage/storage.js +2 -0
  48. package/utils/binary/compat.cjs +1 -0
  49. package/utils/binary/compat.d.cts +3 -0
  50. package/utils/binary/compat.d.ts +3 -0
  51. package/utils/binary/compat.js +2 -1
  52. package/utils/index.d.cts +2 -0
  53. package/utils/index.d.ts +2 -0
  54. package/utils.cjs +11 -0
  55. package/utils.js +6 -1
package/client.cjs CHANGED
@@ -54,12 +54,14 @@ const getChatMember = require("./highlevel/methods/chats/get-chat-member.cjs");
54
54
  const getChatMembers = require("./highlevel/methods/chats/get-chat-members.cjs");
55
55
  const getChatPreview = require("./highlevel/methods/chats/get-chat-preview.cjs");
56
56
  const getChat = require("./highlevel/methods/chats/get-chat.cjs");
57
+ const getChats = require("./highlevel/methods/chats/get-chats.cjs");
57
58
  const getCreatorAfterLeave = require("./highlevel/methods/chats/get-creator-after-leave.cjs");
58
59
  const getFullChat = require("./highlevel/methods/chats/get-full-chat.cjs");
59
60
  const getFullUser = require("./highlevel/methods/chats/get-full-user.cjs");
60
61
  const getMessageAuthor = require("./highlevel/methods/chats/get-message-author.cjs");
61
62
  const getNearbyChats = require("./highlevel/methods/chats/get-nearby-chats.cjs");
62
63
  const getPeer = require("./highlevel/methods/chats/get-peer.cjs");
64
+ const getPeers = require("./highlevel/methods/chats/get-peers.cjs");
63
65
  const getSimilarChannels = require("./highlevel/methods/chats/get-similar-channels.cjs");
64
66
  const getUser = require("./highlevel/methods/chats/get-user.cjs");
65
67
  const iterChatEventLog = require("./highlevel/methods/chats/iter-chat-event-log.cjs");
@@ -598,6 +600,9 @@ TelegramClient.prototype.getChatPreview = function(...args) {
598
600
  TelegramClient.prototype.getChat = function(...args) {
599
601
  return getChat.getChat(this._client, ...args);
600
602
  };
603
+ TelegramClient.prototype.getChats = function(...args) {
604
+ return getChats.getChats(this._client, ...args);
605
+ };
601
606
  TelegramClient.prototype.getCreatorAfterLeave = function(...args) {
602
607
  return getCreatorAfterLeave.getCreatorAfterLeave(this._client, ...args);
603
608
  };
@@ -616,6 +621,9 @@ TelegramClient.prototype.getNearbyChats = function(...args) {
616
621
  TelegramClient.prototype.getPeer = function(...args) {
617
622
  return getPeer.getPeer(this._client, ...args);
618
623
  };
624
+ TelegramClient.prototype.getPeers = function(...args) {
625
+ return getPeers.getPeers(this._client, ...args);
626
+ };
619
627
  TelegramClient.prototype.getSimilarChannels = function(...args) {
620
628
  return getSimilarChannels.getSimilarChannels(this._client, ...args);
621
629
  };
package/client.js CHANGED
@@ -47,12 +47,14 @@ import { getChatMember } from "./highlevel/methods/chats/get-chat-member.js";
47
47
  import { getChatMembers } from "./highlevel/methods/chats/get-chat-members.js";
48
48
  import { getChatPreview } from "./highlevel/methods/chats/get-chat-preview.js";
49
49
  import { getChat } from "./highlevel/methods/chats/get-chat.js";
50
+ import { getChats } from "./highlevel/methods/chats/get-chats.js";
50
51
  import { getCreatorAfterLeave } from "./highlevel/methods/chats/get-creator-after-leave.js";
51
52
  import { getFullChat } from "./highlevel/methods/chats/get-full-chat.js";
52
53
  import { getFullUser } from "./highlevel/methods/chats/get-full-user.js";
53
54
  import { getMessageAuthor } from "./highlevel/methods/chats/get-message-author.js";
54
55
  import { getNearbyChats } from "./highlevel/methods/chats/get-nearby-chats.js";
55
56
  import { getPeer } from "./highlevel/methods/chats/get-peer.js";
57
+ import { getPeers } from "./highlevel/methods/chats/get-peers.js";
56
58
  import { getSimilarChannels } from "./highlevel/methods/chats/get-similar-channels.js";
57
59
  import { getUser } from "./highlevel/methods/chats/get-user.js";
58
60
  import { iterChatEventLog } from "./highlevel/methods/chats/iter-chat-event-log.js";
@@ -591,6 +593,9 @@ TelegramClient.prototype.getChatPreview = function(...args) {
591
593
  TelegramClient.prototype.getChat = function(...args) {
592
594
  return getChat(this._client, ...args);
593
595
  };
596
+ TelegramClient.prototype.getChats = function(...args) {
597
+ return getChats(this._client, ...args);
598
+ };
594
599
  TelegramClient.prototype.getCreatorAfterLeave = function(...args) {
595
600
  return getCreatorAfterLeave(this._client, ...args);
596
601
  };
@@ -609,6 +614,9 @@ TelegramClient.prototype.getNearbyChats = function(...args) {
609
614
  TelegramClient.prototype.getPeer = function(...args) {
610
615
  return getPeer(this._client, ...args);
611
616
  };
617
+ TelegramClient.prototype.getPeers = function(...args) {
618
+ return getPeers(this._client, ...args);
619
+ };
612
620
  TelegramClient.prototype.getSimilarChannels = function(...args) {
613
621
  return getSimilarChannels(this._client, ...args);
614
622
  };
@@ -13,6 +13,8 @@ const functionUtils = require("../utils/function-utils.cjs");
13
13
  const logger = require("../utils/logger.cjs");
14
14
  const typeAssertions = require("../utils/type-assertions.cjs");
15
15
  require("@mtcute/tl-runtime");
16
+ require("@mtcute/tl/binary/reader.js");
17
+ require("@mtcute/tl/binary/writer.js");
16
18
  const appConfigManager = require("./managers/app-config-manager.cjs");
17
19
  const timers = require("./managers/timers.cjs");
18
20
  const storage = require("./storage/storage.cjs");
package/highlevel/base.js CHANGED
@@ -6,6 +6,8 @@ import { asyncResettable } from "../utils/function-utils.js";
6
6
  import { LogManager } from "../utils/logger.js";
7
7
  import { isTlRpcError } from "../utils/type-assertions.js";
8
8
  import "@mtcute/tl-runtime";
9
+ import "@mtcute/tl/binary/reader.js";
10
+ import "@mtcute/tl/binary/writer.js";
9
11
  import { AppConfigManager } from "./managers/app-config-manager.js";
10
12
  import { TimersManager } from "./managers/timers.js";
11
13
  import { TelegramStorageManager } from "./storage/storage.js";
@@ -1258,6 +1258,15 @@ export interface TelegramClient extends ITelegramClient {
1258
1258
  * Use {@link getChatPreview} instead.
1259
1259
  */
1260
1260
  getChat(chatId: InputPeerLike): Promise<Chat>;
1261
+ /**
1262
+ * Get basic information about multiple chats.
1263
+ *
1264
+ * **Available**: ✅ both users and bots
1265
+ *
1266
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
1267
+ * @returns The list of chats in the same order as the input
1268
+ */
1269
+ getChats(chatIds: InputPeerLike[]): Promise<(Chat | null)[]>;
1261
1270
  /**
1262
1271
  * Get the user who will be made the creator of the channel/supergroup if you were to leave it.
1263
1272
  *
@@ -1295,6 +1304,15 @@ export interface TelegramClient extends ITelegramClient {
1295
1304
  getNearbyChats(latitude: number, longitude: number): Promise<Chat[]>;
1296
1305
  /** Shorthand for {@link getChat} and {@link getUser} depending on the type of the peer */
1297
1306
  getPeer(peer: InputPeerLike): Promise<Peer>;
1307
+ /**
1308
+ * Get basic information about multiple peers.
1309
+ *
1310
+ * **Available**: ✅ both users and bots
1311
+ *
1312
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
1313
+ * @returns The list of peers in the same order as the input
1314
+ */
1315
+ getPeers(chatIds: InputPeerLike[]): Promise<(Peer | null)[]>;
1298
1316
  /**
1299
1317
  * Get channels that are similar to a given channel
1300
1318
  *
@@ -5175,11 +5193,10 @@ export interface TelegramClient extends ITelegramClient {
5175
5193
  * Get information about multiple users.
5176
5194
  * You can retrieve up to 200 users at once.
5177
5195
  *
5178
- * Note that order is not guaranteed.
5179
- *
5180
5196
  * **Available**: ✅ both users and bots
5181
5197
  *
5182
5198
  * @param ids Users' identifiers. Can be ID, username, phone number, `"me"`, `"self"` or TL object
5199
+ * @returns The list of users in the same order as the input
5183
5200
  */
5184
5201
  getUsers(ids: MaybeArray<InputPeerLike>): Promise<(User | null)[]>;
5185
5202
  /**
@@ -1258,6 +1258,15 @@ export interface TelegramClient extends ITelegramClient {
1258
1258
  * Use {@link getChatPreview} instead.
1259
1259
  */
1260
1260
  getChat(chatId: InputPeerLike): Promise<Chat>;
1261
+ /**
1262
+ * Get basic information about multiple chats.
1263
+ *
1264
+ * **Available**: ✅ both users and bots
1265
+ *
1266
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
1267
+ * @returns The list of chats in the same order as the input
1268
+ */
1269
+ getChats(chatIds: InputPeerLike[]): Promise<(Chat | null)[]>;
1261
1270
  /**
1262
1271
  * Get the user who will be made the creator of the channel/supergroup if you were to leave it.
1263
1272
  *
@@ -1295,6 +1304,15 @@ export interface TelegramClient extends ITelegramClient {
1295
1304
  getNearbyChats(latitude: number, longitude: number): Promise<Chat[]>;
1296
1305
  /** Shorthand for {@link getChat} and {@link getUser} depending on the type of the peer */
1297
1306
  getPeer(peer: InputPeerLike): Promise<Peer>;
1307
+ /**
1308
+ * Get basic information about multiple peers.
1309
+ *
1310
+ * **Available**: ✅ both users and bots
1311
+ *
1312
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
1313
+ * @returns The list of peers in the same order as the input
1314
+ */
1315
+ getPeers(chatIds: InputPeerLike[]): Promise<(Peer | null)[]>;
1298
1316
  /**
1299
1317
  * Get channels that are similar to a given channel
1300
1318
  *
@@ -5175,11 +5193,10 @@ export interface TelegramClient extends ITelegramClient {
5175
5193
  * Get information about multiple users.
5176
5194
  * You can retrieve up to 200 users at once.
5177
5195
  *
5178
- * Note that order is not guaranteed.
5179
- *
5180
5196
  * **Available**: ✅ both users and bots
5181
5197
  *
5182
5198
  * @param ids Users' identifiers. Can be ID, username, phone number, `"me"`, `"self"` or TL object
5199
+ * @returns The list of users in the same order as the input
5183
5200
  */
5184
5201
  getUsers(ids: MaybeArray<InputPeerLike>): Promise<(User | null)[]>;
5185
5202
  /**
@@ -54,7 +54,7 @@ const _getChatsBatched = queryBatcher.batchedQuery({
54
54
  fetch: (client, items) => client.call({
55
55
  _: "messages.getChats",
56
56
  id: items
57
- }).then((res) => res.chats.filter((it) => it._ === "chat")),
57
+ }).then((res) => res.chats.filter((it) => it._ === "chat" || it._ === "chatForbidden")),
58
58
  inputKey: (id) => id,
59
59
  outputKey: (item) => item.id,
60
60
  maxBatchSize: 50,
@@ -65,9 +65,7 @@ const _getChannelsBatched = queryBatcher.batchedQuery({
65
65
  _: "channels.getChannels",
66
66
  id: items
67
67
  }).then(
68
- (res) => res.chats.filter(
69
- (it) => it._ === "channel" || it._ === "channelForbidden"
70
- )
68
+ (res) => res.chats.filter((it) => it._ === "channel" || it._ === "channelForbidden")
71
69
  ),
72
70
  inputKey: (id) => {
73
71
  switch (id._) {
@@ -4,7 +4,7 @@ import { tl } from '@mtcute/tl';
4
4
  /** @internal */
5
5
  export declare const _getUsersBatched: BatchedQuery<tl.TypeInputUser, tl.TypeUser>;
6
6
  /** @internal */
7
- export declare const _getChatsBatched: BatchedQuery<number, tl.RawChat>;
7
+ export declare const _getChatsBatched: BatchedQuery<number, tl.RawChat | tl.RawChatForbidden>;
8
8
  /** @internal */
9
9
  export declare const _getChannelsBatched: BatchedQuery<tl.TypeInputChannel, tl.RawChannel | tl.RawChannelForbidden>;
10
10
  /** @internal */
@@ -4,7 +4,7 @@ import { tl } from '@mtcute/tl';
4
4
  /** @internal */
5
5
  export declare const _getUsersBatched: BatchedQuery<tl.TypeInputUser, tl.TypeUser>;
6
6
  /** @internal */
7
- export declare const _getChatsBatched: BatchedQuery<number, tl.RawChat>;
7
+ export declare const _getChatsBatched: BatchedQuery<number, tl.RawChat | tl.RawChatForbidden>;
8
8
  /** @internal */
9
9
  export declare const _getChannelsBatched: BatchedQuery<tl.TypeInputChannel, tl.RawChannel | tl.RawChannelForbidden>;
10
10
  /** @internal */
@@ -47,7 +47,7 @@ const _getChatsBatched = batchedQuery({
47
47
  fetch: (client, items) => client.call({
48
48
  _: "messages.getChats",
49
49
  id: items
50
- }).then((res) => res.chats.filter((it) => it._ === "chat")),
50
+ }).then((res) => res.chats.filter((it) => it._ === "chat" || it._ === "chatForbidden")),
51
51
  inputKey: (id) => id,
52
52
  outputKey: (item) => item.id,
53
53
  maxBatchSize: 50,
@@ -58,9 +58,7 @@ const _getChannelsBatched = batchedQuery({
58
58
  _: "channels.getChannels",
59
59
  id: items
60
60
  }).then(
61
- (res) => res.chats.filter(
62
- (it) => it._ === "channel" || it._ === "channelForbidden"
63
- )
61
+ (res) => res.chats.filter((it) => it._ === "channel" || it._ === "channelForbidden")
64
62
  ),
65
63
  inputKey: (id) => {
66
64
  switch (id._) {
@@ -0,0 +1,27 @@
1
+ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
2
+ globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
3
+ console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
4
+ console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
5
+ }
6
+ "use strict";
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const peerUtils = require("../../utils/peer-utils.cjs");
9
+ const resolvePeerMany = require("../users/resolve-peer-many.cjs");
10
+ const batchedQueries = require("./batched-queries.cjs");
11
+ const errors = require("../../types/errors.cjs");
12
+ const chat = require("../../types/peers/chat.cjs");
13
+ async function getChats(client, chatIds) {
14
+ const inputPeers = await resolvePeerMany.resolvePeerMany(client, chatIds);
15
+ const res = await Promise.all(inputPeers.map((peer) => {
16
+ if (!peer) return null;
17
+ if (peerUtils.isInputPeerChannel(peer)) {
18
+ return batchedQueries._getChannelsBatched(client, peerUtils.toInputChannel(peer));
19
+ } else if (peerUtils.isInputPeerChat(peer)) {
20
+ return batchedQueries._getChatsBatched(client, peer.chatId);
21
+ } else {
22
+ throw new errors.MtInvalidPeerTypeError(peer, "chat or channel");
23
+ }
24
+ }));
25
+ return res.map((it) => it ? new chat.Chat(it) : null);
26
+ }
27
+ exports.getChats = getChats;
@@ -0,0 +1,9 @@
1
+ import { ITelegramClient } from '../../client.types.js';
2
+ import { InputPeerLike, Chat } from '../../types/index.js';
3
+ /**
4
+ * Get basic information about multiple chats.
5
+ *
6
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
7
+ * @returns The list of chats in the same order as the input
8
+ */
9
+ export declare function getChats(client: ITelegramClient, chatIds: InputPeerLike[]): Promise<(Chat | null)[]>;
@@ -0,0 +1,9 @@
1
+ import { ITelegramClient } from '../../client.types.js';
2
+ import { InputPeerLike, Chat } from '../../types/index.js';
3
+ /**
4
+ * Get basic information about multiple chats.
5
+ *
6
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
7
+ * @returns The list of chats in the same order as the input
8
+ */
9
+ export declare function getChats(client: ITelegramClient, chatIds: InputPeerLike[]): Promise<(Chat | null)[]>;
@@ -0,0 +1,22 @@
1
+ import { isInputPeerChannel, toInputChannel, isInputPeerChat } from "../../utils/peer-utils.js";
2
+ import { resolvePeerMany } from "../users/resolve-peer-many.js";
3
+ import { _getChannelsBatched, _getChatsBatched } from "./batched-queries.js";
4
+ import { MtInvalidPeerTypeError } from "../../types/errors.js";
5
+ import { Chat as Chat$2 } from "../../types/peers/chat.js";
6
+ async function getChats(client, chatIds) {
7
+ const inputPeers = await resolvePeerMany(client, chatIds);
8
+ const res = await Promise.all(inputPeers.map((peer) => {
9
+ if (!peer) return null;
10
+ if (isInputPeerChannel(peer)) {
11
+ return _getChannelsBatched(client, toInputChannel(peer));
12
+ } else if (isInputPeerChat(peer)) {
13
+ return _getChatsBatched(client, peer.chatId);
14
+ } else {
15
+ throw new MtInvalidPeerTypeError(peer, "chat or channel");
16
+ }
17
+ }));
18
+ return res.map((it) => it ? new Chat$2(it) : null);
19
+ }
20
+ export {
21
+ getChats
22
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
1
+ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WARNED) {
2
+ globalThis._MTCUTE_CJS_DEPRECATION_WARNED = true;
3
+ console.warn("[@mtcute/core] CommonJS bundles are deprecated. They will be removed completely in one of the upcoming releases. No support is provided for CommonJS users. Please consider switching to ESM, it's " + (/* @__PURE__ */ new Date()).getFullYear() + " already.");
4
+ console.warn("[@mtcute/core] Learn more about switching to ESM: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c");
5
+ }
6
+ "use strict";
7
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const resolvePeerMany = require("../users/resolve-peer-many.cjs");
9
+ const batchedQueries = require("./batched-queries.cjs");
10
+ const peer = require("../../types/peers/peer.cjs");
11
+ async function getPeers(client, chatIds) {
12
+ const inputPeers = await resolvePeerMany.resolvePeerMany(client, chatIds);
13
+ const res = await Promise.all(inputPeers.map((peer2) => peer2 ? batchedQueries._getRawPeerBatched(client, peer2) : null));
14
+ return res.map((it) => it ? peer.parsePeer(it) : null);
15
+ }
16
+ exports.getPeers = getPeers;
@@ -0,0 +1,9 @@
1
+ import { ITelegramClient } from '../../client.types.js';
2
+ import { InputPeerLike, Peer } from '../../types/index.js';
3
+ /**
4
+ * Get basic information about multiple peers.
5
+ *
6
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
7
+ * @returns The list of peers in the same order as the input
8
+ */
9
+ export declare function getPeers(client: ITelegramClient, chatIds: InputPeerLike[]): Promise<(Peer | null)[]>;
@@ -0,0 +1,9 @@
1
+ import { ITelegramClient } from '../../client.types.js';
2
+ import { InputPeerLike, Peer } from '../../types/index.js';
3
+ /**
4
+ * Get basic information about multiple peers.
5
+ *
6
+ * @param chatIds Chat identifiers. Can be ID, username or TL object
7
+ * @returns The list of peers in the same order as the input
8
+ */
9
+ export declare function getPeers(client: ITelegramClient, chatIds: InputPeerLike[]): Promise<(Peer | null)[]>;
@@ -0,0 +1,11 @@
1
+ import { resolvePeerMany } from "../users/resolve-peer-many.js";
2
+ import { _getRawPeerBatched } from "./batched-queries.js";
3
+ import { parsePeer } from "../../types/peers/peer.js";
4
+ async function getPeers(client, chatIds) {
5
+ const inputPeers = await resolvePeerMany(client, chatIds);
6
+ const res = await Promise.all(inputPeers.map((peer) => peer ? _getRawPeerBatched(client, peer) : null));
7
+ return res.map((it) => it ? parsePeer(it) : null);
8
+ }
9
+ export {
10
+ getPeers
11
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -7,6 +7,8 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
8
  const typeAssertions = require("../../../utils/type-assertions.cjs");
9
9
  require("@mtcute/tl-runtime");
10
+ require("@mtcute/tl/binary/reader.js");
11
+ require("@mtcute/tl/binary/writer.js");
10
12
  const resolvePeer = require("../users/resolve-peer.cjs");
11
13
  const entities = require("../../types/misc/entities.cjs");
12
14
  async function setContactNote(client, userId, note) {
@@ -1,5 +1,7 @@
1
1
  import { assertTrue } from "../../../utils/type-assertions.js";
2
2
  import "@mtcute/tl-runtime";
3
+ import "@mtcute/tl/binary/reader.js";
4
+ import "@mtcute/tl/binary/writer.js";
3
5
  import { resolveUser } from "../users/resolve-peer.js";
4
6
  import { inputTextToTl } from "../../types/misc/entities.js";
5
7
  async function setContactNote(client, userId, note) {
@@ -5,8 +5,7 @@ import { InputPeerLike, User } from '../../types/index.js';
5
5
  * Get information about multiple users.
6
6
  * You can retrieve up to 200 users at once.
7
7
  *
8
- * Note that order is not guaranteed.
9
- *
10
8
  * @param ids Users' identifiers. Can be ID, username, phone number, `"me"`, `"self"` or TL object
9
+ * @returns The list of users in the same order as the input
11
10
  */
12
11
  export declare function getUsers(client: ITelegramClient, ids: MaybeArray<InputPeerLike>): Promise<(User | null)[]>;
@@ -5,8 +5,7 @@ import { InputPeerLike, User } from '../../types/index.js';
5
5
  * Get information about multiple users.
6
6
  * You can retrieve up to 200 users at once.
7
7
  *
8
- * Note that order is not guaranteed.
9
- *
10
8
  * @param ids Users' identifiers. Can be ID, username, phone number, `"me"`, `"self"` or TL object
9
+ * @returns The list of users in the same order as the input
11
10
  */
12
11
  export declare function getUsers(client: ITelegramClient, ids: MaybeArray<InputPeerLike>): Promise<(User | null)[]>;
@@ -50,12 +50,14 @@ export { getChatMember } from './methods/chats/get-chat-member.js';
50
50
  export { getChatMembers } from './methods/chats/get-chat-members.js';
51
51
  export { getChatPreview } from './methods/chats/get-chat-preview.js';
52
52
  export { getChat } from './methods/chats/get-chat.js';
53
+ export { getChats } from './methods/chats/get-chats.js';
53
54
  export { getCreatorAfterLeave } from './methods/chats/get-creator-after-leave.js';
54
55
  export { getFullChat } from './methods/chats/get-full-chat.js';
55
56
  export { getFullUser } from './methods/chats/get-full-user.js';
56
57
  export { getMessageAuthor } from './methods/chats/get-message-author.js';
57
58
  export { getNearbyChats } from './methods/chats/get-nearby-chats.js';
58
59
  export { getPeer } from './methods/chats/get-peer.js';
60
+ export { getPeers } from './methods/chats/get-peers.js';
59
61
  export { getSimilarChannels } from './methods/chats/get-similar-channels.js';
60
62
  export { getUser } from './methods/chats/get-user.js';
61
63
  export { iterChatEventLog } from './methods/chats/iter-chat-event-log.js';
@@ -50,12 +50,14 @@ export { getChatMember } from './methods/chats/get-chat-member.js';
50
50
  export { getChatMembers } from './methods/chats/get-chat-members.js';
51
51
  export { getChatPreview } from './methods/chats/get-chat-preview.js';
52
52
  export { getChat } from './methods/chats/get-chat.js';
53
+ export { getChats } from './methods/chats/get-chats.js';
53
54
  export { getCreatorAfterLeave } from './methods/chats/get-creator-after-leave.js';
54
55
  export { getFullChat } from './methods/chats/get-full-chat.js';
55
56
  export { getFullUser } from './methods/chats/get-full-user.js';
56
57
  export { getMessageAuthor } from './methods/chats/get-message-author.js';
57
58
  export { getNearbyChats } from './methods/chats/get-nearby-chats.js';
58
59
  export { getPeer } from './methods/chats/get-peer.js';
60
+ export { getPeers } from './methods/chats/get-peers.js';
59
61
  export { getSimilarChannels } from './methods/chats/get-similar-channels.js';
60
62
  export { getUser } from './methods/chats/get-user.js';
61
63
  export { iterChatEventLog } from './methods/chats/iter-chat-event-log.js';
@@ -5,16 +5,26 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
5
5
  }
6
6
  "use strict";
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
+ const utils = require("@fuman/utils");
8
9
  const chat = require("./chat.cjs");
9
10
  const user = require("./user.cjs");
10
11
  function parsePeer(peer, index) {
11
12
  switch (peer._) {
12
13
  case "peerUser":
13
- return new user.User(index.user(peer.userId));
14
+ return new user.User(utils.asNonNull(index).user(peer.userId));
14
15
  case "peerChat":
15
- return new chat.Chat(index.chat(peer.chatId));
16
+ return new chat.Chat(utils.asNonNull(index).chat(peer.chatId));
16
17
  case "peerChannel":
17
- return new chat.Chat(index.chat(peer.channelId));
18
+ return new chat.Chat(utils.asNonNull(index).chat(peer.channelId));
19
+ case "channel":
20
+ case "channelForbidden":
21
+ case "chat":
22
+ case "chatForbidden":
23
+ return new chat.Chat(peer);
24
+ case "user":
25
+ return new user.User(peer);
26
+ default:
27
+ throw new Error("Empty peer");
18
28
  }
19
29
  }
20
30
  exports.parsePeer = parsePeer;
@@ -46,3 +46,7 @@ export type PeerSender = Peer | AnonymousSender;
46
46
  * Given a `tl.TypePeer`, return a {@link Peer} object ({@link User} or {@link Chat})
47
47
  */
48
48
  export declare function parsePeer(peer: tl.TypePeer, index: PeersIndex): Peer;
49
+ /**
50
+ * Given a `tl.TypeUser | tl.TypeChat`, return a {@link Peer} object ({@link User} or {@link Chat})
51
+ */
52
+ export declare function parsePeer(peer: tl.TypeUser | tl.TypeChat): Peer;
@@ -46,3 +46,7 @@ export type PeerSender = Peer | AnonymousSender;
46
46
  * Given a `tl.TypePeer`, return a {@link Peer} object ({@link User} or {@link Chat})
47
47
  */
48
48
  export declare function parsePeer(peer: tl.TypePeer, index: PeersIndex): Peer;
49
+ /**
50
+ * Given a `tl.TypeUser | tl.TypeChat`, return a {@link Peer} object ({@link User} or {@link Chat})
51
+ */
52
+ export declare function parsePeer(peer: tl.TypeUser | tl.TypeChat): Peer;
@@ -1,13 +1,23 @@
1
+ import { asNonNull } from "@fuman/utils";
1
2
  import { Chat as Chat$2 } from "./chat.js";
2
3
  import { User as User$2 } from "./user.js";
3
4
  function parsePeer(peer, index) {
4
5
  switch (peer._) {
5
6
  case "peerUser":
6
- return new User$2(index.user(peer.userId));
7
+ return new User$2(asNonNull(index).user(peer.userId));
7
8
  case "peerChat":
8
- return new Chat$2(index.chat(peer.chatId));
9
+ return new Chat$2(asNonNull(index).chat(peer.chatId));
9
10
  case "peerChannel":
10
- return new Chat$2(index.chat(peer.channelId));
11
+ return new Chat$2(asNonNull(index).chat(peer.channelId));
12
+ case "channel":
13
+ case "channelForbidden":
14
+ case "chat":
15
+ case "chatForbidden":
16
+ return new Chat$2(peer);
17
+ case "user":
18
+ return new User$2(peer);
19
+ default:
20
+ throw new Error("Empty peer");
11
21
  }
12
22
  }
13
23
  export {
@@ -14,6 +14,8 @@ const earlyTimer = require("../../utils/early-timer.cjs");
14
14
  const peerUtils = require("../../utils/peer-utils.cjs");
15
15
  const sortedArray = require("../../utils/sorted-array.cjs");
16
16
  require("@mtcute/tl-runtime");
17
+ require("@mtcute/tl/binary/reader.js");
18
+ require("@mtcute/tl/binary/writer.js");
17
19
  const batchedQueries = require("../methods/chats/batched-queries.cjs");
18
20
  const peersIndex = require("../types/peers/peers-index.cjs");
19
21
  const types = require("./types.cjs");
@@ -7,6 +7,8 @@ import { EarlyTimer } from "../../utils/early-timer.js";
7
7
  import { toggleChannelIdMark, parseMarkedPeerId, getBarePeerId, getMarkedPeerId } from "../../utils/peer-utils.js";
8
8
  import { SortedArray } from "../../utils/sorted-array.js";
9
9
  import "@mtcute/tl-runtime";
10
+ import "@mtcute/tl/binary/reader.js";
11
+ import "@mtcute/tl/binary/writer.js";
10
12
  import { _getChannelsBatched, _getUsersBatched } from "../methods/chats/batched-queries.js";
11
13
  import { PeersIndex } from "../types/peers/peers-index.js";
12
14
  import { RawUpdateInfo } from "./types.js";
package/methods.cjs CHANGED
@@ -52,12 +52,14 @@ const getChatMember = require("./highlevel/methods/chats/get-chat-member.cjs");
52
52
  const getChatMembers = require("./highlevel/methods/chats/get-chat-members.cjs");
53
53
  const getChatPreview = require("./highlevel/methods/chats/get-chat-preview.cjs");
54
54
  const getChat = require("./highlevel/methods/chats/get-chat.cjs");
55
+ const getChats = require("./highlevel/methods/chats/get-chats.cjs");
55
56
  const getCreatorAfterLeave = require("./highlevel/methods/chats/get-creator-after-leave.cjs");
56
57
  const getFullChat = require("./highlevel/methods/chats/get-full-chat.cjs");
57
58
  const getFullUser = require("./highlevel/methods/chats/get-full-user.cjs");
58
59
  const getMessageAuthor = require("./highlevel/methods/chats/get-message-author.cjs");
59
60
  const getNearbyChats = require("./highlevel/methods/chats/get-nearby-chats.cjs");
60
61
  const getPeer = require("./highlevel/methods/chats/get-peer.cjs");
62
+ const getPeers = require("./highlevel/methods/chats/get-peers.cjs");
61
63
  const getSimilarChannels = require("./highlevel/methods/chats/get-similar-channels.cjs");
62
64
  const getUser = require("./highlevel/methods/chats/get-user.cjs");
63
65
  const iterChatEventLog = require("./highlevel/methods/chats/iter-chat-event-log.cjs");
@@ -332,12 +334,14 @@ exports.getChatMember = getChatMember.getChatMember;
332
334
  exports.getChatMembers = getChatMembers.getChatMembers;
333
335
  exports.getChatPreview = getChatPreview.getChatPreview;
334
336
  exports.getChat = getChat.getChat;
337
+ exports.getChats = getChats.getChats;
335
338
  exports.getCreatorAfterLeave = getCreatorAfterLeave.getCreatorAfterLeave;
336
339
  exports.getFullChat = getFullChat.getFullChat;
337
340
  exports.getFullUser = getFullUser.getFullUser;
338
341
  exports.getMessageAuthor = getMessageAuthor.getMessageAuthor;
339
342
  exports.getNearbyChats = getNearbyChats.getNearbyChats;
340
343
  exports.getPeer = getPeer.getPeer;
344
+ exports.getPeers = getPeers.getPeers;
341
345
  exports.getSimilarChannels = getSimilarChannels.getSimilarChannels;
342
346
  exports.getUser = getUser.getUser;
343
347
  exports.iterChatEventLog = iterChatEventLog.iterChatEventLog;
package/methods.js CHANGED
@@ -45,12 +45,14 @@ import { getChatMember } from "./highlevel/methods/chats/get-chat-member.js";
45
45
  import { getChatMembers } from "./highlevel/methods/chats/get-chat-members.js";
46
46
  import { getChatPreview } from "./highlevel/methods/chats/get-chat-preview.js";
47
47
  import { getChat } from "./highlevel/methods/chats/get-chat.js";
48
+ import { getChats } from "./highlevel/methods/chats/get-chats.js";
48
49
  import { getCreatorAfterLeave } from "./highlevel/methods/chats/get-creator-after-leave.js";
49
50
  import { getFullChat } from "./highlevel/methods/chats/get-full-chat.js";
50
51
  import { getFullUser } from "./highlevel/methods/chats/get-full-user.js";
51
52
  import { getMessageAuthor } from "./highlevel/methods/chats/get-message-author.js";
52
53
  import { getNearbyChats } from "./highlevel/methods/chats/get-nearby-chats.js";
53
54
  import { getPeer } from "./highlevel/methods/chats/get-peer.js";
55
+ import { getPeers } from "./highlevel/methods/chats/get-peers.js";
54
56
  import { getSimilarChannels } from "./highlevel/methods/chats/get-similar-channels.js";
55
57
  import { getUser } from "./highlevel/methods/chats/get-user.js";
56
58
  import { iterChatEventLog } from "./highlevel/methods/chats/iter-chat-event-log.js";
@@ -369,6 +371,7 @@ export {
369
371
  getChatMembers,
370
372
  getChatPreview,
371
373
  getChatlistPreview,
374
+ getChats,
372
375
  getCollectibleInfo,
373
376
  getCommonChats,
374
377
  getContacts,
@@ -408,6 +411,7 @@ export {
408
411
  getPeerDialogs,
409
412
  getPeerSettings,
410
413
  getPeerStories,
414
+ getPeers,
411
415
  getPrimaryInviteLink,
412
416
  getProfilePhoto,
413
417
  getProfilePhotos,
@@ -11,6 +11,8 @@ const Long = require("long");
11
11
  const longUtils = require("../utils/long-utils.cjs");
12
12
  const miscUtils = require("../utils/misc-utils.cjs");
13
13
  const sortedArray = require("../utils/sorted-array.cjs");
14
+ require("@mtcute/tl/binary/reader.js");
15
+ require("@mtcute/tl/binary/writer.js");
14
16
  const authKey = require("./auth-key.cjs");
15
17
  const errors = require("../types/errors.cjs");
16
18
  class MtprotoSession {
@@ -4,6 +4,8 @@ import Long from "long";
4
4
  import { randomLong, LongSet, LongMap, compareLongs } from "../utils/long-utils.js";
5
5
  import { getRandomInt } from "../utils/misc-utils.js";
6
6
  import { SortedArray } from "../utils/sorted-array.js";
7
+ import "@mtcute/tl/binary/reader.js";
8
+ import "@mtcute/tl/binary/writer.js";
7
9
  import { AuthKey } from "./auth-key.js";
8
10
  import { MtcuteError } from "../types/errors.js";
9
11
  class MtprotoSession {
@@ -225,7 +225,7 @@ class NetworkManager {
225
225
  _: "initConnection",
226
226
  deviceModel,
227
227
  systemVersion: "1.0",
228
- appVersion: "0.28.0",
228
+ appVersion: "0.28.1",
229
229
  systemLangCode: "en",
230
230
  langPack: "",
231
231
  // "langPacks are for official apps only"
@@ -218,7 +218,7 @@ class NetworkManager {
218
218
  _: "initConnection",
219
219
  deviceModel,
220
220
  systemVersion: "1.0",
221
- appVersion: "0.28.0",
221
+ appVersion: "0.28.1",
222
222
  systemLangCode: "en",
223
223
  langPack: "",
224
224
  // "langPacks are for official apps only"
@@ -12,6 +12,8 @@ const Long = require("long");
12
12
  const mtproto = require("../utils/crypto/mtproto.cjs");
13
13
  const earlyTimer = require("../utils/early-timer.cjs");
14
14
  const longUtils = require("../utils/long-utils.cjs");
15
+ require("@mtcute/tl/binary/reader.js");
16
+ require("@mtcute/tl/binary/writer.js");
15
17
  const authorization = require("./authorization.cjs");
16
18
  const mtprotoSession = require("./mtproto-session.cjs");
17
19
  const persistentConnection = require("./persistent-connection.cjs");
@@ -5,6 +5,8 @@ import Long from "long";
5
5
  import { createAesIgeForMessageOld } from "../utils/crypto/mtproto.js";
6
6
  import { EarlyTimer } from "../utils/early-timer.js";
7
7
  import { longFromBuffer, randomLong, removeFromLongArray } from "../utils/long-utils.js";
8
+ import "@mtcute/tl/binary/reader.js";
9
+ import "@mtcute/tl/binary/writer.js";
8
10
  import { doAuthorization } from "./authorization.js";
9
11
  import { MtprotoSession } from "./mtproto-session.js";
10
12
  import { PersistentConnection } from "./persistent-connection.js";
@@ -9,6 +9,8 @@ const io = require("@fuman/io");
9
9
  const utils = require("@fuman/utils");
10
10
  const miscUtils = require("../../utils/misc-utils.cjs");
11
11
  require("@mtcute/tl-runtime");
12
+ require("@mtcute/tl/binary/reader.js");
13
+ require("@mtcute/tl/binary/writer.js");
12
14
  const abstract = require("./abstract.cjs");
13
15
  const TAG = new Uint8Array([238, 238, 238, 238]);
14
16
  const PADDED_TAG = new Uint8Array([221, 221, 221, 221]);
@@ -2,6 +2,8 @@ import { read, write } from "@fuman/io";
2
2
  import { typed } from "@fuman/utils";
3
3
  import { getRandomInt } from "../../utils/misc-utils.js";
4
4
  import "@mtcute/tl-runtime";
5
+ import "@mtcute/tl/binary/reader.js";
6
+ import "@mtcute/tl/binary/writer.js";
5
7
  import { TransportError } from "./abstract.js";
6
8
  const TAG = new Uint8Array([238, 238, 238, 238]);
7
9
  const PADDED_TAG = new Uint8Array([221, 221, 221, 221]);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtcute/core",
3
3
  "type": "module",
4
- "version": "0.28.0",
4
+ "version": "0.28.1",
5
5
  "description": "Type-safe library for MTProto (Telegram API)",
6
6
  "license": "MIT",
7
7
  "scripts": {},
@@ -9,7 +9,7 @@
9
9
  "@fuman/io": "0.0.19",
10
10
  "@fuman/net": "0.0.19",
11
11
  "@fuman/utils": "0.0.19",
12
- "@mtcute/file-id": "^0.27.8",
12
+ "@mtcute/file-id": "^0.28.1",
13
13
  "@mtcute/tl": "^222.0.0",
14
14
  "@mtcute/tl-runtime": "^0.24.3",
15
15
  "@types/events": "3.0.0",
@@ -8,6 +8,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
8
  const defaultDcs = require("./service/default-dcs.cjs");
9
9
  const functionUtils = require("../utils/function-utils.cjs");
10
10
  require("@mtcute/tl-runtime");
11
+ require("@mtcute/tl/binary/reader.js");
12
+ require("@mtcute/tl/binary/writer.js");
11
13
  const authKeys = require("./service/auth-keys.cjs");
12
14
  const futureSalts = require("./service/future-salts.cjs");
13
15
  class StorageManager {
@@ -1,6 +1,8 @@
1
1
  import { DefaultDcsService } from "./service/default-dcs.js";
2
2
  import { asyncResettable } from "../utils/function-utils.js";
3
3
  import "@mtcute/tl-runtime";
4
+ import "@mtcute/tl/binary/reader.js";
5
+ import "@mtcute/tl/binary/writer.js";
4
6
  import { AuthKeysService } from "./service/auth-keys.js";
5
7
  import { FutureSaltsService } from "./service/future-salts.js";
6
8
  class StorageManager {
@@ -426,5 +426,6 @@ function deserializePeersIndexWithCompat(data) {
426
426
  }
427
427
  return res;
428
428
  }
429
+ exports.__tlReaderMapWithCompat = _combinedReaderMap;
429
430
  exports.deserializeObjectWithCompat = deserializeObjectWithCompat;
430
431
  exports.deserializePeersIndexWithCompat = deserializePeersIndexWithCompat;
@@ -1,5 +1,8 @@
1
+ import { TlReaderMap } from '@mtcute/tl-runtime';
1
2
  import { tl } from '@mtcute/tl';
2
3
  import { PeersIndex } from '../../highlevel/types/peers/peers-index.js';
4
+ declare const _combinedReaderMap: TlReaderMap;
5
+ export { _combinedReaderMap as __tlReaderMapWithCompat };
3
6
  /**
4
7
  * Deserialize a TL object previously serialized with {@link serializeObject},
5
8
  * with backwards compatibility for older versions of the schema.
@@ -1,5 +1,8 @@
1
+ import { TlReaderMap } from '@mtcute/tl-runtime';
1
2
  import { tl } from '@mtcute/tl';
2
3
  import { PeersIndex } from '../../highlevel/types/peers/peers-index.js';
4
+ declare const _combinedReaderMap: TlReaderMap;
5
+ export { _combinedReaderMap as __tlReaderMapWithCompat };
3
6
  /**
4
7
  * Deserialize a TL object previously serialized with {@link serializeObject},
5
8
  * with backwards compatibility for older versions of the schema.
@@ -1,5 +1,5 @@
1
1
  import { Bytes, read } from "@fuman/io";
2
- import { assert, objectEntries } from "@fuman/utils";
2
+ import { objectEntries, assert } from "@fuman/utils";
3
3
  import { tl } from "@mtcute/tl";
4
4
  import { TlBinaryReader } from "@mtcute/tl-runtime";
5
5
  import { __tlReaderMap } from "@mtcute/tl/binary/reader.js";
@@ -420,6 +420,7 @@ function deserializePeersIndexWithCompat(data) {
420
420
  return res;
421
421
  }
422
422
  export {
423
+ _combinedReaderMap as __tlReaderMapWithCompat,
423
424
  deserializeObjectWithCompat,
424
425
  deserializePeersIndexWithCompat
425
426
  };
package/utils/index.d.cts CHANGED
@@ -19,3 +19,5 @@ export * from './sorted-array.js';
19
19
  export * from './tl-json.js';
20
20
  export * from './type-assertions.js';
21
21
  export * from '@mtcute/tl-runtime';
22
+ export { __tlReaderMap } from '@mtcute/tl/binary/reader.js';
23
+ export { __tlWriterMap } from '@mtcute/tl/binary/writer.js';
package/utils/index.d.ts CHANGED
@@ -19,3 +19,5 @@ export * from './sorted-array.js';
19
19
  export * from './tl-json.js';
20
20
  export * from './type-assertions.js';
21
21
  export * from '@mtcute/tl-runtime';
22
+ export { __tlReaderMap } from '@mtcute/tl/binary/reader.js';
23
+ export { __tlWriterMap } from '@mtcute/tl/binary/writer.js';
package/utils.cjs CHANGED
@@ -23,6 +23,8 @@ const sortedArray = require("./utils/sorted-array.cjs");
23
23
  const tlJson = require("./utils/tl-json.cjs");
24
24
  const typeAssertions = require("./utils/type-assertions.cjs");
25
25
  const tlRuntime = require("@mtcute/tl-runtime");
26
+ const reader_js = require("@mtcute/tl/binary/reader.js");
27
+ const writer_js = require("@mtcute/tl/binary/writer.js");
26
28
  const convertFileId = require("./highlevel/utils/convert-file-id.cjs");
27
29
  const entities = require("./highlevel/utils/entities.cjs");
28
30
  const fileUtils = require("./highlevel/utils/file-utils.cjs");
@@ -48,6 +50,7 @@ exports.DefaultDcsService = defaultDcs.DefaultDcsService;
48
50
  exports.randomBigInt = bigintUtils.randomBigInt;
49
51
  exports.randomBigIntBits = bigintUtils.randomBigIntBits;
50
52
  exports.randomBigIntInRange = bigintUtils.randomBigIntInRange;
53
+ exports.__tlReaderMapWithCompat = compat.__tlReaderMapWithCompat;
51
54
  exports.deserializeObjectWithCompat = compat.deserializeObjectWithCompat;
52
55
  exports.deserializePeersIndexWithCompat = compat.deserializePeersIndexWithCompat;
53
56
  exports.deserializeObject = serialization.deserializeObject;
@@ -91,6 +94,14 @@ exports.hasValueAtKey = typeAssertions.hasValueAtKey;
91
94
  exports.isPresent = typeAssertions.isPresent;
92
95
  exports.isTlRpcError = typeAssertions.isTlRpcError;
93
96
  exports.mtpAssertTypeIs = typeAssertions.mtpAssertTypeIs;
97
+ Object.defineProperty(exports, "__tlReaderMap", {
98
+ enumerable: true,
99
+ get: () => reader_js.__tlReaderMap
100
+ });
101
+ Object.defineProperty(exports, "__tlWriterMap", {
102
+ enumerable: true,
103
+ get: () => writer_js.__tlWriterMap
104
+ });
94
105
  exports.fileIdToEncryptedFile = convertFileId.fileIdToEncryptedFile;
95
106
  exports.fileIdToInputDocument = convertFileId.fileIdToInputDocument;
96
107
  exports.fileIdToInputFileLocation = convertFileId.fileIdToInputFileLocation;
package/utils.js CHANGED
@@ -3,7 +3,7 @@ import { UpdatesStateService } from "./highlevel/storage/service/updates.js";
3
3
  import { BaseService } from "./storage/service/base.js";
4
4
  import { DefaultDcsService } from "./storage/service/default-dcs.js";
5
5
  import { randomBigInt, randomBigIntBits, randomBigIntInRange } from "./utils/bigint-utils.js";
6
- import { deserializeObjectWithCompat, deserializePeersIndexWithCompat } from "./utils/binary/compat.js";
6
+ import { __tlReaderMapWithCompat, deserializeObjectWithCompat, deserializePeersIndexWithCompat } from "./utils/binary/compat.js";
7
7
  import { deserializeObject, deserializePeersIndex, serializeObject, serializePeersIndex } from "./utils/binary/serialization.js";
8
8
  import { defaultProductionDc, defaultProductionIpv6Dc, defaultTestDc, defaultTestIpv6Dc, parseBasicDcOption, serializeBasicDcOption } from "./utils/dcs.js";
9
9
  import { EarlyTimer } from "./utils/early-timer.js";
@@ -16,6 +16,8 @@ import { SortedArray } from "./utils/sorted-array.js";
16
16
  import { jsonToTlJson, tlJsonToJson } from "./utils/tl-json.js";
17
17
  import { assertTrue, assertTypeIs, assertTypeIsNot, hasValueAtKey, isPresent, isTlRpcError, mtpAssertTypeIs } from "./utils/type-assertions.js";
18
18
  export * from "@mtcute/tl-runtime";
19
+ import { __tlReaderMap } from "@mtcute/tl/binary/reader.js";
20
+ import { __tlWriterMap } from "@mtcute/tl/binary/writer.js";
19
21
  import { fileIdToEncryptedFile, fileIdToInputDocument, fileIdToInputFileLocation, fileIdToInputPhoto, fileIdToInputWebFileLocation, fileIdToSecureFile } from "./highlevel/utils/convert-file-id.js";
20
22
  import { joinTextWithEntities } from "./highlevel/utils/entities.js";
21
23
  import { determinePartSize, extractFileName, inflateSvgPath, isProbablyPlainText, strippedPhotoToJpg, svgPathToFile } from "./highlevel/utils/file-utils.js";
@@ -48,6 +50,9 @@ export {
48
50
  RpsMeter,
49
51
  SortedArray,
50
52
  UpdatesStateService,
53
+ __tlReaderMap,
54
+ __tlReaderMapWithCompat,
55
+ __tlWriterMap,
51
56
  addPublicKey,
52
57
  assertTrue,
53
58
  assertTypeIs,