dbus-sdk
Version:
A Node.js SDK for interacting with DBus, enabling seamless service calling and exposure with TypeScript support
32 lines • 2.07 kB
TypeScript
import { DataType } from '../types/DataType';
/**
* Class for handling DBus signature parsing and compatibility checking.
* Provides static methods to parse signature strings into data type trees and compare signatures for compatibility.
*/
export declare class Signature {
/**
* Parses a DBus signature string into an array of data type structures.
* Converts a signature string (e.g., 'a{sv}') into a tree-like structure of DataType objects.
* Throws a SignatureError if the signature is invalid or contains unknown types.
*
* @param signature - The DBus signature string to parse (e.g., 'a{sv}' for an array of dictionary entries).
* @returns An array of DataType objects representing the parsed signature structure.
* @throws {SignatureError} If the signature is invalid or contains unrecognized types.
*/
static parseSignature(signature: string): DataType[];
/**
* Compare two signature strings to check if they are compatible.
* The base signature is the reference (e.g., method definition), and the input signature is the one to compare (e.g., method call).
* If the base signature contains 'v' (variant), any type in the input signature at that position is considered compatible.
* This rule applies recursively to nested structures.
* Returns false instead of throwing an error if signatures are incompatible.
* Handles cases where signatures are undefined or empty.
*
* @param baseSignature - The base signature string (reference, e.g., method definition "vs"). Can be undefined.
* @param inputSignature - The input signature string to compare (e.g., method call "a{sv}s"). Can be undefined.
* @returns True if the signatures are compatible, false if they are not or if inputs are invalid.
* @throws {SignatureError} If either signature is invalid (non-empty and cannot be parsed).
*/
static areSignaturesCompatible(baseSignature: string | undefined, inputSignature: string | undefined): boolean;
}
//# sourceMappingURL=Signature.d.ts.map