feat(rustdb): extract service API logic into a dedicated Rust module and expose shared service types
This commit is contained in:
@@ -2,6 +2,30 @@ import * as plugins from './plugins.js';
|
||||
import * as path from 'path';
|
||||
import * as url from 'url';
|
||||
import { EventEmitter } from 'events';
|
||||
import type {
|
||||
ISmartDbHealth,
|
||||
ISmartDbDatabaseTenantInput,
|
||||
ISmartDbDeleteDatabaseTenantInput,
|
||||
ISmartDbRotateDatabaseTenantPasswordInput,
|
||||
ISmartDbDatabaseTenantDescriptor,
|
||||
ISmartDbDeleteDatabaseTenantResult,
|
||||
ISmartDbDatabaseExport,
|
||||
ISmartDbImportDatabaseInput,
|
||||
ISmartDbImportDatabaseResult,
|
||||
} from './service-types.js';
|
||||
|
||||
export type {
|
||||
ISmartDbHealth,
|
||||
ISmartDbDatabaseTenantInput,
|
||||
ISmartDbDeleteDatabaseTenantInput,
|
||||
ISmartDbRotateDatabaseTenantPasswordInput,
|
||||
ISmartDbDatabaseTenantDescriptor,
|
||||
ISmartDbDeleteDatabaseTenantResult,
|
||||
ISmartDbDatabaseExportCollection,
|
||||
ISmartDbDatabaseExport,
|
||||
ISmartDbImportDatabaseInput,
|
||||
ISmartDbImportDatabaseResult,
|
||||
} from './service-types.js';
|
||||
|
||||
/**
|
||||
* A single oplog entry returned from the Rust engine.
|
||||
@@ -83,73 +107,6 @@ export interface ISmartDbMetrics {
|
||||
uptimeSeconds: number;
|
||||
}
|
||||
|
||||
export interface ISmartDbHealth {
|
||||
running: boolean;
|
||||
storage?: 'memory' | 'file';
|
||||
storagePath?: string;
|
||||
authEnabled?: boolean;
|
||||
authUsers?: number;
|
||||
usersPathConfigured?: boolean;
|
||||
databaseCount: number;
|
||||
collectionCount: number;
|
||||
uptimeSeconds?: number;
|
||||
}
|
||||
|
||||
export interface ISmartDbDatabaseTenantInput {
|
||||
databaseName: string;
|
||||
username: string;
|
||||
password: string;
|
||||
roles?: string[];
|
||||
}
|
||||
|
||||
export interface ISmartDbDeleteDatabaseTenantInput {
|
||||
databaseName: string;
|
||||
username?: string;
|
||||
}
|
||||
|
||||
export interface ISmartDbRotateDatabaseTenantPasswordInput {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
export interface ISmartDbDatabaseTenantDescriptor {
|
||||
databaseName: string;
|
||||
username: string;
|
||||
roles: string[];
|
||||
authSource: string;
|
||||
mongodbUri?: string;
|
||||
}
|
||||
|
||||
export interface ISmartDbDeleteDatabaseTenantResult {
|
||||
databaseName: string;
|
||||
deletedUsers: number;
|
||||
databaseDropped: boolean;
|
||||
}
|
||||
|
||||
export interface ISmartDbDatabaseExportCollection {
|
||||
name: string;
|
||||
documents: Record<string, any>[];
|
||||
indexes: Record<string, any>[];
|
||||
}
|
||||
|
||||
export interface ISmartDbDatabaseExport {
|
||||
format: 'smartdb.database.export.v1';
|
||||
databaseName: string;
|
||||
exportedAtMs: number;
|
||||
collections: ISmartDbDatabaseExportCollection[];
|
||||
}
|
||||
|
||||
export interface ISmartDbImportDatabaseInput {
|
||||
databaseName: string;
|
||||
source: ISmartDbDatabaseExport;
|
||||
}
|
||||
|
||||
export interface ISmartDbImportDatabaseResult {
|
||||
databaseName: string;
|
||||
collections: number;
|
||||
documents: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type-safe command definitions for the RustDb IPC protocol.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user