import { NodeClass, QualifiedName, type QualifiedNameOptions } from "node-opcua-data-model"; import { NodeId } from "node-opcua-nodeid"; import { DataType, Variant, VariantArrayType, type VariantOptions } from "node-opcua-variant"; import { type NodesetDefinitionField, type NodesetHeaderRecord, type NodesetNodeRecord } from "./nodeset_record.js"; /** * a NodeId: the number alone when numeric in namespace 0 (nearly every id of a nodeset), * `[namespaceIndex, value]` when numeric elsewhere, `[namespaceIndex, kind, value]` otherwise */ export type JsonNodeId = number | [number, number] | [number, "i" | "s" | "g" | "b", number | string]; /** a reference: `[isForward ? 1 : 0, referenceType, target]`, plus `0` when the inverse is not declared by the target */ export type JsonReference = [0 | 1, JsonNodeId, JsonNodeId] | [0 | 1, JsonNodeId, JsonNodeId, 0]; export type JsonQualifiedName = [number, string]; /** what a corrupt or foreign image raises; the loader discards such an image and rebuilds it */ export declare class NodesetImageError extends Error { } export declare function encodeNodeId(nodeId: NodeId): JsonNodeId; export declare function decodeNodeId(json: unknown): NodeId; export declare function encodeQualifiedName(name: QualifiedNameOptions): JsonQualifiedName; export declare function decodeQualifiedName(json: unknown): QualifiedName; type Json = unknown; export interface JsonValue { dataType: DataType; arrayType?: VariantArrayType; dimensions?: number[] | null; value: Json; } export declare function encodeValue(options: VariantOptions | Variant): JsonValue; export declare function decodeValue(json: JsonValue): VariantOptions; export interface NodesetImageHeader { kind: "header"; schema: number; addressSpaceVersion: string; createdAt: string; /** the byte length of the XML source, when the image comes from one */ sourceLength?: number; namespaceUris: string[]; models: Array<{ modelUri: string; version: string; publicationDate: string | null; requiredModels: Array<{ modelUri: string; version: string; publicationDate: string | null; }>; symbolicName?: string; accessRestrictions?: string; }>; aliases: Record; } export interface NodesetImageTrailer { kind: "trailer"; nodes: number; sourceDigest: string; } export interface EncodeHeaderOptions { addressSpaceVersion?: string; sourceLength?: number; createdAt?: Date; } export declare function encodeHeader(record: NodesetHeaderRecord, options?: EncodeHeaderOptions): NodesetImageHeader; export declare function decodeHeader(json: NodesetImageHeader): NodesetHeaderRecord; interface JsonField extends Omit { dataType?: JsonNodeId | null; } export interface NodesetImageNode { nodeClass: NodeClass; nodeId: JsonNodeId; browseName: JsonQualifiedName; displayName?: string; description?: string; references: JsonReference[]; releaseStatus?: "Draft" | "Deprecated"; symbolicName?: string; accessRestrictions?: string; hasNoPermissions?: boolean; rolePermissions?: Array<{ roleId: JsonNodeId; permissions: number; }>; isAbstract?: boolean; eventNotifier?: number; inverseName?: string; symmetric?: boolean; containsNoLoops?: boolean; parentNodeId?: JsonNodeId | null; dataType?: JsonNodeId | null; valueRank?: number; arrayDimensions?: number[] | null; minimumSamplingInterval?: number; historizing?: boolean; accessLevel?: string; userAccessLevel?: string; value?: JsonValue; methodDeclarationId?: JsonNodeId | null; definition?: { name?: string; isUnion?: boolean; fields: JsonField[]; }; } export declare function encodeNode(record: NodesetNodeRecord): NodesetImageNode; export declare function decodeNode(json: NodesetImageNode): NodesetNodeRecord; export {};