/** * @module node-opcua-address-space * * The consumer that turns {@link NodesetRecord}s into nodes of an address space: it registers * the namespaces the header declares, translates every id from the file's namespace table to * the address space's, applies the loader options, creates the node and queues the post-load * tasks (values, extension objects, data-type registration) that run once every document is in. */ import type { BaseNode, IAddressSpace, UAReference } from "node-opcua-address-space-base"; import { NodeId } from "node-opcua-nodeid"; import type { NodeSetLoaderOptions } from "../interfaces/nodeset_loader_options.js"; import { type NodesetRecord, type NodesetRecordConsumer } from "./nodeset_record.js"; export type Task = (addressSpace: IAddressSpace) => Promise; /** the work deferred until every document is loaded, in the order it runs */ export interface LoaderTaskQueues { postTasks: Task[]; postTasks0_InitializeVariable: Task[]; postTasks0_DecodePojoString: Task[]; postTasks1_InitializeVariable: Task[]; postTasks2_AssignedExtensionObjectToDataValue: Task[]; pendingSimpleTypeToRegister: { name: string; dataTypeNodeId: NodeId; }[]; } export declare function makeLoaderTaskQueues(): LoaderTaskQueues; /** see NodesetRecordApplier.takePendingBackReferences */ export interface PendingBackReferences { /** nodes whose document said which of their references are one-sided: nothing else to propagate */ settled: Set; /** the one-sided references, with the node holding each */ references: Array<[BaseNode, UAReference]>; } export declare class NodesetRecordApplier implements NodesetRecordConsumer { private readonly options; private readonly queues; /** the back references the load owes, and the nodes it owes nothing else for; see takePendingBackReferences */ private pending; private readonly addressSpace; private readonly applyRolePermissions; private readonly applyAccessRestrictions; private table; private aliasMap; private translatedStrings; private translatedIds; private headerSeen; constructor(addressSpace: IAddressSpace, options: NodeSetLoaderOptions, queues: LoaderTaskQueues); apply(record: NodesetRecord): void; private applyHeader; private addNamespace; private translateNamespaceIndex; /** a file-local id to the address space's, built once per distinct id */ private translate; private translateOrNull; private translateQualifiedName; /** * an id given as text, the way the XML body of a deferred extension object carries them: * an alias, or `ns=;...` */ private readonly translateString; /** * the ids a value may hold, by data type; everything else passes through. A record is not * the applier's to change: another consumer may read it after this one, so what is * translated is a copy */ private translateValue; private canIgnore; private permissions; private common; /** the node's references as the node will hold them, one per reference of the record, in its order */ private references; /** * what the end of the load must do about the inverses of a node's references: a reference the * document marks as not declared from the other end is kept for one propagation, and the node * is settled; a node whose references carry no such information is left to the end-of-load * sweep, which propagates it whole. `references` are those built by {@link references} from * the same record, in the same order. */ private settle; /** * what the end of the load must do about back references: the one-sided references of the * settled nodes, to propagate one by one, and the settled nodes themselves, which the sweep * over every node skips. Taken once by the loader's terminate step and dropped after it: the * set lives for the load, not on the nodes */ takePendingBackReferences(): PendingBackReferences; private createNode; private applyNode; private applyDataType; /** * the value of a record, translated, with the extension objects still waiting as XML replaced * by null and their decode queued; the deferred getter yields them once decoded */ private prepareValue; private assignExtensionObjectLater; private variableCommon; private applyVariable; /** a data type node whose basic type resolves: what an initial value needs to be checked against */ private isDataTypeReady; /** * what the "initializing simple variables" post task does, done at creation; a value the * variable refuses is logged and skipped, as the post task would */ private setInitialValueNow; private applyVariableType; }