node-opcua-extension-object 2.73.1 → 2.76.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/LICENSE CHANGED
@@ -1,6 +1,8 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014-2021 Etienne Rossignon
3
+ Copyright (c) 2022 Sterfive SAS - 833264583 RCS ORLEANS - France (https://www.sterfive.com)
4
+
5
+ Copyright (c) 2014-2022 Etienne Rossignon
4
6
 
5
7
  Permission is hereby granted, free of charge, to any person obtaining a copy of
6
8
  this software and associated documentation files (the "Software"), to deal in
@@ -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;
@@ -1,182 +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
- // tslint:disable-next-line:no-console
169
- warningLog("WARNING => Extension object decoding error on ", object.constructor.name, " expected size was", length, "but only this amount of bytes have been read :", stream.length - streamLengthBefore);
170
- stream.length = streamLengthBefore + length;
171
- }
172
- return object;
173
- }
174
- exports.decodeExtensionObject = decodeExtensionObject;
175
- (0, node_opcua_factory_1.registerBuiltInType)({
176
- name: "ExtensionObject",
177
- subType: "",
178
- encode: encodeExtensionObject,
179
- decode: decodeExtensionObject,
180
- defaultValue: () => null
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
+ });
182
181
  //# sourceMappingURL=extension_object.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"extension_object.js","sourceRoot":"","sources":["../source/extension_object.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mEAAoE;AAEpE,uDAA2F;AAC3F,2DAAqJ;AACrJ,yDAAuE;AAEvE,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,UAAU,CAAC,CAAC;AAE/C,+BAA+B;AAE/B,6BAA6B;AAC7B,MAAa,eAAgB,SAAQ,iCAAY;IAQ7C,YAAY,OAAoC;QAC5C,KAAK,EAAE,CAAC;IACZ,CAAC;;AAVL,0CAWC;AAViB,sBAAM,GAA0B,IAAI,yCAAoB,CAAC;IACnE,QAAQ,EAAE,EAAE;IACZ,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,EAAE;IACV,IAAI,EAAE,iBAAiB;CAC1B,CAAC,CAAC;AAOP,eAAe,CAAC,SAAS,CAAC,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC;AAE1D,SAAS,6BAA6B,CAAC,cAAsB;IACzD,OAAO,IAAA,oCAAe,EAAC,cAAgC,CAAoB,CAAC;AAChF,CAAC;AAED,4CAA4C;AAC5C,oFAAoF;AACpF,oDAAoD;AAEpD,+DAA+D;AAC/D,EAAE;AACF,mGAAmG;AACnG,iGAAiG;AACjG,4FAA4F;AAC5F,wDAAwD;AACxD,EAAE;AACF,+EAA+E;AAC/E,qEAAqE;AACrE,sDAAsD;AACtD,uEAAuE;AACvE,uEAAuE;AACvE,EAAE;AACF,uDAAuD;AACvD,kGAAkG;AAClG,EAAE;AACF,wCAAwC;AACxC,iFAAiF;AACjF,6FAA6F;AAC7F,4DAA4D;AAC5D,EAAE;AAEF,SAAgB,qBAAqB,CAAC,MAA2B,EAAE,MAA0B;IACzF,IAAI,CAAC,MAAM,EAAE;QACT,IAAA,qCAAY,EAAC,I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B,MAAM,GAAG,EAAqB,CAAC;SAClC;aAAM;YACH,IAAI;gBACA,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;aACzB;YAAC,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,uBAAuB,EAAE,GAAG,CAAC,CAAC;aAC1C;SACJ;KACJ;IAED,IAAI,kBAAkB,GAAG,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE;QAC/C,4EAA4E;QAC5E,sGAAsG;QACtG,sCAAsC;QACtC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,2CAA2C,CAAC,CAAC,CAAC;QAE/E,UAAU,CACN,uEAAuE,EACvE,MAAM,CAAC,WAAW,CAAC,IAAI,EACvB,oBAAoB,EACpB,MAAM,EACN,gDAAgD,EAChD,MAAM,CAAC,MAAM,GAAG,kBAAkB,EAClC,iCAAiC,EACjC,MAAM,CAAC,QAAQ,EAAE,EACjB,iBAAiB,EACjB,YAAY,CACf,CAAC;QACF,MAAM,CAAC,MAAM,GAAG,kBAAkB,GAAG,MAAM,CAAC;KAC/C;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAjED,sDAiEC;AAED,IAAA,wCAAmB,EAAC;IAChB,IAAI,EAAE,iBAAiB;IACvB,OAAO,EAAE,EAAE;IAEX,MAAM,EAAE,qBAAqB;IAE7B,MAAM,EAAE,qBAAqB;IAE7B,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI;CAC3B,CAAC,CAAC"}
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.73.1",
3
+ "version": "2.76.0",
4
4
  "description": "pure nodejs OPCUA SDK - module -extension-object",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -13,12 +13,11 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "chalk": "4.1.2",
16
- "node-opcua-assert": "2.66.0",
17
- "node-opcua-basic-types": "2.73.0",
18
- "node-opcua-binary-stream": "2.73.0",
19
- "node-opcua-debug": "2.71.0",
20
- "node-opcua-factory": "2.73.1",
21
- "node-opcua-nodeid": "2.71.0"
16
+ "node-opcua-basic-types": "2.76.0",
17
+ "node-opcua-binary-stream": "2.76.0",
18
+ "node-opcua-debug": "2.76.0",
19
+ "node-opcua-factory": "2.76.0",
20
+ "node-opcua-nodeid": "2.76.0"
22
21
  },
23
22
  "author": "Etienne Rossignon",
24
23
  "license": "MIT",
@@ -35,5 +34,5 @@
35
34
  "internet of things"
36
35
  ],
37
36
  "homepage": "http://node-opcua.github.io/",
38
- "gitHead": "684a796e88e1732f418f2ada6aca2808e0115de8"
37
+ "gitHead": "75d9b8cf894c8fbadf77d2c4a48a730d055465e7"
39
38
  }
@@ -4,7 +4,14 @@
4
4
  import { decodeNodeId, encodeNodeId } from "node-opcua-basic-types";
5
5
  import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
6
6
  import { checkDebugFlag, hexDump, make_debugLog, make_warningLog } from "node-opcua-debug";
7
- import { BaseUAObject, constructObject, IStructuredTypeSchema, is_internal_id, registerBuiltInType, StructuredTypeSchema } from "node-opcua-factory";
7
+ import {
8
+ BaseUAObject,
9
+ constructObject,
10
+ IStructuredTypeSchema,
11
+ is_internal_id,
12
+ registerBuiltInType,
13
+ StructuredTypeSchema
14
+ } from "node-opcua-factory";
8
15
  import { ExpandedNodeId, makeNodeId, NodeId } from "node-opcua-nodeid";
9
16
 
10
17
  const debugLog = make_debugLog(__filename);
@@ -186,14 +193,17 @@ export function decodeExtensionObject(stream: BinaryStream, _value?: ExtensionOb
186
193
  // causing 2 extra member to be added.
187
194
  debugLog(chalk.bgWhiteBright.red("========================================="));
188
195
 
189
- // tslint:disable-next-line:no-console
190
196
  warningLog(
191
- "WARNING => Extension object decoding error on ",
197
+ "WARNING => decodeExtensionObject: Extension object decoding error on ",
192
198
  object.constructor.name,
193
199
  " expected size was",
194
200
  length,
195
201
  "but only this amount of bytes have been read :",
196
- stream.length - streamLengthBefore
202
+ stream.length - streamLengthBefore,
203
+ "\n encoding nodeId = ",
204
+ nodeId.toString(),
205
+ "encodingType = ",
206
+ encodingType
197
207
  );
198
208
  stream.length = streamLengthBefore + length;
199
209
  }