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

node-opcua-client-dynamic-extension-object

Package Overview
Dependencies
Maintainers
1
Versions
201
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-opcua-client-dynamic-extension-object - npm Package Compare versions

Comparing version 2.5.0-alpha.14 to 2.5.1

54

dist/client_dynamic_extension_object.js

@@ -210,3 +210,3 @@ "use strict";

const dataTypeNodeIds = yield _enrichWithDescriptionOf(session, dataTypeDescriptions);
// now read DataTypeDefition attributes of all the dataTypeNodeIds
// now read DataTypeDefition attributes of all the dataTypeNodeIds, this will only contains concrete structure
const nodesToRead = dataTypeNodeIds.map((nodeId) => ({

@@ -223,18 +223,24 @@ attributeId: node_opcua_data_model_1.AttributeIds.DataTypeDefinition, nodeId,

const dataTypeDescription = dataTypeDescriptions[index];
index++;
/* istanbul ignore next */
if (dataValue.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
continue;
/* istanbul ignore else */
if (dataValue.statusCode === node_opcua_status_code_1.StatusCodes.Good) {
const dataTypeDefinition = dataValue.value.value;
if (dataTypeDefinition && dataTypeDefinition instanceof node_opcua_types_1.StructureDefinition) {
const className = dataTypeDescription.browseName.name;
dataTypeDefinitions.push({ className, dataTypeNodeId, dataTypeDefinition });
}
}
const dataTypeDefinition = dataValue.value.value;
if (dataTypeDefinition && dataTypeDefinition instanceof node_opcua_types_1.StructureDefinition) {
const className = dataTypeDescription.browseName.name;
dataTypeDefinitions.push({ className, dataTypeNodeId, dataTypeDefinition });
else {
debugLog("dataTypeNodeId ", dataTypeNodeId.toString(), " has no DataTypeDescription attribute", dataValue.statusCode.toString());
}
index++;
}
// to do put in logicial order
const dataTypeDefinitionsSorted = sortStructure(dataTypeDefinitions);
if (doDebug) {
debugLog("order ", dataTypeDefinitionsSorted.map((a) => a.className + " " + a.dataTypeNodeId).join(" -> "));
}
for (const { className, dataTypeNodeId, dataTypeDefinition } of dataTypeDefinitionsSorted) {
console.log(chalk.yellow("--------------------------------------- "), className, dataTypeNodeId.toString());
if (dataTypeFactory.hasStructuredType(className)) {
continue;
continue; // this structure has already been seen
}

@@ -282,3 +288,3 @@ // now fill typeDictionary

if (isDictionaryDeprecated || !rawSchemaDataValue.value.value) {
debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null ! ", chalk.cyan(name.value.value.toString()), "namespace =", namespace);
debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null !", chalk.cyan(name.value.value.toString()), "namespace =", namespace);
debugLog("lets use the new way (1.04) and let's crawl all dataTypes exposed by this name space");

@@ -353,3 +359,5 @@ // dataType definition in store directily in UADataType under the $definition property

const name = ref.browseName.name.toString();
debugLog(" type ", name.padEnd(30, " "), binaryEncoding.toString());
if (doDebug) {
debugLog(" type ", name.padEnd(30, " "), binaryEncoding.toString());
}
// let's verify that constructor is operational

@@ -668,3 +676,3 @@ try {

return __awaiter(this, void 0, void 0, function* () {
if (dataTypeNodeId.value === 0) {
if (dataTypeNodeId.value === 0 || (dataTypeNodeId.namespace === 0 && dataTypeNodeId.value === 22)) {
// this is the default Structure !

@@ -697,3 +705,3 @@ // throw new Error("invalid nodeId " + dataTypeNodeId.toString());

category = yield findDataTypeCategory(session, cache, dataTypeNodeId);
debugLog(" type " + fieldTypeName + " has not been seen yet, let resolve it (category = ", category, " )");
debugLog(" type " + fieldTypeName + " has not been seen yet, let resolve it => (category = ", category, " )");
switch (category) {

@@ -712,7 +720,7 @@ case "basic":

if (dataTypeDefinitionDataValue.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
throw new Error(" Cannot find dataType Definition!");
throw new Error(" Cannot find dataType Definition ! with nodeId =" + dataTypeNodeId.toString());
}
const definition = dataTypeDefinitionDataValue.value.value;
// schema = await convertDataTypeDefinitionToStructureTypeSchema(session, fieldTypeName, definition, dataTypeFactory, cache);
schema = dataTypeFactory.getStructuredTypeSchema(fieldTypeName);
schema = yield convertDataTypeDefinitionToStructureTypeSchema(session, dataTypeNodeId, fieldTypeName, definition, dataTypeFactory, cache);
// xx const schema1 = dataTypeFactory.getStructuredTypeSchema(fieldTypeName);
break;

@@ -733,8 +741,12 @@ }

return __awaiter(this, void 0, void 0, function* () {
// read abstract flag
const isAbstractDV = yield session.read({ nodeId: dataTypeNodeId, attributeId: node_opcua_data_model_1.AttributeIds.IsAbstract });
schema.dataTypeNodeId = dataTypeNodeId;
schema.id = dataTypeNodeId;
const encodings = yield _findEncodings(session, dataTypeNodeId);
schema.encodingDefaultBinary = node_opcua_nodeid_1.makeExpandedNodeId(encodings.binaryEncodingNodeId);
schema.encodingDefaultXml = node_opcua_nodeid_1.makeExpandedNodeId(encodings.xmlEncodingNodeId);
schema.encodingDefaultJson = node_opcua_nodeid_1.makeExpandedNodeId(encodings.jsonEncodingNodeId);
if (isAbstractDV.statusCode === node_opcua_status_code_1.StatusCodes.Good && isAbstractDV.value.value === false) {
const encodings = yield _findEncodings(session, dataTypeNodeId);
schema.encodingDefaultBinary = node_opcua_nodeid_1.makeExpandedNodeId(encodings.binaryEncodingNodeId);
schema.encodingDefaultXml = node_opcua_nodeid_1.makeExpandedNodeId(encodings.xmlEncodingNodeId);
schema.encodingDefaultJson = node_opcua_nodeid_1.makeExpandedNodeId(encodings.jsonEncodingNodeId);
}
return schema;

@@ -741,0 +753,0 @@ });

{
"name": "node-opcua-client-dynamic-extension-object",
"version": "2.5.0-alpha.14",
"version": "2.5.1",
"description": "pure nodejs OPCUA SDK - module client-dynamic-extension-object",

@@ -13,17 +13,17 @@ "main": "./dist/index.js",

"chalk": "^3.0.0",
"node-opcua-assert": "^2.5.0-alpha.4",
"node-opcua-binary-stream": "^2.5.0-alpha.4",
"node-opcua-data-model": "^2.5.0-alpha.12",
"node-opcua-data-value": "^2.5.0-alpha.12",
"node-opcua-debug": "^2.5.0-alpha.4",
"node-opcua-extension-object": "^2.5.0-alpha.12",
"node-opcua-factory": "^2.5.0-alpha.12",
"node-opcua-nodeid": "^2.5.0-alpha.4",
"node-opcua-pseudo-session": "^2.5.0-alpha.12",
"node-opcua-schemas": "^2.5.0-alpha.12",
"node-opcua-service-browse": "^2.5.0-alpha.12",
"node-opcua-service-translate-browse-path": "^2.5.0-alpha.12",
"node-opcua-status-code": "^2.5.0-alpha.4",
"node-opcua-types": "^2.5.0-alpha.12",
"node-opcua-variant": "^2.5.0-alpha.12"
"node-opcua-assert": "^2.5.1",
"node-opcua-binary-stream": "^2.5.1",
"node-opcua-data-model": "^2.5.1",
"node-opcua-data-value": "^2.5.1",
"node-opcua-debug": "^2.5.1",
"node-opcua-extension-object": "^2.5.1",
"node-opcua-factory": "^2.5.1",
"node-opcua-nodeid": "^2.5.1",
"node-opcua-pseudo-session": "^2.5.1",
"node-opcua-schemas": "^2.5.1",
"node-opcua-service-browse": "^2.5.1",
"node-opcua-service-translate-browse-path": "^2.5.1",
"node-opcua-status-code": "^2.5.1",
"node-opcua-types": "^2.5.1",
"node-opcua-variant": "^2.5.1"
},

@@ -45,3 +45,3 @@ "author": "Etienne Rossignon",

"homepage": "http://node-opcua.github.io/",
"gitHead": "f5cfb0fe127f1e023dcdc60f705979438def017b"
"gitHead": "4cc18f384bbdf33c5cdd2a7857e810425aa67c8b"
}

@@ -293,3 +293,3 @@ // tslint:disable: no-console

// now read DataTypeDefition attributes of all the dataTypeNodeIds
// now read DataTypeDefition attributes of all the dataTypeNodeIds, this will only contains concrete structure
const nodesToRead: ReadValueIdLike[] = dataTypeNodeIds.map((nodeId: NodeId) => ({

@@ -311,21 +311,27 @@ attributeId: AttributeIds.DataTypeDefinition, nodeId,

const dataTypeDescription = dataTypeDescriptions[index];
index++;
/* istanbul ignore next */
if (dataValue.statusCode !== StatusCodes.Good) {
continue;
}
const dataTypeDefinition = dataValue.value.value;
/* istanbul ignore else */
if (dataValue.statusCode === StatusCodes.Good) {
const dataTypeDefinition = dataValue.value.value;
if (dataTypeDefinition && dataTypeDefinition instanceof StructureDefinition) {
const className = dataTypeDescription.browseName.name!;
dataTypeDefinitions.push({ className, dataTypeNodeId, dataTypeDefinition });
if (dataTypeDefinition && dataTypeDefinition instanceof StructureDefinition) {
const className = dataTypeDescription.browseName.name!;
dataTypeDefinitions.push({ className, dataTypeNodeId, dataTypeDefinition });
}
} else {
debugLog("dataTypeNodeId ", dataTypeNodeId.toString(), " has no DataTypeDescription attribute", dataValue.statusCode.toString());
}
index++;
}
// to do put in logicial order
const dataTypeDefinitionsSorted = sortStructure(dataTypeDefinitions);
if (doDebug) {
debugLog("order ", dataTypeDefinitionsSorted.map((a) => a.className + " " + a.dataTypeNodeId).join(" -> "));
}
for (const { className, dataTypeNodeId, dataTypeDefinition } of dataTypeDefinitionsSorted) {
for (const { className, dataTypeNodeId, dataTypeDefinition } of dataTypeDefinitionsSorted) {
console.log(chalk.yellow("--------------------------------------- "), className, dataTypeNodeId.toString());
if (dataTypeFactory.hasStructuredType(className)) {
continue;
continue; // this structure has already been seen
}

@@ -388,3 +394,3 @@ // now fill typeDictionary

debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null ! ", chalk.cyan(name.value.value.toString()), "namespace =", namespace);
debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null !", chalk.cyan(name.value.value.toString()), "namespace =", namespace);
debugLog("lets use the new way (1.04) and let's crawl all dataTypes exposed by this name space");

@@ -468,2 +474,3 @@

if (doDebug) {
console.log(chalk.bgWhite.red("testing new constructors"));

@@ -474,4 +481,5 @@ const tuples = _.zip(references, binaryEncodingNodeIds);

const name = ref.browseName!.name!.toString();
debugLog(" type ", name.padEnd(30, " "), binaryEncoding.toString());
if (doDebug) {
debugLog(" type ", name.padEnd(30, " "), binaryEncoding.toString());
}
// let's verify that constructor is operational

@@ -580,3 +588,3 @@ try {

}
const promises2: Array<Promise<void>> = [];
const promises2: Promise<void>[] = [];
for (const ref of references) {

@@ -851,3 +859,3 @@ promises2.push(processReference2(ref));

if (dataTypeNodeId.value === 0) {
if (dataTypeNodeId.value === 0 || (dataTypeNodeId.namespace === 0 && dataTypeNodeId.value === 22)) {
// this is the default Structure !

@@ -880,5 +888,4 @@ // throw new Error("invalid nodeId " + dataTypeNodeId.toString());

category = await findDataTypeCategory(session, cache, dataTypeNodeId);
debugLog(" type " + fieldTypeName + " has not been seen yet, let resolve it => (category = ", category, " )");
debugLog(" type " + fieldTypeName + " has not been seen yet, let resolve it (category = ", category, " )");
switch (category) {

@@ -898,8 +905,9 @@ case "basic":

if (dataTypeDefinitionDataValue.statusCode !== StatusCodes.Good) {
throw new Error(" Cannot find dataType Definition!");
throw new Error(" Cannot find dataType Definition ! with nodeId =" + dataTypeNodeId.toString());
}
const definition = dataTypeDefinitionDataValue.value.value;
// schema = await convertDataTypeDefinitionToStructureTypeSchema(session, fieldTypeName, definition, dataTypeFactory, cache);
schema = dataTypeFactory.getStructuredTypeSchema(fieldTypeName);
schema = await convertDataTypeDefinitionToStructureTypeSchema(
session, dataTypeNodeId, fieldTypeName, definition, dataTypeFactory, cache);
// xx const schema1 = dataTypeFactory.getStructuredTypeSchema(fieldTypeName);
break;

@@ -925,9 +933,13 @@ }

// read abstract flag
const isAbstractDV = await session.read({ nodeId: dataTypeNodeId, attributeId: AttributeIds.IsAbstract });
schema.dataTypeNodeId = dataTypeNodeId;
schema.id = dataTypeNodeId;
const encodings = await _findEncodings(session, dataTypeNodeId);
schema.encodingDefaultBinary = makeExpandedNodeId(encodings.binaryEncodingNodeId);
schema.encodingDefaultXml = makeExpandedNodeId(encodings.xmlEncodingNodeId);
schema.encodingDefaultJson = makeExpandedNodeId(encodings.jsonEncodingNodeId);
if (isAbstractDV.statusCode === StatusCodes.Good && isAbstractDV.value.value === false) {
const encodings = await _findEncodings(session, dataTypeNodeId);
schema.encodingDefaultBinary = makeExpandedNodeId(encodings.binaryEncodingNodeId);
schema.encodingDefaultXml = makeExpandedNodeId(encodings.xmlEncodingNodeId);
schema.encodingDefaultJson = makeExpandedNodeId(encodings.jsonEncodingNodeId);
}
return schema;

@@ -934,0 +946,0 @@ }

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