opcjs-base 0.1.20-alpha → 0.1.29-alpha
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/index.cjs +418 -395
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -31
- package/dist/index.d.ts +42 -31
- package/dist/index.js +418 -396
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
|
|
3
3
|
var fastXmlParser = require('fast-xml-parser');
|
|
4
4
|
|
|
5
|
+
// src/types/expandedNodeId.ts
|
|
6
|
+
var ExpandedNodeId = class {
|
|
7
|
+
/** The wrapped NodeId. */
|
|
8
|
+
nodeId;
|
|
9
|
+
/** The server index (optional, for cross-server references). */
|
|
10
|
+
serverIndex;
|
|
11
|
+
/** The namespace URI (optional, alternative to the namespace index on nodeId). */
|
|
12
|
+
namespaceUri;
|
|
13
|
+
/**
|
|
14
|
+
* Create a new ExpandedNodeId.
|
|
15
|
+
*
|
|
16
|
+
* @param nodeId - The wrapped NodeId
|
|
17
|
+
* @param namespaceUri - Optional namespace URI
|
|
18
|
+
* @param serverIndex - Optional server index
|
|
19
|
+
*/
|
|
20
|
+
constructor(nodeId, namespaceUri, serverIndex) {
|
|
21
|
+
this.nodeId = nodeId;
|
|
22
|
+
this.namespaceUri = namespaceUri;
|
|
23
|
+
this.serverIndex = serverIndex;
|
|
24
|
+
}
|
|
25
|
+
/** Convert ExpandedNodeId to string representation. */
|
|
26
|
+
toString() {
|
|
27
|
+
let result = "";
|
|
28
|
+
if (this.serverIndex !== void 0) {
|
|
29
|
+
result += `svr=${this.serverIndex};`;
|
|
30
|
+
}
|
|
31
|
+
if (this.namespaceUri !== void 0) {
|
|
32
|
+
result += `nsu=${this.namespaceUri};`;
|
|
33
|
+
}
|
|
34
|
+
result += this.nodeId.toString();
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
5
39
|
// src/types/nodeId.ts
|
|
6
40
|
var NodeIdType = /* @__PURE__ */ ((NodeIdType2) => {
|
|
7
41
|
NodeIdType2[NodeIdType2["Numeric"] = 0] = "Numeric";
|
|
@@ -172,47 +206,6 @@ var NodeId = class _NodeId {
|
|
|
172
206
|
}
|
|
173
207
|
};
|
|
174
208
|
|
|
175
|
-
// src/types/expandedNodeId.ts
|
|
176
|
-
var ExpandedNodeId = class extends NodeId {
|
|
177
|
-
/**
|
|
178
|
-
* The server index (optional, for cross-server references)
|
|
179
|
-
*/
|
|
180
|
-
serverIndex;
|
|
181
|
-
/**
|
|
182
|
-
* The namespace URI (optional, alternative to namespace index)
|
|
183
|
-
*/
|
|
184
|
-
namespaceUri;
|
|
185
|
-
/**
|
|
186
|
-
* Create a new ExpandedNodeId
|
|
187
|
-
*
|
|
188
|
-
* @param namespace - The namespace index
|
|
189
|
-
* @param identifier - The identifier
|
|
190
|
-
* @param namespaceUri - Optional namespace URI
|
|
191
|
-
* @param serverIndex - Optional server index
|
|
192
|
-
*/
|
|
193
|
-
constructor(namespace = 0, identifier = 0, namespaceUri, serverIndex) {
|
|
194
|
-
super(namespace, identifier);
|
|
195
|
-
this.namespaceUri = namespaceUri;
|
|
196
|
-
this.serverIndex = serverIndex;
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Convert ExpandedNodeId to string representation
|
|
200
|
-
*
|
|
201
|
-
* @returns String representation of the ExpandedNodeId
|
|
202
|
-
*/
|
|
203
|
-
toString() {
|
|
204
|
-
let result = "";
|
|
205
|
-
if (this.serverIndex !== void 0) {
|
|
206
|
-
result += `svr=${this.serverIndex};`;
|
|
207
|
-
}
|
|
208
|
-
if (this.namespaceUri !== void 0) {
|
|
209
|
-
result += `nsu=${this.namespaceUri};`;
|
|
210
|
-
}
|
|
211
|
-
result += super.toString();
|
|
212
|
-
return result;
|
|
213
|
-
}
|
|
214
|
-
};
|
|
215
|
-
|
|
216
209
|
// src/codecs/encoder.ts
|
|
217
210
|
var Encoder = class {
|
|
218
211
|
encoders = /* @__PURE__ */ new Map();
|
|
@@ -230,7 +223,7 @@ var Encoder = class {
|
|
|
230
223
|
}
|
|
231
224
|
const writer = writerFactory();
|
|
232
225
|
const encodingId = value.getBinaryEncodingId();
|
|
233
|
-
const eid = new ExpandedNodeId(0, encodingId);
|
|
226
|
+
const eid = new ExpandedNodeId(new NodeId(0, encodingId));
|
|
234
227
|
writer.writeExpandedNodeId(eid);
|
|
235
228
|
const typeId = value.getTypeId();
|
|
236
229
|
const encodingFunction = this.encoders.get(typeId);
|
|
@@ -277,7 +270,7 @@ var Decoder = class {
|
|
|
277
270
|
}
|
|
278
271
|
const reader = readerFactory(data);
|
|
279
272
|
const eid = reader.readExpandedNodeId();
|
|
280
|
-
return this.decodeWithEncodingId(eid.identifier, reader);
|
|
273
|
+
return this.decodeWithEncodingId(eid.nodeId.identifier, reader);
|
|
281
274
|
}
|
|
282
275
|
decodeWithEncodingId(encodingId, reader) {
|
|
283
276
|
const decodingInfo = this.encodingIdMap.get(encodingId);
|
|
@@ -493,7 +486,7 @@ function decodeExpandedNodeId(reader) {
|
|
|
493
486
|
if (hasServerIndex) {
|
|
494
487
|
serverIndex = reader.readUInt32();
|
|
495
488
|
}
|
|
496
|
-
return new ExpandedNodeId(nodeId
|
|
489
|
+
return new ExpandedNodeId(nodeId, namespaceUri, serverIndex);
|
|
497
490
|
}
|
|
498
491
|
function encodeExpandedNodeId(writer, value) {
|
|
499
492
|
let extraFlags = 0;
|
|
@@ -504,9 +497,9 @@ function encodeExpandedNodeId(writer, value) {
|
|
|
504
497
|
extraFlags |= ExpandedNodeIdMask.ServerIndexFlag;
|
|
505
498
|
}
|
|
506
499
|
if (extraFlags === 0) {
|
|
507
|
-
encodeNodeId(writer, value);
|
|
500
|
+
encodeNodeId(writer, value.nodeId);
|
|
508
501
|
} else {
|
|
509
|
-
encodeNodeIdWithExtraFlags(writer, value, extraFlags);
|
|
502
|
+
encodeNodeIdWithExtraFlags(writer, value.nodeId, extraFlags);
|
|
510
503
|
}
|
|
511
504
|
if (value.namespaceUri !== void 0) {
|
|
512
505
|
writer.writeString(value.namespaceUri);
|
|
@@ -727,7 +720,7 @@ function encodeLocalizedText(writer, value) {
|
|
|
727
720
|
// src/types/extensionObject.ts
|
|
728
721
|
var ExtensionObject = class _ExtensionObject {
|
|
729
722
|
/**
|
|
730
|
-
* The NodeId that identifies the type of structure encoded in the body.
|
|
723
|
+
* The NodeId (or ExpandedNodeId) that identifies the type of structure encoded in the body.
|
|
731
724
|
*/
|
|
732
725
|
typeId;
|
|
733
726
|
/**
|
|
@@ -1056,7 +1049,7 @@ function decodeExtensionObject(reader, decoder) {
|
|
|
1056
1049
|
}
|
|
1057
1050
|
function encodeExtensionObject(writer, value, encoder) {
|
|
1058
1051
|
const typeId = value.typeId;
|
|
1059
|
-
if (
|
|
1052
|
+
if (typeId instanceof ExpandedNodeId) {
|
|
1060
1053
|
encodeExpandedNodeId(writer, typeId);
|
|
1061
1054
|
} else {
|
|
1062
1055
|
encodeNodeId(writer, typeId);
|
|
@@ -1372,7 +1365,7 @@ function StatusCodeToString(statusCode) {
|
|
|
1372
1365
|
if (statusCode === void 0) {
|
|
1373
1366
|
return "Unknown";
|
|
1374
1367
|
}
|
|
1375
|
-
const baseCode = statusCode & 4294901760;
|
|
1368
|
+
const baseCode = (statusCode & 4294901760) >>> 0;
|
|
1376
1369
|
const name = Object.entries(StatusCode).find(([, v]) => v === baseCode)?.[0];
|
|
1377
1370
|
return name ?? `0x${baseCode.toString(16).toUpperCase().padStart(8, "0")}`;
|
|
1378
1371
|
}
|
|
@@ -1394,6 +1387,9 @@ function StatusCodeGetFlagBits(statusCode) {
|
|
|
1394
1387
|
LimitConstant: limitBits === 3
|
|
1395
1388
|
};
|
|
1396
1389
|
}
|
|
1390
|
+
function StatusCodeIs(statusCode, expected) {
|
|
1391
|
+
return (statusCode & 4294901760) >>> 0 === expected;
|
|
1392
|
+
}
|
|
1397
1393
|
|
|
1398
1394
|
// src/types/dataValue.ts
|
|
1399
1395
|
var DataValue = class _DataValue {
|
|
@@ -1624,147 +1620,416 @@ function encodeDataValue(writer, value, encoder) {
|
|
|
1624
1620
|
}
|
|
1625
1621
|
}
|
|
1626
1622
|
|
|
1627
|
-
// src/types/
|
|
1628
|
-
var
|
|
1623
|
+
// src/types/xmlElement.ts
|
|
1624
|
+
var XmlElement = class _XmlElement {
|
|
1629
1625
|
/**
|
|
1630
|
-
* The
|
|
1626
|
+
* The XML string content
|
|
1631
1627
|
*/
|
|
1632
|
-
|
|
1628
|
+
content;
|
|
1633
1629
|
/**
|
|
1634
|
-
*
|
|
1630
|
+
* Create a new XmlElement
|
|
1631
|
+
*
|
|
1632
|
+
* @param content - The XML string content
|
|
1635
1633
|
*/
|
|
1636
|
-
|
|
1634
|
+
constructor(content = "") {
|
|
1635
|
+
this.content = content;
|
|
1636
|
+
}
|
|
1637
1637
|
/**
|
|
1638
|
-
*
|
|
1639
|
-
*
|
|
1640
|
-
*
|
|
1638
|
+
* Get the XML string content
|
|
1639
|
+
*
|
|
1640
|
+
* @returns The XML string
|
|
1641
1641
|
*/
|
|
1642
|
-
|
|
1642
|
+
toString() {
|
|
1643
|
+
return this.content;
|
|
1644
|
+
}
|
|
1643
1645
|
/**
|
|
1644
|
-
*
|
|
1646
|
+
* Get the length of the XML string
|
|
1645
1647
|
*
|
|
1646
|
-
* @returns
|
|
1648
|
+
* @returns The number of characters
|
|
1647
1649
|
*/
|
|
1648
|
-
|
|
1649
|
-
return this.
|
|
1650
|
+
get length() {
|
|
1651
|
+
return this.content.length;
|
|
1650
1652
|
}
|
|
1651
1653
|
/**
|
|
1652
|
-
*
|
|
1654
|
+
* Escape special XML characters in text content
|
|
1653
1655
|
*
|
|
1654
|
-
* @
|
|
1656
|
+
* @param text - Text to escape
|
|
1657
|
+
* @returns Escaped text safe for use in XML
|
|
1658
|
+
*
|
|
1659
|
+
* @example
|
|
1660
|
+
* ```typescript
|
|
1661
|
+
* XmlElement.escape("Hello & <World>"); // "Hello & <World>"
|
|
1662
|
+
* ```
|
|
1655
1663
|
*/
|
|
1656
|
-
|
|
1657
|
-
return
|
|
1664
|
+
static escape(text) {
|
|
1665
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1658
1666
|
}
|
|
1659
1667
|
/**
|
|
1660
|
-
*
|
|
1668
|
+
* Unescape XML entities to plain text
|
|
1661
1669
|
*
|
|
1662
|
-
* @
|
|
1670
|
+
* @param xml - XML text with entities
|
|
1671
|
+
* @returns Unescaped text
|
|
1672
|
+
*
|
|
1673
|
+
* @example
|
|
1674
|
+
* ```typescript
|
|
1675
|
+
* XmlElement.unescape("Hello & <World>"); // "Hello & <World>"
|
|
1676
|
+
* ```
|
|
1663
1677
|
*/
|
|
1664
|
-
|
|
1665
|
-
return
|
|
1678
|
+
static unescape(xml) {
|
|
1679
|
+
return xml.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
1666
1680
|
}
|
|
1667
1681
|
/**
|
|
1668
|
-
*
|
|
1682
|
+
* Create a simple XML element
|
|
1669
1683
|
*
|
|
1670
|
-
* @
|
|
1684
|
+
* @param tagName - The XML tag name
|
|
1685
|
+
* @param content - The text content (will be escaped)
|
|
1686
|
+
* @param attributes - Optional attributes object
|
|
1687
|
+
* @returns XmlElement
|
|
1688
|
+
*
|
|
1689
|
+
* @example
|
|
1690
|
+
* ```typescript
|
|
1691
|
+
* const xml = XmlElement.create("Temperature", "25.5", { unit: "C" });
|
|
1692
|
+
* // "<Temperature unit=\"C\">25.5</Temperature>"
|
|
1693
|
+
* ```
|
|
1671
1694
|
*/
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1695
|
+
static create(tagName, content = "", attributes) {
|
|
1696
|
+
let attrStr = "";
|
|
1697
|
+
if (attributes) {
|
|
1698
|
+
attrStr = Object.entries(attributes).map(([key, value]) => ` ${key}="${_XmlElement.escape(value)}"`).join("");
|
|
1675
1699
|
}
|
|
1676
|
-
|
|
1700
|
+
const escapedContent = _XmlElement.escape(content);
|
|
1701
|
+
const xmlString = `<${tagName}${attrStr}>${escapedContent}</${tagName}>`;
|
|
1702
|
+
return new _XmlElement(xmlString);
|
|
1677
1703
|
}
|
|
1678
1704
|
/**
|
|
1679
|
-
*
|
|
1705
|
+
* Create an empty XmlElement
|
|
1680
1706
|
*
|
|
1681
|
-
* @
|
|
1682
|
-
* @returns True if variants are equal
|
|
1707
|
+
* @returns Empty XmlElement
|
|
1683
1708
|
*/
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
return false;
|
|
1687
|
-
}
|
|
1688
|
-
if (this.arrayDimensions !== void 0 || other.arrayDimensions !== void 0) {
|
|
1689
|
-
if (this.arrayDimensions === void 0 || other.arrayDimensions === void 0) {
|
|
1690
|
-
return false;
|
|
1691
|
-
}
|
|
1692
|
-
if (this.arrayDimensions.length !== other.arrayDimensions.length) {
|
|
1693
|
-
return false;
|
|
1694
|
-
}
|
|
1695
|
-
for (let i = 0; i < this.arrayDimensions.length; i++) {
|
|
1696
|
-
if (this.arrayDimensions[i] !== other.arrayDimensions[i]) {
|
|
1697
|
-
return false;
|
|
1698
|
-
}
|
|
1699
|
-
}
|
|
1700
|
-
}
|
|
1701
|
-
return JSON.stringify(this.value) === JSON.stringify(other.value);
|
|
1709
|
+
static empty() {
|
|
1710
|
+
return new _XmlElement("");
|
|
1702
1711
|
}
|
|
1703
1712
|
/**
|
|
1704
|
-
*
|
|
1713
|
+
* Check equality with another XmlElement
|
|
1705
1714
|
*
|
|
1706
|
-
* @
|
|
1715
|
+
* @param other - The other XmlElement
|
|
1716
|
+
* @returns true if both contain the same XML string
|
|
1707
1717
|
*/
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
if (this.isNull()) {
|
|
1711
|
-
return "Variant(Null)";
|
|
1712
|
-
}
|
|
1713
|
-
if (this.isArray()) {
|
|
1714
|
-
const dimStr = this.arrayDimensions ? `[${this.arrayDimensions.join(",")}]` : "[?]";
|
|
1715
|
-
return `Variant(${typeName}${dimStr})`;
|
|
1716
|
-
}
|
|
1717
|
-
return `Variant(${typeName}: ${String(this.value)})`;
|
|
1718
|
+
equals(other) {
|
|
1719
|
+
return this.content === other.content;
|
|
1718
1720
|
}
|
|
1721
|
+
};
|
|
1722
|
+
|
|
1723
|
+
// src/types/diagnosticInfo.ts
|
|
1724
|
+
var DiagnosticInfo = class _DiagnosticInfo {
|
|
1719
1725
|
/**
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
1722
|
-
* Uses the `.type` discriminant on tagged primitives to determine the
|
|
1723
|
-
* VariantType exactly — no heuristic inference based on value ranges.
|
|
1724
|
-
*
|
|
1725
|
-
* @param value - A typed OPC UA primitive value.
|
|
1726
|
-
* @returns A new Variant wrapping the inner value with the correct VariantType.
|
|
1726
|
+
* Index into a string table for the symbolic identifier.
|
|
1727
|
+
* The symbolic id is used to identify an error condition in a vendor-specific way.
|
|
1727
1728
|
*/
|
|
1728
|
-
|
|
1729
|
-
if (value === null || value === void 0) {
|
|
1730
|
-
return _Variant.newNull();
|
|
1731
|
-
}
|
|
1732
|
-
if (typeof value === "boolean") {
|
|
1733
|
-
return new _Variant(1 /* Boolean */, value);
|
|
1734
|
-
}
|
|
1735
|
-
if (typeof value === "string") {
|
|
1736
|
-
return new _Variant(12 /* String */, value);
|
|
1737
|
-
}
|
|
1738
|
-
if (value instanceof Uint8Array) {
|
|
1739
|
-
return new _Variant(15 /* ByteString */, value);
|
|
1740
|
-
}
|
|
1741
|
-
if (value instanceof Date) {
|
|
1742
|
-
return new _Variant(13 /* DateTime */, value);
|
|
1743
|
-
}
|
|
1744
|
-
if (typeof value === "object" && "type" in value) {
|
|
1745
|
-
const tagged = value;
|
|
1746
|
-
return new _Variant(tagged.type, tagged.value);
|
|
1747
|
-
}
|
|
1748
|
-
throw new Error(
|
|
1749
|
-
`newFrom: unhandled UaPrimitive value: ${JSON.stringify(value)}`
|
|
1750
|
-
);
|
|
1751
|
-
}
|
|
1729
|
+
symbolicId;
|
|
1752
1730
|
/**
|
|
1753
|
-
*
|
|
1754
|
-
*
|
|
1755
|
-
* @returns A new Variant with undefined value
|
|
1731
|
+
* Index into a string table for the namespace URI.
|
|
1732
|
+
* Identifies the namespace that defines the symbolicId.
|
|
1756
1733
|
*/
|
|
1757
|
-
|
|
1758
|
-
return new _Variant(0 /* Null */);
|
|
1759
|
-
}
|
|
1734
|
+
namespaceUri;
|
|
1760
1735
|
/**
|
|
1761
|
-
*
|
|
1736
|
+
* Index into a string table for the localized text.
|
|
1737
|
+
* Contains a human-readable description of the error.
|
|
1738
|
+
*/
|
|
1739
|
+
localizedText;
|
|
1740
|
+
/**
|
|
1741
|
+
* Index into a string table for the locale.
|
|
1742
|
+
* Identifies the locale used for the localizedText.
|
|
1743
|
+
*/
|
|
1744
|
+
locale;
|
|
1745
|
+
/**
|
|
1746
|
+
* Additional debugging/diagnostic information.
|
|
1747
|
+
* Not intended for display to end users.
|
|
1748
|
+
*/
|
|
1749
|
+
additionalInfo;
|
|
1750
|
+
/**
|
|
1751
|
+
* StatusCode from a nested operation.
|
|
1752
|
+
* Used when the diagnostic info relates to a nested operation result.
|
|
1753
|
+
*/
|
|
1754
|
+
innerStatusCode;
|
|
1755
|
+
/**
|
|
1756
|
+
* Nested DiagnosticInfo.
|
|
1757
|
+
* Allows for recursive diagnostic information structures.
|
|
1758
|
+
*/
|
|
1759
|
+
innerDiagnosticInfo;
|
|
1760
|
+
/**
|
|
1761
|
+
* Creates a new DiagnosticInfo.
|
|
1762
1762
|
*
|
|
1763
|
-
* @param
|
|
1764
|
-
* @param value - The scalar or array value
|
|
1765
|
-
* @param arrayDimensions - Optional array dimensions for structured arrays
|
|
1763
|
+
* @param options - Optional diagnostic information fields
|
|
1766
1764
|
*/
|
|
1767
|
-
constructor(
|
|
1765
|
+
constructor(options = {}) {
|
|
1766
|
+
this.symbolicId = options.symbolicId;
|
|
1767
|
+
this.namespaceUri = options.namespaceUri;
|
|
1768
|
+
this.localizedText = options.localizedText;
|
|
1769
|
+
this.locale = options.locale;
|
|
1770
|
+
this.additionalInfo = options.additionalInfo;
|
|
1771
|
+
this.innerStatusCode = options.innerStatusCode;
|
|
1772
|
+
this.innerDiagnosticInfo = options.innerDiagnosticInfo;
|
|
1773
|
+
}
|
|
1774
|
+
/**
|
|
1775
|
+
* Creates an empty DiagnosticInfo with no fields set.
|
|
1776
|
+
*
|
|
1777
|
+
* @returns A new DiagnosticInfo with all fields undefined
|
|
1778
|
+
*/
|
|
1779
|
+
static createEmpty() {
|
|
1780
|
+
return new _DiagnosticInfo({});
|
|
1781
|
+
}
|
|
1782
|
+
/**
|
|
1783
|
+
* Creates a DiagnosticInfo with just additional info text.
|
|
1784
|
+
*
|
|
1785
|
+
* @param additionalInfo - The diagnostic information text
|
|
1786
|
+
* @returns A new DiagnosticInfo with only additionalInfo set
|
|
1787
|
+
*/
|
|
1788
|
+
static fromText(additionalInfo) {
|
|
1789
|
+
return new _DiagnosticInfo({ additionalInfo });
|
|
1790
|
+
}
|
|
1791
|
+
/**
|
|
1792
|
+
* Checks if this DiagnosticInfo is empty (all fields undefined).
|
|
1793
|
+
*
|
|
1794
|
+
* @returns True if all fields are undefined
|
|
1795
|
+
*/
|
|
1796
|
+
isEmpty() {
|
|
1797
|
+
return this.symbolicId === void 0 && this.namespaceUri === void 0 && this.localizedText === void 0 && this.locale === void 0 && this.additionalInfo === void 0 && this.innerStatusCode === void 0 && this.innerDiagnosticInfo === void 0;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Checks if this DiagnosticInfo has nested diagnostic information.
|
|
1801
|
+
*
|
|
1802
|
+
* @returns True if innerDiagnosticInfo is not undefined
|
|
1803
|
+
*/
|
|
1804
|
+
hasInnerDiagnostics() {
|
|
1805
|
+
return this.innerDiagnosticInfo !== void 0;
|
|
1806
|
+
}
|
|
1807
|
+
/**
|
|
1808
|
+
* Gets the depth of nested diagnostic information.
|
|
1809
|
+
*
|
|
1810
|
+
* @returns The nesting depth (0 if no inner diagnostics)
|
|
1811
|
+
*/
|
|
1812
|
+
getDepth() {
|
|
1813
|
+
if (this.innerDiagnosticInfo === void 0) {
|
|
1814
|
+
return 0;
|
|
1815
|
+
}
|
|
1816
|
+
return 1 + this.innerDiagnosticInfo.getDepth();
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* Flattens the nested diagnostic information into an array.
|
|
1820
|
+
*
|
|
1821
|
+
* @returns An array of all DiagnosticInfo objects in the chain
|
|
1822
|
+
*/
|
|
1823
|
+
flatten() {
|
|
1824
|
+
const result = [this];
|
|
1825
|
+
if (this.innerDiagnosticInfo !== void 0) {
|
|
1826
|
+
result.push(...this.innerDiagnosticInfo.flatten());
|
|
1827
|
+
}
|
|
1828
|
+
return result;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Converts the DiagnosticInfo to a string representation.
|
|
1832
|
+
*
|
|
1833
|
+
* @param includeInner - Whether to include inner diagnostic info (default: true)
|
|
1834
|
+
* @returns A string representation
|
|
1835
|
+
*/
|
|
1836
|
+
toString(includeInner = true) {
|
|
1837
|
+
if (this.isEmpty()) {
|
|
1838
|
+
return "DiagnosticInfo(empty)";
|
|
1839
|
+
}
|
|
1840
|
+
const parts = [];
|
|
1841
|
+
if (this.symbolicId !== void 0) {
|
|
1842
|
+
parts.push(`symbolicId: ${this.symbolicId}`);
|
|
1843
|
+
}
|
|
1844
|
+
if (this.namespaceUri !== void 0) {
|
|
1845
|
+
parts.push(`namespaceUri: ${this.namespaceUri}`);
|
|
1846
|
+
}
|
|
1847
|
+
if (this.localizedText !== void 0) {
|
|
1848
|
+
parts.push(`localizedText: ${this.localizedText}`);
|
|
1849
|
+
}
|
|
1850
|
+
if (this.locale !== void 0) {
|
|
1851
|
+
parts.push(`locale: ${this.locale}`);
|
|
1852
|
+
}
|
|
1853
|
+
if (this.additionalInfo !== void 0) {
|
|
1854
|
+
parts.push(`additionalInfo: "${this.additionalInfo}"`);
|
|
1855
|
+
}
|
|
1856
|
+
if (this.innerStatusCode !== void 0) {
|
|
1857
|
+
parts.push(`innerStatusCode: ${this.innerStatusCode.toString()}`);
|
|
1858
|
+
}
|
|
1859
|
+
if (includeInner && this.innerDiagnosticInfo !== void 0) {
|
|
1860
|
+
parts.push(`innerDiagnosticInfo: ${this.innerDiagnosticInfo.toString(true)}`);
|
|
1861
|
+
}
|
|
1862
|
+
return `DiagnosticInfo(${parts.join(", ")})`;
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
|
|
1866
|
+
// src/types/variant.ts
|
|
1867
|
+
var Variant = class _Variant {
|
|
1868
|
+
/**
|
|
1869
|
+
* The variant type identifier.
|
|
1870
|
+
*/
|
|
1871
|
+
type;
|
|
1872
|
+
/**
|
|
1873
|
+
* The variant value (scalar or array).
|
|
1874
|
+
*/
|
|
1875
|
+
value;
|
|
1876
|
+
/**
|
|
1877
|
+
* Optional array dimensions for multi-dimensional arrays.
|
|
1878
|
+
* For 1D arrays, this is [length].
|
|
1879
|
+
* For 2D arrays, this is [rows, cols], etc.
|
|
1880
|
+
*/
|
|
1881
|
+
arrayDimensions;
|
|
1882
|
+
/**
|
|
1883
|
+
* Checks if this variant is null.
|
|
1884
|
+
*
|
|
1885
|
+
* @returns True if the variant type is Null
|
|
1886
|
+
*/
|
|
1887
|
+
isNull() {
|
|
1888
|
+
return this.type === 0 /* Null */;
|
|
1889
|
+
}
|
|
1890
|
+
/**
|
|
1891
|
+
* Checks if this variant contains an array.
|
|
1892
|
+
*
|
|
1893
|
+
* @returns True if the value is an array
|
|
1894
|
+
*/
|
|
1895
|
+
isArray() {
|
|
1896
|
+
return Array.isArray(this.value);
|
|
1897
|
+
}
|
|
1898
|
+
/**
|
|
1899
|
+
* Checks if this variant contains a scalar value.
|
|
1900
|
+
*
|
|
1901
|
+
* @returns True if the value is not an array
|
|
1902
|
+
*/
|
|
1903
|
+
isScalar() {
|
|
1904
|
+
return !this.isArray();
|
|
1905
|
+
}
|
|
1906
|
+
/**
|
|
1907
|
+
* Gets the array length for 1D arrays.
|
|
1908
|
+
*
|
|
1909
|
+
* @returns The array length, or 0 if not an array
|
|
1910
|
+
*/
|
|
1911
|
+
getArrayLength() {
|
|
1912
|
+
if (this.isArray() && Array.isArray(this.value)) {
|
|
1913
|
+
return this.value.length;
|
|
1914
|
+
}
|
|
1915
|
+
return 0;
|
|
1916
|
+
}
|
|
1917
|
+
/**
|
|
1918
|
+
* Checks equality with another Variant.
|
|
1919
|
+
*
|
|
1920
|
+
* @param other - The variant to compare with
|
|
1921
|
+
* @returns True if variants are equal
|
|
1922
|
+
*/
|
|
1923
|
+
equals(other) {
|
|
1924
|
+
if (this.type !== other.type) {
|
|
1925
|
+
return false;
|
|
1926
|
+
}
|
|
1927
|
+
if (this.arrayDimensions !== void 0 || other.arrayDimensions !== void 0) {
|
|
1928
|
+
if (this.arrayDimensions === void 0 || other.arrayDimensions === void 0) {
|
|
1929
|
+
return false;
|
|
1930
|
+
}
|
|
1931
|
+
if (this.arrayDimensions.length !== other.arrayDimensions.length) {
|
|
1932
|
+
return false;
|
|
1933
|
+
}
|
|
1934
|
+
for (let i = 0; i < this.arrayDimensions.length; i++) {
|
|
1935
|
+
if (this.arrayDimensions[i] !== other.arrayDimensions[i]) {
|
|
1936
|
+
return false;
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
}
|
|
1940
|
+
return JSON.stringify(this.value) === JSON.stringify(other.value);
|
|
1941
|
+
}
|
|
1942
|
+
/**
|
|
1943
|
+
* Converts the variant to a string representation.
|
|
1944
|
+
*
|
|
1945
|
+
* @returns A string representation of the variant
|
|
1946
|
+
*/
|
|
1947
|
+
toString() {
|
|
1948
|
+
const typeName = BuiltInType[this.type];
|
|
1949
|
+
if (this.isNull()) {
|
|
1950
|
+
return "Variant(Null)";
|
|
1951
|
+
}
|
|
1952
|
+
if (this.isArray()) {
|
|
1953
|
+
const dimStr = this.arrayDimensions ? `[${this.arrayDimensions.join(",")}]` : "[?]";
|
|
1954
|
+
return `Variant(${typeName}${dimStr})`;
|
|
1955
|
+
}
|
|
1956
|
+
return `Variant(${typeName}: ${String(this.value)})`;
|
|
1957
|
+
}
|
|
1958
|
+
/**
|
|
1959
|
+
* Union of all OPC UA built-in types accepted by {@link Variant.newFrom}.
|
|
1960
|
+
*
|
|
1961
|
+
* Includes both the tagged numeric primitives from `UaPrimitive` (which carry
|
|
1962
|
+
* a `BuiltInType` discriminant so the exact numeric encoding is known) and the
|
|
1963
|
+
* class-based built-in types that are identified unambiguously at runtime via
|
|
1964
|
+
* `instanceof`.
|
|
1965
|
+
*/
|
|
1966
|
+
static newFrom(value) {
|
|
1967
|
+
if (value === null || value === void 0) {
|
|
1968
|
+
return _Variant.newNull();
|
|
1969
|
+
}
|
|
1970
|
+
if (typeof value === "boolean") {
|
|
1971
|
+
return new _Variant(1 /* Boolean */, value);
|
|
1972
|
+
}
|
|
1973
|
+
if (typeof value === "string") {
|
|
1974
|
+
return new _Variant(12 /* String */, value);
|
|
1975
|
+
}
|
|
1976
|
+
if (value instanceof Uint8Array) {
|
|
1977
|
+
return new _Variant(15 /* ByteString */, value);
|
|
1978
|
+
}
|
|
1979
|
+
if (value instanceof Date) {
|
|
1980
|
+
return new _Variant(13 /* DateTime */, value);
|
|
1981
|
+
}
|
|
1982
|
+
if (value instanceof ExpandedNodeId) {
|
|
1983
|
+
return new _Variant(18 /* ExpandedNodeId */, value);
|
|
1984
|
+
}
|
|
1985
|
+
if (value instanceof NodeId) {
|
|
1986
|
+
return new _Variant(17 /* NodeId */, value);
|
|
1987
|
+
}
|
|
1988
|
+
if (value instanceof QualifiedName) {
|
|
1989
|
+
return new _Variant(20 /* QualifiedName */, value);
|
|
1990
|
+
}
|
|
1991
|
+
if (value instanceof LocalizedText) {
|
|
1992
|
+
return new _Variant(21 /* LocalizedText */, value);
|
|
1993
|
+
}
|
|
1994
|
+
if (value instanceof XmlElement) {
|
|
1995
|
+
return new _Variant(16 /* XmlElement */, value);
|
|
1996
|
+
}
|
|
1997
|
+
if (value instanceof ExtensionObject) {
|
|
1998
|
+
return new _Variant(22 /* ExtensionObject */, value);
|
|
1999
|
+
}
|
|
2000
|
+
if (value instanceof DataValue) {
|
|
2001
|
+
return new _Variant(23 /* DataValue */, value);
|
|
2002
|
+
}
|
|
2003
|
+
if (value instanceof DiagnosticInfo) {
|
|
2004
|
+
return new _Variant(25 /* DiagnosticInfo */, value);
|
|
2005
|
+
}
|
|
2006
|
+
if (value instanceof _Variant) {
|
|
2007
|
+
return new _Variant(24 /* Variant */, value);
|
|
2008
|
+
}
|
|
2009
|
+
if (typeof value === "object" && "type" in value) {
|
|
2010
|
+
const tagged = value;
|
|
2011
|
+
return new _Variant(tagged.type, tagged.value);
|
|
2012
|
+
}
|
|
2013
|
+
throw new Error(
|
|
2014
|
+
`newFrom: unhandled value: ${JSON.stringify(value)}`
|
|
2015
|
+
);
|
|
2016
|
+
}
|
|
2017
|
+
/**
|
|
2018
|
+
* Creates a undefined variant.
|
|
2019
|
+
*
|
|
2020
|
+
* @returns A new Variant with undefined value
|
|
2021
|
+
*/
|
|
2022
|
+
static newNull() {
|
|
2023
|
+
return new _Variant(0 /* Null */);
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Creates a new Variant.
|
|
2027
|
+
*
|
|
2028
|
+
* @param variantType - The type of value stored in the variant
|
|
2029
|
+
* @param value - The scalar or array value
|
|
2030
|
+
* @param arrayDimensions - Optional array dimensions for structured arrays
|
|
2031
|
+
*/
|
|
2032
|
+
constructor(variantType = 0 /* Null */, value = void 0, arrayDimensions = void 0) {
|
|
1768
2033
|
this.type = variantType;
|
|
1769
2034
|
this.value = value;
|
|
1770
2035
|
this.arrayDimensions = arrayDimensions;
|
|
@@ -1985,149 +2250,6 @@ function encodeVariant(writer, value, encoder) {
|
|
|
1985
2250
|
}
|
|
1986
2251
|
}
|
|
1987
2252
|
|
|
1988
|
-
// src/types/diagnosticInfo.ts
|
|
1989
|
-
var DiagnosticInfo = class _DiagnosticInfo {
|
|
1990
|
-
/**
|
|
1991
|
-
* Index into a string table for the symbolic identifier.
|
|
1992
|
-
* The symbolic id is used to identify an error condition in a vendor-specific way.
|
|
1993
|
-
*/
|
|
1994
|
-
symbolicId;
|
|
1995
|
-
/**
|
|
1996
|
-
* Index into a string table for the namespace URI.
|
|
1997
|
-
* Identifies the namespace that defines the symbolicId.
|
|
1998
|
-
*/
|
|
1999
|
-
namespaceUri;
|
|
2000
|
-
/**
|
|
2001
|
-
* Index into a string table for the localized text.
|
|
2002
|
-
* Contains a human-readable description of the error.
|
|
2003
|
-
*/
|
|
2004
|
-
localizedText;
|
|
2005
|
-
/**
|
|
2006
|
-
* Index into a string table for the locale.
|
|
2007
|
-
* Identifies the locale used for the localizedText.
|
|
2008
|
-
*/
|
|
2009
|
-
locale;
|
|
2010
|
-
/**
|
|
2011
|
-
* Additional debugging/diagnostic information.
|
|
2012
|
-
* Not intended for display to end users.
|
|
2013
|
-
*/
|
|
2014
|
-
additionalInfo;
|
|
2015
|
-
/**
|
|
2016
|
-
* StatusCode from a nested operation.
|
|
2017
|
-
* Used when the diagnostic info relates to a nested operation result.
|
|
2018
|
-
*/
|
|
2019
|
-
innerStatusCode;
|
|
2020
|
-
/**
|
|
2021
|
-
* Nested DiagnosticInfo.
|
|
2022
|
-
* Allows for recursive diagnostic information structures.
|
|
2023
|
-
*/
|
|
2024
|
-
innerDiagnosticInfo;
|
|
2025
|
-
/**
|
|
2026
|
-
* Creates a new DiagnosticInfo.
|
|
2027
|
-
*
|
|
2028
|
-
* @param options - Optional diagnostic information fields
|
|
2029
|
-
*/
|
|
2030
|
-
constructor(options = {}) {
|
|
2031
|
-
this.symbolicId = options.symbolicId;
|
|
2032
|
-
this.namespaceUri = options.namespaceUri;
|
|
2033
|
-
this.localizedText = options.localizedText;
|
|
2034
|
-
this.locale = options.locale;
|
|
2035
|
-
this.additionalInfo = options.additionalInfo;
|
|
2036
|
-
this.innerStatusCode = options.innerStatusCode;
|
|
2037
|
-
this.innerDiagnosticInfo = options.innerDiagnosticInfo;
|
|
2038
|
-
}
|
|
2039
|
-
/**
|
|
2040
|
-
* Creates an empty DiagnosticInfo with no fields set.
|
|
2041
|
-
*
|
|
2042
|
-
* @returns A new DiagnosticInfo with all fields undefined
|
|
2043
|
-
*/
|
|
2044
|
-
static createEmpty() {
|
|
2045
|
-
return new _DiagnosticInfo({});
|
|
2046
|
-
}
|
|
2047
|
-
/**
|
|
2048
|
-
* Creates a DiagnosticInfo with just additional info text.
|
|
2049
|
-
*
|
|
2050
|
-
* @param additionalInfo - The diagnostic information text
|
|
2051
|
-
* @returns A new DiagnosticInfo with only additionalInfo set
|
|
2052
|
-
*/
|
|
2053
|
-
static fromText(additionalInfo) {
|
|
2054
|
-
return new _DiagnosticInfo({ additionalInfo });
|
|
2055
|
-
}
|
|
2056
|
-
/**
|
|
2057
|
-
* Checks if this DiagnosticInfo is empty (all fields undefined).
|
|
2058
|
-
*
|
|
2059
|
-
* @returns True if all fields are undefined
|
|
2060
|
-
*/
|
|
2061
|
-
isEmpty() {
|
|
2062
|
-
return this.symbolicId === void 0 && this.namespaceUri === void 0 && this.localizedText === void 0 && this.locale === void 0 && this.additionalInfo === void 0 && this.innerStatusCode === void 0 && this.innerDiagnosticInfo === void 0;
|
|
2063
|
-
}
|
|
2064
|
-
/**
|
|
2065
|
-
* Checks if this DiagnosticInfo has nested diagnostic information.
|
|
2066
|
-
*
|
|
2067
|
-
* @returns True if innerDiagnosticInfo is not undefined
|
|
2068
|
-
*/
|
|
2069
|
-
hasInnerDiagnostics() {
|
|
2070
|
-
return this.innerDiagnosticInfo !== void 0;
|
|
2071
|
-
}
|
|
2072
|
-
/**
|
|
2073
|
-
* Gets the depth of nested diagnostic information.
|
|
2074
|
-
*
|
|
2075
|
-
* @returns The nesting depth (0 if no inner diagnostics)
|
|
2076
|
-
*/
|
|
2077
|
-
getDepth() {
|
|
2078
|
-
if (this.innerDiagnosticInfo === void 0) {
|
|
2079
|
-
return 0;
|
|
2080
|
-
}
|
|
2081
|
-
return 1 + this.innerDiagnosticInfo.getDepth();
|
|
2082
|
-
}
|
|
2083
|
-
/**
|
|
2084
|
-
* Flattens the nested diagnostic information into an array.
|
|
2085
|
-
*
|
|
2086
|
-
* @returns An array of all DiagnosticInfo objects in the chain
|
|
2087
|
-
*/
|
|
2088
|
-
flatten() {
|
|
2089
|
-
const result = [this];
|
|
2090
|
-
if (this.innerDiagnosticInfo !== void 0) {
|
|
2091
|
-
result.push(...this.innerDiagnosticInfo.flatten());
|
|
2092
|
-
}
|
|
2093
|
-
return result;
|
|
2094
|
-
}
|
|
2095
|
-
/**
|
|
2096
|
-
* Converts the DiagnosticInfo to a string representation.
|
|
2097
|
-
*
|
|
2098
|
-
* @param includeInner - Whether to include inner diagnostic info (default: true)
|
|
2099
|
-
* @returns A string representation
|
|
2100
|
-
*/
|
|
2101
|
-
toString(includeInner = true) {
|
|
2102
|
-
if (this.isEmpty()) {
|
|
2103
|
-
return "DiagnosticInfo(empty)";
|
|
2104
|
-
}
|
|
2105
|
-
const parts = [];
|
|
2106
|
-
if (this.symbolicId !== void 0) {
|
|
2107
|
-
parts.push(`symbolicId: ${this.symbolicId}`);
|
|
2108
|
-
}
|
|
2109
|
-
if (this.namespaceUri !== void 0) {
|
|
2110
|
-
parts.push(`namespaceUri: ${this.namespaceUri}`);
|
|
2111
|
-
}
|
|
2112
|
-
if (this.localizedText !== void 0) {
|
|
2113
|
-
parts.push(`localizedText: ${this.localizedText}`);
|
|
2114
|
-
}
|
|
2115
|
-
if (this.locale !== void 0) {
|
|
2116
|
-
parts.push(`locale: ${this.locale}`);
|
|
2117
|
-
}
|
|
2118
|
-
if (this.additionalInfo !== void 0) {
|
|
2119
|
-
parts.push(`additionalInfo: "${this.additionalInfo}"`);
|
|
2120
|
-
}
|
|
2121
|
-
if (this.innerStatusCode !== void 0) {
|
|
2122
|
-
parts.push(`innerStatusCode: ${this.innerStatusCode.toString()}`);
|
|
2123
|
-
}
|
|
2124
|
-
if (includeInner && this.innerDiagnosticInfo !== void 0) {
|
|
2125
|
-
parts.push(`innerDiagnosticInfo: ${this.innerDiagnosticInfo.toString(true)}`);
|
|
2126
|
-
}
|
|
2127
|
-
return `DiagnosticInfo(${parts.join(", ")})`;
|
|
2128
|
-
}
|
|
2129
|
-
};
|
|
2130
|
-
|
|
2131
2253
|
// src/codecs/binary/typesComplex/diagnosticInfo.ts
|
|
2132
2254
|
var DiagnosticInfoMaskBits = {
|
|
2133
2255
|
SymbolicId: 1,
|
|
@@ -2822,106 +2944,6 @@ var SecureChannelTypeDecoder = class extends TransformStream {
|
|
|
2822
2944
|
}
|
|
2823
2945
|
};
|
|
2824
2946
|
|
|
2825
|
-
// src/types/xmlElement.ts
|
|
2826
|
-
var XmlElement = class _XmlElement {
|
|
2827
|
-
/**
|
|
2828
|
-
* The XML string content
|
|
2829
|
-
*/
|
|
2830
|
-
content;
|
|
2831
|
-
/**
|
|
2832
|
-
* Create a new XmlElement
|
|
2833
|
-
*
|
|
2834
|
-
* @param content - The XML string content
|
|
2835
|
-
*/
|
|
2836
|
-
constructor(content = "") {
|
|
2837
|
-
this.content = content;
|
|
2838
|
-
}
|
|
2839
|
-
/**
|
|
2840
|
-
* Get the XML string content
|
|
2841
|
-
*
|
|
2842
|
-
* @returns The XML string
|
|
2843
|
-
*/
|
|
2844
|
-
toString() {
|
|
2845
|
-
return this.content;
|
|
2846
|
-
}
|
|
2847
|
-
/**
|
|
2848
|
-
* Get the length of the XML string
|
|
2849
|
-
*
|
|
2850
|
-
* @returns The number of characters
|
|
2851
|
-
*/
|
|
2852
|
-
get length() {
|
|
2853
|
-
return this.content.length;
|
|
2854
|
-
}
|
|
2855
|
-
/**
|
|
2856
|
-
* Escape special XML characters in text content
|
|
2857
|
-
*
|
|
2858
|
-
* @param text - Text to escape
|
|
2859
|
-
* @returns Escaped text safe for use in XML
|
|
2860
|
-
*
|
|
2861
|
-
* @example
|
|
2862
|
-
* ```typescript
|
|
2863
|
-
* XmlElement.escape("Hello & <World>"); // "Hello & <World>"
|
|
2864
|
-
* ```
|
|
2865
|
-
*/
|
|
2866
|
-
static escape(text) {
|
|
2867
|
-
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2868
|
-
}
|
|
2869
|
-
/**
|
|
2870
|
-
* Unescape XML entities to plain text
|
|
2871
|
-
*
|
|
2872
|
-
* @param xml - XML text with entities
|
|
2873
|
-
* @returns Unescaped text
|
|
2874
|
-
*
|
|
2875
|
-
* @example
|
|
2876
|
-
* ```typescript
|
|
2877
|
-
* XmlElement.unescape("Hello & <World>"); // "Hello & <World>"
|
|
2878
|
-
* ```
|
|
2879
|
-
*/
|
|
2880
|
-
static unescape(xml) {
|
|
2881
|
-
return xml.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
2882
|
-
}
|
|
2883
|
-
/**
|
|
2884
|
-
* Create a simple XML element
|
|
2885
|
-
*
|
|
2886
|
-
* @param tagName - The XML tag name
|
|
2887
|
-
* @param content - The text content (will be escaped)
|
|
2888
|
-
* @param attributes - Optional attributes object
|
|
2889
|
-
* @returns XmlElement
|
|
2890
|
-
*
|
|
2891
|
-
* @example
|
|
2892
|
-
* ```typescript
|
|
2893
|
-
* const xml = XmlElement.create("Temperature", "25.5", { unit: "C" });
|
|
2894
|
-
* // "<Temperature unit=\"C\">25.5</Temperature>"
|
|
2895
|
-
* ```
|
|
2896
|
-
*/
|
|
2897
|
-
static create(tagName, content = "", attributes) {
|
|
2898
|
-
let attrStr = "";
|
|
2899
|
-
if (attributes) {
|
|
2900
|
-
attrStr = Object.entries(attributes).map(([key, value]) => ` ${key}="${_XmlElement.escape(value)}"`).join("");
|
|
2901
|
-
}
|
|
2902
|
-
const escapedContent = _XmlElement.escape(content);
|
|
2903
|
-
const xmlString = `<${tagName}${attrStr}>${escapedContent}</${tagName}>`;
|
|
2904
|
-
return new _XmlElement(xmlString);
|
|
2905
|
-
}
|
|
2906
|
-
/**
|
|
2907
|
-
* Create an empty XmlElement
|
|
2908
|
-
*
|
|
2909
|
-
* @returns Empty XmlElement
|
|
2910
|
-
*/
|
|
2911
|
-
static empty() {
|
|
2912
|
-
return new _XmlElement("");
|
|
2913
|
-
}
|
|
2914
|
-
/**
|
|
2915
|
-
* Check equality with another XmlElement
|
|
2916
|
-
*
|
|
2917
|
-
* @param other - The other XmlElement
|
|
2918
|
-
* @returns true if both contain the same XML string
|
|
2919
|
-
*/
|
|
2920
|
-
equals(other) {
|
|
2921
|
-
return this.content === other.content;
|
|
2922
|
-
}
|
|
2923
|
-
};
|
|
2924
|
-
|
|
2925
2947
|
// src/types/primitives.ts
|
|
2926
2948
|
var uaSbyte = (value) => ({ value, type: 2 /* SByte */ });
|
|
2927
2949
|
var uaByte = (value) => ({ value, type: 3 /* Byte */ });
|
|
@@ -18211,6 +18233,7 @@ exports.StandaloneSubscribedDataSetRefDataType = StandaloneSubscribedDataSetRefD
|
|
|
18211
18233
|
exports.StatusChangeNotification = StatusChangeNotification;
|
|
18212
18234
|
exports.StatusCode = StatusCode;
|
|
18213
18235
|
exports.StatusCodeGetFlagBits = StatusCodeGetFlagBits;
|
|
18236
|
+
exports.StatusCodeIs = StatusCodeIs;
|
|
18214
18237
|
exports.StatusCodeToString = StatusCodeToString;
|
|
18215
18238
|
exports.StatusCodeToStringNumber = StatusCodeToStringNumber;
|
|
18216
18239
|
exports.StatusResult = StatusResult;
|