UNPKG

mongodb-data-service

Version:
715 lines • 30.8 kB
import type { DevtoolsProxyOptions } from '@mongodb-js/devtools-proxy-support'; import { ExplainVerbosity } from 'mongodb'; import type { Abortable, AggregateOptions, AggregationCursor, AnyBulkWriteOperation, BulkWriteOptions, BulkWriteResult, Collection, CountDocumentsOptions, CreateCollectionOptions, CreateIndexesOptions, DeleteOptions, DeleteResult, Document, EstimatedDocumentCountOptions, Filter, FindCursor, FindOneAndReplaceOptions, FindOneAndUpdateOptions, FindOptions, IndexSpecification, InsertManyResult, InsertOneOptions, InsertOneResult, ServerHeartbeatFailedEvent, TopologyDescription, TopologyDescriptionChangedEvent, TopologyType, IndexInformationOptions, UpdateFilter, UpdateOptions, UpdateResult, ReplaceOptions, ClientEncryptionDataKeyProvider, ClientEncryptionCreateDataKeyProviderOptions, SearchIndexDescription, ReadPreferenceMode } from 'mongodb'; import ConnectionStringUrl from 'mongodb-connection-string-url'; import type { ConnectionOptions } from './connection-options'; import type { CollectionDetails, DatabaseDetails, InstanceDetails } from './instance-detail-helper'; import { adaptCollectionInfo, adaptDatabaseInfo } from './instance-detail-helper'; import type { ReauthenticationHandler } from './connect-mongo-client'; import type { CollectionStats } from './types'; import type { ConnectionStatusWithPrivileges } from './run-command'; import type { CSFLECollectionTracker } from './csfle-collection-tracker'; import { isCancelError } from '@mongodb-js/compass-utils'; import type { IndexDefinition } from './index-detail-helper'; import type { SearchIndex } from './search-index-detail-helper'; import type { BoundLogger, DataServiceImplLogger } from './logger'; import { WithLogContext } from './logger'; import type { DevtoolsConnectOptions } from '@mongodb-js/devtools-connect'; export type ExecutionOptions = { abortSignal?: AbortSignal; }; export type ExplainExecuteOptions = ExecutionOptions & { explainVerbosity?: keyof typeof ExplainVerbosity; }; export type SampleOptions = { size?: number; query?: Filter<Document>; fields?: Document; }; export interface DataServiceEventMap { topologyDescriptionChanged: (evt: TopologyDescriptionChangedEvent) => void; serverHeartbeatFailed: (evt: ServerHeartbeatFailedEvent) => void; connectionInfoSecretsChanged: () => void; close: () => void; oidcAuthFailed: (error: string) => void; } export type UpdatePreviewChange = { before: Document; after: Document; }; export type UpdatePreviewExecutionOptions = ExecutionOptions & { sample?: number; timeout?: number; }; export type UpdatePreview = { changes: UpdatePreviewChange[]; }; export type StreamProcessor = { id: string; name: string; state: 'CREATING' | 'CREATED' | 'VALIDATING' | 'PROVISIONING' | 'RECEIVED_ON_DISPATCHER' | 'STARTING' | 'STARTED' | 'STOPPING' | 'STOPPED' | 'RELEASING' | 'DROPPING' | 'DROPPED' | 'FAILED'; pipeline: Document[]; lastStateChange: Date; lastModified: Date; }; export interface DataService { on<K extends keyof DataServiceEventMap>(event: K, listener: DataServiceEventMap[K]): this; off<K extends keyof DataServiceEventMap>(event: K, listener: DataServiceEventMap[K]): this; removeListener<K extends keyof DataServiceEventMap>(event: K, listener: DataServiceEventMap[K]): this; once<K extends keyof DataServiceEventMap>(event: K, listener: DataServiceEventMap[K]): this; readonly id: number; /*** Connection ***/ /** * Connect the service */ connect(options?: { signal?: AbortSignal; productName?: string; productDocsLink?: string; }): Promise<void>; /** * Disconnect the service */ disconnect(): Promise<void>; /** * Returns whether or not current instance is connected */ isConnected(): boolean; /** * Returns connection options passed to the driver on connection */ getMongoClientConnectionOptions(): { url: string; options: DevtoolsConnectOptions; } | undefined; /** * Returns connection options DataService was initialized with */ getConnectionOptions(): Readonly<ConnectionOptions>; /** * Returns connection string for the connection options DataService was * initialized with */ getConnectionString(): ConnectionStringUrl; /** * Return the current topology type, as reported by the driver's topology * update events. * * @returns The current topology type. */ getCurrentTopologyType(): TopologyType; /** * Returns the most recent topology description from the server's SDAM events. * https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring-monitoring.rst#events */ getLastSeenTopology(): null | TopologyDescription; /** * Is the data service allowed to perform write operations. * @returns If the data service is writable. */ isWritable(): boolean; /** * Is the data service connected to a mongos. * @returns If the data service is connected to a mongos. */ isMongos(): boolean; /*** Server Stats and Info ***/ /** * Get the current instance details. * * @deprecated avoid using `instance` directly and use `InstanceModel` instead */ instance(): Promise<InstanceDetails>; /** * Returns the results of currentOp. */ currentOp(): Promise<{ inprog: Document; }>; /** * Returns the result of serverStatus. */ serverStatus(): Promise<Document>; /** * Returns the result of top. * * @param callback - the callback. */ top(): Promise<{ totals: Record<string, unknown>; }>; /** * Kills operation by operation id * @see {@link https://www.mongodb.com/docs/manual/reference/command/killOp/#mongodb-dbcommand-dbcmd.killOp} */ killOp(id: number, comment?: string): Promise<Document>; /*** Collections ***/ /** * List all collections for a database. * * @deprecated avoid using `listCollections` directly and use * `CollectionModel` instead */ listCollections(databaseName: string, filter?: Document, options?: { nameOnly?: true; fetchNamespacesFromPrivileges?: boolean; privileges?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserPrivileges'] | null; }): Promise<CollectionDetails[]>; /** * Returns normalized collection info provided by listCollection command for a * specific collection * * @param dbName database name * @param collName collection name */ collectionInfo(dbName: string, collName: string): Promise<ReturnType<typeof adaptCollectionInfo> | null>; /** * Get the stats for a collection. * * @param databaseName - The database name. * @param collectionName - The collection name. */ collectionStats(databaseName: string, collectionName: string): Promise<CollectionStats>; /** * Creates a collection * * @param ns - The namespace. * @param options - The options. */ createCollection(ns: string, options: CreateCollectionOptions): Promise<Collection<Document>>; /** * Create a new view. * * @param name - The collectionName for the view. * @param sourceNs - The source `<db>.<collectionOrViewName>` for the view. * @param pipeline - The agggregation pipeline for the view. * @param options - Options e.g. collation. */ createView(name: string, sourceNs: string, pipeline: Document[], options: CreateCollectionOptions): Promise<Collection<Document>>; /** * Update a collection. * * @param ns - The namespace. * @param flags - The flags. */ updateCollection(ns: string, flags: Document & { collMod?: never; }): Promise<Document>; /** * Drops a collection from a database * * @param ns - The namespace. * @param callback - The callback. */ dropCollection(ns: string): Promise<boolean>; /** * */ renameCollection(ns: string, newCollectionName: string): Promise<Collection<Document>>; /** * Count the number of documents in the collection. * * @param ns - The namespace to search on. * @param options - The query options. * @param executionOptions - The execution options. */ estimatedCount(ns: string, options?: EstimatedDocumentCountOptions, executionOptions?: ExecutionOptions): Promise<number>; /*** Databases ***/ /** * List all databases on the currently connected instance. * * @deprecated avoid using `listDatabases` directly and use `DatabaseModel` * instead */ listDatabases(options?: { nameOnly?: true; fetchNamespacesFromPrivileges?: boolean; privileges?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserPrivileges'] | null; roles?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserRoles'] | null; }): Promise<Omit<DatabaseDetails, 'collections'>[]>; /** * Get the stats for a database. * * @param name - The database name. * @param callback - The callback. */ databaseStats(name: string): Promise<ReturnType<typeof adaptDatabaseInfo> & { name: string; }>; /** * Drops a database * * @param name - The database name */ dropDatabase(name: string): Promise<boolean>; /*** Indexes ***/ /** * Get the indexes for the collection. * * @param ns - The collection namespace. * @param options - Index information options */ indexes(ns: string, options?: IndexInformationOptions, executionOptions?: ExecutionOptions): Promise<IndexDefinition[]>; /** * Creates an index * * @param ns - The namespace. * @param spec - The index specification. * @param options - The options. */ createIndex(ns: string, spec: IndexSpecification, options: CreateIndexesOptions): Promise<string>; /** * Drops an index from a collection * * @param ns - The namespace. * @param name - The index name. */ dropIndex(ns: string, name: string): Promise<Document>; /*** SearchIndexes ***/ isListSearchIndexesSupported(ns: string): Promise<boolean>; getSearchIndexes(ns: string): Promise<SearchIndex[]>; createSearchIndex(ns: string, description: SearchIndexDescription): Promise<string>; updateSearchIndex(ns: string, name: string, definition: Document): Promise<void>; dropSearchIndex(ns: string, name: string): Promise<void>; /*** Aggregation ***/ /** * Execute an aggregation framework pipeline with the provided options on the * collection. * * @param ns - The namespace to search on. * @param pipeline - The aggregation pipeline. * @param options - The aggregation options. * @param executionOptions - The execution options. */ aggregate(ns: string, pipeline: Document[], options?: AggregateOptions, executionOptions?: ExecutionOptions): Promise<Document[]>; /** * Returns an aggregation cursor on the collection. * * @param ns - The namespace to search on. * @param pipeline - The aggregation pipeline. * @param options - The aggregation options. */ aggregateCursor(ns: string, pipeline: Document[], options?: AggregateOptions & Abortable): AggregationCursor; explainAggregate(ns: string, pipeline: Document[], options: AggregateOptions, executionOptions?: ExplainExecuteOptions): Promise<Document>; /*** Find ***/ /** * Find documents for the provided filter and options on the collection. * * @param ns - The namespace to search on. * @param filter - The query filter. * @param options - The query options. * @param executionOptions - The execution options. */ find(ns: string, filter: Filter<Document>, options?: FindOptions, executionOptions?: ExecutionOptions): Promise<Document[]>; /** * Returns a find cursor on the collection. * * @param ns - The namespace to search on. * @param filter - The query filter. * @param options - The query options. */ findCursor(ns: string, filter: Filter<Document>, options?: FindOptions): FindCursor; /** * Returns explain plan for the provided filter and options on the collection. * * @param ns - The namespace to search on. * @param filter - The query filter. * @param options - The query options. * @param executionOptions - The execution options. */ explainFind(ns: string, filter: Filter<Document>, options?: FindOptions, executionOptions?: ExplainExecuteOptions): Promise<Document>; /** * Find one document and replace it with the replacement. * * @param ns - The namespace to search on. * @param filter - The filter. * @param replacement - The replacement doc. * @param options - The query options. */ findOneAndReplace(ns: string, filter: Filter<Document>, replacement: Document, options?: FindOneAndReplaceOptions): Promise<Document | null>; /** * Find one document and update it with the update operations. * * @param ns - The namespace to search on. * @param filter - The filter. * @param update - The update operations doc. * @param options - The query options. */ findOneAndUpdate(ns: string, filter: Filter<Document>, update: Document, options?: FindOneAndUpdateOptions): Promise<Document | null>; /** * Update one document. * * @param ns - The namespace to search on. * @param filter - The filter used to select the document to update. * @param update - The update operations to be applied to the document. * @param options - Optional settings for the command. */ updateOne(ns: string, filter: Filter<Document>, update: Document, options?: UpdateOptions): Promise<Document | null>; /** * Replace one document. * * @param ns - The namespace to search on. * @param filter - The filter. * @param replacement - The Document that replaces the matching document. * @param options - Optional settings for the command. */ replaceOne(ns: string, filter: Filter<Document>, replacement: Document, options?: UpdateOptions): Promise<Document | null>; /** * Count the number of documents in the collection for the provided filter * and options. * * @param ns - The namespace to search on. * @param filter - The filter query. * @param options - The query options. * @param executionOptions - The execution options. */ count(ns: string, filter: Filter<Document>, options?: CountDocumentsOptions, executionOptions?: ExecutionOptions & { fallbackReadPreference?: ReadPreferenceMode; }): Promise<number>; /** * Returns a cursor to a sample on the collection. * * @param ns - The namespace to sample. * @param args - The sampling options. * @param options - Driver options (ie. maxTimeMs, session, batchSize ...) */ sampleCursor(ns: string, args?: SampleOptions, options?: AggregateOptions & Abortable, executionOptions?: ExecutionOptions & { fallbackReadPreference?: ReadPreferenceMode; }): AggregationCursor; /** * Sample documents from the collection. * * @param ns - The namespace to sample. * @param args - The sampling options. * @param options - Driver options (ie. maxTimeMs, session, batchSize ...) */ sample(ns: string, args?: SampleOptions, options?: AggregateOptions, executionOptions?: ExecutionOptions & { fallbackReadPreference?: ReadPreferenceMode; }): Promise<Document[]>; /*** Insert ***/ /** * Insert a single document into the database. * * @param ns - The namespace. * @param doc - The document to insert. * @param options - The options. */ insertOne(ns: string, doc: Document, options?: InsertOneOptions): Promise<InsertOneResult<Document>>; /** * Inserts multiple documents into the collection. * * @param ns - The namespace. * @param docs - The documents to insert. * @param options - The options. * @param callback - The callback. */ insertMany(ns: string, docs: Document[], options?: BulkWriteOptions): Promise<InsertManyResult<Document>>; /** * Performs multiple write operations with controls for order of execution. * * @param ns Namespace * @param operations An array of `bulkWrite()` write operations. * @param options `bulkWrite()` options * * @see {@link https://www.mongodb.com/docs/manual/reference/method/db.collection.bulkWrite/} */ bulkWrite(ns: string, operations: AnyBulkWriteOperation[], options: BulkWriteOptions): Promise<BulkWriteResult>; /*** Delete ***/ /** * Delete a single document from the collection. * * @param ns - The namespace. * @param filter - The filter. * @param options - The options. */ deleteOne(ns: string, filter: Filter<Document>, options?: DeleteOptions): Promise<DeleteResult>; /** * Deletes multiple documents from a collection. * * @param ns - The namespace. * @param filter - The filter. * @param options - The options. */ deleteMany(ns: string, filter: Filter<Document>, options?: DeleteOptions): Promise<DeleteResult>; /** * Helper method to check whether or not error is caused by dataService * operation being aborted * * @param error The error to check. */ isCancelError(error: any): ReturnType<typeof isCancelError>; /** * Create a new data encryption key (DEK) using the ClientEncryption * helper class. */ createDataKey(provider: string, options?: unknown): Promise<Document>; /** * Returns current CSFLE status (`enabled` or `disabled`) or `unavailable` * when no CSFLE configuration was provided to the dataService. * * Should default to `unavailable` on unsupported platforms */ getCSFLEMode(): 'enabled' | 'disabled' | 'unavailable'; /** * Change current CSFLE status */ setCSFLEEnabled(enabled: boolean): void; /** * @see CSFLECollectionTracker.isUpdateAllowed */ isUpdateAllowed: CSFLECollectionTracker['isUpdateAllowed']; /** * @see CSFLECollectionTracker.knownSchemaForCollection */ knownSchemaForCollection: CSFLECollectionTracker['knownSchemaForCollection']; /** * Returns a list of configured KMS providers for the current connection */ configuredKMSProviders(): string[]; /** * Register reauthentication handlers with this DataService instance. */ addReauthenticationHandler(handler: ReauthenticationHandler): void; /** * Return the current state of ConnectionOptions secrets, which may have changed * since connecting (e.g. OIDC tokens). The `connectionInfoSecretsChanged` event * is being emitted when this value changes. */ getUpdatedSecrets(): Promise<Partial<ConnectionOptions>>; /** * Runs the update within a transactions, only * modifying a subset of the documents matched by the filter. * It returns a list of the changed documents, or a serverError. */ previewUpdate(ns: string, filter: Document, update: Document | Document[], executionOptions?: UpdatePreviewExecutionOptions): Promise<UpdatePreview>; /** * Updates multiple documents from a collection. * * @param ns - The namespace. * @param filter - The filter. * @param update - The update. * @param options - The options. */ updateMany(ns: string, filter: Filter<Document>, update: UpdateFilter<Document>, options?: UpdateOptions): Promise<UpdateResult>; /*** Streams ***/ /** * List all the named stream processors. */ listStreamProcessors(filter?: Document): Promise<StreamProcessor[]>; /** * Start the specified stream processor * * @param name processor name */ startStreamProcessor(name: string): Promise<void>; /** * Stop the specified stream processor * * @param name processor name */ stopStreamProcessor(name: string): Promise<void>; /** * Drop the specified stream processor * * @param name processor name */ dropStreamProcessor(name: string): Promise<void>; } declare class DataServiceImpl extends WithLogContext implements DataService { private readonly _connectionOptions; private readonly _proxyOptions; private _isConnecting; private _mongoClientConnectionOptions?; private _metadataClient?; private _crudClient?; private _useCRUDClient; private _csfleCollectionTracker?; private _tunnel?; private _state?; private _reauthenticationHandlers; /** * Stores the most recent topology description from the server's SDAM events: * https://github.com/mongodb/specifications/blob/master/source/server-discovery-and-monitoring/server-discovery-and-monitoring-monitoring.rst#events */ private _lastSeenTopology; private _isWritable; private _id; private _emitter; /** * Directly used during data-service runtime, auto sets component and context * with a connection id */ protected _logger: BoundLogger; /** * To be passed to the connect-mongo-client */ private _unboundLogger?; private _getOptionsWithFallbackReadPreference; constructor(connectionOptions: Readonly<ConnectionOptions>, logger?: DataServiceImplLogger, proxyOptions?: DevtoolsProxyOptions); get id(): number; on(...args: Parameters<DataService['on']>): this; off(...args: Parameters<DataService['on']>): this; removeListener(...args: Parameters<DataService['on']>): this; once(...args: Parameters<DataService['on']>): this; getMongoClientConnectionOptions(): { url: string; options: DevtoolsConnectOptions; } | undefined; getConnectionOptions(): Readonly<ConnectionOptions>; getConnectionString(): ConnectionStringUrl; setCSFLEEnabled(enabled: boolean): void; getCSFLEMode(): 'enabled' | 'disabled' | 'unavailable'; collectionStats(databaseName: string, collectionName: string): Promise<CollectionStats>; collectionInfo(dbName: string, collName: string): Promise<ReturnType<typeof adaptCollectionInfo> | null>; killOp(id: number, comment?: string): Promise<Document>; isWritable(): boolean; isMongos(): boolean; getCurrentTopologyType(): TopologyType; private _connectionStatus; private _getPrivilegesOrFallback; private _getRolesOrFallback; private _listCollections; listCollections(databaseName: string, filter?: Document, { nameOnly, fetchNamespacesFromPrivileges, privileges, }?: { nameOnly?: true; fetchNamespacesFromPrivileges?: boolean; privileges?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserPrivileges'] | null; }): Promise<CollectionDetails[]>; listDatabases({ nameOnly, fetchNamespacesFromPrivileges, privileges, roles, }?: { nameOnly?: true; fetchNamespacesFromPrivileges?: boolean; privileges?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserPrivileges'] | null; roles?: ConnectionStatusWithPrivileges['authInfo']['authenticatedUserRoles'] | null; }): Promise<Omit<DatabaseDetails, 'collections'>[]>; addReauthenticationHandler(handler: ReauthenticationHandler): void; private _requestReauthenticationFromUser; connect({ signal, productName, productDocsLink, }?: { signal?: AbortSignal; productName?: string; productDocsLink?: string; }): Promise<void>; estimatedCount(ns: string, options?: EstimatedDocumentCountOptions, executionOptions?: ExecutionOptions): Promise<number>; count(ns: string, filter: Filter<Document>, options?: CountDocumentsOptions, executionOptions?: ExecutionOptions & { fallbackReadPreference: ReadPreferenceMode; }): Promise<number>; createCollection(ns: string, options: CreateCollectionOptions): Promise<Collection<Document>>; createIndex(ns: string, spec: IndexSpecification, options: CreateIndexesOptions): Promise<string>; deleteOne(ns: string, filter: Filter<Document>, options?: DeleteOptions): Promise<DeleteResult>; deleteMany(ns: string, filter: Filter<Document>, options?: DeleteOptions): Promise<DeleteResult>; updateMany(ns: string, filter: Filter<Document>, update: UpdateFilter<Document>, options?: UpdateOptions): Promise<UpdateResult>; disconnect(): Promise<void>; dropCollection(ns: string): Promise<boolean>; renameCollection(ns: string, newCollectionName: string): Promise<Collection<Document>>; dropDatabase(name: string): Promise<boolean>; dropIndex(ns: string, name: string): Promise<Document>; isListSearchIndexesSupported(ns: string): Promise<boolean>; getSearchIndexes(ns: string): Promise<SearchIndex[]>; createSearchIndex(ns: string, description: SearchIndexDescription): Promise<string>; updateSearchIndex(ns: string, name: string, definition: Document): Promise<void>; dropSearchIndex(ns: string, name: string): Promise<void>; aggregateCursor(ns: string, pipeline: Document[], options?: AggregateOptions & Abortable): AggregationCursor; aggregate<T = Document>(ns: string, pipeline: Document[], options?: AggregateOptions, executionOptions?: ExecutionOptions): Promise<T[]>; find(ns: string, filter: Filter<Document>, options?: FindOptions, executionOptions?: ExecutionOptions): Promise<Document[]>; findCursor(ns: string, filter: Filter<Document>, options?: FindOptions): FindCursor; findOneAndReplace(ns: string, filter: Filter<Document>, replacement: Document, options: FindOneAndReplaceOptions): Promise<Document | null>; findOneAndUpdate(ns: string, filter: Filter<Document>, update: Document, options: FindOneAndUpdateOptions): Promise<Document | null>; updateOne(ns: string, filter: Filter<Document>, update: Document, options: UpdateOptions): Promise<Document | null>; replaceOne(ns: string, filter: Filter<Document>, replacement: Document, options: ReplaceOptions): Promise<Document | null>; explainFind(ns: string, filter: Filter<Document>, options?: FindOptions, executionOptions?: ExplainExecuteOptions): Promise<Document>; explainAggregate(ns: string, pipeline: Document[], options: AggregateOptions, executionOptions?: ExplainExecuteOptions): Promise<Document>; private _indexStats; private _indexSizes; private _indexProgress; indexes(ns: string, options?: IndexInformationOptions): Promise<IndexDefinition[]>; instance(): Promise<InstanceDetails>; insertOne(ns: string, doc: Document, options?: InsertOneOptions): Promise<InsertOneResult<Document>>; insertMany(ns: string, docs: Document[], options?: BulkWriteOptions): Promise<InsertManyResult<Document>>; updateCollection(ns: string, flags?: Document & { collMod?: never; }): Promise<Document>; bulkWrite(ns: string, operations: AnyBulkWriteOperation<Document>[], options: BulkWriteOptions): Promise<BulkWriteResult>; currentOp(): Promise<{ inprog: Document[]; }>; getLastSeenTopology(): null | TopologyDescription; serverStatus(): Promise<Document>; top(): Promise<{ totals: Record<string, unknown>; }>; createView(name: string, sourceNs: string, pipeline: Document[], options?: Omit<CreateCollectionOptions, 'viewOn' | 'pipeline'>): Promise<Collection<Document>>; private _buildSamplingPipeline; sampleCursor(ns: string, samplingOptions?: SampleOptions, options?: AggregateOptions & Abortable, executionOptions?: ExecutionOptions & { fallbackReadPreference?: ReadPreferenceMode; }): AggregationCursor; sample(ns: string, samplingOptions?: SampleOptions, options?: AggregateOptions, executionOptions?: ExecutionOptions & { fallbackReadPreference?: ReadPreferenceMode; }): Promise<Document[]>; private _startSession; private _killSessions; isConnected(): boolean; private _cancellableOperation; isCancelError(error: any): ReturnType<typeof isCancelError>; private _setupListeners; private _initializedClient; private _getCSFLECollectionTracker; isUpdateAllowed(ns: string, originalDocument: Document): Promise<boolean>; knownSchemaForCollection(ns: string): Promise<{ hasSchema: boolean; encryptedFields: import("./csfle-collection-tracker").CSFLEEncryptedFieldsSet; }>; databaseStats(name: string): Promise<ReturnType<typeof adaptDatabaseInfo> & { name: string; }>; previewUpdate(ns: string, filter: Document, update: Document | Document[], executionOptions?: UpdatePreviewExecutionOptions): Promise<UpdatePreview>; /** * @param databaseName - The name of the database. * @param collectionName - The name of the collection. * @param data - The result of the collStats command. */ private _buildCollectionStats; /** * Get the collection to operate on. * * @param ns - The namespace. */ private _collection; /** * Get the database to operate on. * * @param ns - The namespace. */ private _database; /** * Get the collection name from a namespace. * * @param ns - The namespace in database.collection format. */ private _collectionName; /** * Get the database name from a namespace. * * @param ns - The namespace in database.collection format. */ private _databaseName; /** * Determine if the hello response indicates a writable server. * * @param evt - The topology description changed event. * * @returns If the server is writable. */ private _checkIsWritable; private _cleanup; private _resetCRUDClient; configuredKMSProviders(): string[]; private _csfleLogInformation; createDataKey(provider: ClientEncryptionDataKeyProvider, options?: ClientEncryptionCreateDataKeyProviderOptions): Promise<Document>; private _getClientEncryption; getUpdatedSecrets(): Promise<Partial<ConnectionOptions>>; listStreamProcessors(filter?: Document): Promise<StreamProcessor[]>; startStreamProcessor(name: string): Promise<void>; stopStreamProcessor(name: string): Promise<void>; dropStreamProcessor(name: string): Promise<void>; } export { DataServiceImpl }; export default DataService; //# sourceMappingURL=data-service.d.ts.map