import type { AddReferenceOpts, BaseNode, IAddressSpace, UAReference, UAReferenceType } from "node-opcua-address-space-base"; import { NodeId, type NodeIdLike } from "node-opcua-nodeid"; export declare function isNodeIdString(str: string): boolean; export interface MinimalistAddressSpace { findNode(nodeId: NodeIdLike): BaseNode | null; findReferenceType(referenceTypeId: NodeIdLike | UAReferenceType, namespaceIndex?: number): UAReferenceType | null; } /** * The key a reference is indexed under in a node: one safe integer for the common case, a string * otherwise. A load of the standard nodeset indexes 17 000 references; building a string for each * (two NodeId.toString and a concatenation) was a measurable share of node construction and of * the retained heap. */ export type ReferenceKey = number | string; /** what a reference key needs from the address space: a small ordinal per reference type */ export interface ReferenceTypeOrdinals { referenceTypeOrdinal(referenceType: NodeId): number; } /** * the key of a node in reference indexes: a number below 2^40 for a numeric NodeId in a namespace * below 256, which is what nodesets carry, a string for the rest */ /** * HasTypeDefinition and HasModellingRule never get a back reference: there would be thousands * per type or modelling rule, and nothing browses them that way */ export declare function isMassivelyUsedReferenceType(referenceType: NodeId): boolean; export declare function nodeIdKey(nodeId: NodeId): number | string; /** * the key of a reference (direction, reference type, target) given the reference type ordinal * and the target key; a safe integer when both fit, a string otherwise */ export declare function referenceKey(isForward: boolean, referenceTypeOrdinal: number, targetKey: number | string): ReferenceKey; export declare function resolveReferenceNode(addressSpace: MinimalistAddressSpace, reference: UAReference): BaseNode; export declare function resolveReferenceType(addressSpace: MinimalistAddressSpace, reference: UAReference): UAReferenceType; /** * @class Reference * @param options.referenceType {NodeId} * @param options.nodeId {NodeId} * @param options.isForward {Boolean} * @constructor */ export declare class ReferenceImpl implements UAReference { static resolveReferenceNode(addressSpace: MinimalistAddressSpace, reference: UAReference): BaseNode; static resolveReferenceType(addressSpace: MinimalistAddressSpace, reference: UAReference): UAReferenceType; nodeId: NodeId; referenceType: NodeId; _referenceType?: UAReferenceType; readonly isForward: boolean; node?: BaseNode; private __hash?; private __key?; constructor(options: AddReferenceOpts | UAReference); /** * turn reference into a arrow : ---- ReferenceType --> [NodeId] * @return {String} */ toString(options?: { addressSpace?: IAddressSpace; }): string; /** * @internal */ get hash(): string; /** * @internal * the key this reference is indexed under in the node holding it, computed once */ key(ordinals: ReferenceTypeOrdinals): ReferenceKey; /** * @internal * the key of the reference that the node `sourceNodeKey` would hold to point back at us: what * `BaseNode_add_backward_reference` would create, so that the caller can find out first * whether it exists already, without allocating anything */ inverseKey(ordinals: ReferenceTypeOrdinals, sourceNodeKey: number | string): ReferenceKey; /** * @internal */ dispose(): void; }