Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

node-opcua-nodeid

Package Overview
Dependencies
Maintainers
1
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-opcua-nodeid - npm Package Compare versions

Comparing version 2.11.0 to 2.16.0

63

dist/expanded_nodeid.js

@@ -44,36 +44,39 @@ "use strict";

*/
class ExpandedNodeId extends nodeid_1.NodeId {
constructor(identifierType, value, namespace, namespaceUri, serverIndex) {
super(identifierType, value, namespace);
this.namespaceUri = namespaceUri || null;
this.serverIndex = serverIndex || 0;
}
static fromNodeId(nodeId, namespaceUri, serverIndex) {
return new ExpandedNodeId(nodeId.identifierType, nodeId.value, nodeId.namespace, namespaceUri, serverIndex);
}
/**
* @method toString
* @return {string}
*/
toString() {
let str = nodeid_1.NodeId.prototype.toString.call(this);
if (this.namespaceUri) {
str += ";namespaceUri:" + this.namespaceUri;
let ExpandedNodeId = /** @class */ (() => {
class ExpandedNodeId extends nodeid_1.NodeId {
constructor(identifierType, value, namespace, namespaceUri, serverIndex) {
super(identifierType, value, namespace);
this.namespaceUri = namespaceUri || null;
this.serverIndex = serverIndex || 0;
}
if (this.serverIndex) {
str += ";serverIndex:" + this.serverIndex;
static fromNodeId(nodeId, namespaceUri, serverIndex) {
return new ExpandedNodeId(nodeId.identifierType, nodeId.value, nodeId.namespace, namespaceUri, serverIndex);
}
return str;
/**
* @method toString
* @return {string}
*/
toString() {
let str = nodeid_1.NodeId.prototype.toString.call(this);
if (this.namespaceUri) {
str += ";namespaceUri:" + this.namespaceUri;
}
if (this.serverIndex) {
str += ";serverIndex:" + this.serverIndex;
}
return str;
}
/**
* convert nodeId to a JSON string. same as {@link NodeId#toString }
* @method toJSON
* @return {String}
*/
toJSON() {
return this.toString();
}
}
/**
* convert nodeId to a JSON string. same as {@link NodeId#toString }
* @method toJSON
* @return {String}
*/
toJSON() {
return this.toString();
}
}
ExpandedNodeId.nullExpandedNodeId = new ExpandedNodeId(nodeid_1.NodeIdType.NUMERIC, 0, 0);
return ExpandedNodeId;
})();
exports.ExpandedNodeId = ExpandedNodeId;
ExpandedNodeId.nullExpandedNodeId = new ExpandedNodeId(nodeid_1.NodeIdType.NUMERIC, 0, 0);
function coerceExpandedNodeId(value) {

@@ -80,0 +83,0 @@ const n = nodeid_1.coerceNodeId(value);

@@ -54,108 +54,111 @@ "use strict";

*/
class NodeId {
/**
* @param identifierType - the nodeID type
* @param value - the node id value. The type of Value depends on identifierType.
* @param namespace - the index of the related namespace (optional , default value = 0 )
*/
constructor(identifierType, value, namespace) {
this.identifierType = identifierType;
this.value = value;
this.namespace = namespace || 0;
// namespace shall be a UInt16
node_opcua_assert_1.assert(this.namespace >= 0 && this.namespace <= 0xFFFF);
node_opcua_assert_1.assert(this.identifierType !== NodeIdType.NUMERIC || (this.value >= 0 && this.value <= 0xFFFFFFFF));
node_opcua_assert_1.assert(this.identifierType !== NodeIdType.GUID || node_opcua_guid_1.isValidGuid(this.value));
node_opcua_assert_1.assert(this.identifierType !== NodeIdType.STRING || typeof this.value === "string");
}
/**
* get the string representation of the nodeID.
*
* @method toString
* @example
*
* ``` javascript
* const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
* console.log(nodeid.toString());
* ```
*
* ```
* >"ns=1;i=123"
* ```
*
* @param [options.addressSpace] {AddressSpace}
* @return {String}
*/
toString(options) {
const addressSpace = options ? options.addressSpace : null;
let str;
switch (this.identifierType) {
case NodeIdType.NUMERIC:
str = "ns=" + this.namespace + ";i=" + this.value;
break;
case NodeIdType.STRING:
str = "ns=" + this.namespace + ";s=" + this.value;
break;
case NodeIdType.GUID:
str = "ns=" + this.namespace + ";g=" + this.value;
break;
default:
node_opcua_assert_1.assert(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
if (this.value) {
str = "ns=" + this.namespace + ";b=" + this.value.toString("hex");
let NodeId = /** @class */ (() => {
class NodeId {
/**
* @param identifierType - the nodeID type
* @param value - the node id value. The type of Value depends on identifierType.
* @param namespace - the index of the related namespace (optional , default value = 0 )
*/
constructor(identifierType, value, namespace) {
this.identifierType = identifierType;
this.value = value;
this.namespace = namespace || 0;
// namespace shall be a UInt16
node_opcua_assert_1.assert(this.namespace >= 0 && this.namespace <= 0xFFFF);
node_opcua_assert_1.assert(this.identifierType !== NodeIdType.NUMERIC || (this.value >= 0 && this.value <= 0xFFFFFFFF));
node_opcua_assert_1.assert(this.identifierType !== NodeIdType.GUID || node_opcua_guid_1.isValidGuid(this.value));
node_opcua_assert_1.assert(this.identifierType !== NodeIdType.STRING || typeof this.value === "string");
}
/**
* get the string representation of the nodeID.
*
* @method toString
* @example
*
* ``` javascript
* const nodeid = new NodeId(NodeIdType.NUMERIC, 123,1);
* console.log(nodeid.toString());
* ```
*
* ```
* >"ns=1;i=123"
* ```
*
* @param [options.addressSpace] {AddressSpace}
* @return {String}
*/
toString(options) {
const addressSpace = options ? options.addressSpace : null;
let str;
switch (this.identifierType) {
case NodeIdType.NUMERIC:
str = "ns=" + this.namespace + ";i=" + this.value;
break;
case NodeIdType.STRING:
str = "ns=" + this.namespace + ";s=" + this.value;
break;
case NodeIdType.GUID:
str = "ns=" + this.namespace + ";g=" + this.value;
break;
default:
node_opcua_assert_1.assert(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
if (this.value) {
str = "ns=" + this.namespace + ";b=" + this.value.toString("hex");
}
else {
str = "ns=" + this.namespace + ";b=<null>";
}
break;
}
if (addressSpace) {
if (this.namespace === 0 && (this.identifierType === NodeIdType.NUMERIC)) {
// find standard browse name
const name = reverse_map(this.value.toString()) || "<undefined>";
str += " " + chalk.green.bold(name);
}
else {
str = "ns=" + this.namespace + ";b=<null>";
else if (addressSpace.findNode) {
// let use the provided address space to figure out the browseNode of this node.
// to make the message a little bit more useful.
const n = addressSpace.findNode(this);
str += " " + (n ? n.browseName.toString() : " (????)");
}
break;
}
return str;
}
if (addressSpace) {
if (this.namespace === 0 && (this.identifierType === NodeIdType.NUMERIC)) {
// find standard browse name
const name = reverse_map(this.value.toString()) || "<undefined>";
str += " " + chalk.green.bold(name);
/**
* convert nodeId to a JSON string. same as {@link NodeId#toString }
*/
toJSON() {
return this.toString();
}
displayText() {
if (this.namespace === 0 && this.identifierType === NodeIdType.NUMERIC) {
const name = reverse_map(this.value.toString());
if (name) {
return name + " (" + this.toString() + ")";
}
}
else if (addressSpace.findNode) {
// let use the provided address space to figure out the browseNode of this node.
// to make the message a little bit more useful.
const n = addressSpace.findNode(this);
str += " " + (n ? n.browseName.toString() : " (????)");
}
return this.toString();
}
return str;
}
/**
* convert nodeId to a JSON string. same as {@link NodeId#toString }
*/
toJSON() {
return this.toString();
}
displayText() {
if (this.namespace === 0 && this.identifierType === NodeIdType.NUMERIC) {
const name = reverse_map(this.value.toString());
if (name) {
return name + " (" + this.toString() + ")";
/**
* returns true if the NodeId is null or empty
*/
isEmpty() {
switch (this.identifierType) {
case NodeIdType.NUMERIC:
return this.value === 0;
case NodeIdType.STRING:
return !this.value || this.value.length === 0;
case NodeIdType.GUID:
return !this.value || this.value === node_opcua_guid_1.emptyGuid;
default:
node_opcua_assert_1.assert(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
return !this.value || this.value.length === 0;
}
}
return this.toString();
}
/**
* returns true if the NodeId is null or empty
*/
isEmpty() {
switch (this.identifierType) {
case NodeIdType.NUMERIC:
return this.value === 0;
case NodeIdType.STRING:
return !this.value || this.value.length === 0;
case NodeIdType.GUID:
return !this.value || this.value === node_opcua_guid_1.emptyGuid;
default:
node_opcua_assert_1.assert(this.identifierType === NodeIdType.BYTESTRING, "invalid identifierType in NodeId : " + this.identifierType);
return !this.value || this.value.length === 0;
}
}
}
NodeId.NodeIdType = NodeIdType;
return NodeId;
})();
exports.NodeId = NodeId;
NodeId.NodeIdType = NodeIdType;
NodeId.nullNodeId = new NodeId(NodeIdType.NUMERIC, 0);

@@ -162,0 +165,0 @@ const regexNamespaceI = /ns=([0-9]+);i=([0-9]+)/;

@@ -5,3 +5,3 @@ {

"types": "./dist/index.d.ts",
"version": "2.11.0",
"version": "2.16.0",
"description": "pure nodejs OPCUA SDK - module -nodeid",

@@ -16,10 +16,10 @@ "scripts": {

"chalk": "^4.1.0",
"node-opcua-assert": "2.10.0",
"node-opcua-constants": "2.9.0",
"node-opcua-enum": "2.10.0",
"node-opcua-guid": "2.10.0",
"node-opcua-assert": "2.16.0",
"node-opcua-constants": "2.16.0",
"node-opcua-enum": "2.16.0",
"node-opcua-guid": "2.16.0",
"underscore": "^1.10.2"
},
"devDependencies": {
"node-opcua-benchmarker": "2.10.0",
"node-opcua-benchmarker": "2.16.0",
"should": "^13.2.3",

@@ -43,3 +43,3 @@ "source-map-support": "^0.5.19"

"homepage": "http://node-opcua.github.io/",
"gitHead": "1e1c6d63340aa799867af261437a6a0f5a9a2cdd"
"gitHead": "9fa7d50952a7c39ff6790888a2bd6f32fe46836d"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc