node-opcua-client-dynamic-extension-object
Advanced tools
Comparing version 2.117.0 to 2.118.0
import { DataTypeFactory, FieldCategory, IStructuredTypeSchema, TypeDefinition } from "node-opcua-factory"; | ||
import { NodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { DataTypeDefinition } from "node-opcua-types"; | ||
@@ -12,4 +12,4 @@ export interface CacheForFieldResolution { | ||
} | ||
export declare function convertDataTypeDefinitionToStructureTypeSchema(session: IBasicSession, dataTypeNodeId: NodeId, name: string, definition: DataTypeDefinition, dataTypeFactory: DataTypeFactory, isAbstract: boolean, cache: { | ||
export declare function convertDataTypeDefinitionToStructureTypeSchema(session: IBasicSessionAsync2, dataTypeNodeId: NodeId, name: string, definition: DataTypeDefinition, dataTypeFactory: DataTypeFactory, isAbstract: boolean, cache: { | ||
[key: string]: CacheForFieldResolution; | ||
}): Promise<IStructuredTypeSchema>; |
import { NodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { AnyConstructorFunc } from "node-opcua-schemas"; | ||
@@ -7,2 +7,2 @@ /** | ||
*/ | ||
export declare function getExtensionObjectConstructor(session: IBasicSession, dataTypeNodeId: NodeId): Promise<AnyConstructorFunc>; | ||
export declare function getExtensionObjectConstructor(session: IBasicSessionAsync2, dataTypeNodeId: NodeId): Promise<AnyConstructorFunc>; |
@@ -1,4 +0,4 @@ | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { ExtraDataTypeManager } from "./extra_data_type_manager"; | ||
export declare function invalidateExtraDataTypeManager(session: IBasicSession): Promise<void>; | ||
export declare function getExtraDataTypeManager(session: IBasicSession): Promise<ExtraDataTypeManager>; | ||
export declare function invalidateExtraDataTypeManager(session: IBasicSessionAsync2): Promise<void>; | ||
export declare function getExtraDataTypeManager(session: IBasicSessionAsync2): Promise<ExtraDataTypeManager>; |
@@ -1,2 +0,2 @@ | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { ExtraDataTypeManager } from "./extra_data_type_manager"; | ||
@@ -6,3 +6,3 @@ /** | ||
*/ | ||
export declare function serverImplementsDataTypeDefinition(session: IBasicSession): Promise<boolean>; | ||
export declare function populateDataTypeManager(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void>; | ||
export declare function serverImplementsDataTypeDefinition(session: IBasicSessionAsync2): Promise<boolean>; | ||
export declare function populateDataTypeManager(session: IBasicSessionAsync2, dataTypeManager: ExtraDataTypeManager): Promise<void>; |
import { NodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { ISessionForBrowseAll } from "node-opcua-pseudo-session"; | ||
import { DataTypeAndEncodingId } from "node-opcua-schemas"; | ||
export declare function _findEncodings(session: IBasicSession, dataTypeNodeId: NodeId): Promise<DataTypeAndEncodingId>; | ||
export declare function _findEncodings(session: ISessionForBrowseAll, dataTypeNodeId: NodeId): Promise<DataTypeAndEncodingId>; |
@@ -1,2 +0,2 @@ | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { ExtraDataTypeManager } from "../extra_data_type_manager"; | ||
@@ -9,2 +9,2 @@ /** | ||
*/ | ||
export declare function populateDataTypeManager103(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void>; | ||
export declare function populateDataTypeManager103(session: IBasicSessionAsync2, dataTypeManager: ExtraDataTypeManager): Promise<void>; |
import { DataTypeFactory } from "node-opcua-factory"; | ||
import { NodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { ExtraDataTypeManager } from "../extra_data_type_manager"; | ||
import { CacheForFieldResolution } from "../convert_data_type_definition_to_structuretype_schema"; | ||
export declare function readDataTypeDefinitionAndBuildType(session: IBasicSession, dataTypeNodeId: NodeId, name: string, dataTypeFactory: DataTypeFactory, cache: { | ||
export declare function readDataTypeDefinitionAndBuildType(session: IBasicSessionAsync2, dataTypeNodeId: NodeId, name: string, dataTypeFactory: DataTypeFactory, cache: { | ||
[key: string]: CacheForFieldResolution; | ||
}): Promise<void>; | ||
export declare function populateDataTypeManager104(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void>; | ||
export declare function populateDataTypeManager104(session: IBasicSessionAsync2, dataTypeManager: ExtraDataTypeManager): Promise<void>; |
@@ -116,3 +116,3 @@ "use strict"; | ||
pendingNodesToBrowse.push(nodeToBrowse); | ||
// taskMananager.registerTask(flushBrowse); | ||
// taskManager.registerTask(flushBrowse); | ||
} | ||
@@ -119,0 +119,0 @@ else if (result.statusCode.isGood()) { |
import { NotificationData } from "node-opcua-types"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
export declare function promoteOpaqueStructureInNotificationData(session: IBasicSession, notificationData: NotificationData[]): Promise<void>; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
export declare function promoteOpaqueStructureInNotificationData(session: IBasicSessionAsync2, notificationData: NotificationData[]): Promise<void>; |
@@ -1,2 +0,2 @@ | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { Variant } from "node-opcua-variant"; | ||
@@ -7,2 +7,2 @@ export interface PseudoDataValue { | ||
export declare function extractDataValueToPromote(dataValues: PseudoDataValue[]): PseudoDataValue[]; | ||
export declare function promoteOpaqueStructure(session: IBasicSession, dataValues: PseudoDataValue[]): Promise<void>; | ||
export declare function promoteOpaqueStructure(session: IBasicSessionAsync2, dataValues: PseudoDataValue[]): Promise<void>; |
@@ -9,12 +9,11 @@ "use strict"; | ||
const resolve_dynamic_extension_object_1 = require("./resolve_dynamic_extension_object"); | ||
; | ||
function extractDataValueToPromote(dataValues) { | ||
// count number of Opaque Structures | ||
const dataValuesToFix = dataValues.filter((dataValue) => dataValue.value && dataValue.value.dataType === node_opcua_variant_1.DataType.ExtensionObject && | ||
((dataValue.value.arrayType === node_opcua_variant_1.VariantArrayType.Scalar | ||
&& dataValue.value.value instanceof node_opcua_extension_object_1.OpaqueStructure) | ||
|| | ||
(dataValue.value.arrayType !== node_opcua_variant_1.VariantArrayType.Scalar | ||
&& dataValue.value.value && dataValue.value.value.length >= 0 | ||
&& dataValue.value.value[0] instanceof node_opcua_extension_object_1.OpaqueStructure))); | ||
const dataValuesToFix = dataValues.filter((dataValue) => dataValue.value && | ||
dataValue.value.dataType === node_opcua_variant_1.DataType.ExtensionObject && | ||
((dataValue.value.arrayType === node_opcua_variant_1.VariantArrayType.Scalar && dataValue.value.value instanceof node_opcua_extension_object_1.OpaqueStructure) || | ||
(dataValue.value.arrayType !== node_opcua_variant_1.VariantArrayType.Scalar && | ||
dataValue.value.value && | ||
dataValue.value.value.length >= 0 && | ||
dataValue.value.value[0] instanceof node_opcua_extension_object_1.OpaqueStructure))); | ||
return dataValuesToFix; | ||
@@ -34,5 +33,5 @@ } | ||
// https://medium.com/swlh/dealing-with-multiple-promises-in-javascript-41d6c21f20ff | ||
await Promise.all(promises.map(p => p.catch(e => e))); | ||
await Promise.all(promises.map((p) => p.catch((e) => e))); | ||
} | ||
exports.promoteOpaqueStructure = promoteOpaqueStructure; | ||
//# sourceMappingURL=promote_opaque_structure.js.map |
import { ExtensionObject } from "node-opcua-extension-object"; | ||
import { Variant } from "node-opcua-variant"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { ExtraDataTypeManager } from "./extra_data_type_manager"; | ||
export declare function resolveOpaqueStructureInExtentionObject(session: IBasicSession, dataTypeManager: ExtraDataTypeManager, object: ExtensionObject): Promise<void>; | ||
export declare function resolveDynamicExtensionObject(session: IBasicSession, variant: Variant, dataTypeManager: ExtraDataTypeManager): Promise<void>; | ||
export declare function resolveOpaqueStructureInExtentionObject(session: IBasicSessionAsync2, dataTypeManager: ExtraDataTypeManager, object: ExtensionObject): Promise<void>; | ||
export declare function resolveDynamicExtensionObject(session: IBasicSessionAsync2, variant: Variant, dataTypeManager: ExtraDataTypeManager): Promise<void>; |
{ | ||
"name": "node-opcua-client-dynamic-extension-object", | ||
"version": "2.117.0", | ||
"version": "2.118.0", | ||
"description": "pure nodejs OPCUA SDK - module client-dynamic-extension-object", | ||
@@ -17,15 +17,15 @@ "main": "./dist/index.js", | ||
"node-opcua-constants": "2.114.0", | ||
"node-opcua-data-model": "2.117.0", | ||
"node-opcua-data-value": "2.117.0", | ||
"node-opcua-debug": "2.117.0", | ||
"node-opcua-extension-object": "2.117.0", | ||
"node-opcua-factory": "2.117.0", | ||
"node-opcua-nodeid": "2.117.0", | ||
"node-opcua-pseudo-session": "2.117.0", | ||
"node-opcua-schemas": "2.117.0", | ||
"node-opcua-service-browse": "2.117.0", | ||
"node-opcua-service-translate-browse-path": "2.117.0", | ||
"node-opcua-data-model": "2.118.0", | ||
"node-opcua-data-value": "2.118.0", | ||
"node-opcua-debug": "2.118.0", | ||
"node-opcua-extension-object": "2.118.0", | ||
"node-opcua-factory": "2.118.0", | ||
"node-opcua-nodeid": "2.118.0", | ||
"node-opcua-pseudo-session": "2.118.0", | ||
"node-opcua-schemas": "2.118.0", | ||
"node-opcua-service-browse": "2.118.0", | ||
"node-opcua-service-translate-browse-path": "2.118.0", | ||
"node-opcua-status-code": "2.117.0", | ||
"node-opcua-types": "2.117.0", | ||
"node-opcua-variant": "2.117.0" | ||
"node-opcua-types": "2.118.0", | ||
"node-opcua-variant": "2.118.0" | ||
}, | ||
@@ -47,3 +47,3 @@ "author": "Etienne Rossignon", | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "99ed7589a203923985c25be8907b36485c798bbe", | ||
"gitHead": "6210aaa97b43554e3982113041963b2720e50a95", | ||
"files": [ | ||
@@ -50,0 +50,0 @@ "dist", |
@@ -1,2 +0,1 @@ | ||
import { assert } from "node-opcua-assert"; | ||
import { AttributeIds, BrowseDirection, makeResultMask, NodeClassMask } from "node-opcua-data-model"; | ||
@@ -9,3 +8,2 @@ import { DataValue } from "node-opcua-data-value"; | ||
BitField, | ||
ConstructorFuncWithSchema, | ||
DataTypeFactory, | ||
@@ -22,4 +20,3 @@ EnumerationDefinitionSchema, | ||
import { NodeId, makeExpandedNodeId, resolveNodeId, coerceNodeId } from "node-opcua-nodeid"; | ||
import { browseAll, BrowseDescriptionLike, findBasicDataType, getBuiltInDataType, IBasicSession } from "node-opcua-pseudo-session"; | ||
import { StatusCodes } from "node-opcua-status-code"; | ||
import { browseAll, BrowseDescriptionLike, findBasicDataType, IBasicSessionAsync, IBasicSessionAsync2, IBasicSessionBrowseNextAsync } from "node-opcua-pseudo-session"; | ||
import { | ||
@@ -42,3 +39,3 @@ EnumDefinition, | ||
async function findSuperType(session: IBasicSession, dataTypeNodeId: NodeId): Promise<NodeId> { | ||
async function findSuperType(session: IBasicSessionAsync2, dataTypeNodeId: NodeId): Promise<NodeId> { | ||
if (dataTypeNodeId.namespace === 0 && dataTypeNodeId.value === 24) { | ||
@@ -75,3 +72,3 @@ // BaseDataType ! | ||
async function findDataTypeCategory( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
cache: { [key: string]: CacheForFieldResolution }, | ||
@@ -108,3 +105,3 @@ dataTypeNodeId: NodeId | ||
async function findDataTypeBasicType( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
cache: { [key: string]: CacheForFieldResolution }, | ||
@@ -149,3 +146,3 @@ dataTypeNodeId: NodeId | ||
async function readBrowseName(session: IBasicSession, nodeId: NodeId): Promise<string> { | ||
async function readBrowseName(session: IBasicSessionAsync, nodeId: NodeId): Promise<string> { | ||
const dataValue = await session.read({ nodeId, attributeId: AttributeIds.BrowseName }); | ||
@@ -162,3 +159,3 @@ if (dataValue.statusCode.isNotGood()) { | ||
async function resolve2( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeNodeId: NodeId, | ||
@@ -231,3 +228,3 @@ dataTypeFactory: DataTypeFactory, | ||
const isExtensionObject = async (session: IBasicSession, dataTypeNodeId: NodeId): Promise<boolean> => { | ||
const isExtensionObject = async (session: IBasicSessionAsync2, dataTypeNodeId: NodeId): Promise<boolean> => { | ||
if (dataTypeNodeId.namespace === 0 && dataTypeNodeId.value === DataType.ExtensionObject) { | ||
@@ -252,3 +249,3 @@ return true; | ||
async function resolveFieldType( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeNodeId: NodeId, | ||
@@ -356,3 +353,3 @@ dataTypeFactory: DataTypeFactory, | ||
async function _setupEncodings( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync & IBasicSessionBrowseNextAsync, | ||
dataTypeNodeId: NodeId, | ||
@@ -376,3 +373,3 @@ schema: IStructuredTypeSchema | ||
export async function convertDataTypeDefinitionToStructureTypeSchema( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeNodeId: NodeId, | ||
@@ -379,0 +376,0 @@ name: string, |
import { QualifiedName, AttributeIds } from "node-opcua-data-model"; | ||
import { NodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { AnyConstructorFunc } from "node-opcua-schemas"; | ||
@@ -12,3 +12,3 @@ // | ||
*/ | ||
export async function getExtensionObjectConstructor(session: IBasicSession, dataTypeNodeId: NodeId): Promise<AnyConstructorFunc> { | ||
export async function getExtensionObjectConstructor(session: IBasicSessionAsync2, dataTypeNodeId: NodeId): Promise<AnyConstructorFunc> { | ||
const extraDataTypeManager = await getExtraDataTypeManager(session); | ||
@@ -15,0 +15,0 @@ |
import { checkDebugFlag, make_debugLog, make_errorLog } from "node-opcua-debug"; | ||
import { DataTypeFactory, getStandardDataTypeFactory } from "node-opcua-factory"; | ||
import { IBasicSession, readNamespaceArray } from "node-opcua-pseudo-session"; | ||
import { | ||
IBasicSessionAsync2, | ||
readNamespaceArray | ||
} from "node-opcua-pseudo-session"; | ||
// | ||
@@ -13,7 +16,7 @@ import { ExtraDataTypeManager } from "./extra_data_type_manager"; | ||
interface IBasicSessionEx extends IBasicSession { | ||
interface IBasicSessionEx extends IBasicSessionAsync2 { | ||
$$extraDataTypeManager?: ExtraDataTypeManager; | ||
$$extraDataTypeManagerToResolve?: [(a: ExtraDataTypeManager) => void, (err: Error) => void][]; | ||
} | ||
export async function invalidateExtraDataTypeManager(session: IBasicSession): Promise<void> { | ||
export async function invalidateExtraDataTypeManager(session: IBasicSessionAsync2): Promise<void> { | ||
const sessionPriv: IBasicSessionEx = session as IBasicSessionEx; | ||
@@ -26,3 +29,3 @@ sessionPriv.$$extraDataTypeManager = undefined; | ||
async function extractDataTypeManager(session: IBasicSession): Promise<ExtraDataTypeManager> { | ||
async function extractDataTypeManager(session: IBasicSessionAsync2): Promise<ExtraDataTypeManager> { | ||
const namespaceArray = await readNamespaceArray(session); | ||
@@ -51,3 +54,3 @@ // istanbul ignore next | ||
export async function getExtraDataTypeManager(session: IBasicSession): Promise<ExtraDataTypeManager> { | ||
export async function getExtraDataTypeManager(session: IBasicSessionAsync2): Promise<ExtraDataTypeManager> { | ||
const sessionPriv: IBasicSessionEx = session as IBasicSessionEx; | ||
@@ -54,0 +57,0 @@ if (sessionPriv.$$extraDataTypeManager) { |
import { AttributeIds, BrowseDirection, NodeClassMask, ResultMask } from "node-opcua-data-model"; | ||
import { resolveNodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession, browseAll } from "node-opcua-pseudo-session"; | ||
import { DataTypeIds, ObjectIds, ObjectTypeIds, VariableTypeIds } from "node-opcua-constants"; | ||
import { | ||
IBasicSessionAsync2, | ||
browseAll | ||
} from "node-opcua-pseudo-session"; | ||
import { DataTypeIds, ObjectIds, VariableTypeIds } from "node-opcua-constants"; | ||
import { DataType } from "node-opcua-variant"; | ||
@@ -16,3 +19,5 @@ import { ReferenceDescription } from "node-opcua-types"; | ||
*/ | ||
export async function serverImplementsDataTypeDefinition(session: IBasicSession): Promise<boolean> { | ||
export async function serverImplementsDataTypeDefinition( | ||
session: IBasicSessionAsync2 | ||
): Promise<boolean> { | ||
// One way to figure out is to check if the server provides DataTypeDefinition node | ||
@@ -110,3 +115,3 @@ // ( see OPCUA 1.04 part 6 -) | ||
export async function populateDataTypeManager(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void> { | ||
export async function populateDataTypeManager(session: IBasicSessionAsync2, dataTypeManager: ExtraDataTypeManager): Promise<void> { | ||
const force104 = await serverImplementsDataTypeDefinition(session); | ||
@@ -113,0 +118,0 @@ if (force104) { |
import { BrowseDirection, makeNodeClassMask, makeResultMask } from "node-opcua-data-model"; | ||
import { NodeId, resolveNodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession, BrowseDescriptionLike, browseAll } from "node-opcua-pseudo-session"; | ||
import { BrowseDescriptionLike, browseAll, ISessionForBrowseAll } from "node-opcua-pseudo-session"; | ||
import { DataTypeAndEncodingId } from "node-opcua-schemas"; | ||
export async function _findEncodings(session: IBasicSession, dataTypeNodeId: NodeId): Promise<DataTypeAndEncodingId> { | ||
export async function _findEncodings(session: ISessionForBrowseAll, dataTypeNodeId: NodeId): Promise<DataTypeAndEncodingId> { | ||
const nodeToBrowse: BrowseDescriptionLike = { | ||
@@ -8,0 +8,0 @@ browseDirection: BrowseDirection.Forward, |
@@ -13,3 +13,3 @@ /* eslint-disable max-statements */ | ||
import { ExpandedNodeId, NodeId, resolveNodeId, sameNodeId } from "node-opcua-nodeid"; | ||
import { browseAll, BrowseDescriptionLike, IBasicSession } from "node-opcua-pseudo-session"; | ||
import { browseAll, BrowseDescriptionLike, IBasicSessionAsync, IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { | ||
@@ -56,3 +56,3 @@ createDynamicObjectConstructor, | ||
async function _readDeprecatedFlag(session: IBasicSession, dataTypeDictionary: NodeId): Promise<boolean> { | ||
async function _readDeprecatedFlag(session: IBasicSessionAsync, dataTypeDictionary: NodeId): Promise<boolean> { | ||
const browsePath = makeBrowsePath(dataTypeDictionary, ".Deprecated"); | ||
@@ -71,3 +71,3 @@ const a = await session.translateBrowsePath(browsePath); | ||
async function _readNamespaceUriProperty(session: IBasicSession, dataTypeDictionary: NodeId): Promise<string> { | ||
async function _readNamespaceUriProperty(session: IBasicSessionAsync, dataTypeDictionary: NodeId): Promise<string> { | ||
const a = await session.translateBrowsePath(makeBrowsePath(dataTypeDictionary, ".NamespaceUri")); | ||
@@ -90,3 +90,3 @@ /* istanbul ignore next */ | ||
async function _getDataTypeDescriptions(session: IBasicSession, dataTypeDictionaryNodeId: NodeId): Promise<IDataTypeDescription[]> { | ||
async function _getDataTypeDescriptions(session: IBasicSessionAsync2, dataTypeDictionaryNodeId: NodeId): Promise<IDataTypeDescription[]> { | ||
const nodeToBrowse2: BrowseDescriptionLike = { | ||
@@ -106,3 +106,3 @@ browseDirection: BrowseDirection.Forward, | ||
async function _enrichWithDescriptionOf(session: IBasicSession, dataTypeDescriptions: IDataTypeDescription[]): Promise<NodeId[]> { | ||
async function _enrichWithDescriptionOf(session: IBasicSessionAsync2, dataTypeDescriptions: IDataTypeDescription[]): Promise<NodeId[]> { | ||
const nodesToBrowse3: BrowseDescriptionOptions[] = []; | ||
@@ -266,3 +266,3 @@ for (const ref of dataTypeDescriptions) { | ||
async function _extractDataTypeDictionaryFromDefinition( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeDictionaryNodeId: NodeId, | ||
@@ -354,3 +354,3 @@ dataTypeFactory: DataTypeFactory | ||
async function _extractNodeIds( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeDictionaryNodeId: NodeId | ||
@@ -391,3 +391,3 @@ ): Promise<MapDataTypeAndEncodingIdProvider> { | ||
async function _extractDataTypeDictionary( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
d: TypeDictionaryInfo, | ||
@@ -434,3 +434,3 @@ dataTypeManager: ExtraDataTypeManager | ||
async function _exploreDataTypeDefinition( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeDictionaryTypeNode: NodeId, | ||
@@ -532,3 +532,3 @@ dataTypeFactory: DataTypeFactory, | ||
*/ | ||
export async function populateDataTypeManager103(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void> { | ||
export async function populateDataTypeManager103(session: IBasicSessionAsync2, dataTypeManager: ExtraDataTypeManager): Promise<void> { | ||
debugLog("in ... populateDataTypeManager"); | ||
@@ -535,0 +535,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { assert } from "node-opcua-assert"; | ||
import { AttributeIds, BrowseDirection } from "node-opcua-data-model"; | ||
@@ -6,3 +5,3 @@ import { make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug"; | ||
import { NodeId, resolveNodeId } from "node-opcua-nodeid"; | ||
import { IBasicSession, browseAll } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2, IBasicSessionBrowseAsync, IBasicSessionBrowseNext, IBasicSessionReadAsync, IBasicSessionTranslateBrowsePathAsync, browseAll } from "node-opcua-pseudo-session"; | ||
import { createDynamicObjectConstructor as createDynamicObjectConstructorAndRegister } from "node-opcua-schemas"; | ||
@@ -30,3 +29,3 @@ import { StatusCodes } from "node-opcua-status-code"; | ||
export async function readDataTypeDefinitionAndBuildType( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeNodeId: NodeId, | ||
@@ -133,3 +132,3 @@ name: string, | ||
async function applyOnReferenceRecursively( | ||
session: IBasicSession, | ||
session: IBasicSessionTranslateBrowsePathAsync & IBasicSessionReadAsync & IBasicSessionBrowseAsync & IBasicSessionBrowseNext, | ||
nodeId: NodeId, | ||
@@ -153,3 +152,3 @@ browseDescriptionTemplate: BrowseDescriptionOptions, | ||
pendingNodesToBrowse.push(nodeToBrowse); | ||
// taskMananager.registerTask(flushBrowse); | ||
// taskManager.registerTask(flushBrowse); | ||
} else if (result.statusCode.isGood()) { | ||
@@ -198,3 +197,6 @@ for (const r of result.references || []) { | ||
} | ||
export async function populateDataTypeManager104(session: IBasicSession, dataTypeManager: ExtraDataTypeManager): Promise<void> { | ||
export async function populateDataTypeManager104( | ||
session: IBasicSessionAsync2, | ||
dataTypeManager: ExtraDataTypeManager | ||
): Promise<void> { | ||
const cache: { [key: string]: CacheForFieldResolution } = {}; | ||
@@ -201,0 +203,0 @@ |
import { NotificationData, DataChangeNotification, EventNotificationList } from "node-opcua-types"; | ||
import { Variant, DataType } from "node-opcua-variant"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { promoteOpaqueStructure } from "./promote_opaque_structure"; | ||
export async function promoteOpaqueStructureInNotificationData( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
notificationData: NotificationData[] | ||
@@ -9,0 +9,0 @@ ): Promise<void> { |
import { OpaqueStructure } from "node-opcua-extension-object"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { DataType, VariantArrayType, Variant } from "node-opcua-variant"; | ||
@@ -8,24 +8,21 @@ // | ||
export interface PseudoDataValue { | ||
value: Variant; | ||
} | ||
export interface PseudoDataValue { value: Variant }; | ||
export function extractDataValueToPromote(dataValues: PseudoDataValue[]): PseudoDataValue[] { | ||
// count number of Opaque Structures | ||
const dataValuesToFix = dataValues.filter((dataValue: PseudoDataValue) => | ||
dataValue.value && dataValue.value.dataType === DataType.ExtensionObject && | ||
( | ||
(dataValue.value.arrayType === VariantArrayType.Scalar | ||
&& dataValue.value.value instanceof OpaqueStructure) | ||
|| | ||
(dataValue.value.arrayType !== VariantArrayType.Scalar | ||
&& dataValue.value.value && dataValue.value.value.length >= 0 | ||
&& dataValue.value.value[0] instanceof OpaqueStructure) | ||
) | ||
const dataValuesToFix = dataValues.filter( | ||
(dataValue: PseudoDataValue) => | ||
dataValue.value && | ||
dataValue.value.dataType === DataType.ExtensionObject && | ||
((dataValue.value.arrayType === VariantArrayType.Scalar && dataValue.value.value instanceof OpaqueStructure) || | ||
(dataValue.value.arrayType !== VariantArrayType.Scalar && | ||
dataValue.value.value && | ||
dataValue.value.value.length >= 0 && | ||
dataValue.value.value[0] instanceof OpaqueStructure)) | ||
); | ||
return dataValuesToFix; | ||
} | ||
export async function promoteOpaqueStructure( | ||
session: IBasicSession, | ||
dataValues: PseudoDataValue[] | ||
) { | ||
export async function promoteOpaqueStructure(session: IBasicSessionAsync2, dataValues: PseudoDataValue[]) { | ||
const dataValuesToFix = extractDataValueToPromote(dataValues); | ||
@@ -39,8 +36,7 @@ if (dataValuesToFix.length === 0) { | ||
const promises = dataValuesToFix.map( | ||
async (dataValue: PseudoDataValue) => { | ||
return await resolveDynamicExtensionObject(session, dataValue.value, extraDataTypeManager) | ||
}); | ||
const promises = dataValuesToFix.map(async (dataValue: PseudoDataValue) => { | ||
return await resolveDynamicExtensionObject(session, dataValue.value, extraDataTypeManager); | ||
}); | ||
// https://medium.com/swlh/dealing-with-multiple-promises-in-javascript-41d6c21f20ff | ||
await Promise.all(promises.map(p => p.catch(e => e))); | ||
await Promise.all(promises.map((p) => p.catch((e) => e))); | ||
} |
@@ -5,3 +5,3 @@ import { BinaryStream } from "node-opcua-binary-stream"; | ||
import { hexDump, make_warningLog } from "node-opcua-debug"; | ||
import { IBasicSession } from "node-opcua-pseudo-session"; | ||
import { IBasicSessionAsync2 } from "node-opcua-pseudo-session"; | ||
import { NodeId } from "node-opcua-nodeid"; | ||
@@ -17,3 +17,3 @@ import { ConstructorFunc, StructuredTypeField } from "node-opcua-factory"; | ||
async function getOrExtractConstructor( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
binaryEncodingNodeId: NodeId, | ||
@@ -59,3 +59,3 @@ dataTypeManager: ExtraDataTypeManager | ||
export async function resolveOpaqueStructureInExtentionObject( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
dataTypeManager: ExtraDataTypeManager, | ||
@@ -120,3 +120,3 @@ object: ExtensionObject | ||
async function resolveDynamicExtensionObjectV( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
opaque: OpaqueStructure, | ||
@@ -154,3 +154,3 @@ dataTypeManager: ExtraDataTypeManager | ||
export async function resolveDynamicExtensionObject( | ||
session: IBasicSession, | ||
session: IBasicSessionAsync2, | ||
variant: Variant, | ||
@@ -157,0 +157,0 @@ dataTypeManager: ExtraDataTypeManager |
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
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
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
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
250458
3943
+ Addednode-opcua-basic-types@2.118.0(transitive)
+ Addednode-opcua-data-model@2.118.0(transitive)
+ Addednode-opcua-data-value@2.118.0(transitive)
+ Addednode-opcua-date-time@2.118.0(transitive)
+ Addednode-opcua-debug@2.118.0(transitive)
+ Addednode-opcua-extension-object@2.118.0(transitive)
+ Addednode-opcua-factory@2.118.0(transitive)
+ Addednode-opcua-generator@2.118.0(transitive)
+ Addednode-opcua-nodeid@2.118.0(transitive)
+ Addednode-opcua-numeric-range@2.118.0(transitive)
+ Addednode-opcua-pseudo-session@2.118.0(transitive)
+ Addednode-opcua-schemas@2.118.0(transitive)
+ Addednode-opcua-service-browse@2.118.0(transitive)
+ Addednode-opcua-service-call@2.118.0(transitive)
+ Addednode-opcua-service-read@2.118.0(transitive)
+ Addednode-opcua-service-secure-channel@2.118.0(transitive)
+ Addednode-opcua-service-subscription@2.118.0(transitive)
+ Addednode-opcua-service-translate-browse-path@2.118.0(transitive)
+ Addednode-opcua-service-write@2.118.0(transitive)
+ Addednode-opcua-types@2.118.0(transitive)
+ Addednode-opcua-variant@2.118.0(transitive)
+ Addednode-opcua-xml2json@2.118.0(transitive)
- Removednode-opcua-basic-types@2.117.0(transitive)
- Removednode-opcua-data-model@2.117.0(transitive)
- Removednode-opcua-data-value@2.117.0(transitive)
- Removednode-opcua-date-time@2.117.0(transitive)
- Removednode-opcua-debug@2.117.0(transitive)
- Removednode-opcua-extension-object@2.117.0(transitive)
- Removednode-opcua-factory@2.117.0(transitive)
- Removednode-opcua-generator@2.117.0(transitive)
- Removednode-opcua-nodeid@2.117.0(transitive)
- Removednode-opcua-numeric-range@2.117.0(transitive)
- Removednode-opcua-pseudo-session@2.117.0(transitive)
- Removednode-opcua-schemas@2.117.0(transitive)
- Removednode-opcua-service-browse@2.117.0(transitive)
- Removednode-opcua-service-call@2.117.0(transitive)
- Removednode-opcua-service-read@2.117.0(transitive)
- Removednode-opcua-service-secure-channel@2.117.0(transitive)
- Removednode-opcua-service-subscription@2.117.0(transitive)
- Removednode-opcua-service-translate-browse-path@2.117.0(transitive)
- Removednode-opcua-service-write@2.117.0(transitive)
- Removednode-opcua-types@2.117.0(transitive)
- Removednode-opcua-variant@2.117.0(transitive)
- Removednode-opcua-xml2json@2.117.0(transitive)
Updatednode-opcua-debug@2.118.0
Updatednode-opcua-factory@2.118.0
Updatednode-opcua-nodeid@2.118.0
Updatednode-opcua-schemas@2.118.0
Updatednode-opcua-types@2.118.0
Updatednode-opcua-variant@2.118.0