@mtcute/core 0.27.0 → 0.27.2

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 (39) hide show
  1. package/client.cjs +12 -0
  2. package/client.js +13 -1
  3. package/highlevel/client.d.cts +131 -90
  4. package/highlevel/client.d.ts +131 -90
  5. package/highlevel/client.test.d.cts +1 -0
  6. package/highlevel/client.test.d.ts +1 -0
  7. package/highlevel/methods/auth/start.d.cts +3 -3
  8. package/highlevel/methods/auth/start.d.ts +3 -3
  9. package/highlevel/methods/contacts/set-contact-note.cjs +21 -0
  10. package/highlevel/methods/contacts/set-contact-note.js +16 -0
  11. package/highlevel/methods/files/download-chunk.cjs +63 -0
  12. package/highlevel/methods/files/download-chunk.d.cts +29 -0
  13. package/highlevel/methods/files/download-chunk.d.ts +29 -0
  14. package/highlevel/methods/files/download-chunk.js +58 -0
  15. package/highlevel/methods/files/download-chunk.test.d.cts +1 -0
  16. package/highlevel/methods/files/download-chunk.test.d.ts +1 -0
  17. package/highlevel/methods/files/download-iterable.cjs +40 -23
  18. package/highlevel/methods/files/download-iterable.d.cts +6 -0
  19. package/highlevel/methods/files/download-iterable.d.ts +6 -0
  20. package/highlevel/methods/files/download-iterable.js +34 -17
  21. package/highlevel/methods/forums/reorder-pinned-forum-topics.cjs +2 -2
  22. package/highlevel/methods/forums/reorder-pinned-forum-topics.js +3 -3
  23. package/highlevel/methods/forums/toggle-forum-topic-closed.cjs +2 -2
  24. package/highlevel/methods/forums/toggle-forum-topic-closed.js +3 -3
  25. package/highlevel/methods/forums/toggle-forum-topic-pinned.cjs +2 -2
  26. package/highlevel/methods/forums/toggle-forum-topic-pinned.js +3 -3
  27. package/highlevel/methods.d.cts +3 -0
  28. package/highlevel/methods.d.ts +3 -0
  29. package/highlevel/types/premium/star-gift.cjs +5 -1
  30. package/highlevel/types/premium/star-gift.d.cts +3 -1
  31. package/highlevel/types/premium/star-gift.d.ts +3 -1
  32. package/highlevel/types/premium/star-gift.js +5 -1
  33. package/methods.cjs +5 -0
  34. package/methods.js +6 -1
  35. package/network/network-manager.cjs +1 -1
  36. package/network/network-manager.js +1 -1
  37. package/package.json +2 -2
  38. package/utils/binary/compat.cjs +29 -0
  39. package/utils/binary/compat.js +29 -0
@@ -29,10 +29,12 @@ export declare class StarGift {
29
29
  /** Whether this gift is available only to premium users */
30
30
  get isPremiumOnly(): boolean;
31
31
  /** If this gift is currently sold through an auction, info about that auction. `null` otherwise */
32
- get action(): {
32
+ get auction(): {
33
33
  slug: string;
34
34
  giftsPerRound: number;
35
35
  } | null;
36
+ /** @deprecated Use {@link auction} instead (typo in older versions) */
37
+ get action(): this['auction'];
36
38
  /** Whether this gift includes a peer color that can be applied to user's profile */
37
39
  get hasPeerColor(): boolean;
38
40
  /** Whether this gift is a unique gift */
@@ -29,10 +29,12 @@ export declare class StarGift {
29
29
  /** Whether this gift is available only to premium users */
30
30
  get isPremiumOnly(): boolean;
31
31
  /** If this gift is currently sold through an auction, info about that auction. `null` otherwise */
32
- get action(): {
32
+ get auction(): {
33
33
  slug: string;
34
34
  giftsPerRound: number;
35
35
  } | null;
36
+ /** @deprecated Use {@link auction} instead (typo in older versions) */
37
+ get action(): this['auction'];
36
38
  /** Whether this gift includes a peer color that can be applied to user's profile */
37
39
  get hasPeerColor(): boolean;
38
40
  /** Whether this gift is a unique gift */
@@ -27,13 +27,17 @@ class StarGift {
27
27
  return this.raw.requirePremium;
28
28
  }
29
29
  /** If this gift is currently sold through an auction, info about that auction. `null` otherwise */
30
- get action() {
30
+ get auction() {
31
31
  if (!this.raw.auctionSlug || this.raw.giftsPerRound == null) return null;
32
32
  return {
33
33
  slug: this.raw.auctionSlug,
34
34
  giftsPerRound: this.raw.giftsPerRound
35
35
  };
36
36
  }
37
+ /** @deprecated Use {@link auction} instead (typo in older versions) */
38
+ get action() {
39
+ return this.auction;
40
+ }
37
41
  /** Whether this gift includes a peer color that can be applied to user's profile */
38
42
  get hasPeerColor() {
39
43
  return this.raw.peerColorAvailable;
package/methods.cjs CHANGED
@@ -87,6 +87,7 @@ const addContact = require("./highlevel/methods/contacts/add-contact.cjs");
87
87
  const deleteContacts = require("./highlevel/methods/contacts/delete-contacts.cjs");
88
88
  const getContacts = require("./highlevel/methods/contacts/get-contacts.cjs");
89
89
  const importContacts = require("./highlevel/methods/contacts/import-contacts.cjs");
90
+ const setContactNote = require("./highlevel/methods/contacts/set-contact-note.cjs");
90
91
  const createFolder = require("./highlevel/methods/dialogs/create-folder.cjs");
91
92
  const deleteFolder = require("./highlevel/methods/dialogs/delete-folder.cjs");
92
93
  const editFolder = require("./highlevel/methods/dialogs/edit-folder.cjs");
@@ -99,6 +100,7 @@ const iterDialogs = require("./highlevel/methods/dialogs/iter-dialogs.cjs");
99
100
  const joinChatlist = require("./highlevel/methods/dialogs/join-chatlist.cjs");
100
101
  const setFoldersOrder = require("./highlevel/methods/dialogs/set-folders-order.cjs");
101
102
  const downloadBuffer = require("./highlevel/methods/files/download-buffer.cjs");
103
+ const downloadChunk = require("./highlevel/methods/files/download-chunk.cjs");
102
104
  const downloadIterable = require("./highlevel/methods/files/download-iterable.cjs");
103
105
  const downloadStream = require("./highlevel/methods/files/download-stream.cjs");
104
106
  const normalizeInputFile = require("./highlevel/methods/files/normalize-input-file.cjs");
@@ -362,6 +364,7 @@ exports.addContact = addContact.addContact;
362
364
  exports.deleteContacts = deleteContacts.deleteContacts;
363
365
  exports.getContacts = getContacts.getContacts;
364
366
  exports.importContacts = importContacts.importContacts;
367
+ exports.setContactNote = setContactNote.setContactNote;
365
368
  exports.createFolder = createFolder.createFolder;
366
369
  exports.deleteFolder = deleteFolder.deleteFolder;
367
370
  exports.editFolder = editFolder.editFolder;
@@ -374,6 +377,8 @@ exports.iterDialogs = iterDialogs.iterDialogs;
374
377
  exports.joinChatlist = joinChatlist.joinChatlist;
375
378
  exports.setFoldersOrder = setFoldersOrder.setFoldersOrder;
376
379
  exports.downloadAsBuffer = downloadBuffer.downloadAsBuffer;
380
+ exports.downloadChunk = downloadChunk.downloadChunk;
381
+ exports._normalizeFileDownloadLocation = downloadIterable._normalizeFileDownloadLocation;
377
382
  exports.downloadAsIterable = downloadIterable.downloadAsIterable;
378
383
  exports.downloadAsStream = downloadStream.downloadAsStream;
379
384
  exports._normalizeInputFile = normalizeInputFile._normalizeInputFile;
package/methods.js CHANGED
@@ -80,6 +80,7 @@ import { addContact } from "./highlevel/methods/contacts/add-contact.js";
80
80
  import { deleteContacts } from "./highlevel/methods/contacts/delete-contacts.js";
81
81
  import { getContacts } from "./highlevel/methods/contacts/get-contacts.js";
82
82
  import { importContacts } from "./highlevel/methods/contacts/import-contacts.js";
83
+ import { setContactNote } from "./highlevel/methods/contacts/set-contact-note.js";
83
84
  import { createFolder } from "./highlevel/methods/dialogs/create-folder.js";
84
85
  import { deleteFolder } from "./highlevel/methods/dialogs/delete-folder.js";
85
86
  import { editFolder } from "./highlevel/methods/dialogs/edit-folder.js";
@@ -92,7 +93,8 @@ import { iterDialogs } from "./highlevel/methods/dialogs/iter-dialogs.js";
92
93
  import { joinChatlist } from "./highlevel/methods/dialogs/join-chatlist.js";
93
94
  import { setFoldersOrder } from "./highlevel/methods/dialogs/set-folders-order.js";
94
95
  import { downloadAsBuffer } from "./highlevel/methods/files/download-buffer.js";
95
- import { downloadAsIterable } from "./highlevel/methods/files/download-iterable.js";
96
+ import { downloadChunk } from "./highlevel/methods/files/download-chunk.js";
97
+ import { _normalizeFileDownloadLocation, downloadAsIterable } from "./highlevel/methods/files/download-iterable.js";
96
98
  import { downloadAsStream } from "./highlevel/methods/files/download-stream.js";
97
99
  import { _normalizeInputFile } from "./highlevel/methods/files/normalize-input-file.js";
98
100
  import { _normalizeInputMedia } from "./highlevel/methods/files/normalize-input-media.js";
@@ -270,6 +272,7 @@ import { sendOnline, setOnline } from "./highlevel/methods/users/set-online.js";
270
272
  import { unblockUser } from "./highlevel/methods/users/unblock-user.js";
271
273
  import { updateProfile } from "./highlevel/methods/users/update-profile.js";
272
274
  export {
275
+ _normalizeFileDownloadLocation,
273
276
  _normalizeInputFile,
274
277
  _normalizeInputMedia,
275
278
  _normalizeInputStarGift,
@@ -328,6 +331,7 @@ export {
328
331
  downloadAsBuffer,
329
332
  downloadAsIterable,
330
333
  downloadAsStream,
334
+ downloadChunk,
331
335
  editAdminRights,
332
336
  editBusinessChatLink,
333
337
  editCloseFriends,
@@ -519,6 +523,7 @@ export {
519
523
  setChatTitle,
520
524
  setChatTtl,
521
525
  setChatUsername,
526
+ setContactNote,
522
527
  setEmojiStatus,
523
528
  setFoldersOrder,
524
529
  setGameScore,
@@ -225,7 +225,7 @@ class NetworkManager {
225
225
  _: "initConnection",
226
226
  deviceModel,
227
227
  systemVersion: "1.0",
228
- appVersion: "0.27.0",
228
+ appVersion: "0.27.2",
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.27.0",
221
+ appVersion: "0.27.2",
222
222
  systemLangCode: "en",
223
223
  langPack: "",
224
224
  // "langPacks are for official apps only"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mtcute/core",
3
3
  "type": "module",
4
- "version": "0.27.0",
4
+ "version": "0.27.2",
5
5
  "description": "Type-safe library for MTProto (Telegram API)",
6
6
  "license": "MIT",
7
7
  "scripts": {},
@@ -10,7 +10,7 @@
10
10
  "@fuman/net": "0.0.17",
11
11
  "@fuman/utils": "0.0.17",
12
12
  "@mtcute/file-id": "^0.27.0",
13
- "@mtcute/tl": "^218.0.0",
13
+ "@mtcute/tl": "^218.0.1",
14
14
  "@mtcute/tl-runtime": "^0.24.3",
15
15
  "@types/events": "3.0.0",
16
16
  "long": "5.2.3"
@@ -62,6 +62,7 @@ function mapCompatStarGift(obj) {
62
62
  case "starGift_layer206":
63
63
  case "starGift_layer209":
64
64
  case "starGift_layer211":
65
+ case "starGift_layer216":
65
66
  return replaceType(obj, "starGift");
66
67
  default:
67
68
  return obj;
@@ -116,6 +117,7 @@ function mapCompatMessageAction(obj) {
116
117
  };
117
118
  case "messageActionStarGift_layer197":
118
119
  case "messageActionStarGift_layer211":
120
+ case "messageActionStarGift_layer216":
119
121
  return {
120
122
  ...obj,
121
123
  _: "messageActionStarGift",
@@ -131,6 +133,18 @@ function mapCompatMessageAction(obj) {
131
133
  emoticon: obj.emoticon
132
134
  }
133
135
  };
136
+ case "messageActionGiftCode_layer216":
137
+ return {
138
+ ...obj,
139
+ _: "messageActionGiftCode",
140
+ days: obj.months / 30
141
+ };
142
+ case "messageActionGiftPremium_layer216":
143
+ return {
144
+ ...obj,
145
+ _: "messageActionGiftPremium",
146
+ days: obj.months / 30
147
+ };
134
148
  default:
135
149
  return obj;
136
150
  }
@@ -151,6 +165,7 @@ function mapCompatMessage(obj) {
151
165
  switch (obj._) {
152
166
  case "message_layer199":
153
167
  case "message_layer204":
168
+ case "message_layer216":
154
169
  return {
155
170
  ...obj,
156
171
  _: "message",
@@ -181,6 +196,7 @@ function mapCompatObject(obj) {
181
196
  case "starGift_layer206":
182
197
  case "starGift_layer209":
183
198
  case "starGift_layer211":
199
+ case "starGift_layer216":
184
200
  return mapCompatStarGift(obj);
185
201
  case "emojiStatus_layer197":
186
202
  case "emojiStatusUntil_layer214":
@@ -198,6 +214,9 @@ function mapCompatObject(obj) {
198
214
  case "messageActionPaidMessagesPrice_layer203":
199
215
  case "messageActionSetChatTheme_layer211":
200
216
  case "messageActionStarGiftUnique_layer214":
217
+ case "messageActionGiftCode_layer216":
218
+ case "messageActionGiftPremium_layer216":
219
+ case "messageActionStarGift_layer216":
201
220
  return mapCompatMessageAction(obj);
202
221
  case "userFull_layer199":
203
222
  return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
@@ -208,6 +227,7 @@ function mapCompatObject(obj) {
208
227
  case "userFull_layer214":
209
228
  return replaceType(obj, "userFull");
210
229
  case "user_layer199":
230
+ case "user_layer216":
211
231
  return {
212
232
  ...obj,
213
233
  _: "user",
@@ -216,6 +236,7 @@ function mapCompatObject(obj) {
216
236
  };
217
237
  case "channel_layer199":
218
238
  case "channel_layer203":
239
+ case "channel_layer216":
219
240
  return {
220
241
  ...obj,
221
242
  _: "channel",
@@ -228,6 +249,7 @@ function mapCompatObject(obj) {
228
249
  return { _: "phoneCallDiscardReasonMissed" };
229
250
  case "message_layer199":
230
251
  case "message_layer204":
252
+ case "message_layer216":
231
253
  case "messageService_layer204":
232
254
  return mapCompatMessage(obj);
233
255
  case "messageReplyHeader_layer206":
@@ -238,6 +260,13 @@ function mapCompatObject(obj) {
238
260
  _: "storyItem",
239
261
  media: mapCompatMessageMedia(obj.media)
240
262
  };
263
+ case "todoCompletion_layer216":
264
+ return {
265
+ _: "todoCompletion",
266
+ date: obj.date,
267
+ completedBy: { _: "peerUser", userId: obj.completedBy },
268
+ id: obj.id
269
+ };
241
270
  case "premiumGiftOption_layer199":
242
271
  return null;
243
272
  default:
@@ -55,6 +55,7 @@ function mapCompatStarGift(obj) {
55
55
  case "starGift_layer206":
56
56
  case "starGift_layer209":
57
57
  case "starGift_layer211":
58
+ case "starGift_layer216":
58
59
  return replaceType(obj, "starGift");
59
60
  default:
60
61
  return obj;
@@ -109,6 +110,7 @@ function mapCompatMessageAction(obj) {
109
110
  };
110
111
  case "messageActionStarGift_layer197":
111
112
  case "messageActionStarGift_layer211":
113
+ case "messageActionStarGift_layer216":
112
114
  return {
113
115
  ...obj,
114
116
  _: "messageActionStarGift",
@@ -124,6 +126,18 @@ function mapCompatMessageAction(obj) {
124
126
  emoticon: obj.emoticon
125
127
  }
126
128
  };
129
+ case "messageActionGiftCode_layer216":
130
+ return {
131
+ ...obj,
132
+ _: "messageActionGiftCode",
133
+ days: obj.months / 30
134
+ };
135
+ case "messageActionGiftPremium_layer216":
136
+ return {
137
+ ...obj,
138
+ _: "messageActionGiftPremium",
139
+ days: obj.months / 30
140
+ };
127
141
  default:
128
142
  return obj;
129
143
  }
@@ -144,6 +158,7 @@ function mapCompatMessage(obj) {
144
158
  switch (obj._) {
145
159
  case "message_layer199":
146
160
  case "message_layer204":
161
+ case "message_layer216":
147
162
  return {
148
163
  ...obj,
149
164
  _: "message",
@@ -174,6 +189,7 @@ function mapCompatObject(obj) {
174
189
  case "starGift_layer206":
175
190
  case "starGift_layer209":
176
191
  case "starGift_layer211":
192
+ case "starGift_layer216":
177
193
  return mapCompatStarGift(obj);
178
194
  case "emojiStatus_layer197":
179
195
  case "emojiStatusUntil_layer214":
@@ -191,6 +207,9 @@ function mapCompatObject(obj) {
191
207
  case "messageActionPaidMessagesPrice_layer203":
192
208
  case "messageActionSetChatTheme_layer211":
193
209
  case "messageActionStarGiftUnique_layer214":
210
+ case "messageActionGiftCode_layer216":
211
+ case "messageActionGiftPremium_layer216":
212
+ case "messageActionStarGift_layer216":
194
213
  return mapCompatMessageAction(obj);
195
214
  case "userFull_layer199":
196
215
  return replaceType(dropFields(obj, ["premiumGifts"]), "userFull");
@@ -201,6 +220,7 @@ function mapCompatObject(obj) {
201
220
  case "userFull_layer214":
202
221
  return replaceType(obj, "userFull");
203
222
  case "user_layer199":
223
+ case "user_layer216":
204
224
  return {
205
225
  ...obj,
206
226
  _: "user",
@@ -209,6 +229,7 @@ function mapCompatObject(obj) {
209
229
  };
210
230
  case "channel_layer199":
211
231
  case "channel_layer203":
232
+ case "channel_layer216":
212
233
  return {
213
234
  ...obj,
214
235
  _: "channel",
@@ -221,6 +242,7 @@ function mapCompatObject(obj) {
221
242
  return { _: "phoneCallDiscardReasonMissed" };
222
243
  case "message_layer199":
223
244
  case "message_layer204":
245
+ case "message_layer216":
224
246
  case "messageService_layer204":
225
247
  return mapCompatMessage(obj);
226
248
  case "messageReplyHeader_layer206":
@@ -231,6 +253,13 @@ function mapCompatObject(obj) {
231
253
  _: "storyItem",
232
254
  media: mapCompatMessageMedia(obj.media)
233
255
  };
256
+ case "todoCompletion_layer216":
257
+ return {
258
+ _: "todoCompletion",
259
+ date: obj.date,
260
+ completedBy: { _: "peerUser", userId: obj.completedBy },
261
+ id: obj.id
262
+ };
234
263
  case "premiumGiftOption_layer199":
235
264
  return null;
236
265
  default: