node-opcua-json 2.182.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/README.md +29 -2
- 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/index.d.ts +4 -3
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/dist/json_basic_encoding_decoding_data_value.d.ts +2 -1
- package/dist/json_basic_encoding_decoding_data_value.js +8 -7
- package/dist/json_basic_encoding_decoding_data_value.js.map +1 -1
- package/dist/json_basic_encoding_decoding_nodeid.d.ts +32 -1
- package/dist/json_basic_encoding_decoding_nodeid.js +21 -5
- package/dist/json_basic_encoding_decoding_nodeid.js.map +1 -1
- package/package.json +36 -3
- package/source/104/index.ts +117 -0
- package/source/105/index.ts +118 -0
- package/source/index.ts +14 -2
- package/source/json_basic_encoding_decoding_data_value.ts +6 -6
- package/source/json_basic_encoding_decoding_nodeid.ts +29 -10
package/README.md
CHANGED
|
@@ -72,6 +72,32 @@ When a PubSub subscriber has to work out which scheme it is being sent,
|
|
|
72
72
|
`JsonDataSetMessageContentMaskToJsonEncodingScheme` reads the two `FieldEncoding` bits of
|
|
73
73
|
OPC 10000-14 Table 112, and `JsonEncodingSchemeToJsonDataSetMessageContentMask` writes them.
|
|
74
74
|
|
|
75
|
+
## One edition only: `node-opcua-json/104` and `node-opcua-json/105`
|
|
76
|
+
|
|
77
|
+
The root entry point is deliberately flexible: it takes a `JsonEncodingScheme` and dispatches
|
|
78
|
+
to whichever edition it names. Code that speaks a single edition, such as a PubSub publisher
|
|
79
|
+
pinned to 1.05 or a bridge to a 1.04-only stack, is better off importing that edition directly.
|
|
80
|
+
|
|
81
|
+
```ts
|
|
82
|
+
import { opcuaJsonEncodeDataValue, JsonEncoderMode, type DataValueJSON } from "node-opcua-json/105";
|
|
83
|
+
|
|
84
|
+
const pojo: DataValueJSON = opcuaJsonEncodeDataValue(dataValue, JsonEncoderMode.Compact, namespaceArray);
|
|
85
|
+
// { UaType: 11, Value: 3.5, ... } and nothing else can come out
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Each subpath exposes the whole API under **version-free names**: `opcuaJsonEncodeDataValue`,
|
|
89
|
+
`opcuaJsonDecodeVariant`, `opcuaJsonEncodeStatusCode`, `opcuaJsonEncodeNodeId`,
|
|
90
|
+
`opcuaJsonEncodeExtensionObject`, the `DataValueJSON` / `VariantJSON` / `NodeIdJSON` /
|
|
91
|
+
`ExtensionObjectJSON` types and a `JsonEncoderMode` enum, every one bound to that edition alone.
|
|
92
|
+
The mode parameter is the edition's own two-value enum, so a 1.04 mode is a type error in the
|
|
93
|
+
1.05 realm and vice versa, and the JSON types are the edition's exact shapes rather than a union.
|
|
94
|
+
Version-agnostic scalars (`Int64`, `ByteString`, `DateTime`, ...) are the same functions in both.
|
|
95
|
+
|
|
96
|
+
Switching an existing file from one edition to the other is a one-line change of the import
|
|
97
|
+
path. The root package keeps the suffixed names (`opcuaJsonEncodeDataValue104`,
|
|
98
|
+
`opcuaJsonEncodeVariant105`, ...) and also exposes both realms as the `v104` and `v105`
|
|
99
|
+
namespaces for code that has to handle both in one place.
|
|
100
|
+
|
|
75
101
|
## Decoding structures
|
|
76
102
|
|
|
77
103
|
Decoding a `Variant` that contains a structure means constructing that structure, and only the
|
|
@@ -114,9 +140,10 @@ scheme, so one call site serves all four.
|
|
|
114
140
|
| area | exports |
|
|
115
141
|
|---|---|
|
|
116
142
|
| Variant | `opcuaJsonEncodeVariant`, `opcuaJsonDecodeVariant`, the `104` / `105` pairs, `VariantJSON`, `VariantJSON104`, `VariantJSON105` |
|
|
117
|
-
| DataValue | `opcuaJsonEncodeDataValue`, `opcuaJsonDecodeDataValue`, `opcuaJsonEncodeDataValueMQTT`, `DataValueJSON105` |
|
|
143
|
+
| DataValue | `opcuaJsonEncodeDataValue`, `opcuaJsonDecodeDataValue`, `opcuaJsonEncodeDataValueMQTT`, the `104` / `105` variants of all three, `DataValueJSON`, `DataValueJSON104`, `DataValueJSON105` |
|
|
118
144
|
| ExtensionObject | `opcuaJsonEncodeExtensionObject`, `opcuaJsonDecodeExtensionObject`, the `...Body` pair, `makeBody`, `ExtensionObjectJSON104`, `ExtensionObjectJSON105` |
|
|
119
|
-
| NodeId | `opcuaJsonEncodeNodeId`, `opcuaJsonDecodeNodeId`, the `ExpandedNodeId` pair, `opcuaJsonEncodeNodeIdAsString` |
|
|
145
|
+
| NodeId | `opcuaJsonEncodeNodeId`, `opcuaJsonDecodeNodeId`, the `ExpandedNodeId` pair, the `104` / `105` encoders, `opcuaJsonEncodeNodeIdAsString` |
|
|
146
|
+
| realms | `node-opcua-json/104`, `node-opcua-json/105`, and the `v104` / `v105` namespaces on the root |
|
|
120
147
|
| scalars | `Int64`, `UInt64`, `ByteString`, `DateTime`, `LocalizedText`, `QualifiedName`, `StatusCode` |
|
|
121
148
|
| structures | `decodeOPCUA_JSON`, `decodeOPCUA_JSONOld` |
|
|
122
149
|
| schemes | `JsonEncodingScheme`, `JsonEncoderMode104`, `JsonEncoderMode105`, `toJsonEncodingScheme`, `makeDataValueEncodingEnum`, the two `JsonDataSetMessageContentMask` converters |
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
* The OPC UA 1.04 JSON encoding (Part 6, "reversible" and "non-reversible" forms), exposed
|
|
26
|
+
* under version-free names: `import { opcuaJsonEncodeDataValue } from "node-opcua-json/104"`.
|
|
27
|
+
*
|
|
28
|
+
* Everything here is locked to 1.04: the encoders take a JsonEncoderMode (Reversible or
|
|
29
|
+
* NonReversible) and the JSON types are the 1.04 shapes (Type/Body, TypeId/Body, NodeId objects).
|
|
30
|
+
* The root "node-opcua-json" entry point dispatches on JsonEncodingScheme and accepts either edition.
|
|
31
|
+
*/
|
|
32
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
33
|
+
import type { Pojo } from "../decode_opcua_json.js";
|
|
34
|
+
import type { ExtensionObjectBuilder } from "../json_basic_encoding_body_functor.js";
|
|
35
|
+
import { type ExtensionObjectJSON104 } from "../json_basic_encoding_decoding_extension_object.js";
|
|
36
|
+
import { type JsonEncoderMode104 } from "../json_encoding_scheme.js";
|
|
37
|
+
export * from "../decode_opcua_json.js";
|
|
38
|
+
export type { ExtensionObjectConstructorFuncWithSchema } from "../extension_object_constructor.js";
|
|
39
|
+
export * from "../json_basic_encoding_body_functor.js";
|
|
40
|
+
export * from "../json_basic_encoding_decoding_byte_string.js";
|
|
41
|
+
export { type DataValueJSON104 as DataValueJSON, type DataValueStatusAndTimestamps, opcuaJsonDecodeDataValue104 as opcuaJsonDecodeDataValue, opcuaJsonEncodeDataValue104 as opcuaJsonEncodeDataValue, opcuaJsonEncodeDataValueMQTT104 as opcuaJsonEncodeDataValueMQTT } from "../json_basic_encoding_decoding_data_value.js";
|
|
42
|
+
export * from "../json_basic_encoding_decoding_date_time.js";
|
|
43
|
+
export { type ExtensionObjectJSON104 as ExtensionObjectJSON, makeBody, opcuaJsonDecodeExtensionObjectBody, opcuaJsonEncodeExtensionObjectBody } from "../json_basic_encoding_decoding_extension_object.js";
|
|
44
|
+
export * from "../json_basic_encoding_decoding_int64.js";
|
|
45
|
+
export * from "../json_basic_encoding_decoding_localizedtext.js";
|
|
46
|
+
export { type NodeIdJSON104 as NodeIdJSON, opcuaDecodeURIComponent, opcuaEncodeURIComponent, opcuaJsonDecodeExpandedNodeId, opcuaJsonDecodeNodeId, opcuaJsonEncodeExpandedNodeId104 as opcuaJsonEncodeExpandedNodeId, opcuaJsonEncodeNodeId104 as opcuaJsonEncodeNodeId } from "../json_basic_encoding_decoding_nodeid.js";
|
|
47
|
+
export * from "../json_basic_encoding_decoding_qualifiedname.js";
|
|
48
|
+
export { opcuaJsonDecodeStatusCode, opcuaJsonEncodeStatusCode104 as opcuaJsonEncodeStatusCode, type StatusCodeJSON } from "../json_basic_encoding_decoding_statuscode.js";
|
|
49
|
+
export { opcuaJsonDecodeVariant104 as opcuaJsonDecodeVariant, opcuaJsonEncodeVariant104 as opcuaJsonEncodeVariant, type VariantJSON104 as VariantJSON, type VariantJSONBody, type VariantJSONBodyScalar } from "../json_basic_encoding_decoding_variant.js";
|
|
50
|
+
export { JsonEncoderMode104 as JsonEncoderMode, JsonEncodingScheme, toJsonEncodingScheme } from "../json_encoding_scheme.js";
|
|
51
|
+
/**
|
|
52
|
+
* encode an ExtensionObject with the 1.04 rules: Reversible yields { TypeId, Body },
|
|
53
|
+
* NonReversible yields the bare body.
|
|
54
|
+
*/
|
|
55
|
+
export declare function opcuaJsonEncodeExtensionObject(extensionObject: ExtensionObject | ExtensionObject[] | null, mode: JsonEncoderMode104, namespaceArray?: string[]): ExtensionObjectJSON104 | Pojo | (ExtensionObjectJSON104 | Pojo)[] | null;
|
|
56
|
+
export declare function opcuaJsonDecodeExtensionObject(pojo: ExtensionObjectJSON104, builder: ExtensionObjectBuilder, namespaceArray: string[]): ExtensionObject | ExtensionObject[] | null;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ==========================================================================
|
|
4
|
+
* Copyright (c) 2021-2026 Sterfive - etienne.rossignon@sterfive.com
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
17
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
19
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
22
|
+
* IN THE SOFTWARE.
|
|
23
|
+
* ==========================================================================
|
|
24
|
+
*/
|
|
25
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
28
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
30
|
+
}
|
|
31
|
+
Object.defineProperty(o, k2, desc);
|
|
32
|
+
}) : (function(o, m, k, k2) {
|
|
33
|
+
if (k2 === undefined) k2 = k;
|
|
34
|
+
o[k2] = m[k];
|
|
35
|
+
}));
|
|
36
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
37
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.toJsonEncodingScheme = exports.JsonEncodingScheme = exports.JsonEncoderMode = exports.opcuaJsonEncodeVariant = exports.opcuaJsonDecodeVariant = exports.opcuaJsonEncodeStatusCode = exports.opcuaJsonDecodeStatusCode = exports.opcuaJsonEncodeNodeId = exports.opcuaJsonEncodeExpandedNodeId = exports.opcuaJsonDecodeNodeId = exports.opcuaJsonDecodeExpandedNodeId = exports.opcuaEncodeURIComponent = exports.opcuaDecodeURIComponent = exports.opcuaJsonEncodeExtensionObjectBody = exports.opcuaJsonDecodeExtensionObjectBody = exports.makeBody = exports.opcuaJsonEncodeDataValueMQTT = exports.opcuaJsonEncodeDataValue = exports.opcuaJsonDecodeDataValue = void 0;
|
|
41
|
+
exports.opcuaJsonEncodeExtensionObject = opcuaJsonEncodeExtensionObject;
|
|
42
|
+
exports.opcuaJsonDecodeExtensionObject = opcuaJsonDecodeExtensionObject;
|
|
43
|
+
const json_basic_encoding_decoding_extension_object_js_1 = require("../json_basic_encoding_decoding_extension_object.js");
|
|
44
|
+
const json_encoding_scheme_js_1 = require("../json_encoding_scheme.js");
|
|
45
|
+
// version-agnostic parts, shared with the root entry point
|
|
46
|
+
__exportStar(require("../decode_opcua_json.js"), exports);
|
|
47
|
+
__exportStar(require("../json_basic_encoding_body_functor.js"), exports);
|
|
48
|
+
__exportStar(require("../json_basic_encoding_decoding_byte_string.js"), exports);
|
|
49
|
+
// DataValue
|
|
50
|
+
var json_basic_encoding_decoding_data_value_js_1 = require("../json_basic_encoding_decoding_data_value.js");
|
|
51
|
+
Object.defineProperty(exports, "opcuaJsonDecodeDataValue", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonDecodeDataValue104; } });
|
|
52
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValue", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValue104; } });
|
|
53
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValueMQTT", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValueMQTT104; } });
|
|
54
|
+
__exportStar(require("../json_basic_encoding_decoding_date_time.js"), exports);
|
|
55
|
+
// ExtensionObject
|
|
56
|
+
var json_basic_encoding_decoding_extension_object_js_2 = require("../json_basic_encoding_decoding_extension_object.js");
|
|
57
|
+
Object.defineProperty(exports, "makeBody", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_2.makeBody; } });
|
|
58
|
+
Object.defineProperty(exports, "opcuaJsonDecodeExtensionObjectBody", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_2.opcuaJsonDecodeExtensionObjectBody; } });
|
|
59
|
+
Object.defineProperty(exports, "opcuaJsonEncodeExtensionObjectBody", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_2.opcuaJsonEncodeExtensionObjectBody; } });
|
|
60
|
+
__exportStar(require("../json_basic_encoding_decoding_int64.js"), exports);
|
|
61
|
+
__exportStar(require("../json_basic_encoding_decoding_localizedtext.js"), exports);
|
|
62
|
+
// NodeId
|
|
63
|
+
var json_basic_encoding_decoding_nodeid_js_1 = require("../json_basic_encoding_decoding_nodeid.js");
|
|
64
|
+
Object.defineProperty(exports, "opcuaDecodeURIComponent", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaDecodeURIComponent; } });
|
|
65
|
+
Object.defineProperty(exports, "opcuaEncodeURIComponent", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaEncodeURIComponent; } });
|
|
66
|
+
Object.defineProperty(exports, "opcuaJsonDecodeExpandedNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonDecodeExpandedNodeId; } });
|
|
67
|
+
Object.defineProperty(exports, "opcuaJsonDecodeNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonDecodeNodeId; } });
|
|
68
|
+
Object.defineProperty(exports, "opcuaJsonEncodeExpandedNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeExpandedNodeId104; } });
|
|
69
|
+
Object.defineProperty(exports, "opcuaJsonEncodeNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeNodeId104; } });
|
|
70
|
+
__exportStar(require("../json_basic_encoding_decoding_qualifiedname.js"), exports);
|
|
71
|
+
// StatusCode
|
|
72
|
+
var json_basic_encoding_decoding_statuscode_js_1 = require("../json_basic_encoding_decoding_statuscode.js");
|
|
73
|
+
Object.defineProperty(exports, "opcuaJsonDecodeStatusCode", { enumerable: true, get: function () { return json_basic_encoding_decoding_statuscode_js_1.opcuaJsonDecodeStatusCode; } });
|
|
74
|
+
Object.defineProperty(exports, "opcuaJsonEncodeStatusCode", { enumerable: true, get: function () { return json_basic_encoding_decoding_statuscode_js_1.opcuaJsonEncodeStatusCode104; } });
|
|
75
|
+
// Variant
|
|
76
|
+
var json_basic_encoding_decoding_variant_js_1 = require("../json_basic_encoding_decoding_variant.js");
|
|
77
|
+
Object.defineProperty(exports, "opcuaJsonDecodeVariant", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonDecodeVariant104; } });
|
|
78
|
+
Object.defineProperty(exports, "opcuaJsonEncodeVariant", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant104; } });
|
|
79
|
+
var json_encoding_scheme_js_2 = require("../json_encoding_scheme.js");
|
|
80
|
+
Object.defineProperty(exports, "JsonEncoderMode", { enumerable: true, get: function () { return json_encoding_scheme_js_2.JsonEncoderMode104; } });
|
|
81
|
+
Object.defineProperty(exports, "JsonEncodingScheme", { enumerable: true, get: function () { return json_encoding_scheme_js_2.JsonEncodingScheme; } });
|
|
82
|
+
Object.defineProperty(exports, "toJsonEncodingScheme", { enumerable: true, get: function () { return json_encoding_scheme_js_2.toJsonEncodingScheme; } });
|
|
83
|
+
/**
|
|
84
|
+
* encode an ExtensionObject with the 1.04 rules: Reversible yields { TypeId, Body },
|
|
85
|
+
* NonReversible yields the bare body.
|
|
86
|
+
*/
|
|
87
|
+
function opcuaJsonEncodeExtensionObject(extensionObject, mode, namespaceArray) {
|
|
88
|
+
return (0, json_basic_encoding_decoding_extension_object_js_1.opcuaJsonEncodeExtensionObject)(extensionObject, (0, json_encoding_scheme_js_1.toJsonEncodingScheme)(mode), namespaceArray);
|
|
89
|
+
}
|
|
90
|
+
function opcuaJsonDecodeExtensionObject(pojo, builder, namespaceArray) {
|
|
91
|
+
return (0, json_basic_encoding_decoding_extension_object_js_1.opcuaJsonDecodeExtensionObject)(pojo, builder, namespaceArray);
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
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,OAA+B,EAC/B,cAAwB;IAExB,OAAO,IAAA,iFAAiC,EAAC,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAC5E,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
* The OPC UA 1.05 JSON encoding (Part 6, "Compact" and "Verbose" forms), exposed under
|
|
26
|
+
* version-free names: `import { opcuaJsonEncodeDataValue } from "node-opcua-json/105"`.
|
|
27
|
+
*
|
|
28
|
+
* Everything here is locked to 1.05: the encoders take a JsonEncoderMode (Compact or Verbose)
|
|
29
|
+
* and the JSON types are the 1.05 shapes (UaType/Value, UaTypeId/UaBody, NodeId strings).
|
|
30
|
+
* The root "node-opcua-json" entry point dispatches on JsonEncodingScheme and accepts either edition.
|
|
31
|
+
*/
|
|
32
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
33
|
+
import type { ExtensionObjectBuilder } from "../json_basic_encoding_body_functor.js";
|
|
34
|
+
import { type ExtensionObjectJSON105 } from "../json_basic_encoding_decoding_extension_object.js";
|
|
35
|
+
import { type JsonEncoderMode105 } from "../json_encoding_scheme.js";
|
|
36
|
+
export * from "../decode_opcua_json.js";
|
|
37
|
+
export type { ExtensionObjectConstructorFuncWithSchema } from "../extension_object_constructor.js";
|
|
38
|
+
export * from "../json_basic_encoding_body_functor.js";
|
|
39
|
+
export * from "../json_basic_encoding_decoding_byte_string.js";
|
|
40
|
+
export { type DataValueJSON105 as DataValueJSON, type DataValueStatusAndTimestamps, opcuaJsonDecodeDataValue105 as opcuaJsonDecodeDataValue, opcuaJsonEncodeDataValue105 as opcuaJsonEncodeDataValue, opcuaJsonEncodeDataValueMQTT105 as opcuaJsonEncodeDataValueMQTT } from "../json_basic_encoding_decoding_data_value.js";
|
|
41
|
+
export * from "../json_basic_encoding_decoding_date_time.js";
|
|
42
|
+
export { type ExtensionObjectJSON105 as ExtensionObjectJSON, makeBody, opcuaJsonDecodeExtensionObjectBody, opcuaJsonEncodeExtensionObjectBody } from "../json_basic_encoding_decoding_extension_object.js";
|
|
43
|
+
export * from "../json_basic_encoding_decoding_int64.js";
|
|
44
|
+
export * from "../json_basic_encoding_decoding_localizedtext.js";
|
|
45
|
+
export { type NodeIdJSON105 as NodeIdJSON, opcuaDecodeURIComponent, opcuaEncodeURIComponent, opcuaJsonDecodeExpandedNodeId, opcuaJsonDecodeNodeId, opcuaJsonEncodeExpandedNodeId105 as opcuaJsonEncodeExpandedNodeId, opcuaJsonEncodeExpandedNodeIdAsString, opcuaJsonEncodeNodeId105 as opcuaJsonEncodeNodeId, opcuaJsonEncodeNodeIdAsString } from "../json_basic_encoding_decoding_nodeid.js";
|
|
46
|
+
export * from "../json_basic_encoding_decoding_qualifiedname.js";
|
|
47
|
+
export { opcuaJsonDecodeStatusCode, opcuaJsonEncodeStatusCode105 as opcuaJsonEncodeStatusCode, type StatusCodeJSON } from "../json_basic_encoding_decoding_statuscode.js";
|
|
48
|
+
export { opcuaJsonDecodeVariant105 as opcuaJsonDecodeVariant, opcuaJsonEncodeVariant105 as opcuaJsonEncodeVariant, type VariantJSON105 as VariantJSON, type VariantJSONBody, type VariantJSONBodyScalar } from "../json_basic_encoding_decoding_variant.js";
|
|
49
|
+
export { JsonEncoderMode105 as JsonEncoderMode, JsonEncodingScheme, toJsonEncodingScheme } from "../json_encoding_scheme.js";
|
|
50
|
+
/**
|
|
51
|
+
* encode an ExtensionObject with the 1.05 rules: { UaTypeId, UaBody }, UaBody omitted in
|
|
52
|
+
* Compact mode when empty; a null ExtensionObject is omitted (undefined) in Compact mode.
|
|
53
|
+
*/
|
|
54
|
+
export declare function opcuaJsonEncodeExtensionObject(extensionObject: ExtensionObject | ExtensionObject[] | null, mode: JsonEncoderMode105, namespaceArray?: string[]): ExtensionObjectJSON105 | ExtensionObjectJSON105[] | null | undefined;
|
|
55
|
+
export declare function opcuaJsonDecodeExtensionObject(pojo: ExtensionObjectJSON105, builder: ExtensionObjectBuilder, namespaceArray: string[]): ExtensionObject | ExtensionObject[] | null;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ==========================================================================
|
|
4
|
+
* Copyright (c) 2021-2026 Sterfive - etienne.rossignon@sterfive.com
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in
|
|
14
|
+
* all copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
17
|
+
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
19
|
+
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
21
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
22
|
+
* IN THE SOFTWARE.
|
|
23
|
+
* ==========================================================================
|
|
24
|
+
*/
|
|
25
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
26
|
+
if (k2 === undefined) k2 = k;
|
|
27
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
28
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
29
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
30
|
+
}
|
|
31
|
+
Object.defineProperty(o, k2, desc);
|
|
32
|
+
}) : (function(o, m, k, k2) {
|
|
33
|
+
if (k2 === undefined) k2 = k;
|
|
34
|
+
o[k2] = m[k];
|
|
35
|
+
}));
|
|
36
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
37
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.toJsonEncodingScheme = exports.JsonEncodingScheme = exports.JsonEncoderMode = exports.opcuaJsonEncodeVariant = exports.opcuaJsonDecodeVariant = exports.opcuaJsonEncodeStatusCode = exports.opcuaJsonDecodeStatusCode = exports.opcuaJsonEncodeNodeIdAsString = exports.opcuaJsonEncodeNodeId = exports.opcuaJsonEncodeExpandedNodeIdAsString = exports.opcuaJsonEncodeExpandedNodeId = exports.opcuaJsonDecodeNodeId = exports.opcuaJsonDecodeExpandedNodeId = exports.opcuaEncodeURIComponent = exports.opcuaDecodeURIComponent = exports.opcuaJsonEncodeExtensionObjectBody = exports.opcuaJsonDecodeExtensionObjectBody = exports.makeBody = exports.opcuaJsonEncodeDataValueMQTT = exports.opcuaJsonEncodeDataValue = exports.opcuaJsonDecodeDataValue = void 0;
|
|
41
|
+
exports.opcuaJsonEncodeExtensionObject = opcuaJsonEncodeExtensionObject;
|
|
42
|
+
exports.opcuaJsonDecodeExtensionObject = opcuaJsonDecodeExtensionObject;
|
|
43
|
+
const json_basic_encoding_decoding_extension_object_js_1 = require("../json_basic_encoding_decoding_extension_object.js");
|
|
44
|
+
const json_encoding_scheme_js_1 = require("../json_encoding_scheme.js");
|
|
45
|
+
// version-agnostic parts, shared with the root entry point
|
|
46
|
+
__exportStar(require("../decode_opcua_json.js"), exports);
|
|
47
|
+
__exportStar(require("../json_basic_encoding_body_functor.js"), exports);
|
|
48
|
+
__exportStar(require("../json_basic_encoding_decoding_byte_string.js"), exports);
|
|
49
|
+
// DataValue
|
|
50
|
+
var json_basic_encoding_decoding_data_value_js_1 = require("../json_basic_encoding_decoding_data_value.js");
|
|
51
|
+
Object.defineProperty(exports, "opcuaJsonDecodeDataValue", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonDecodeDataValue105; } });
|
|
52
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValue", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValue105; } });
|
|
53
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValueMQTT", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValueMQTT105; } });
|
|
54
|
+
__exportStar(require("../json_basic_encoding_decoding_date_time.js"), exports);
|
|
55
|
+
// ExtensionObject
|
|
56
|
+
var json_basic_encoding_decoding_extension_object_js_2 = require("../json_basic_encoding_decoding_extension_object.js");
|
|
57
|
+
Object.defineProperty(exports, "makeBody", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_2.makeBody; } });
|
|
58
|
+
Object.defineProperty(exports, "opcuaJsonDecodeExtensionObjectBody", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_2.opcuaJsonDecodeExtensionObjectBody; } });
|
|
59
|
+
Object.defineProperty(exports, "opcuaJsonEncodeExtensionObjectBody", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_2.opcuaJsonEncodeExtensionObjectBody; } });
|
|
60
|
+
__exportStar(require("../json_basic_encoding_decoding_int64.js"), exports);
|
|
61
|
+
__exportStar(require("../json_basic_encoding_decoding_localizedtext.js"), exports);
|
|
62
|
+
// NodeId
|
|
63
|
+
var json_basic_encoding_decoding_nodeid_js_1 = require("../json_basic_encoding_decoding_nodeid.js");
|
|
64
|
+
Object.defineProperty(exports, "opcuaDecodeURIComponent", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaDecodeURIComponent; } });
|
|
65
|
+
Object.defineProperty(exports, "opcuaEncodeURIComponent", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaEncodeURIComponent; } });
|
|
66
|
+
Object.defineProperty(exports, "opcuaJsonDecodeExpandedNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonDecodeExpandedNodeId; } });
|
|
67
|
+
Object.defineProperty(exports, "opcuaJsonDecodeNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonDecodeNodeId; } });
|
|
68
|
+
Object.defineProperty(exports, "opcuaJsonEncodeExpandedNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeExpandedNodeId105; } });
|
|
69
|
+
Object.defineProperty(exports, "opcuaJsonEncodeExpandedNodeIdAsString", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeExpandedNodeIdAsString; } });
|
|
70
|
+
Object.defineProperty(exports, "opcuaJsonEncodeNodeId", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeNodeId105; } });
|
|
71
|
+
Object.defineProperty(exports, "opcuaJsonEncodeNodeIdAsString", { enumerable: true, get: function () { return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeNodeIdAsString; } });
|
|
72
|
+
__exportStar(require("../json_basic_encoding_decoding_qualifiedname.js"), exports);
|
|
73
|
+
// StatusCode
|
|
74
|
+
var json_basic_encoding_decoding_statuscode_js_1 = require("../json_basic_encoding_decoding_statuscode.js");
|
|
75
|
+
Object.defineProperty(exports, "opcuaJsonDecodeStatusCode", { enumerable: true, get: function () { return json_basic_encoding_decoding_statuscode_js_1.opcuaJsonDecodeStatusCode; } });
|
|
76
|
+
Object.defineProperty(exports, "opcuaJsonEncodeStatusCode", { enumerable: true, get: function () { return json_basic_encoding_decoding_statuscode_js_1.opcuaJsonEncodeStatusCode105; } });
|
|
77
|
+
// Variant
|
|
78
|
+
var json_basic_encoding_decoding_variant_js_1 = require("../json_basic_encoding_decoding_variant.js");
|
|
79
|
+
Object.defineProperty(exports, "opcuaJsonDecodeVariant", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonDecodeVariant105; } });
|
|
80
|
+
Object.defineProperty(exports, "opcuaJsonEncodeVariant", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant105; } });
|
|
81
|
+
var json_encoding_scheme_js_2 = require("../json_encoding_scheme.js");
|
|
82
|
+
Object.defineProperty(exports, "JsonEncoderMode", { enumerable: true, get: function () { return json_encoding_scheme_js_2.JsonEncoderMode105; } });
|
|
83
|
+
Object.defineProperty(exports, "JsonEncodingScheme", { enumerable: true, get: function () { return json_encoding_scheme_js_2.JsonEncodingScheme; } });
|
|
84
|
+
Object.defineProperty(exports, "toJsonEncodingScheme", { enumerable: true, get: function () { return json_encoding_scheme_js_2.toJsonEncodingScheme; } });
|
|
85
|
+
/**
|
|
86
|
+
* encode an ExtensionObject with the 1.05 rules: { UaTypeId, UaBody }, UaBody omitted in
|
|
87
|
+
* Compact mode when empty; a null ExtensionObject is omitted (undefined) in Compact mode.
|
|
88
|
+
*/
|
|
89
|
+
function opcuaJsonEncodeExtensionObject(extensionObject, mode, namespaceArray) {
|
|
90
|
+
return (0, json_basic_encoding_decoding_extension_object_js_1.opcuaJsonEncodeExtensionObject)(extensionObject, (0, json_encoding_scheme_js_1.toJsonEncodingScheme)(mode), namespaceArray);
|
|
91
|
+
}
|
|
92
|
+
function opcuaJsonDecodeExtensionObject(pojo, builder, namespaceArray) {
|
|
93
|
+
return (0, json_basic_encoding_decoding_extension_object_js_1.opcuaJsonDecodeExtensionObject)(pojo, builder, namespaceArray);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/105/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;AA6EH,wEAUC;AAED,wEAMC;AAlFD,0HAI6D;AAC7D,wEAA2F;AAE3F,2DAA2D;AAC3D,0DAAwC;AAExC,yEAAuD;AACvD,iFAA+D;AAC/D,YAAY;AACZ,4GAMuD;AAHnD,sJAAA,2BAA2B,OAA4B;AACvD,sJAAA,2BAA2B,OAA4B;AACvD,0JAAA,+BAA+B,OAAgC;AAEnE,+EAA6D;AAC7D,kBAAkB;AAClB,wHAK6D;AAHzD,4IAAA,QAAQ,OAAA;AACR,sKAAA,kCAAkC,OAAA;AAClC,sKAAA,kCAAkC,OAAA;AAEtC,2EAAyD;AACzD,mFAAiE;AACjE,SAAS;AACT,oGAUmD;AAR/C,iJAAA,uBAAuB,OAAA;AACvB,iJAAA,uBAAuB,OAAA;AACvB,uJAAA,6BAA6B,OAAA;AAC7B,+IAAA,qBAAqB,OAAA;AACrB,uJAAA,gCAAgC,OAAiC;AACjE,+JAAA,qCAAqC,OAAA;AACrC,+IAAA,wBAAwB,OAAyB;AACjD,uJAAA,6BAA6B,OAAA;AAEjC,mFAAiE;AAEjE,aAAa;AACb,4GAIuD;AAHnD,uJAAA,yBAAyB,OAAA;AACzB,uJAAA,4BAA4B,OAA6B;AAG7D,UAAU;AACV,sGAMoD;AALhD,iJAAA,yBAAyB,OAA0B;AACnD,iJAAA,yBAAyB,OAA0B;AAKvD,sEAA6H;AAApH,0HAAA,kBAAkB,OAAmB;AAAE,6HAAA,kBAAkB,OAAA;AAAE,+HAAA,oBAAoB,OAAA;AAExF;;;GAGG;AACH,SAAgB,8BAA8B,CAC1C,eAA2D,EAC3D,IAAwB,EACxB,cAAyB;IAEzB,OAAO,IAAA,iFAAiC,EAAC,eAAe,EAAE,IAAA,8CAAoB,EAAC,IAAI,CAAC,EAAE,cAAc,CAIrF,CAAC;AACpB,CAAC;AAED,SAAgB,8BAA8B,CAC1C,IAA4B,EAC5B,OAA+B,EAC/B,cAAwB;IAExB,OAAO,IAAA,iFAAiC,EAAC,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAC5E,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,11 +21,13 @@
|
|
|
21
21
|
* IN THE SOFTWARE.
|
|
22
22
|
* ==========================================================================
|
|
23
23
|
*/
|
|
24
|
+
export * as v104 from "./104/index.js";
|
|
25
|
+
export * as v105 from "./105/index.js";
|
|
24
26
|
export * from "./decode_opcua_json.js";
|
|
25
27
|
export type { ExtensionObjectConstructorFuncWithSchema } from "./extension_object_constructor.js";
|
|
26
28
|
export * from "./json_basic_encoding_body_functor.js";
|
|
27
29
|
export * from "./json_basic_encoding_decoding_byte_string.js";
|
|
28
|
-
export { type DataValueJSON, type DataValueJSON104, type DataValueJSON105, opcuaJsonDecodeDataValue, opcuaJsonEncodeDataValue, opcuaJsonEncodeDataValueMQTT } from "./json_basic_encoding_decoding_data_value.js";
|
|
30
|
+
export { type DataValueJSON, type DataValueJSON104, type DataValueJSON105, opcuaJsonDecodeDataValue, opcuaJsonDecodeDataValue104, opcuaJsonDecodeDataValue105, opcuaJsonEncodeDataValue, opcuaJsonEncodeDataValue104, opcuaJsonEncodeDataValue105, opcuaJsonEncodeDataValueMQTT, opcuaJsonEncodeDataValueMQTT104, opcuaJsonEncodeDataValueMQTT105 } from "./json_basic_encoding_decoding_data_value.js";
|
|
29
31
|
export * from "./json_basic_encoding_decoding_extension_object.js";
|
|
30
32
|
export { opcuaJsonDecodeExtensionObject, opcuaJsonEncodeExtensionObject } from "./json_basic_encoding_decoding_extension_object.js";
|
|
31
33
|
export * from "./json_basic_encoding_decoding_int64.js";
|
|
@@ -33,6 +35,5 @@ export * from "./json_basic_encoding_decoding_localizedtext.js";
|
|
|
33
35
|
export * from "./json_basic_encoding_decoding_nodeid.js";
|
|
34
36
|
export * from "./json_basic_encoding_decoding_qualifiedname.js";
|
|
35
37
|
export * from "./json_basic_encoding_decoding_statuscode.js";
|
|
36
|
-
export
|
|
37
|
-
export { opcuaJsonDecodeVariant, opcuaJsonDecodeVariant105, opcuaJsonEncodeVariant, opcuaJsonEncodeVariant105, type VariantJSON, type VariantJSON104, type VariantJSON105 } from "./json_basic_encoding_decoding_variant.js";
|
|
38
|
+
export { opcuaJsonDecodeVariant, opcuaJsonDecodeVariant104, opcuaJsonDecodeVariant105, opcuaJsonEncodeVariant, opcuaJsonEncodeVariant104, opcuaJsonEncodeVariant105, type VariantJSON, type VariantJSON104, type VariantJSON105 } from "./json_basic_encoding_decoding_variant.js";
|
|
38
39
|
export * from "./json_encoding_scheme.js";
|
package/dist/index.js
CHANGED
|
@@ -33,18 +33,51 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
33
33
|
if (k2 === undefined) k2 = k;
|
|
34
34
|
o[k2] = m[k];
|
|
35
35
|
}));
|
|
36
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
37
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
38
|
+
}) : function(o, v) {
|
|
39
|
+
o["default"] = v;
|
|
40
|
+
});
|
|
41
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
42
|
+
var ownKeys = function(o) {
|
|
43
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
44
|
+
var ar = [];
|
|
45
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
46
|
+
return ar;
|
|
47
|
+
};
|
|
48
|
+
return ownKeys(o);
|
|
49
|
+
};
|
|
50
|
+
return function (mod) {
|
|
51
|
+
if (mod && mod.__esModule) return mod;
|
|
52
|
+
var result = {};
|
|
53
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
54
|
+
__setModuleDefault(result, mod);
|
|
55
|
+
return result;
|
|
56
|
+
};
|
|
57
|
+
})();
|
|
36
58
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
37
59
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
38
60
|
};
|
|
39
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
-
exports.opcuaJsonEncodeVariant105 = exports.opcuaJsonEncodeVariant = exports.opcuaJsonDecodeVariant105 = exports.opcuaJsonDecodeVariant = exports.opcuaJsonEncodeExtensionObject = exports.opcuaJsonDecodeExtensionObject = exports.opcuaJsonEncodeDataValueMQTT = exports.opcuaJsonEncodeDataValue = exports.opcuaJsonDecodeDataValue = void 0;
|
|
62
|
+
exports.opcuaJsonEncodeVariant105 = exports.opcuaJsonEncodeVariant104 = exports.opcuaJsonEncodeVariant = exports.opcuaJsonDecodeVariant105 = exports.opcuaJsonDecodeVariant104 = exports.opcuaJsonDecodeVariant = exports.opcuaJsonEncodeExtensionObject = exports.opcuaJsonDecodeExtensionObject = exports.opcuaJsonEncodeDataValueMQTT105 = exports.opcuaJsonEncodeDataValueMQTT104 = exports.opcuaJsonEncodeDataValueMQTT = exports.opcuaJsonEncodeDataValue105 = exports.opcuaJsonEncodeDataValue104 = exports.opcuaJsonEncodeDataValue = exports.opcuaJsonDecodeDataValue105 = exports.opcuaJsonDecodeDataValue104 = exports.opcuaJsonDecodeDataValue = exports.v105 = exports.v104 = void 0;
|
|
63
|
+
// version-locked realms: `node-opcua-json/104` and `node-opcua-json/105` expose the same
|
|
64
|
+
// API under version-free names (opcuaJsonEncodeDataValue, DataValueJSON, ...) bound to a
|
|
65
|
+
// single edition of Part 6, whereas this root entry point dispatches on JsonEncodingScheme.
|
|
66
|
+
exports.v104 = __importStar(require("./104/index.js"));
|
|
67
|
+
exports.v105 = __importStar(require("./105/index.js"));
|
|
41
68
|
__exportStar(require("./decode_opcua_json.js"), exports);
|
|
42
69
|
__exportStar(require("./json_basic_encoding_body_functor.js"), exports);
|
|
43
70
|
__exportStar(require("./json_basic_encoding_decoding_byte_string.js"), exports);
|
|
44
71
|
var json_basic_encoding_decoding_data_value_js_1 = require("./json_basic_encoding_decoding_data_value.js");
|
|
45
72
|
Object.defineProperty(exports, "opcuaJsonDecodeDataValue", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonDecodeDataValue; } });
|
|
73
|
+
Object.defineProperty(exports, "opcuaJsonDecodeDataValue104", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonDecodeDataValue104; } });
|
|
74
|
+
Object.defineProperty(exports, "opcuaJsonDecodeDataValue105", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonDecodeDataValue105; } });
|
|
46
75
|
Object.defineProperty(exports, "opcuaJsonEncodeDataValue", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValue; } });
|
|
76
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValue104", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValue104; } });
|
|
77
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValue105", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValue105; } });
|
|
47
78
|
Object.defineProperty(exports, "opcuaJsonEncodeDataValueMQTT", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValueMQTT; } });
|
|
79
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValueMQTT104", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValueMQTT104; } });
|
|
80
|
+
Object.defineProperty(exports, "opcuaJsonEncodeDataValueMQTT105", { enumerable: true, get: function () { return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValueMQTT105; } });
|
|
48
81
|
__exportStar(require("./json_basic_encoding_decoding_extension_object.js"), exports);
|
|
49
82
|
var json_basic_encoding_decoding_extension_object_js_1 = require("./json_basic_encoding_decoding_extension_object.js");
|
|
50
83
|
Object.defineProperty(exports, "opcuaJsonDecodeExtensionObject", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_1.opcuaJsonDecodeExtensionObject; } });
|
|
@@ -54,13 +87,14 @@ __exportStar(require("./json_basic_encoding_decoding_localizedtext.js"), exports
|
|
|
54
87
|
__exportStar(require("./json_basic_encoding_decoding_nodeid.js"), exports);
|
|
55
88
|
__exportStar(require("./json_basic_encoding_decoding_qualifiedname.js"), exports);
|
|
56
89
|
__exportStar(require("./json_basic_encoding_decoding_statuscode.js"), exports);
|
|
57
|
-
__exportStar(require("./json_basic_encoding_decoding_statuscode.js"), exports);
|
|
58
90
|
var json_basic_encoding_decoding_variant_js_1 = require("./json_basic_encoding_decoding_variant.js");
|
|
59
91
|
Object.defineProperty(exports, "opcuaJsonDecodeVariant", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonDecodeVariant; } });
|
|
92
|
+
Object.defineProperty(exports, "opcuaJsonDecodeVariant104", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonDecodeVariant104; } });
|
|
60
93
|
// the explicit 1.05 entry points: the dispatcher above overloads Compact and Verbose together
|
|
61
94
|
// and so cannot return the 1.05 object shape for Verbose alone
|
|
62
95
|
Object.defineProperty(exports, "opcuaJsonDecodeVariant105", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonDecodeVariant105; } });
|
|
63
96
|
Object.defineProperty(exports, "opcuaJsonEncodeVariant", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant; } });
|
|
97
|
+
Object.defineProperty(exports, "opcuaJsonEncodeVariant104", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant104; } });
|
|
64
98
|
Object.defineProperty(exports, "opcuaJsonEncodeVariant105", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant105; } });
|
|
65
99
|
__exportStar(require("./json_encoding_scheme.js"), exports);
|
|
66
100
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yFAAyF;AACzF,yFAAyF;AACzF,4FAA4F;AAC5F,uDAAuC;AACvC,uDAAuC;AACvC,yDAAuC;AAEvC,wEAAsD;AACtD,gFAA8D;AAC9D,2GAasD;AATlD,sJAAA,wBAAwB,OAAA;AACxB,yJAAA,2BAA2B,OAAA;AAC3B,yJAAA,2BAA2B,OAAA;AAC3B,sJAAA,wBAAwB,OAAA;AACxB,yJAAA,2BAA2B,OAAA;AAC3B,yJAAA,2BAA2B,OAAA;AAC3B,0JAAA,4BAA4B,OAAA;AAC5B,6JAAA,+BAA+B,OAAA;AAC/B,6JAAA,+BAA+B,OAAA;AAEnC,qFAAmE;AACnE,uHAG4D;AAFxD,kKAAA,8BAA8B,OAAA;AAC9B,kKAAA,8BAA8B,OAAA;AAElC,0EAAwD;AACxD,kFAAgE;AAChE,2EAAyD;AACzD,kFAAgE;AAChE,+EAA6D;AAC7D,qGAYmD;AAX/C,iJAAA,sBAAsB,OAAA;AACtB,oJAAA,yBAAyB,OAAA;AACzB,8FAA8F;AAC9F,+DAA+D;AAC/D,oJAAA,yBAAyB,OAAA;AACzB,iJAAA,sBAAsB,OAAA;AACtB,oJAAA,yBAAyB,OAAA;AACzB,oJAAA,yBAAyB,OAAA;AAK7B,4DAA0C"}
|
|
@@ -64,13 +64,14 @@ export type DataValueJSON = DataValueJSON105;
|
|
|
64
64
|
* @returns
|
|
65
65
|
*/
|
|
66
66
|
export declare function opcuaJsonEncodeDataValueMQTT(dataValue: DataValue, encoding: JsonEncodingScheme, mask: DataSetFieldContentMask, namespaceArray?: string[]): VariantJSONBody | VariantJSON105 | VariantJSON104 | DataValueJSON105 | DataValueJSON104 | null;
|
|
67
|
+
export declare function opcuaJsonEncodeDataValueMQTT104(dataValue: DataValue, mode: JsonEncoderMode104, mask: DataSetFieldContentMask, namespaceArray?: string[]): VariantJSONBody | VariantJSON104 | DataValueJSON104 | null;
|
|
67
68
|
/**
|
|
68
69
|
*
|
|
69
70
|
* @param dataValue
|
|
70
71
|
* @param mask
|
|
71
72
|
* @returns
|
|
72
73
|
*/
|
|
73
|
-
export declare function
|
|
74
|
+
export declare function opcuaJsonEncodeDataValueMQTT105(dataValue: DataValue, mode: JsonEncoderMode105, mask: DataSetFieldContentMask, namespaceArray?: string[]): VariantJSONBody | DataValueJSON105 | null;
|
|
74
75
|
export declare function opcuaJsonEncodeDataValue104(dataValue: DataValue, mode: JsonEncoderMode104, namespaceArray: string[]): DataValueJSON104;
|
|
75
76
|
export declare function opcuaJsonEncodeDataValue105(dataValue: DataValue, mode: JsonEncoderMode105, namespaceArray: string[]): DataValueJSON105;
|
|
76
77
|
export declare function opcuaJsonEncodeDataValue(dataValue: DataValue, mode: JsonEncodingScheme.Compact | JsonEncodingScheme.Verbose, namespaceArray: string[]): DataValueJSON105;
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.opcuaJsonEncodeDataValueMQTT = opcuaJsonEncodeDataValueMQTT;
|
|
27
|
-
exports.
|
|
27
|
+
exports.opcuaJsonEncodeDataValueMQTT104 = opcuaJsonEncodeDataValueMQTT104;
|
|
28
|
+
exports.opcuaJsonEncodeDataValueMQTT105 = opcuaJsonEncodeDataValueMQTT105;
|
|
28
29
|
exports.opcuaJsonEncodeDataValue104 = opcuaJsonEncodeDataValue104;
|
|
29
30
|
exports.opcuaJsonEncodeDataValue105 = opcuaJsonEncodeDataValue105;
|
|
30
31
|
exports.opcuaJsonEncodeDataValue = opcuaJsonEncodeDataValue;
|
|
@@ -97,19 +98,19 @@ function _decodeTimestampsAndStatusCodeJson(pojo, dataValueOpt) {
|
|
|
97
98
|
function opcuaJsonEncodeDataValueMQTT(dataValue, encoding, mask, namespaceArray = []) {
|
|
98
99
|
switch (encoding) {
|
|
99
100
|
case json_encoding_scheme_js_1.JsonEncodingScheme.DeprecatedNonReversible:
|
|
100
|
-
return
|
|
101
|
+
return opcuaJsonEncodeDataValueMQTT104(dataValue, json_encoding_scheme_js_1.JsonEncoderMode104.NonReversible, mask, namespaceArray);
|
|
101
102
|
case json_encoding_scheme_js_1.JsonEncodingScheme.DeprecatedReversible:
|
|
102
|
-
return
|
|
103
|
+
return opcuaJsonEncodeDataValueMQTT104(dataValue, json_encoding_scheme_js_1.JsonEncoderMode104.Reversible, mask, namespaceArray);
|
|
103
104
|
case json_encoding_scheme_js_1.JsonEncodingScheme.Verbose:
|
|
104
|
-
return
|
|
105
|
+
return opcuaJsonEncodeDataValueMQTT105(dataValue, json_encoding_scheme_js_1.JsonEncoderMode105.Verbose, mask, namespaceArray);
|
|
105
106
|
case json_encoding_scheme_js_1.JsonEncodingScheme.Compact: {
|
|
106
|
-
return
|
|
107
|
+
return opcuaJsonEncodeDataValueMQTT105(dataValue, json_encoding_scheme_js_1.JsonEncoderMode105.Compact, mask, namespaceArray);
|
|
107
108
|
}
|
|
108
109
|
default:
|
|
109
110
|
throw new Error("Invalid JsonEncodingScheme");
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
|
-
function
|
|
113
|
+
function opcuaJsonEncodeDataValueMQTT104(dataValue, mode, mask, namespaceArray = []) {
|
|
113
114
|
/**
|
|
114
115
|
* All fields with a concrete DataType are encoded using VerboseEncoding if FieldEncoding1 is
|
|
115
116
|
* FALSE and CompactEncoding if FieldEncoding1 is TRUE.
|
|
@@ -189,7 +190,7 @@ function _opcuaJsonEncodeDataValueMQTT104(dataValue, mode, mask, namespaceArray
|
|
|
189
190
|
* @param mask
|
|
190
191
|
* @returns
|
|
191
192
|
*/
|
|
192
|
-
function
|
|
193
|
+
function opcuaJsonEncodeDataValueMQTT105(dataValue, mode, mask, namespaceArray = []) {
|
|
193
194
|
if (mask === node_opcua_types_1.DataSetFieldContentMask.None) {
|
|
194
195
|
if (mode === json_encoding_scheme_js_1.JsonEncoderMode105.Verbose) {
|
|
195
196
|
return (0, json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant105)(dataValue.value, mode, namespaceArray);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json_basic_encoding_decoding_data_value.js","sourceRoot":"","sources":["../source/json_basic_encoding_decoding_data_value.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAwHH,oEAmBC;
|
|
1
|
+
{"version":3,"file":"json_basic_encoding_decoding_data_value.js","sourceRoot":"","sources":["../source/json_basic_encoding_decoding_data_value.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;AAwHH,oEAmBC;AACD,0EAgFC;AAQD,0EAsBC;AASD,kEAkBC;AACD,kEAgBC;AAYD,4DAiBC;AAED,kEAcC;AAED,kEAcC;AAED,4DAYC;AA9WD,iEAAyE;AACzE,uDAA2D;AAC3D,2DAA8C;AAE9C,6GAKsD;AACtD,uGAQmD;AACnD,uEAA6H;AAmC7H,SAAS,2BAA2B,CAChC,IAAkC,EAClC,SAAoB,EACpB,IAA6B,EAC7B,IAAwB;IAExB,IAAI,IAAI,GAAG,0CAAuB,CAAC,iBAAiB,IAAI,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAClF,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;IACzD,CAAC;IACD,IAAI,IAAI,GAAG,0CAAuB,CAAC,iBAAiB,IAAI,SAAS,CAAC,iBAAiB,EAAE,CAAC;QAClF,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;IACzD,CAAC;IACD,IAAI,IAAI,GAAG,0CAAuB,CAAC,eAAe,IAAI,SAAS,CAAC,eAAe,EAAE,CAAC;QAC9E,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC;IACrD,CAAC;IACD,IAAI,IAAI,GAAG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IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACnB,OAAO,2BAA2B,CAAC,IAAwB,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC1F,CAAC;IACD,OAAO,2BAA2B,CAAC,IAAwB,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -28,14 +28,45 @@ export interface NodeIdJSON104 {
|
|
|
28
28
|
IdType?: 0 | 1 | 2 | 3;
|
|
29
29
|
Id: number | string;
|
|
30
30
|
Namespace?: number | string;
|
|
31
|
+
/** ExpandedNodeId only: the ServerIndex, omitted when 0 (Part 6 1.04 clause 5.4.2.11) */
|
|
32
|
+
ServerUri?: number;
|
|
31
33
|
}
|
|
32
34
|
export type NodeIdJSON105 = string;
|
|
33
35
|
export type NodeIdJSON = NodeIdJSON104 | NodeIdJSON105;
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* IdType The IdentifierType encoded as a JSON number.
|
|
39
|
+
* Allowed values are:
|
|
40
|
+
* 0 - UInt32 Identifier encoded as a JSON number.
|
|
41
|
+
* 1 - A String Identifier encoded as a JSON string.
|
|
42
|
+
* 2 - A Guid Identifier.
|
|
43
|
+
* 3 - A ByteString Identifier
|
|
44
|
+
*
|
|
45
|
+
* This field is omitted for UInt32 identifiers.
|
|
46
|
+
*
|
|
47
|
+
* Id The Identifier.
|
|
48
|
+
* The value of the id field specifies the encoding of this field.
|
|
49
|
+
*
|
|
50
|
+
* Namespace The NamespaceIndex for the NodeId.
|
|
51
|
+
* The field is encoded as a JSON number for the reversible encoding.
|
|
52
|
+
* The field is omitted if the NamespaceIndex equals 0.
|
|
53
|
+
* For the non-reversible encoding, the field is the NamespaceUri associated with the NamespaceIndex,
|
|
54
|
+
* encoded as a JSON string.
|
|
55
|
+
* A NamespaceIndex of 1 is always encoded as a JSON number.
|
|
56
|
+
*/
|
|
57
|
+
export declare function opcuaJsonEncodeNodeId104(value: NodeId, scheme?: JsonEncodingScheme, namespaceArray?: string[]): NodeIdJSON104;
|
|
34
58
|
export declare function opcuaJsonEncodeNodeIdAsString(value: NodeId, namespaceArray: string[]): string;
|
|
35
59
|
export declare function opcuaJsonEncodeExpandedNodeIdAsString(value: ExpandedNodeId, namespaceArray: string[]): string;
|
|
60
|
+
export declare function opcuaJsonEncodeNodeId105(value: NodeId, scheme: JsonEncodingScheme, namespaceArray?: string[]): NodeIdJSON105 | undefined;
|
|
61
|
+
export declare function opcuaJsonEncodeExpandedNodeId105(value: ExpandedNodeId, scheme: JsonEncodingScheme, namespaceArray?: string[]): NodeIdJSON105 | undefined;
|
|
36
62
|
export declare function opcuaJsonEncodeNodeId(value: NodeId, scheme: JsonEncodingScheme, namespaceArray?: string[]): NodeIdJSON | undefined;
|
|
37
63
|
export declare function opcuaJsonEncodeExpandedNodeId(value: ExpandedNodeId, scheme: JsonEncodingScheme, namespaceArray?: string[]): NodeIdJSON | undefined;
|
|
38
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Part 6 1.04 clause 5.4.2.11: an ExpandedNodeId is the NodeId object plus a ServerUri field
|
|
66
|
+
* carrying the ServerIndex, omitted when 0. A NamespaceUri set on the ExpandedNodeId wins over
|
|
67
|
+
* the index in the non-reversible form, where the namespace is written as a URI anyway.
|
|
68
|
+
*/
|
|
69
|
+
export declare function opcuaJsonEncodeExpandedNodeId104(value: ExpandedNodeId, scheme: JsonEncodingScheme, namespaceArray?: string[]): NodeIdJSON104;
|
|
39
70
|
export declare function opcuaEncodeURIComponent(value: string): string;
|
|
40
71
|
export declare function opcuaDecodeURIComponent(value: string): string;
|
|
41
72
|
export declare function opcuaJsonDecodeNodeId(pojoOrString: NodeIdJSON | undefined, _builder?: ExtensionObjectBuilder | undefined, namespaceArray?: string[]): NodeId;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.opcuaJsonEncodeNodeId104 = opcuaJsonEncodeNodeId104;
|
|
3
4
|
exports.opcuaJsonEncodeNodeIdAsString = opcuaJsonEncodeNodeIdAsString;
|
|
4
5
|
exports.opcuaJsonEncodeExpandedNodeIdAsString = opcuaJsonEncodeExpandedNodeIdAsString;
|
|
6
|
+
exports.opcuaJsonEncodeNodeId105 = opcuaJsonEncodeNodeId105;
|
|
7
|
+
exports.opcuaJsonEncodeExpandedNodeId105 = opcuaJsonEncodeExpandedNodeId105;
|
|
5
8
|
exports.opcuaJsonEncodeNodeId = opcuaJsonEncodeNodeId;
|
|
6
9
|
exports.opcuaJsonEncodeExpandedNodeId = opcuaJsonEncodeExpandedNodeId;
|
|
7
10
|
exports.opcuaJsonEncodeExpandedNodeId104 = opcuaJsonEncodeExpandedNodeId104;
|
|
@@ -184,8 +187,20 @@ function opcuaJsonEncodeExpandedNodeId(value, scheme, namespaceArray) {
|
|
|
184
187
|
throw new Error(`Invalid JsonEncodingScheme: ${scheme}`);
|
|
185
188
|
}
|
|
186
189
|
}
|
|
187
|
-
|
|
188
|
-
|
|
190
|
+
/**
|
|
191
|
+
* Part 6 1.04 clause 5.4.2.11: an ExpandedNodeId is the NodeId object plus a ServerUri field
|
|
192
|
+
* carrying the ServerIndex, omitted when 0. A NamespaceUri set on the ExpandedNodeId wins over
|
|
193
|
+
* the index in the non-reversible form, where the namespace is written as a URI anyway.
|
|
194
|
+
*/
|
|
195
|
+
function opcuaJsonEncodeExpandedNodeId104(value, scheme, namespaceArray) {
|
|
196
|
+
const pojo = opcuaJsonEncodeNodeId104(value, scheme, namespaceArray);
|
|
197
|
+
if (value.namespaceUri && scheme === json_encoding_scheme_js_1.JsonEncodingScheme.DeprecatedNonReversible) {
|
|
198
|
+
pojo.Namespace = value.namespaceUri;
|
|
199
|
+
}
|
|
200
|
+
if (value.serverIndex !== 0) {
|
|
201
|
+
pojo.ServerUri = value.serverIndex;
|
|
202
|
+
}
|
|
203
|
+
return pojo;
|
|
189
204
|
}
|
|
190
205
|
function opcuaEncodeURIComponent(value) {
|
|
191
206
|
return value.replace(/;/g, (match) => {
|
|
@@ -291,8 +306,9 @@ function opcuaJsonDecodeNodeId(pojoOrString, _builder, namespaceArray) {
|
|
|
291
306
|
}
|
|
292
307
|
function opcuaJsonDecodeExpandedNodeId(pojoOrString, builder, namespaceArray) {
|
|
293
308
|
const nodeId = opcuaJsonDecodeNodeId(pojoOrString, builder, namespaceArray);
|
|
294
|
-
|
|
295
|
-
//
|
|
296
|
-
|
|
309
|
+
// the 1.05 string form carries svr=/svu=, which coerceNodeId does not parse; the 1.04 object
|
|
310
|
+
// form carries ServerUri as the ServerIndex
|
|
311
|
+
const serverIndex = typeof pojoOrString === "object" && pojoOrString ? (pojoOrString.ServerUri ?? 0) : 0;
|
|
312
|
+
return node_opcua_nodeid_1.ExpandedNodeId.fromNodeId(nodeId, undefined, serverIndex);
|
|
297
313
|
}
|
|
298
314
|
//# sourceMappingURL=json_basic_encoding_decoding_nodeid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json_basic_encoding_decoding_nodeid.js","sourceRoot":"","sources":["../source/json_basic_encoding_decoding_nodeid.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"json_basic_encoding_decoding_nodeid.js","sourceRoot":"","sources":["../source/json_basic_encoding_decoding_nodeid.ts"],"names":[],"mappings":";;AAyGA,4DAoCC;AAED,sEAeC;AACD,sFAWC;AAED,4DAYC;AAED,4EAWC;AAED,sDAiBC;AACD,sEAeC;AAOD,4EAaC;AAED,0DAKC;AACD,0DAKC;AA2CD,sDAsDC;AAED,sEAUC;AAtXD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,yDAAqF,CAAC,YAAY;AAElG,uEAA+D;AA2B/D,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAmB,EAAE;IACzD,QAAQ,KAAK,CAAC,cAAc,EAAE,CAAC;QAC3B,KAAK,8BAAU,CAAC,OAAO;YACnB,OAAO,KAAK,CAAC,KAAe,CAAC;QACjC,KAAK,8BAAU,C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C/B,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC,CAAC,EAAE,CAAC;IAEL,MAAM,KAAK,GAA6B,CAAC,GAAG,EAAE;QAC1C,QAAQ,cAAc,EAAE,CAAC;YACrB,KAAK,8BAAU,CAAC,OAAO;gBACnB,OAAO,OAAO,IAAI,CAAC,EAAE,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAE,IAAI,CAAC,EAAiB,CAAC;YACzF,KAAK,8BAAU,CAAC,UAAU;gBACtB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAY,EAAE,QAAQ,CAAC,CAAC;YACpD;gBACI,OAAO,IAAI,CAAC,EAAE,CAAC;QACvB,CAAC;IACL,CAAC,CAAC,EAAE,CAAC;IAEL,OAAO,IAAI,0BAAM,CAAC,cAAc,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AACxD,CAAC;AAED,SAAgB,6BAA6B,CACzC,YAAoC,EACpC,OAA4C,EAC5C,cAAyB;IAEzB,MAAM,MAAM,GAAG,qBAAqB,CAAC,YAAY,EAAE,OAAO,EAAE,cAAc,CAAC,CAAC;IAC5E,6FAA6F;IAC7F,4CAA4C;IAC5C,MAAM,WAAW,GAAG,OAAO,YAAY,KAAK,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACzG,OAAO,kCAAc,CAAC,UAAU,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AACrE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-json",
|
|
3
|
-
"version": "2.182.
|
|
3
|
+
"version": "2.182.2",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - the OPC UA JSON encoding of OPC 10000-6 clause 5.4",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -11,6 +11,39 @@
|
|
|
11
11
|
},
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
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
|
+
},
|
|
14
47
|
"devEngines": {
|
|
15
48
|
"node": ">=18.x",
|
|
16
49
|
"npm": ">=10.x"
|
|
@@ -30,7 +63,7 @@
|
|
|
30
63
|
"node-opcua-variant": "2.182.0"
|
|
31
64
|
},
|
|
32
65
|
"devDependencies": {
|
|
33
|
-
"node-opcua-address-space": "2.182.
|
|
66
|
+
"node-opcua-address-space": "2.182.2",
|
|
34
67
|
"node-opcua-constants": "2.181.0",
|
|
35
68
|
"node-opcua-nodesets": "2.182.0"
|
|
36
69
|
},
|
|
@@ -54,5 +87,5 @@
|
|
|
54
87
|
"dist",
|
|
55
88
|
"source"
|
|
56
89
|
],
|
|
57
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "cb72d06e8bcb611479f44f9f45f67bbee93bc32e"
|
|
58
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
|
+
}
|
package/source/index.ts
CHANGED
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
* ==========================================================================
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
// version-locked realms: `node-opcua-json/104` and `node-opcua-json/105` expose the same
|
|
26
|
+
// API under version-free names (opcuaJsonEncodeDataValue, DataValueJSON, ...) bound to a
|
|
27
|
+
// single edition of Part 6, whereas this root entry point dispatches on JsonEncodingScheme.
|
|
28
|
+
export * as v104 from "./104/index.js";
|
|
29
|
+
export * as v105 from "./105/index.js";
|
|
25
30
|
export * from "./decode_opcua_json.js";
|
|
26
31
|
export type { ExtensionObjectConstructorFuncWithSchema } from "./extension_object_constructor.js";
|
|
27
32
|
export * from "./json_basic_encoding_body_functor.js";
|
|
@@ -31,8 +36,14 @@ export {
|
|
|
31
36
|
type DataValueJSON104,
|
|
32
37
|
type DataValueJSON105,
|
|
33
38
|
opcuaJsonDecodeDataValue,
|
|
39
|
+
opcuaJsonDecodeDataValue104,
|
|
40
|
+
opcuaJsonDecodeDataValue105,
|
|
34
41
|
opcuaJsonEncodeDataValue,
|
|
35
|
-
|
|
42
|
+
opcuaJsonEncodeDataValue104,
|
|
43
|
+
opcuaJsonEncodeDataValue105,
|
|
44
|
+
opcuaJsonEncodeDataValueMQTT,
|
|
45
|
+
opcuaJsonEncodeDataValueMQTT104,
|
|
46
|
+
opcuaJsonEncodeDataValueMQTT105
|
|
36
47
|
} from "./json_basic_encoding_decoding_data_value.js";
|
|
37
48
|
export * from "./json_basic_encoding_decoding_extension_object.js";
|
|
38
49
|
export {
|
|
@@ -44,13 +55,14 @@ export * from "./json_basic_encoding_decoding_localizedtext.js";
|
|
|
44
55
|
export * from "./json_basic_encoding_decoding_nodeid.js";
|
|
45
56
|
export * from "./json_basic_encoding_decoding_qualifiedname.js";
|
|
46
57
|
export * from "./json_basic_encoding_decoding_statuscode.js";
|
|
47
|
-
export * from "./json_basic_encoding_decoding_statuscode.js";
|
|
48
58
|
export {
|
|
49
59
|
opcuaJsonDecodeVariant,
|
|
60
|
+
opcuaJsonDecodeVariant104,
|
|
50
61
|
// the explicit 1.05 entry points: the dispatcher above overloads Compact and Verbose together
|
|
51
62
|
// and so cannot return the 1.05 object shape for Verbose alone
|
|
52
63
|
opcuaJsonDecodeVariant105,
|
|
53
64
|
opcuaJsonEncodeVariant,
|
|
65
|
+
opcuaJsonEncodeVariant104,
|
|
54
66
|
opcuaJsonEncodeVariant105,
|
|
55
67
|
type VariantJSON,
|
|
56
68
|
type VariantJSON104,
|
|
@@ -148,19 +148,19 @@ export function opcuaJsonEncodeDataValueMQTT(
|
|
|
148
148
|
): VariantJSONBody | VariantJSON105 | VariantJSON104 | DataValueJSON105 | DataValueJSON104 | null {
|
|
149
149
|
switch (encoding) {
|
|
150
150
|
case JsonEncodingScheme.DeprecatedNonReversible:
|
|
151
|
-
return
|
|
151
|
+
return opcuaJsonEncodeDataValueMQTT104(dataValue, JsonEncoderMode104.NonReversible, mask, namespaceArray);
|
|
152
152
|
case JsonEncodingScheme.DeprecatedReversible:
|
|
153
|
-
return
|
|
153
|
+
return opcuaJsonEncodeDataValueMQTT104(dataValue, JsonEncoderMode104.Reversible, mask, namespaceArray);
|
|
154
154
|
case JsonEncodingScheme.Verbose:
|
|
155
|
-
return
|
|
155
|
+
return opcuaJsonEncodeDataValueMQTT105(dataValue, JsonEncoderMode105.Verbose, mask, namespaceArray);
|
|
156
156
|
case JsonEncodingScheme.Compact: {
|
|
157
|
-
return
|
|
157
|
+
return opcuaJsonEncodeDataValueMQTT105(dataValue, JsonEncoderMode105.Compact, mask, namespaceArray);
|
|
158
158
|
}
|
|
159
159
|
default:
|
|
160
160
|
throw new Error("Invalid JsonEncodingScheme");
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
export function opcuaJsonEncodeDataValueMQTT104(
|
|
164
164
|
dataValue: DataValue,
|
|
165
165
|
mode: JsonEncoderMode104,
|
|
166
166
|
mask: DataSetFieldContentMask,
|
|
@@ -248,7 +248,7 @@ function _opcuaJsonEncodeDataValueMQTT104(
|
|
|
248
248
|
* @param mask
|
|
249
249
|
* @returns
|
|
250
250
|
*/
|
|
251
|
-
export function
|
|
251
|
+
export function opcuaJsonEncodeDataValueMQTT105(
|
|
252
252
|
dataValue: DataValue,
|
|
253
253
|
mode: JsonEncoderMode105,
|
|
254
254
|
mask: DataSetFieldContentMask,
|
|
@@ -44,6 +44,8 @@ export interface NodeIdJSON104 {
|
|
|
44
44
|
IdType?: 0 | 1 | 2 | 3;
|
|
45
45
|
Id: number | string;
|
|
46
46
|
Namespace?: number | string;
|
|
47
|
+
/** ExpandedNodeId only: the ServerIndex, omitted when 0 (Part 6 1.04 clause 5.4.2.11) */
|
|
48
|
+
ServerUri?: number;
|
|
47
49
|
}
|
|
48
50
|
export type NodeIdJSON105 = string;
|
|
49
51
|
export type NodeIdJSON = NodeIdJSON104 | NodeIdJSON105;
|
|
@@ -101,7 +103,7 @@ const nodeIdValueToString = (value: NodeId): string => {
|
|
|
101
103
|
* A NamespaceIndex of 1 is always encoded as a JSON number.
|
|
102
104
|
*/
|
|
103
105
|
|
|
104
|
-
function opcuaJsonEncodeNodeId104(
|
|
106
|
+
export function opcuaJsonEncodeNodeId104(
|
|
105
107
|
value: NodeId,
|
|
106
108
|
scheme = JsonEncodingScheme.DeprecatedReversible,
|
|
107
109
|
namespaceArray?: string[]
|
|
@@ -168,7 +170,11 @@ export function opcuaJsonEncodeExpandedNodeIdAsString(value: ExpandedNodeId, nam
|
|
|
168
170
|
return result;
|
|
169
171
|
}
|
|
170
172
|
|
|
171
|
-
function opcuaJsonEncodeNodeId105(
|
|
173
|
+
export function opcuaJsonEncodeNodeId105(
|
|
174
|
+
value: NodeId,
|
|
175
|
+
scheme: JsonEncodingScheme,
|
|
176
|
+
namespaceArray?: string[]
|
|
177
|
+
): NodeIdJSON105 | undefined {
|
|
172
178
|
if (value.namespace === 0 && value.identifierType === NodeIdType.NUMERIC && value.value === 0) {
|
|
173
179
|
if (scheme === JsonEncodingScheme.Compact) {
|
|
174
180
|
return undefined;
|
|
@@ -178,7 +184,7 @@ function opcuaJsonEncodeNodeId105(value: NodeId, scheme: JsonEncodingScheme, nam
|
|
|
178
184
|
return opcuaJsonEncodeNodeIdAsString(value, namespaceArray || []);
|
|
179
185
|
}
|
|
180
186
|
|
|
181
|
-
function opcuaJsonEncodeExpandedNodeId105(
|
|
187
|
+
export function opcuaJsonEncodeExpandedNodeId105(
|
|
182
188
|
value: ExpandedNodeId,
|
|
183
189
|
scheme: JsonEncodingScheme,
|
|
184
190
|
namespaceArray?: string[]
|
|
@@ -226,12 +232,24 @@ export function opcuaJsonEncodeExpandedNodeId(
|
|
|
226
232
|
}
|
|
227
233
|
}
|
|
228
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Part 6 1.04 clause 5.4.2.11: an ExpandedNodeId is the NodeId object plus a ServerUri field
|
|
237
|
+
* carrying the ServerIndex, omitted when 0. A NamespaceUri set on the ExpandedNodeId wins over
|
|
238
|
+
* the index in the non-reversible form, where the namespace is written as a URI anyway.
|
|
239
|
+
*/
|
|
229
240
|
export function opcuaJsonEncodeExpandedNodeId104(
|
|
230
|
-
|
|
241
|
+
value: ExpandedNodeId,
|
|
231
242
|
scheme: JsonEncodingScheme,
|
|
232
|
-
|
|
233
|
-
):
|
|
234
|
-
|
|
243
|
+
namespaceArray?: string[]
|
|
244
|
+
): NodeIdJSON104 {
|
|
245
|
+
const pojo = opcuaJsonEncodeNodeId104(value, scheme, namespaceArray);
|
|
246
|
+
if (value.namespaceUri && scheme === JsonEncodingScheme.DeprecatedNonReversible) {
|
|
247
|
+
pojo.Namespace = value.namespaceUri;
|
|
248
|
+
}
|
|
249
|
+
if (value.serverIndex !== 0) {
|
|
250
|
+
pojo.ServerUri = value.serverIndex;
|
|
251
|
+
}
|
|
252
|
+
return pojo;
|
|
235
253
|
}
|
|
236
254
|
|
|
237
255
|
export function opcuaEncodeURIComponent(value: string): string {
|
|
@@ -350,7 +368,8 @@ export function opcuaJsonDecodeExpandedNodeId(
|
|
|
350
368
|
namespaceArray?: string[]
|
|
351
369
|
): ExpandedNodeId {
|
|
352
370
|
const nodeId = opcuaJsonDecodeNodeId(pojoOrString, builder, namespaceArray);
|
|
353
|
-
|
|
354
|
-
//
|
|
355
|
-
|
|
371
|
+
// the 1.05 string form carries svr=/svu=, which coerceNodeId does not parse; the 1.04 object
|
|
372
|
+
// form carries ServerUri as the ServerIndex
|
|
373
|
+
const serverIndex = typeof pojoOrString === "object" && pojoOrString ? (pojoOrString.ServerUri ?? 0) : 0;
|
|
374
|
+
return ExpandedNodeId.fromNodeId(nodeId, undefined, serverIndex);
|
|
356
375
|
}
|