node-opcua-schemas
Advanced tools
Comparing version 2.133.0 to 2.134.0
@@ -223,12 +223,28 @@ "use strict"; | ||
else { | ||
const constructor = dataTypeFactory.getStructureInfoByTypeName(field.fieldType).constructor; | ||
if (!constructor) { | ||
throw new Error("Cannot instantiate an abstract dataType" + field.fieldType); | ||
const hasStructure = dataTypeFactory.hasStructureByTypeName(field.fieldType); | ||
// We could have a structure or a enumeration | ||
if (!hasStructure) { | ||
const enumeration = dataTypeFactory.getEnumeration(field.fieldType); | ||
if (!enumeration) { | ||
throw new Error("Cannot find" + field.fieldType + " as a structure or enumeration"); | ||
} | ||
else { | ||
if (field.isArray) { | ||
const arr = value || []; | ||
thisAny[name] = arr.map((x) => enumeration.typedEnum.get(x)); | ||
} | ||
else { | ||
thisAny[name] = enumeration.typedEnum.get(value); | ||
} | ||
} | ||
} | ||
if (field.isArray) { | ||
const arr = value || []; | ||
thisAny[name] = arr.map((x) => (constructor ? new constructor(x) : null)); | ||
} | ||
else { | ||
thisAny[name] = constructor ? new constructor(value) : null; | ||
const constructor = dataTypeFactory.getStructureInfoByTypeName(field.fieldType).constructor; | ||
if (field.isArray) { | ||
const arr = value || []; | ||
thisAny[name] = arr.map((x) => (constructor ? new constructor(x) : null)); | ||
} | ||
else { | ||
thisAny[name] = constructor ? new constructor(value) : null; | ||
} | ||
} | ||
@@ -235,0 +251,0 @@ } |
{ | ||
"name": "node-opcua-schemas", | ||
"version": "2.133.0", | ||
"version": "2.134.0", | ||
"description": "pure nodejs OPCUA SDK - module schemas", | ||
@@ -19,11 +19,11 @@ "main": "dist/source/index.js", | ||
"node-opcua-debug": "2.133.0", | ||
"node-opcua-extension-object": "2.133.0", | ||
"node-opcua-factory": "2.133.0", | ||
"node-opcua-extension-object": "2.134.0", | ||
"node-opcua-factory": "2.134.0", | ||
"node-opcua-nodeid": "2.133.0", | ||
"node-opcua-variant": "2.133.0", | ||
"node-opcua-variant": "2.134.0", | ||
"node-opcua-xml2json": "2.133.0" | ||
}, | ||
"devDependencies": { | ||
"node-opcua-data-model": "2.133.0", | ||
"node-opcua-packet-analyzer": "2.133.0", | ||
"node-opcua-data-model": "2.134.0", | ||
"node-opcua-packet-analyzer": "2.134.0", | ||
"node-opcua-utils": "2.133.0" | ||
@@ -46,3 +46,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "921bb04f2e7ce3109dd051ff27a2210edf700344", | ||
"gitHead": "ccb34926a3c195f6a7e66fca58a2f101858e78be", | ||
"files": [ | ||
@@ -49,0 +49,0 @@ "dist", |
@@ -272,11 +272,25 @@ /** | ||
} else { | ||
const constructor = dataTypeFactory.getStructureInfoByTypeName(field.fieldType).constructor; | ||
if (!constructor) { | ||
throw new Error("Cannot instantiate an abstract dataType" + field.fieldType); | ||
} | ||
if (field.isArray) { | ||
const arr = (value as unknown[]) || []; | ||
thisAny[name] = arr.map((x: any) => (constructor ? new constructor(x) : null)); | ||
const hasStructure = dataTypeFactory.hasStructureByTypeName(field.fieldType); | ||
// We could have a structure or a enumeration | ||
if (!hasStructure) { | ||
const enumeration = dataTypeFactory.getEnumeration(field.fieldType); | ||
if (!enumeration) { | ||
throw new Error("Cannot find" + field.fieldType + " as a structure or enumeration"); | ||
} else { | ||
if (field.isArray) { | ||
const arr = (value as unknown[]) || []; | ||
thisAny[name] = arr.map((x: any) => enumeration.typedEnum.get(x)); | ||
} else { | ||
thisAny[name] = enumeration.typedEnum.get(value as number | string); | ||
} | ||
} | ||
} else { | ||
thisAny[name] = constructor ? new constructor(value as Record<string, unknown>) : null; | ||
const constructor = dataTypeFactory.getStructureInfoByTypeName(field.fieldType).constructor; | ||
if (field.isArray) { | ||
const arr = (value as unknown[]) || []; | ||
thisAny[name] = arr.map((x: any) => (constructor ? new constructor(x) : null)); | ||
} else { | ||
thisAny[name] = constructor ? new constructor(value as Record<string, unknown>) : null; | ||
} | ||
} | ||
@@ -283,0 +297,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
230973
2959
+ Added@types/long@4.0.0(transitive)
+ Addedlong@4.0.0(transitive)
+ Addednode-opcua-basic-types@2.134.0(transitive)
+ Addednode-opcua-data-model@2.134.0(transitive)
+ Addednode-opcua-date-time@2.134.0(transitive)
+ Addednode-opcua-extension-object@2.134.0(transitive)
+ Addednode-opcua-factory@2.134.0(transitive)
+ Addednode-opcua-variant@2.134.0(transitive)
- Removedlong@5.2.3(transitive)
- Removednode-opcua-basic-types@2.133.0(transitive)
- Removednode-opcua-data-model@2.133.0(transitive)
- Removednode-opcua-date-time@2.133.0(transitive)
- Removednode-opcua-extension-object@2.133.0(transitive)
- Removednode-opcua-factory@2.133.0(transitive)
- Removednode-opcua-variant@2.133.0(transitive)
Updatednode-opcua-factory@2.134.0
Updatednode-opcua-variant@2.134.0