@mtkruto/node 0.0.73 → 0.0.75

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.
@@ -20,7 +20,7 @@ export class SessionLocalStorage extends Session {
20
20
  }
21
21
  }
22
22
  save() {
23
- const authKey = this.authKey == null ? undefined : Array.from(this.authKey).map((v) => v.toString(16)).map((v) => v.padStart(2, "0"));
23
+ const authKey = this.authKey == null ? undefined : Array.from(this.authKey).map((v) => v.toString(16)).map((v) => v.padStart(2, "0")).join("");
24
24
  localStorage.setItem(this.key, JSON.stringify({ dc: this.dc, authKey }));
25
25
  }
26
26
  }
@@ -26,7 +26,7 @@ function serializeSingleParam(writer, value, type, ntype) {
26
26
  return;
27
27
  }
28
28
  else {
29
- throw new Error("a");
29
+ throw new TypeError(`Expected ${type.name}`);
30
30
  }
31
31
  }
32
32
  if (type == Uint8Array) {
@@ -34,7 +34,7 @@ function serializeSingleParam(writer, value, type, ntype) {
34
34
  writer.writeBytes(value);
35
35
  }
36
36
  else {
37
- throw new Error("Expected Uint8Array");
37
+ throw new TypeError("Expected Uint8Array");
38
38
  }
39
39
  }
40
40
  switch (type) {
@@ -51,7 +51,7 @@ function serializeSingleParam(writer, value, type, ntype) {
51
51
  }
52
52
  }
53
53
  else {
54
- throw new Error("Expected bigint");
54
+ throw new TypeError("Expected bigint");
55
55
  }
56
56
  break;
57
57
  case "boolean":
@@ -64,7 +64,7 @@ function serializeSingleParam(writer, value, type, ntype) {
64
64
  }
65
65
  }
66
66
  else {
67
- throw new Error("Expected boolean");
67
+ throw new TypeError("Expected boolean");
68
68
  }
69
69
  break;
70
70
  case "number":
@@ -72,7 +72,7 @@ function serializeSingleParam(writer, value, type, ntype) {
72
72
  writer.writeInt32(value);
73
73
  }
74
74
  else {
75
- throw new Error("Expected number");
75
+ throw new TypeError("Expected number");
76
76
  }
77
77
  break;
78
78
  case "string":
@@ -83,7 +83,7 @@ function serializeSingleParam(writer, value, type, ntype) {
83
83
  writer.writeBytes(value);
84
84
  }
85
85
  else {
86
- throw new Error("Expected string or Uint8Array");
86
+ throw new TypeError("Expected string or Uint8Array");
87
87
  }
88
88
  break;
89
89
  case "true":
@@ -91,7 +91,7 @@ function serializeSingleParam(writer, value, type, ntype) {
91
91
  writer.writeInt32(0x997275B5);
92
92
  }
93
93
  else {
94
- throw new Error("Expected true");
94
+ throw new TypeError("Expected true");
95
95
  }
96
96
  }
97
97
  }
@@ -129,7 +129,7 @@ export class TLObject {
129
129
  if (type instanceof Array) {
130
130
  const itemsType = type[0];
131
131
  if (!Array.isArray(value)) {
132
- throw new Error("Expected array");
132
+ throw new TypeError("Expected array");
133
133
  }
134
134
  writer.writeInt32(0x1CB5C415); // vector constructor
135
135
  writer.writeInt32(value.length);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "main": "./script/mod.js",
4
4
  "types": "./types/mod.d.ts",
5
5
  "name": "@mtkruto/node",
6
- "version": "0.0.73",
6
+ "version": "0.0.75",
7
7
  "description": "MTKruto for Node.js",
8
8
  "author": "Roj <rojvv@icloud.com>",
9
9
  "license": "LGPL-3.0-or-later",
@@ -23,7 +23,7 @@ class SessionLocalStorage extends session_js_1.Session {
23
23
  }
24
24
  }
25
25
  save() {
26
- const authKey = this.authKey == null ? undefined : Array.from(this.authKey).map((v) => v.toString(16)).map((v) => v.padStart(2, "0"));
26
+ const authKey = this.authKey == null ? undefined : Array.from(this.authKey).map((v) => v.toString(16)).map((v) => v.padStart(2, "0")).join("");
27
27
  localStorage.setItem(this.key, JSON.stringify({ dc: this.dc, authKey }));
28
28
  }
29
29
  }
@@ -31,7 +31,7 @@ function serializeSingleParam(writer, value, type, ntype) {
31
31
  return;
32
32
  }
33
33
  else {
34
- throw new Error("a");
34
+ throw new TypeError(`Expected ${type.name}`);
35
35
  }
36
36
  }
37
37
  if (type == Uint8Array) {
@@ -39,7 +39,7 @@ function serializeSingleParam(writer, value, type, ntype) {
39
39
  writer.writeBytes(value);
40
40
  }
41
41
  else {
42
- throw new Error("Expected Uint8Array");
42
+ throw new TypeError("Expected Uint8Array");
43
43
  }
44
44
  }
45
45
  switch (type) {
@@ -56,7 +56,7 @@ function serializeSingleParam(writer, value, type, ntype) {
56
56
  }
57
57
  }
58
58
  else {
59
- throw new Error("Expected bigint");
59
+ throw new TypeError("Expected bigint");
60
60
  }
61
61
  break;
62
62
  case "boolean":
@@ -69,7 +69,7 @@ function serializeSingleParam(writer, value, type, ntype) {
69
69
  }
70
70
  }
71
71
  else {
72
- throw new Error("Expected boolean");
72
+ throw new TypeError("Expected boolean");
73
73
  }
74
74
  break;
75
75
  case "number":
@@ -77,7 +77,7 @@ function serializeSingleParam(writer, value, type, ntype) {
77
77
  writer.writeInt32(value);
78
78
  }
79
79
  else {
80
- throw new Error("Expected number");
80
+ throw new TypeError("Expected number");
81
81
  }
82
82
  break;
83
83
  case "string":
@@ -88,7 +88,7 @@ function serializeSingleParam(writer, value, type, ntype) {
88
88
  writer.writeBytes(value);
89
89
  }
90
90
  else {
91
- throw new Error("Expected string or Uint8Array");
91
+ throw new TypeError("Expected string or Uint8Array");
92
92
  }
93
93
  break;
94
94
  case "true":
@@ -96,7 +96,7 @@ function serializeSingleParam(writer, value, type, ntype) {
96
96
  writer.writeInt32(0x997275B5);
97
97
  }
98
98
  else {
99
- throw new Error("Expected true");
99
+ throw new TypeError("Expected true");
100
100
  }
101
101
  }
102
102
  }
@@ -134,7 +134,7 @@ class TLObject {
134
134
  if (type instanceof Array) {
135
135
  const itemsType = type[0];
136
136
  if (!Array.isArray(value)) {
137
- throw new Error("Expected array");
137
+ throw new TypeError("Expected array");
138
138
  }
139
139
  writer.writeInt32(0x1CB5C415); // vector constructor
140
140
  writer.writeInt32(value.length);