@mtkruto/node 0.7.1 → 0.7.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.
- package/esm/tl/1_utilities.d.ts +1 -1
- package/esm/tl/1_utilities.d.ts.map +1 -1
- package/esm/tl/1_utilities.js +6 -6
- package/esm/tl/2_deserialize.d.ts.map +1 -1
- package/esm/tl/2_deserialize.js +6 -4
- package/esm/tl/2_serialize.d.ts.map +1 -1
- package/esm/tl/2_serialize.js +4 -1
- package/package.json +1 -1
- package/script/tl/1_utilities.d.ts +1 -1
- package/script/tl/1_utilities.d.ts.map +1 -1
- package/script/tl/1_utilities.js +6 -5
- package/script/tl/2_deserialize.d.ts.map +1 -1
- package/script/tl/2_deserialize.js +5 -3
- package/script/tl/2_serialize.d.ts.map +1 -1
- package/script/tl/2_serialize.js +3 -0
package/esm/tl/1_utilities.d.ts
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { AnyType, Enums, Functions, Types } from "./0_api.js";
|
|
21
21
|
export declare function isOptionalParam(ntype: string): boolean;
|
|
22
|
+
export declare function getOptionalParamInnerType(ntype: string): string;
|
|
22
23
|
export declare function analyzeOptionalParam(ntype: string): {
|
|
23
24
|
flagField: string;
|
|
24
|
-
ntype: string;
|
|
25
25
|
bitIndex: number;
|
|
26
26
|
};
|
|
27
27
|
export declare function isValidType(object: any): object is AnyType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/1_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoB,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"1_utilities.d.ts","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G,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAE9F;AACD,wBAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAM/E;AAWD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEzD"}
|
package/esm/tl/1_utilities.js
CHANGED
|
@@ -18,23 +18,23 @@
|
|
|
18
18
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
19
19
|
*/
|
|
20
20
|
// deno-lint-ignore-file no-explicit-any
|
|
21
|
-
import {
|
|
21
|
+
import { assertEquals, assertFalse, unreachable } from "../0_deps.js";
|
|
22
22
|
import { getEnum, getType } from "./0_api.js";
|
|
23
23
|
export function isOptionalParam(ntype) {
|
|
24
24
|
return ntype.includes("?");
|
|
25
25
|
}
|
|
26
|
+
export function getOptionalParamInnerType(ntype) {
|
|
27
|
+
return ntype.split("?")[1];
|
|
28
|
+
}
|
|
26
29
|
export function analyzeOptionalParam(ntype) {
|
|
27
30
|
if (!isOptionalParam(ntype)) {
|
|
28
31
|
throw new Error("Parameter not optional");
|
|
29
32
|
}
|
|
30
33
|
const flagField = ntype.split(".")[0];
|
|
31
34
|
assertEquals(typeof flagField, "string");
|
|
32
|
-
const
|
|
33
|
-
const bitIndex = Number(parts[0].split(".")[1]);
|
|
35
|
+
const bitIndex = Number(ntype.split("?")[0].split(".")[1]);
|
|
34
36
|
assertFalse(isNaN(bitIndex));
|
|
35
|
-
|
|
36
|
-
assert(ntype_);
|
|
37
|
-
return { flagField, ntype: ntype_, bitIndex };
|
|
37
|
+
return { flagField, bitIndex };
|
|
38
38
|
}
|
|
39
39
|
export function isValidType(object) {
|
|
40
40
|
return object != null && typeof object === "object" && typeof object._ === "string" && getType(object._) !== undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_deserialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_deserialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAA+B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"2_deserialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_deserialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAA+B,MAAM,YAAY,CAAC;AAkDlE,wBAAgB,WAAW,CACzB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAqCT"}
|
package/esm/tl/2_deserialize.js
CHANGED
|
@@ -19,9 +19,12 @@
|
|
|
19
19
|
*/
|
|
20
20
|
// deno-lint-ignore-file no-explicit-any
|
|
21
21
|
import { assertEquals } from "../0_deps.js";
|
|
22
|
-
import { analyzeOptionalParam, isOptionalParam } from "./1_utilities.js";
|
|
22
|
+
import { analyzeOptionalParam, getOptionalParamInnerType, isOptionalParam } from "./1_utilities.js";
|
|
23
23
|
import { flags, getType, getTypeName } from "./0_api.js";
|
|
24
24
|
function deserializeSingleParam(reader, type, ntype) {
|
|
25
|
+
if (isOptionalParam(ntype)) {
|
|
26
|
+
ntype = getOptionalParamInnerType(ntype);
|
|
27
|
+
}
|
|
25
28
|
if (type == Uint8Array) {
|
|
26
29
|
return reader.readBytes();
|
|
27
30
|
}
|
|
@@ -64,10 +67,9 @@ function deserializeSingleParam(reader, type, ntype) {
|
|
|
64
67
|
export function deserialize(reader, paramDesc, name) {
|
|
65
68
|
const type_ = { _: name };
|
|
66
69
|
const flagFields = {};
|
|
67
|
-
for (
|
|
70
|
+
for (const [name, type, ntype] of paramDesc) {
|
|
68
71
|
if (isOptionalParam(ntype)) {
|
|
69
|
-
const { flagField,
|
|
70
|
-
ntype = ntype_;
|
|
72
|
+
const { flagField, bitIndex } = analyzeOptionalParam(ntype);
|
|
71
73
|
const bits = flagFields[flagField];
|
|
72
74
|
if ((bits & (1 << bitIndex)) == 0) {
|
|
73
75
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_serialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"2_serialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AA8FvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CA0DtD"}
|
package/esm/tl/2_serialize.js
CHANGED
|
@@ -20,8 +20,11 @@
|
|
|
20
20
|
// deno-lint-ignore-file no-explicit-any
|
|
21
21
|
import { flags, getType } from "./0_api.js";
|
|
22
22
|
import { TLRawWriter } from "./0_tl_raw_writer.js";
|
|
23
|
-
import { analyzeOptionalParam, assertIsValidType, isOptionalParam } from "./1_utilities.js";
|
|
23
|
+
import { analyzeOptionalParam, assertIsValidType, getOptionalParamInnerType, isOptionalParam } from "./1_utilities.js";
|
|
24
24
|
function serializeSingleParam(writer, value, type, ntype, debugInfo) {
|
|
25
|
+
if (isOptionalParam(ntype)) {
|
|
26
|
+
ntype = getOptionalParamInnerType(ntype);
|
|
27
|
+
}
|
|
25
28
|
const valueRepr = value == null ? null : (typeof value === "object" && "_" in value) ? value._ : value.constructor.name;
|
|
26
29
|
if (type == Uint8Array) {
|
|
27
30
|
if ((value instanceof Uint8Array)) {
|
package/package.json
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { AnyType, Enums, Functions, Types } from "./0_api.js";
|
|
21
21
|
export declare function isOptionalParam(ntype: string): boolean;
|
|
22
|
+
export declare function getOptionalParamInnerType(ntype: string): string;
|
|
22
23
|
export declare function analyzeOptionalParam(ntype: string): {
|
|
23
24
|
flagField: string;
|
|
24
|
-
ntype: string;
|
|
25
25
|
bitIndex: number;
|
|
26
26
|
};
|
|
27
27
|
export declare function isValidType(object: any): object is AnyType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"1_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/1_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoB,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"1_utilities.d.ts","sourceRoot":"","sources":["../../src/tl/1_utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAoB,KAAK,EAAE,MAAM,YAAY,CAAC;AAEhF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEtD;AACD,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D;AACD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAY3F;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,OAAO,CAE1D;AACD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,QAI5C;AAED,wBAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,SAAS,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAMjL;AACD,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,CAAC,SAAS,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAExM;AACD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAE9F;AACD,wBAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAM/E;AAWD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEzD"}
|
package/script/tl/1_utilities.js
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
// deno-lint-ignore-file no-explicit-any
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.isOptionalParam = isOptionalParam;
|
|
24
|
+
exports.getOptionalParamInnerType = getOptionalParamInnerType;
|
|
24
25
|
exports.analyzeOptionalParam = analyzeOptionalParam;
|
|
25
26
|
exports.isValidType = isValidType;
|
|
26
27
|
exports.assertIsValidType = assertIsValidType;
|
|
@@ -34,18 +35,18 @@ const _0_api_js_1 = require("./0_api.js");
|
|
|
34
35
|
function isOptionalParam(ntype) {
|
|
35
36
|
return ntype.includes("?");
|
|
36
37
|
}
|
|
38
|
+
function getOptionalParamInnerType(ntype) {
|
|
39
|
+
return ntype.split("?")[1];
|
|
40
|
+
}
|
|
37
41
|
function analyzeOptionalParam(ntype) {
|
|
38
42
|
if (!isOptionalParam(ntype)) {
|
|
39
43
|
throw new Error("Parameter not optional");
|
|
40
44
|
}
|
|
41
45
|
const flagField = ntype.split(".")[0];
|
|
42
46
|
(0, _0_deps_js_1.assertEquals)(typeof flagField, "string");
|
|
43
|
-
const
|
|
44
|
-
const bitIndex = Number(parts[0].split(".")[1]);
|
|
47
|
+
const bitIndex = Number(ntype.split("?")[0].split(".")[1]);
|
|
45
48
|
(0, _0_deps_js_1.assertFalse)(isNaN(bitIndex));
|
|
46
|
-
|
|
47
|
-
(0, _0_deps_js_1.assert)(ntype_);
|
|
48
|
-
return { flagField, ntype: ntype_, bitIndex };
|
|
49
|
+
return { flagField, bitIndex };
|
|
49
50
|
}
|
|
50
51
|
function isValidType(object) {
|
|
51
52
|
return object != null && typeof object === "object" && typeof object._ === "string" && (0, _0_api_js_1.getType)(object._) !== undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_deserialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_deserialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAA+B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"2_deserialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_deserialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,OAAO,EAA+B,MAAM,YAAY,CAAC;AAkDlE,wBAAgB,WAAW,CACzB,MAAM,EAAE,WAAW,EACnB,SAAS,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,EACtC,IAAI,EAAE,MAAM,GACX,OAAO,CAqCT"}
|
|
@@ -25,6 +25,9 @@ const _0_deps_js_1 = require("../0_deps.js");
|
|
|
25
25
|
const _1_utilities_js_1 = require("./1_utilities.js");
|
|
26
26
|
const _0_api_js_1 = require("./0_api.js");
|
|
27
27
|
function deserializeSingleParam(reader, type, ntype) {
|
|
28
|
+
if ((0, _1_utilities_js_1.isOptionalParam)(ntype)) {
|
|
29
|
+
ntype = (0, _1_utilities_js_1.getOptionalParamInnerType)(ntype);
|
|
30
|
+
}
|
|
28
31
|
if (type == Uint8Array) {
|
|
29
32
|
return reader.readBytes();
|
|
30
33
|
}
|
|
@@ -67,10 +70,9 @@ function deserializeSingleParam(reader, type, ntype) {
|
|
|
67
70
|
function deserialize(reader, paramDesc, name) {
|
|
68
71
|
const type_ = { _: name };
|
|
69
72
|
const flagFields = {};
|
|
70
|
-
for (
|
|
73
|
+
for (const [name, type, ntype] of paramDesc) {
|
|
71
74
|
if ((0, _1_utilities_js_1.isOptionalParam)(ntype)) {
|
|
72
|
-
const { flagField,
|
|
73
|
-
ntype = ntype_;
|
|
75
|
+
const { flagField, bitIndex } = (0, _1_utilities_js_1.analyzeOptionalParam)(ntype);
|
|
74
76
|
const bits = flagFields[flagField];
|
|
75
77
|
if ((bits & (1 << bitIndex)) == 0) {
|
|
76
78
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"2_serialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"2_serialize.d.ts","sourceRoot":"","sources":["../../src/tl/2_serialize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,SAAS,EAAkB,MAAM,YAAY,CAAC;AA8FvD,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CA0DtD"}
|
package/script/tl/2_serialize.js
CHANGED
|
@@ -25,6 +25,9 @@ const _0_api_js_1 = require("./0_api.js");
|
|
|
25
25
|
const _0_tl_raw_writer_js_1 = require("./0_tl_raw_writer.js");
|
|
26
26
|
const _1_utilities_js_1 = require("./1_utilities.js");
|
|
27
27
|
function serializeSingleParam(writer, value, type, ntype, debugInfo) {
|
|
28
|
+
if ((0, _1_utilities_js_1.isOptionalParam)(ntype)) {
|
|
29
|
+
ntype = (0, _1_utilities_js_1.getOptionalParamInnerType)(ntype);
|
|
30
|
+
}
|
|
28
31
|
const valueRepr = value == null ? null : (typeof value === "object" && "_" in value) ? value._ : value.constructor.name;
|
|
29
32
|
if (type == Uint8Array) {
|
|
30
33
|
if ((value instanceof Uint8Array)) {
|