@sourceregistry/node-ovsdb
Version:
TypeScript OVSDB client for Node.js
136 lines • 3.68 kB
TypeScript
import { OvsdbClientOptions } from './index';
import { DatabaseSchema } from './types';
/**
* Options for generating TypeScript types from an OVSDB schema.
*/
export interface GenerateTypesOptions {
/**
* The schema object to transform.
*/
schema: DatabaseSchema;
/**
* Name of the generated top-level database type.
*
* @defaultValue Derived from `schema.name`
*/
databaseTypeName?: string;
/**
* Module specifier used in generated imports.
*
* @defaultValue `"@sourceregistry/node-ovsdb"`
*/
importFrom?: string;
}
/**
* CLI options for reading a schema and writing generated types.
*/
export interface GenerateTypesCliOptions {
/**
* Path to a schema JSON file. When set, live OVSDB access is skipped.
*/
schemaPath?: string;
/**
* Unix socket path for live schema introspection.
*/
socketPath?: string;
/**
* Hostname for live schema introspection over TCP or TLS.
*/
host?: string;
/**
* Port for live schema introspection over TCP or TLS.
*
* @defaultValue `6640`
*/
port?: number;
/**
* Enables TLS for live schema introspection.
*/
tls?: boolean;
/**
* Disables TLS peer verification for environments that use self-signed certificates.
*/
tlsInsecure?: boolean;
/**
* Explicit TLS server name used during handshake verification.
*/
tlsServername?: string;
/**
* PEM CA bundle path used for TLS verification.
*/
tlsCaFile?: string;
/**
* PEM client certificate path used for mutual TLS.
*/
tlsCertFile?: string;
/**
* PEM client private key path used for mutual TLS.
*/
tlsKeyFile?: string;
/**
* Database name used with live schema introspection.
*
* @defaultValue `"Open_vSwitch"`
*/
databaseName?: string;
/**
* Destination file. When omitted, generated output is returned only.
*/
outputPath?: string;
/**
* Name of the generated top-level database type.
*/
databaseTypeName?: string;
/**
* Module specifier used in generated imports.
*
* @defaultValue `"@sourceregistry/node-ovsdb"`
*/
importFrom?: string;
}
/**
* Generates TypeScript types from an OVSDB schema.
*
* The output is designed for direct use as the generic database model for
* {@link OVSDBClient}.
*/
export declare function generateTypesFromSchema(options: GenerateTypesOptions): string;
/**
* Loads a schema from a file or a live OVSDB server and optionally writes the
* generated TypeScript output to disk.
*/
export declare function generateTypesFile(options: GenerateTypesCliOptions): Promise<string>;
/**
* Reads a schema JSON file from disk.
*/
export declare function readSchemaFile(schemaPath: string): Promise<DatabaseSchema>;
/**
* Reads a schema from a live OVSDB server.
*/
export declare function fetchSchemaFromOvsdb(options: {
socketPath?: string;
host?: string;
port?: number;
tls?: boolean;
tlsInsecure?: boolean;
tlsServername?: string;
tlsCaFile?: string;
tlsCertFile?: string;
tlsKeyFile?: string;
databaseName?: string;
}): Promise<DatabaseSchema>;
/**
* Builds client transport options for live schema introspection.
*/
export declare function createGeneratorClientOptions(options: {
socketPath?: string;
host?: string;
port?: number;
tls?: boolean;
tlsInsecure?: boolean;
tlsServername?: string;
tlsCaFile?: string;
tlsCertFile?: string;
tlsKeyFile?: string;
}): Promise<OvsdbClientOptions>;
//# sourceMappingURL=generator.d.ts.map