UNPKG

mongodb-data-service

Version:
92 lines 3.77 kB
import type { MongoClient, Document, MongoClientOptions, AutoEncryptionOptions } from 'mongodb'; import type { BuildInfo, CollectionInfo, CollectionInfoNameOnly, ConnectionStatusWithPrivileges, DatabaseInfo, DbStats } from './run-command'; type BuildInfoDetails = { isEnterprise: boolean; version: string; }; type HostInfoDetails = { arch?: string; cpu_cores?: number; cpu_frequency?: number; memory_bits?: number; os?: string; os_family?: string; kernel_version?: string; kernel_version_string?: string; }; type GenuineMongoDBDetails = { isGenuine: boolean; dbType: string; }; type DataLakeDetails = { isDataLake: boolean; version: string | null; }; export type CollectionDetails = { _id: string; name: string; database: string; type: string; system: boolean; oplog: boolean; command: boolean; special: boolean; specialish: boolean; normal: boolean; readonly: boolean; clustered: boolean; collation: Document | null; view_on: string | null; fle2: boolean; pipeline: Document[] | null; validation: { validator: Document; validationAction: string; validationLevel: string; } | null; inferred_from_privileges: boolean; }; export type DatabaseDetails = { _id: string; name: string; collection_count: number; document_count: number; storage_size: number; data_size: number; index_count: number; index_size: number; collections: CollectionDetails[]; inferred_from_privileges: boolean; }; export type InstanceDetails = { auth: { user: ConnectionStatusWithPrivileges['authInfo']['authenticatedUsers'][number] | null; roles: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserRoles']; privileges: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserPrivileges']; }; build: BuildInfoDetails; host: HostInfoDetails; genuineMongoDB: GenuineMongoDBDetails; dataLake: DataLakeDetails; featureCompatibilityVersion: string | null; isAtlas: boolean; isLocalAtlas: boolean; csfleMode: 'enabled' | 'disabled' | 'unavailable'; }; export declare function getInstance(client: MongoClient, uri: string): Promise<Omit<InstanceDetails, 'csfleMode'>>; export declare function checkIsCSFLEConnection(client: { options: MongoClientOptions; }): boolean; export declare function configuredKMSProviders(autoEncryption?: AutoEncryptionOptions): (keyof NonNullable<AutoEncryptionOptions['kmsProviders']>)[]; type DatabaseCollectionPrivileges = Record<string, Record<string, string[]>>; export declare function getPrivilegesByDatabaseAndCollection(authenticatedUserPrivileges?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserPrivileges'] | null, requiredActions?: string[] | null): DatabaseCollectionPrivileges; export declare function getDatabasesByRoles(authenticatedUserRoles?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserRoles'] | null, possibleRoles?: string[] | null): string[]; export declare function isNotAuthorized(err: any): boolean; export declare function isNotSupportedPipelineStage(err: any): false | RegExpMatchArray | null; export declare function adaptBuildInfo(rawBuildInfo: Partial<BuildInfo>): BuildInfoDetails; export declare function adaptDatabaseInfo(databaseStats: Partial<DbStats> & Partial<DatabaseInfo>): Omit<DatabaseDetails, '_id' | 'collections' | 'name' | 'inferred_from_privileges'>; export declare function adaptCollectionInfo({ db, name, info, options, type, }: CollectionInfoNameOnly & Partial<CollectionInfo> & { db: string; }): Omit<CollectionDetails, 'inferred_from_privileges'>; export {}; //# sourceMappingURL=instance-detail-helper.d.ts.map