node-opcua-packet-analyzer 2.53.0 → 2.57.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.
- package/dist/source/index.js.map +1 -1
- package/dist/source/packet_analyzer/packet_analyzer.d.ts +7 -1
- package/dist/source/packet_analyzer/packet_analyzer.js +2 -6
- package/dist/source/packet_analyzer/packet_analyzer.js.map +1 -1
- package/dist/test_helpers/compare_obj_by_encoding.js.map +1 -1
- package/dist/test_helpers/encode_decode_round_trip_test.d.ts +12 -2
- package/dist/test_helpers/encode_decode_round_trip_test.js +7 -8
- package/dist/test_helpers/encode_decode_round_trip_test.js.map +1 -1
- package/package.json +11 -8
- package/source/index.ts +1 -5
- package/source/packet_analyzer/packet_analyzer.ts +28 -14
- package/test_helpers/compare_obj_by_encoding.ts +0 -1
- package/test_helpers/encode_decode_round_trip_test.ts +20 -12
package/dist/source/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/index.ts"],"names":[],"mappings":";;;AAAA,qEAA0H;AAAjH,gHAAA,aAAa,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AAAE,iIAAA,8BAA8B,OAAA"}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { BinaryStream } from "node-opcua-binary-stream";
|
|
2
3
|
import { BaseUAObject } from "node-opcua-factory";
|
|
3
4
|
interface AnalyzePacketOptions {
|
|
4
5
|
}
|
|
5
|
-
export
|
|
6
|
+
export interface ObjectMessage {
|
|
7
|
+
encode(stream: BinaryStream): void;
|
|
8
|
+
decode(stream: BinaryStream): void;
|
|
9
|
+
decodeDebug(stream: BinaryStream, options: any): void;
|
|
10
|
+
}
|
|
11
|
+
export declare function analyzePacket(buffer: Buffer, objMessage: ObjectMessage, padding: number, offset?: number, customOptions?: AnalyzePacketOptions): void;
|
|
6
12
|
export declare function analyseExtensionObject(buffer: Buffer, padding: number, offset: number, customOptions?: AnalyzePacketOptions): void;
|
|
7
13
|
export declare function analyze_object_binary_encoding(obj: BaseUAObject): void;
|
|
8
14
|
export {};
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// tslint:disable:no-bitwise
|
|
3
|
-
// tslint:disable:no-console
|
|
4
|
-
// tslint:disable:max-line-length
|
|
5
|
-
// tslint:disable:no-empty-interface
|
|
6
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
exports.analyze_object_binary_encoding = exports.analyseExtensionObject = exports.analyzePacket = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
8
5
|
const chalk = require("chalk");
|
|
9
6
|
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
10
|
-
const util_1 = require("util");
|
|
11
7
|
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
12
8
|
const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
|
|
13
9
|
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
@@ -20,7 +16,7 @@ function f(n, width) {
|
|
|
20
16
|
}
|
|
21
17
|
function display_encoding_mask(padding, encodingMask, encodingInfo) {
|
|
22
18
|
for (const v in encodingInfo) {
|
|
23
|
-
if (!
|
|
19
|
+
if (!Object.prototype.hasOwnProperty.call(encodingInfo, v)) {
|
|
24
20
|
continue;
|
|
25
21
|
}
|
|
26
22
|
const enumKey = encodingInfo[v];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packet_analyzer.js","sourceRoot":"","sources":["../../../source/packet_analyzer/packet_analyzer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packet_analyzer.js","sourceRoot":"","sources":["../../../source/packet_analyzer/packet_analyzer.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,+BAA+B;AAC/B,yDAA2C;AA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|
1
|
-
{"version":3,"file":"compare_obj_by_encoding.js","sourceRoot":"","sources":["../../test_helpers/compare_obj_by_encoding.ts"],"names":[],"mappings":";;;AAAA,uEAAwD;AAExD,iCAAiC;AACjC,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,SAAgB,uBAAuB,CAAC,IAAkB,EAAE,IAAkB;
|
|
1
|
+
{"version":3,"file":"compare_obj_by_encoding.js","sourceRoot":"","sources":["../../test_helpers/compare_obj_by_encoding.ts"],"names":[],"mappings":";;;AAAA,uEAAwD;AAExD,iCAAiC;AACjC,MAAM,OAAO,GAAG,MAAM,CAAC;AAEvB,SAAgB,uBAAuB,CAAC,IAAkB,EAAE,IAAkB;IAC1E,SAAS,OAAO,CAAC,GAAiB;QAC9B,MAAM,MAAM,GAAG,IAAI,uCAAY,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC;QACvD,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACnB,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACxC,OAAO,IAAI,CAAC;AAChB,CAAC;AARD,0DAQC"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { BinaryStream } from "node-opcua-binary-stream";
|
|
3
|
+
import { ExpandedNodeId } from "node-opcua-nodeid";
|
|
4
|
+
import { BaseUAObject } from "node-opcua-factory";
|
|
5
|
+
export interface IExtensionObject extends BaseUAObject {
|
|
6
|
+
binaryStoreSize(): number;
|
|
7
|
+
encode(stream: BinaryStream): void;
|
|
8
|
+
decode(stream: BinaryStream): void;
|
|
9
|
+
encodingDefaultBinary?: ExpandedNodeId;
|
|
10
|
+
constructor: any;
|
|
11
|
+
}
|
|
2
12
|
declare type encode_decode_round_trip_testCallback = (buffer: Buffer, encoding: any, options: any) => void;
|
|
3
13
|
/**
|
|
4
14
|
* @method encode_decode_round_trip_test
|
|
@@ -7,6 +17,6 @@ declare type encode_decode_round_trip_testCallback = (buffer: Buffer, encoding:
|
|
|
7
17
|
* @param callback_buffer
|
|
8
18
|
* @return {*}
|
|
9
19
|
*/
|
|
10
|
-
export declare function encode_decode_round_trip_test(obj:
|
|
11
|
-
export declare function json_encode_decode_round_trip_test(obj:
|
|
20
|
+
export declare function encode_decode_round_trip_test(obj: IExtensionObject, options?: unknown | encode_decode_round_trip_testCallback, callback_buffer?: encode_decode_round_trip_testCallback): any;
|
|
21
|
+
export declare function json_encode_decode_round_trip_test(obj: unknown, options: unknown, callbackBuffer?: unknown): void;
|
|
12
22
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.json_encode_decode_round_trip_test = exports.encode_decode_round_trip_test = void 0;
|
|
4
|
+
// tslint:disable:no-console
|
|
4
5
|
// @ts-check
|
|
5
6
|
const chalk = require("chalk");
|
|
6
7
|
const node_opcua_binary_stream_1 = require("node-opcua-binary-stream");
|
|
@@ -9,7 +10,6 @@ const node_opcua_factory_1 = require("node-opcua-factory");
|
|
|
9
10
|
const node_opcua_test_helpers_1 = require("node-opcua-test-helpers");
|
|
10
11
|
const should = require("should");
|
|
11
12
|
const source_1 = require("../source");
|
|
12
|
-
// tslint:disable:no-console
|
|
13
13
|
function dump_block_in_debug_mode(buffer, id, options) {
|
|
14
14
|
if (process.env.DEBUG) {
|
|
15
15
|
console.log((0, node_opcua_debug_1.hexDump)(buffer));
|
|
@@ -57,14 +57,13 @@ function redirectToNull(functor) {
|
|
|
57
57
|
const old = console.log;
|
|
58
58
|
if (!process.env.DEBUG) {
|
|
59
59
|
// tslint:disable:no-empty
|
|
60
|
-
console.log = (...args) => {
|
|
60
|
+
console.log = (...args) => {
|
|
61
|
+
/** */
|
|
62
|
+
};
|
|
61
63
|
}
|
|
62
64
|
try {
|
|
63
65
|
functor();
|
|
64
66
|
}
|
|
65
|
-
catch (err) {
|
|
66
|
-
throw err;
|
|
67
|
-
}
|
|
68
67
|
finally {
|
|
69
68
|
console.log = old;
|
|
70
69
|
}
|
|
@@ -83,15 +82,15 @@ function encode_decode_round_trip_test(obj, options, callback_buffer) {
|
|
|
83
82
|
}
|
|
84
83
|
callback_buffer = callback_buffer || dump_block_in_debug_mode;
|
|
85
84
|
should.exist(obj);
|
|
86
|
-
const size = obj.binaryStoreSize(
|
|
85
|
+
const size = obj.binaryStoreSize();
|
|
87
86
|
const stream = new node_opcua_binary_stream_1.BinaryStream(Buffer.alloc(size));
|
|
88
|
-
obj.encode(stream
|
|
87
|
+
obj.encode(stream);
|
|
89
88
|
callback_buffer(stream.buffer, obj.encodingDefaultBinary, options);
|
|
90
89
|
stream.rewind();
|
|
91
90
|
// reconstruct a object ( some object may not have a default Binary and should be recreated
|
|
92
91
|
const expandedNodeId = obj.encodingDefaultBinary;
|
|
93
92
|
const objReloaded = expandedNodeId ? (0, node_opcua_factory_1.constructObject)(expandedNodeId) : new obj.constructor();
|
|
94
|
-
objReloaded.decode(stream
|
|
93
|
+
objReloaded.decode(stream);
|
|
95
94
|
redirectToNull(() => (0, source_1.analyze_object_binary_encoding)(obj));
|
|
96
95
|
compare(objReloaded, obj);
|
|
97
96
|
return objReloaded;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"encode_decode_round_trip_test.js","sourceRoot":"","sources":["../../test_helpers/encode_decode_round_trip_test.ts"],"names":[],"mappings":";;;AAAA,YAAY;AACZ,+BAA+B;AAC/B,uEAAwD;AACxD,uDAA2C;
|
|
1
|
+
{"version":3,"file":"encode_decode_round_trip_test.js","sourceRoot":"","sources":["../../test_helpers/encode_decode_round_trip_test.ts"],"names":[],"mappings":";;;AAAA,4BAA4B;AAC5B,YAAY;AACZ,+BAA+B;AAC/B,uEAAwD;AACxD,uDAA2C;AAE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AC,GAAG,CAAC,CAAC;IAElB,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;IAEjC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAErC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAE1B,OAAO,WAAW,CAAC;AACvB,CAAC;AAhBD,gFAgBC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-packet-analyzer",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.57.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -packet-analyzer",
|
|
5
5
|
"main": "./dist/source/index.js",
|
|
6
6
|
"types": "./dist/source/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc -b",
|
|
9
|
+
"lint": "eslint source test_helpers",
|
|
10
|
+
"format": "prettier --write source test_helpers",
|
|
9
11
|
"clean": "node -e \"require('rimraf').sync('dist');\"",
|
|
10
12
|
"test": "echo no test"
|
|
11
13
|
},
|
|
@@ -13,12 +15,13 @@
|
|
|
13
15
|
"license": "MIT",
|
|
14
16
|
"dependencies": {
|
|
15
17
|
"chalk": "4.1.2",
|
|
16
|
-
"node-opcua-assert": "2.
|
|
17
|
-
"node-opcua-basic-types": "2.
|
|
18
|
-
"node-opcua-binary-stream": "2.
|
|
19
|
-
"node-opcua-debug": "2.
|
|
20
|
-
"node-opcua-factory": "2.
|
|
21
|
-
"node-opcua-
|
|
18
|
+
"node-opcua-assert": "2.55.0",
|
|
19
|
+
"node-opcua-basic-types": "2.57.0",
|
|
20
|
+
"node-opcua-binary-stream": "2.55.0",
|
|
21
|
+
"node-opcua-debug": "2.55.0",
|
|
22
|
+
"node-opcua-factory": "2.57.0",
|
|
23
|
+
"node-opcua-nodeid": "2.55.0",
|
|
24
|
+
"node-opcua-utils": "2.57.0"
|
|
22
25
|
},
|
|
23
26
|
"devDependencies": {
|
|
24
27
|
"node-opcua-test-helpers": "2.42.0",
|
|
@@ -37,5 +40,5 @@
|
|
|
37
40
|
"internet of things"
|
|
38
41
|
],
|
|
39
42
|
"homepage": "http://node-opcua.github.io/",
|
|
40
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "cb6a995ab35ea6231ffca85fbd0b624fe37119d2"
|
|
41
44
|
}
|
package/source/index.ts
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
// tslint:disable:no-console
|
|
3
|
-
// tslint:disable:max-line-length
|
|
4
|
-
// tslint:disable:no-empty-interface
|
|
5
|
-
|
|
1
|
+
import { inspect } from "util";
|
|
6
2
|
import * as chalk from "chalk";
|
|
7
3
|
import { assert } from "node-opcua-assert";
|
|
8
|
-
import { inspect } from "util";
|
|
9
4
|
|
|
10
5
|
import { decodeByte, decodeExpandedNodeId, decodeNodeId, decodeUInt32 } from "node-opcua-basic-types";
|
|
11
6
|
import { BinaryStream } from "node-opcua-binary-stream";
|
|
@@ -23,7 +18,7 @@ function f(n: number, width: number): string {
|
|
|
23
18
|
|
|
24
19
|
function display_encoding_mask(padding: string, encodingMask: any, encodingInfo: any) {
|
|
25
20
|
for (const v in encodingInfo) {
|
|
26
|
-
if (!
|
|
21
|
+
if (!Object.prototype.hasOwnProperty.call(encodingInfo, v)) {
|
|
27
22
|
continue;
|
|
28
23
|
}
|
|
29
24
|
const enumKey = encodingInfo[v];
|
|
@@ -50,7 +45,15 @@ function hex_block(start: number, end: number, buffer: Buffer) {
|
|
|
50
45
|
);
|
|
51
46
|
}
|
|
52
47
|
|
|
53
|
-
|
|
48
|
+
interface Tracer {
|
|
49
|
+
name?: string;
|
|
50
|
+
tracer: {
|
|
51
|
+
dump: (title: string, value: any) => void;
|
|
52
|
+
encoding_byte: (encodingMask: any, valueEnum: any, start: number, end: number) => void;
|
|
53
|
+
trace: (operation: any, name: any, value: any, start: number, end: number, fieldType: string) => void;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function make_tracer(buffer: Buffer, padding: number, offset?: number): Tracer {
|
|
54
57
|
padding = !padding ? 0 : padding;
|
|
55
58
|
offset = offset || 0;
|
|
56
59
|
|
|
@@ -157,18 +160,29 @@ function make_tracer(buffer: Buffer, padding: number, offset?: number) {
|
|
|
157
160
|
|
|
158
161
|
interface AnalyzePacketOptions {}
|
|
159
162
|
|
|
163
|
+
export interface ObjectMessage {
|
|
164
|
+
encode(stream: BinaryStream): void;
|
|
165
|
+
decode(stream: BinaryStream): void;
|
|
166
|
+
decodeDebug(stream: BinaryStream, options: any): void;
|
|
167
|
+
}
|
|
168
|
+
|
|
160
169
|
export function analyzePacket(
|
|
161
170
|
buffer: Buffer,
|
|
162
|
-
objMessage:
|
|
171
|
+
objMessage: ObjectMessage,
|
|
163
172
|
padding: number,
|
|
164
173
|
offset?: number,
|
|
165
174
|
customOptions?: AnalyzePacketOptions
|
|
166
|
-
) {
|
|
175
|
+
): void {
|
|
167
176
|
const stream = new BinaryStream(buffer);
|
|
168
177
|
_internalAnalyzePacket(buffer, stream, objMessage, padding, customOptions, offset);
|
|
169
178
|
}
|
|
170
179
|
|
|
171
|
-
export function analyseExtensionObject(
|
|
180
|
+
export function analyseExtensionObject(
|
|
181
|
+
buffer: Buffer,
|
|
182
|
+
padding: number,
|
|
183
|
+
offset: number,
|
|
184
|
+
customOptions?: AnalyzePacketOptions
|
|
185
|
+
): void {
|
|
172
186
|
const stream = new BinaryStream(buffer);
|
|
173
187
|
let id;
|
|
174
188
|
let objMessage;
|
|
@@ -186,12 +200,12 @@ export function analyseExtensionObject(buffer: Buffer, padding: number, offset:
|
|
|
186
200
|
function _internalAnalyzePacket(
|
|
187
201
|
buffer: Buffer,
|
|
188
202
|
stream: BinaryStream,
|
|
189
|
-
objMessage:
|
|
203
|
+
objMessage: ObjectMessage | undefined,
|
|
190
204
|
padding: number,
|
|
191
205
|
customOptions?: AnalyzePacketOptions,
|
|
192
206
|
offset?: number
|
|
193
207
|
) {
|
|
194
|
-
let options
|
|
208
|
+
let options = make_tracer(buffer, padding, offset);
|
|
195
209
|
options.name = "message";
|
|
196
210
|
if (customOptions) options = { ...options, ...customOptions };
|
|
197
211
|
try {
|
|
@@ -209,7 +223,7 @@ function _internalAnalyzePacket(
|
|
|
209
223
|
}
|
|
210
224
|
}
|
|
211
225
|
|
|
212
|
-
export function analyze_object_binary_encoding(obj: BaseUAObject) {
|
|
226
|
+
export function analyze_object_binary_encoding(obj: BaseUAObject): void {
|
|
213
227
|
assert(obj);
|
|
214
228
|
|
|
215
229
|
const size = obj.binaryStoreSize();
|
|
@@ -4,7 +4,6 @@ import * as should from "should";
|
|
|
4
4
|
const persist = should;
|
|
5
5
|
|
|
6
6
|
export function compare_obj_by_encoding(obj1: BaseUAObject, obj2: BaseUAObject): boolean {
|
|
7
|
-
|
|
8
7
|
function encoded(obj: BaseUAObject) {
|
|
9
8
|
const stream = new BinaryStream(obj.binaryStoreSize());
|
|
10
9
|
obj.encode(stream);
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
1
2
|
// @ts-check
|
|
2
3
|
import * as chalk from "chalk";
|
|
3
4
|
import { BinaryStream } from "node-opcua-binary-stream";
|
|
4
5
|
import { hexDump } from "node-opcua-debug";
|
|
5
|
-
import {
|
|
6
|
+
import { ExpandedNodeId } from "node-opcua-nodeid";
|
|
7
|
+
import { BaseUAObject, constructObject, ConstructorFuncWithSchema } from "node-opcua-factory";
|
|
6
8
|
import { assert_arrays_are_equal } from "node-opcua-test-helpers";
|
|
7
9
|
import * as should from "should";
|
|
8
10
|
|
|
9
11
|
import { analyze_object_binary_encoding, analyzePacket } from "../source";
|
|
10
|
-
// tslint:disable:no-console
|
|
11
12
|
|
|
13
|
+
export interface IExtensionObject extends BaseUAObject {
|
|
14
|
+
binaryStoreSize(): number;
|
|
15
|
+
encode(stream: BinaryStream): void;
|
|
16
|
+
decode(stream: BinaryStream): void;
|
|
17
|
+
encodingDefaultBinary?: ExpandedNodeId;
|
|
18
|
+
constructor: any;
|
|
19
|
+
}
|
|
12
20
|
function dump_block_in_debug_mode(buffer: Buffer, id: any, options: any) {
|
|
13
21
|
if (process.env.DEBUG) {
|
|
14
22
|
console.log(hexDump(buffer));
|
|
@@ -60,13 +68,13 @@ function redirectToNull(functor: () => void) {
|
|
|
60
68
|
|
|
61
69
|
if (!process.env.DEBUG) {
|
|
62
70
|
// tslint:disable:no-empty
|
|
63
|
-
console.log = (...args: any[]) => {
|
|
71
|
+
console.log = (...args: any[]) => {
|
|
72
|
+
/** */
|
|
73
|
+
};
|
|
64
74
|
}
|
|
65
75
|
|
|
66
76
|
try {
|
|
67
77
|
functor();
|
|
68
|
-
} catch (err) {
|
|
69
|
-
throw err;
|
|
70
78
|
} finally {
|
|
71
79
|
console.log = old;
|
|
72
80
|
}
|
|
@@ -82,12 +90,12 @@ type encode_decode_round_trip_testCallback = (buffer: Buffer, encoding: any, opt
|
|
|
82
90
|
* @return {*}
|
|
83
91
|
*/
|
|
84
92
|
export function encode_decode_round_trip_test(
|
|
85
|
-
obj:
|
|
86
|
-
options?:
|
|
93
|
+
obj: IExtensionObject,
|
|
94
|
+
options?: unknown | encode_decode_round_trip_testCallback,
|
|
87
95
|
callback_buffer?: encode_decode_round_trip_testCallback
|
|
88
96
|
): any {
|
|
89
97
|
if (!callback_buffer && typeof options === "function") {
|
|
90
|
-
callback_buffer = options;
|
|
98
|
+
callback_buffer = options as encode_decode_round_trip_testCallback;
|
|
91
99
|
options = {};
|
|
92
100
|
}
|
|
93
101
|
|
|
@@ -95,11 +103,11 @@ export function encode_decode_round_trip_test(
|
|
|
95
103
|
|
|
96
104
|
should.exist(obj);
|
|
97
105
|
|
|
98
|
-
const size = obj.binaryStoreSize(
|
|
106
|
+
const size = obj.binaryStoreSize();
|
|
99
107
|
|
|
100
108
|
const stream = new BinaryStream(Buffer.alloc(size));
|
|
101
109
|
|
|
102
|
-
obj.encode(stream
|
|
110
|
+
obj.encode(stream);
|
|
103
111
|
|
|
104
112
|
callback_buffer(stream.buffer, obj.encodingDefaultBinary, options);
|
|
105
113
|
|
|
@@ -109,14 +117,14 @@ export function encode_decode_round_trip_test(
|
|
|
109
117
|
const expandedNodeId = obj.encodingDefaultBinary;
|
|
110
118
|
const objReloaded = expandedNodeId ? constructObject(expandedNodeId) : new obj.constructor();
|
|
111
119
|
|
|
112
|
-
objReloaded.decode(stream
|
|
120
|
+
objReloaded.decode(stream);
|
|
113
121
|
|
|
114
122
|
redirectToNull(() => analyze_object_binary_encoding(obj));
|
|
115
123
|
compare(objReloaded, obj);
|
|
116
124
|
return objReloaded;
|
|
117
125
|
}
|
|
118
126
|
|
|
119
|
-
export function json_encode_decode_round_trip_test(obj:
|
|
127
|
+
export function json_encode_decode_round_trip_test(obj: unknown, options: unknown, callbackBuffer?: unknown): void {
|
|
120
128
|
if (!callbackBuffer && typeof options === "function") {
|
|
121
129
|
callbackBuffer = options;
|
|
122
130
|
options = {};
|