node-opcua-data-model 2.169.0 → 2.170.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/qualified_name.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { type UAString, type UInt16 } from "node-opcua-basic-types";
|
|
2
|
+
import type { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
3
|
+
import { BaseUAObject, type IStructuredTypeSchema } from "node-opcua-factory";
|
|
4
|
+
import { type ExpandedNodeId } from "node-opcua-nodeid";
|
|
5
5
|
export declare const schemaQualifiedName: IStructuredTypeSchema;
|
|
6
6
|
export interface QualifiedNameOptions {
|
|
7
7
|
namespaceIndex?: UInt16;
|
package/dist/qualified_name.js
CHANGED
|
@@ -9,9 +9,9 @@ exports.decodeQualifiedName = decodeQualifiedName;
|
|
|
9
9
|
* @module node-opcua-data-model
|
|
10
10
|
*/
|
|
11
11
|
const node_opcua_assert_1 = require("node-opcua-assert");
|
|
12
|
+
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
12
13
|
const node_opcua_factory_1 = require("node-opcua-factory");
|
|
13
14
|
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
14
|
-
const node_opcua_basic_types_1 = require("node-opcua-basic-types");
|
|
15
15
|
exports.schemaQualifiedName = (0, node_opcua_factory_1.buildStructuredType)({
|
|
16
16
|
baseType: "BaseUAObject",
|
|
17
17
|
name: "QualifiedName",
|
|
@@ -73,7 +73,7 @@ class QualifiedName extends node_opcua_factory_1.BaseUAObject {
|
|
|
73
73
|
}
|
|
74
74
|
toString() {
|
|
75
75
|
if (this.namespaceIndex) {
|
|
76
|
-
return this.namespaceIndex
|
|
76
|
+
return `${this.namespaceIndex}:${this.name}`;
|
|
77
77
|
}
|
|
78
78
|
return this.name || "<null>";
|
|
79
79
|
}
|
|
@@ -90,7 +90,7 @@ QualifiedName.prototype.schema = QualifiedName.schema;
|
|
|
90
90
|
// xx return !this.name || this.name.length === 0;
|
|
91
91
|
// xx}
|
|
92
92
|
function isInteger(value) {
|
|
93
|
-
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
|
|
93
|
+
return typeof value === "number" && Number.isFinite(value) && Math.floor(value) === value;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
|
|
@@ -105,8 +105,8 @@ function isInteger(value) {
|
|
|
105
105
|
function stringToQualifiedName(value) {
|
|
106
106
|
const splitArray = value.split(":");
|
|
107
107
|
let namespaceIndex = 0;
|
|
108
|
-
if (!isNaN(parseFloat(splitArray[0])) &&
|
|
109
|
-
isFinite(parseInt(splitArray[0], 10)) &&
|
|
108
|
+
if (!Number.isNaN(parseFloat(splitArray[0])) &&
|
|
109
|
+
Number.isFinite(parseInt(splitArray[0], 10)) &&
|
|
110
110
|
isInteger(parseFloat(splitArray[0])) &&
|
|
111
111
|
splitArray.length > 1) {
|
|
112
112
|
namespaceIndex = parseInt(splitArray[0], 10);
|
|
@@ -126,8 +126,8 @@ function coerceQualifiedName(value) {
|
|
|
126
126
|
return stringToQualifiedName(value);
|
|
127
127
|
}
|
|
128
128
|
else {
|
|
129
|
-
(0, node_opcua_assert_1.assert)(Object.
|
|
130
|
-
(0, node_opcua_assert_1.assert)(Object.
|
|
129
|
+
(0, node_opcua_assert_1.assert)(Object.hasOwn(value, "namespaceIndex"));
|
|
130
|
+
(0, node_opcua_assert_1.assert)(Object.hasOwn(value, "name"));
|
|
131
131
|
return new QualifiedName(value);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qualified_name.js","sourceRoot":"","sources":["../source/qualified_name.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"qualified_name.js","sourceRoot":"","sources":["../source/qualified_name.ts"],"names":[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AAC;SAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACnC,OAAO,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACJ,IAAA,0BAAM,EAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,gBAAgB,CAAC,CAAC,CAAC;QAC/C,IAAA,0BAAM,EAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;QACrC,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;AACL,CAAC;AAED,IAAA,kDAA6B,EAAC,aAAa,CAAC,CAAC;AAE7C,SAAgB,mBAAmB,CAAC,KAAoB,EAAE,MAA0B;IAChF,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AAED,SAAgB,mBAAmB,CAAC,MAAoB,EAAE,KAAqB;IAC3E,KAAK,GAAG,KAAK,IAAI,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC;IACzC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-data-model",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.170.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module data-model",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"internet of things"
|
|
41
41
|
],
|
|
42
42
|
"homepage": "http://node-opcua.github.io/",
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "40629feaff284ba70596149e58b3cc2a7a0e8f68",
|
|
44
44
|
"files": [
|
|
45
45
|
"dist",
|
|
46
46
|
"source"
|
package/source/qualified_name.ts
CHANGED
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
* @module node-opcua-data-model
|
|
3
3
|
*/
|
|
4
4
|
import { assert } from "node-opcua-assert";
|
|
5
|
+
import {
|
|
6
|
+
decodeUAString,
|
|
7
|
+
decodeUInt16,
|
|
8
|
+
encodeUAString,
|
|
9
|
+
encodeUInt16,
|
|
10
|
+
type UAString,
|
|
11
|
+
type UInt16,
|
|
12
|
+
} from "node-opcua-basic-types";
|
|
13
|
+
import type { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
5
14
|
import {
|
|
6
15
|
BaseUAObject,
|
|
7
16
|
buildStructuredType,
|
|
8
17
|
check_options_correctness_against_schema,
|
|
9
|
-
|
|
18
|
+
FieldCategory,
|
|
19
|
+
type IStructuredTypeSchema,
|
|
10
20
|
parameters,
|
|
11
21
|
registerSpecialVariantEncoder,
|
|
12
|
-
IStructuredTypeSchema,
|
|
13
|
-
FieldCategory
|
|
14
22
|
} from "node-opcua-factory";
|
|
23
|
+
import { type ExpandedNodeId, makeExpandedNodeId } from "node-opcua-nodeid";
|
|
15
24
|
|
|
16
|
-
import { BinaryStream, OutputBinaryStream } from "node-opcua-binary-stream";
|
|
17
|
-
import { ExpandedNodeId, makeExpandedNodeId } from "node-opcua-nodeid";
|
|
18
|
-
|
|
19
|
-
import { decodeUAString, decodeUInt16, encodeUAString, encodeUInt16, Int32, UAString, UInt16 } from "node-opcua-basic-types";
|
|
20
25
|
|
|
21
26
|
export const schemaQualifiedName = buildStructuredType({
|
|
22
27
|
baseType: "BaseUAObject",
|
|
@@ -91,7 +96,7 @@ export class QualifiedName extends BaseUAObject {
|
|
|
91
96
|
|
|
92
97
|
public toString(): string {
|
|
93
98
|
if (this.namespaceIndex) {
|
|
94
|
-
return this.namespaceIndex
|
|
99
|
+
return `${this.namespaceIndex}:${this.name}`;
|
|
95
100
|
}
|
|
96
101
|
return this.name || "<null>";
|
|
97
102
|
}
|
|
@@ -114,8 +119,8 @@ export type QualifiedNameLike = QualifiedNameOptions | string;
|
|
|
114
119
|
// xx return !this.name || this.name.length === 0;
|
|
115
120
|
// xx}
|
|
116
121
|
|
|
117
|
-
function isInteger(value:
|
|
118
|
-
return typeof value === "number" && isFinite(value) && Math.floor(value) === value;
|
|
122
|
+
function isInteger(value: unknown): boolean {
|
|
123
|
+
return typeof value === "number" && Number.isFinite(value) && Math.floor(value) === value;
|
|
119
124
|
}
|
|
120
125
|
|
|
121
126
|
/**
|
|
@@ -133,8 +138,8 @@ export function stringToQualifiedName(value: string): QualifiedName {
|
|
|
133
138
|
let namespaceIndex = 0;
|
|
134
139
|
|
|
135
140
|
if (
|
|
136
|
-
!isNaN(parseFloat(splitArray[0])) &&
|
|
137
|
-
isFinite(parseInt(splitArray[0], 10)) &&
|
|
141
|
+
!Number.isNaN(parseFloat(splitArray[0])) &&
|
|
142
|
+
Number.isFinite(parseInt(splitArray[0], 10)) &&
|
|
138
143
|
isInteger(parseFloat(splitArray[0])) &&
|
|
139
144
|
splitArray.length > 1
|
|
140
145
|
) {
|
|
@@ -156,8 +161,8 @@ export function coerceQualifiedName(value: null | QualifiedNameLike): QualifiedN
|
|
|
156
161
|
} else if (typeof value === "string") {
|
|
157
162
|
return stringToQualifiedName(value);
|
|
158
163
|
} else {
|
|
159
|
-
assert(Object.
|
|
160
|
-
assert(Object.
|
|
164
|
+
assert(Object.hasOwn(value, "namespaceIndex"));
|
|
165
|
+
assert(Object.hasOwn(value, "name"));
|
|
161
166
|
return new QualifiedName(value);
|
|
162
167
|
}
|
|
163
168
|
}
|