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.70.3 to 2.71.0

dist/client_dynamic_extension_object.d.ts

0

dist/convert_data_type_definition_to_structuretype_schema.d.ts

@@ -0,0 +0,0 @@ import { DataTypeFactory, FieldCategory, StructuredTypeSchema, TypeDefinition } from "node-opcua-factory";

56

dist/convert_data_type_definition_to_structuretype_schema.js

@@ -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 @@ import { DataTypeFactory } from "node-opcua-factory";

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 @@ 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

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