opcua-webapi-ts 1.0.19

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.
Files changed (230) hide show
  1. package/README.md +34 -0
  2. package/dist/cjs/client/UaClientConfigure.d.ts +9 -0
  3. package/dist/cjs/client/UaClientConfigure.js +24 -0
  4. package/dist/cjs/client/UaWebClient.d.ts +38 -0
  5. package/dist/cjs/client/UaWebClient.js +590 -0
  6. package/dist/cjs/client/index.d.ts +3 -0
  7. package/dist/cjs/client/index.js +19 -0
  8. package/dist/cjs/client/utils/UaDataTypeDictionary.d.ts +15 -0
  9. package/dist/cjs/client/utils/UaDataTypeDictionary.js +149 -0
  10. package/dist/cjs/client/utils/UaNodeReader.d.ts +83 -0
  11. package/dist/cjs/client/utils/UaNodeReader.js +714 -0
  12. package/dist/cjs/client/utils/UaObjectTypeDictionary.d.ts +12 -0
  13. package/dist/cjs/client/utils/UaObjectTypeDictionary.js +80 -0
  14. package/dist/cjs/client/utils/UaReferenceTypeDictionary.d.ts +12 -0
  15. package/dist/cjs/client/utils/UaReferenceTypeDictionary.js +80 -0
  16. package/dist/cjs/client/utils/index.d.ts +4 -0
  17. package/dist/cjs/client/utils/index.js +20 -0
  18. package/dist/cjs/common/index.d.ts +4 -0
  19. package/dist/cjs/common/index.js +20 -0
  20. package/dist/cjs/common/mapper/UaPayloadMapper.d.ts +18 -0
  21. package/dist/cjs/common/mapper/UaPayloadMapper.js +481 -0
  22. package/dist/cjs/common/mapper/index.d.ts +1 -0
  23. package/dist/cjs/common/mapper/index.js +17 -0
  24. package/dist/cjs/common/nodes/Identifiers.d.ts +2458 -0
  25. package/dist/cjs/common/nodes/Identifiers.js +2470 -0
  26. package/dist/cjs/common/nodes/UaAttributes.d.ts +18 -0
  27. package/dist/cjs/common/nodes/UaAttributes.js +2 -0
  28. package/dist/cjs/common/nodes/UaDataType.d.ts +15 -0
  29. package/dist/cjs/common/nodes/UaDataType.js +93 -0
  30. package/dist/cjs/common/nodes/UaMethod.d.ts +16 -0
  31. package/dist/cjs/common/nodes/UaMethod.js +77 -0
  32. package/dist/cjs/common/nodes/UaNode.d.ts +38 -0
  33. package/dist/cjs/common/nodes/UaNode.js +94 -0
  34. package/dist/cjs/common/nodes/UaObject.d.ts +16 -0
  35. package/dist/cjs/common/nodes/UaObject.js +69 -0
  36. package/dist/cjs/common/nodes/UaObjectType.d.ts +12 -0
  37. package/dist/cjs/common/nodes/UaObjectType.js +62 -0
  38. package/dist/cjs/common/nodes/UaReferenceType.d.ts +12 -0
  39. package/dist/cjs/common/nodes/UaReferenceType.js +33 -0
  40. package/dist/cjs/common/nodes/UaVariable.d.ts +25 -0
  41. package/dist/cjs/common/nodes/UaVariable.js +76 -0
  42. package/dist/cjs/common/nodes/UaVariableType.d.ts +14 -0
  43. package/dist/cjs/common/nodes/UaVariableType.js +50 -0
  44. package/dist/cjs/common/nodes/index.d.ts +10 -0
  45. package/dist/cjs/common/nodes/index.js +26 -0
  46. package/dist/cjs/common/structure/UaArgument.d.ts +19 -0
  47. package/dist/cjs/common/structure/UaArgument.js +65 -0
  48. package/dist/cjs/common/structure/UaContentFilter.d.ts +13 -0
  49. package/dist/cjs/common/structure/UaContentFilter.js +48 -0
  50. package/dist/cjs/common/structure/UaContentFilterElement.d.ts +12 -0
  51. package/dist/cjs/common/structure/UaContentFilterElement.js +43 -0
  52. package/dist/cjs/common/structure/UaEUInformation.d.ts +18 -0
  53. package/dist/cjs/common/structure/UaEUInformation.js +56 -0
  54. package/dist/cjs/common/structure/UaElementOperand.d.ts +12 -0
  55. package/dist/cjs/common/structure/UaElementOperand.js +36 -0
  56. package/dist/cjs/common/structure/UaEnumValueType.d.ts +16 -0
  57. package/dist/cjs/common/structure/UaEnumValueType.js +48 -0
  58. package/dist/cjs/common/structure/UaEventFilter.d.ts +14 -0
  59. package/dist/cjs/common/structure/UaEventFilter.js +49 -0
  60. package/dist/cjs/common/structure/UaHistoryData.d.ts +12 -0
  61. package/dist/cjs/common/structure/UaHistoryData.js +43 -0
  62. package/dist/cjs/common/structure/UaHistoryEvent.d.ts +12 -0
  63. package/dist/cjs/common/structure/UaHistoryEvent.js +59 -0
  64. package/dist/cjs/common/structure/UaLiteralOperand.d.ts +12 -0
  65. package/dist/cjs/common/structure/UaLiteralOperand.js +43 -0
  66. package/dist/cjs/common/structure/UaRange.d.ts +14 -0
  67. package/dist/cjs/common/structure/UaRange.js +44 -0
  68. package/dist/cjs/common/structure/UaReadAtTimeDetails.d.ts +14 -0
  69. package/dist/cjs/common/structure/UaReadAtTimeDetails.js +41 -0
  70. package/dist/cjs/common/structure/UaReadEventDetails.d.ts +19 -0
  71. package/dist/cjs/common/structure/UaReadEventDetails.js +57 -0
  72. package/dist/cjs/common/structure/UaReadRawModifiedDetails.d.ts +20 -0
  73. package/dist/cjs/common/structure/UaReadRawModifiedDetails.js +58 -0
  74. package/dist/cjs/common/structure/UaSimpleAttributeOperand.d.ts +14 -0
  75. package/dist/cjs/common/structure/UaSimpleAttributeOperand.js +43 -0
  76. package/dist/cjs/common/structure/index.d.ts +15 -0
  77. package/dist/cjs/common/structure/index.js +31 -0
  78. package/dist/cjs/common/types/UaDataValue.d.ts +14 -0
  79. package/dist/cjs/common/types/UaDataValue.js +28 -0
  80. package/dist/cjs/common/types/UaError.d.ts +6 -0
  81. package/dist/cjs/common/types/UaError.js +15 -0
  82. package/dist/cjs/common/types/UaExpandedNodeId.d.ts +15 -0
  83. package/dist/cjs/common/types/UaExpandedNodeId.js +51 -0
  84. package/dist/cjs/common/types/UaExtensionObject.d.ts +9 -0
  85. package/dist/cjs/common/types/UaExtensionObject.js +19 -0
  86. package/dist/cjs/common/types/UaHistoryDataResult.d.ts +8 -0
  87. package/dist/cjs/common/types/UaHistoryDataResult.js +16 -0
  88. package/dist/cjs/common/types/UaHistoryEventFieldList.d.ts +7 -0
  89. package/dist/cjs/common/types/UaHistoryEventFieldList.js +23 -0
  90. package/dist/cjs/common/types/UaHistoryEventResult.d.ts +8 -0
  91. package/dist/cjs/common/types/UaHistoryEventResult.js +16 -0
  92. package/dist/cjs/common/types/UaLink.d.ts +12 -0
  93. package/dist/cjs/common/types/UaLink.js +24 -0
  94. package/dist/cjs/common/types/UaLocalizedText.d.ts +9 -0
  95. package/dist/cjs/common/types/UaLocalizedText.js +20 -0
  96. package/dist/cjs/common/types/UaNodeId.d.ts +23 -0
  97. package/dist/cjs/common/types/UaNodeId.js +154 -0
  98. package/dist/cjs/common/types/UaQuery.d.ts +11 -0
  99. package/dist/cjs/common/types/UaQuery.js +82 -0
  100. package/dist/cjs/common/types/UaQueryFilter.d.ts +27 -0
  101. package/dist/cjs/common/types/UaQueryFilter.js +74 -0
  102. package/dist/cjs/common/types/UaRequestPatameters.d.ts +11 -0
  103. package/dist/cjs/common/types/UaRequestPatameters.js +29 -0
  104. package/dist/cjs/common/types/UaServiceTypes.d.ts +18 -0
  105. package/dist/cjs/common/types/UaServiceTypes.js +2 -0
  106. package/dist/cjs/common/types/UaStatusCode.d.ts +24 -0
  107. package/dist/cjs/common/types/UaStatusCode.js +76 -0
  108. package/dist/cjs/common/types/UaTypes.d.ts +12 -0
  109. package/dist/cjs/common/types/UaTypes.js +2 -0
  110. package/dist/cjs/common/types/UaVariant.d.ts +89 -0
  111. package/dist/cjs/common/types/UaVariant.js +384 -0
  112. package/dist/cjs/common/types/index.d.ts +17 -0
  113. package/dist/cjs/common/types/index.js +33 -0
  114. package/dist/cjs/index.d.ts +2 -0
  115. package/dist/cjs/index.js +18 -0
  116. package/dist/client/UaClientConfigure.d.ts +9 -0
  117. package/dist/client/UaClientConfigure.js +24 -0
  118. package/dist/client/UaWebClient.d.ts +38 -0
  119. package/dist/client/UaWebClient.js +590 -0
  120. package/dist/client/index.d.ts +3 -0
  121. package/dist/client/index.js +19 -0
  122. package/dist/client/utils/UaDataTypeDictionary.d.ts +15 -0
  123. package/dist/client/utils/UaDataTypeDictionary.js +149 -0
  124. package/dist/client/utils/UaNodeReader.d.ts +83 -0
  125. package/dist/client/utils/UaNodeReader.js +714 -0
  126. package/dist/client/utils/UaObjectTypeDictionary.d.ts +12 -0
  127. package/dist/client/utils/UaObjectTypeDictionary.js +80 -0
  128. package/dist/client/utils/UaReferenceTypeDictionary.d.ts +12 -0
  129. package/dist/client/utils/UaReferenceTypeDictionary.js +80 -0
  130. package/dist/client/utils/index.d.ts +4 -0
  131. package/dist/client/utils/index.js +20 -0
  132. package/dist/common/index.d.ts +4 -0
  133. package/dist/common/index.js +20 -0
  134. package/dist/common/mapper/UaPayloadMapper.d.ts +18 -0
  135. package/dist/common/mapper/UaPayloadMapper.js +481 -0
  136. package/dist/common/mapper/index.d.ts +1 -0
  137. package/dist/common/mapper/index.js +17 -0
  138. package/dist/common/nodes/Identifiers.d.ts +2458 -0
  139. package/dist/common/nodes/Identifiers.js +2470 -0
  140. package/dist/common/nodes/UaAttributes.d.ts +18 -0
  141. package/dist/common/nodes/UaAttributes.js +2 -0
  142. package/dist/common/nodes/UaDataType.d.ts +15 -0
  143. package/dist/common/nodes/UaDataType.js +93 -0
  144. package/dist/common/nodes/UaMethod.d.ts +16 -0
  145. package/dist/common/nodes/UaMethod.js +77 -0
  146. package/dist/common/nodes/UaNode.d.ts +38 -0
  147. package/dist/common/nodes/UaNode.js +94 -0
  148. package/dist/common/nodes/UaObject.d.ts +16 -0
  149. package/dist/common/nodes/UaObject.js +69 -0
  150. package/dist/common/nodes/UaObjectType.d.ts +12 -0
  151. package/dist/common/nodes/UaObjectType.js +62 -0
  152. package/dist/common/nodes/UaReferenceType.d.ts +12 -0
  153. package/dist/common/nodes/UaReferenceType.js +33 -0
  154. package/dist/common/nodes/UaVariable.d.ts +25 -0
  155. package/dist/common/nodes/UaVariable.js +76 -0
  156. package/dist/common/nodes/UaVariableType.d.ts +14 -0
  157. package/dist/common/nodes/UaVariableType.js +50 -0
  158. package/dist/common/nodes/index.d.ts +10 -0
  159. package/dist/common/nodes/index.js +26 -0
  160. package/dist/common/structure/UaArgument.d.ts +19 -0
  161. package/dist/common/structure/UaArgument.js +65 -0
  162. package/dist/common/structure/UaContentFilter.d.ts +13 -0
  163. package/dist/common/structure/UaContentFilter.js +48 -0
  164. package/dist/common/structure/UaContentFilterElement.d.ts +12 -0
  165. package/dist/common/structure/UaContentFilterElement.js +43 -0
  166. package/dist/common/structure/UaEUInformation.d.ts +18 -0
  167. package/dist/common/structure/UaEUInformation.js +56 -0
  168. package/dist/common/structure/UaElementOperand.d.ts +12 -0
  169. package/dist/common/structure/UaElementOperand.js +36 -0
  170. package/dist/common/structure/UaEnumValueType.d.ts +16 -0
  171. package/dist/common/structure/UaEnumValueType.js +48 -0
  172. package/dist/common/structure/UaEventFilter.d.ts +14 -0
  173. package/dist/common/structure/UaEventFilter.js +49 -0
  174. package/dist/common/structure/UaHistoryData.d.ts +12 -0
  175. package/dist/common/structure/UaHistoryData.js +43 -0
  176. package/dist/common/structure/UaHistoryEvent.d.ts +12 -0
  177. package/dist/common/structure/UaHistoryEvent.js +59 -0
  178. package/dist/common/structure/UaLiteralOperand.d.ts +12 -0
  179. package/dist/common/structure/UaLiteralOperand.js +43 -0
  180. package/dist/common/structure/UaRange.d.ts +14 -0
  181. package/dist/common/structure/UaRange.js +44 -0
  182. package/dist/common/structure/UaReadAtTimeDetails.d.ts +14 -0
  183. package/dist/common/structure/UaReadAtTimeDetails.js +41 -0
  184. package/dist/common/structure/UaReadEventDetails.d.ts +19 -0
  185. package/dist/common/structure/UaReadEventDetails.js +57 -0
  186. package/dist/common/structure/UaReadRawModifiedDetails.d.ts +20 -0
  187. package/dist/common/structure/UaReadRawModifiedDetails.js +58 -0
  188. package/dist/common/structure/UaSimpleAttributeOperand.d.ts +14 -0
  189. package/dist/common/structure/UaSimpleAttributeOperand.js +43 -0
  190. package/dist/common/structure/index.d.ts +15 -0
  191. package/dist/common/structure/index.js +31 -0
  192. package/dist/common/types/UaDataValue.d.ts +14 -0
  193. package/dist/common/types/UaDataValue.js +28 -0
  194. package/dist/common/types/UaError.d.ts +6 -0
  195. package/dist/common/types/UaError.js +15 -0
  196. package/dist/common/types/UaExpandedNodeId.d.ts +15 -0
  197. package/dist/common/types/UaExpandedNodeId.js +51 -0
  198. package/dist/common/types/UaExtensionObject.d.ts +9 -0
  199. package/dist/common/types/UaExtensionObject.js +19 -0
  200. package/dist/common/types/UaHistoryDataResult.d.ts +8 -0
  201. package/dist/common/types/UaHistoryDataResult.js +16 -0
  202. package/dist/common/types/UaHistoryEventFieldList.d.ts +7 -0
  203. package/dist/common/types/UaHistoryEventFieldList.js +23 -0
  204. package/dist/common/types/UaHistoryEventResult.d.ts +8 -0
  205. package/dist/common/types/UaHistoryEventResult.js +16 -0
  206. package/dist/common/types/UaLink.d.ts +12 -0
  207. package/dist/common/types/UaLink.js +24 -0
  208. package/dist/common/types/UaLocalizedText.d.ts +9 -0
  209. package/dist/common/types/UaLocalizedText.js +20 -0
  210. package/dist/common/types/UaNodeId.d.ts +23 -0
  211. package/dist/common/types/UaNodeId.js +154 -0
  212. package/dist/common/types/UaQuery.d.ts +11 -0
  213. package/dist/common/types/UaQuery.js +82 -0
  214. package/dist/common/types/UaQueryFilter.d.ts +27 -0
  215. package/dist/common/types/UaQueryFilter.js +74 -0
  216. package/dist/common/types/UaRequestPatameters.d.ts +11 -0
  217. package/dist/common/types/UaRequestPatameters.js +29 -0
  218. package/dist/common/types/UaServiceTypes.d.ts +18 -0
  219. package/dist/common/types/UaServiceTypes.js +2 -0
  220. package/dist/common/types/UaStatusCode.d.ts +24 -0
  221. package/dist/common/types/UaStatusCode.js +76 -0
  222. package/dist/common/types/UaTypes.d.ts +12 -0
  223. package/dist/common/types/UaTypes.js +2 -0
  224. package/dist/common/types/UaVariant.d.ts +89 -0
  225. package/dist/common/types/UaVariant.js +384 -0
  226. package/dist/common/types/index.d.ts +17 -0
  227. package/dist/common/types/index.js +33 -0
  228. package/dist/index.d.ts +2 -0
  229. package/dist/index.js +18 -0
  230. package/package.json +23 -0
@@ -0,0 +1,8 @@
1
+ import { UaDataValue } from "./UaDataValue";
2
+ export declare class UaHistoryDataResult {
3
+ private _historyData;
4
+ private _continuationPoint;
5
+ constructor(historyData: Array<UaDataValue>, continuationPoint?: string | null);
6
+ get historyData(): Array<UaDataValue>;
7
+ get continuationPoint(): string | null;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaHistoryDataResult = void 0;
4
+ class UaHistoryDataResult {
5
+ constructor(historyData, continuationPoint) {
6
+ this._historyData = historyData;
7
+ this._continuationPoint = (continuationPoint) ? continuationPoint : null;
8
+ }
9
+ get historyData() {
10
+ return this._historyData;
11
+ }
12
+ get continuationPoint() {
13
+ return this._continuationPoint;
14
+ }
15
+ }
16
+ exports.UaHistoryDataResult = UaHistoryDataResult;
@@ -0,0 +1,7 @@
1
+ import { UaVariant } from "./UaVariant";
2
+ export declare class UaHistoryEventFieldList {
3
+ private _eventFields;
4
+ constructor(eventFields: Array<UaVariant>);
5
+ get eventFields(): Array<UaVariant>;
6
+ getEventData(fieldNames: Array<string>): Map<string, UaVariant>;
7
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaHistoryEventFieldList = void 0;
4
+ class UaHistoryEventFieldList {
5
+ constructor(eventFields) {
6
+ this._eventFields = eventFields;
7
+ }
8
+ get eventFields() {
9
+ return this._eventFields;
10
+ }
11
+ getEventData(fieldNames) {
12
+ let eventData = new Map();
13
+ let index = 0;
14
+ for (let item of this._eventFields) {
15
+ if (this._eventFields.length <= index)
16
+ break;
17
+ eventData.set(fieldNames[index], item);
18
+ index++;
19
+ }
20
+ return eventData;
21
+ }
22
+ }
23
+ exports.UaHistoryEventFieldList = UaHistoryEventFieldList;
@@ -0,0 +1,8 @@
1
+ import { UaHistoryEventFieldList } from "./UaHistoryEventFieldList";
2
+ export declare class UaHistoryEventResult {
3
+ private _historyEvents;
4
+ private _continuationPoint;
5
+ constructor(historyEvents: Array<UaHistoryEventFieldList>, continuationPoint?: string | null);
6
+ get historyEvents(): Array<UaHistoryEventFieldList>;
7
+ get continuationPoint(): string | null;
8
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaHistoryEventResult = void 0;
4
+ class UaHistoryEventResult {
5
+ constructor(historyEvents, continuationPoint) {
6
+ this._historyEvents = historyEvents;
7
+ this._continuationPoint = (continuationPoint) ? continuationPoint : null;
8
+ }
9
+ get historyEvents() {
10
+ return this._historyEvents;
11
+ }
12
+ get continuationPoint() {
13
+ return this._continuationPoint;
14
+ }
15
+ }
16
+ exports.UaHistoryEventResult = UaHistoryEventResult;
@@ -0,0 +1,12 @@
1
+ import { UaNodeId } from "./UaNodeId";
2
+ export declare class UaLink {
3
+ private _targetId;
4
+ private _nodeClass;
5
+ private _referenceTypeId;
6
+ private _isForward;
7
+ constructor(targetId: UaNodeId, nodeClass: number, referenceTypeId: UaNodeId, isForward: boolean);
8
+ get targetId(): UaNodeId;
9
+ get nodeClass(): number;
10
+ get referenceTypeId(): UaNodeId;
11
+ get isForward(): boolean;
12
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaLink = void 0;
4
+ class UaLink {
5
+ constructor(targetId, nodeClass, referenceTypeId, isForward) {
6
+ this._targetId = targetId;
7
+ this._nodeClass = nodeClass;
8
+ this._referenceTypeId = referenceTypeId;
9
+ this._isForward = isForward;
10
+ }
11
+ get targetId() {
12
+ return this._targetId;
13
+ }
14
+ get nodeClass() {
15
+ return this._nodeClass;
16
+ }
17
+ get referenceTypeId() {
18
+ return this._referenceTypeId;
19
+ }
20
+ get isForward() {
21
+ return this._isForward;
22
+ }
23
+ }
24
+ exports.UaLink = UaLink;
@@ -0,0 +1,9 @@
1
+ export declare class UaLocalizedText {
2
+ static nullText: UaLocalizedText;
3
+ private _text;
4
+ private _locale;
5
+ constructor(text?: string | null, locale?: string | null);
6
+ get text(): string;
7
+ get locale(): string | null;
8
+ toString(): string;
9
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaLocalizedText = void 0;
4
+ class UaLocalizedText {
5
+ constructor(text, locale) {
6
+ this._text = (text) ? text : "";
7
+ this._locale = (locale) ? locale : null;
8
+ }
9
+ get text() {
10
+ return this._text;
11
+ }
12
+ get locale() {
13
+ return this._locale;
14
+ }
15
+ toString() {
16
+ return `Text: ${this._text} Locale: ${this._locale}`;
17
+ }
18
+ }
19
+ exports.UaLocalizedText = UaLocalizedText;
20
+ UaLocalizedText.nullText = new UaLocalizedText();
@@ -0,0 +1,23 @@
1
+ export declare enum UaNodeIdType {
2
+ NUMERIC = 1,
3
+ STRING = 2,
4
+ GUID = 3,
5
+ BYTESTRING = 4
6
+ }
7
+ export declare class UaNodeId {
8
+ static nullNodeId: UaNodeId;
9
+ private _identifierType;
10
+ private _value;
11
+ private _nsIndex;
12
+ constructor(value: number | string, namespace?: number, identifierType?: UaNodeIdType);
13
+ get nsIndex(): number;
14
+ get value(): string | number;
15
+ get identifierType(): UaNodeIdType;
16
+ numericId(): number;
17
+ stringId(): string;
18
+ isEmpty(): boolean;
19
+ equal(other: UaNodeId | null): boolean;
20
+ toString(): string;
21
+ }
22
+ export declare function parseUaNodeId(value: string): UaNodeId;
23
+ export declare function parseUaNodeIdOrNull(value: string | null | undefined): UaNodeId | null;
@@ -0,0 +1,154 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaNodeId = exports.UaNodeIdType = void 0;
4
+ exports.parseUaNodeId = parseUaNodeId;
5
+ exports.parseUaNodeIdOrNull = parseUaNodeIdOrNull;
6
+ const _1 = require(".");
7
+ const opcua_webapi_1 = require("opcua-webapi");
8
+ var UaNodeIdType;
9
+ (function (UaNodeIdType) {
10
+ UaNodeIdType[UaNodeIdType["NUMERIC"] = 1] = "NUMERIC";
11
+ UaNodeIdType[UaNodeIdType["STRING"] = 2] = "STRING";
12
+ UaNodeIdType[UaNodeIdType["GUID"] = 3] = "GUID";
13
+ UaNodeIdType[UaNodeIdType["BYTESTRING"] = 4] = "BYTESTRING";
14
+ })(UaNodeIdType || (exports.UaNodeIdType = UaNodeIdType = {}));
15
+ class UaNodeId {
16
+ constructor(value, namespace, identifierType) {
17
+ this._value = (value) ? value : 0;
18
+ this._nsIndex = (namespace) ? namespace : 0;
19
+ if (typeof value === 'number') {
20
+ this._identifierType = UaNodeIdType.NUMERIC;
21
+ }
22
+ else {
23
+ this._identifierType = (identifierType) ? identifierType : UaNodeIdType.STRING;
24
+ }
25
+ if (this._nsIndex < 0 && this._nsIndex > 0xffff)
26
+ throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
27
+ if (this._identifierType === UaNodeIdType.NUMERIC) {
28
+ if (typeof this._value !== "number" || this._value < 0 || this._value > 0xffffffff)
29
+ throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
30
+ }
31
+ else if (this._identifierType === UaNodeIdType.STRING ||
32
+ this._identifierType === UaNodeIdType.BYTESTRING ||
33
+ this._identifierType === UaNodeIdType.GUID) {
34
+ if (typeof this._value !== "string")
35
+ throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
36
+ }
37
+ else {
38
+ throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
39
+ }
40
+ }
41
+ get nsIndex() {
42
+ return this._nsIndex;
43
+ }
44
+ get value() {
45
+ return this._value;
46
+ }
47
+ get identifierType() {
48
+ return this._identifierType;
49
+ }
50
+ numericId() {
51
+ return (this._identifierType === UaNodeIdType.NUMERIC) ? this._value : 0;
52
+ }
53
+ stringId() {
54
+ return (this._identifierType !== UaNodeIdType.NUMERIC) ? this._value : "";
55
+ }
56
+ isEmpty() {
57
+ return (0 === this._value) ? true : false;
58
+ }
59
+ equal(other) {
60
+ if (null == other)
61
+ return false;
62
+ if (this._identifierType !== other._identifierType)
63
+ return false;
64
+ if (this._nsIndex !== other._nsIndex)
65
+ return false;
66
+ if (this._value !== other._value)
67
+ return false;
68
+ return true;
69
+ }
70
+ toString() {
71
+ const namespacePart = (this._nsIndex == 0) ? "" : `ns=${this._nsIndex};`;
72
+ let str;
73
+ switch (this.identifierType) {
74
+ case UaNodeIdType.NUMERIC:
75
+ str = `${namespacePart}i=${this._value}`;
76
+ break;
77
+ case UaNodeIdType.STRING:
78
+ str = `${namespacePart}s=${this._value}`;
79
+ break;
80
+ case UaNodeIdType.GUID:
81
+ str = `${namespacePart}g=${this._value}`;
82
+ break;
83
+ default:
84
+ str = `${namespacePart}b=${this._value}`;
85
+ break;
86
+ }
87
+ return str;
88
+ }
89
+ }
90
+ exports.UaNodeId = UaNodeId;
91
+ UaNodeId.nullNodeId = new UaNodeId(0, 0);
92
+ const regexNamespaceI = /ns=([0-9]+);i=([0-9]+)/;
93
+ const regexNamespaceS = /ns=([0-9]+);s=(.*)/;
94
+ const regexNamespaceB = /ns=([0-9]+);b=(.*)/;
95
+ const regexNamespaceG = /ns=([0-9]+);g=([0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12})/;
96
+ function parseUaNodeId(value) {
97
+ if (value.length <= 2)
98
+ throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
99
+ let identifierType = UaNodeIdType.NUMERIC;
100
+ let idValue;
101
+ let nsIndex;
102
+ let twoFirst = value.substring(0, 2);
103
+ let matches;
104
+ if (twoFirst === "i=") {
105
+ identifierType = UaNodeIdType.NUMERIC;
106
+ idValue = parseInt(value.substring(2), 10);
107
+ }
108
+ else if ((matches = regexNamespaceI.exec(value)) !== null) {
109
+ identifierType = UaNodeIdType.NUMERIC;
110
+ nsIndex = parseInt(matches[1], 10);
111
+ idValue = parseInt(matches[2], 10);
112
+ }
113
+ else if ((matches = regexNamespaceS.exec(value)) !== null) {
114
+ identifierType = UaNodeIdType.STRING;
115
+ nsIndex = parseInt(matches[1], 10);
116
+ idValue = matches[2];
117
+ }
118
+ else if (twoFirst === "s=") {
119
+ identifierType = UaNodeIdType.STRING;
120
+ idValue = value.substring(2);
121
+ }
122
+ else if ((matches = regexNamespaceB.exec(value)) !== null) {
123
+ identifierType = UaNodeIdType.BYTESTRING;
124
+ nsIndex = parseInt(matches[1], 10);
125
+ idValue = matches[2];
126
+ }
127
+ else if ((matches = regexNamespaceG.exec(value)) !== null) {
128
+ identifierType = UaNodeIdType.GUID;
129
+ nsIndex = parseInt(matches[1], 10);
130
+ idValue = matches[2];
131
+ }
132
+ else if (twoFirst === "b=") {
133
+ identifierType = UaNodeIdType.BYTESTRING;
134
+ idValue = value.substring(2);
135
+ }
136
+ else if (twoFirst === "g=") {
137
+ identifierType = UaNodeIdType.GUID;
138
+ idValue = value.substring(2);
139
+ }
140
+ else {
141
+ throw new _1.UaError((0, _1.makeUaStatusCode)(opcua_webapi_1.StatusCodes.BadNodeIdInvalid));
142
+ }
143
+ return new UaNodeId(idValue, nsIndex, identifierType);
144
+ }
145
+ function parseUaNodeIdOrNull(value) {
146
+ if (!value)
147
+ return null;
148
+ try {
149
+ return parseUaNodeId(value);
150
+ }
151
+ catch (e) {
152
+ return null;
153
+ }
154
+ }
@@ -0,0 +1,11 @@
1
+ import { UaContentFilter } from "../structure";
2
+ import { UaQueryFilter } from "./UaQueryFilter";
3
+ export declare class UaQuery {
4
+ private _filters;
5
+ private _orAll;
6
+ constructor(filters: Array<UaQueryFilter>, orAll?: boolean);
7
+ get filters(): UaQueryFilter[];
8
+ get orAll(): boolean;
9
+ toContentFilter(): UaContentFilter;
10
+ static fromContentFilter(filter: UaContentFilter): UaQuery | null;
11
+ }
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaQuery = void 0;
4
+ const opcua_webapi_1 = require("opcua-webapi");
5
+ const structure_1 = require("../structure");
6
+ const UaQueryFilter_1 = require("./UaQueryFilter");
7
+ class UaQuery {
8
+ constructor(filters, orAll) {
9
+ this._filters = filters;
10
+ this._orAll = (orAll) ? true : false;
11
+ }
12
+ get filters() {
13
+ return this._filters;
14
+ }
15
+ get orAll() {
16
+ return this._orAll;
17
+ }
18
+ toContentFilter() {
19
+ let queryElements = [];
20
+ let notElements = [];
21
+ let index = 0;
22
+ for (let item of this.filters) {
23
+ queryElements.push(item.toContentFilterElement());
24
+ if (item.isNot) {
25
+ let notOperand = new structure_1.UaElementOperand(index);
26
+ let notElement = new structure_1.UaContentFilterElement([notOperand.toExtensionObject()], opcua_webapi_1.FilterOperator.Not);
27
+ notElements.push(notElement);
28
+ }
29
+ index++;
30
+ }
31
+ let elements = [];
32
+ elements.push(...queryElements);
33
+ elements.push(...notElements);
34
+ if (this.orAll) {
35
+ let orElement = new structure_1.UaContentFilterElement([], opcua_webapi_1.FilterOperator.Or);
36
+ elements.push(orElement);
37
+ }
38
+ let filter = new structure_1.UaContentFilter(elements);
39
+ return filter;
40
+ }
41
+ static fromContentFilter(filter) {
42
+ let queryElements = new Map;
43
+ let notElements = [];
44
+ let orAll = false;
45
+ let index = 0;
46
+ for (let item of filter.elements) {
47
+ if (item.operator == opcua_webapi_1.FilterOperator.Not) {
48
+ if (item.operands.length != 1 ||
49
+ !item.operands[0].typeId.equal(structure_1.UaElementOperand.dataTypeId))
50
+ return null;
51
+ let operand = structure_1.UaElementOperand.fromExtensionObject(item.operands[0]);
52
+ if (null == operand)
53
+ return null;
54
+ notElements.push(operand.index);
55
+ }
56
+ else if (item.operator >= opcua_webapi_1.FilterOperator.Equals && item.operator <= opcua_webapi_1.FilterOperator.InList) {
57
+ let query = UaQueryFilter_1.UaQueryFilter.fromContentFilterElement(item);
58
+ if (null == query)
59
+ return;
60
+ queryElements.set(index, query);
61
+ }
62
+ else if (item.operator == opcua_webapi_1.FilterOperator.Or) {
63
+ if (item.operands.length != 0)
64
+ return null;
65
+ orAll = true;
66
+ }
67
+ else {
68
+ return null;
69
+ }
70
+ index++;
71
+ }
72
+ for (let item of notElements) {
73
+ let query = queryElements.get(item);
74
+ if (!query)
75
+ return null;
76
+ query.isNot = true;
77
+ }
78
+ let ret = new UaQuery(Array.from(queryElements.values()), orAll);
79
+ return ret;
80
+ }
81
+ }
82
+ exports.UaQuery = UaQuery;
@@ -0,0 +1,27 @@
1
+ import { UaContentFilterElement } from "../structure";
2
+ import { UaVariant } from "./UaVariant";
3
+ export declare enum UaQueryFilterType {
4
+ Equals = 0,
5
+ IsNull = 1,
6
+ GreaterThan = 2,
7
+ LessThan = 3,
8
+ GreaterThanOrEqual = 4,
9
+ LessThanOrEqual = 5,
10
+ Like = 6,
11
+ Between = 8,
12
+ InList = 9
13
+ }
14
+ export declare class UaQueryFilter {
15
+ private _fieldName;
16
+ private _operator;
17
+ private _value;
18
+ private _isNot;
19
+ constructor(fieldName: string, operator: UaQueryFilterType, value: UaVariant, isNot?: boolean);
20
+ get fieldName(): string;
21
+ get operator(): UaQueryFilterType;
22
+ get value(): UaVariant;
23
+ get isNot(): boolean;
24
+ set isNot(isNot: boolean);
25
+ toContentFilterElement(): UaContentFilterElement;
26
+ static fromContentFilterElement(element: UaContentFilterElement): UaQueryFilter | null;
27
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaQueryFilter = exports.UaQueryFilterType = void 0;
4
+ const opcua_webapi_1 = require("opcua-webapi");
5
+ const structure_1 = require("../structure");
6
+ var UaQueryFilterType;
7
+ (function (UaQueryFilterType) {
8
+ UaQueryFilterType[UaQueryFilterType["Equals"] = 0] = "Equals";
9
+ UaQueryFilterType[UaQueryFilterType["IsNull"] = 1] = "IsNull";
10
+ UaQueryFilterType[UaQueryFilterType["GreaterThan"] = 2] = "GreaterThan";
11
+ UaQueryFilterType[UaQueryFilterType["LessThan"] = 3] = "LessThan";
12
+ UaQueryFilterType[UaQueryFilterType["GreaterThanOrEqual"] = 4] = "GreaterThanOrEqual";
13
+ UaQueryFilterType[UaQueryFilterType["LessThanOrEqual"] = 5] = "LessThanOrEqual";
14
+ UaQueryFilterType[UaQueryFilterType["Like"] = 6] = "Like";
15
+ UaQueryFilterType[UaQueryFilterType["Between"] = 8] = "Between";
16
+ UaQueryFilterType[UaQueryFilterType["InList"] = 9] = "InList";
17
+ })(UaQueryFilterType || (exports.UaQueryFilterType = UaQueryFilterType = {}));
18
+ class UaQueryFilter {
19
+ constructor(fieldName, operator, value, isNot) {
20
+ this._fieldName = fieldName;
21
+ this._operator = operator;
22
+ this._value = value;
23
+ this._isNot = (isNot) ? true : false;
24
+ }
25
+ get fieldName() {
26
+ opcua_webapi_1.FilterOperator;
27
+ return this._fieldName;
28
+ }
29
+ get operator() {
30
+ return this._operator;
31
+ }
32
+ get value() {
33
+ return this._value;
34
+ }
35
+ get isNot() {
36
+ return this._isNot;
37
+ }
38
+ set isNot(isNot) {
39
+ this._isNot = isNot;
40
+ }
41
+ toContentFilterElement() {
42
+ let simpleOperand = new structure_1.UaSimpleAttributeOperand([this.fieldName]);
43
+ let literalOperand = new structure_1.UaLiteralOperand(this.value);
44
+ let operands = [
45
+ simpleOperand.toExtensionObject(),
46
+ literalOperand.toExtensionObject()
47
+ ];
48
+ let element = new structure_1.UaContentFilterElement(operands, this.operator);
49
+ return element;
50
+ }
51
+ static fromContentFilterElement(element) {
52
+ if (element.operator < UaQueryFilterType.Equals ||
53
+ element.operator > UaQueryFilterType.InList ||
54
+ element.operator == UaQueryFilterType.Like + 1)
55
+ return null;
56
+ let simpleOperand = null;
57
+ let literalOperand = null;
58
+ for (let item of element.operands) {
59
+ if (item.typeId.equal(structure_1.UaSimpleAttributeOperand.dataTypeId)) {
60
+ simpleOperand = structure_1.UaSimpleAttributeOperand.fromExtensionObject(item);
61
+ }
62
+ else if (item.typeId.equal(structure_1.UaLiteralOperand.dataTypeId)) {
63
+ literalOperand = structure_1.UaLiteralOperand.fromExtensionObject(item);
64
+ }
65
+ }
66
+ if (null == simpleOperand ||
67
+ 0 == simpleOperand.browsePath.length ||
68
+ null == literalOperand)
69
+ return null;
70
+ let filter = new UaQueryFilter(simpleOperand.browsePath[0], element.operator, literalOperand.value);
71
+ return filter;
72
+ }
73
+ }
74
+ exports.UaQueryFilter = UaQueryFilter;
@@ -0,0 +1,11 @@
1
+ export declare class UaClientParameters {
2
+ private _timeout?;
3
+ private _returnDiagnostics?;
4
+ private _auditEntryId?;
5
+ get timeout(): number | undefined;
6
+ set timeout(timeout: number);
7
+ get returnDiagnostics(): number | undefined;
8
+ set returnDiagnostics(returnDiagnostics: number);
9
+ get auditEntryId(): string | undefined;
10
+ set auditEntryId(auditEntryId: string);
11
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UaClientParameters = void 0;
4
+ class UaClientParameters {
5
+ get timeout() {
6
+ return this._timeout;
7
+ }
8
+ set timeout(timeout) {
9
+ if (timeout < 500) {
10
+ this._timeout = 500;
11
+ }
12
+ else {
13
+ this._timeout = this.timeout;
14
+ }
15
+ }
16
+ get returnDiagnostics() {
17
+ return this._returnDiagnostics;
18
+ }
19
+ set returnDiagnostics(returnDiagnostics) {
20
+ this._returnDiagnostics = returnDiagnostics;
21
+ }
22
+ get auditEntryId() {
23
+ return this._auditEntryId;
24
+ }
25
+ set auditEntryId(auditEntryId) {
26
+ this._auditEntryId = auditEntryId;
27
+ }
28
+ }
29
+ exports.UaClientParameters = UaClientParameters;
@@ -0,0 +1,18 @@
1
+ import { UaNodeId, UaLocalizedText, UaExpandedNodeId, UaVariant } from ".";
2
+ export type UaReferenceDescriptor = {
3
+ nodeId: UaExpandedNodeId;
4
+ nodeClass: number;
5
+ browseName: string;
6
+ displayName: UaLocalizedText;
7
+ referenceTypeId: UaNodeId;
8
+ isForward: boolean;
9
+ typeDefinition?: UaExpandedNodeId;
10
+ };
11
+ export type UaBrowseResult = {
12
+ results: Array<UaReferenceDescriptor>;
13
+ continuationPoint?: string;
14
+ };
15
+ export type UaWriteValue = {
16
+ nodeId: UaNodeId;
17
+ value: UaVariant;
18
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,24 @@
1
+ export declare class UaStatusCode {
2
+ private static _codesDictionary;
3
+ private _code;
4
+ constructor(code?: number);
5
+ get value(): number;
6
+ get name(): string;
7
+ toString(): string;
8
+ checkBit(mask: number): boolean;
9
+ /** returns true if the overflow bit is set */
10
+ get hasOverflowBit(): boolean;
11
+ /** returns true if the semanticChange bit is set */
12
+ get hasSemanticChangedBit(): boolean;
13
+ /** returns true if the structureChange bit is set */
14
+ get hasStructureChangedBit(): boolean;
15
+ equals(other: UaStatusCode): boolean;
16
+ isGood(): boolean;
17
+ isNotGood(): boolean;
18
+ isBad(): boolean;
19
+ isUncertain(): boolean;
20
+ }
21
+ export declare const extraStatusCodeBits: {
22
+ [key: string]: number;
23
+ };
24
+ export declare function makeUaStatusCode(code?: number): UaStatusCode;