node-opcua-json 0.50.0 → 2.182.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/LICENSE +22 -0
- package/README.md +168 -4
- package/dist/104/index.d.ts +56 -0
- package/dist/104/index.js +93 -0
- package/dist/104/index.js.map +1 -0
- package/dist/105/index.d.ts +55 -0
- package/dist/105/index.js +95 -0
- package/dist/105/index.js.map +1 -0
- package/dist/decode_opcua_json.d.ts +31 -0
- package/dist/decode_opcua_json.js +61 -0
- package/dist/decode_opcua_json.js.map +1 -0
- package/dist/extension_object_constructor.d.ts +46 -0
- package/dist/extension_object_constructor.js +26 -0
- package/dist/extension_object_constructor.js.map +1 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +100 -0
- package/dist/index.js.map +1 -0
- package/dist/json_basic_encoding_body_functor.d.ts +34 -0
- package/dist/json_basic_encoding_body_functor.js +170 -0
- package/dist/json_basic_encoding_body_functor.js.map +1 -0
- package/dist/json_basic_encoding_decoding_byte_string.d.ts +27 -0
- package/dist/json_basic_encoding_decoding_byte_string.js +27 -0
- package/dist/json_basic_encoding_decoding_byte_string.js.map +1 -0
- package/dist/json_basic_encoding_decoding_data_value.d.ts +81 -0
- package/dist/json_basic_encoding_decoding_data_value.js +290 -0
- package/dist/json_basic_encoding_decoding_data_value.js.map +1 -0
- package/dist/json_basic_encoding_decoding_date_time.d.ts +26 -0
- package/dist/json_basic_encoding_decoding_date_time.js +43 -0
- package/dist/json_basic_encoding_decoding_date_time.js.map +1 -0
- package/dist/json_basic_encoding_decoding_extension_object.d.ts +65 -0
- package/dist/json_basic_encoding_decoding_extension_object.js +461 -0
- package/dist/json_basic_encoding_decoding_extension_object.js.map +1 -0
- package/dist/json_basic_encoding_decoding_int64.d.ts +30 -0
- package/dist/json_basic_encoding_decoding_int64.js +56 -0
- package/dist/json_basic_encoding_decoding_int64.js.map +1 -0
- package/dist/json_basic_encoding_decoding_localizedtext.d.ts +33 -0
- package/dist/json_basic_encoding_decoding_localizedtext.js +62 -0
- package/dist/json_basic_encoding_decoding_localizedtext.js.map +1 -0
- package/dist/json_basic_encoding_decoding_nodeid.d.ts +73 -0
- package/dist/json_basic_encoding_decoding_nodeid.js +314 -0
- package/dist/json_basic_encoding_decoding_nodeid.js.map +1 -0
- package/dist/json_basic_encoding_decoding_qualifiedname.d.ts +35 -0
- package/dist/json_basic_encoding_decoding_qualifiedname.js +126 -0
- package/dist/json_basic_encoding_decoding_qualifiedname.js.map +1 -0
- package/dist/json_basic_encoding_decoding_statuscode.d.ts +39 -0
- package/dist/json_basic_encoding_decoding_statuscode.js +139 -0
- package/dist/json_basic_encoding_decoding_statuscode.js.map +1 -0
- package/dist/json_basic_encoding_decoding_variant.d.ts +101 -0
- package/dist/json_basic_encoding_decoding_variant.js +234 -0
- package/dist/json_basic_encoding_decoding_variant.js.map +1 -0
- package/dist/json_encoding_scheme.d.ts +50 -0
- package/dist/json_encoding_scheme.js +117 -0
- package/dist/json_encoding_scheme.js.map +1 -0
- package/package.json +90 -35
- package/source/104/index.ts +117 -0
- package/source/105/index.ts +118 -0
- package/source/decode_opcua_json.ts +67 -0
- package/source/extension_object_constructor.ts +48 -0
- package/source/index.ts +71 -0
- package/source/json_basic_encoding_body_functor.ts +190 -0
- package/source/json_basic_encoding_decoding_byte_string.ts +52 -0
- package/source/json_basic_encoding_decoding_data_value.ts +392 -0
- package/source/json_basic_encoding_decoding_date_time.ts +42 -0
- package/source/json_basic_encoding_decoding_extension_object.ts +531 -0
- package/source/json_basic_encoding_decoding_int64.ts +74 -0
- package/source/json_basic_encoding_decoding_localizedtext.ts +69 -0
- package/source/json_basic_encoding_decoding_nodeid.ts +375 -0
- package/source/json_basic_encoding_decoding_qualifiedname.ts +144 -0
- package/source/json_basic_encoding_decoding_statuscode.ts +151 -0
- package/source/json_basic_encoding_decoding_variant.ts +339 -0
- package/source/json_encoding_scheme.ts +114 -0
- package/LICENSE.md +0 -40
- package/dist2/decode_opcua_json.d.ts +0 -12
- package/dist2/index.d.ts +0 -17
- package/dist2/index.js +0 -1
- package/dist2/json_basic_encoding_body_functor.d.ts +0 -14
- package/dist2/json_basic_encoding_decoding_byte_string.d.ts +0 -8
- package/dist2/json_basic_encoding_decoding_data_value.d.ts +0 -26
- package/dist2/json_basic_encoding_decoding_date_time.d.ts +0 -6
- package/dist2/json_basic_encoding_decoding_extension_object.d.ts +0 -32
- package/dist2/json_basic_encoding_decoding_int64.d.ts +0 -9
- package/dist2/json_basic_encoding_decoding_localizedtext.d.ts +0 -14
- package/dist2/json_basic_encoding_decoding_nodeid.d.ts +0 -33
- package/dist2/json_basic_encoding_decoding_qualifiedname.d.ts +0 -14
- package/dist2/json_basic_encoding_decoding_statuscode.d.ts +0 -16
- package/dist2/json_basic_encoding_decoding_variant.d.ts +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.JsonEncoderMode105 = exports.JsonEncoderMode104 = exports.JsonEncodingScheme = void 0;
|
|
4
|
+
exports.toJsonEncodingScheme = toJsonEncodingScheme;
|
|
5
|
+
exports.makeDataValueEncodingEnum = makeDataValueEncodingEnum;
|
|
6
|
+
exports.JsonDataSetMessageContentMaskToJsonEncodingScheme = JsonDataSetMessageContentMaskToJsonEncodingScheme;
|
|
7
|
+
exports.JsonEncodingSchemeToJsonDataSetMessageContentMask = JsonEncodingSchemeToJsonDataSetMessageContentMask;
|
|
8
|
+
const node_opcua_types_1 = require("node-opcua-types");
|
|
9
|
+
var JsonEncodingScheme;
|
|
10
|
+
(function (JsonEncodingScheme) {
|
|
11
|
+
JsonEncodingScheme[JsonEncodingScheme["Verbose"] = 2] = "Verbose";
|
|
12
|
+
JsonEncodingScheme[JsonEncodingScheme["Compact"] = 3] = "Compact";
|
|
13
|
+
JsonEncodingScheme[JsonEncodingScheme["DeprecatedNonReversible"] = 0] = "DeprecatedNonReversible";
|
|
14
|
+
JsonEncodingScheme[JsonEncodingScheme["DeprecatedReversible"] = 1] = "DeprecatedReversible";
|
|
15
|
+
})(JsonEncodingScheme || (exports.JsonEncodingScheme = JsonEncodingScheme = {}));
|
|
16
|
+
/**
|
|
17
|
+
* JSON encoders as per 1.04
|
|
18
|
+
*/
|
|
19
|
+
var JsonEncoderMode104;
|
|
20
|
+
(function (JsonEncoderMode104) {
|
|
21
|
+
// biome-ignore lint/style/useLiteralEnumMembers: intentionally aliased to JsonEncodingScheme to keep the two enums in sync
|
|
22
|
+
JsonEncoderMode104[JsonEncoderMode104["Reversible"] = 1] = "Reversible";
|
|
23
|
+
// biome-ignore lint/style/useLiteralEnumMembers: intentionally aliased to JsonEncodingScheme to keep the two enums in sync
|
|
24
|
+
JsonEncoderMode104[JsonEncoderMode104["NonReversible"] = 0] = "NonReversible";
|
|
25
|
+
})(JsonEncoderMode104 || (exports.JsonEncoderMode104 = JsonEncoderMode104 = {}));
|
|
26
|
+
/**
|
|
27
|
+
* From Part 6: 1.05.4:
|
|
28
|
+
*
|
|
29
|
+
* - The CompactEncoding omits all fields with a value equal to the default value for the type.
|
|
30
|
+
* - The VerboseEncoding includes all fields.
|
|
31
|
+
* - The CompactEncoding and VerboseEncoding replace the ReversibleEncoding and
|
|
32
|
+
* NonReversibleEncoding.
|
|
33
|
+
* The differences are described in Annex H.
|
|
34
|
+
* The VerboseEncoding also supports the RawData mode defined in OPC 10000-14.
|
|
35
|
+
*
|
|
36
|
+
* In RawData mode, encoders shall omit
|
|
37
|
+
* the following fields:
|
|
38
|
+
* UaType (see 5.4.2.17 and 5.4.2.18);
|
|
39
|
+
* UaTypeId (see 5.4.2.16);
|
|
40
|
+
* Decoders may not be able to process streams encoding in RawData mode unless they have
|
|
41
|
+
* access to the associated metadata.
|
|
42
|
+
*
|
|
43
|
+
* These fields are not omitted when serialization uses abstract DataTypes such as Structure
|
|
44
|
+
* (i.e. ExtensionObject) or BaseDataType (i.e. Variant).
|
|
45
|
+
*
|
|
46
|
+
* OPC 10000-14 specifies the behaviour if a Publisher is misconfigured with metadata that
|
|
47
|
+
* uses abstract DataTypes.
|
|
48
|
+
*/
|
|
49
|
+
var JsonEncoderMode105;
|
|
50
|
+
(function (JsonEncoderMode105) {
|
|
51
|
+
// biome-ignore lint/style/useLiteralEnumMembers: intentionally aliased to JsonEncodingScheme to keep the two enums in sync
|
|
52
|
+
JsonEncoderMode105[JsonEncoderMode105["Verbose"] = 2] = "Verbose";
|
|
53
|
+
/**
|
|
54
|
+
* A DataEncoding where encoding the serialized form omits optional and default values.
|
|
55
|
+
*
|
|
56
|
+
* All DataEncodings are CompactEncodings unless otherwise stated.
|
|
57
|
+
*/
|
|
58
|
+
// biome-ignore lint/style/useLiteralEnumMembers: intentionally aliased to JsonEncodingScheme to keep the two enums in sync
|
|
59
|
+
JsonEncoderMode105[JsonEncoderMode105["Compact"] = 3] = "Compact";
|
|
60
|
+
})(JsonEncoderMode105 || (exports.JsonEncoderMode105 = JsonEncoderMode105 = {}));
|
|
61
|
+
function toJsonEncodingScheme(mode) {
|
|
62
|
+
switch (mode) {
|
|
63
|
+
case JsonEncoderMode104.Reversible:
|
|
64
|
+
return JsonEncodingScheme.DeprecatedReversible;
|
|
65
|
+
case JsonEncoderMode104.NonReversible:
|
|
66
|
+
return JsonEncodingScheme.DeprecatedNonReversible;
|
|
67
|
+
case JsonEncoderMode105.Verbose:
|
|
68
|
+
return JsonEncodingScheme.Verbose;
|
|
69
|
+
case JsonEncoderMode105.Compact:
|
|
70
|
+
return JsonEncodingScheme.Compact;
|
|
71
|
+
default:
|
|
72
|
+
throw new Error("Invalid JsonEncoderMode");
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function makeDataValueEncodingEnum(fieldEncoding1, fieldEncoding2) {
|
|
76
|
+
// https://reference.opcfoundation.org/Core/Part14/v105/docs/6.3.2.3.1#Table112
|
|
77
|
+
/**
|
|
78
|
+
* FieldEncoding1 FieldEncoding2 Description
|
|
79
|
+
* False True The JSON VerboseEncoding is used for the
|
|
80
|
+
* DataSetMessage field encoding.
|
|
81
|
+
* True True The JSON CompactEncoding is used for the
|
|
82
|
+
* DataSetMessage field encoding.
|
|
83
|
+
* False False The deprecated JSON NonReversibleEncoding is used
|
|
84
|
+
* for the DataSetMessage field encoding.
|
|
85
|
+
* The RawData bit of the DataSetFieldContentMask shall be ignored.
|
|
86
|
+
* True False The deprecated JSON ReversibleFieldEncoding is used
|
|
87
|
+
* for the DataSetMessage field encoding.
|
|
88
|
+
* The RawData bit of the DataSetFieldContentMask shall be ignored.
|
|
89
|
+
*/
|
|
90
|
+
if (fieldEncoding2) {
|
|
91
|
+
// CompactEncoding/VerboseEncoding
|
|
92
|
+
return fieldEncoding1 ? JsonEncodingScheme.Compact : JsonEncodingScheme.Verbose;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return fieldEncoding1 ? JsonEncodingScheme.DeprecatedReversible : JsonEncodingScheme.DeprecatedNonReversible;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
function JsonDataSetMessageContentMaskToJsonEncodingScheme(jsonDataMessageContentMask) {
|
|
99
|
+
const fieldEncoding1 = (jsonDataMessageContentMask & node_opcua_types_1.JsonDataSetMessageContentMask.FieldEncoding1) !== 0;
|
|
100
|
+
const fieldEncoding2 = (jsonDataMessageContentMask & node_opcua_types_1.JsonDataSetMessageContentMask.FieldEncoding2) !== 0;
|
|
101
|
+
return makeDataValueEncodingEnum(fieldEncoding1, fieldEncoding2);
|
|
102
|
+
}
|
|
103
|
+
function JsonEncodingSchemeToJsonDataSetMessageContentMask(scheme) {
|
|
104
|
+
switch (scheme) {
|
|
105
|
+
case JsonEncodingScheme.Verbose:
|
|
106
|
+
return node_opcua_types_1.JsonDataSetMessageContentMask.FieldEncoding2;
|
|
107
|
+
case JsonEncodingScheme.Compact:
|
|
108
|
+
return node_opcua_types_1.JsonDataSetMessageContentMask.FieldEncoding1 | node_opcua_types_1.JsonDataSetMessageContentMask.FieldEncoding2;
|
|
109
|
+
case JsonEncodingScheme.DeprecatedReversible:
|
|
110
|
+
return node_opcua_types_1.JsonDataSetMessageContentMask.FieldEncoding1;
|
|
111
|
+
case JsonEncodingScheme.DeprecatedNonReversible:
|
|
112
|
+
return 0; // no field encoding
|
|
113
|
+
default:
|
|
114
|
+
throw new Error("Invalid JsonEncodingScheme");
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=json_encoding_scheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_encoding_scheme.js","sourceRoot":"","sources":["../source/json_encoding_scheme.ts"],"names":[],"mappings":";;;AAsDA,oDAaC;AAED,8DAsBC;AAED,8GAMC;AACD,8GAaC;AAjHD,uDAAiE;AAEjE,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,iEAAW,CAAA;IACX,iEAAW,CAAA;IACX,iGAA2B,CAAA;IAC3B,2FAAwB,CAAA;AAC5B,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAED;;GAEG;AACH,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,2HAA2H;IAC3H,uEAAoD,CAAA;IACpD,2HAA2H;IAC3H,6EAA0D,CAAA;AAC9D,CAAC,EALW,kBAAkB,kCAAlB,kBAAkB,QAK7B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,IAAY,kBAUX;AAVD,WAAY,kBAAkB;IAC1B,2HAA2H;IAC3H,iEAAoC,CAAA;IACpC;;;;OAIG;IACH,2HAA2H;IAC3H,iEAAoC,CAAA;AACxC,CAAC,EAVW,kBAAkB,kCAAlB,kBAAkB,QAU7B;AAED,SAAgB,oBAAoB,CAAC,IAA6C;IAC9E,QAAQ,IAAI,EAAE,CAAC;QACX,KAAK,kBAAkB,CAAC,UAAU;YAC9B,OAAO,kBAAkB,CAAC,oBAAoB,CAAC;QACnD,KAAK,kBAAkB,CAAC,aAAa;YACjC,OAAO,kBAAkB,CAAC,uBAAuB,CAAC;QACtD,KAAK,kBAAkB,CAAC,OAAO;YAC3B,OAAO,kBAAkB,CAAC,OAAO,CAAC;QACtC,KAAK,kBAAkB,CAAC,OAAO;YAC3B,OAAO,kBAAkB,CAAC,OAAO,CAAC;QACtC;YACI,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IACnD,CAAC;AACL,CAAC;AAED,SAAgB,yBAAyB,CAAC,cAAuB,EAAE,cAAuB;IACtF,+EAA+E;IAE/E;;;;;;;;;;;;OAYG;IACH,IAAI,cAAc,EAAE,CAAC;QACjB,kCAAkC;QAClC,OAAO,cAAc,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,kBAAkB,CAAC,OAAO,CAAC;IACpF,CAAC;SAAM,CAAC;QACJ,OAAO,cAAc,CAAC,CAAC,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,CAAC,CAAC,kBAAkB,CAAC,uBAAuB,CAAC;IACjH,CAAC;AACL,CAAC;AAED,SAAgB,iDAAiD,CAC7D,0BAAyD;IAEzD,MAAM,cAAc,GAAG,CAAC,0BAA0B,GAAG,gDAA6B,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACzG,MAAM,cAAc,GAAG,CAAC,0BAA0B,GAAG,gDAA6B,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IACzG,OAAO,yBAAyB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;AACrE,CAAC;AACD,SAAgB,iDAAiD,CAAC,MAA0B;IACxF,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,kBAAkB,CAAC,OAAO;YAC3B,OAAO,gDAA6B,CAAC,cAAc,CAAC;QACxD,KAAK,kBAAkB,CAAC,OAAO;YAC3B,OAAO,gDAA6B,CAAC,cAAc,GAAG,gDAA6B,CAAC,cAAc,CAAC;QACvG,KAAK,kBAAkB,CAAC,oBAAoB;YACxC,OAAO,gDAA6B,CAAC,cAAc,CAAC;QACxD,KAAK,kBAAkB,CAAC,uBAAuB;YAC3C,OAAO,CAAC,CAAC,CAAC,oBAAoB;QAClC;YACI,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;IACtD,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,36 +1,91 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
2
|
+
"name": "node-opcua-json",
|
|
3
|
+
"version": "2.182.2",
|
|
4
|
+
"description": "pure nodejs OPCUA SDK - the OPC UA JSON encoding of OPC 10000-6 clause 5.4",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc -b",
|
|
7
|
+
"lint": "biome check --no-errors-on-unmatched .",
|
|
8
|
+
"clean": "npx rimraf -g node_modules dist *.tsbuildinfo",
|
|
9
|
+
"test": "mocha",
|
|
10
|
+
"test:check": "tsc --noEmit -p test/tsconfig.json"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"default": "./dist/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./104": {
|
|
20
|
+
"types": "./dist/104/index.d.ts",
|
|
21
|
+
"default": "./dist/104/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./105": {
|
|
24
|
+
"types": "./dist/105/index.d.ts",
|
|
25
|
+
"default": "./dist/105/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./dist/*": {
|
|
28
|
+
"types": "./dist/*.d.ts",
|
|
29
|
+
"default": "./dist/*.js"
|
|
30
|
+
},
|
|
31
|
+
"./dist/*.js": {
|
|
32
|
+
"types": "./dist/*.d.ts",
|
|
33
|
+
"default": "./dist/*.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"typesVersions": {
|
|
38
|
+
"*": {
|
|
39
|
+
"104": [
|
|
40
|
+
"dist/104/index.d.ts"
|
|
41
|
+
],
|
|
42
|
+
"105": [
|
|
43
|
+
"dist/105/index.d.ts"
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"devEngines": {
|
|
48
|
+
"node": ">=18.x",
|
|
49
|
+
"npm": ">=10.x"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"node-opcua-basic-types": "2.182.0",
|
|
53
|
+
"node-opcua-data-model": "2.182.0",
|
|
54
|
+
"node-opcua-data-value": "2.182.0",
|
|
55
|
+
"node-opcua-date-time": "2.181.0",
|
|
56
|
+
"node-opcua-debug": "2.181.0",
|
|
57
|
+
"node-opcua-extension-object": "2.182.0",
|
|
58
|
+
"node-opcua-factory": "2.182.0",
|
|
59
|
+
"node-opcua-nodeid": "2.182.0",
|
|
60
|
+
"node-opcua-numeric-range": "2.182.0",
|
|
61
|
+
"node-opcua-status-code": "2.181.0",
|
|
62
|
+
"node-opcua-types": "2.182.0",
|
|
63
|
+
"node-opcua-variant": "2.182.0"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"node-opcua-address-space": "2.182.2",
|
|
67
|
+
"node-opcua-constants": "2.181.0",
|
|
68
|
+
"node-opcua-nodesets": "2.182.0"
|
|
69
|
+
},
|
|
70
|
+
"author": "Etienne Rossignon",
|
|
71
|
+
"license": "MIT",
|
|
72
|
+
"repository": {
|
|
73
|
+
"type": "git",
|
|
74
|
+
"url": "git://github.com/node-opcua/node-opcua.git"
|
|
75
|
+
},
|
|
76
|
+
"keywords": [
|
|
77
|
+
"OPCUA",
|
|
78
|
+
"opcua",
|
|
79
|
+
"m2m",
|
|
80
|
+
"iot",
|
|
81
|
+
"opc ua",
|
|
82
|
+
"internet of things",
|
|
83
|
+
"json"
|
|
84
|
+
],
|
|
85
|
+
"homepage": "http://node-opcua.github.io/",
|
|
86
|
+
"files": [
|
|
87
|
+
"dist",
|
|
88
|
+
"source"
|
|
89
|
+
],
|
|
90
|
+
"gitHead": "cb72d06e8bcb611479f44f9f45f67bbee93bc32e"
|
|
91
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* Copyright (c) 2021-2026 Sterfive - etienne.rossignon@sterfive.com
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in
|
|
13
|
+
* all copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
16
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
18
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
21
|
+
* IN THE SOFTWARE.
|
|
22
|
+
* ==========================================================================
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The OPC UA 1.04 JSON encoding (Part 6, "reversible" and "non-reversible" forms), exposed
|
|
27
|
+
* under version-free names: `import { opcuaJsonEncodeDataValue } from "node-opcua-json/104"`.
|
|
28
|
+
*
|
|
29
|
+
* Everything here is locked to 1.04: the encoders take a JsonEncoderMode (Reversible or
|
|
30
|
+
* NonReversible) and the JSON types are the 1.04 shapes (Type/Body, TypeId/Body, NodeId objects).
|
|
31
|
+
* The root "node-opcua-json" entry point dispatches on JsonEncodingScheme and accepts either edition.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
35
|
+
import type { Pojo } from "../decode_opcua_json.js";
|
|
36
|
+
import type { ExtensionObjectBuilder } from "../json_basic_encoding_body_functor.js";
|
|
37
|
+
import {
|
|
38
|
+
type ExtensionObjectJSON104,
|
|
39
|
+
opcuaJsonDecodeExtensionObject as opcuaJsonDecodeExtensionObjectAny,
|
|
40
|
+
opcuaJsonEncodeExtensionObject as opcuaJsonEncodeExtensionObjectAny
|
|
41
|
+
} from "../json_basic_encoding_decoding_extension_object.js";
|
|
42
|
+
import { type JsonEncoderMode104, toJsonEncodingScheme } from "../json_encoding_scheme.js";
|
|
43
|
+
|
|
44
|
+
// version-agnostic parts, shared with the root entry point
|
|
45
|
+
export * from "../decode_opcua_json.js";
|
|
46
|
+
export type { ExtensionObjectConstructorFuncWithSchema } from "../extension_object_constructor.js";
|
|
47
|
+
export * from "../json_basic_encoding_body_functor.js";
|
|
48
|
+
export * from "../json_basic_encoding_decoding_byte_string.js";
|
|
49
|
+
// DataValue
|
|
50
|
+
export {
|
|
51
|
+
type DataValueJSON104 as DataValueJSON,
|
|
52
|
+
type DataValueStatusAndTimestamps,
|
|
53
|
+
opcuaJsonDecodeDataValue104 as opcuaJsonDecodeDataValue,
|
|
54
|
+
opcuaJsonEncodeDataValue104 as opcuaJsonEncodeDataValue,
|
|
55
|
+
opcuaJsonEncodeDataValueMQTT104 as opcuaJsonEncodeDataValueMQTT
|
|
56
|
+
} from "../json_basic_encoding_decoding_data_value.js";
|
|
57
|
+
export * from "../json_basic_encoding_decoding_date_time.js";
|
|
58
|
+
// ExtensionObject
|
|
59
|
+
export {
|
|
60
|
+
type ExtensionObjectJSON104 as ExtensionObjectJSON,
|
|
61
|
+
makeBody,
|
|
62
|
+
opcuaJsonDecodeExtensionObjectBody,
|
|
63
|
+
opcuaJsonEncodeExtensionObjectBody
|
|
64
|
+
} from "../json_basic_encoding_decoding_extension_object.js";
|
|
65
|
+
export * from "../json_basic_encoding_decoding_int64.js";
|
|
66
|
+
export * from "../json_basic_encoding_decoding_localizedtext.js";
|
|
67
|
+
// NodeId
|
|
68
|
+
export {
|
|
69
|
+
type NodeIdJSON104 as NodeIdJSON,
|
|
70
|
+
opcuaDecodeURIComponent,
|
|
71
|
+
opcuaEncodeURIComponent,
|
|
72
|
+
opcuaJsonDecodeExpandedNodeId,
|
|
73
|
+
opcuaJsonDecodeNodeId,
|
|
74
|
+
opcuaJsonEncodeExpandedNodeId104 as opcuaJsonEncodeExpandedNodeId,
|
|
75
|
+
opcuaJsonEncodeNodeId104 as opcuaJsonEncodeNodeId
|
|
76
|
+
} from "../json_basic_encoding_decoding_nodeid.js";
|
|
77
|
+
export * from "../json_basic_encoding_decoding_qualifiedname.js";
|
|
78
|
+
|
|
79
|
+
// StatusCode
|
|
80
|
+
export {
|
|
81
|
+
opcuaJsonDecodeStatusCode,
|
|
82
|
+
opcuaJsonEncodeStatusCode104 as opcuaJsonEncodeStatusCode,
|
|
83
|
+
type StatusCodeJSON
|
|
84
|
+
} from "../json_basic_encoding_decoding_statuscode.js";
|
|
85
|
+
// Variant
|
|
86
|
+
export {
|
|
87
|
+
opcuaJsonDecodeVariant104 as opcuaJsonDecodeVariant,
|
|
88
|
+
opcuaJsonEncodeVariant104 as opcuaJsonEncodeVariant,
|
|
89
|
+
type VariantJSON104 as VariantJSON,
|
|
90
|
+
type VariantJSONBody,
|
|
91
|
+
type VariantJSONBodyScalar
|
|
92
|
+
} from "../json_basic_encoding_decoding_variant.js";
|
|
93
|
+
export { JsonEncoderMode104 as JsonEncoderMode, JsonEncodingScheme, toJsonEncodingScheme } from "../json_encoding_scheme.js";
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* encode an ExtensionObject with the 1.04 rules: Reversible yields { TypeId, Body },
|
|
97
|
+
* NonReversible yields the bare body.
|
|
98
|
+
*/
|
|
99
|
+
export function opcuaJsonEncodeExtensionObject(
|
|
100
|
+
extensionObject: ExtensionObject | ExtensionObject[] | null,
|
|
101
|
+
mode: JsonEncoderMode104,
|
|
102
|
+
namespaceArray?: string[]
|
|
103
|
+
): ExtensionObjectJSON104 | Pojo | (ExtensionObjectJSON104 | Pojo)[] | null {
|
|
104
|
+
return opcuaJsonEncodeExtensionObjectAny(extensionObject, toJsonEncodingScheme(mode), namespaceArray) as
|
|
105
|
+
| ExtensionObjectJSON104
|
|
106
|
+
| Pojo
|
|
107
|
+
| (ExtensionObjectJSON104 | Pojo)[]
|
|
108
|
+
| null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function opcuaJsonDecodeExtensionObject(
|
|
112
|
+
pojo: ExtensionObjectJSON104,
|
|
113
|
+
builder: ExtensionObjectBuilder,
|
|
114
|
+
namespaceArray: string[]
|
|
115
|
+
): ExtensionObject | ExtensionObject[] | null {
|
|
116
|
+
return opcuaJsonDecodeExtensionObjectAny(pojo, builder, namespaceArray);
|
|
117
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* Copyright (c) 2021-2026 Sterfive - etienne.rossignon@sterfive.com
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in
|
|
13
|
+
* all copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
16
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
18
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
21
|
+
* IN THE SOFTWARE.
|
|
22
|
+
* ==========================================================================
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The OPC UA 1.05 JSON encoding (Part 6, "Compact" and "Verbose" forms), exposed under
|
|
27
|
+
* version-free names: `import { opcuaJsonEncodeDataValue } from "node-opcua-json/105"`.
|
|
28
|
+
*
|
|
29
|
+
* Everything here is locked to 1.05: the encoders take a JsonEncoderMode (Compact or Verbose)
|
|
30
|
+
* and the JSON types are the 1.05 shapes (UaType/Value, UaTypeId/UaBody, NodeId strings).
|
|
31
|
+
* The root "node-opcua-json" entry point dispatches on JsonEncodingScheme and accepts either edition.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
35
|
+
import type { ExtensionObjectBuilder } from "../json_basic_encoding_body_functor.js";
|
|
36
|
+
import {
|
|
37
|
+
type ExtensionObjectJSON105,
|
|
38
|
+
opcuaJsonDecodeExtensionObject as opcuaJsonDecodeExtensionObjectAny,
|
|
39
|
+
opcuaJsonEncodeExtensionObject as opcuaJsonEncodeExtensionObjectAny
|
|
40
|
+
} from "../json_basic_encoding_decoding_extension_object.js";
|
|
41
|
+
import { type JsonEncoderMode105, toJsonEncodingScheme } from "../json_encoding_scheme.js";
|
|
42
|
+
|
|
43
|
+
// version-agnostic parts, shared with the root entry point
|
|
44
|
+
export * from "../decode_opcua_json.js";
|
|
45
|
+
export type { ExtensionObjectConstructorFuncWithSchema } from "../extension_object_constructor.js";
|
|
46
|
+
export * from "../json_basic_encoding_body_functor.js";
|
|
47
|
+
export * from "../json_basic_encoding_decoding_byte_string.js";
|
|
48
|
+
// DataValue
|
|
49
|
+
export {
|
|
50
|
+
type DataValueJSON105 as DataValueJSON,
|
|
51
|
+
type DataValueStatusAndTimestamps,
|
|
52
|
+
opcuaJsonDecodeDataValue105 as opcuaJsonDecodeDataValue,
|
|
53
|
+
opcuaJsonEncodeDataValue105 as opcuaJsonEncodeDataValue,
|
|
54
|
+
opcuaJsonEncodeDataValueMQTT105 as opcuaJsonEncodeDataValueMQTT
|
|
55
|
+
} from "../json_basic_encoding_decoding_data_value.js";
|
|
56
|
+
export * from "../json_basic_encoding_decoding_date_time.js";
|
|
57
|
+
// ExtensionObject
|
|
58
|
+
export {
|
|
59
|
+
type ExtensionObjectJSON105 as ExtensionObjectJSON,
|
|
60
|
+
makeBody,
|
|
61
|
+
opcuaJsonDecodeExtensionObjectBody,
|
|
62
|
+
opcuaJsonEncodeExtensionObjectBody
|
|
63
|
+
} from "../json_basic_encoding_decoding_extension_object.js";
|
|
64
|
+
export * from "../json_basic_encoding_decoding_int64.js";
|
|
65
|
+
export * from "../json_basic_encoding_decoding_localizedtext.js";
|
|
66
|
+
// NodeId
|
|
67
|
+
export {
|
|
68
|
+
type NodeIdJSON105 as NodeIdJSON,
|
|
69
|
+
opcuaDecodeURIComponent,
|
|
70
|
+
opcuaEncodeURIComponent,
|
|
71
|
+
opcuaJsonDecodeExpandedNodeId,
|
|
72
|
+
opcuaJsonDecodeNodeId,
|
|
73
|
+
opcuaJsonEncodeExpandedNodeId105 as opcuaJsonEncodeExpandedNodeId,
|
|
74
|
+
opcuaJsonEncodeExpandedNodeIdAsString,
|
|
75
|
+
opcuaJsonEncodeNodeId105 as opcuaJsonEncodeNodeId,
|
|
76
|
+
opcuaJsonEncodeNodeIdAsString
|
|
77
|
+
} from "../json_basic_encoding_decoding_nodeid.js";
|
|
78
|
+
export * from "../json_basic_encoding_decoding_qualifiedname.js";
|
|
79
|
+
|
|
80
|
+
// StatusCode
|
|
81
|
+
export {
|
|
82
|
+
opcuaJsonDecodeStatusCode,
|
|
83
|
+
opcuaJsonEncodeStatusCode105 as opcuaJsonEncodeStatusCode,
|
|
84
|
+
type StatusCodeJSON
|
|
85
|
+
} from "../json_basic_encoding_decoding_statuscode.js";
|
|
86
|
+
// Variant
|
|
87
|
+
export {
|
|
88
|
+
opcuaJsonDecodeVariant105 as opcuaJsonDecodeVariant,
|
|
89
|
+
opcuaJsonEncodeVariant105 as opcuaJsonEncodeVariant,
|
|
90
|
+
type VariantJSON105 as VariantJSON,
|
|
91
|
+
type VariantJSONBody,
|
|
92
|
+
type VariantJSONBodyScalar
|
|
93
|
+
} from "../json_basic_encoding_decoding_variant.js";
|
|
94
|
+
export { JsonEncoderMode105 as JsonEncoderMode, JsonEncodingScheme, toJsonEncodingScheme } from "../json_encoding_scheme.js";
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* encode an ExtensionObject with the 1.05 rules: { UaTypeId, UaBody }, UaBody omitted in
|
|
98
|
+
* Compact mode when empty; a null ExtensionObject is omitted (undefined) in Compact mode.
|
|
99
|
+
*/
|
|
100
|
+
export function opcuaJsonEncodeExtensionObject(
|
|
101
|
+
extensionObject: ExtensionObject | ExtensionObject[] | null,
|
|
102
|
+
mode: JsonEncoderMode105,
|
|
103
|
+
namespaceArray?: string[]
|
|
104
|
+
): ExtensionObjectJSON105 | ExtensionObjectJSON105[] | null | undefined {
|
|
105
|
+
return opcuaJsonEncodeExtensionObjectAny(extensionObject, toJsonEncodingScheme(mode), namespaceArray) as
|
|
106
|
+
| ExtensionObjectJSON105
|
|
107
|
+
| ExtensionObjectJSON105[]
|
|
108
|
+
| null
|
|
109
|
+
| undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function opcuaJsonDecodeExtensionObject(
|
|
113
|
+
pojo: ExtensionObjectJSON105,
|
|
114
|
+
builder: ExtensionObjectBuilder,
|
|
115
|
+
namespaceArray: string[]
|
|
116
|
+
): ExtensionObject | ExtensionObject[] | null {
|
|
117
|
+
return opcuaJsonDecodeExtensionObjectAny(pojo, builder, namespaceArray);
|
|
118
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* Copyright (c) 2021-2026 Sterfive - etienne.rossignon@sterfive.com
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in
|
|
13
|
+
* all copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
16
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
18
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
21
|
+
* IN THE SOFTWARE.
|
|
22
|
+
* ==========================================================================
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
26
|
+
import { type ConstructorFuncWithSchema, getStandardDataTypeFactory } from "node-opcua-factory";
|
|
27
|
+
import { type NodeId, type NodeIdLike, resolveNodeId } from "node-opcua-nodeid";
|
|
28
|
+
import type { ExtensionObjectConstructorFuncWithSchema } from "./extension_object_constructor.js";
|
|
29
|
+
|
|
30
|
+
import { opcuaJsonDecodeExtensionObjectBody } from "./json_basic_encoding_decoding_extension_object.js";
|
|
31
|
+
|
|
32
|
+
export type Pojo = { [key: string]: unknown };
|
|
33
|
+
|
|
34
|
+
const faekeBuilder = {
|
|
35
|
+
getExtensionObjectConstructor(_dataTypeNodeId: NodeId): ExtensionObjectConstructorFuncWithSchema {
|
|
36
|
+
return null as unknown as ExtensionObjectConstructorFuncWithSchema;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export function decodeOPCUA_JSONOld<T extends ExtensionObject>(dataType: NodeIdLike, pojo: Pojo): T | null {
|
|
40
|
+
const factory = getStandardDataTypeFactory();
|
|
41
|
+
|
|
42
|
+
const schema = factory.getStructureInfoForDataType(resolveNodeId(dataType));
|
|
43
|
+
if (!schema) return null;
|
|
44
|
+
|
|
45
|
+
const Constructor = schema.constructor;
|
|
46
|
+
if (!Constructor) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const adaptedBody = opcuaJsonDecodeExtensionObjectBody(Constructor.schema, pojo, faekeBuilder, []);
|
|
51
|
+
if (Array.isArray(adaptedBody)) {
|
|
52
|
+
throw new Error("decodeOPCUA_JSONOld: adaptedBody is an array, expected an object");
|
|
53
|
+
}
|
|
54
|
+
const extObj = new Constructor(adaptedBody);
|
|
55
|
+
return extObj as T;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function decodeOPCUA_JSON<T extends ConstructorFuncWithSchema>(Constructor: T, pojo: Pojo): InstanceType<T> {
|
|
59
|
+
const adaptedBody = opcuaJsonDecodeExtensionObjectBody(Constructor.schema, pojo, faekeBuilder, []);
|
|
60
|
+
|
|
61
|
+
if (Array.isArray(adaptedBody)) {
|
|
62
|
+
// If the adapted body is an empty array, we return null
|
|
63
|
+
throw new Error("decodeOPCUA_JSONOld: adaptedBody is an array, expected an object");
|
|
64
|
+
}
|
|
65
|
+
const extObj = new Constructor(adaptedBody);
|
|
66
|
+
return extObj as InstanceType<T>;
|
|
67
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ==========================================================================
|
|
3
|
+
* Copyright (c) 2021-2026 Sterfive - etienne.rossignon@sterfive.com
|
|
4
|
+
*
|
|
5
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
* in the Software without restriction, including without limitation the rights
|
|
8
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
* furnished to do so, subject to the following conditions:
|
|
11
|
+
*
|
|
12
|
+
* The above copyright notice and this permission notice shall be included in
|
|
13
|
+
* all copies or substantial portions of the Software.
|
|
14
|
+
*
|
|
15
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
16
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
18
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
20
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
21
|
+
* IN THE SOFTWARE.
|
|
22
|
+
* ==========================================================================
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
26
|
+
import type { IStructuredTypeSchema } from "node-opcua-factory";
|
|
27
|
+
import type { ExpandedNodeId } from "node-opcua-nodeid";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* the constructor of a concrete ExtensionObject, together with the schema that describes it.
|
|
31
|
+
*
|
|
32
|
+
* This is `ConstructorFuncWithSchema` from node-opcua-factory narrowed to construct an
|
|
33
|
+
* ExtensionObject rather than an IBaseUAObject, which is what a JSON decoder needs: it hands back
|
|
34
|
+
* what it built, and the caller is entitled to an ExtensionObject.
|
|
35
|
+
*
|
|
36
|
+
* It is declared here rather than imported because the narrowing needs `ExtensionObject`, and
|
|
37
|
+
* node-opcua-factory cannot name that type without depending on node-opcua-extension-object, which
|
|
38
|
+
* depends on it. node-opcua-address-space declares an identical interface for the same reason; it
|
|
39
|
+
* could import this one instead, now that this package sits below it.
|
|
40
|
+
*/
|
|
41
|
+
export interface ExtensionObjectConstructorFuncWithSchema {
|
|
42
|
+
new (options?: Record<string, unknown>): ExtensionObject;
|
|
43
|
+
schema: IStructuredTypeSchema;
|
|
44
|
+
possibleFields: string[];
|
|
45
|
+
encodingDefaultBinary: ExpandedNodeId;
|
|
46
|
+
encodingDefaultXml: ExpandedNodeId;
|
|
47
|
+
encodingDefaultJson?: ExpandedNodeId;
|
|
48
|
+
}
|