node-opcua-address-space 2.84.0 → 2.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/source/continuation_points/continuation_point_manager.js +6 -1
- package/dist/source/continuation_points/continuation_point_manager.js.map +1 -1
- package/dist/source/loader/ensure_datatype_extracted.js +1 -1
- package/dist/source/loader/ensure_datatype_extracted.js.map +1 -1
- package/dist/source/loader/load_nodeset2.js +1 -1
- package/dist/source/loader/load_nodeset2.js.map +1 -1
- package/dist/source/pseudo_session.d.ts +15 -1
- package/dist/source/pseudo_session.js +86 -37
- package/dist/source/pseudo_session.js.map +1 -1
- package/dist/src/address_space.d.ts +0 -4
- package/dist/src/address_space.js +4 -13
- package/dist/src/address_space.js.map +1 -1
- package/dist/src/base_node_private.js +5 -0
- package/dist/src/base_node_private.js.map +1 -1
- package/dist/src/namespace_impl.js +1 -0
- package/dist/src/namespace_impl.js.map +1 -1
- package/dist/src/nodeset_tools/construct_namespace_dependency.js +7 -0
- package/dist/src/nodeset_tools/construct_namespace_dependency.js.map +1 -1
- package/dist/src/nodeset_tools/nodeset_to_xml.js +4 -0
- package/dist/src/nodeset_tools/nodeset_to_xml.js.map +1 -1
- package/dist/src/tool_isSupertypeOf.d.ts +1 -0
- package/dist/src/tool_isSupertypeOf.js +7 -1
- package/dist/src/tool_isSupertypeOf.js.map +1 -1
- package/package.json +35 -35
- package/source/continuation_points/continuation_point_manager.ts +6 -2
- package/source/loader/ensure_datatype_extracted.ts +1 -1
- package/source/loader/load_nodeset2.ts +1 -1
- package/source/pseudo_session.ts +120 -46
- package/src/address_space.ts +4 -16
- package/src/base_node_private.ts +6 -0
- package/src/namespace_impl.ts +6 -3
- package/src/nodeset_tools/construct_namespace_dependency.ts +9 -0
- package/src/nodeset_tools/nodeset_to_xml.ts +4 -1
- package/src/tool_isSupertypeOf.ts +5 -0
package/src/address_space.ts
CHANGED
|
@@ -123,7 +123,6 @@ function isNodeIdString(str: unknown): boolean {
|
|
|
123
123
|
return str.substring(0, 2) === "i=" || str.substring(0, 3) === "ns=";
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
127
126
|
/**
|
|
128
127
|
* `AddressSpace` is a collection of UA nodes.
|
|
129
128
|
*
|
|
@@ -423,7 +422,9 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
423
422
|
// +-> Structure
|
|
424
423
|
// +-> Node
|
|
425
424
|
// +-> ObjectNode
|
|
426
|
-
if (dataType instanceof
|
|
425
|
+
if (dataType instanceof UADataTypeImpl) {
|
|
426
|
+
return this.findDataType(dataType.nodeId);
|
|
427
|
+
} else if (dataType instanceof NodeId) {
|
|
427
428
|
return _find_by_node_id<UADataType>(this, dataType!, namespaceIndex);
|
|
428
429
|
}
|
|
429
430
|
if (typeof dataType === "number") {
|
|
@@ -1346,29 +1347,16 @@ export class AddressSpace implements AddressSpacePrivate {
|
|
|
1346
1347
|
_nodeId = (_nodeId as any).nodeId as NodeId;
|
|
1347
1348
|
}
|
|
1348
1349
|
_nodeId = resolveNodeId(_nodeId);
|
|
1349
|
-
/* istanbul ignore next */
|
|
1350
|
-
if (!(_nodeId instanceof NodeId) || _nodeId.isEmpty()) {
|
|
1351
|
-
// tslint:disable:no-console
|
|
1352
|
-
console.log("xx =>", JSON.stringify(params, null, " "));
|
|
1353
|
-
throw new Error(" Invalid reference nodeId " + _nodeId.toString());
|
|
1354
|
-
}
|
|
1355
1350
|
params.nodeId = _nodeId;
|
|
1356
1351
|
}
|
|
1357
1352
|
return new ReferenceImpl(params);
|
|
1358
1353
|
}
|
|
1359
1354
|
|
|
1360
|
-
/**
|
|
1361
|
-
*
|
|
1362
|
-
* @param references
|
|
1363
|
-
*/
|
|
1364
1355
|
public normalizeReferenceTypes(references: AddReferenceOpts[] | ReferenceImpl[] | null): UAReference[] {
|
|
1365
1356
|
if (!references || references.length === 0) {
|
|
1366
1357
|
return [];
|
|
1367
1358
|
}
|
|
1368
|
-
|
|
1369
|
-
assert(Array.isArray(references));
|
|
1370
|
-
|
|
1371
|
-
return (references as any).map((el: UAReference | AddReferenceOpts) => this.normalizeReferenceType(el));
|
|
1359
|
+
return references.map((el) => this.normalizeReferenceType(el));
|
|
1372
1360
|
}
|
|
1373
1361
|
|
|
1374
1362
|
// -- Historical Node -----------------------------------------------------------------------------------------
|
package/src/base_node_private.ts
CHANGED
|
@@ -40,6 +40,7 @@ import { UANamespace_process_modelling_rule } from "./namespace_private";
|
|
|
40
40
|
import { ReferenceImpl } from "./reference_impl";
|
|
41
41
|
import { BaseNodeImpl, getReferenceType } from "./base_node_impl";
|
|
42
42
|
import { AddressSpacePrivate } from "./address_space_private";
|
|
43
|
+
import { wipeMemorizedStuff } from "./tool_isSupertypeOf";
|
|
43
44
|
|
|
44
45
|
// eslint-disable-next-line prefer-const
|
|
45
46
|
let doTrace = checkDebugFlag("INSTANTIATE");
|
|
@@ -126,6 +127,7 @@ export function BaseNode_clearCache(node: BaseNode): void {
|
|
|
126
127
|
if (_private && _private._cache) {
|
|
127
128
|
_private._cache = {};
|
|
128
129
|
}
|
|
130
|
+
wipeMemorizedStuff(node);
|
|
129
131
|
}
|
|
130
132
|
const hasTypeDefinition_ReferenceTypeNodeId = resolveNodeId("HasTypeDefinition");
|
|
131
133
|
|
|
@@ -681,6 +683,10 @@ function _cloneInterface(
|
|
|
681
683
|
|
|
682
684
|
extraInfo = extraInfo || defaultExtraInfo;
|
|
683
685
|
const addressSpace = node.addressSpace;
|
|
686
|
+
|
|
687
|
+
if (node.nodeClass !== NodeClass.Object && node.nodeClass !== NodeClass.Variable) {
|
|
688
|
+
return;
|
|
689
|
+
}
|
|
684
690
|
const typeDefinitionNode = node.typeDefinitionObj;
|
|
685
691
|
if (!typeDefinitionNode) {
|
|
686
692
|
return;
|
package/src/namespace_impl.ts
CHANGED
|
@@ -10,7 +10,7 @@ import { AxisScaleEnumeration } from "node-opcua-data-access";
|
|
|
10
10
|
import { AccessRestrictionsFlag, coerceLocalizedText, QualifiedNameLike } from "node-opcua-data-model";
|
|
11
11
|
import { QualifiedName } from "node-opcua-data-model";
|
|
12
12
|
import { BrowseDirection } from "node-opcua-data-model";
|
|
13
|
-
import {
|
|
13
|
+
import { NodeClass } from "node-opcua-data-model";
|
|
14
14
|
import { dumpIf, make_errorLog } from "node-opcua-debug";
|
|
15
15
|
import { NodeIdLike, NodeIdType, resolveNodeId } from "node-opcua-nodeid";
|
|
16
16
|
import { NodeId } from "node-opcua-nodeid";
|
|
@@ -124,7 +124,7 @@ import { UAReferenceTypeImpl } from "./ua_reference_type_impl";
|
|
|
124
124
|
import { UAViewImpl } from "./ua_view_impl";
|
|
125
125
|
import { UAStateMachineImpl, UATransitionImpl } from "./state_machine/finite_state_machine";
|
|
126
126
|
import { _addMultiStateValueDiscrete } from "./data_access/ua_multistate_value_discrete_impl";
|
|
127
|
-
|
|
127
|
+
|
|
128
128
|
|
|
129
129
|
function _makeHashKey(nodeId: NodeId): string | number {
|
|
130
130
|
switch (nodeId.identifierType) {
|
|
@@ -615,7 +615,7 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
615
615
|
assert(!Object.prototype.hasOwnProperty.call(options, "nodeClass"));
|
|
616
616
|
assert(Object.prototype.hasOwnProperty.call(options, "browseName"), "must provide a browseName");
|
|
617
617
|
|
|
618
|
-
const options1 = options as
|
|
618
|
+
const options1 = options as unknown as { nodeClass: NodeClass; references: AddReferenceOpts[]; subtypeOf: UADataType };
|
|
619
619
|
options1.nodeClass = NodeClass.DataType;
|
|
620
620
|
options1.references = options.references || [];
|
|
621
621
|
|
|
@@ -638,6 +638,9 @@ export class NamespaceImpl implements NamespacePrivate {
|
|
|
638
638
|
});
|
|
639
639
|
}
|
|
640
640
|
const node = this.internalCreateNode(options) as UADataType;
|
|
641
|
+
|
|
642
|
+
node.propagate_back_references();
|
|
643
|
+
|
|
641
644
|
return node;
|
|
642
645
|
}
|
|
643
646
|
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { INamespace, UADataType, UAVariable, UAVariableType } from "node-opcua-address-space-base";
|
|
2
2
|
import { NodeClass } from "node-opcua-data-model";
|
|
3
3
|
import { StructureField } from "node-opcua-types";
|
|
4
|
+
import { make_warningLog } from "node-opcua-debug";
|
|
4
5
|
import { NamespacePrivate } from "../namespace_private";
|
|
5
6
|
import { BaseNodeImpl, getReferenceType } from "../base_node_impl";
|
|
6
7
|
|
|
8
|
+
const warningLog = make_warningLog(__filename);
|
|
9
|
+
|
|
7
10
|
function _constructNamespaceDependency(
|
|
8
11
|
namespace: INamespace,
|
|
9
12
|
dependency: INamespace[],
|
|
@@ -43,6 +46,12 @@ function _constructNamespaceDependency(
|
|
|
43
46
|
if (_visitedDataType.has(dataType.toString())) {
|
|
44
47
|
return;
|
|
45
48
|
}
|
|
49
|
+
// istanbul ignore next
|
|
50
|
+
if (dataTypeNode.nodeClass !== NodeClass.DataType) {
|
|
51
|
+
warningLog("exploreDataTypes! ignoring ",dataTypeNode.toString());
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
46
55
|
const namespaceIndex = dataType.namespace;
|
|
47
56
|
consider(namespaceIndex);
|
|
48
57
|
if (dataTypeNode.isStructure()) {
|
|
@@ -35,7 +35,6 @@ import { AttributeIds, Int64, minOPCUADate, StatusCode, StatusCodes } from "node
|
|
|
35
35
|
import { BrowseDescription, EnumDefinition, StructureDefinition, StructureType } from "node-opcua-types";
|
|
36
36
|
|
|
37
37
|
import { ITranslationTable, XmlWriter } from "../../source/xml_writer";
|
|
38
|
-
import { NamespacePrivate } from "../namespace_private";
|
|
39
38
|
import { ReferenceImpl } from "../reference_impl";
|
|
40
39
|
import { BaseNodeImpl, getReferenceType } from "../base_node_impl";
|
|
41
40
|
import { UAReferenceTypeImpl } from "../ua_reference_type_impl";
|
|
@@ -251,6 +250,10 @@ function findXsdNamespaceUri(xw: XmlWriter, nodeId: NodeId): string {
|
|
|
251
250
|
if (namespace === "http://opcfoundation.org/UA/") {
|
|
252
251
|
return "http://opcfoundation.org/UA/2008/02/Types.xsd";
|
|
253
252
|
}
|
|
253
|
+
// istanbul ignore next
|
|
254
|
+
if (!namespace) {
|
|
255
|
+
return "";
|
|
256
|
+
}
|
|
254
257
|
return namespace.replace(/\/$/, "") + "/Types.xsd";
|
|
255
258
|
}
|
|
256
259
|
|
|
@@ -60,6 +60,11 @@ function _slow_isSupertypeOf<T extends UAType>(this: T, Class: typeof BaseNodeIm
|
|
|
60
60
|
|
|
61
61
|
export type MemberFuncValue<T, P, R> = (this: T, param: P) => R;
|
|
62
62
|
|
|
63
|
+
export function wipeMemorizedStuff(node: any) {
|
|
64
|
+
if (!node.__cache) {
|
|
65
|
+
node.__cache = undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
63
68
|
// http://jsperf.com/underscore-js-memoize-refactor-test
|
|
64
69
|
// http://addyosmani.com/blog/faster-javascript-memoization/
|
|
65
70
|
function wrap_memoize<T, P, R>(
|