node-opcua-client-dynamic-extension-object
Advanced tools
Comparing version 2.77.0 to 2.78.0
@@ -156,3 +156,3 @@ "use strict"; | ||
if (definition instanceof node_opcua_types_1.EnumDefinition) { | ||
const e = new node_opcua_factory_1.EnumerationDefinitionSchema({ | ||
const e = new node_opcua_factory_1.EnumerationDefinitionSchema(dataTypeNodeId, { | ||
enumValues: convert(definition.fields), | ||
@@ -159,0 +159,0 @@ name: fieldTypeName |
@@ -12,2 +12,3 @@ /** | ||
export * from "./convert_data_type_definition_to_structuretype_schema"; | ||
export * from "./convert_structuretype_schema_to_structure_definition"; | ||
export * from "./promote_opaque_structure_in_notification_data"; |
@@ -28,3 +28,4 @@ "use strict"; | ||
__exportStar(require("./convert_data_type_definition_to_structuretype_schema"), exports); | ||
__exportStar(require("./convert_structuretype_schema_to_structure_definition"), exports); | ||
__exportStar(require("./promote_opaque_structure_in_notification_data"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -118,5 +118,5 @@ "use strict"; | ||
const nodesToBrowseDataType = []; | ||
let i = 0; | ||
for (const result3 of results3) { | ||
const dataTypeDescription = dataTypeDescriptions[i++]; | ||
for (let i = 0; i < results3.length; i++) { | ||
const result3 = results3[i]; | ||
const dataTypeDescription = dataTypeDescriptions[i]; | ||
result3.references = result3.references || []; | ||
@@ -145,4 +145,4 @@ if (result3.references.length === 0) { | ||
includeSubtypes: false, | ||
nodeClassMask: (0, node_opcua_data_model_1.makeNodeClassMask)("DataType"), | ||
nodeId: ref.nodeId.toString(), | ||
nodeClassMask: node_opcua_data_model_1.NodeClassMask.DataType, | ||
nodeId: ref.nodeId, | ||
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasEncoding"), | ||
@@ -157,14 +157,42 @@ // resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition") | ||
const results4 = yield (0, node_opcua_pseudo_session_1.browseAll)(session, nodesToBrowseDataType); | ||
i = 0; | ||
for (const result4 of results4) { | ||
for (let i = 0; i < results4.length; i++) { | ||
const result4 = results4[i]; | ||
result4.references = result4.references || []; | ||
/* istanbul ignore next */ | ||
if (result4.references.length !== 1) { | ||
console.log("What's going on ?", result4.toString()); | ||
errorLog("What's going on ?", result4.toString(), "result4.references.length = ", result4.references.length); | ||
} | ||
for (const ref of result4.references) { | ||
const dataTypeNodeId = ref.nodeId; | ||
dataTypeNodeIds.push(dataTypeNodeId); | ||
const dataTypeDescription = dataTypeDescriptions[i++]; | ||
dataTypeDescription.encodings.dataTypeNodeId = dataTypeNodeId; | ||
const ref = result4.references[0]; | ||
const dataTypeNodeId = ref.nodeId; | ||
dataTypeNodeIds[i] = dataTypeNodeId; | ||
const dataTypeDescription = dataTypeDescriptions[i]; | ||
dataTypeDescription.encodings.dataTypeNodeId = dataTypeNodeId; | ||
} | ||
} | ||
const otherEncodingBrowse = dataTypeNodeIds.map((dataTypeNodeId) => ({ | ||
browseDirection: node_opcua_service_browse_1.BrowseDirection.Forward, | ||
includeSubtypes: false, | ||
nodeClassMask: node_opcua_data_model_1.NodeClassMask.Object, | ||
nodeId: dataTypeNodeId, | ||
referenceTypeId: (0, node_opcua_nodeid_1.resolveNodeId)("HasEncoding"), | ||
// resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition") | ||
resultMask: (0, node_opcua_data_model_1.makeResultMask)("NodeId | BrowseName") | ||
})); | ||
const results5 = yield (0, node_opcua_pseudo_session_1.browseAll)(session, otherEncodingBrowse); | ||
for (let i = 0; i < results5.length; i++) { | ||
const result5 = results5[i]; | ||
const dataTypeDescription = dataTypeDescriptions[i]; | ||
for (const ref of result5.references || []) { | ||
switch (ref.browseName.name) { | ||
case "Default XML": | ||
dataTypeDescription.encodings.xmlEncodingNodeId = ref.nodeId; | ||
break; | ||
case "Default Binary": | ||
dataTypeDescription.encodings.binaryEncodingNodeId = ref.nodeId; | ||
break; | ||
case "Default JSON": | ||
dataTypeDescription.encodings.jsonEncodingNodeId = ref.nodeId; | ||
break; | ||
default: | ||
errorLog("Cannot handle unknown encoding", ref.browseName.name); | ||
} | ||
@@ -286,10 +314,13 @@ } | ||
} | ||
function _isOldDataTypeDictionary(d) { | ||
const isDictionaryDeprecated = d.isDictionaryDeprecated; // await _readDeprecatedFlag(session, dataTypeDictionaryNodeId); | ||
const rawSchema = d.rawSchema; // DataValue = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.Value }); | ||
return !isDictionaryDeprecated && rawSchema.length >= 0; | ||
} | ||
function _extractDataTypeDictionary(session, d, dataTypeManager) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const dataTypeDictionaryNodeId = d.reference.nodeId; | ||
const isDictionaryDeprecated = d.isDictionaryDeprecated; // await _readDeprecatedFlag(session, dataTypeDictionaryNodeId); | ||
const rawSchema = d.rawSchema; // DataValue = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.Value }); | ||
const name = yield session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: node_opcua_data_model_1.AttributeIds.BrowseName }); | ||
const namespace = yield _readNamespaceUriProperty(session, dataTypeDictionaryNodeId); | ||
if (isDictionaryDeprecated || rawSchema.length === 0) { | ||
if (!_isOldDataTypeDictionary(d)) { | ||
debugLog("DataTypeDictionary is deprecated or BSD schema stored in dataValue is null !", chalk.cyan(name.value.value.toString()), "namespace =", namespace); | ||
@@ -303,5 +334,5 @@ debugLog("let's use the new way (1.04) and let's crawl all dataTypes exposed by this name space"); | ||
yield _extractDataTypeDictionaryFromDefinition(session, dataTypeDictionaryNodeId, dataTypeFactory2); | ||
return; | ||
} | ||
else { | ||
const rawSchema = d.rawSchema; // DataValue = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.Value }); | ||
debugLog(" ----- Using old method for extracting schema => with BSD files"); | ||
@@ -308,0 +339,0 @@ // old method ( until 1.03 ) |
{ | ||
"name": "node-opcua-client-dynamic-extension-object", | ||
"version": "2.77.0", | ||
"version": "2.78.0", | ||
"description": "pure nodejs OPCUA SDK - module client-dynamic-extension-object", | ||
@@ -16,15 +16,15 @@ "main": "./dist/index.js", | ||
"node-opcua-binary-stream": "2.77.0", | ||
"node-opcua-data-model": "2.77.0", | ||
"node-opcua-data-value": "2.77.0", | ||
"node-opcua-data-model": "2.78.0", | ||
"node-opcua-data-value": "2.78.0", | ||
"node-opcua-debug": "2.77.0", | ||
"node-opcua-extension-object": "2.77.0", | ||
"node-opcua-factory": "2.77.0", | ||
"node-opcua-extension-object": "2.78.0", | ||
"node-opcua-factory": "2.78.0", | ||
"node-opcua-nodeid": "2.77.0", | ||
"node-opcua-pseudo-session": "2.77.0", | ||
"node-opcua-schemas": "2.77.0", | ||
"node-opcua-service-browse": "2.77.0", | ||
"node-opcua-service-translate-browse-path": "2.77.0", | ||
"node-opcua-pseudo-session": "2.78.0", | ||
"node-opcua-schemas": "2.78.0", | ||
"node-opcua-service-browse": "2.78.0", | ||
"node-opcua-service-translate-browse-path": "2.78.0", | ||
"node-opcua-status-code": "2.77.0", | ||
"node-opcua-types": "2.77.0", | ||
"node-opcua-variant": "2.77.0" | ||
"node-opcua-types": "2.78.0", | ||
"node-opcua-variant": "2.78.0" | ||
}, | ||
@@ -46,3 +46,3 @@ "author": "Etienne Rossignon", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "5c8d45772d786fa4ba59369dd26679353ab5482b" | ||
"gitHead": "31c6eee3c51f52427584364fff2fdb07bbac65be" | ||
} |
@@ -194,3 +194,3 @@ import { assert } from "node-opcua-assert"; | ||
if (definition instanceof EnumDefinition) { | ||
const e = new EnumerationDefinitionSchema({ | ||
const e = new EnumerationDefinitionSchema(dataTypeNodeId, { | ||
enumValues: convert(definition.fields), | ||
@@ -197,0 +197,0 @@ name: fieldTypeName |
@@ -12,2 +12,3 @@ /** | ||
export * from "./convert_data_type_definition_to_structuretype_schema"; | ||
export * from "./convert_structuretype_schema_to_structure_definition"; | ||
export * from "./promote_opaque_structure_in_notification_data"; |
@@ -9,3 +9,3 @@ /* eslint-disable max-statements */ | ||
import { assert } from "node-opcua-assert"; | ||
import { AttributeIds, makeNodeClassMask, makeResultMask, QualifiedName } from "node-opcua-data-model"; | ||
import { AttributeIds, makeNodeClassMask, makeResultMask, NodeClassMask, QualifiedName } from "node-opcua-data-model"; | ||
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug"; | ||
@@ -24,3 +24,3 @@ import { ConstructorFuncWithSchema, DataTypeFactory, getStandardDataTypeFactory } from "node-opcua-factory"; | ||
import { StatusCodes } from "node-opcua-status-code"; | ||
import { ReadValueIdOptions, StructureDefinition } from "node-opcua-types"; | ||
import { BrowsePath, ReadValueIdOptions, StructureDefinition } from "node-opcua-types"; | ||
@@ -127,5 +127,6 @@ import { ExtraDataTypeManager } from "../extra_data_type_manager"; | ||
let i = 0; | ||
for (const result3 of results3) { | ||
const dataTypeDescription = dataTypeDescriptions[i++]; | ||
for (let i=0;i< results3.length;i++) { | ||
const result3 = results3[i]; | ||
const dataTypeDescription = dataTypeDescriptions[i]; | ||
@@ -140,3 +141,3 @@ result3.references = result3.references || []; | ||
warningLog("_enrichWithDescriptionOf : expecting 1 reference for ", dataTypeDescription.browseName.toString()); | ||
warningLog(result3.toString()); | ||
warningLog(result3.toString()); | ||
continue; | ||
@@ -157,4 +158,4 @@ } | ||
includeSubtypes: false, | ||
nodeClassMask: makeNodeClassMask("DataType"), | ||
nodeId: ref.nodeId.toString(), | ||
nodeClassMask: NodeClassMask.DataType, | ||
nodeId: ref.nodeId, | ||
referenceTypeId: resolveNodeId("HasEncoding"), | ||
@@ -166,7 +167,10 @@ // resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition") | ||
} | ||
const dataTypeNodeIds: NodeId[] = []; | ||
if (nodesToBrowseDataType.length > 0) { | ||
const results4 = await browseAll(session, nodesToBrowseDataType); | ||
i = 0; | ||
for (const result4 of results4) { | ||
for (let i=0;i< results4.length; i++) { | ||
const result4 =results4[i]; | ||
result4.references = result4.references || []; | ||
@@ -176,13 +180,41 @@ | ||
if (result4.references.length !== 1) { | ||
console.log("What's going on ?", result4.toString()); | ||
errorLog("What's going on ?", result4.toString(), "result4.references.length = ", result4.references.length); | ||
} | ||
for (const ref of result4.references) { | ||
const dataTypeNodeId = ref.nodeId; | ||
const ref = result4.references![0]; | ||
const dataTypeNodeId = ref.nodeId; | ||
dataTypeNodeIds[i]= dataTypeNodeId; | ||
const dataTypeDescription = dataTypeDescriptions[i]; | ||
dataTypeDescription.encodings!.dataTypeNodeId = dataTypeNodeId; | ||
} | ||
} | ||
dataTypeNodeIds.push(dataTypeNodeId); | ||
const otherEncodingBrowse = dataTypeNodeIds.map((dataTypeNodeId)=>({ | ||
browseDirection: BrowseDirection.Forward, | ||
includeSubtypes: false, | ||
nodeClassMask: NodeClassMask.Object, | ||
nodeId: dataTypeNodeId, | ||
referenceTypeId: resolveNodeId("HasEncoding"), | ||
// resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition") | ||
resultMask: makeResultMask("NodeId | BrowseName") | ||
})); | ||
const dataTypeDescription = dataTypeDescriptions[i++]; | ||
dataTypeDescription.encodings!.dataTypeNodeId = dataTypeNodeId; | ||
} | ||
const results5 = await browseAll(session, otherEncodingBrowse); | ||
for (let i=0;i<results5.length;i++) { | ||
const result5= results5[i]; | ||
const dataTypeDescription = dataTypeDescriptions[i]; | ||
for (const ref of result5.references || []) { | ||
switch(ref.browseName.name) { | ||
case "Default XML": | ||
dataTypeDescription.encodings!.xmlEncodingNodeId = ref.nodeId; | ||
break; | ||
case "Default Binary": | ||
dataTypeDescription.encodings!.binaryEncodingNodeId = ref.nodeId; | ||
break; | ||
case "Default JSON": | ||
dataTypeDescription.encodings!.jsonEncodingNodeId = ref.nodeId; | ||
break; | ||
default: | ||
errorLog("Cannot handle unknown encoding", ref.browseName.name); | ||
} | ||
} | ||
@@ -354,2 +386,7 @@ } | ||
function _isOldDataTypeDictionary(d: TypeDictionaryInfo) { | ||
const isDictionaryDeprecated = d.isDictionaryDeprecated; // await _readDeprecatedFlag(session, dataTypeDictionaryNodeId); | ||
const rawSchema = d.rawSchema; // DataValue = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.Value }); | ||
return !isDictionaryDeprecated && rawSchema.length >=0; | ||
} | ||
async function _extractDataTypeDictionary( | ||
@@ -362,9 +399,6 @@ session: IBasicSession, | ||
const isDictionaryDeprecated = d.isDictionaryDeprecated; // await _readDeprecatedFlag(session, dataTypeDictionaryNodeId); | ||
const rawSchema = d.rawSchema; // DataValue = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.Value }); | ||
const name = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.BrowseName }); | ||
const namespace = await _readNamespaceUriProperty(session, dataTypeDictionaryNodeId); | ||
if (isDictionaryDeprecated || rawSchema.length === 0) { | ||
if (!_isOldDataTypeDictionary(d)) { | ||
debugLog( | ||
@@ -384,4 +418,4 @@ "DataTypeDictionary is deprecated or BSD schema stored in dataValue is null !", | ||
await _extractDataTypeDictionaryFromDefinition(session, dataTypeDictionaryNodeId, dataTypeFactory2); | ||
return; | ||
} else { | ||
const rawSchema = d.rawSchema; // DataValue = await session.read({ nodeId: dataTypeDictionaryNodeId, attributeId: AttributeIds.Value }); | ||
debugLog(" ----- Using old method for extracting schema => with BSD files"); | ||
@@ -388,0 +422,0 @@ // old method ( until 1.03 ) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
251591
55
3867
+ Addednode-opcua-data-model@2.78.0(transitive)
+ Addednode-opcua-data-value@2.78.0(transitive)
+ Addednode-opcua-extension-object@2.78.0(transitive)
+ Addednode-opcua-factory@2.78.0(transitive)
+ Addednode-opcua-generator@2.78.0(transitive)
+ Addednode-opcua-numeric-range@2.78.0(transitive)
+ Addednode-opcua-pseudo-session@2.78.0(transitive)
+ Addednode-opcua-schemas@2.78.0(transitive)
+ Addednode-opcua-service-browse@2.78.0(transitive)
+ Addednode-opcua-service-call@2.78.0(transitive)
+ Addednode-opcua-service-read@2.78.0(transitive)
+ Addednode-opcua-service-secure-channel@2.78.0(transitive)
+ Addednode-opcua-service-subscription@2.78.0(transitive)
+ Addednode-opcua-service-translate-browse-path@2.78.0(transitive)
+ Addednode-opcua-service-write@2.78.0(transitive)
+ Addednode-opcua-types@2.78.0(transitive)
+ Addednode-opcua-variant@2.78.0(transitive)
- Removednode-opcua-data-model@2.77.0(transitive)
- Removednode-opcua-data-value@2.77.0(transitive)
- Removednode-opcua-extension-object@2.77.0(transitive)
- Removednode-opcua-factory@2.77.0(transitive)
- Removednode-opcua-generator@2.77.0(transitive)
- Removednode-opcua-numeric-range@2.77.0(transitive)
- Removednode-opcua-pseudo-session@2.77.0(transitive)
- Removednode-opcua-schemas@2.77.0(transitive)
- Removednode-opcua-service-browse@2.77.0(transitive)
- Removednode-opcua-service-call@2.77.0(transitive)
- Removednode-opcua-service-read@2.77.0(transitive)
- Removednode-opcua-service-secure-channel@2.77.0(transitive)
- Removednode-opcua-service-subscription@2.77.0(transitive)
- Removednode-opcua-service-translate-browse-path@2.77.0(transitive)
- Removednode-opcua-service-write@2.77.0(transitive)
- Removednode-opcua-types@2.77.0(transitive)
- Removednode-opcua-variant@2.77.0(transitive)
Updatednode-opcua-data-model@2.78.0
Updatednode-opcua-data-value@2.78.0
Updatednode-opcua-factory@2.78.0
Updatednode-opcua-schemas@2.78.0
Updatednode-opcua-types@2.78.0
Updatednode-opcua-variant@2.78.0