node-opcua-extension-object 2.76.0 → 2.76.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/dist/extension_object.d.ts +16 -16
- package/dist/extension_object.js +180 -180
- package/dist/index.d.ts +4 -4
- package/dist/index.js +20 -20
- package/package.json +7 -7
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
3
|
-
import { BaseUAObject, IStructuredTypeSchema } from "node-opcua-factory";
|
|
4
|
-
import { NodeId } from "node-opcua-nodeid";
|
|
5
|
-
export declare class ExtensionObject extends BaseUAObject {
|
|
6
|
-
static schema: IStructuredTypeSchema;
|
|
7
|
-
constructor(options?: null | Record<string, any>);
|
|
8
|
-
}
|
|
9
|
-
export declare function encodeExtensionObject(object: BaseUAObject | null, stream: OutputBinaryStream): void;
|
|
10
|
-
export declare class OpaqueStructure extends ExtensionObject {
|
|
11
|
-
nodeId: NodeId;
|
|
12
|
-
buffer: Buffer;
|
|
13
|
-
constructor(nodeId: NodeId, buffer: Buffer);
|
|
14
|
-
toString(): string;
|
|
15
|
-
}
|
|
16
|
-
export declare function decodeExtensionObject(stream: BinaryStream, _value?: ExtensionObject | null): ExtensionObject | null;
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
3
|
+
import { BaseUAObject, IStructuredTypeSchema } from "node-opcua-factory";
|
|
4
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
5
|
+
export declare class ExtensionObject extends BaseUAObject {
|
|
6
|
+
static schema: IStructuredTypeSchema;
|
|
7
|
+
constructor(options?: null | Record<string, any>);
|
|
8
|
+
}
|
|
9
|
+
export declare function encodeExtensionObject(object: BaseUAObject | null, stream: OutputBinaryStream): void;
|
|
10
|
+
export declare class OpaqueStructure extends ExtensionObject {
|
|
11
|
+
nodeId: NodeId;
|
|
12
|
+
buffer: Buffer;
|
|
13
|
+
constructor(nodeId: NodeId, buffer: Buffer);
|
|
14
|
+
toString(): string;
|
|
15
|
+
}
|
|
16
|
+
export declare function decodeExtensionObject(stream: BinaryStream, _value?: ExtensionObject | null): ExtensionObject | null;
|
package/dist/extension_object.js
CHANGED
|
@@ -1,181 +1,181 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decodeExtensionObject = exports.OpaqueStructure = exports.encodeExtensionObject = exports.ExtensionObject = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @module node-opcua-extension-object
|
|
6
|
-
*/
|
|
7
|
-
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
9
|
-
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
10
|
-
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
11
|
-
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
12
|
-
const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
|
|
13
|
-
const chalk = require("chalk");
|
|
14
|
-
/* tslint:disable:no-empty */
|
|
15
|
-
class ExtensionObject extends node_opcua_factory_1.BaseUAObject {
|
|
16
|
-
constructor(options) {
|
|
17
|
-
super();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.ExtensionObject = ExtensionObject;
|
|
21
|
-
ExtensionObject.schema = new node_opcua_factory_1.StructuredTypeSchema({
|
|
22
|
-
baseType: "",
|
|
23
|
-
documentation: "",
|
|
24
|
-
fields: [],
|
|
25
|
-
name: "ExtensionObject"
|
|
26
|
-
});
|
|
27
|
-
ExtensionObject.prototype.schema = ExtensionObject.schema;
|
|
28
|
-
function constructEmptyExtensionObject(expandedNodeId) {
|
|
29
|
-
return (0, node_opcua_factory_1.constructObject)(expandedNodeId);
|
|
30
|
-
}
|
|
31
|
-
// OPC-UA Part 6 - $5.2.2.15 ExtensionObject
|
|
32
|
-
// An ExtensionObject is encoded as sequence of bytes prefixed by the NodeId of its
|
|
33
|
-
// DataTypeEncoding and the number of bytes encoded.
|
|
34
|
-
// what the specs say: OCC/UA part 6 $5.2.2.15 ExtensionObject
|
|
35
|
-
//
|
|
36
|
-
// TypeId | NodeId | The identifier for the DataTypeEncoding node in the Server's AddressSpace.
|
|
37
|
-
// | ExtensionObjects defined by the OPC UA specification have a numeric node
|
|
38
|
-
// | identifier assigned to them with a NamespaceIndex of 0. The numeric
|
|
39
|
-
// | identifiers are defined in A.1.
|
|
40
|
-
//
|
|
41
|
-
// Encoding | Byte | An enumeration that indicates how the body is encoded.
|
|
42
|
-
// | The parameter may have the following values:
|
|
43
|
-
// | 0x00 No body is encoded.
|
|
44
|
-
// | 0x01 The body is encoded as a ByteString.
|
|
45
|
-
// | 0x02 The body is encoded as a XmlElement.
|
|
46
|
-
//
|
|
47
|
-
// Length | Int32 | The length of the object body.
|
|
48
|
-
// | The length shall be specified if the body is encoded. <<<<<<<( WTF ?)
|
|
49
|
-
//
|
|
50
|
-
// Body | Byte[*] | The object body
|
|
51
|
-
// | This field contains the raw bytes for ByteString bodies.
|
|
52
|
-
// | For XmlElement bodies this field contains the XML encoded as a UTF-8
|
|
53
|
-
// | string without any null terminator.
|
|
54
|
-
//
|
|
55
|
-
function encodeExtensionObject(object, stream) {
|
|
56
|
-
if (!object) {
|
|
57
|
-
(0, node_opcua_basic_types_1.encodeNodeId)((0, node_opcua_nodeid_1.makeNodeId)(0), stream);
|
|
58
|
-
stream.writeUInt8(0x00); // no body is encoded
|
|
59
|
-
// note : Length shall not hbe specified, end of the job!
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
if (object instanceof OpaqueStructure) {
|
|
63
|
-
// Writing raw Opaque buffer as Opaque Structure ...
|
|
64
|
-
(0, node_opcua_basic_types_1.encodeNodeId)(object.nodeId, stream);
|
|
65
|
-
stream.writeUInt8(0x01); // 0x01 The body is encoded as a ByteString.
|
|
66
|
-
stream.writeByteStream(object.buffer);
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
/* istanbul ignore next */
|
|
70
|
-
if (!(object instanceof node_opcua_factory_1.BaseUAObject)) {
|
|
71
|
-
throw new Error("Expecting a extension object");
|
|
72
|
-
}
|
|
73
|
-
// ensure we have a valid encoding Default Binary ID !!!
|
|
74
|
-
/* istanbul ignore next */
|
|
75
|
-
if (!object.schema) {
|
|
76
|
-
debugLog(" object = ", object);
|
|
77
|
-
throw new Error("object has no schema " + object.constructor.name);
|
|
78
|
-
}
|
|
79
|
-
const encodingDefaultBinary = object.schema.encodingDefaultBinary;
|
|
80
|
-
/* istanbul ignore next */
|
|
81
|
-
if (!encodingDefaultBinary) {
|
|
82
|
-
debugLog(chalk.yellow("encoding ExtObj "), object);
|
|
83
|
-
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
84
|
-
}
|
|
85
|
-
/* istanbul ignore next */
|
|
86
|
-
if (encodingDefaultBinary.isEmpty()) {
|
|
87
|
-
debugLog(chalk.yellow("encoding ExtObj "), object.constructor.encodingDefaultBinary.toString());
|
|
88
|
-
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
89
|
-
}
|
|
90
|
-
/* istanbul ignore next */
|
|
91
|
-
if ((0, node_opcua_factory_1.is_internal_id)(encodingDefaultBinary.value)) {
|
|
92
|
-
debugLog(chalk.yellow("encoding ExtObj "), object.constructor.encodingDefaultBinary.toString(), object.schema.name);
|
|
93
|
-
throw new Error("Cannot find valid OPCUA encodingDefaultBinary for this object : " + object.schema.name);
|
|
94
|
-
}
|
|
95
|
-
(0, node_opcua_basic_types_1.encodeNodeId)(encodingDefaultBinary, stream);
|
|
96
|
-
stream.writeUInt8(0x01); // 0x01 The body is encoded as a ByteString.
|
|
97
|
-
stream.writeUInt32(object.binaryStoreSize());
|
|
98
|
-
object.encode(stream);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.encodeExtensionObject = encodeExtensionObject;
|
|
102
|
-
// tslint:disable:max-classes-per-file
|
|
103
|
-
class OpaqueStructure extends ExtensionObject {
|
|
104
|
-
constructor(nodeId, buffer) {
|
|
105
|
-
super();
|
|
106
|
-
this.nodeId = nodeId;
|
|
107
|
-
this.buffer = buffer;
|
|
108
|
-
}
|
|
109
|
-
toString() {
|
|
110
|
-
const str = "/* OpaqueStructure */ { \n" +
|
|
111
|
-
"nodeId " +
|
|
112
|
-
this.nodeId.toString() +
|
|
113
|
-
"\n" +
|
|
114
|
-
"buffer = \n" +
|
|
115
|
-
(0, node_opcua_debug_1.hexDump)(this.buffer) +
|
|
116
|
-
"\n" +
|
|
117
|
-
"}";
|
|
118
|
-
return str;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.OpaqueStructure = OpaqueStructure;
|
|
122
|
-
function decodeExtensionObject(stream, _value) {
|
|
123
|
-
const nodeId = (0, node_opcua_basic_types_1.decodeNodeId)(stream);
|
|
124
|
-
const encodingType = stream.readUInt8();
|
|
125
|
-
if (encodingType === 0) {
|
|
126
|
-
return null;
|
|
127
|
-
}
|
|
128
|
-
const length = stream.readUInt32();
|
|
129
|
-
/* istanbul ignore next */
|
|
130
|
-
if (nodeId.value === 0 || encodingType === 0) {
|
|
131
|
-
return {};
|
|
132
|
-
}
|
|
133
|
-
// let verify that decode will use the expected number of bytes
|
|
134
|
-
const streamLengthBefore = stream.length;
|
|
135
|
-
let object;
|
|
136
|
-
if (nodeId.namespace !== 0) {
|
|
137
|
-
// this is a extension object define in a other namespace
|
|
138
|
-
// we can only threat it as an opaque object for the time being
|
|
139
|
-
// the caller that may now more about the namespace Array and type
|
|
140
|
-
// definition will be able to turn the opaque object into a meaningful
|
|
141
|
-
// structure
|
|
142
|
-
// lets rewind before the length
|
|
143
|
-
stream.length -= 4;
|
|
144
|
-
object = new OpaqueStructure(nodeId, stream.readByteStream());
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
object = constructEmptyExtensionObject(nodeId);
|
|
148
|
-
/* istanbul ignore next */
|
|
149
|
-
if (object === null) {
|
|
150
|
-
// this object is unknown to us ..
|
|
151
|
-
stream.length += length;
|
|
152
|
-
object = {};
|
|
153
|
-
}
|
|
154
|
-
else {
|
|
155
|
-
try {
|
|
156
|
-
object.decode(stream);
|
|
157
|
-
}
|
|
158
|
-
catch (err) {
|
|
159
|
-
debugLog("Cannot decode object ", err);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
if (streamLengthBefore + length !== stream.length) {
|
|
164
|
-
// this may happen if the server or client do have a different OPCUA version
|
|
165
|
-
// for instance SubscriptionDiagnostics structure has been changed between OPCUA version 1.01 and 1.04
|
|
166
|
-
// causing 2 extra member to be added.
|
|
167
|
-
debugLog(chalk.bgWhiteBright.red("========================================="));
|
|
168
|
-
warningLog("WARNING => decodeExtensionObject: Extension object decoding error on ", object.constructor.name, " expected size was", length, "but only this amount of bytes have been read :", stream.length - streamLengthBefore, "\n encoding nodeId = ", nodeId.toString(), "encodingType = ", encodingType);
|
|
169
|
-
stream.length = streamLengthBefore + length;
|
|
170
|
-
}
|
|
171
|
-
return object;
|
|
172
|
-
}
|
|
173
|
-
exports.decodeExtensionObject = decodeExtensionObject;
|
|
174
|
-
(0, node_opcua_factory_1.registerBuiltInType)({
|
|
175
|
-
name: "ExtensionObject",
|
|
176
|
-
subType: "",
|
|
177
|
-
encode: encodeExtensionObject,
|
|
178
|
-
decode: decodeExtensionObject,
|
|
179
|
-
defaultValue: () => null
|
|
180
|
-
});
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeExtensionObject = exports.OpaqueStructure = exports.encodeExtensionObject = exports.ExtensionObject = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-extension-object
|
|
6
|
+
*/
|
|
7
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
8
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
9
|
+
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
10
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
11
|
+
const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename);
|
|
12
|
+
const warningLog = (0, node_opcua_debug_1.make_warningLog)(__filename);
|
|
13
|
+
const chalk = require("chalk");
|
|
14
|
+
/* tslint:disable:no-empty */
|
|
15
|
+
class ExtensionObject extends node_opcua_factory_1.BaseUAObject {
|
|
16
|
+
constructor(options) {
|
|
17
|
+
super();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ExtensionObject = ExtensionObject;
|
|
21
|
+
ExtensionObject.schema = new node_opcua_factory_1.StructuredTypeSchema({
|
|
22
|
+
baseType: "",
|
|
23
|
+
documentation: "",
|
|
24
|
+
fields: [],
|
|
25
|
+
name: "ExtensionObject"
|
|
26
|
+
});
|
|
27
|
+
ExtensionObject.prototype.schema = ExtensionObject.schema;
|
|
28
|
+
function constructEmptyExtensionObject(expandedNodeId) {
|
|
29
|
+
return (0, node_opcua_factory_1.constructObject)(expandedNodeId);
|
|
30
|
+
}
|
|
31
|
+
// OPC-UA Part 6 - $5.2.2.15 ExtensionObject
|
|
32
|
+
// An ExtensionObject is encoded as sequence of bytes prefixed by the NodeId of its
|
|
33
|
+
// DataTypeEncoding and the number of bytes encoded.
|
|
34
|
+
// what the specs say: OCC/UA part 6 $5.2.2.15 ExtensionObject
|
|
35
|
+
//
|
|
36
|
+
// TypeId | NodeId | The identifier for the DataTypeEncoding node in the Server's AddressSpace.
|
|
37
|
+
// | ExtensionObjects defined by the OPC UA specification have a numeric node
|
|
38
|
+
// | identifier assigned to them with a NamespaceIndex of 0. The numeric
|
|
39
|
+
// | identifiers are defined in A.1.
|
|
40
|
+
//
|
|
41
|
+
// Encoding | Byte | An enumeration that indicates how the body is encoded.
|
|
42
|
+
// | The parameter may have the following values:
|
|
43
|
+
// | 0x00 No body is encoded.
|
|
44
|
+
// | 0x01 The body is encoded as a ByteString.
|
|
45
|
+
// | 0x02 The body is encoded as a XmlElement.
|
|
46
|
+
//
|
|
47
|
+
// Length | Int32 | The length of the object body.
|
|
48
|
+
// | The length shall be specified if the body is encoded. <<<<<<<( WTF ?)
|
|
49
|
+
//
|
|
50
|
+
// Body | Byte[*] | The object body
|
|
51
|
+
// | This field contains the raw bytes for ByteString bodies.
|
|
52
|
+
// | For XmlElement bodies this field contains the XML encoded as a UTF-8
|
|
53
|
+
// | string without any null terminator.
|
|
54
|
+
//
|
|
55
|
+
function encodeExtensionObject(object, stream) {
|
|
56
|
+
if (!object) {
|
|
57
|
+
(0, node_opcua_basic_types_1.encodeNodeId)((0, node_opcua_nodeid_1.makeNodeId)(0), stream);
|
|
58
|
+
stream.writeUInt8(0x00); // no body is encoded
|
|
59
|
+
// note : Length shall not hbe specified, end of the job!
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (object instanceof OpaqueStructure) {
|
|
63
|
+
// Writing raw Opaque buffer as Opaque Structure ...
|
|
64
|
+
(0, node_opcua_basic_types_1.encodeNodeId)(object.nodeId, stream);
|
|
65
|
+
stream.writeUInt8(0x01); // 0x01 The body is encoded as a ByteString.
|
|
66
|
+
stream.writeByteStream(object.buffer);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
/* istanbul ignore next */
|
|
70
|
+
if (!(object instanceof node_opcua_factory_1.BaseUAObject)) {
|
|
71
|
+
throw new Error("Expecting a extension object");
|
|
72
|
+
}
|
|
73
|
+
// ensure we have a valid encoding Default Binary ID !!!
|
|
74
|
+
/* istanbul ignore next */
|
|
75
|
+
if (!object.schema) {
|
|
76
|
+
debugLog(" object = ", object);
|
|
77
|
+
throw new Error("object has no schema " + object.constructor.name);
|
|
78
|
+
}
|
|
79
|
+
const encodingDefaultBinary = object.schema.encodingDefaultBinary;
|
|
80
|
+
/* istanbul ignore next */
|
|
81
|
+
if (!encodingDefaultBinary) {
|
|
82
|
+
debugLog(chalk.yellow("encoding ExtObj "), object);
|
|
83
|
+
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
84
|
+
}
|
|
85
|
+
/* istanbul ignore next */
|
|
86
|
+
if (encodingDefaultBinary.isEmpty()) {
|
|
87
|
+
debugLog(chalk.yellow("encoding ExtObj "), object.constructor.encodingDefaultBinary.toString());
|
|
88
|
+
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
89
|
+
}
|
|
90
|
+
/* istanbul ignore next */
|
|
91
|
+
if ((0, node_opcua_factory_1.is_internal_id)(encodingDefaultBinary.value)) {
|
|
92
|
+
debugLog(chalk.yellow("encoding ExtObj "), object.constructor.encodingDefaultBinary.toString(), object.schema.name);
|
|
93
|
+
throw new Error("Cannot find valid OPCUA encodingDefaultBinary for this object : " + object.schema.name);
|
|
94
|
+
}
|
|
95
|
+
(0, node_opcua_basic_types_1.encodeNodeId)(encodingDefaultBinary, stream);
|
|
96
|
+
stream.writeUInt8(0x01); // 0x01 The body is encoded as a ByteString.
|
|
97
|
+
stream.writeUInt32(object.binaryStoreSize());
|
|
98
|
+
object.encode(stream);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.encodeExtensionObject = encodeExtensionObject;
|
|
102
|
+
// tslint:disable:max-classes-per-file
|
|
103
|
+
class OpaqueStructure extends ExtensionObject {
|
|
104
|
+
constructor(nodeId, buffer) {
|
|
105
|
+
super();
|
|
106
|
+
this.nodeId = nodeId;
|
|
107
|
+
this.buffer = buffer;
|
|
108
|
+
}
|
|
109
|
+
toString() {
|
|
110
|
+
const str = "/* OpaqueStructure */ { \n" +
|
|
111
|
+
"nodeId " +
|
|
112
|
+
this.nodeId.toString() +
|
|
113
|
+
"\n" +
|
|
114
|
+
"buffer = \n" +
|
|
115
|
+
(0, node_opcua_debug_1.hexDump)(this.buffer) +
|
|
116
|
+
"\n" +
|
|
117
|
+
"}";
|
|
118
|
+
return str;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.OpaqueStructure = OpaqueStructure;
|
|
122
|
+
function decodeExtensionObject(stream, _value) {
|
|
123
|
+
const nodeId = (0, node_opcua_basic_types_1.decodeNodeId)(stream);
|
|
124
|
+
const encodingType = stream.readUInt8();
|
|
125
|
+
if (encodingType === 0) {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
const length = stream.readUInt32();
|
|
129
|
+
/* istanbul ignore next */
|
|
130
|
+
if (nodeId.value === 0 || encodingType === 0) {
|
|
131
|
+
return {};
|
|
132
|
+
}
|
|
133
|
+
// let verify that decode will use the expected number of bytes
|
|
134
|
+
const streamLengthBefore = stream.length;
|
|
135
|
+
let object;
|
|
136
|
+
if (nodeId.namespace !== 0) {
|
|
137
|
+
// this is a extension object define in a other namespace
|
|
138
|
+
// we can only threat it as an opaque object for the time being
|
|
139
|
+
// the caller that may now more about the namespace Array and type
|
|
140
|
+
// definition will be able to turn the opaque object into a meaningful
|
|
141
|
+
// structure
|
|
142
|
+
// lets rewind before the length
|
|
143
|
+
stream.length -= 4;
|
|
144
|
+
object = new OpaqueStructure(nodeId, stream.readByteStream());
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
object = constructEmptyExtensionObject(nodeId);
|
|
148
|
+
/* istanbul ignore next */
|
|
149
|
+
if (object === null) {
|
|
150
|
+
// this object is unknown to us ..
|
|
151
|
+
stream.length += length;
|
|
152
|
+
object = {};
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
try {
|
|
156
|
+
object.decode(stream);
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
debugLog("Cannot decode object ", err);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (streamLengthBefore + length !== stream.length) {
|
|
164
|
+
// this may happen if the server or client do have a different OPCUA version
|
|
165
|
+
// for instance SubscriptionDiagnostics structure has been changed between OPCUA version 1.01 and 1.04
|
|
166
|
+
// causing 2 extra member to be added.
|
|
167
|
+
debugLog(chalk.bgWhiteBright.red("========================================="));
|
|
168
|
+
warningLog("WARNING => decodeExtensionObject: Extension object decoding error on ", object.constructor.name, " expected size was", length, "but only this amount of bytes have been read :", stream.length - streamLengthBefore, "\n encoding nodeId = ", nodeId.toString(), "encodingType = ", encodingType);
|
|
169
|
+
stream.length = streamLengthBefore + length;
|
|
170
|
+
}
|
|
171
|
+
return object;
|
|
172
|
+
}
|
|
173
|
+
exports.decodeExtensionObject = decodeExtensionObject;
|
|
174
|
+
(0, node_opcua_factory_1.registerBuiltInType)({
|
|
175
|
+
name: "ExtensionObject",
|
|
176
|
+
subType: "",
|
|
177
|
+
encode: encodeExtensionObject,
|
|
178
|
+
decode: decodeExtensionObject,
|
|
179
|
+
defaultValue: () => null
|
|
180
|
+
});
|
|
181
181
|
//# sourceMappingURL=extension_object.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-extension-object
|
|
3
|
-
*/
|
|
4
|
-
export * from "./extension_object";
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-extension-object
|
|
3
|
+
*/
|
|
4
|
+
export * from "./extension_object";
|
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
/**
|
|
18
|
-
* @module node-opcua-extension-object
|
|
19
|
-
*/
|
|
20
|
-
__exportStar(require("./extension_object"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* @module node-opcua-extension-object
|
|
19
|
+
*/
|
|
20
|
+
__exportStar(require("./extension_object"), exports);
|
|
21
21
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-extension-object",
|
|
3
|
-
"version": "2.76.
|
|
3
|
+
"version": "2.76.2",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -extension-object",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"chalk": "4.1.2",
|
|
16
|
-
"node-opcua-basic-types": "2.76.
|
|
17
|
-
"node-opcua-binary-stream": "2.76.
|
|
18
|
-
"node-opcua-debug": "2.76.
|
|
19
|
-
"node-opcua-factory": "2.76.
|
|
20
|
-
"node-opcua-nodeid": "2.76.
|
|
16
|
+
"node-opcua-basic-types": "2.76.2",
|
|
17
|
+
"node-opcua-binary-stream": "2.76.2",
|
|
18
|
+
"node-opcua-debug": "2.76.2",
|
|
19
|
+
"node-opcua-factory": "2.76.2",
|
|
20
|
+
"node-opcua-nodeid": "2.76.2"
|
|
21
21
|
},
|
|
22
22
|
"author": "Etienne Rossignon",
|
|
23
23
|
"license": "MIT",
|
|
@@ -34,5 +34,5 @@
|
|
|
34
34
|
"internet of things"
|
|
35
35
|
],
|
|
36
36
|
"homepage": "http://node-opcua.github.io/",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "acb5ecaf1e1c71af3b63e80909d58447f3f298e7"
|
|
38
38
|
}
|