node-opcua-client-dynamic-extension-object
Advanced tools
Comparing version 2.70.3 to 2.71.0
@@ -0,0 +0,0 @@ import { DataTypeFactory, FieldCategory, StructuredTypeSchema, TypeDefinition } from "node-opcua-factory"; |
@@ -23,2 +23,3 @@ "use strict"; | ||
// | ||
const node_opcua_variant_1 = require("node-opcua-variant"); | ||
const find_encodings_1 = require("./private/find_encodings"); | ||
@@ -248,4 +249,11 @@ const debugLog = (0, node_opcua_debug_1.make_debugLog)(__filename); | ||
function convertDataTypeDefinitionToStructureTypeSchema(session, dataTypeNodeId, name, definition, dataTypeFactory, cache) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (definition instanceof node_opcua_types_1.StructureDefinition) { | ||
let fieldCountToIgnore = 0; | ||
let base = (_a = dataTypeFactory.getConstructorForDataType(definition.baseDataType)) === null || _a === void 0 ? void 0 : _a.schema; | ||
while (base && !(base.dataTypeNodeId.value === node_opcua_variant_1.DataType.ExtensionObject && base.dataTypeNodeId.namespace === 0)) { | ||
fieldCountToIgnore += base._possibleFields.length; | ||
base = base._baseSchema; | ||
} | ||
const fields = []; | ||
@@ -269,26 +277,30 @@ const isUnion = definition.structureType === node_opcua_types_1.StructureType.Union; | ||
const postActions = []; | ||
for (const fieldD of definition.fields) { | ||
let field; | ||
({ field, switchBit, switchValue } = createField(fieldD, switchBit, bitFields, isUnion, switchValue)); | ||
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 = yield readBrowseName(session, dataTypeNodeId); | ||
(field.fieldType = fieldTypeName), (field.category = node_opcua_factory_1.FieldCategory.complex); | ||
if (definition.fields) { | ||
for (let i = fieldCountToIgnore; i < definition.fields.length; i++) { | ||
const fieldD = definition.fields[i]; | ||
// we need to skip fields that have already been handled in base class | ||
let field; | ||
({ field, switchBit, switchValue } = createField(fieldD, switchBit, bitFields, isUnion, switchValue)); | ||
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 = yield readBrowseName(session, dataTypeNodeId); | ||
(field.fieldType = fieldTypeName), (field.category = node_opcua_factory_1.FieldCategory.complex); | ||
fields.push(field); | ||
const capturedField = field; | ||
postActions.push((schema) => { | ||
capturedField.schema = schema; | ||
}); | ||
continue; | ||
} | ||
const rt = (yield resolveFieldType(session, fieldD.dataType, dataTypeFactory, cache)); | ||
if (!rt) { | ||
errorLog("convertDataTypeDefinitionToStructureTypeSchema cannot handle field", fieldD.name, "in", name, "because " + fieldD.dataType.toString() + " cannot be resolved"); | ||
continue; | ||
} | ||
const { schema, category, fieldTypeName } = rt; | ||
(field.fieldType = fieldTypeName), (field.category = category); | ||
field.schema = schema; | ||
fields.push(field); | ||
const capturedField = field; | ||
postActions.push((schema) => { | ||
capturedField.schema = schema; | ||
}); | ||
continue; | ||
} | ||
const rt = (yield resolveFieldType(session, fieldD.dataType, dataTypeFactory, cache)); | ||
if (!rt) { | ||
errorLog("convertDataTypeDefinitionToStructureTypeSchema cannot handle field", fieldD.name, "in", name, "because " + fieldD.dataType.toString() + " cannot be resolved"); | ||
continue; | ||
} | ||
const { schema, category, fieldTypeName } = rt; | ||
(field.fieldType = fieldTypeName), (field.category = category); | ||
field.schema = schema; | ||
fields.push(field); | ||
} | ||
@@ -295,0 +307,0 @@ const a = yield resolveFieldType(session, definition.baseDataType, dataTypeFactory, cache); |
@@ -0,0 +0,0 @@ import { ConstructorFunc, DataTypeFactory } from "node-opcua-factory"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { NodeId } from "node-opcua-nodeid"; |
@@ -0,0 +0,0 @@ "use strict"; |
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { ExtraDataTypeManager } from "./extra_data_type_manager"; | ||
export declare function getExtraDataTypeManager(session: IBasicSession): Promise<ExtraDataTypeManager>; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ "use strict"; |
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { ExtraDataTypeManager } from "./extra_data_type_manager"; | ||
export declare function populateDataTypeManager(session: IBasicSession, dataTypeManager: ExtraDataTypeManager, force: boolean): Promise<void>; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { NodeId } from "node-opcua-nodeid"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IBasicSession } from "node-opcua-pseudo-session"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { DataTypeFactory } from "node-opcua-factory"; |
@@ -0,0 +0,0 @@ "use strict"; |
import { NotificationData } from "node-opcua-types"; | ||
import { IBasicSession } from "node-opcua-pseudo-session/source/basic_session_interface"; | ||
export declare function promoteOpaqueStructureInNotificationData(session: IBasicSession, notificationData: NotificationData[]): Promise<void>; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { IBasicSession } from "node-opcua-pseudo-session"; |
@@ -0,0 +0,0 @@ "use strict"; |
@@ -0,0 +0,0 @@ import { Variant } from "node-opcua-variant"; |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "node-opcua-client-dynamic-extension-object", | ||
"version": "2.70.3", | ||
"version": "2.71.0", | ||
"description": "pure nodejs OPCUA SDK - module client-dynamic-extension-object", | ||
@@ -15,17 +15,17 @@ "main": "./dist/index.js", | ||
"node-opcua-assert": "2.66.0", | ||
"node-opcua-binary-stream": "2.69.0", | ||
"node-opcua-binary-stream": "2.71.0", | ||
"node-opcua-constants": "2.70.0", | ||
"node-opcua-data-model": "2.70.0", | ||
"node-opcua-data-value": "2.70.0", | ||
"node-opcua-debug": "2.69.0", | ||
"node-opcua-extension-object": "2.70.0", | ||
"node-opcua-factory": "2.70.0", | ||
"node-opcua-nodeid": "2.70.0", | ||
"node-opcua-pseudo-session": "2.70.3", | ||
"node-opcua-schemas": "2.70.3", | ||
"node-opcua-service-browse": "2.70.3", | ||
"node-opcua-service-translate-browse-path": "2.70.3", | ||
"node-opcua-status-code": "2.70.0", | ||
"node-opcua-types": "2.70.3", | ||
"node-opcua-variant": "2.70.0" | ||
"node-opcua-data-model": "2.71.0", | ||
"node-opcua-data-value": "2.71.0", | ||
"node-opcua-debug": "2.71.0", | ||
"node-opcua-extension-object": "2.71.0", | ||
"node-opcua-factory": "2.71.0", | ||
"node-opcua-nodeid": "2.71.0", | ||
"node-opcua-pseudo-session": "2.71.0", | ||
"node-opcua-schemas": "2.71.0", | ||
"node-opcua-service-browse": "2.71.0", | ||
"node-opcua-service-translate-browse-path": "2.71.0", | ||
"node-opcua-status-code": "2.71.0", | ||
"node-opcua-types": "2.71.0", | ||
"node-opcua-variant": "2.71.0" | ||
}, | ||
@@ -47,3 +47,3 @@ "author": "Etienne Rossignon", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "08b5465af631fd010bc48843c951b2e556270de4" | ||
"gitHead": "10f7cc1e1cd30dfef75adad9cb709a78401fabf3" | ||
} |
@@ -27,2 +27,3 @@ import { assert } from "node-opcua-assert"; | ||
// | ||
import { DataType } from "node-opcua-variant"; | ||
import { _findEncodings } from "./private/find_encodings"; | ||
@@ -304,2 +305,10 @@ | ||
if (definition instanceof StructureDefinition) { | ||
let fieldCountToIgnore = 0; | ||
let base: undefined | any = dataTypeFactory.getConstructorForDataType(definition.baseDataType)?.schema; | ||
while (base && !(base.dataTypeNodeId.value === DataType.ExtensionObject && base.dataTypeNodeId.namespace === 0)) { | ||
fieldCountToIgnore += base._possibleFields.length; | ||
base = base._baseSchema; | ||
} | ||
const fields: FieldInterfaceOptions[] = []; | ||
@@ -329,36 +338,40 @@ | ||
for (const fieldD of definition.fields!) { | ||
let field: FieldInterfaceOptions | undefined; | ||
({ field, switchBit, switchValue } = createField(fieldD, switchBit, bitFields, isUnion, switchValue)); | ||
if (definition.fields) { | ||
for (let i = fieldCountToIgnore; i < definition.fields.length; i++) { | ||
const fieldD = definition.fields[i]; | ||
// we need to skip fields that have already been handled in base class | ||
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); | ||
let field: FieldInterfaceOptions | undefined; | ||
({ field, switchBit, switchValue } = createField(fieldD, switchBit, bitFields, isUnion, switchValue)); | ||
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); | ||
fields.push(field); | ||
const capturedField = field; | ||
postActions.push((schema: StructuredTypeSchema) => { | ||
capturedField.schema = schema; | ||
}); | ||
continue; | ||
} | ||
const rt = (await resolveFieldType(session, fieldD.dataType, dataTypeFactory, cache))!; | ||
if (!rt) { | ||
errorLog( | ||
"convertDataTypeDefinitionToStructureTypeSchema cannot handle field", | ||
fieldD.name, | ||
"in", | ||
name, | ||
"because " + fieldD.dataType.toString() + " cannot be resolved" | ||
); | ||
continue; | ||
} | ||
const { schema, category, fieldTypeName } = rt; | ||
(field.fieldType = fieldTypeName!), (field.category = category); | ||
field.schema = schema; | ||
fields.push(field); | ||
const capturedField = field; | ||
postActions.push((schema: StructuredTypeSchema) => { | ||
capturedField.schema = schema; | ||
}); | ||
continue; | ||
} | ||
const rt = (await resolveFieldType(session, fieldD.dataType, dataTypeFactory, cache))!; | ||
if (!rt) { | ||
errorLog( | ||
"convertDataTypeDefinitionToStructureTypeSchema cannot handle field", | ||
fieldD.name, | ||
"in", | ||
name, | ||
"because " + fieldD.dataType.toString() + " cannot be resolved" | ||
); | ||
continue; | ||
} | ||
const { schema, category, fieldTypeName } = rt; | ||
(field.fieldType = fieldTypeName!), (field.category = category); | ||
field.schema = schema; | ||
fields.push(field); | ||
} | ||
const a = await resolveFieldType(session, definition.baseDataType, dataTypeFactory, cache); | ||
@@ -365,0 +378,0 @@ const baseType = a ? a.fieldTypeName : "ExtensionObject"; |
@@ -48,2 +48,3 @@ import { assert } from "node-opcua-assert"; | ||
createDynamicObjectConstructor(schema, dataTypeFactory); | ||
} catch (err) { | ||
@@ -50,0 +51,0 @@ errorLog("Error", err); |
@@ -16,4 +16,7 @@ import { BinaryStream } from "node-opcua-binary-stream"; | ||
async function getOrExtractConstructor(session: IBasicSession, binaryEncodingNodeId: NodeId, dataTypeManager: ExtraDataTypeManager): Promise<ConstructorFunc> | ||
{ | ||
async function getOrExtractConstructor( | ||
session: IBasicSession, | ||
binaryEncodingNodeId: NodeId, | ||
dataTypeManager: ExtraDataTypeManager | ||
): Promise<ConstructorFunc> { | ||
const dataTypeFactory = dataTypeManager.getDataTypeFactoryForNamespace(binaryEncodingNodeId.namespace); | ||
@@ -24,4 +27,4 @@ const Constructor = dataTypeFactory.getConstructor(binaryEncodingNodeId); | ||
} | ||
if (binaryEncodingNodeId.namespace ===0) { | ||
throw new Error("Internal Error"); | ||
if (binaryEncodingNodeId.namespace === 0) { | ||
throw new Error("Internal Error"); | ||
} | ||
@@ -40,10 +43,10 @@ // need to extract it | ||
} | ||
const r = browseResult.references![0]; | ||
const dataTypeNodeId =r.nodeId; | ||
const r = browseResult.references![0]; | ||
const dataTypeNodeId = r.nodeId; | ||
if (dataTypeFactory.getConstructorForDataType(dataTypeNodeId)) { | ||
throw new Error("Internal Error: we are not expecting this dataType to be processed already"); | ||
throw new Error("Internal Error: we are not expecting this dataType to be processed already"); | ||
} | ||
await readDataTypeDefinitionAndBuildType(session, dataTypeNodeId, r.browseName.name!, dataTypeFactory, {}); | ||
return dataTypeFactory.getConstructorForDataType(dataTypeNodeId)!; | ||
@@ -106,3 +109,3 @@ } | ||
} | ||
variant.value = await resolveDynamicExtensionObjectV(session, variant.value as OpaqueStructure, dataTypeManager); | ||
} | ||
variant.value = await resolveDynamicExtensionObjectV(session, variant.value, dataTypeManager); | ||
} |
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
297820
53
4293
+ Addednode-opcua-basic-types@2.71.0(transitive)
+ Addednode-opcua-binary-stream@2.71.0(transitive)
+ Addednode-opcua-buffer-utils@2.71.0(transitive)
+ Addednode-opcua-data-model@2.71.0(transitive)
+ Addednode-opcua-data-value@2.71.0(transitive)
+ Addednode-opcua-date-time@2.71.0(transitive)
+ Addednode-opcua-debug@2.71.0(transitive)
+ Addednode-opcua-enum@2.71.0(transitive)
+ Addednode-opcua-extension-object@2.71.0(transitive)
+ Addednode-opcua-factory@2.71.0(transitive)
+ Addednode-opcua-generator@2.71.0(transitive)
+ Addednode-opcua-nodeid@2.71.0(transitive)
+ Addednode-opcua-numeric-range@2.71.0(transitive)
+ Addednode-opcua-packet-analyzer@2.71.0(transitive)
+ Addednode-opcua-pseudo-session@2.71.0(transitive)
+ Addednode-opcua-schemas@2.71.0(transitive)
+ Addednode-opcua-service-browse@2.71.0(transitive)
+ Addednode-opcua-service-call@2.71.0(transitive)
+ Addednode-opcua-service-filter@2.71.0(transitive)
+ Addednode-opcua-service-read@2.71.0(transitive)
+ Addednode-opcua-service-secure-channel@2.71.0(transitive)
+ Addednode-opcua-service-subscription@2.71.0(transitive)
+ Addednode-opcua-service-translate-browse-path@2.71.0(transitive)
+ Addednode-opcua-service-write@2.71.0(transitive)
+ Addednode-opcua-status-code@2.71.0(transitive)
+ Addednode-opcua-types@2.71.0(transitive)
+ Addednode-opcua-utils@2.71.0(transitive)
+ Addednode-opcua-variant@2.71.0(transitive)
+ Addednode-opcua-xml2json@2.71.0(transitive)
- Removednode-opcua-basic-types@2.70.0(transitive)
- Removednode-opcua-binary-stream@2.69.0(transitive)
- Removednode-opcua-buffer-utils@2.69.0(transitive)
- Removednode-opcua-data-model@2.70.0(transitive)
- Removednode-opcua-data-value@2.70.0(transitive)
- Removednode-opcua-date-time@2.69.0(transitive)
- Removednode-opcua-debug@2.69.0(transitive)
- Removednode-opcua-enum@2.69.0(transitive)
- Removednode-opcua-extension-object@2.70.0(transitive)
- Removednode-opcua-factory@2.70.0(transitive)
- Removednode-opcua-generator@2.70.3(transitive)
- Removednode-opcua-nodeid@2.70.0(transitive)
- Removednode-opcua-numeric-range@2.70.0(transitive)
- Removednode-opcua-packet-analyzer@2.70.0(transitive)
- Removednode-opcua-pseudo-session@2.70.3(transitive)
- Removednode-opcua-schemas@2.70.3(transitive)
- Removednode-opcua-service-browse@2.70.3(transitive)
- Removednode-opcua-service-call@2.70.3(transitive)
- Removednode-opcua-service-filter@2.70.3(transitive)
- Removednode-opcua-service-read@2.70.3(transitive)
- Removednode-opcua-service-secure-channel@2.70.3(transitive)
- Removednode-opcua-service-subscription@2.70.3(transitive)
- Removednode-opcua-service-translate-browse-path@2.70.3(transitive)
- Removednode-opcua-service-write@2.70.3(transitive)
- Removednode-opcua-status-code@2.70.0(transitive)
- Removednode-opcua-types@2.70.3(transitive)
- Removednode-opcua-utils@2.69.0(transitive)
- Removednode-opcua-variant@2.70.0(transitive)
- Removednode-opcua-xml2json@2.70.3(transitive)
Updatednode-opcua-data-model@2.71.0
Updatednode-opcua-data-value@2.71.0
Updatednode-opcua-debug@2.71.0
Updatednode-opcua-factory@2.71.0
Updatednode-opcua-nodeid@2.71.0
Updatednode-opcua-schemas@2.71.0
Updatednode-opcua-types@2.71.0
Updatednode-opcua-variant@2.71.0