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,46 @@
|
|
|
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
|
+
import type { ExtensionObject } from "node-opcua-extension-object";
|
|
25
|
+
import type { IStructuredTypeSchema } from "node-opcua-factory";
|
|
26
|
+
import type { ExpandedNodeId } from "node-opcua-nodeid";
|
|
27
|
+
/**
|
|
28
|
+
* the constructor of a concrete ExtensionObject, together with the schema that describes it.
|
|
29
|
+
*
|
|
30
|
+
* This is `ConstructorFuncWithSchema` from node-opcua-factory narrowed to construct an
|
|
31
|
+
* ExtensionObject rather than an IBaseUAObject, which is what a JSON decoder needs: it hands back
|
|
32
|
+
* what it built, and the caller is entitled to an ExtensionObject.
|
|
33
|
+
*
|
|
34
|
+
* It is declared here rather than imported because the narrowing needs `ExtensionObject`, and
|
|
35
|
+
* node-opcua-factory cannot name that type without depending on node-opcua-extension-object, which
|
|
36
|
+
* depends on it. node-opcua-address-space declares an identical interface for the same reason; it
|
|
37
|
+
* could import this one instead, now that this package sits below it.
|
|
38
|
+
*/
|
|
39
|
+
export interface ExtensionObjectConstructorFuncWithSchema {
|
|
40
|
+
new (options?: Record<string, unknown>): ExtensionObject;
|
|
41
|
+
schema: IStructuredTypeSchema;
|
|
42
|
+
possibleFields: string[];
|
|
43
|
+
encodingDefaultBinary: ExpandedNodeId;
|
|
44
|
+
encodingDefaultXml: ExpandedNodeId;
|
|
45
|
+
encodingDefaultJson?: ExpandedNodeId;
|
|
46
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
//# sourceMappingURL=extension_object_constructor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extension_object_constructor.js","sourceRoot":"","sources":["../source/extension_object_constructor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
export * as v104 from "./104/index.js";
|
|
25
|
+
export * as v105 from "./105/index.js";
|
|
26
|
+
export * from "./decode_opcua_json.js";
|
|
27
|
+
export type { ExtensionObjectConstructorFuncWithSchema } from "./extension_object_constructor.js";
|
|
28
|
+
export * from "./json_basic_encoding_body_functor.js";
|
|
29
|
+
export * from "./json_basic_encoding_decoding_byte_string.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";
|
|
31
|
+
export * from "./json_basic_encoding_decoding_extension_object.js";
|
|
32
|
+
export { opcuaJsonDecodeExtensionObject, opcuaJsonEncodeExtensionObject } from "./json_basic_encoding_decoding_extension_object.js";
|
|
33
|
+
export * from "./json_basic_encoding_decoding_int64.js";
|
|
34
|
+
export * from "./json_basic_encoding_decoding_localizedtext.js";
|
|
35
|
+
export * from "./json_basic_encoding_decoding_nodeid.js";
|
|
36
|
+
export * from "./json_basic_encoding_decoding_qualifiedname.js";
|
|
37
|
+
export * from "./json_basic_encoding_decoding_statuscode.js";
|
|
38
|
+
export { opcuaJsonDecodeVariant, opcuaJsonDecodeVariant104, opcuaJsonDecodeVariant105, opcuaJsonEncodeVariant, opcuaJsonEncodeVariant104, opcuaJsonEncodeVariant105, type VariantJSON, type VariantJSON104, type VariantJSON105 } from "./json_basic_encoding_decoding_variant.js";
|
|
39
|
+
export * from "./json_encoding_scheme.js";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
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 __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
|
+
})();
|
|
58
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
59
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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"));
|
|
68
|
+
__exportStar(require("./decode_opcua_json.js"), exports);
|
|
69
|
+
__exportStar(require("./json_basic_encoding_body_functor.js"), exports);
|
|
70
|
+
__exportStar(require("./json_basic_encoding_decoding_byte_string.js"), exports);
|
|
71
|
+
var json_basic_encoding_decoding_data_value_js_1 = require("./json_basic_encoding_decoding_data_value.js");
|
|
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; } });
|
|
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; } });
|
|
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; } });
|
|
81
|
+
__exportStar(require("./json_basic_encoding_decoding_extension_object.js"), exports);
|
|
82
|
+
var json_basic_encoding_decoding_extension_object_js_1 = require("./json_basic_encoding_decoding_extension_object.js");
|
|
83
|
+
Object.defineProperty(exports, "opcuaJsonDecodeExtensionObject", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_1.opcuaJsonDecodeExtensionObject; } });
|
|
84
|
+
Object.defineProperty(exports, "opcuaJsonEncodeExtensionObject", { enumerable: true, get: function () { return json_basic_encoding_decoding_extension_object_js_1.opcuaJsonEncodeExtensionObject; } });
|
|
85
|
+
__exportStar(require("./json_basic_encoding_decoding_int64.js"), exports);
|
|
86
|
+
__exportStar(require("./json_basic_encoding_decoding_localizedtext.js"), exports);
|
|
87
|
+
__exportStar(require("./json_basic_encoding_decoding_nodeid.js"), exports);
|
|
88
|
+
__exportStar(require("./json_basic_encoding_decoding_qualifiedname.js"), exports);
|
|
89
|
+
__exportStar(require("./json_basic_encoding_decoding_statuscode.js"), exports);
|
|
90
|
+
var json_basic_encoding_decoding_variant_js_1 = require("./json_basic_encoding_decoding_variant.js");
|
|
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; } });
|
|
93
|
+
// the explicit 1.05 entry points: the dispatcher above overloads Compact and Verbose together
|
|
94
|
+
// and so cannot return the 1.05 object shape for Verbose alone
|
|
95
|
+
Object.defineProperty(exports, "opcuaJsonDecodeVariant105", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonDecodeVariant105; } });
|
|
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; } });
|
|
98
|
+
Object.defineProperty(exports, "opcuaJsonEncodeVariant105", { enumerable: true, get: function () { return json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant105; } });
|
|
99
|
+
__exportStar(require("./json_encoding_scheme.js"), exports);
|
|
100
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
import type { NodeId } from "node-opcua-nodeid";
|
|
25
|
+
import { DataType } from "node-opcua-variant";
|
|
26
|
+
import type { ExtensionObjectConstructorFuncWithSchema } from "./extension_object_constructor.js";
|
|
27
|
+
import { JsonEncodingScheme } from "./json_encoding_scheme.js";
|
|
28
|
+
export type EncoderFunc<T> = (t: T, encodingScheme: JsonEncodingScheme, namespaceArray?: string[]) => unknown;
|
|
29
|
+
export interface ExtensionObjectBuilder {
|
|
30
|
+
getExtensionObjectConstructor(dataTypeNodeId: NodeId): ExtensionObjectConstructorFuncWithSchema;
|
|
31
|
+
}
|
|
32
|
+
export type DecoderFunc<T> = (t: T, builder: ExtensionObjectBuilder, namespaceArray: string[]) => unknown;
|
|
33
|
+
export declare function bodyEncodeFunctor(dataType: DataType): EncoderFunc<unknown>;
|
|
34
|
+
export declare function bodyDecodeFunctor(dataType: DataType): DecoderFunc<unknown>;
|
|
@@ -0,0 +1,170 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.bodyEncodeFunctor = bodyEncodeFunctor;
|
|
27
|
+
exports.bodyDecodeFunctor = bodyDecodeFunctor;
|
|
28
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
29
|
+
const json_basic_encoding_decoding_byte_string_js_1 = require("./json_basic_encoding_decoding_byte_string.js");
|
|
30
|
+
const json_basic_encoding_decoding_data_value_js_1 = require("./json_basic_encoding_decoding_data_value.js");
|
|
31
|
+
const json_basic_encoding_decoding_date_time_js_1 = require("./json_basic_encoding_decoding_date_time.js");
|
|
32
|
+
const json_basic_encoding_decoding_extension_object_js_1 = require("./json_basic_encoding_decoding_extension_object.js");
|
|
33
|
+
const json_basic_encoding_decoding_int64_js_1 = require("./json_basic_encoding_decoding_int64.js");
|
|
34
|
+
const json_basic_encoding_decoding_localizedtext_js_1 = require("./json_basic_encoding_decoding_localizedtext.js");
|
|
35
|
+
const json_basic_encoding_decoding_nodeid_js_1 = require("./json_basic_encoding_decoding_nodeid.js");
|
|
36
|
+
const json_basic_encoding_decoding_qualifiedname_js_1 = require("./json_basic_encoding_decoding_qualifiedname.js");
|
|
37
|
+
const json_basic_encoding_decoding_statuscode_js_1 = require("./json_basic_encoding_decoding_statuscode.js");
|
|
38
|
+
const json_basic_encoding_decoding_variant_js_1 = require("./json_basic_encoding_decoding_variant.js");
|
|
39
|
+
const json_encoding_scheme_js_1 = require("./json_encoding_scheme.js");
|
|
40
|
+
function opcuaJsonEncodeString(a, scheme) {
|
|
41
|
+
switch (scheme) {
|
|
42
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.DeprecatedReversible:
|
|
43
|
+
return a;
|
|
44
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.DeprecatedNonReversible:
|
|
45
|
+
return a;
|
|
46
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.Verbose:
|
|
47
|
+
return a;
|
|
48
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.Compact:
|
|
49
|
+
if (a === "" || a === undefined || a === null) {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
return a;
|
|
53
|
+
default:
|
|
54
|
+
throw new Error(`Unknown JsonEncodingScheme: ${scheme}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function opcuaJsonEncodeGuid(a, scheme) {
|
|
58
|
+
switch (scheme) {
|
|
59
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.DeprecatedReversible:
|
|
60
|
+
return a.toLowerCase();
|
|
61
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.DeprecatedNonReversible:
|
|
62
|
+
return a.toLowerCase();
|
|
63
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.Verbose:
|
|
64
|
+
return a.toLowerCase();
|
|
65
|
+
case json_encoding_scheme_js_1.JsonEncodingScheme.Compact:
|
|
66
|
+
if (a === "00000000-0000-0000-0000-000000000000") {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
return a.toLowerCase();
|
|
70
|
+
default:
|
|
71
|
+
throw new Error(`Unknown JsonEncodingScheme: ${scheme}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function bodyEncodeFunctor(dataType) {
|
|
75
|
+
switch (dataType) {
|
|
76
|
+
case node_opcua_variant_1.DataType.Null:
|
|
77
|
+
return () => null;
|
|
78
|
+
case node_opcua_variant_1.DataType.Boolean:
|
|
79
|
+
case node_opcua_variant_1.DataType.Byte:
|
|
80
|
+
case node_opcua_variant_1.DataType.Double:
|
|
81
|
+
case node_opcua_variant_1.DataType.Float:
|
|
82
|
+
case node_opcua_variant_1.DataType.Int16:
|
|
83
|
+
case node_opcua_variant_1.DataType.Int32:
|
|
84
|
+
case node_opcua_variant_1.DataType.SByte:
|
|
85
|
+
case node_opcua_variant_1.DataType.UInt16:
|
|
86
|
+
case node_opcua_variant_1.DataType.UInt32:
|
|
87
|
+
return (a) => a;
|
|
88
|
+
case node_opcua_variant_1.DataType.Guid:
|
|
89
|
+
return opcuaJsonEncodeGuid;
|
|
90
|
+
case node_opcua_variant_1.DataType.String:
|
|
91
|
+
return opcuaJsonEncodeString;
|
|
92
|
+
case node_opcua_variant_1.DataType.ByteString:
|
|
93
|
+
return json_basic_encoding_decoding_byte_string_js_1.opcuaJsonEncodeByteString;
|
|
94
|
+
case node_opcua_variant_1.DataType.LocalizedText:
|
|
95
|
+
return json_basic_encoding_decoding_localizedtext_js_1.opcuaJsonEncodeLocalizedText;
|
|
96
|
+
case node_opcua_variant_1.DataType.NodeId:
|
|
97
|
+
return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeNodeId;
|
|
98
|
+
case node_opcua_variant_1.DataType.ExpandedNodeId:
|
|
99
|
+
return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonEncodeExpandedNodeId;
|
|
100
|
+
case node_opcua_variant_1.DataType.QualifiedName:
|
|
101
|
+
return json_basic_encoding_decoding_qualifiedname_js_1.opcuaJsonEncodeQualifiedName;
|
|
102
|
+
case node_opcua_variant_1.DataType.StatusCode:
|
|
103
|
+
return json_basic_encoding_decoding_statuscode_js_1.opcuaJsonEncodeStatusCode;
|
|
104
|
+
case node_opcua_variant_1.DataType.DateTime:
|
|
105
|
+
return json_basic_encoding_decoding_date_time_js_1.opcuaJsonEncodeDateTime;
|
|
106
|
+
case node_opcua_variant_1.DataType.ExtensionObject:
|
|
107
|
+
return json_basic_encoding_decoding_extension_object_js_1.opcuaJsonEncodeExtensionObject;
|
|
108
|
+
case node_opcua_variant_1.DataType.Variant:
|
|
109
|
+
return json_basic_encoding_decoding_variant_js_1.opcuaJsonEncodeVariant;
|
|
110
|
+
case node_opcua_variant_1.DataType.Int64:
|
|
111
|
+
return json_basic_encoding_decoding_int64_js_1.opcuaJsonEncodeInt64;
|
|
112
|
+
case node_opcua_variant_1.DataType.UInt64:
|
|
113
|
+
return json_basic_encoding_decoding_int64_js_1.opcuaJsonEncodeUInt64;
|
|
114
|
+
case node_opcua_variant_1.DataType.DataValue:
|
|
115
|
+
return json_basic_encoding_decoding_data_value_js_1.opcuaJsonEncodeDataValue;
|
|
116
|
+
case node_opcua_variant_1.DataType.DiagnosticInfo:
|
|
117
|
+
case node_opcua_variant_1.DataType.XmlElement:
|
|
118
|
+
throw new Error(`Unsupported yet ${node_opcua_variant_1.DataType[dataType]}`);
|
|
119
|
+
default:
|
|
120
|
+
return () => null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function bodyDecodeFunctor(dataType) {
|
|
124
|
+
switch (dataType) {
|
|
125
|
+
case node_opcua_variant_1.DataType.Null:
|
|
126
|
+
return () => null;
|
|
127
|
+
case node_opcua_variant_1.DataType.Boolean:
|
|
128
|
+
case node_opcua_variant_1.DataType.Byte:
|
|
129
|
+
case node_opcua_variant_1.DataType.Double:
|
|
130
|
+
case node_opcua_variant_1.DataType.Float:
|
|
131
|
+
case node_opcua_variant_1.DataType.Guid:
|
|
132
|
+
case node_opcua_variant_1.DataType.Int16:
|
|
133
|
+
case node_opcua_variant_1.DataType.Int32:
|
|
134
|
+
case node_opcua_variant_1.DataType.SByte:
|
|
135
|
+
case node_opcua_variant_1.DataType.String:
|
|
136
|
+
case node_opcua_variant_1.DataType.UInt16:
|
|
137
|
+
case node_opcua_variant_1.DataType.UInt32:
|
|
138
|
+
return ((a) => a);
|
|
139
|
+
case node_opcua_variant_1.DataType.ByteString:
|
|
140
|
+
return json_basic_encoding_decoding_byte_string_js_1.opcuaJsonDecodeByteString;
|
|
141
|
+
case node_opcua_variant_1.DataType.LocalizedText:
|
|
142
|
+
return json_basic_encoding_decoding_localizedtext_js_1.opcuaJsonDecodeLocalizedText;
|
|
143
|
+
case node_opcua_variant_1.DataType.NodeId:
|
|
144
|
+
return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonDecodeNodeId;
|
|
145
|
+
case node_opcua_variant_1.DataType.ExpandedNodeId:
|
|
146
|
+
return json_basic_encoding_decoding_nodeid_js_1.opcuaJsonDecodeExpandedNodeId;
|
|
147
|
+
case node_opcua_variant_1.DataType.QualifiedName:
|
|
148
|
+
return json_basic_encoding_decoding_qualifiedname_js_1.opcuaJsonDecodeQualifiedName;
|
|
149
|
+
case node_opcua_variant_1.DataType.StatusCode:
|
|
150
|
+
return json_basic_encoding_decoding_statuscode_js_1.opcuaJsonDecodeStatusCode;
|
|
151
|
+
case node_opcua_variant_1.DataType.DateTime:
|
|
152
|
+
return json_basic_encoding_decoding_date_time_js_1.opcuaJsonDecodeDateTime;
|
|
153
|
+
case node_opcua_variant_1.DataType.ExtensionObject:
|
|
154
|
+
return json_basic_encoding_decoding_extension_object_js_1.opcuaJsonDecodeExtensionObject;
|
|
155
|
+
case node_opcua_variant_1.DataType.Variant:
|
|
156
|
+
return json_basic_encoding_decoding_variant_js_1.opcuaJsonDecodeVariant;
|
|
157
|
+
case node_opcua_variant_1.DataType.Int64:
|
|
158
|
+
return json_basic_encoding_decoding_int64_js_1.opcuaJsonDecodeInt64;
|
|
159
|
+
case node_opcua_variant_1.DataType.UInt64:
|
|
160
|
+
return json_basic_encoding_decoding_int64_js_1.opcuaJsonDecodeUInt64;
|
|
161
|
+
case node_opcua_variant_1.DataType.DataValue:
|
|
162
|
+
return json_basic_encoding_decoding_data_value_js_1.opcuaJsonDecodeDataValue;
|
|
163
|
+
case node_opcua_variant_1.DataType.DiagnosticInfo:
|
|
164
|
+
case node_opcua_variant_1.DataType.XmlElement:
|
|
165
|
+
throw new Error(`Unsupported yet ${node_opcua_variant_1.DataType[dataType]}`);
|
|
166
|
+
default:
|
|
167
|
+
return () => null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=json_basic_encoding_body_functor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_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AQ,CAAC,aAAa;YACvB,OAAO,4EAAoD,CAAC;QAChE,KAAK,6BAAQ,CAAC,MAAM;YAChB,OAAO,8DAA6C,CAAC;QACzD,KAAK,6BAAQ,CAAC,cAAc;YACxB,OAAO,sEAAqD,CAAC;QACjE,KAAK,6BAAQ,CAAC,aAAa;YACvB,OAAO,4EAAoD,CAAC;QAChE,KAAK,6BAAQ,CAAC,UAAU;YACpB,OAAO,sEAAiD,CAAC;QAC7D,KAAK,6BAAQ,CAAC,QAAQ;YAClB,OAAO,mEAA+C,CAAC;QAC3D,KAAK,6BAAQ,CAAC,eAAe;YACzB,OAAO,iFAAsD,CAAC;QAClE,KAAK,6BAAQ,CAAC,OAAO;YACjB,OAAO,gEAA8C,CAAC;QAC1D,KAAK,6BAAQ,CAAC,KAAK;YACf,OAAO,4DAA4C,CAAC;QACxD,KAAK,6BAAQ,CAAC,MAAM;YAChB,OAAO,6DAA6C,CAAC;QACzD,KAAK,6BAAQ,CAAC,SAAS;YACnB,OAAO,qEAAgD,CAAC;QAC5D,KAAK,6BAAQ,CAAC,cAAc,CAAC;QAC7B,KAAK,6BAAQ,CAAC,UAAU;YACpB,MAAM,IAAI,KAAK,CAAC,mBAAmB,6BAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC7D;YACI,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC;IAC1B,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
import type { ByteString } from "node-opcua-basic-types";
|
|
25
|
+
import { JsonEncodingScheme } from "./json_encoding_scheme.js";
|
|
26
|
+
export declare function opcuaJsonEncodeByteString(byteString: ByteString | null, scheme: JsonEncodingScheme, _namespaceArray?: string[]): string | null | undefined;
|
|
27
|
+
export declare function opcuaJsonDecodeByteString(pojo: string | null): Buffer | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.opcuaJsonEncodeByteString = opcuaJsonEncodeByteString;
|
|
4
|
+
exports.opcuaJsonDecodeByteString = opcuaJsonDecodeByteString;
|
|
5
|
+
const json_encoding_scheme_js_1 = require("./json_encoding_scheme.js");
|
|
6
|
+
function opcuaJsonEncodeByteString(byteString, scheme, _namespaceArray) {
|
|
7
|
+
if (!byteString) {
|
|
8
|
+
if (scheme === json_encoding_scheme_js_1.JsonEncodingScheme.Compact) {
|
|
9
|
+
return undefined; // Compact encoding does not encode null values
|
|
10
|
+
}
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
if (scheme === json_encoding_scheme_js_1.JsonEncodingScheme.Compact && byteString.length === 0) {
|
|
14
|
+
return undefined; // Compact encoding does not encode empty ByteString
|
|
15
|
+
}
|
|
16
|
+
if (scheme === json_encoding_scheme_js_1.JsonEncodingScheme.Verbose && byteString.length === 0) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return byteString.toString("base64");
|
|
20
|
+
}
|
|
21
|
+
function opcuaJsonDecodeByteString(pojo) {
|
|
22
|
+
if (!pojo) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return Buffer.from(pojo, "base64");
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=json_basic_encoding_decoding_byte_string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json_basic_encoding_decoding_byte_string.js","sourceRoot":"","sources":["../source/json_basic_encoding_decoding_byte_string.ts"],"names":[],"mappings":";;AA0BA,8DAkBC;AAED,8DAKC;AA3BD,uEAA+D;AAE/D,SAAgB,yBAAyB,CACrC,UAA6B,EAC7B,MAA0B,EAC1B,eAA0B;IAE1B,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,IAAI,MAAM,KAAK,4CAAkB,CAAC,OAAO,EAAE,CAAC;YACxC,OAAO,SAAS,CAAC,CAAC,+CAA+C;QACrE,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,MAAM,KAAK,4CAAkB,CAAC,OAAO,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnE,OAAO,SAAS,CAAC,CAAC,oDAAoD;IAC1E,CAAC;IACD,IAAI,MAAM,KAAK,4CAAkB,CAAC,OAAO,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnE,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,yBAAyB,CAAC,IAAmB;IACzD,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
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
|
+
import type { UInt16 } from "node-opcua-basic-types";
|
|
25
|
+
import { DataValue } from "node-opcua-data-value";
|
|
26
|
+
import { DataSetFieldContentMask } from "node-opcua-types";
|
|
27
|
+
import type { ExtensionObjectBuilder } from "./json_basic_encoding_body_functor.js";
|
|
28
|
+
import { type StatusCodeJSON } from "./json_basic_encoding_decoding_statuscode.js";
|
|
29
|
+
import { type VariantJSON104, type VariantJSON105, type VariantJSONBody } from "./json_basic_encoding_decoding_variant.js";
|
|
30
|
+
import { JsonEncoderMode104, JsonEncoderMode105, JsonEncodingScheme } from "./json_encoding_scheme.js";
|
|
31
|
+
export interface DataValueStatusAndTimestamps {
|
|
32
|
+
StatusCode?: StatusCodeJSON | number;
|
|
33
|
+
/**
|
|
34
|
+
* The source timestamp associated with the value.
|
|
35
|
+
* Not encoded if the value is DateTime.MinValue.
|
|
36
|
+
*/
|
|
37
|
+
SourceTimestamp?: Date;
|
|
38
|
+
/**
|
|
39
|
+
* The number of 10 Picosecond intervals for the SourceTimestamp.
|
|
40
|
+
* Not encoded if the value is 0.
|
|
41
|
+
*/
|
|
42
|
+
SourcePicoseconds?: UInt16;
|
|
43
|
+
/**
|
|
44
|
+
* The server timestamp associated with the value.
|
|
45
|
+
* Not encoded if the value is DateTime.MinValue.
|
|
46
|
+
*/
|
|
47
|
+
ServerTimestamp?: Date;
|
|
48
|
+
/**
|
|
49
|
+
* The number of 10 Picosecond intervals for the ServerTimestamp.
|
|
50
|
+
* Not encoded if the value is 0.
|
|
51
|
+
*/
|
|
52
|
+
ServerPicoseconds?: UInt16;
|
|
53
|
+
}
|
|
54
|
+
export interface DataValueJSON104 extends DataValueStatusAndTimestamps {
|
|
55
|
+
Value?: VariantJSON104 | null;
|
|
56
|
+
}
|
|
57
|
+
export interface DataValueJSON105 extends VariantJSON105, DataValueStatusAndTimestamps {
|
|
58
|
+
}
|
|
59
|
+
export type DataValueJSON = DataValueJSON105;
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param dataValue
|
|
63
|
+
* @param mask
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
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;
|
|
68
|
+
/**
|
|
69
|
+
*
|
|
70
|
+
* @param dataValue
|
|
71
|
+
* @param mask
|
|
72
|
+
* @returns
|
|
73
|
+
*/
|
|
74
|
+
export declare function opcuaJsonEncodeDataValueMQTT105(dataValue: DataValue, mode: JsonEncoderMode105, mask: DataSetFieldContentMask, namespaceArray?: string[]): VariantJSONBody | DataValueJSON105 | null;
|
|
75
|
+
export declare function opcuaJsonEncodeDataValue104(dataValue: DataValue, mode: JsonEncoderMode104, namespaceArray: string[]): DataValueJSON104;
|
|
76
|
+
export declare function opcuaJsonEncodeDataValue105(dataValue: DataValue, mode: JsonEncoderMode105, namespaceArray: string[]): DataValueJSON105;
|
|
77
|
+
export declare function opcuaJsonEncodeDataValue(dataValue: DataValue, mode: JsonEncodingScheme.Compact | JsonEncodingScheme.Verbose, namespaceArray: string[]): DataValueJSON105;
|
|
78
|
+
export declare function opcuaJsonEncodeDataValue(dataValue: DataValue, mode: JsonEncodingScheme.DeprecatedNonReversible | JsonEncodingScheme.DeprecatedReversible, namespaceArray: string[]): DataValueJSON104;
|
|
79
|
+
export declare function opcuaJsonDecodeDataValue104(pojo: DataValueJSON104 | null | undefined, builder: ExtensionObjectBuilder, namespaceArray: string[]): DataValue;
|
|
80
|
+
export declare function opcuaJsonDecodeDataValue105(pojo: DataValueJSON105 | null | undefined, builder: ExtensionObjectBuilder, namespaceArray: string[]): DataValue;
|
|
81
|
+
export declare function opcuaJsonDecodeDataValue(pojo: DataValueJSON104 | DataValueJSON105 | null | undefined, builder: ExtensionObjectBuilder, namespaceArray: string[]): DataValue;
|