@mtkruto/node 0.0.921 → 0.0.922

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.
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
4
4
  export declare const VECTOR_CONSTRUCTOR = 481674261;
5
5
  export declare const DEFAULT_INITIAL_DC: DC;
6
6
  export declare const LAYER = 158;
7
- export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.921";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.922";
8
8
  export declare const DEFAULT_DEVICE_MODEL: string;
9
9
  export declare const DEFAULT_LANG_CODE: string;
10
10
  export declare const DEFAULT_LANG_PACK = "";
package/esm/constants.js CHANGED
@@ -62,7 +62,7 @@ export const publicKeys = new Map([
62
62
  export const VECTOR_CONSTRUCTOR = 0x1CB5C415;
63
63
  export const DEFAULT_INITIAL_DC = "2-test";
64
64
  export const LAYER = 158;
65
- export const DEFAULT_APP_VERSION = "MTKruto 0.0.921";
65
+ export const DEFAULT_APP_VERSION = "MTKruto 0.0.922";
66
66
  // @ts-ignore: lib
67
67
  export const DEFAULT_DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
68
68
  export const DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -5,6 +5,7 @@ import { bigIntFromBuffer } from "../utilities/0_bigint.js";
5
5
  import { serialize } from "../tl/1_tl_object.js";
6
6
  import * as types from "../tl/2_types.js";
7
7
  import { TLReader } from "../tl/3_tl_reader.js";
8
+ import { rleDecode, rleEncode } from "../utilities/0_rle.js";
8
9
  export class Storage {
9
10
  constructor() {
10
11
  Object.defineProperty(this, "_authKeyId", {
@@ -163,12 +164,12 @@ export class Storage {
163
164
  }
164
165
  async setEntity(peer) {
165
166
  const type = peer instanceof types.Channel ? "channel" : peer instanceof types.Chat ? "chat" : peer instanceof types.User ? "user" : UNREACHABLE();
166
- await this.set(`${this.peer__}${type}${peer.id}`, base64Encode(peer[serialize]()));
167
+ await this.set(`${this.peer__}${type}${peer.id}`, base64Encode(rleEncode(peer[serialize]())));
167
168
  }
168
169
  async getEntity(type, id) {
169
170
  const peer_ = await this.get(`${this.peer__}${type}${id}`);
170
171
  if (peer_ != null) {
171
- const reader = new TLReader(base64Decode(peer_));
172
+ const reader = new TLReader(rleDecode(base64Decode(peer_)));
172
173
  return reader.readObject();
173
174
  }
174
175
  else {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "module": "./esm/mod.js",
3
3
  "main": "./script/mod.js",
4
4
  "name": "@mtkruto/node",
5
- "version": "0.0.921",
5
+ "version": "0.0.922",
6
6
  "description": "MTKruto for Node.js",
7
7
  "author": "Roj <rojvv@icloud.com>",
8
8
  "license": "LGPL-3.0-or-later",
@@ -4,7 +4,7 @@ export declare const publicKeys: Map<bigint, [bigint, bigint]>;
4
4
  export declare const VECTOR_CONSTRUCTOR = 481674261;
5
5
  export declare const DEFAULT_INITIAL_DC: DC;
6
6
  export declare const LAYER = 158;
7
- export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.921";
7
+ export declare const DEFAULT_APP_VERSION = "MTKruto 0.0.922";
8
8
  export declare const DEFAULT_DEVICE_MODEL: string;
9
9
  export declare const DEFAULT_LANG_CODE: string;
10
10
  export declare const DEFAULT_LANG_PACK = "";
@@ -88,7 +88,7 @@ exports.publicKeys = new Map([
88
88
  exports.VECTOR_CONSTRUCTOR = 0x1CB5C415;
89
89
  exports.DEFAULT_INITIAL_DC = "2-test";
90
90
  exports.LAYER = 158;
91
- exports.DEFAULT_APP_VERSION = "MTKruto 0.0.921";
91
+ exports.DEFAULT_APP_VERSION = "MTKruto 0.0.922";
92
92
  // @ts-ignore: lib
93
93
  exports.DEFAULT_DEVICE_MODEL = typeof dntShim.Deno === "undefined" ? typeof navigator === "undefined" ? typeof process === "undefined" ? "Unknown" : process.platform + "-" + process.arch : navigator.userAgent.split(" ")[0] : dntShim.Deno.build.os + "-" + dntShim.Deno.build.arch;
94
94
  exports.DEFAULT_LANG_CODE = typeof navigator === "undefined" ? "en" : navigator.language.split("-")[0];
@@ -31,6 +31,7 @@ const _0_bigint_js_1 = require("../utilities/0_bigint.js");
31
31
  const _1_tl_object_js_1 = require("../tl/1_tl_object.js");
32
32
  const types = __importStar(require("../tl/2_types.js"));
33
33
  const _3_tl_reader_js_1 = require("../tl/3_tl_reader.js");
34
+ const _0_rle_js_1 = require("../utilities/0_rle.js");
34
35
  class Storage {
35
36
  constructor() {
36
37
  Object.defineProperty(this, "_authKeyId", {
@@ -189,12 +190,12 @@ class Storage {
189
190
  }
190
191
  async setEntity(peer) {
191
192
  const type = peer instanceof types.Channel ? "channel" : peer instanceof types.Chat ? "chat" : peer instanceof types.User ? "user" : (0, _0_control_js_1.UNREACHABLE)();
192
- await this.set(`${this.peer__}${type}${peer.id}`, (0, deps_js_1.base64Encode)(peer[_1_tl_object_js_1.serialize]()));
193
+ await this.set(`${this.peer__}${type}${peer.id}`, (0, deps_js_1.base64Encode)((0, _0_rle_js_1.rleEncode)(peer[_1_tl_object_js_1.serialize]())));
193
194
  }
194
195
  async getEntity(type, id) {
195
196
  const peer_ = await this.get(`${this.peer__}${type}${id}`);
196
197
  if (peer_ != null) {
197
- const reader = new _3_tl_reader_js_1.TLReader((0, deps_js_1.base64Decode)(peer_));
198
+ const reader = new _3_tl_reader_js_1.TLReader((0, _0_rle_js_1.rleDecode)((0, deps_js_1.base64Decode)(peer_)));
198
199
  return reader.readObject();
199
200
  }
200
201
  else {