/** * @module node-opcua-address-space */ import { type AddReferenceOpts, type AttributeEventName, type BaseNode, type BaseNodeEvents, type BrowseDescriptionOptions2, type IAddressSpace, type INamespace, type ISessionContext, type ListenerSignature, type ModellingRuleType, TypedEventEmitter, type UAMethod, type UAObject, type UAObjectType, type UAProperty, type UAReference, type UAReferenceType, type UAVariable, type UAVariableType } from "node-opcua-address-space-base"; import type { UAString } from "node-opcua-basic-types"; import { AccessRestrictionsFlag, AttributeIds, BrowseDirection, LocalizedText, type LocalizedTextLike, NodeClass, QualifiedName, type QualifiedNameLike, type QualifiedNameOptions } from "node-opcua-data-model"; import { DataValue } from "node-opcua-data-value"; import { NodeId, type NodeIdLike } from "node-opcua-nodeid"; import type { UAStateVariable } from "node-opcua-nodeset-ua"; import type { NumericRange } from "node-opcua-numeric-range"; import type { ReferenceDescription } from "node-opcua-service-browse"; import { type StatusCode } from "node-opcua-status-code"; import { type RelativePathElement, RolePermissionType, type RolePermissionTypeOptions, type WriteValueOptions } from "node-opcua-types"; import { DataType } from "node-opcua-variant"; import type { XmlWriter } from "../api/xml_writer.js"; import type { AddressSpacePrivate } from "./address_space_private.js"; export interface InternalBaseNodeOptions { /** * the parent address space */ addressSpace: AddressSpacePrivate; browseName: QualifiedName; nodeId: NodeId; references?: UAReference[]; displayName?: LocalizedTextLike | LocalizedTextLike[]; description?: LocalizedTextLike | null; browseFilter?: (this: BaseNode, context?: ISessionContext) => boolean; /** * https://reference.opcfoundation.org/v104/Core/docs/Part3/8.56/ */ accessRestrictions?: AccessRestrictionsFlag; rolePermissions?: RolePermissionTypeOptions[]; } export declare function makeAttributeEventName(attributeId: AttributeIds): AttributeEventName; /** * Base class for all Node classes * * BaseNode is the base class for all the OPCUA objects in the address space * It provides attributes and a set of references to other nodes. * see: * {{#crossLink "UAObject"}}{{/crossLink}}, * {{#crossLink "UAVariable"}}{{/crossLink}}, * {{#crossLink "Reference"}}{{/crossLink}}, * {{#crossLink "UAMethod"}}{{/crossLink}}, * {{#crossLink "UAView"}}{{/crossLink}}, * {{#crossLink "UAObjectType"}}{{/crossLink}}, * {{#crossLink "UADataType"}}{{/crossLink}}, * {{#crossLink "UAVariableType"}}{{/crossLink}}, * * */ export declare abstract class BaseNodeImpl = BaseNodeEvents> extends TypedEventEmitter implements BaseNode { static makeAttributeEventName(attributeId: AttributeIds): AttributeEventName; private _accessRestrictions?; private _rolePermissions?; get addressSpace(): IAddressSpace; protected get addressSpacePrivate(): AddressSpacePrivate; get displayName(): LocalizedText[]; setDisplayName(value: LocalizedTextLike[] | LocalizedTextLike): void; get description(): LocalizedText; setDescription(value: LocalizedTextLike | null): void; /** * returns the nodeId of this node's Type Definition */ get typeDefinition(): NodeId; /** * returns the nodeId of this node's Type Definition */ get typeDefinitionObj(): UAObjectType | UAVariableType; get parentNodeId(): NodeId | undefined; /** * namespace index */ get namespaceIndex(): number; /** * namespace uri */ get namespaceUri(): string; /** * the parent node */ get parent(): BaseNode | null; /** * @property modellingRule * @type {String|undefined} */ get modellingRule(): ModellingRuleType | undefined; readonly nodeClass: NodeClass; readonly nodeId: NodeId; readonly browseName: QualifiedName; protected _postInstantiateFunc?: (instance: BaseNode, instanceType: BaseNode, options?: unknown) => void; /** * @internal * @param options */ constructor(options: InternalBaseNodeOptions); getDisplayName(_locale?: string): string; get namespace(): INamespace; findReferencesEx(referenceType: string | NodeId | UAReferenceType, browseDirection?: BrowseDirection): UAReference[]; findReferences_no_cache(referenceTypeNode: UAReferenceType, isForward?: boolean): UAReference[]; findReferences(referenceType: string | NodeId | UAReferenceType, isForward?: boolean): UAReference[]; findReference(strReference: string | NodeId | UAReferenceType, isForward?: boolean): UAReference | null; findReferencesExAsObject(referenceType: string | NodeId | UAReferenceType, browseDirection?: BrowseDirection): BaseNode[]; findReferencesAsObject(referenceType: string | NodeId | UAReferenceType, isForward?: boolean): BaseNode[]; /** * return an array with the Aggregates of this object. */ getAggregates(): BaseNode[]; /** * return an array with the components of this object. */ getComponents(): BaseNode[]; /** * return a array with the properties of this object. */ getProperties(): BaseNode[]; private static _hasChild; getChildren(): BaseNode[]; /** * return a array with the notifiers of this object. * only reference of exact type HasNotifier are returned. */ getNotifiers(): BaseNode[]; /** * return a array with the event source of this object. * only reference of exact type HasEventSource are returned. */ getEventSources(): BaseNode[]; /** * return a array of the objects for which this node is an EventSource */ getEventSourceOfs(): BaseNode[]; /** * the children of this node named `browseName` reached through a reference of type * `referenceType` or a subtype of it, read from the child index rather than by scanning the * references of the node again */ private _selectChildren; /** * retrieve a component by name */ getComponentByName(browseName: QualifiedNameOptions): UAVariable | UAObject | null; getComponentByName(browseName: string, namespaceIndex?: number): UAVariable | UAObject | null; /** * retrieve a property by name */ getPropertyByName(browseName: QualifiedNameOptions): UAVariable | null; getPropertyByName(browseName: string, namespaceIndex?: number): UAVariable | null; /** * retrieve a folder element by name */ getFolderElementByName(browseName: QualifiedNameOptions): BaseNode | null; getFolderElementByName(browseName: string, namespaceIndex?: number): BaseNode | null; /** * returns the list of nodes that this folder object organizes */ getFolderElements(): BaseNodeImpl[]; /** * returns the list of methods that this object provides * @return an array with Method objects. * * * Note: internally, methods are special types of components */ getMethods(): UAMethod[]; /** * returns the method exposed by this object and with the given nodeId */ getMethodById(nodeId: NodeId): UAMethod | null; getMethodByName(methodName: QualifiedNameOptions): UAMethod | null; getMethodByName(methodName: string, namespaceIndex?: number): UAMethod | null; getWriteMask(): number; getUserWriteMask(): number; readAttribute(context: ISessionContext | null, attributeId: AttributeIds, indexRange?: NumericRange, dataEncoding?: QualifiedNameLike | null): DataValue; writeAttribute(context: ISessionContext | null, writeValue: WriteValueOptions, callback: (err: Error | null, statusCode?: StatusCode) => void): void; fullName(): string; ownReferences(): UAReference[]; /** * * @param relativePathElement * @param isLast * @return {NodeId[]} */ browseNodeByTargetName(relativePathElement: RelativePathElement, isLast: boolean): NodeId[]; /** * the references of this node that can answer a relative path element, taken from the child * index, or null when the element is one the index cannot answer (an inverse step, an * unspecified or non-hierarchical reference type, no target name) */ private _hierarchicalStepCandidates; /** * browse the node to extract information requested in browseDescription * and returns an array with reference descriptions * * * */ browseNode(browseDescription: BrowseDescriptionOptions2, context?: ISessionContext): ReferenceDescription[]; allReferences(): UAReference[]; /** * @param reference * @param reference.referenceType {String} * @param [reference.isForward = true] {Boolean} * @param reference.nodeId {Node|NodeId|String} * * @example * * view.addReference({ referenceType: "Organizes", nodeId: myDevice }); * * or * * myDevice1.addReference({ referenceType: "OrganizedBy", nodeId: view }); */ addReference(reference: AddReferenceOpts): void; removeReference(referenceOpts: AddReferenceOpts): void; /** * */ resolveNodeId(nodeId: NodeIdLike): NodeId; /** * Expose the hierarchical children of this node as properties of this node, and this node as * a property of its parents, for the browse names that have no shared accessor. * * A node created while a nodeset loads needs nothing here: its name got a getter on the * prototype (see child_accessors.ts). This is the path for nodes created afterwards through the * namespace API, whose browse names may be anything and must not touch the prototype. */ install_extra_properties(): void; /** * undo install_extra_properties for one reference, on both ends when it is an inverse one */ uninstall_extra_properties(reference: UAReference): void; toString(): string; toJSON(): Record; /** * @property isFalseSubStateOf * @type {BaseNode|null} */ get isFalseSubStateOf(): BaseNode | null; /** * @property isTrueSubStateOf * @type {BaseNode|null} */ get isTrueSubStateOf(): BaseNode | null; /** * @return {UAStateVariable[]} return an array with the SubStates of this object. */ getFalseSubStates(): UAStateVariable[]; /** * @return {UAStateVariable[]} return an array with the SubStates of this object. */ getTrueSubStates(): UAStateVariable[]; findHierarchicalReferences(): UAReference[]; getChildByName(browseName: QualifiedNameOptions): BaseNode | null; getChildByName(browseName: string, namespaceIndex?: number): BaseNode | null; getNodeVersion(): UAProperty | null; get nodeVersion(): UAProperty | undefined; set nodeVersion(_n: unknown); get toStateNode(): BaseNode | null; get fromStateNode(): BaseNode | null; /** * this methods propagates the forward references to the pointed node * by inserting backward references to the counter part node * @private */ propagate_back_references(): void; /** * propagate_back_references for a node a NodeSet2 file declared: its references may be held * by their target as well, so each is looked up there before a back reference is built */ propagate_back_references_declared_from_both_ends(): void; /** one reference of a node a NodeSet2 file declared, see propagate_back_references_declared_from_both_ends */ propagate_back_reference_declared_from_both_ends(reference: UAReference): void; private _propagate_back_references; /** * the dispose method should be called when the node is no longer used, to release * back pointer to the address space and clear caches. * * @private */ dispose(): void; isDisposed(): boolean; dumpXML(xmlWriter: XmlWriter): void; /** * Undo the effect of propagate_back_references */ unpropagate_back_references(): void; installPostInstallFunc(f: (instance: BaseNode, tpyeNode: BaseNode, opts?: unknown) => void): void; _on_child_added(childNode: BaseNode): void; _on_child_removed(_obj: BaseNode): void; /** * @private * @param reference */ _add_backward_reference(reference: UAReference): void; protected _coerceReferenceType(referenceType: string | NodeId | UAReferenceType): UAReferenceType | null; private __addReference; /** kept as given; the LocalizedText objects are built on first read (most nodes are never asked) */ private _setDisplayName; private _setDescription; private _notifyAttributeChange; private _clear_caches; canUserWriteAttribute(context: ISessionContext | null, attributeId: AttributeIds): boolean; private _readAccessRestrictions; private _readRolePermissions; private _readUserRolePermissions; /** * * @param rolePermissions */ setRolePermissions(rolePermissions: RolePermissionTypeOptions[]): void; getRolePermissions(inherited: boolean): RolePermissionType[] | null; get rolePermissions(): RolePermissionType[] | undefined; setAccessRestrictions(accessRestrictions: AccessRestrictionsFlag): void; get accessRestrictions(): AccessRestrictionsFlag | undefined; getAccessRestrictions(inherited: boolean): AccessRestrictionsFlag; } /** * the child designated by `node.`: what the shared getters resolve, exposed for the * code that walks dotted paths by name (`_getCompositeKey`); works under `isFrugal` too, where no * own accessor is ever installed */ export declare function resolveChildAccessor(node: BaseNode, accessorName: string): BaseNode | undefined; /** * The accessor names under which a child of `node` can never be reached: the reserved names, the * members of the class of the node (attributes, methods, EventEmitter and Object members) and its * own fields. A child carrying one of these is reachable through `getChildByName` only. * * The generator of the typed nodeset interfaces reads this so that a generated interface names a * child exactly the way the runtime exposes it. * * @internal */ export declare function childAccessorNamesShadowedBy(node: BaseNode): Set; /** * Define the shared getter of every browse name seen since the last call: the nodeset loader calls * it once a load is complete, so that the prototype changes in one batch rather than once per * new name in the middle of node creation. */ export declare function flushSharedChildAccessors(): number; /** * Give browse names created at runtime a shared accessor, for an application that builds its * model through the namespace API and wants `parent.` without an accessor on every parent. */ export declare function defineSharedChildAccessors(browseNames: string[]): void; export declare function getReferenceType(reference: UAReference): UAReferenceType;