node-opcua-nodeid 2.90.1 → 2.98.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "node-opcua-nodeid",
3
3
  "main": "./dist/index.js",
4
4
  "types": "./dist/index.d.ts",
5
- "version": "2.90.1",
5
+ "version": "2.98.0",
6
6
  "description": "pure nodejs OPCUA SDK - module -nodeid",
7
7
  "scripts": {
8
8
  "build": "tsc -b",
@@ -16,8 +16,8 @@
16
16
  "node-opcua-guid": "2.88.0"
17
17
  },
18
18
  "devDependencies": {
19
- "node-opcua-benchmarker": "2.90.1",
20
- "node-opcua-debug": "2.90.1",
19
+ "node-opcua-benchmarker": "2.98.0",
20
+ "node-opcua-debug": "2.98.0",
21
21
  "should": "^13.2.3"
22
22
  },
23
23
  "author": "Etienne Rossignon",
@@ -35,5 +35,5 @@
35
35
  "internet of things"
36
36
  ],
37
37
  "homepage": "http://node-opcua.github.io/",
38
- "gitHead": "3325ff5f8477fd058ba574d19e8128c36e3e831f"
38
+ "gitHead": "e4d73afdfcccb3491423149d9b9785888f4ebb3c"
39
39
  }
package/source/nodeid.ts CHANGED
@@ -47,21 +47,42 @@ function defaultValue(identifierType: NodeIdType.STRING): null;
47
47
  function defaultValue(identifierType: NodeIdType.NUMERIC): 0;
48
48
  function defaultValue(identifierType: NodeIdType.GUID): null;
49
49
  */
50
- function defaultValue(identifierType: NodeIdType): string | number| Buffer {
51
- switch(identifierType) {
52
- case NodeIdType.GUID : return emptyGuid;
53
- case NodeIdType.BYTESTRING : return null as any as Buffer;// Buffer.alloc(0);
54
- case NodeIdType.STRING : return "";
55
- case NodeIdType.NUMERIC : return 0;
50
+ function defaultValue(identifierType: NodeIdType): string | number | Buffer {
51
+ switch (identifierType) {
52
+ case NodeIdType.GUID: return emptyGuid;
53
+ case NodeIdType.BYTESTRING: return null as any as Buffer;// Buffer.alloc(0);
54
+ case NodeIdType.STRING: return "";
55
+ case NodeIdType.NUMERIC: return 0;
56
56
  }
57
57
  }
58
+
59
+ export interface INodeIdNumeric extends NodeId {
60
+ identifierType: NodeIdType.NUMERIC;
61
+ value: number;
62
+ }
63
+ export interface INodeIdGuid extends NodeId {
64
+ identifierType: NodeIdType.GUID;
65
+ value: string;
66
+ }
67
+ export interface INodeIdByteString extends NodeId {
68
+ identifierType: NodeIdType.BYTESTRING;
69
+ value: Buffer;
70
+ }
71
+ export interface INodeIdString extends NodeId {
72
+ identifierType: NodeIdType.STRING;
73
+ value: string;
74
+ }
75
+ export type INodeId = INodeIdNumeric | INodeIdGuid | INodeIdString | INodeIdByteString;
76
+
77
+
78
+ const doDebug = false;
58
79
  /**
59
80
  * Construct a node ID
60
81
  *
61
82
  * @class NodeId
62
83
  * @example
63
84
  *
64
- * ``` javascript
85
+ * ``` javascript
65
86
  * const nodeId = new NodeId(NodeIdType.NUMERIC,123,1);
66
87
  * ```
67
88
  * @constructor
@@ -82,6 +103,8 @@ export class NodeId {
82
103
  * @param namespace - the index of the related namespace (optional , default value = 0 )
83
104
  */
84
105
  constructor(identifierType?: NodeIdType | null, value?: number | string | Buffer | Guid, namespace?: number) {
106
+
107
+
85
108
  if (identifierType === null || identifierType === undefined) {
86
109
  this.identifierType = NodeIdType.NUMERIC;
87
110
  this.value = 0;
@@ -94,14 +117,13 @@ export class NodeId {
94
117
  this.namespace = namespace || 0;
95
118
 
96
119
  // namespace shall be a UInt16
97
- assert(this.namespace >= 0 && this.namespace <= 0xffff);
98
-
99
- assert(this.identifierType !== NodeIdType.NUMERIC || (this.value !== null && this.value >= 0 && this.value <= 0xffffffff));
100
- assert(this.identifierType !== NodeIdType.GUID || isValidGuid(this.value as string));
101
- assert(this.identifierType !== NodeIdType.STRING || typeof this.value === "string");
120
+ assert(this.namespace >= 0 && this.namespace <= 0xffff, "NodeId: invalid namespace value");
121
+ assert(this.identifierType !== NodeIdType.NUMERIC || (this.value !== null && this.value as number >= 0 && this.value as number <= 0xffffffff));
122
+ assert(this.identifierType !== NodeIdType.GUID || isValidGuid(this.value as string), "NodeId: Guid is invalid");
123
+ assert(this.identifierType !== NodeIdType.STRING || typeof this.value === "string", "cannot empty string");
102
124
  if (this.identifierType === NodeIdType.GUID) {
103
125
  this.value = normalizeGuid(value as string);
104
- }
126
+ }
105
127
  }
106
128
 
107
129
  /**
@@ -125,15 +147,16 @@ export class NodeId {
125
147
  public toString(options?: { addressSpace?: any }): string {
126
148
  const addressSpace = options ? options.addressSpace : null;
127
149
  let str;
128
- switch (this.identifierType) {
150
+ const _this = this as INodeId;
151
+ switch (_this.identifierType) {
129
152
  case NodeIdType.NUMERIC:
130
- str = "ns=" + this.namespace + ";i=" + this.value;
153
+ str = "ns=" + this.namespace + ";i=" + _this.value;
131
154
  break;
132
155
  case NodeIdType.STRING:
133
- str = "ns=" + this.namespace + ";s=" + this.value;
156
+ str = "ns=" + this.namespace + ";s=" + _this.value;
134
157
  break;
135
158
  case NodeIdType.GUID:
136
- str = "ns=" + this.namespace + ";g=" + normalizeGuid(this.value as string);
159
+ str = "ns=" + this.namespace + ";g=" + normalizeGuid(_this.value);
137
160
  break;
138
161
  default:
139
162
  assert(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
@@ -146,9 +169,9 @@ export class NodeId {
146
169
  }
147
170
 
148
171
  if (addressSpace) {
149
- if (this.namespace === 0 && this.identifierType === NodeIdType.NUMERIC) {
172
+ if (this.namespace === 0 && _this.identifierType === NodeIdType.NUMERIC) {
150
173
  // find standard browse name
151
- const name = reverse_map((this.value||0).toString()) || "<undefined>";
174
+ const name = reverse_map((this.value || 0).toString()) || "<undefined>";
152
175
  str += " " + name;
153
176
  } else if (addressSpace.findNode) {
154
177
  // let use the provided address space to figure out the browseNode of this node.
@@ -181,16 +204,16 @@ export class NodeId {
181
204
  * returns true if the NodeId is null or empty
182
205
  */
183
206
  public isEmpty(): boolean {
184
- switch (this.identifierType) {
207
+ const _this = this as INodeId;
208
+ switch (_this.identifierType) {
185
209
  case NodeIdType.NUMERIC:
186
- return this.value === 0;
210
+ return _this.value === 0;
187
211
  case NodeIdType.STRING:
188
- return !this.value || (this.value as string).length === 0;
212
+ return !_this.value;
189
213
  case NodeIdType.GUID:
190
- return !this.value || this.value === emptyGuid;
214
+ return !_this.value || _this.value === emptyGuid;
191
215
  default:
192
- assert(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
193
- return !this.value || (this.value as Buffer).length === 0;
216
+ return !_this.value || (_this.value as Buffer).length === 0;
194
217
  }
195
218
  }
196
219
  }
@@ -202,7 +225,7 @@ NodeId.nullNodeId = new Proxy(
202
225
  return (target as any)[prop];
203
226
  },
204
227
  set: () => {
205
- throw new Error("Cannot assign a value to constant NodeId.nullNodeId");
228
+ throw new Error("Cannot assign a value to constant NodeId.nullNodeId");
206
229
  }
207
230
  });
208
231
 
@@ -276,7 +299,7 @@ export function coerceNodeId(value: unknown, namespace?: number): NodeId {
276
299
  } else if ((matches = regexNamespaceG.exec(value)) !== null) {
277
300
  identifierType = NodeIdType.GUID;
278
301
  namespace = parseInt(matches[1], 10);
279
- value =normalizeGuid(matches[2]);
302
+ value = normalizeGuid(matches[2]);
280
303
  } else {
281
304
  throw new Error("String cannot be coerced to a nodeId : " + value);
282
305
  }
@@ -1,68 +0,0 @@
1
- /// <reference types="node" />
2
- /**
3
- * @module node-opcua-nodeid
4
- */
5
- import { Guid } from "node-opcua-guid";
6
- import { NodeId, NodeIdType } from "./nodeid";
7
- /**
8
- * An ExpandedNodeId extends the NodeId structure.
9
- *
10
- * An ExpandedNodeId extends the NodeId structure by allowing the NamespaceUri to be
11
- * explicitly specified instead of using the NamespaceIndex. The NamespaceUri is optional. If it
12
- * is specified then the NamespaceIndex inside the NodeId shall be ignored.
13
- *
14
- * The ExpandedNodeId is encoded by first encoding a NodeId as described in Clause 5 .2.2.9
15
- * and then encoding NamespaceUri as a String.
16
- *
17
- * An instance of an ExpandedNodeId may still use the NamespaceIndex instead of the
18
- * NamespaceUri. In this case, the NamespaceUri is not encoded in the stream. The presence of
19
- * the NamespaceUri in the stream is indicated by setting the NamespaceUri flag in the encoding
20
- * format byte for the NodeId.
21
- *
22
- * If the NamespaceUri is present then the encoder shall encode the NamespaceIndex as 0 in
23
- * the stream when the NodeId portion is encoded. The unused NamespaceIndex is included in
24
- * the stream for consistency,
25
- *
26
- * An ExpandedNodeId may also have a ServerIndex which is encoded as a UInt32 after the
27
- * NamespaceUri. The ServerIndex flag in the NodeId encoding byte indicates whether the
28
- * ServerIndex is present in the stream. The ServerIndex is omitted if it is equal to zero.
29
- *
30
- * @class ExpandedNodeId
31
- * @extends NodeId
32
- *
33
- *
34
- *
35
- * @param identifierType - the nodeID type
36
- * @param value - the node id value. The type of Value depends on identifierType.
37
- * @param namespace - the index of the related namespace (optional , default value = 0 )
38
- * @param namespaceUri - NamespaceUri
39
- * @param serverIndex - the server Index
40
- * @constructor
41
- */
42
- export declare class ExpandedNodeId extends NodeId {
43
- static nullExpandedNodeId: ExpandedNodeId;
44
- static fromNodeId(nodeId: NodeId, namespaceUri?: string, serverIndex?: number): ExpandedNodeId;
45
- namespaceUri: null | string;
46
- serverIndex: number;
47
- constructor(forDeserialization: null);
48
- constructor(identifierType: NodeIdType, value: number | string | Guid | Buffer, namespace: number, namespaceUri?: null | string, serverIndex?: number);
49
- /**
50
- * @method toString
51
- * @return {string}
52
- */
53
- toString(): string;
54
- /**
55
- * convert nodeId to a JSON string. same as {@link NodeId#toString }
56
- * @method toJSON
57
- * @return {String}
58
- */
59
- toJSON(): any;
60
- }
61
- export declare function coerceExpandedNodeId(value: unknown): ExpandedNodeId;
62
- /**
63
- * @method makeExpandedNodeId
64
- * @param value
65
- * @param [namespace=0] the namespace
66
- * @return {ExpandedNodeId}
67
- */
68
- export declare function makeExpandedNodeId(value: unknown, namespace?: number): ExpandedNodeId;
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeExpandedNodeId = exports.coerceExpandedNodeId = exports.ExpandedNodeId = void 0;
4
- const nodeid_1 = require("./nodeid");
5
- /**
6
- * An ExpandedNodeId extends the NodeId structure.
7
- *
8
- * An ExpandedNodeId extends the NodeId structure by allowing the NamespaceUri to be
9
- * explicitly specified instead of using the NamespaceIndex. The NamespaceUri is optional. If it
10
- * is specified then the NamespaceIndex inside the NodeId shall be ignored.
11
- *
12
- * The ExpandedNodeId is encoded by first encoding a NodeId as described in Clause 5 .2.2.9
13
- * and then encoding NamespaceUri as a String.
14
- *
15
- * An instance of an ExpandedNodeId may still use the NamespaceIndex instead of the
16
- * NamespaceUri. In this case, the NamespaceUri is not encoded in the stream. The presence of
17
- * the NamespaceUri in the stream is indicated by setting the NamespaceUri flag in the encoding
18
- * format byte for the NodeId.
19
- *
20
- * If the NamespaceUri is present then the encoder shall encode the NamespaceIndex as 0 in
21
- * the stream when the NodeId portion is encoded. The unused NamespaceIndex is included in
22
- * the stream for consistency,
23
- *
24
- * An ExpandedNodeId may also have a ServerIndex which is encoded as a UInt32 after the
25
- * NamespaceUri. The ServerIndex flag in the NodeId encoding byte indicates whether the
26
- * ServerIndex is present in the stream. The ServerIndex is omitted if it is equal to zero.
27
- *
28
- * @class ExpandedNodeId
29
- * @extends NodeId
30
- *
31
- *
32
- *
33
- * @param identifierType - the nodeID type
34
- * @param value - the node id value. The type of Value depends on identifierType.
35
- * @param namespace - the index of the related namespace (optional , default value = 0 )
36
- * @param namespaceUri - NamespaceUri
37
- * @param serverIndex - the server Index
38
- * @constructor
39
- */
40
- class ExpandedNodeId extends nodeid_1.NodeId {
41
- static fromNodeId(nodeId, namespaceUri, serverIndex) {
42
- return new ExpandedNodeId(nodeId.identifierType, nodeId.value, nodeId.namespace, namespaceUri, serverIndex);
43
- }
44
- constructor(identifierType, value, namespace, namespaceUri, serverIndex) {
45
- super(identifierType, value, namespace);
46
- this.namespaceUri = namespaceUri || null;
47
- this.serverIndex = serverIndex || 0;
48
- }
49
- /**
50
- * @method toString
51
- * @return {string}
52
- */
53
- toString() {
54
- let str = nodeid_1.NodeId.prototype.toString.call(this);
55
- if (this.namespaceUri) {
56
- str += ";namespaceUri:" + this.namespaceUri;
57
- }
58
- if (this.serverIndex) {
59
- str += ";serverIndex:" + this.serverIndex;
60
- }
61
- return str;
62
- }
63
- /**
64
- * convert nodeId to a JSON string. same as {@link NodeId#toString }
65
- * @method toJSON
66
- * @return {String}
67
- */
68
- toJSON() {
69
- return this.toString();
70
- }
71
- }
72
- exports.ExpandedNodeId = ExpandedNodeId;
73
- ExpandedNodeId.nullExpandedNodeId = new ExpandedNodeId(nodeid_1.NodeIdType.NUMERIC, 0, 0);
74
- function coerceExpandedNodeId(value) {
75
- const n = (0, nodeid_1.coerceNodeId)(value);
76
- return new ExpandedNodeId(n.identifierType, n.value, n.namespace, /*namespaceUri*/ null, /*serverIndex*/ 0);
77
- }
78
- exports.coerceExpandedNodeId = coerceExpandedNodeId;
79
- /**
80
- * @method makeExpandedNodeId
81
- * @param value
82
- * @param [namespace=0] the namespace
83
- * @return {ExpandedNodeId}
84
- */
85
- function makeExpandedNodeId(value, namespace) {
86
- if (value === undefined && namespace === undefined) {
87
- return new ExpandedNodeId(nodeid_1.NodeIdType.NUMERIC, 0, 0, null, 0);
88
- }
89
- const serverIndex = 0;
90
- let n;
91
- const namespaceUri = null;
92
- if (value instanceof ExpandedNodeId) {
93
- // construct from a ExpandedNodeId => copy
94
- n = value;
95
- return new ExpandedNodeId(n.identifierType, n.value, n.namespace, n.namespaceUri, n.serverIndex);
96
- }
97
- if (value instanceof nodeid_1.NodeId) {
98
- // construct from a nodeId
99
- n = value;
100
- return new ExpandedNodeId(n.identifierType, n.value, n.namespace, namespaceUri, serverIndex);
101
- }
102
- const valueInt = parseInt(value, 10);
103
- if (!isFinite(valueInt)) {
104
- throw new Error(" cannot makeExpandedNodeId out of " + value);
105
- }
106
- namespace = namespace || 0;
107
- return new ExpandedNodeId(nodeid_1.NodeIdType.NUMERIC, valueInt, namespace, namespaceUri, serverIndex);
108
- }
109
- exports.makeExpandedNodeId = makeExpandedNodeId;
110
- //# sourceMappingURL=expanded_nodeid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expanded_nodeid.js","sourceRoot":"","sources":["../source/expanded_nodeid.ts"],"names":[],"mappings":";;;AAIA,qCAA4D;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAa,cAAe,SAAQ,eAAM;IAG/B,MAAM,CAAC,UAAU,CAAC,MAAc,EAAE,YAAqB,EAAE,WAAoB;QAChF,OAAO,IAAI,cAAc,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAChH,CAAC;IAaD,YACI,cAAkC,EAClC,KAAuC,EACvC,SAAkB,EAClB,YAA4B,EAC5B,WAAoB;QAEpB,KAAK,CAAC,cAAc,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QACxC,IAAI,CAAC,YAAY,GAAG,YAAY,IAAI,IAAI,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,WAAW,IAAI,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACI,QAAQ;QACX,IAAI,GAAG,GAAG,eAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,IAAI,CAAC,YAAY,EAAE;YACnB,GAAG,IAAI,gBAAgB,GAAG,IAAI,CAAC,YAAY,CAAC;SAC/C;QACD,IAAI,IAAI,CAAC,WAAW,EAAE;YAClB,GAAG,IAAI,eAAe,GAAG,IAAI,CAAC,WAAW,CAAC;SAC7C;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,MAAM;QACT,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC3B,CAAC;;AApDL,wCAqDC;AApDiB,iCAAkB,GAAG,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AAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,oCAAoC,GAAG,KAAK,CAAC,CAAC;KACjE;IACD,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC;IAC3B,OAAO,IAAI,cAAc,CAAC,mBAAU,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;AAClG,CAAC;AAzBD,gDAyBC"}
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * @module node-opcua-nodeid
3
- */
4
- export * from "./nodeid";
5
- export * from "./expanded_nodeid";
package/dist/index.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- /**
18
- * @module node-opcua-nodeid
19
- */
20
- __exportStar(require("./nodeid"), exports);
21
- __exportStar(require("./expanded_nodeid"), exports);
22
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;GAEG;AACH,2CAAyB;AACzB,oDAAkC"}
package/dist/nodeid.d.ts DELETED
@@ -1,122 +0,0 @@
1
- /// <reference types="node" />
2
- import { Guid } from "node-opcua-guid";
3
- /**
4
- * `NodeIdType` an enumeration that specifies the possible types of a `NodeId` value.
5
- */
6
- export declare enum NodeIdType {
7
- /**
8
- * @static
9
- * @property NUMERIC
10
- * @default 0x1
11
- */
12
- NUMERIC = 1,
13
- /**
14
- * @static
15
- * @property STRING
16
- * @default 0x2
17
- */
18
- STRING = 2,
19
- /**
20
- * @static
21
- * @property GUID
22
- * @default 0x3
23
- */
24
- GUID = 3,
25
- /**
26
- * @static
27
- * @property BYTESTRING
28
- * @default 0x4
29
- */
30
- BYTESTRING = 4
31
- }
32
- /**
33
- * Construct a node ID
34
- *
35
- * @class NodeId
36
- * @example
37
- *
38
- * ``` javascript
39
- * const nodeId = new NodeId(NodeIdType.NUMERIC,123,1);
40
- * ```
41
- * @constructor
42
- */
43
- export declare class NodeId {
44
- static NodeIdType: typeof NodeIdType;
45
- static nullNodeId: NodeId;
46
- static resolveNodeId: (a: string | NodeId) => NodeId;
47
- static sameNodeId: (n1: NodeId, n2: NodeId) => boolean;
48
- identifierType: NodeIdType;
49
- value: number | string | Buffer | Guid;
50
- namespace: number;
51
- /**
52
- * @param identifierType - the nodeID type
53
- * @param value - the node id value. The type of Value depends on identifierType.
54
- * @param namespace - the index of the related namespace (optional , default value = 0 )
55
- */
56
- constructor(identifierType?: NodeIdType | null, value?: number | string | Buffer | Guid, namespace?: number);
57
- /**
58
- * get the string representation of the nodeID.
59
- *
60
- * @method toString
61
- * @example
62
- *
63
- * ``` javascript
64
- * const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
65
- * console.log(nodeid.toString());
66
- * ```
67
- *
68
- * ```
69
- * >"ns=1;i=123"
70
- * ```
71
- *
72
- * @param [options.addressSpace] {AddressSpace}
73
- * @return {String}
74
- */
75
- toString(options?: {
76
- addressSpace?: any;
77
- }): string;
78
- /**
79
- * convert nodeId to a JSON string. same as {@link NodeId#toString }
80
- */
81
- toJSON(): string;
82
- displayText(): string;
83
- /**
84
- * returns true if the NodeId is null or empty
85
- */
86
- isEmpty(): boolean;
87
- }
88
- export type NodeIdLike = string | NodeId | number;
89
- /**
90
- * Convert a value into a nodeId:
91
- * @class opcua
92
- * @method coerceNodeId
93
- * @static
94
- *
95
- * @description:
96
- * - if nodeId is a string of form : "i=1234" => nodeId({value=1234, identifierType: NodeIdType.NUMERIC})
97
- * - if nodeId is a string of form : "s=foo" => nodeId({value="foo", identifierType: NodeIdType.STRING})
98
- * - if nodeId is a string of form : "b=ABCD=" => nodeId({value=decodeBase64("ABCD="), identifierType: NodeIdType.BYTESTRING})
99
- * - if nodeId is a {@link NodeId} : coerceNodeId returns value
100
- * @param value
101
- * @param namespace {number}
102
- */
103
- export declare function coerceNodeId(value: unknown, namespace?: number): NodeId;
104
- /**
105
- * construct a node Id from a value and a namespace.
106
- * @class opcua
107
- * @method makeNodeId
108
- * @static
109
- * @param {String|Buffer} value
110
- * @param [namespace]=0 {Number} the node id namespace
111
- * @return {NodeId}
112
- */
113
- export declare function makeNodeId(value: string | Buffer | number, namespace?: number): NodeId;
114
- /**
115
- * @class opcua
116
- * @method resolveNodeId
117
- * @static
118
- * @param nodeIdOrString
119
- * @return the nodeId
120
- */
121
- export declare function resolveNodeId(nodeIdOrString: NodeIdLike): NodeId;
122
- export declare function sameNodeId(n1: NodeId, n2: NodeId): boolean;
package/dist/nodeid.js DELETED
@@ -1,381 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sameNodeId = exports.resolveNodeId = exports.makeNodeId = exports.coerceNodeId = exports.NodeId = exports.NodeIdType = void 0;
4
- /**
5
- * @module node-opcua-nodeid
6
- */
7
- const node_opcua_assert_1 = require("node-opcua-assert");
8
- const node_opcua_constants_1 = require("node-opcua-constants");
9
- const node_opcua_guid_1 = require("node-opcua-guid");
10
- /**
11
- * `NodeIdType` an enumeration that specifies the possible types of a `NodeId` value.
12
- */
13
- var NodeIdType;
14
- (function (NodeIdType) {
15
- /**
16
- * @static
17
- * @property NUMERIC
18
- * @default 0x1
19
- */
20
- NodeIdType[NodeIdType["NUMERIC"] = 1] = "NUMERIC";
21
- /**
22
- * @static
23
- * @property STRING
24
- * @default 0x2
25
- */
26
- NodeIdType[NodeIdType["STRING"] = 2] = "STRING";
27
- /**
28
- * @static
29
- * @property GUID
30
- * @default 0x3
31
- */
32
- NodeIdType[NodeIdType["GUID"] = 3] = "GUID";
33
- /**
34
- * @static
35
- * @property BYTESTRING
36
- * @default 0x4
37
- */
38
- NodeIdType[NodeIdType["BYTESTRING"] = 4] = "BYTESTRING";
39
- })(NodeIdType = exports.NodeIdType || (exports.NodeIdType = {}));
40
- /*function defaultValue(identifierType: NodeIdType.BYTESTRING): null;
41
- function defaultValue(identifierType: NodeIdType.STRING): null;
42
- function defaultValue(identifierType: NodeIdType.NUMERIC): 0;
43
- function defaultValue(identifierType: NodeIdType.GUID): null;
44
- */
45
- function defaultValue(identifierType) {
46
- switch (identifierType) {
47
- case NodeIdType.GUID: return node_opcua_guid_1.emptyGuid;
48
- case NodeIdType.BYTESTRING: return null; // Buffer.alloc(0);
49
- case NodeIdType.STRING: return "";
50
- case NodeIdType.NUMERIC: return 0;
51
- }
52
- }
53
- /**
54
- * Construct a node ID
55
- *
56
- * @class NodeId
57
- * @example
58
- *
59
- * ``` javascript
60
- * const nodeId = new NodeId(NodeIdType.NUMERIC,123,1);
61
- * ```
62
- * @constructor
63
- */
64
- class NodeId {
65
- ;
66
- /**
67
- * @param identifierType - the nodeID type
68
- * @param value - the node id value. The type of Value depends on identifierType.
69
- * @param namespace - the index of the related namespace (optional , default value = 0 )
70
- */
71
- constructor(identifierType, value, namespace) {
72
- if (identifierType === null || identifierType === undefined) {
73
- this.identifierType = NodeIdType.NUMERIC;
74
- this.value = 0;
75
- this.namespace = 0;
76
- return;
77
- }
78
- this.identifierType = identifierType;
79
- this.value = value || defaultValue(identifierType);
80
- this.namespace = namespace || 0;
81
- // namespace shall be a UInt16
82
- (0, node_opcua_assert_1.assert)(this.namespace >= 0 && this.namespace <= 0xffff);
83
- (0, node_opcua_assert_1.assert)(this.identifierType !== NodeIdType.NUMERIC || (this.value !== null && this.value >= 0 && this.value <= 0xffffffff));
84
- (0, node_opcua_assert_1.assert)(this.identifierType !== NodeIdType.GUID || (0, node_opcua_guid_1.isValidGuid)(this.value));
85
- (0, node_opcua_assert_1.assert)(this.identifierType !== NodeIdType.STRING || typeof this.value === "string");
86
- if (this.identifierType === NodeIdType.GUID) {
87
- this.value = (0, node_opcua_guid_1.normalizeGuid)(value);
88
- }
89
- }
90
- /**
91
- * get the string representation of the nodeID.
92
- *
93
- * @method toString
94
- * @example
95
- *
96
- * ``` javascript
97
- * const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
98
- * console.log(nodeid.toString());
99
- * ```
100
- *
101
- * ```
102
- * >"ns=1;i=123"
103
- * ```
104
- *
105
- * @param [options.addressSpace] {AddressSpace}
106
- * @return {String}
107
- */
108
- toString(options) {
109
- const addressSpace = options ? options.addressSpace : null;
110
- let str;
111
- switch (this.identifierType) {
112
- case NodeIdType.NUMERIC:
113
- str = "ns=" + this.namespace + ";i=" + this.value;
114
- break;
115
- case NodeIdType.STRING:
116
- str = "ns=" + this.namespace + ";s=" + this.value;
117
- break;
118
- case NodeIdType.GUID:
119
- str = "ns=" + this.namespace + ";g=" + (0, node_opcua_guid_1.normalizeGuid)(this.value);
120
- break;
121
- default:
122
- (0, node_opcua_assert_1.assert)(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
123
- if (this.value) {
124
- str = "ns=" + this.namespace + ";b=" + this.value.toString("base64");
125
- }
126
- else {
127
- str = "ns=" + this.namespace + ";b=<null>";
128
- }
129
- break;
130
- }
131
- if (addressSpace) {
132
- if (this.namespace === 0 && this.identifierType === NodeIdType.NUMERIC) {
133
- // find standard browse name
134
- const name = reverse_map((this.value || 0).toString()) || "<undefined>";
135
- str += " " + name;
136
- }
137
- else if (addressSpace.findNode) {
138
- // let use the provided address space to figure out the browseNode of this node.
139
- // to make the message a little bit more useful.
140
- const n = addressSpace.findNode(this);
141
- str += " " + (n ? n.browseName.toString() : " (????)");
142
- }
143
- }
144
- return str;
145
- }
146
- /**
147
- * convert nodeId to a JSON string. same as {@link NodeId#toString }
148
- */
149
- toJSON() {
150
- return this.toString();
151
- }
152
- displayText() {
153
- if (this.namespace === 0 && this.identifierType === NodeIdType.NUMERIC) {
154
- const name = reverse_map(this.value.toString());
155
- if (name) {
156
- return name + " (" + this.toString() + ")";
157
- }
158
- }
159
- return this.toString();
160
- }
161
- /**
162
- * returns true if the NodeId is null or empty
163
- */
164
- isEmpty() {
165
- switch (this.identifierType) {
166
- case NodeIdType.NUMERIC:
167
- return this.value === 0;
168
- case NodeIdType.STRING:
169
- return !this.value || this.value.length === 0;
170
- case NodeIdType.GUID:
171
- return !this.value || this.value === node_opcua_guid_1.emptyGuid;
172
- default:
173
- (0, node_opcua_assert_1.assert)(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
174
- return !this.value || this.value.length === 0;
175
- }
176
- }
177
- }
178
- exports.NodeId = NodeId;
179
- NodeId.NodeIdType = NodeIdType;
180
- NodeId.nullNodeId = new Proxy(new NodeId(NodeIdType.NUMERIC, 0, 0), {
181
- get: (target, prop) => {
182
- return target[prop];
183
- },
184
- set: () => {
185
- throw new Error("Cannot assign a value to constant NodeId.nullNodeId");
186
- }
187
- });
188
- const regexNamespaceI = /ns=([0-9]+);i=([0-9]+)/;
189
- const regexNamespaceS = /ns=([0-9]+);s=(.*)/;
190
- const regexNamespaceB = /ns=([0-9]+);b=(.*)/;
191
- 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})/;
192
- /**
193
- * Convert a value into a nodeId:
194
- * @class opcua
195
- * @method coerceNodeId
196
- * @static
197
- *
198
- * @description:
199
- * - if nodeId is a string of form : "i=1234" => nodeId({value=1234, identifierType: NodeIdType.NUMERIC})
200
- * - if nodeId is a string of form : "s=foo" => nodeId({value="foo", identifierType: NodeIdType.STRING})
201
- * - if nodeId is a string of form : "b=ABCD=" => nodeId({value=decodeBase64("ABCD="), identifierType: NodeIdType.BYTESTRING})
202
- * - if nodeId is a {@link NodeId} : coerceNodeId returns value
203
- * @param value
204
- * @param namespace {number}
205
- */
206
- // eslint-disable-next-line max-statements
207
- function coerceNodeId(value, namespace) {
208
- let matches;
209
- let twoFirst;
210
- if (value instanceof NodeId) {
211
- return value;
212
- }
213
- value = value || 0;
214
- namespace = namespace || 0;
215
- let identifierType = NodeIdType.NUMERIC;
216
- if (typeof value === "string") {
217
- identifierType = NodeIdType.STRING;
218
- twoFirst = value.substring(0, 2);
219
- if (twoFirst === "i=") {
220
- identifierType = NodeIdType.NUMERIC;
221
- value = parseInt(value.substring(2), 10);
222
- }
223
- else if (twoFirst === "s=") {
224
- identifierType = NodeIdType.STRING;
225
- value = value.substring(2);
226
- }
227
- else if (twoFirst === "b=") {
228
- identifierType = NodeIdType.BYTESTRING;
229
- value = Buffer.from(value.substring(2), "base64");
230
- }
231
- else if (twoFirst === "g=") {
232
- identifierType = NodeIdType.GUID;
233
- value = (0, node_opcua_guid_1.normalizeGuid)(value.substring(2));
234
- (0, node_opcua_assert_1.assert)((0, node_opcua_guid_1.isValidGuid)(value));
235
- }
236
- else if ((0, node_opcua_guid_1.isValidGuid)(value)) {
237
- identifierType = NodeIdType.GUID;
238
- value = (0, node_opcua_guid_1.normalizeGuid)(value);
239
- }
240
- else if ((matches = regexNamespaceI.exec(value)) !== null) {
241
- identifierType = NodeIdType.NUMERIC;
242
- namespace = parseInt(matches[1], 10);
243
- value = parseInt(matches[2], 10);
244
- }
245
- else if ((matches = regexNamespaceS.exec(value)) !== null) {
246
- identifierType = NodeIdType.STRING;
247
- namespace = parseInt(matches[1], 10);
248
- value = matches[2];
249
- }
250
- else if ((matches = regexNamespaceB.exec(value)) !== null) {
251
- identifierType = NodeIdType.BYTESTRING;
252
- namespace = parseInt(matches[1], 10);
253
- value = Buffer.from(matches[2], "base64");
254
- }
255
- else if ((matches = regexNamespaceG.exec(value)) !== null) {
256
- identifierType = NodeIdType.GUID;
257
- namespace = parseInt(matches[1], 10);
258
- value = (0, node_opcua_guid_1.normalizeGuid)(matches[2]);
259
- }
260
- else {
261
- throw new Error("String cannot be coerced to a nodeId : " + value);
262
- }
263
- }
264
- else if (value instanceof Buffer) {
265
- identifierType = NodeIdType.BYTESTRING;
266
- }
267
- else if (value instanceof Object) {
268
- // it could be a Enum or a NodeId Like object
269
- const tmp = value;
270
- value = tmp.value;
271
- namespace = namespace || tmp.namespace;
272
- identifierType = tmp.identifierType || identifierType;
273
- return new NodeId(identifierType, value, namespace);
274
- }
275
- return new NodeId(identifierType, value, namespace);
276
- }
277
- exports.coerceNodeId = coerceNodeId;
278
- const regEx1 = /^(s|g|b|i|ns)=/;
279
- /**
280
- * construct a node Id from a value and a namespace.
281
- * @class opcua
282
- * @method makeNodeId
283
- * @static
284
- * @param {String|Buffer} value
285
- * @param [namespace]=0 {Number} the node id namespace
286
- * @return {NodeId}
287
- */
288
- function makeNodeId(value, namespace) {
289
- value = value || 0;
290
- namespace = namespace || 0;
291
- let identifierType = NodeIdType.NUMERIC;
292
- if (typeof value === "string") {
293
- if (value.match(regEx1)) {
294
- throw new Error("please use coerce NodeId instead");
295
- }
296
- // 1 2 3
297
- // 012345678901234567890123456789012345
298
- // "72962B91-FA75-4AE6-8D28-B404DC7DAF63"
299
- if ((0, node_opcua_guid_1.isValidGuid)(value)) {
300
- identifierType = NodeIdType.GUID;
301
- value = (0, node_opcua_guid_1.normalizeGuid)(value);
302
- }
303
- else {
304
- identifierType = NodeIdType.STRING;
305
- }
306
- }
307
- else if (value instanceof Buffer) {
308
- identifierType = NodeIdType.BYTESTRING;
309
- }
310
- const nodeId = new NodeId(identifierType, value, namespace);
311
- return nodeId;
312
- }
313
- exports.makeNodeId = makeNodeId;
314
- // reverse maps
315
- let _nodeIdToNameIndex = {};
316
- let _nameToNodeIdIndex = {};
317
- const regName = /[a-zA-Z_].*/;
318
- (function build_standard_nodeid_indexes() {
319
- function expand_map(directIndex) {
320
- for (const name in directIndex) {
321
- if (Object.prototype.hasOwnProperty.call(directIndex, name) && regName.exec(name) !== null) {
322
- const value = directIndex[name];
323
- _nodeIdToNameIndex[value] = name;
324
- _nameToNodeIdIndex[name] = new NodeId(NodeIdType.NUMERIC, value, 0);
325
- }
326
- }
327
- }
328
- _nodeIdToNameIndex = {};
329
- _nameToNodeIdIndex = {};
330
- expand_map(node_opcua_constants_1.ObjectIds);
331
- expand_map(node_opcua_constants_1.ObjectTypeIds);
332
- expand_map(node_opcua_constants_1.VariableIds);
333
- expand_map(node_opcua_constants_1.VariableTypeIds);
334
- expand_map(node_opcua_constants_1.MethodIds);
335
- expand_map(node_opcua_constants_1.ReferenceTypeIds);
336
- expand_map(node_opcua_constants_1.DataTypeIds);
337
- })();
338
- function reverse_map(nodeId) {
339
- return _nodeIdToNameIndex[nodeId];
340
- }
341
- /**
342
- * @class opcua
343
- * @method resolveNodeId
344
- * @static
345
- * @param nodeIdOrString
346
- * @return the nodeId
347
- */
348
- function resolveNodeId(nodeIdOrString) {
349
- let nodeId;
350
- const rawId = typeof nodeIdOrString === "string" ? _nameToNodeIdIndex[nodeIdOrString] : undefined;
351
- if (rawId !== undefined) {
352
- return rawId;
353
- }
354
- else {
355
- nodeId = coerceNodeId(nodeIdOrString);
356
- }
357
- return nodeId;
358
- }
359
- exports.resolveNodeId = resolveNodeId;
360
- NodeId.resolveNodeId = resolveNodeId;
361
- function sameNodeId(n1, n2) {
362
- if (n1.identifierType !== n2.identifierType) {
363
- return false;
364
- }
365
- if (n1.namespace !== n2.namespace) {
366
- return false;
367
- }
368
- switch (n1.identifierType) {
369
- case NodeIdType.NUMERIC:
370
- case NodeIdType.STRING:
371
- case NodeIdType.GUID:
372
- return n1.value === n2.value;
373
- case NodeIdType.BYTESTRING:
374
- return n1.value.toString("hex") === n2.value.toString("hex");
375
- default:
376
- throw new Error("Invalid identifier type");
377
- }
378
- }
379
- exports.sameNodeId = sameNodeId;
380
- NodeId.sameNodeId = sameNodeId;
381
- //# sourceMappingURL=nodeid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nodeid.js","sourceRoot":"","sources":["../source/nodeid.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yDAA2C;AAC3C,+DAQ8B;AAC9B,qDAA8E;AAE9E;;GAEG;AACH,IAAY,UAyBX;AAzBD,WAAY,UAAU;IAClB;;;;OAIG;IACH,iDAAc,CAAA;IACd;;;;OAIG;IACH,+CAAa,CAAA;IACb;;;;OAIG;IACH,2CAAW,CAAA;IACX;;;;OAIG;IACH,uDAAiB,CAAA;AACrB,CAAC,EAzBW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAyBrB;AACD;;;;EAIE;AACF,SAAS,YAAY,CAAC,cAA0B;IAC5C,QAAO,cAAc,EAAE;QACnB,KAAK,UAAU,CAAC,IAAK,CAAC,CAAC,OAAO,2BAAS,CAAC;QACxC,KAAK,UAAU,CAAC,UAAW,CAAC,CAAC,OAAO,IAAqB,CAAC,CAAA,mBAAmB;QAC7E,KAAK,UAAU,CAAC,MAAO,CAAC,CAAC,OAAO,EAAE,CAAC;QACnC,KAAK,UAAU,CAAC,OAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;KACtC;AACL,CAAC;AACD;;;;;;;;;;GAUG;AACH,MAAa,MAAM;IAO+B,CAAC;IAG/C;;;;OAIG;IACH,YAAY,cAAkC,EAAE,KAAuC,EAAE,SAAkB;QACvG,IAAI,cAAc,KAAK,IAAI,IAAI,cAAc,KAAK,SAAS,EAAE;YACzD,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;YACzC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;YACf,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;YACnB,OAAO;SACV;QAED,IAAI,CAAC,cAAc,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