node-opcua-extension-object 2.162.0 → 2.164.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.
|
@@ -12,4 +12,7 @@ export declare class OpaqueStructure extends ExtensionObject {
|
|
|
12
12
|
constructor(nodeId: NodeId, buffer: Buffer);
|
|
13
13
|
toString(): string;
|
|
14
14
|
}
|
|
15
|
+
export interface IDataTypeFactory {
|
|
16
|
+
constructObject(dataTypeNodeId: NodeId): BaseUAObject | null;
|
|
17
|
+
}
|
|
15
18
|
export declare function decodeExtensionObject(stream: BinaryStream, _value?: ExtensionObject | null): ExtensionObject | null;
|
package/dist/extension_object.js
CHANGED
|
@@ -69,28 +69,28 @@ function encodeExtensionObject(object, stream) {
|
|
|
69
69
|
stream.writeByteStream(object.buffer);
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
|
-
/*
|
|
72
|
+
/* c8 ignore next */
|
|
73
73
|
if (!(object instanceof node_opcua_factory_1.BaseUAObject)) {
|
|
74
74
|
throw new Error("Expecting a extension object");
|
|
75
75
|
}
|
|
76
76
|
// ensure we have a valid encoding Default Binary ID !!!
|
|
77
|
-
/*
|
|
77
|
+
/* c8 ignore next */
|
|
78
78
|
if (!object.schema) {
|
|
79
79
|
debugLog(" object = ", object);
|
|
80
80
|
throw new Error("object has no schema " + object.constructor.name);
|
|
81
81
|
}
|
|
82
82
|
const encodingDefaultBinary = object.schema.encodingDefaultBinary;
|
|
83
|
-
/*
|
|
83
|
+
/* c8 ignore next */
|
|
84
84
|
if (!encodingDefaultBinary) {
|
|
85
85
|
debugLog(chalk_1.default.yellow("encoding ExtObj "), object);
|
|
86
86
|
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
87
87
|
}
|
|
88
|
-
/*
|
|
88
|
+
/* c8 ignore next */
|
|
89
89
|
if (encodingDefaultBinary.isEmpty()) {
|
|
90
90
|
debugLog(chalk_1.default.yellow("encoding ExtObj "), object.constructor.encodingDefaultBinary.toString());
|
|
91
91
|
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
92
92
|
}
|
|
93
|
-
/*
|
|
93
|
+
/* c8 ignore next */
|
|
94
94
|
if ((0, node_opcua_factory_1.is_internal_id)(encodingDefaultBinary.value)) {
|
|
95
95
|
debugLog(chalk_1.default.yellow("encoding ExtObj "), object.constructor.encodingDefaultBinary.toString(), object.schema.name);
|
|
96
96
|
throw new Error("Cannot find valid OPCUA encodingDefaultBinary for this object : " + object.schema.name);
|
|
@@ -131,7 +131,7 @@ function decodeExtensionObject(stream, _value) {
|
|
|
131
131
|
return null;
|
|
132
132
|
}
|
|
133
133
|
const length = stream.readUInt32();
|
|
134
|
-
/*
|
|
134
|
+
/* c8 ignore next */
|
|
135
135
|
if (nodeId.value === 0 || encodingType === 0) {
|
|
136
136
|
return {};
|
|
137
137
|
}
|
|
@@ -155,7 +155,7 @@ function decodeExtensionObject(stream, _value) {
|
|
|
155
155
|
catch (err) {
|
|
156
156
|
warningLog("cannot construct object with dataType nodeId", nodeId.toString());
|
|
157
157
|
}
|
|
158
|
-
/*
|
|
158
|
+
/* c8 ignore next */
|
|
159
159
|
if (object === null) {
|
|
160
160
|
// this object is unknown to us ..
|
|
161
161
|
stream.length -= 4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension_object.js","sourceRoot":"","sources":["../source/extension_object.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"extension_object.js","sourceRoot":"","sources":["../source/extension_object.ts"],"names":[],"mappings":";;;;;;AAiEA,sDAiDC;AA+BD,sDAwEC;AAzND;;GAEG;AACH,mEAAoE;AAEpE,uDAA2F;AAC3F,2DAQ4B;AAC5B,yDAAuD;AAEvD,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,UAAU,CAAC,CAAC;AAE/C,kDAA0B;AAE1B,6BA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AA2C,CAAC,CAAC,CAAC;QAE/E,UAAU,CACN,uEAAuE,EACvE,MAAM,EAAE,WAAW,CAAC,IAAI,EACxB,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;IAChD,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-extension-object",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.164.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,11 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"chalk": "4.1.2",
|
|
16
|
-
"node-opcua-basic-types": "2.
|
|
17
|
-
"node-opcua-binary-stream": "2.
|
|
18
|
-
"node-opcua-debug": "2.
|
|
19
|
-
"node-opcua-factory": "2.
|
|
20
|
-
"node-opcua-nodeid": "2.
|
|
16
|
+
"node-opcua-basic-types": "2.164.0",
|
|
17
|
+
"node-opcua-binary-stream": "2.164.0",
|
|
18
|
+
"node-opcua-debug": "2.164.0",
|
|
19
|
+
"node-opcua-factory": "2.164.0",
|
|
20
|
+
"node-opcua-nodeid": "2.164.0"
|
|
21
21
|
},
|
|
22
22
|
"author": "Etienne Rossignon",
|
|
23
23
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"internet of things"
|
|
35
35
|
],
|
|
36
36
|
"homepage": "http://node-opcua.github.io/",
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "eb76d34b885c7584785d8eff69ada66f95b55c2e",
|
|
38
38
|
"files": [
|
|
39
39
|
"dist",
|
|
40
40
|
"source"
|
|
@@ -10,9 +10,10 @@ import {
|
|
|
10
10
|
IStructuredTypeSchema,
|
|
11
11
|
is_internal_id,
|
|
12
12
|
registerBuiltInType,
|
|
13
|
-
StructuredTypeSchema
|
|
13
|
+
StructuredTypeSchema,
|
|
14
|
+
DataTypeFactory
|
|
14
15
|
} from "node-opcua-factory";
|
|
15
|
-
import {
|
|
16
|
+
import { makeNodeId, NodeId } from "node-opcua-nodeid";
|
|
16
17
|
|
|
17
18
|
const debugLog = make_debugLog(__filename);
|
|
18
19
|
const warningLog = make_warningLog(__filename);
|
|
@@ -75,28 +76,28 @@ export function encodeExtensionObject(object: BaseUAObject | null, stream: Outpu
|
|
|
75
76
|
stream.writeByteStream(object.buffer);
|
|
76
77
|
return;
|
|
77
78
|
}
|
|
78
|
-
/*
|
|
79
|
+
/* c8 ignore next */
|
|
79
80
|
if (!(object instanceof BaseUAObject)) {
|
|
80
81
|
throw new Error("Expecting a extension object");
|
|
81
82
|
}
|
|
82
83
|
// ensure we have a valid encoding Default Binary ID !!!
|
|
83
|
-
/*
|
|
84
|
+
/* c8 ignore next */
|
|
84
85
|
if (!object.schema) {
|
|
85
86
|
debugLog(" object = ", object);
|
|
86
87
|
throw new Error("object has no schema " + object.constructor.name);
|
|
87
88
|
}
|
|
88
89
|
const encodingDefaultBinary = object.schema.encodingDefaultBinary!;
|
|
89
|
-
/*
|
|
90
|
+
/* c8 ignore next */
|
|
90
91
|
if (!encodingDefaultBinary) {
|
|
91
92
|
debugLog(chalk.yellow("encoding ExtObj "), object);
|
|
92
93
|
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
93
94
|
}
|
|
94
|
-
/*
|
|
95
|
+
/* c8 ignore next */
|
|
95
96
|
if (encodingDefaultBinary.isEmpty()) {
|
|
96
97
|
debugLog(chalk.yellow("encoding ExtObj "), (object.constructor as any).encodingDefaultBinary.toString());
|
|
97
98
|
throw new Error("Cannot find encodingDefaultBinary for this object : " + object.schema.name);
|
|
98
99
|
}
|
|
99
|
-
/*
|
|
100
|
+
/* c8 ignore next */
|
|
100
101
|
if (is_internal_id(encodingDefaultBinary.value as number)) {
|
|
101
102
|
debugLog(
|
|
102
103
|
chalk.yellow("encoding ExtObj "),
|
|
@@ -139,8 +140,13 @@ export class OpaqueStructure extends ExtensionObject {
|
|
|
139
140
|
return str;
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
export interface IDataTypeFactory {
|
|
144
|
+
constructObject(dataTypeNodeId: NodeId): BaseUAObject | null;
|
|
145
|
+
}
|
|
146
|
+
export function decodeExtensionObject(
|
|
147
|
+
stream: BinaryStream,
|
|
148
|
+
_value?: ExtensionObject | null,
|
|
149
|
+
): ExtensionObject | null {
|
|
144
150
|
const nodeId = decodeNodeId(stream);
|
|
145
151
|
const encodingType = stream.readUInt8();
|
|
146
152
|
|
|
@@ -150,7 +156,7 @@ export function decodeExtensionObject(stream: BinaryStream, _value?: ExtensionOb
|
|
|
150
156
|
|
|
151
157
|
const length = stream.readUInt32();
|
|
152
158
|
|
|
153
|
-
/*
|
|
159
|
+
/* c8 ignore next */
|
|
154
160
|
if (nodeId.value === 0 || encodingType === 0) {
|
|
155
161
|
return {} as ExtensionObject;
|
|
156
162
|
}
|
|
@@ -174,7 +180,7 @@ export function decodeExtensionObject(stream: BinaryStream, _value?: ExtensionOb
|
|
|
174
180
|
} catch (err) {
|
|
175
181
|
warningLog("cannot construct object with dataType nodeId", nodeId.toString());
|
|
176
182
|
}
|
|
177
|
-
/*
|
|
183
|
+
/* c8 ignore next */
|
|
178
184
|
if (object === null) {
|
|
179
185
|
// this object is unknown to us ..
|
|
180
186
|
stream.length -= 4;
|