@mtcute/core 0.29.7 → 0.30.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 (90) hide show
  1. package/highlevel/client.d.cts +4 -6
  2. package/highlevel/client.d.ts +4 -6
  3. package/highlevel/methods/chats/join-chat.cjs +38 -16
  4. package/highlevel/methods/chats/join-chat.d.cts +20 -6
  5. package/highlevel/methods/chats/join-chat.d.ts +20 -6
  6. package/highlevel/methods/chats/join-chat.js +38 -16
  7. package/highlevel/methods/chats/save-draft.d.cts +4 -1
  8. package/highlevel/methods/chats/save-draft.d.ts +4 -1
  9. package/highlevel/methods.d.cts +2 -0
  10. package/highlevel/methods.d.ts +2 -0
  11. package/highlevel/storage/service/peers.cjs +1 -0
  12. package/highlevel/storage/service/peers.js +1 -0
  13. package/highlevel/types/files/utils.d.cts +1 -1
  14. package/highlevel/types/files/utils.d.ts +1 -1
  15. package/highlevel/types/messages/index.d.cts +1 -0
  16. package/highlevel/types/messages/index.d.ts +1 -0
  17. package/highlevel/types/messages/message.cjs +5 -0
  18. package/highlevel/types/messages/message.d.cts +3 -0
  19. package/highlevel/types/messages/message.d.ts +3 -0
  20. package/highlevel/types/messages/message.js +5 -0
  21. package/highlevel/types/messages/rich-message.cjs +50 -0
  22. package/highlevel/types/messages/rich-message.d.cts +18 -0
  23. package/highlevel/types/messages/rich-message.d.ts +18 -0
  24. package/highlevel/types/messages/rich-message.js +45 -0
  25. package/highlevel/types/peers/full-chat.cjs +6 -0
  26. package/highlevel/types/peers/full-chat.d.cts +2 -0
  27. package/highlevel/types/peers/full-chat.d.ts +2 -0
  28. package/highlevel/types/peers/full-chat.js +6 -0
  29. package/highlevel/types/peers/user.cjs +4 -0
  30. package/highlevel/types/peers/user.d.cts +2 -0
  31. package/highlevel/types/peers/user.d.ts +2 -0
  32. package/highlevel/types/peers/user.js +4 -0
  33. package/highlevel/types/updates/user-typing-update.cjs +2 -0
  34. package/highlevel/types/updates/user-typing-update.js +2 -0
  35. package/highlevel/updates/manager.cjs +191 -0
  36. package/highlevel/updates/manager.js +191 -0
  37. package/highlevel/utils/inspectable.cjs +1 -0
  38. package/highlevel/utils/inspectable.d.cts +1 -0
  39. package/highlevel/utils/inspectable.d.ts +1 -0
  40. package/highlevel/utils/inspectable.js +1 -0
  41. package/index.cjs +2 -0
  42. package/index.js +2 -0
  43. package/network/flood-control.cjs +149 -0
  44. package/network/flood-control.d.cts +79 -0
  45. package/network/flood-control.d.ts +79 -0
  46. package/network/flood-control.js +144 -0
  47. package/network/flood-control.test.d.cts +1 -0
  48. package/network/flood-control.test.d.ts +1 -0
  49. package/network/mtproto-session.cjs +1 -21
  50. package/network/mtproto-session.d.cts +1 -5
  51. package/network/mtproto-session.d.ts +1 -5
  52. package/network/mtproto-session.js +2 -22
  53. package/network/multi-session-connection.cjs +26 -16
  54. package/network/multi-session-connection.d.cts +1 -1
  55. package/network/multi-session-connection.d.ts +1 -1
  56. package/network/multi-session-connection.js +26 -16
  57. package/network/multi-session-connection.test.d.cts +1 -0
  58. package/network/multi-session-connection.test.d.ts +1 -0
  59. package/network/network-manager.cjs +3 -2
  60. package/network/network-manager.d.cts +12 -0
  61. package/network/network-manager.d.ts +12 -0
  62. package/network/network-manager.js +3 -2
  63. package/network/persistent-connection.cjs +25 -1
  64. package/network/persistent-connection.d.cts +5 -0
  65. package/network/persistent-connection.d.ts +5 -0
  66. package/network/persistent-connection.js +25 -1
  67. package/network/session-connection.cjs +5 -10
  68. package/network/session-connection.d.cts +0 -2
  69. package/network/session-connection.d.ts +0 -2
  70. package/network/session-connection.js +5 -10
  71. package/package.json +1 -1
  72. package/tl/api-schema.json +1 -1
  73. package/tl/binary/reader.cjs +176 -26
  74. package/tl/binary/reader.js +176 -26
  75. package/tl/binary/writer.cjs +439 -20
  76. package/tl/binary/writer.js +439 -20
  77. package/tl/compat/reader.cjs +23 -0
  78. package/tl/compat/reader.js +23 -0
  79. package/tl/index.d.cts +414 -14
  80. package/tl/index.d.ts +414 -14
  81. package/tl/inner-tl.cjs +20 -8
  82. package/tl/inner-tl.js +20 -8
  83. package/utils/binary/compat.cjs +79 -0
  84. package/utils/binary/compat.js +79 -0
  85. package/utils/index.d.cts +1 -0
  86. package/utils/index.d.ts +1 -0
  87. package/utils/long-utils.cjs +10 -0
  88. package/utils/long-utils.js +10 -0
  89. package/utils.cjs +7 -0
  90. package/utils.js +8 -1
package/utils/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from '../highlevel/utils/index.js';
2
+ export * from '../network/flood-control.js';
2
3
  export { __tlReaderMap } from '../tl/binary/reader.js';
3
4
  export { __tlWriterMap } from '../tl/binary/writer.js';
4
5
  export * from './bigint-utils.js';
@@ -7,6 +7,7 @@ if (typeof globalThis !== "undefined" && !globalThis._MTCUTE_CJS_DEPRECATION_WAR
7
7
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
8
8
  const utils = require("@fuman/utils");
9
9
  const Long = require("long");
10
+ const inspectable = require("../highlevel/utils/inspectable.cjs");
10
11
  const miscUtils = require("./misc-utils.cjs");
11
12
  function randomLong(unsigned = false) {
12
13
  const lo = miscUtils.getRandomInt(4294967295);
@@ -53,6 +54,15 @@ class LongMap extends utils.CustomMap {
53
54
  super(longToFastString, longFromFastString);
54
55
  }
55
56
  }
57
+ const proto = class LongMap2 {
58
+ }.prototype;
59
+ LongMap.prototype[inspectable.customInspectSymbol] = function() {
60
+ const res = Object.create(proto);
61
+ this.forEach((v, k) => {
62
+ res[k.toString()] = v;
63
+ });
64
+ return res;
65
+ };
56
66
  class LongSet extends utils.CustomSet {
57
67
  constructor() {
58
68
  super(longToFastString, longFromFastString);
@@ -1,5 +1,6 @@
1
1
  import { typed, CustomMap, CustomSet } from "@fuman/utils";
2
2
  import Long from "long";
3
+ import { customInspectSymbol } from "../highlevel/utils/inspectable.js";
3
4
  import { getRandomInt } from "./misc-utils.js";
4
5
  function randomLong(unsigned = false) {
5
6
  const lo = getRandomInt(4294967295);
@@ -46,6 +47,15 @@ class LongMap extends CustomMap {
46
47
  super(longToFastString, longFromFastString);
47
48
  }
48
49
  }
50
+ const proto = class LongMap2 {
51
+ }.prototype;
52
+ LongMap.prototype[customInspectSymbol] = function() {
53
+ const res = Object.create(proto);
54
+ this.forEach((v, k) => {
55
+ res[k.toString()] = v;
56
+ });
57
+ return res;
58
+ };
49
59
  class LongSet extends CustomSet {
50
60
  constructor() {
51
61
  super(longToFastString, longFromFastString);
package/utils.cjs CHANGED
@@ -5,6 +5,7 @@ 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 floodControl = require("./network/flood-control.cjs");
8
9
  const reader = require("./tl/binary/reader.cjs");
9
10
  const writer = require("./tl/binary/writer.cjs");
10
11
  const bigintUtils = require("./utils/bigint-utils.cjs");
@@ -40,6 +41,11 @@ const millerRabin = require("./utils/crypto/miller-rabin.cjs");
40
41
  const mtproto = require("./utils/crypto/mtproto.cjs");
41
42
  const password = require("./utils/crypto/password.cjs");
42
43
  const bundle = require("./utils/links/bundle.cjs");
44
+ exports.ConnectionFloodController = floodControl.ConnectionFloodController;
45
+ exports.DEFAULT_FLOOD_LIMITS = floodControl.DEFAULT_FLOOD_LIMITS;
46
+ exports.DEFAULT_MTPROTO_ERROR_LIMITS = floodControl.DEFAULT_MTPROTO_ERROR_LIMITS;
47
+ exports.DEFAULT_SANITY_LIMITS = floodControl.DEFAULT_SANITY_LIMITS;
48
+ exports.FloodControl = floodControl.FloodControl;
43
49
  exports.__tlReaderMap = reader.__tlReaderMap;
44
50
  exports.__tlWriterMap = writer.__tlWriterMap;
45
51
  exports.randomBigInt = bigintUtils.randomBigInt;
@@ -108,6 +114,7 @@ exports.svgPathToFile = fileUtils.svgPathToFile;
108
114
  exports.encodeInlineMessageId = inlineUtils.encodeInlineMessageId;
109
115
  exports.normalizeInlineId = inlineUtils.normalizeInlineId;
110
116
  exports.parseInlineMessageId = inlineUtils.parseInlineMessageId;
117
+ exports.customInspectSymbol = inspectable.customInspectSymbol;
111
118
  exports.makeInspectable = inspectable.makeInspectable;
112
119
  exports.makeArrayPaginated = miscUtils.makeArrayPaginated;
113
120
  exports.makeArrayPaginatedWithMeta = miscUtils.makeArrayPaginatedWithMeta;
package/utils.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { ConnectionFloodController, DEFAULT_FLOOD_LIMITS, DEFAULT_MTPROTO_ERROR_LIMITS, DEFAULT_SANITY_LIMITS, FloodControl } from "./network/flood-control.js";
1
2
  import { __tlReaderMap } from "./tl/binary/reader.js";
2
3
  import { __tlWriterMap } from "./tl/binary/writer.js";
3
4
  import { randomBigInt, randomBigIntBits, randomBigIntInRange } from "./utils/bigint-utils.js";
@@ -19,7 +20,7 @@ import { fileIdToEncryptedFile, fileIdToInputDocument, fileIdToInputFileLocation
19
20
  import { joinTextWithEntities } from "./highlevel/utils/entities.js";
20
21
  import { determinePartSize, extractFileName, inflateSvgPath, isProbablyPlainText, strippedPhotoToJpg, svgPathToFile } from "./highlevel/utils/file-utils.js";
21
22
  import { encodeInlineMessageId, normalizeInlineId, parseInlineMessageId } from "./highlevel/utils/inline-utils.js";
22
- import { makeInspectable } from "./highlevel/utils/inspectable.js";
23
+ import { customInspectSymbol, makeInspectable } from "./highlevel/utils/inspectable.js";
23
24
  import { makeArrayPaginated, makeArrayPaginatedWithMeta, makeArrayWithTotal, normalizeDate, normalizeMessageId, normalizePhoneNumber, resolveMaybeDynamic } from "./highlevel/utils/misc-utils.js";
24
25
  import { INVITE_LINK_REGEX, extractUsernames, inputPeerToPeer, isInputPeerChannel, isInputPeerChat, isInputPeerUser, toInputChannel, toInputPeer, toInputUser } from "./highlevel/utils/peer-utils.js";
25
26
  import { RpsMeter } from "./highlevel/utils/rps-meter.js";
@@ -35,7 +36,12 @@ import { computeNewPasswordHash, computePasswordHash, computeSrpParams } from ".
35
36
  import * as bundle from "./utils/links/bundle.js";
36
37
  export {
37
38
  BaseCryptoProvider,
39
+ ConnectionFloodController,
40
+ DEFAULT_FLOOD_LIMITS,
41
+ DEFAULT_MTPROTO_ERROR_LIMITS,
42
+ DEFAULT_SANITY_LIMITS,
38
43
  EarlyTimer,
44
+ FloodControl,
39
45
  INVITE_LINK_REGEX,
40
46
  LogManager,
41
47
  Logger,
@@ -57,6 +63,7 @@ export {
57
63
  computeSrpParams,
58
64
  createAesIgeForMessage,
59
65
  createAesIgeForMessageOld,
66
+ customInspectSymbol,
60
67
  dateEntityFormatToString,
61
68
  decodeWaveform,
62
69
  defaultProductionDc,