/** * @module node-opcua-address-space * * A namespace as a record producer: `namespace.toNodesetRecords()` yields the header record and * one record per node, the same records the XML loader yields for the equivalent NodeSet2 file, * in the order `toNodeset2XML` writes its elements. Any consumer of records (the image writer, * a loader, a diff) then works on a live namespace, whether it came from a file, from code or * from the modeler. * * Ids are translated to the exported file's own namespace table, as in the XML export: the * dependency set of the namespace in loading order, 0 for the UA namespace. */ import type { BaseNode, INamespace } from "node-opcua-address-space-base"; import { DataTypeIds } from "node-opcua-constants"; import { NodeId, NodeIdType } from "node-opcua-nodeid"; import { type NodesetImageWriterOptions } from "../../api/loader/nodeset_image.js"; import { type NodesetRecord } from "../../api/loader/nodeset_record.js"; import { makeTypeXsd } from "./nodeset_to_xml.js"; export interface ToNodesetRecordsOptions { /** * a loaded node carries no release status, so these have no effect today; they are the * mirror of the loader's `loadDraftNodes` and `loadDeprecatedNodes` for a future that keeps it */ includeDraft?: boolean; includeDeprecated?: boolean; } /** the order the exporters list nodes in: by NodeId string, what the XML writer sorted by all along */ export declare const sortByNodeId: (a: { nodeId: NodeId; }, b: { nodeId: NodeId; }) => number; /** what the exporter cannot turn into a record: named by the node so that the caller can act */ export declare class NodesetExportError extends Error { } /** * a comment the XML export writes at a point of the walk (a section, the start or end of an * object); not a record: the image writer and the loader never see one */ export interface SectionMarker { kind: "section"; text: string; } export type NodesetWalkEvent = NodesetRecord | SectionMarker; /** the records of a namespace with the comment markers the XML export places between them */ export declare function namespaceToWalkEvents(namespace: INamespace): NodesetWalkEvent[]; /** * the walk from one node: the node, its type definition and supertype when they belong to the * same namespace and are not out yet, its aggregates after it; with the namespace table the * events' ids are in */ export declare function nodeToWalkEvents(node: BaseNode): { events: NodesetWalkEvent[]; translationTable: Map; }; /** the records of a namespace; see {@link ToNodesetRecordsOptions} */ export declare function namespaceToRecords(namespace: INamespace, _options?: ToNodesetRecordsOptions): NodesetRecord[]; export interface NamespaceToImageOptions extends Pick { } /** * the precompiled image of a namespace: the records, JSON Lines, gzip; the trailer digest is the * SHA-256 of the node lines, so that a re-import keys on the content and not on a file that does * not exist */ export declare function namespaceToImage(namespace: INamespace, options?: NamespaceToImageOptions): Promise; export type { NodesetRecord }; export { DataTypeIds, makeTypeXsd, NodeIdType };