node-opcua-client-dynamic-extension-object
Advanced tools
Comparing version 2.65.1 to 2.66.0
@@ -142,6 +142,12 @@ "use strict"; | ||
const definition = dataTypeDefinitionDataValue.value.value; | ||
const convertIn64ToInteger = (a) => a[1]; | ||
const convert = (fields) => { | ||
const retVal = {}; | ||
fields && fields.forEach((field) => (retVal[field.name || ""] = convertIn64ToInteger(field.value))); | ||
return retVal; | ||
}; | ||
if (category === node_opcua_factory_1.FieldCategory.enumeration) { | ||
if (definition instanceof node_opcua_types_1.EnumDefinition) { | ||
const e = new node_opcua_factory_1.EnumerationDefinitionSchema({ | ||
enumValues: definition.fields, | ||
enumValues: convert(definition.fields), | ||
name: fieldTypeName | ||
@@ -269,4 +275,3 @@ }); | ||
const fieldTypeName = yield readBrowseName(session, dataTypeNodeId); | ||
field.fieldType = fieldTypeName, | ||
field.category = node_opcua_factory_1.FieldCategory.complex; | ||
(field.fieldType = fieldTypeName), (field.category = node_opcua_factory_1.FieldCategory.complex); | ||
fields.push(field); | ||
@@ -285,4 +290,3 @@ const capturedField = field; | ||
const { schema, category, fieldTypeName } = rt; | ||
field.fieldType = fieldTypeName, | ||
field.category = category; | ||
(field.fieldType = fieldTypeName), (field.category = category); | ||
field.schema = schema; | ||
@@ -289,0 +293,0 @@ fields.push(field); |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
{ | ||
"name": "node-opcua-client-dynamic-extension-object", | ||
"version": "2.65.1", | ||
"version": "2.66.0", | ||
"description": "pure nodejs OPCUA SDK - module client-dynamic-extension-object", | ||
@@ -9,3 +9,3 @@ "main": "./dist/index.js", | ||
"build": "tsc -b", | ||
"clean": "node -e \"require('rimraf').sync('dist');\"", | ||
"clean": "npx rimraf dist *.tsbuildinfo", | ||
"test": "echo no test" | ||
@@ -15,18 +15,18 @@ }, | ||
"chalk": "4.1.2", | ||
"node-opcua-assert": "2.64.1", | ||
"node-opcua-binary-stream": "2.64.1", | ||
"node-opcua-constants": "2.64.1", | ||
"node-opcua-data-model": "2.64.1", | ||
"node-opcua-data-value": "2.64.1", | ||
"node-opcua-debug": "2.64.1", | ||
"node-opcua-extension-object": "2.64.1", | ||
"node-opcua-factory": "2.64.1", | ||
"node-opcua-nodeid": "2.64.1", | ||
"node-opcua-pseudo-session": "2.65.1", | ||
"node-opcua-schemas": "2.64.1", | ||
"node-opcua-service-browse": "2.65.1", | ||
"node-opcua-service-translate-browse-path": "2.65.1", | ||
"node-opcua-status-code": "2.64.1", | ||
"node-opcua-types": "2.65.1", | ||
"node-opcua-variant": "2.64.1" | ||
"node-opcua-assert": "2.66.0", | ||
"node-opcua-binary-stream": "2.66.0", | ||
"node-opcua-constants": "2.66.0", | ||
"node-opcua-data-model": "2.66.0", | ||
"node-opcua-data-value": "2.66.0", | ||
"node-opcua-debug": "2.66.0", | ||
"node-opcua-extension-object": "2.66.0", | ||
"node-opcua-factory": "2.66.0", | ||
"node-opcua-nodeid": "2.66.0", | ||
"node-opcua-pseudo-session": "2.66.0", | ||
"node-opcua-schemas": "2.66.0", | ||
"node-opcua-service-browse": "2.66.0", | ||
"node-opcua-service-translate-browse-path": "2.66.0", | ||
"node-opcua-status-code": "2.66.0", | ||
"node-opcua-types": "2.66.0", | ||
"node-opcua-variant": "2.66.0" | ||
}, | ||
@@ -48,3 +48,3 @@ "author": "Etienne Rossignon", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "494c1a72df17756dafa8661648d7ae4d89be89ea" | ||
"gitHead": "97f47e2e242a1fd737495fd64cb65e8fb7a9964b" | ||
} |
@@ -17,3 +17,10 @@ import { assert } from "node-opcua-assert"; | ||
import { StatusCodes } from "node-opcua-status-code"; | ||
import { EnumDefinition, DataTypeDefinition, StructureDefinition, StructureType, StructureField } from "node-opcua-types"; | ||
import { | ||
EnumDefinition, | ||
DataTypeDefinition, | ||
StructureDefinition, | ||
StructureType, | ||
StructureField, | ||
EnumField | ||
} from "node-opcua-types"; | ||
import { ExtensionObject } from "node-opcua-extension-object"; | ||
@@ -136,7 +143,7 @@ // | ||
cache: { [key: string]: CacheForFieldResolution } | ||
): Promise<{ schema: TypeDefinition| undefined, category: FieldCategory}> { | ||
): Promise<{ schema: TypeDefinition | undefined; category: FieldCategory }> { | ||
const category = await findDataTypeCategory(session, cache, dataTypeNodeId); | ||
debugLog(" type " + fieldTypeName + " has not been seen yet, let resolve it => (category = ", category, " )"); | ||
let schema: TypeDefinition|undefined = undefined; | ||
let schema: TypeDefinition | undefined = undefined; | ||
switch (category) { | ||
@@ -165,6 +172,13 @@ case FieldCategory.basic: | ||
const convertIn64ToInteger = (a: number[]) => a[1]; | ||
const convert = (fields: EnumField[] | null) => { | ||
const retVal: Record<string, number> = {}; | ||
fields && fields.forEach((field: EnumField) => (retVal[field.name || ""] = convertIn64ToInteger(field.value))); | ||
return retVal; | ||
}; | ||
if (category === FieldCategory.enumeration) { | ||
if (definition instanceof EnumDefinition) { | ||
const e = new EnumerationDefinitionSchema({ | ||
enumValues: definition.fields, | ||
enumValues: convert(definition.fields), | ||
name: fieldTypeName | ||
@@ -314,18 +328,16 @@ }); | ||
const postActions: ((schema: StructuredTypeSchema ) => void)[] = []; | ||
const postActions: ((schema: StructuredTypeSchema) => void)[] = []; | ||
for (const fieldD of definition.fields!) { | ||
let field: FieldInterfaceOptions | undefined; | ||
({ field, switchBit, switchValue } = createField(fieldD, switchBit, bitFields, isUnion, switchValue)); | ||
if (fieldD.dataType.value === dataTypeNodeId.value && fieldD.dataType.namespace === dataTypeNodeId.namespace ) { | ||
if (fieldD.dataType.value === dataTypeNodeId.value && fieldD.dataType.namespace === dataTypeNodeId.namespace) { | ||
// this is a structure with a field of the same type | ||
// push an empty placeholder that we will fill later | ||
const fieldTypeName = await readBrowseName(session, dataTypeNodeId); | ||
field.fieldType= fieldTypeName!, | ||
field.category = FieldCategory.complex; | ||
(field.fieldType = fieldTypeName!), (field.category = FieldCategory.complex); | ||
fields.push(field); | ||
const capturedField = field; | ||
postActions.push( (schema: StructuredTypeSchema )=> { | ||
postActions.push((schema: StructuredTypeSchema) => { | ||
capturedField.schema = schema; | ||
@@ -348,4 +360,3 @@ }); | ||
field.fieldType= fieldTypeName!, | ||
field.category = category; | ||
(field.fieldType = fieldTypeName!), (field.category = category); | ||
field.schema = schema; | ||
@@ -367,3 +378,3 @@ fields.push(field); | ||
postActions.forEach((action)=>action(structuredTypeSchema)); | ||
postActions.forEach((action) => action(structuredTypeSchema)); | ||
@@ -374,3 +385,9 @@ return structuredTypeSchema; | ||
function createField(fieldD: StructureField, switchBit: number, bitFields: { name: string; length?: number | undefined; }[] | undefined, isUnion: boolean, switchValue: number) { | ||
function createField( | ||
fieldD: StructureField, | ||
switchBit: number, | ||
bitFields: { name: string; length?: number | undefined }[] | undefined, | ||
isUnion: boolean, | ||
switchValue: number | ||
) { | ||
const field: FieldInterfaceOptions = { | ||
@@ -377,0 +394,0 @@ fieldType: "", |
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
201578
3062
+ Added@types/lodash@4.14.180(transitive)
+ Addednode-opcua-assert@2.66.0(transitive)
+ Addednode-opcua-basic-types@2.66.0(transitive)
+ Addednode-opcua-binary-stream@2.66.0(transitive)
+ Addednode-opcua-buffer-utils@2.66.0(transitive)
+ Addednode-opcua-constants@2.66.0(transitive)
+ Addednode-opcua-data-model@2.66.0(transitive)
+ Addednode-opcua-data-value@2.66.0(transitive)
+ Addednode-opcua-date-time@2.66.0(transitive)
+ Addednode-opcua-debug@2.66.0(transitive)
+ Addednode-opcua-enum@2.66.0(transitive)
+ Addednode-opcua-extension-object@2.66.0(transitive)
+ Addednode-opcua-factory@2.66.0(transitive)
+ Addednode-opcua-generator@2.66.0(transitive)
+ Addednode-opcua-guid@2.66.0(transitive)
+ Addednode-opcua-nodeid@2.66.0(transitive)
+ Addednode-opcua-numeric-range@2.66.0(transitive)
+ Addednode-opcua-packet-analyzer@2.66.0(transitive)
+ Addednode-opcua-pseudo-session@2.66.0(transitive)
+ Addednode-opcua-schemas@2.66.0(transitive)
+ Addednode-opcua-service-browse@2.66.0(transitive)
+ Addednode-opcua-service-call@2.66.0(transitive)
+ Addednode-opcua-service-filter@2.66.0(transitive)
+ Addednode-opcua-service-read@2.66.0(transitive)
+ Addednode-opcua-service-secure-channel@2.66.0(transitive)
+ Addednode-opcua-service-subscription@2.66.0(transitive)
+ Addednode-opcua-service-translate-browse-path@2.66.0(transitive)
+ Addednode-opcua-service-write@2.66.0(transitive)
+ Addednode-opcua-status-code@2.66.0(transitive)
+ Addednode-opcua-types@2.66.0(transitive)
+ Addednode-opcua-utils@2.66.0(transitive)
+ Addednode-opcua-variant@2.66.0(transitive)
+ Addednode-opcua-xml2json@2.66.0(transitive)
- Removed@types/lodash@4.14.179(transitive)
- Removednode-opcua-assert@2.64.1(transitive)
- Removednode-opcua-basic-types@2.64.1(transitive)
- Removednode-opcua-binary-stream@2.64.1(transitive)
- Removednode-opcua-buffer-utils@2.64.1(transitive)
- Removednode-opcua-constants@2.64.1(transitive)
- Removednode-opcua-data-model@2.64.1(transitive)
- Removednode-opcua-data-value@2.64.1(transitive)
- Removednode-opcua-date-time@2.64.1(transitive)
- Removednode-opcua-debug@2.64.1(transitive)
- Removednode-opcua-enum@2.64.1(transitive)
- Removednode-opcua-extension-object@2.64.1(transitive)
- Removednode-opcua-factory@2.64.1(transitive)
- Removednode-opcua-generator@2.65.0(transitive)
- Removednode-opcua-guid@2.64.1(transitive)
- Removednode-opcua-nodeid@2.64.1(transitive)
- Removednode-opcua-numeric-range@2.64.1(transitive)
- Removednode-opcua-packet-analyzer@2.64.1(transitive)
- Removednode-opcua-pseudo-session@2.65.1(transitive)
- Removednode-opcua-schemas@2.64.1(transitive)
- Removednode-opcua-service-browse@2.65.1(transitive)
- Removednode-opcua-service-call@2.65.1(transitive)
- Removednode-opcua-service-filter@2.65.1(transitive)
- Removednode-opcua-service-read@2.65.1(transitive)
- Removednode-opcua-service-secure-channel@2.65.1(transitive)
- Removednode-opcua-service-subscription@2.65.1(transitive)
- Removednode-opcua-service-translate-browse-path@2.65.1(transitive)
- Removednode-opcua-service-write@2.65.1(transitive)
- Removednode-opcua-status-code@2.64.1(transitive)
- Removednode-opcua-types@2.65.1(transitive)
- Removednode-opcua-utils@2.64.1(transitive)
- Removednode-opcua-variant@2.64.1(transitive)
- Removednode-opcua-xml2json@2.64.1(transitive)
Updatednode-opcua-assert@2.66.0
Updatednode-opcua-constants@2.66.0
Updatednode-opcua-data-model@2.66.0
Updatednode-opcua-data-value@2.66.0
Updatednode-opcua-debug@2.66.0
Updatednode-opcua-factory@2.66.0
Updatednode-opcua-nodeid@2.66.0
Updatednode-opcua-schemas@2.66.0
Updatednode-opcua-types@2.66.0
Updatednode-opcua-variant@2.66.0