opcjs-base 0.1.20-alpha → 0.1.26-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 +280 -250
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -8
- package/dist/index.d.ts +22 -8
- package/dist/index.js +280 -251
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -1394,6 +1394,9 @@ function StatusCodeGetFlagBits(statusCode) {
|
|
|
1394
1394
|
LimitConstant: limitBits === 3
|
|
1395
1395
|
};
|
|
1396
1396
|
}
|
|
1397
|
+
function StatusCodeIs(statusCode, expected) {
|
|
1398
|
+
return (statusCode & 4294901760) === expected;
|
|
1399
|
+
}
|
|
1397
1400
|
|
|
1398
1401
|
// src/types/dataValue.ts
|
|
1399
1402
|
var DataValue = class _DataValue {
|
|
@@ -1624,6 +1627,249 @@ function encodeDataValue(writer, value, encoder) {
|
|
|
1624
1627
|
}
|
|
1625
1628
|
}
|
|
1626
1629
|
|
|
1630
|
+
// src/types/xmlElement.ts
|
|
1631
|
+
var XmlElement = class _XmlElement {
|
|
1632
|
+
/**
|
|
1633
|
+
* The XML string content
|
|
1634
|
+
*/
|
|
1635
|
+
content;
|
|
1636
|
+
/**
|
|
1637
|
+
* Create a new XmlElement
|
|
1638
|
+
*
|
|
1639
|
+
* @param content - The XML string content
|
|
1640
|
+
*/
|
|
1641
|
+
constructor(content = "") {
|
|
1642
|
+
this.content = content;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Get the XML string content
|
|
1646
|
+
*
|
|
1647
|
+
* @returns The XML string
|
|
1648
|
+
*/
|
|
1649
|
+
toString() {
|
|
1650
|
+
return this.content;
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Get the length of the XML string
|
|
1654
|
+
*
|
|
1655
|
+
* @returns The number of characters
|
|
1656
|
+
*/
|
|
1657
|
+
get length() {
|
|
1658
|
+
return this.content.length;
|
|
1659
|
+
}
|
|
1660
|
+
/**
|
|
1661
|
+
* Escape special XML characters in text content
|
|
1662
|
+
*
|
|
1663
|
+
* @param text - Text to escape
|
|
1664
|
+
* @returns Escaped text safe for use in XML
|
|
1665
|
+
*
|
|
1666
|
+
* @example
|
|
1667
|
+
* ```typescript
|
|
1668
|
+
* XmlElement.escape("Hello & <World>"); // "Hello & <World>"
|
|
1669
|
+
* ```
|
|
1670
|
+
*/
|
|
1671
|
+
static escape(text) {
|
|
1672
|
+
return text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
1673
|
+
}
|
|
1674
|
+
/**
|
|
1675
|
+
* Unescape XML entities to plain text
|
|
1676
|
+
*
|
|
1677
|
+
* @param xml - XML text with entities
|
|
1678
|
+
* @returns Unescaped text
|
|
1679
|
+
*
|
|
1680
|
+
* @example
|
|
1681
|
+
* ```typescript
|
|
1682
|
+
* XmlElement.unescape("Hello & <World>"); // "Hello & <World>"
|
|
1683
|
+
* ```
|
|
1684
|
+
*/
|
|
1685
|
+
static unescape(xml) {
|
|
1686
|
+
return xml.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
1687
|
+
}
|
|
1688
|
+
/**
|
|
1689
|
+
* Create a simple XML element
|
|
1690
|
+
*
|
|
1691
|
+
* @param tagName - The XML tag name
|
|
1692
|
+
* @param content - The text content (will be escaped)
|
|
1693
|
+
* @param attributes - Optional attributes object
|
|
1694
|
+
* @returns XmlElement
|
|
1695
|
+
*
|
|
1696
|
+
* @example
|
|
1697
|
+
* ```typescript
|
|
1698
|
+
* const xml = XmlElement.create("Temperature", "25.5", { unit: "C" });
|
|
1699
|
+
* // "<Temperature unit=\"C\">25.5</Temperature>"
|
|
1700
|
+
* ```
|
|
1701
|
+
*/
|
|
1702
|
+
static create(tagName, content = "", attributes) {
|
|
1703
|
+
let attrStr = "";
|
|
1704
|
+
if (attributes) {
|
|
1705
|
+
attrStr = Object.entries(attributes).map(([key, value]) => ` ${key}="${_XmlElement.escape(value)}"`).join("");
|
|
1706
|
+
}
|
|
1707
|
+
const escapedContent = _XmlElement.escape(content);
|
|
1708
|
+
const xmlString = `<${tagName}${attrStr}>${escapedContent}</${tagName}>`;
|
|
1709
|
+
return new _XmlElement(xmlString);
|
|
1710
|
+
}
|
|
1711
|
+
/**
|
|
1712
|
+
* Create an empty XmlElement
|
|
1713
|
+
*
|
|
1714
|
+
* @returns Empty XmlElement
|
|
1715
|
+
*/
|
|
1716
|
+
static empty() {
|
|
1717
|
+
return new _XmlElement("");
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Check equality with another XmlElement
|
|
1721
|
+
*
|
|
1722
|
+
* @param other - The other XmlElement
|
|
1723
|
+
* @returns true if both contain the same XML string
|
|
1724
|
+
*/
|
|
1725
|
+
equals(other) {
|
|
1726
|
+
return this.content === other.content;
|
|
1727
|
+
}
|
|
1728
|
+
};
|
|
1729
|
+
|
|
1730
|
+
// src/types/diagnosticInfo.ts
|
|
1731
|
+
var DiagnosticInfo = class _DiagnosticInfo {
|
|
1732
|
+
/**
|
|
1733
|
+
* Index into a string table for the symbolic identifier.
|
|
1734
|
+
* The symbolic id is used to identify an error condition in a vendor-specific way.
|
|
1735
|
+
*/
|
|
1736
|
+
symbolicId;
|
|
1737
|
+
/**
|
|
1738
|
+
* Index into a string table for the namespace URI.
|
|
1739
|
+
* Identifies the namespace that defines the symbolicId.
|
|
1740
|
+
*/
|
|
1741
|
+
namespaceUri;
|
|
1742
|
+
/**
|
|
1743
|
+
* Index into a string table for the localized text.
|
|
1744
|
+
* Contains a human-readable description of the error.
|
|
1745
|
+
*/
|
|
1746
|
+
localizedText;
|
|
1747
|
+
/**
|
|
1748
|
+
* Index into a string table for the locale.
|
|
1749
|
+
* Identifies the locale used for the localizedText.
|
|
1750
|
+
*/
|
|
1751
|
+
locale;
|
|
1752
|
+
/**
|
|
1753
|
+
* Additional debugging/diagnostic information.
|
|
1754
|
+
* Not intended for display to end users.
|
|
1755
|
+
*/
|
|
1756
|
+
additionalInfo;
|
|
1757
|
+
/**
|
|
1758
|
+
* StatusCode from a nested operation.
|
|
1759
|
+
* Used when the diagnostic info relates to a nested operation result.
|
|
1760
|
+
*/
|
|
1761
|
+
innerStatusCode;
|
|
1762
|
+
/**
|
|
1763
|
+
* Nested DiagnosticInfo.
|
|
1764
|
+
* Allows for recursive diagnostic information structures.
|
|
1765
|
+
*/
|
|
1766
|
+
innerDiagnosticInfo;
|
|
1767
|
+
/**
|
|
1768
|
+
* Creates a new DiagnosticInfo.
|
|
1769
|
+
*
|
|
1770
|
+
* @param options - Optional diagnostic information fields
|
|
1771
|
+
*/
|
|
1772
|
+
constructor(options = {}) {
|
|
1773
|
+
this.symbolicId = options.symbolicId;
|
|
1774
|
+
this.namespaceUri = options.namespaceUri;
|
|
1775
|
+
this.localizedText = options.localizedText;
|
|
1776
|
+
this.locale = options.locale;
|
|
1777
|
+
this.additionalInfo = options.additionalInfo;
|
|
1778
|
+
this.innerStatusCode = options.innerStatusCode;
|
|
1779
|
+
this.innerDiagnosticInfo = options.innerDiagnosticInfo;
|
|
1780
|
+
}
|
|
1781
|
+
/**
|
|
1782
|
+
* Creates an empty DiagnosticInfo with no fields set.
|
|
1783
|
+
*
|
|
1784
|
+
* @returns A new DiagnosticInfo with all fields undefined
|
|
1785
|
+
*/
|
|
1786
|
+
static createEmpty() {
|
|
1787
|
+
return new _DiagnosticInfo({});
|
|
1788
|
+
}
|
|
1789
|
+
/**
|
|
1790
|
+
* Creates a DiagnosticInfo with just additional info text.
|
|
1791
|
+
*
|
|
1792
|
+
* @param additionalInfo - The diagnostic information text
|
|
1793
|
+
* @returns A new DiagnosticInfo with only additionalInfo set
|
|
1794
|
+
*/
|
|
1795
|
+
static fromText(additionalInfo) {
|
|
1796
|
+
return new _DiagnosticInfo({ additionalInfo });
|
|
1797
|
+
}
|
|
1798
|
+
/**
|
|
1799
|
+
* Checks if this DiagnosticInfo is empty (all fields undefined).
|
|
1800
|
+
*
|
|
1801
|
+
* @returns True if all fields are undefined
|
|
1802
|
+
*/
|
|
1803
|
+
isEmpty() {
|
|
1804
|
+
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;
|
|
1805
|
+
}
|
|
1806
|
+
/**
|
|
1807
|
+
* Checks if this DiagnosticInfo has nested diagnostic information.
|
|
1808
|
+
*
|
|
1809
|
+
* @returns True if innerDiagnosticInfo is not undefined
|
|
1810
|
+
*/
|
|
1811
|
+
hasInnerDiagnostics() {
|
|
1812
|
+
return this.innerDiagnosticInfo !== void 0;
|
|
1813
|
+
}
|
|
1814
|
+
/**
|
|
1815
|
+
* Gets the depth of nested diagnostic information.
|
|
1816
|
+
*
|
|
1817
|
+
* @returns The nesting depth (0 if no inner diagnostics)
|
|
1818
|
+
*/
|
|
1819
|
+
getDepth() {
|
|
1820
|
+
if (this.innerDiagnosticInfo === void 0) {
|
|
1821
|
+
return 0;
|
|
1822
|
+
}
|
|
1823
|
+
return 1 + this.innerDiagnosticInfo.getDepth();
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* Flattens the nested diagnostic information into an array.
|
|
1827
|
+
*
|
|
1828
|
+
* @returns An array of all DiagnosticInfo objects in the chain
|
|
1829
|
+
*/
|
|
1830
|
+
flatten() {
|
|
1831
|
+
const result = [this];
|
|
1832
|
+
if (this.innerDiagnosticInfo !== void 0) {
|
|
1833
|
+
result.push(...this.innerDiagnosticInfo.flatten());
|
|
1834
|
+
}
|
|
1835
|
+
return result;
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Converts the DiagnosticInfo to a string representation.
|
|
1839
|
+
*
|
|
1840
|
+
* @param includeInner - Whether to include inner diagnostic info (default: true)
|
|
1841
|
+
* @returns A string representation
|
|
1842
|
+
*/
|
|
1843
|
+
toString(includeInner = true) {
|
|
1844
|
+
if (this.isEmpty()) {
|
|
1845
|
+
return "DiagnosticInfo(empty)";
|
|
1846
|
+
}
|
|
1847
|
+
const parts = [];
|
|
1848
|
+
if (this.symbolicId !== void 0) {
|
|
1849
|
+
parts.push(`symbolicId: ${this.symbolicId}`);
|
|
1850
|
+
}
|
|
1851
|
+
if (this.namespaceUri !== void 0) {
|
|
1852
|
+
parts.push(`namespaceUri: ${this.namespaceUri}`);
|
|
1853
|
+
}
|
|
1854
|
+
if (this.localizedText !== void 0) {
|
|
1855
|
+
parts.push(`localizedText: ${this.localizedText}`);
|
|
1856
|
+
}
|
|
1857
|
+
if (this.locale !== void 0) {
|
|
1858
|
+
parts.push(`locale: ${this.locale}`);
|
|
1859
|
+
}
|
|
1860
|
+
if (this.additionalInfo !== void 0) {
|
|
1861
|
+
parts.push(`additionalInfo: "${this.additionalInfo}"`);
|
|
1862
|
+
}
|
|
1863
|
+
if (this.innerStatusCode !== void 0) {
|
|
1864
|
+
parts.push(`innerStatusCode: ${this.innerStatusCode.toString()}`);
|
|
1865
|
+
}
|
|
1866
|
+
if (includeInner && this.innerDiagnosticInfo !== void 0) {
|
|
1867
|
+
parts.push(`innerDiagnosticInfo: ${this.innerDiagnosticInfo.toString(true)}`);
|
|
1868
|
+
}
|
|
1869
|
+
return `DiagnosticInfo(${parts.join(", ")})`;
|
|
1870
|
+
}
|
|
1871
|
+
};
|
|
1872
|
+
|
|
1627
1873
|
// src/types/variant.ts
|
|
1628
1874
|
var Variant = class _Variant {
|
|
1629
1875
|
/**
|
|
@@ -1717,13 +1963,12 @@ var Variant = class _Variant {
|
|
|
1717
1963
|
return `Variant(${typeName}: ${String(this.value)})`;
|
|
1718
1964
|
}
|
|
1719
1965
|
/**
|
|
1720
|
-
*
|
|
1966
|
+
* Union of all OPC UA built-in types accepted by {@link Variant.newFrom}.
|
|
1721
1967
|
*
|
|
1722
|
-
*
|
|
1723
|
-
*
|
|
1724
|
-
*
|
|
1725
|
-
*
|
|
1726
|
-
* @returns A new Variant wrapping the inner value with the correct VariantType.
|
|
1968
|
+
* Includes both the tagged numeric primitives from `UaPrimitive` (which carry
|
|
1969
|
+
* a `BuiltInType` discriminant so the exact numeric encoding is known) and the
|
|
1970
|
+
* class-based built-in types that are identified unambiguously at runtime via
|
|
1971
|
+
* `instanceof`.
|
|
1727
1972
|
*/
|
|
1728
1973
|
static newFrom(value) {
|
|
1729
1974
|
if (value === null || value === void 0) {
|
|
@@ -1741,12 +1986,39 @@ var Variant = class _Variant {
|
|
|
1741
1986
|
if (value instanceof Date) {
|
|
1742
1987
|
return new _Variant(13 /* DateTime */, value);
|
|
1743
1988
|
}
|
|
1989
|
+
if (value instanceof ExpandedNodeId) {
|
|
1990
|
+
return new _Variant(18 /* ExpandedNodeId */, value);
|
|
1991
|
+
}
|
|
1992
|
+
if (value instanceof NodeId) {
|
|
1993
|
+
return new _Variant(17 /* NodeId */, value);
|
|
1994
|
+
}
|
|
1995
|
+
if (value instanceof QualifiedName) {
|
|
1996
|
+
return new _Variant(20 /* QualifiedName */, value);
|
|
1997
|
+
}
|
|
1998
|
+
if (value instanceof LocalizedText) {
|
|
1999
|
+
return new _Variant(21 /* LocalizedText */, value);
|
|
2000
|
+
}
|
|
2001
|
+
if (value instanceof XmlElement) {
|
|
2002
|
+
return new _Variant(16 /* XmlElement */, value);
|
|
2003
|
+
}
|
|
2004
|
+
if (value instanceof ExtensionObject) {
|
|
2005
|
+
return new _Variant(22 /* ExtensionObject */, value);
|
|
2006
|
+
}
|
|
2007
|
+
if (value instanceof DataValue) {
|
|
2008
|
+
return new _Variant(23 /* DataValue */, value);
|
|
2009
|
+
}
|
|
2010
|
+
if (value instanceof DiagnosticInfo) {
|
|
2011
|
+
return new _Variant(25 /* DiagnosticInfo */, value);
|
|
2012
|
+
}
|
|
2013
|
+
if (value instanceof _Variant) {
|
|
2014
|
+
return new _Variant(24 /* Variant */, value);
|
|
2015
|
+
}
|
|
1744
2016
|
if (typeof value === "object" && "type" in value) {
|
|
1745
2017
|
const tagged = value;
|
|
1746
2018
|
return new _Variant(tagged.type, tagged.value);
|
|
1747
2019
|
}
|
|
1748
2020
|
throw new Error(
|
|
1749
|
-
`newFrom: unhandled
|
|
2021
|
+
`newFrom: unhandled value: ${JSON.stringify(value)}`
|
|
1750
2022
|
);
|
|
1751
2023
|
}
|
|
1752
2024
|
/**
|
|
@@ -1985,149 +2257,6 @@ function encodeVariant(writer, value, encoder) {
|
|
|
1985
2257
|
}
|
|
1986
2258
|
}
|
|
1987
2259
|
|
|
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
2260
|
// src/codecs/binary/typesComplex/diagnosticInfo.ts
|
|
2132
2261
|
var DiagnosticInfoMaskBits = {
|
|
2133
2262
|
SymbolicId: 1,
|
|
@@ -2822,106 +2951,6 @@ var SecureChannelTypeDecoder = class extends TransformStream {
|
|
|
2822
2951
|
}
|
|
2823
2952
|
};
|
|
2824
2953
|
|
|
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
2954
|
// src/types/primitives.ts
|
|
2926
2955
|
var uaSbyte = (value) => ({ value, type: 2 /* SByte */ });
|
|
2927
2956
|
var uaByte = (value) => ({ value, type: 3 /* Byte */ });
|
|
@@ -18211,6 +18240,7 @@ exports.StandaloneSubscribedDataSetRefDataType = StandaloneSubscribedDataSetRefD
|
|
|
18211
18240
|
exports.StatusChangeNotification = StatusChangeNotification;
|
|
18212
18241
|
exports.StatusCode = StatusCode;
|
|
18213
18242
|
exports.StatusCodeGetFlagBits = StatusCodeGetFlagBits;
|
|
18243
|
+
exports.StatusCodeIs = StatusCodeIs;
|
|
18214
18244
|
exports.StatusCodeToString = StatusCodeToString;
|
|
18215
18245
|
exports.StatusCodeToStringNumber = StatusCodeToStringNumber;
|
|
18216
18246
|
exports.StatusResult = StatusResult;
|