diff --git a/.eslintrc.json b/.eslintrc.json index 6c738ef9379..404f9cffdd6 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -186,6 +186,7 @@ { "patterns": [ "**/../lib/**", + "**/../src/**", "mongodb-mock-server" ] } @@ -224,7 +225,8 @@ { "patterns": [ "**/../lib/**", - "mongodb-mock-server" + "mongodb-mock-server", + "**/../src/**" ] } ] @@ -331,6 +333,15 @@ "disallowTypeAnnotations": false, "fixStyle": "separate-type-imports" } + ], + "no-restricted-imports": [ + "error", + { + "patterns": [ + "**/../lib/**", + "**/../src/**" + ] + } ] } } diff --git a/src/cmap/auth/mongodb_oidc.ts b/src/cmap/auth/mongodb_oidc.ts index 231862d2c65..474f49a8fd5 100644 --- a/src/cmap/auth/mongodb_oidc.ts +++ b/src/cmap/auth/mongodb_oidc.ts @@ -5,11 +5,11 @@ import type { Connection } from '../connection'; import { type AuthContext, AuthProvider } from './auth_provider'; import type { MongoCredentials } from './mongo_credentials'; import { AutomatedCallbackWorkflow } from './mongodb_oidc/automated_callback_workflow'; -import { callback as azureCallback } from './mongodb_oidc/azure_machine_workflow'; -import { callback as gcpCallback } from './mongodb_oidc/gcp_machine_workflow'; -import { callback as k8sCallback } from './mongodb_oidc/k8s_machine_workflow'; +import { azureCallback } from './mongodb_oidc/azure_machine_workflow'; +import { gcpCallback } from './mongodb_oidc/gcp_machine_workflow'; +import { k8sCallback } from './mongodb_oidc/k8s_machine_workflow'; import { TokenCache } from './mongodb_oidc/token_cache'; -import { callback as testCallback } from './mongodb_oidc/token_machine_workflow'; +import { tokenMachineCallback as testCallback } from './mongodb_oidc/token_machine_workflow'; /** Error when credentials are missing. */ const MISSING_CREDENTIALS_ERROR = 'AuthContext must provide credentials.'; diff --git a/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts b/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts index 5331fea6ed1..5b3cbde1ddd 100644 --- a/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts +++ b/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts @@ -19,7 +19,7 @@ const TOKEN_RESOURCE_MISSING_ERROR = * @param params - The OIDC callback parameters. * @returns The OIDC response. */ -export const callback: OIDCCallbackFunction = async ( +export const azureCallback: OIDCCallbackFunction = async ( params: OIDCCallbackParams ): Promise => { const tokenAudience = params.tokenAudience; diff --git a/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts b/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts index c55f1d5bb7d..f72655e4017 100644 --- a/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts +++ b/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts @@ -18,7 +18,7 @@ const TOKEN_RESOURCE_MISSING_ERROR = * @param params - The OIDC callback parameters. * @returns The OIDC response. */ -export const callback: OIDCCallbackFunction = async ( +export const gcpCallback: OIDCCallbackFunction = async ( params: OIDCCallbackParams ): Promise => { const tokenAudience = params.tokenAudience; diff --git a/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts b/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts index 82c11800876..95b83f029b0 100644 --- a/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts +++ b/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts @@ -17,7 +17,7 @@ const AWS_FILENAME = 'AWS_WEB_IDENTITY_TOKEN_FILE'; * @param params - The OIDC callback parameters. * @returns The OIDC response. */ -export const callback: OIDCCallbackFunction = async (): Promise => { +export const k8sCallback: OIDCCallbackFunction = async (): Promise => { let filename: string; if (process.env[AZURE_FILENAME]) { filename = process.env[AZURE_FILENAME]; diff --git a/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts b/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts index 8bb68b98572..4362b57b0bc 100644 --- a/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts +++ b/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts @@ -12,7 +12,7 @@ const TOKEN_MISSING_ERROR = 'OIDC_TOKEN_FILE must be set in the environment.'; * @param params - The OIDC callback parameters. * @returns The OIDC response. */ -export const callback: OIDCCallbackFunction = async (): Promise => { +export const tokenMachineCallback: OIDCCallbackFunction = async (): Promise => { const tokenFile = process.env.OIDC_TOKEN_FILE; if (!tokenFile) { throw new MongoAWSError(TOKEN_MISSING_ERROR); diff --git a/test/action/dependency.test.ts b/test/action/dependency.test.ts index 275f0f545f0..dc3aa7294f6 100644 --- a/test/action/dependency.test.ts +++ b/test/action/dependency.test.ts @@ -5,7 +5,7 @@ import * as path from 'node:path'; import { expect } from 'chai'; import { dependencies, peerDependencies, peerDependenciesMeta } from '../../package.json'; -import { setDifference } from '../../src/utils'; +import { setDifference } from '../mongodb'; import { alphabetically, itInNodeProcess, sorted } from '../tools/utils'; const EXPECTED_DEPENDENCIES = sorted( @@ -139,6 +139,7 @@ describe('package.json', function () { beforeEach(async function () { for (const key of Object.keys(require.cache)) delete require.cache[key]; + // Intentionally import from `src` because we are testing the package's exports (index.ts) // eslint-disable-next-line @typescript-eslint/no-require-imports require('../../src'); imports = Array.from( diff --git a/test/benchmarks/unitBench/list.bench.js b/test/benchmarks/unitBench/list.bench.js index 4e497941254..e3cf380f1e1 100644 --- a/test/benchmarks/unitBench/list.bench.js +++ b/test/benchmarks/unitBench/list.bench.js @@ -1,5 +1,5 @@ const chalk = require('chalk'); -const { List } = require('../../../src/utils'); +const { List } = require('../../mongodb'); const { createHistogram } = require('perf_hooks'); const { process } = require('process'); diff --git a/test/csfle-kms-providers.ts b/test/csfle-kms-providers.ts index 9dcd8f3d58d..f18ac70de9d 100644 --- a/test/csfle-kms-providers.ts +++ b/test/csfle-kms-providers.ts @@ -1,6 +1,6 @@ import * as process from 'process'; -import { type KMSProviders } from './../src'; +import { type KMSProviders } from './mongodb'; const csfleKMSProviders = { aws: { diff --git a/test/integration/auth/auth.prose.test.ts b/test/integration/auth/auth.prose.test.ts index 5abdd398cac..1b2dfc26338 100644 --- a/test/integration/auth/auth.prose.test.ts +++ b/test/integration/auth/auth.prose.test.ts @@ -2,10 +2,7 @@ import { expect } from 'chai'; import * as process from 'process'; import * as sinon from 'sinon'; -import { type MongoClient } from '../../../src'; -import { ScramSHA256 } from '../../../src/cmap/auth/scram'; -import { Connection } from '../../../src/cmap/connection'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; +import { Connection, LEGACY_HELLO_COMMAND, type MongoClient, ScramSHA256 } from '../../mongodb'; import { type TestConfiguration } from '../../tools/runner/config'; function makeConnectionString(config, username, password) { diff --git a/test/integration/auth/mongodb_aws.prose.test.ts b/test/integration/auth/mongodb_aws.prose.test.ts index 34940e60c29..33e8502a3e0 100644 --- a/test/integration/auth/mongodb_aws.prose.test.ts +++ b/test/integration/auth/mongodb_aws.prose.test.ts @@ -1,9 +1,7 @@ import { expect } from 'chai'; import * as process from 'process'; -import { type MongoClient, MongoServerError } from '../../../src'; -import { AWSSDKCredentialProvider } from '../../../src/cmap/auth/aws_temporary_credentials'; - +import { AWSSDKCredentialProvider, type MongoClient, MongoServerError } from '../../mongodb'; const isMongoDBAWSAuthEnvironment = (process.env.MONGODB_URI ?? '').includes('MONGODB-AWS'); describe('MONGODB-AWS Prose Tests', function () { diff --git a/test/integration/auth/mongodb_aws.test.ts b/test/integration/auth/mongodb_aws.test.ts index 56dba04082b..95b792e864c 100644 --- a/test/integration/auth/mongodb_aws.test.ts +++ b/test/integration/auth/mongodb_aws.test.ts @@ -5,24 +5,23 @@ import * as process from 'process'; import * as sinon from 'sinon'; import { + aws4Sign, type AWSCredentials, + AWSSDKCredentialProvider, type CommandOptions, + Connection, type Document, MongoAWSError, type MongoClient, + MongoDBAWS, type MongoDBNamespace, type MongoDBResponseConstructor, MongoMissingCredentialsError, MongoMissingDependencyError, - MongoServerError -} from '../../../src'; -import { refreshKMSCredentials } from '../../../src/client-side-encryption/providers'; -import { AWSSDKCredentialProvider } from '../../../src/cmap/auth/aws_temporary_credentials'; -import { aws4Sign } from '../../../src/cmap/auth/aws4'; -import { MongoDBAWS } from '../../../src/cmap/auth/mongodb_aws'; -import { Connection } from '../../../src/cmap/connection'; -import { setDifference } from '../../../src/utils'; - + MongoServerError, + refreshKMSCredentials, + setDifference +} from '../../mongodb'; const isMongoDBAWSAuthEnvironment = (process.env.MONGODB_URI ?? '').includes('MONGODB-AWS'); describe('MONGODB-AWS', function () { diff --git a/test/integration/auth/mongodb_oidc.prose.test.ts b/test/integration/auth/mongodb_oidc.prose.test.ts index 66aabda7e84..a7e89876a6a 100644 --- a/test/integration/auth/mongodb_oidc.prose.test.ts +++ b/test/integration/auth/mongodb_oidc.prose.test.ts @@ -10,11 +10,11 @@ import { type Collection, MongoClient, type MongoClientOptions, + type MongoDBOIDC, + type OIDCCallbackFunction, type OIDCCallbackParams, type OIDCResponse -} from '../../../src'; -import { type MongoDBOIDC, type OIDCCallbackFunction } from '../../../src/cmap/auth/mongodb_oidc'; - +} from '../../mongodb'; const createCallback = (tokenFile = 'test_user1', expiresInSeconds?: number, extraFields?: any) => { return async (params: OIDCCallbackParams) => { const token = await readFile(path.join(process.env.OIDC_TOKEN_DIR, tokenFile), { diff --git a/test/integration/bson-decimal128/decimal128.test.ts b/test/integration/bson-decimal128/decimal128.test.ts index 73e7bab69a4..9797ce62062 100644 --- a/test/integration/bson-decimal128/decimal128.test.ts +++ b/test/integration/bson-decimal128/decimal128.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type Collection, Decimal128, type MongoClient } from '../../../src'; +import { type Collection, Decimal128, type MongoClient } from '../../mongodb'; describe('Decimal128', function () { let client: MongoClient; diff --git a/test/integration/causal-consistency/causal_consistency.prose.test.js b/test/integration/causal-consistency/causal_consistency.prose.test.js index f4932b12a24..9f333ff7813 100644 --- a/test/integration/causal-consistency/causal_consistency.prose.test.js +++ b/test/integration/causal-consistency/causal_consistency.prose.test.js @@ -1,6 +1,6 @@ 'use strict'; -const { LEGACY_HELLO_COMMAND } = require('../../../src/constants'); +const { LEGACY_HELLO_COMMAND } = require('../../mongodb'); const { setupDatabase } = require('../shared'); const { expect } = require('chai'); diff --git a/test/integration/change-streams/change_stream.test.ts b/test/integration/change-streams/change_stream.test.ts index c3011a4168c..fbdc5e45613 100644 --- a/test/integration/change-streams/change_stream.test.ts +++ b/test/integration/change-streams/change_stream.test.ts @@ -11,16 +11,18 @@ import { type ChangeStream, type ChangeStreamDocument, type ChangeStreamOptions, + type Collection, + type CommandStartedEvent, + type Db, + isHello, + LEGACY_HELLO_COMMAND, + MongoAPIError, + MongoChangeStreamError, + type MongoClient, + MongoServerError, + ReadPreference, type ResumeToken -} from '../../../src/change_stream'; -import { type CommandStartedEvent } from '../../../src/cmap/command_monitoring_events'; -import { type Collection } from '../../../src/collection'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; -import { type Db } from '../../../src/db'; -import { MongoAPIError, MongoChangeStreamError, MongoServerError } from '../../../src/error'; -import { type MongoClient } from '../../../src/mongo_client'; -import { ReadPreference } from '../../../src/read_preference'; -import { isHello } from '../../../src/utils'; +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/unified_suite_builder'; import { type FailCommandFailPoint, sleep } from '../../tools/utils'; diff --git a/test/integration/change-streams/change_streams.prose.test.ts b/test/integration/change-streams/change_streams.prose.test.ts index e39a4e652f7..d655036b70f 100644 --- a/test/integration/change-streams/change_streams.prose.test.ts +++ b/test/integration/change-streams/change_streams.prose.test.ts @@ -10,13 +10,13 @@ import { type CommandStartedEvent, type CommandSucceededEvent, type Document, + LEGACY_HELLO_COMMAND, Long, type MongoClient, MongoNetworkError, ObjectId, Timestamp -} from '../../../src'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import { setupDatabase } from '../shared'; diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.06.corpus.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.06.corpus.test.ts index 220e9f9273d..357acc49bb7 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.06.corpus.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.06.corpus.test.ts @@ -6,9 +6,8 @@ import * as fs from 'fs'; import * as path from 'path'; import * as process from 'process'; -import { type MongoClient, WriteConcern } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; +import { ClientEncryption, type MongoClient, WriteConcern } from '../../mongodb'; import { getEncryptExtraOptions } from '../../tools/utils'; describe('Client Side Encryption Prose Corpus Test', function () { diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.10.kms_tls.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.10.kms_tls.test.ts index 13547668ca7..c6121eedf32 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.10.kms_tls.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.10.kms_tls.test.ts @@ -2,8 +2,8 @@ import { expect } from 'chai'; import * as process from 'process'; import { satisfies } from 'semver'; -import { ClientEncryption, type MongoClient } from '../../../src'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; +import { ClientEncryption, type MongoClient } from '../../mongodb'; const metadata: MongoDBMetadataUI = { requires: { diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts index 61e7efaf950..2009a787d49 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.12.deadlock.test.ts @@ -4,8 +4,12 @@ import { readFileSync } from 'fs'; import * as path from 'path'; import * as process from 'process'; -import { type CommandStartedEvent, type MongoClient, type MongoClientOptions } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; +import { + ClientEncryption, + type CommandStartedEvent, + type MongoClient, + type MongoClientOptions +} from '../../mongodb'; import { type TestConfiguration } from '../../tools/runner/config'; import { getEncryptExtraOptions } from '../../tools/utils'; import { dropCollection } from '../shared'; diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.14.decryption_events.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.14.decryption_events.test.ts index 4177efaeb08..7f4563ff3aa 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.14.decryption_events.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.14.decryption_events.test.ts @@ -3,12 +3,12 @@ import { expect } from 'chai'; import { Binary, BSON, + ClientEncryption, type CommandFailedEvent, type CommandSucceededEvent, type MongoClient, MongoNetworkError -} from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; +} from '../../mongodb'; import { getEncryptExtraOptions } from '../../tools/utils'; const metadata: MongoDBMetadataUI = { diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.17.on_demand_gcp.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.17.on_demand_gcp.test.ts index fe185a0b360..c319b20b892 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.17.on_demand_gcp.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.17.on_demand_gcp.test.ts @@ -1,9 +1,7 @@ import { expect } from 'chai'; import { env } from 'process'; -import { Binary } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; - +import { Binary, ClientEncryption } from '../../mongodb'; const dataKeyOptions = { masterKey: { projectId: 'devprod-drivers', diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.18.azure_kms_mock_server.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.18.azure_kms_mock_server.test.ts index 604d9e7b3dd..3ceb7679224 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.18.azure_kms_mock_server.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.18.azure_kms_mock_server.test.ts @@ -1,12 +1,11 @@ import { expect } from 'chai'; -import { type Document } from '../../../src'; -import { MongoCryptAzureKMSRequestError } from '../../../src/client-side-encryption/errors'; import { type AzureKMSRequestOptions, - fetchAzureKMSToken -} from '../../../src/client-side-encryption/providers/azure'; - + type Document, + fetchAzureKMSToken, + MongoCryptAzureKMSRequestError +} from '../../mongodb'; const BASE_URL = new URL(`http://127.0.0.1:8080/metadata/identity/oauth2/token`); class KMSRequestOptions implements AzureKMSRequestOptions { url: URL = BASE_URL; diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts index 75db5b3a1b3..2c5492739fc 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.19.on_demand_azure.test.ts @@ -1,10 +1,7 @@ import { expect } from 'chai'; import { env } from 'process'; -import { Binary } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { MongoCryptAzureKMSRequestError } from '../../../src/client-side-encryption/errors'; - +import { Binary, ClientEncryption, MongoCryptAzureKMSRequestError } from '../../mongodb'; const dataKeyOptions = { masterKey: { keyVaultEndpoint: 'https://drivers-2411-keyvault.vault.azure.net/', diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.20.mongocryptd_client.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.20.mongocryptd_client.test.ts index e199f568d63..98bd88a9bdf 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.20.mongocryptd_client.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.20.mongocryptd_client.test.ts @@ -2,8 +2,8 @@ import { expect } from 'chai'; import { once } from 'events'; import { createServer, type Server } from 'net'; -import { type MongoClient } from '../../../src'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; +import { type MongoClient } from '../../mongodb'; import { getEncryptExtraOptions } from '../../tools/utils'; describe('20. Bypass creating mongocryptd client when shared library is loaded', function () { diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.21.automatic_data_encryption_keys.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.21.automatic_data_encryption_keys.test.ts index 4ece8360ab7..b1ff4a6f077 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.21.automatic_data_encryption_keys.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.21.automatic_data_encryption_keys.test.ts @@ -1,14 +1,17 @@ import { expect } from 'chai'; -import { Collection, type Db, MongoServerError } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { MongoCryptCreateEncryptedCollectionError } from '../../../src/client-side-encryption/errors'; import { getCSFLEKMSProviders, kmsCredentialsPresent, missingKeys } from '../../csfle-kms-providers'; - +import { + ClientEncryption, + Collection, + type Db, + MongoCryptCreateEncryptedCollectionError, + MongoServerError +} from '../../mongodb'; const metadata: MongoDBMetadataUI = { requires: { clientSideEncryption: true, diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.22.range_explicit_encryption.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.22.range_explicit_encryption.test.ts index 12b00cce19d..6257039008a 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.22.range_explicit_encryption.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.22.range_explicit_encryption.test.ts @@ -3,11 +3,16 @@ import { expect } from 'chai'; import { readFile } from 'fs/promises'; import { join } from 'path'; -import { Decimal128, type Document, Double, Long, type MongoClient } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { MongoCryptError } from '../../../src/client-side-encryption/errors'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; - +import { + ClientEncryption, + Decimal128, + type Document, + Double, + Long, + type MongoClient, + MongoCryptError +} from '../../mongodb'; const getKmsProviders = () => { const result = getCSFLEKMSProviders(); diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.23.range_encryption_defaults.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.23.range_encryption_defaults.test.ts index 9d1439d54cc..97f81e5e333 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.23.range_encryption_defaults.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.23.range_encryption_defaults.test.ts @@ -1,9 +1,7 @@ import { expect } from 'chai'; -import { type Binary, Int32, Long } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; - +import { type Binary, ClientEncryption, Int32, Long } from '../../mongodb'; const metaData: MongoDBMetadataUI = { requires: { clientSideEncryption: '>=6.1.0', diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.25.lookup.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.25.lookup.test.ts index 4f7883db55b..0c873ee1ccd 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.25.lookup.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.25.lookup.test.ts @@ -3,8 +3,8 @@ import * as path from 'node:path'; import { expect } from 'chai'; -import { BSON, type Document, type MongoClient } from '../../../src'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; +import { BSON, type Document, type MongoClient } from '../../mongodb'; import { type TestConfiguration } from '../../tools/runner/config'; import { getEncryptExtraOptions } from '../../tools/utils'; diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.26.custom_aws_credential_providers.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.26.custom_aws_credential_providers.test.ts index 2a880529486..0a77a06c773 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.26.custom_aws_credential_providers.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.26.custom_aws_credential_providers.test.ts @@ -1,9 +1,7 @@ import { expect } from 'chai'; import * as process from 'process'; -import { Binary, MongoClient } from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { AWSSDKCredentialProvider } from '../../../src/cmap/auth/aws_temporary_credentials'; +import { AWSSDKCredentialProvider, Binary, ClientEncryption, MongoClient } from '../../mongodb'; import { getEncryptExtraOptions } from '../../tools/utils'; const metadata: MongoDBMetadataUI = { diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts index d942fd74242..1159b3360d3 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.27.text_queries.test.ts @@ -4,10 +4,8 @@ import { join } from 'node:path'; import { type Binary, type Document, EJSON } from 'bson'; import { expect } from 'chai'; -import { ClientEncryption, type MongoClient } from '../../../src'; -import { MongoDBCollectionNamespace } from '../../../src/utils'; import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; - +import { ClientEncryption, type MongoClient, MongoDBCollectionNamespace } from '../../mongodb'; const metadata: MongoDBMetadataUI = { requires: { clientSideEncryption: '>=6.4.0', diff --git a/test/integration/client-side-encryption/client_side_encryption.prose.test.ts b/test/integration/client-side-encryption/client_side_encryption.prose.test.ts index a682748a52b..42ed8dcfe07 100644 --- a/test/integration/client-side-encryption/client_side_encryption.prose.test.ts +++ b/test/integration/client-side-encryption/client_side_encryption.prose.test.ts @@ -5,16 +5,16 @@ import * as path from 'path'; import * as process from 'process'; import { satisfies } from 'semver'; +import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; import { + ClientEncryption, + LEGACY_HELLO_COMMAND, MongoClient, MongoCryptError, MongoRuntimeError, MongoServerError, MongoServerSelectionError -} from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; -import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; +} from '../../mongodb'; import { AlpineTestConfiguration } from '../../tools/runner/config'; import { getEncryptExtraOptions } from '../../tools/utils'; import { APMEventCollector, dropCollection } from '../shared'; diff --git a/test/integration/client-side-encryption/driver.test.ts b/test/integration/client-side-encryption/driver.test.ts index 8333f6d9b10..65592e9f371 100644 --- a/test/integration/client-side-encryption/driver.test.ts +++ b/test/integration/client-side-encryption/driver.test.ts @@ -7,21 +7,22 @@ import * as sinon from 'sinon'; import { setTimeout } from 'timers/promises'; import * as tls from 'tls'; +import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; import { BSON, + ClientEncryption, type Collection, type CommandStartedEvent, + Connection, + CSOTTimeoutContext, type MongoClient, MongoCryptCreateDataKeyError, MongoCryptCreateEncryptedCollectionError, - MongoOperationTimeoutError -} from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { StateMachine } from '../../../src/client-side-encryption/state_machine'; -import { Connection } from '../../../src/cmap/connection'; -import { CSOTTimeoutContext, TimeoutContext } from '../../../src/timeout'; -import { resolveTimeoutOptions } from '../../../src/utils'; -import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; + MongoOperationTimeoutError, + resolveTimeoutOptions, + StateMachine, + TimeoutContext +} from '../../mongodb'; import { clearFailPoint, configureFailPoint, diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts index d785e61e2cd..a00601a0f28 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.prose.test.ts @@ -17,9 +17,10 @@ import { MongoClient, MongoOperationTimeoutError, MongoServerSelectionError, - ObjectId -} from '../../../src'; -import { processTimeMS, squashError } from '../../../src/utils'; + ObjectId, + processTimeMS, + squashError +} from '../../mongodb'; import { clearFailPoint, configureFailPoint, diff --git a/test/integration/client-side-operations-timeout/client_side_operations_timeout.unit.test.ts b/test/integration/client-side-operations-timeout/client_side_operations_timeout.unit.test.ts index def0bd88af8..10ecbe36298 100644 --- a/test/integration/client-side-operations-timeout/client_side_operations_timeout.unit.test.ts +++ b/test/integration/client-side-operations-timeout/client_side_operations_timeout.unit.test.ts @@ -10,12 +10,18 @@ import { setTimeout } from 'timers'; import { TLSSocket } from 'tls'; import { promisify } from 'util'; -import { type MongoClient, MongoOperationTimeoutError, ObjectId } from '../../../src'; -import { StateMachine } from '../../../src/client-side-encryption/state_machine'; -import { Connection } from '../../../src/cmap/connection'; -import { ConnectionPool } from '../../../src/cmap/connection_pool'; -import { Topology } from '../../../src/sdam/topology'; -import { CSOTTimeoutContext, Timeout, TimeoutContext } from '../../../src/timeout'; +import { + Connection, + ConnectionPool, + CSOTTimeoutContext, + type MongoClient, + MongoOperationTimeoutError, + ObjectId, + StateMachine, + Timeout, + TimeoutContext, + Topology +} from '../../mongodb'; import { measureDuration, sleep } from '../../tools/utils'; import { createTimerSandbox } from '../../unit/timer_sandbox'; diff --git a/test/integration/client-side-operations-timeout/node_csot.test.ts b/test/integration/client-side-operations-timeout/node_csot.test.ts index 6840a76a496..7aad267083d 100644 --- a/test/integration/client-side-operations-timeout/node_csot.test.ts +++ b/test/integration/client-side-operations-timeout/node_csot.test.ts @@ -17,20 +17,20 @@ import { type CommandFailedEvent, type CommandStartedEvent, type CommandSucceededEvent, + Connection, CursorTimeoutMode, type Db, type FindCursor, GridFSBucket, + LEGACY_HELLO_COMMAND, type MongoClient, MongoInvalidArgumentError, MongoOperationTimeoutError, MongoServerError, ObjectId, + promiseWithResolvers, TopologyType -} from '../../../src'; -import { Connection } from '../../../src/cmap/connection'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; -import { promiseWithResolvers } from '../../../src/utils'; +} from '../../mongodb'; import { type FailCommandFailPoint, type FailPoint, waitUntilPoolsFilled } from '../../tools/utils'; const metadata = { requires: { mongodb: '>=4.4' } }; diff --git a/test/integration/collection-management/collection.test.ts b/test/integration/collection-management/collection.test.ts index cf1e71ac26b..4a4b4b532d0 100644 --- a/test/integration/collection-management/collection.test.ts +++ b/test/integration/collection-management/collection.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { Collection, type Db, type MongoClient, MongoServerError } from '../../../src'; +import { Collection, type Db, type MongoClient, MongoServerError } from '../../mongodb'; import { type TestConfiguration } from '../../tools/runner/config'; import { type FailCommandFailPoint } from '../../tools/utils'; import { setupDatabase } from '../shared'; diff --git a/test/integration/collection-management/collection_db_management.test.ts b/test/integration/collection-management/collection_db_management.test.ts index a53fc90a381..327c7f4113a 100644 --- a/test/integration/collection-management/collection_db_management.test.ts +++ b/test/integration/collection-management/collection_db_management.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { Collection, type Db, type MongoClient, ObjectId } from '../../../src'; +import { Collection, type Db, type MongoClient, ObjectId } from '../../mongodb'; describe('Collection Management and Db Management', function () { let client: MongoClient; diff --git a/test/integration/collection-management/view.test.ts b/test/integration/collection-management/view.test.ts index ec645f38fa3..88b30d03f3e 100644 --- a/test/integration/collection-management/view.test.ts +++ b/test/integration/collection-management/view.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type CollectionInfo, type Db, type MongoClient } from '../../../src'; +import { type CollectionInfo, type Db, type MongoClient } from '../../mongodb'; describe('Views', function () { let client: MongoClient; diff --git a/test/integration/command-logging-and-monitoring/command_logging_and_monitoring.prose.test.ts b/test/integration/command-logging-and-monitoring/command_logging_and_monitoring.prose.test.ts index c55f10c1167..5417a516889 100644 --- a/test/integration/command-logging-and-monitoring/command_logging_and_monitoring.prose.test.ts +++ b/test/integration/command-logging-and-monitoring/command_logging_and_monitoring.prose.test.ts @@ -1,8 +1,6 @@ import { expect } from 'chai'; -import { type Document } from '../../../src'; -import { DEFAULT_MAX_DOCUMENT_LENGTH } from '../../../src/mongo_logger'; - +import { DEFAULT_MAX_DOCUMENT_LENGTH, type Document } from '../../mongodb'; describe('Command Logging and Monitoring Prose Tests', function () { const ELLIPSES_LENGTH = 3; let client; diff --git a/test/integration/command-logging-and-monitoring/command_monitoring.test.ts b/test/integration/command-logging-and-monitoring/command_monitoring.test.ts index e68daa3f428..9242770d46c 100644 --- a/test/integration/command-logging-and-monitoring/command_monitoring.test.ts +++ b/test/integration/command-logging-and-monitoring/command_monitoring.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type MongoClient, ObjectId, ReadPreference } from '../../../src'; +import { type MongoClient, ObjectId, ReadPreference } from '../../mongodb'; import { filterForCommands, setupDatabase } from '../shared'; describe('Command Monitoring', function () { diff --git a/test/integration/connection-monitoring-and-pooling/connection.test.ts b/test/integration/connection-monitoring-and-pooling/connection.test.ts index b6aaf759691..0a1dc572bc1 100644 --- a/test/integration/connection-monitoring-and-pooling/connection.test.ts +++ b/test/integration/connection-monitoring-and-pooling/connection.test.ts @@ -7,20 +7,21 @@ import * as sinon from 'sinon'; import { Binary, + connect, + Connection, type ConnectionOptions, + HostAddress, + LEGACY_HELLO_COMMAND, + makeClientMetadata, MongoClient, MongoClientAuthProviders, type MongoClientOptions, + MongoDBResponse, MongoServerError, - ServerHeartbeatStartedEvent -} from '../../../src'; -import { connect } from '../../../src/cmap/connect'; -import { Connection } from '../../../src/cmap/connection'; -import { makeClientMetadata } from '../../../src/cmap/handshake/client_metadata'; -import { MongoDBResponse } from '../../../src/cmap/wire_protocol/responses'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; -import { Topology } from '../../../src/sdam/topology'; -import { HostAddress, ns } from '../../../src/utils'; + ns, + ServerHeartbeatStartedEvent, + Topology +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import { processTick, runtime, sleep } from '../../tools/utils'; import { assert as test, setupDatabase } from '../shared'; diff --git a/test/integration/connection-monitoring-and-pooling/connection_pool.test.ts b/test/integration/connection-monitoring-and-pooling/connection_pool.test.ts index d478b2bac1e..d073b5a1125 100644 --- a/test/integration/connection-monitoring-and-pooling/connection_pool.test.ts +++ b/test/integration/connection-monitoring-and-pooling/connection_pool.test.ts @@ -8,7 +8,7 @@ import { type Db, type MongoClient, type Server -} from '../../../src'; +} from '../../mongodb'; import { clearFailPoint, configureFailPoint, sleep } from '../../tools/utils'; describe('Connection Pool', function () { diff --git a/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts b/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts index 471a6cddf54..5b659290ef6 100644 --- a/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts +++ b/test/integration/connection-monitoring-and-pooling/rtt_pinger.test.ts @@ -2,8 +2,12 @@ import { expect } from 'chai'; import * as semver from 'semver'; import * as sinon from 'sinon'; -import { type Connection, type MongoClient, type RTTPinger } from '../../../src'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; +import { + type Connection, + LEGACY_HELLO_COMMAND, + type MongoClient, + type RTTPinger +} from '../../mongodb'; import { sleep } from '../../tools/utils'; /** diff --git a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts index 2ab148e810a..3ba24d95870 100644 --- a/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts +++ b/test/integration/connections-survive-step-down/connections_survive_step_down.prose.test.ts @@ -5,10 +5,10 @@ import { type ConnectionPoolClearedEvent, type FindCursor, type MongoClient, + MONGODB_ERROR_CODES, MongoServerError, ReadPreference -} from '../../../src'; -import { MONGODB_ERROR_CODES } from '../../../src/error'; +} from '../../mongodb'; import { type FailCommandFailPoint } from '../../tools/utils'; describe('Connections Survive Primary Step Down - prose', function () { diff --git a/test/integration/crud/abstract_operation.test.ts b/test/integration/crud/abstract_operation.test.ts index b28692d7b7b..777e2a38fce 100644 --- a/test/integration/crud/abstract_operation.test.ts +++ b/test/integration/crud/abstract_operation.test.ts @@ -3,58 +3,52 @@ import { expect } from 'chai'; import { type AbstractOperation, type Admin, + AggregateOperation, type Collection, + CountOperation, + CreateCollectionOperation, + CreateIndexesOperation, + CreateSearchIndexesOperation, type Db, - Long, - type MongoClient, - type Server -} from '../../../src'; -import { AggregateOperation } from '../../../src/operations/aggregate'; -import { CountOperation } from '../../../src/operations/count'; -import { CreateCollectionOperation } from '../../../src/operations/create_collection'; -import { + DbStatsOperation, DeleteManyOperation, DeleteOneOperation, - DeleteOperation -} from '../../../src/operations/delete'; -import { DistinctOperation } from '../../../src/operations/distinct'; -import { DropCollectionOperation, DropDatabaseOperation } from '../../../src/operations/drop'; -import { EstimatedDocumentCountOperation } from '../../../src/operations/estimated_document_count'; -import { FindOperation } from '../../../src/operations/find'; -import { + DeleteOperation, + DistinctOperation, + DropCollectionOperation, + DropDatabaseOperation, + DropIndexOperation, + DropSearchIndexOperation, + EstimatedDocumentCountOperation, FindAndModifyOperation, FindOneAndDeleteOperation, FindOneAndReplaceOperation, - FindOneAndUpdateOperation -} from '../../../src/operations/find_and_modify'; -import { GetMoreOperation } from '../../../src/operations/get_more'; -import { - CreateIndexesOperation, - DropIndexOperation, - ListIndexesOperation -} from '../../../src/operations/indexes'; -import { InsertOneOperation, InsertOperation } from '../../../src/operations/insert'; -import { KillCursorsOperation } from '../../../src/operations/kill_cursors'; -import { ListCollectionsOperation } from '../../../src/operations/list_collections'; -import { ListDatabasesOperation } from '../../../src/operations/list_databases'; -import { ProfilingLevelOperation } from '../../../src/operations/profiling_level'; -import { RemoveUserOperation } from '../../../src/operations/remove_user'; -import { RenameOperation } from '../../../src/operations/rename'; -import { RunCommandOperation } from '../../../src/operations/run_command'; -import { CreateSearchIndexesOperation } from '../../../src/operations/search_indexes/create'; -import { DropSearchIndexOperation } from '../../../src/operations/search_indexes/drop'; -import { UpdateSearchIndexOperation } from '../../../src/operations/search_indexes/update'; -import { SetProfilingLevelOperation } from '../../../src/operations/set_profiling_level'; -import { DbStatsOperation } from '../../../src/operations/stats'; -import { + FindOneAndUpdateOperation, + FindOperation, + GetMoreOperation, + InsertOneOperation, + InsertOperation, + KillCursorsOperation, + ListCollectionsOperation, + ListDatabasesOperation, + ListIndexesOperation, + Long, + type MongoClient, + MongoDBNamespace, + ProfilingLevelOperation, + RemoveUserOperation, + RenameOperation, ReplaceOneOperation, + RunCommandOperation, + type Server, + SetProfilingLevelOperation, + TimeoutContext, UpdateManyOperation, UpdateOneOperation, - UpdateOperation -} from '../../../src/operations/update'; -import { ValidateCollectionOperation } from '../../../src/operations/validate_collection'; -import { TimeoutContext } from '../../../src/timeout'; -import { MongoDBNamespace } from '../../../src/utils'; + UpdateOperation, + UpdateSearchIndexOperation, + ValidateCollectionOperation +} from '../../mongodb'; describe('abstract operation', function () { describe('command name getter', function () { diff --git a/test/integration/crud/aggregation.test.ts b/test/integration/crud/aggregation.test.ts index 017fd1bdba4..915d9c9de3c 100644 --- a/test/integration/crud/aggregation.test.ts +++ b/test/integration/crud/aggregation.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { MongoInvalidArgumentError, MongoServerError } from '../../../src/error'; -import { type MongoClient } from '../../../src/mongo_client'; +import { type MongoClient, MongoInvalidArgumentError, MongoServerError } from '../../mongodb'; import { filterForCommands } from '../shared'; describe('Aggregation', function () { diff --git a/test/integration/crud/bulk.test.ts b/test/integration/crud/bulk.test.ts index 054011ee1d3..0f8ae3ae60f 100644 --- a/test/integration/crud/bulk.test.ts +++ b/test/integration/crud/bulk.test.ts @@ -11,7 +11,7 @@ import { type MongoClient, MongoDriverError, MongoInvalidArgumentError -} from '../../../src'; +} from '../../mongodb'; import { assert as test } from '../shared'; const MAX_BSON_SIZE = 16777216; @@ -863,7 +863,7 @@ describe('Bulk', function () { try { batch.insert({ string: hugeString }); test.ok(false); - } catch (err) {} // eslint-disable-line + } catch (err) { } // eslint-disable-line } }); diff --git a/test/integration/crud/client_bulk_write.test.ts b/test/integration/crud/client_bulk_write.test.ts index 99e815242c8..acb05b2e013 100644 --- a/test/integration/crud/client_bulk_write.test.ts +++ b/test/integration/crud/client_bulk_write.test.ts @@ -6,10 +6,10 @@ import { type Connection, type ConnectionPool, type MongoClient, - MongoOperationTimeoutError -} from '../../../src'; -import { TimeoutContext } from '../../../src/timeout'; -import { processTimeMS } from '../../../src/utils'; + MongoOperationTimeoutError, + processTimeMS, + TimeoutContext +} from '../../mongodb'; import { clearFailPoint, configureFailPoint, diff --git a/test/integration/crud/crud.prose.test.ts b/test/integration/crud/crud.prose.test.ts index 67241f58031..302abeb2473 100644 --- a/test/integration/crud/crud.prose.test.ts +++ b/test/integration/crud/crud.prose.test.ts @@ -12,7 +12,7 @@ import { MongoClientBulkWriteError, MongoInvalidArgumentError, MongoServerError -} from '../../../src'; +} from '../../mongodb'; import { getEncryptExtraOptions } from '../../tools/utils'; import { filterForCommands } from '../shared'; diff --git a/test/integration/crud/crud_api.test.ts b/test/integration/crud/crud_api.test.ts index cedea9d867f..6ec29becc47 100644 --- a/test/integration/crud/crud_api.test.ts +++ b/test/integration/crud/crud_api.test.ts @@ -14,7 +14,7 @@ import { MongoServerError, ObjectId, ReturnDocument -} from '../../../src'; +} from '../../mongodb'; import { type FailCommandFailPoint } from '../../tools/utils'; import { assert as test } from '../shared'; diff --git a/test/integration/crud/document_validation.test.ts b/test/integration/crud/document_validation.test.ts index ce6ac49522a..4ef0f8e9468 100644 --- a/test/integration/crud/document_validation.test.ts +++ b/test/integration/crud/document_validation.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { MongoBulkWriteError, type MongoClient, MongoServerError } from '../../../src'; +import { MongoBulkWriteError, type MongoClient, MongoServerError } from '../../mongodb'; import { setupDatabase } from '../shared'; describe('Document Validation', function () { diff --git a/test/integration/crud/explain.test.ts b/test/integration/crud/explain.test.ts index bc6783d04a4..8236cbf00ee 100644 --- a/test/integration/crud/explain.test.ts +++ b/test/integration/crud/explain.test.ts @@ -9,7 +9,7 @@ import { type MongoClient, MongoOperationTimeoutError, MongoServerError -} from '../../../src'; +} from '../../mongodb'; import { clearFailPoint, configureFailPoint, measureDuration } from '../../tools/utils'; import { filterForCommands } from '../shared'; diff --git a/test/integration/crud/find.test.ts b/test/integration/crud/find.test.ts index 80e7f68d142..bb6fc2146e4 100644 --- a/test/integration/crud/find.test.ts +++ b/test/integration/crud/find.test.ts @@ -3,13 +3,13 @@ import * as sinon from 'sinon'; import { Code, + CursorResponse, Long, type MongoClient, MongoServerError, ObjectId, ReturnDocument -} from '../../../src'; -import { CursorResponse } from '../../../src/cmap/wire_protocol/responses'; +} from '../../mongodb'; import { assert as test, filterForCommands } from '../shared'; describe('Find', function () { diff --git a/test/integration/crud/find_and_modify.test.ts b/test/integration/crud/find_and_modify.test.ts index 85e1026b5dd..524ad7b06a5 100644 --- a/test/integration/crud/find_and_modify.test.ts +++ b/test/integration/crud/find_and_modify.test.ts @@ -6,7 +6,7 @@ import { type MongoClient, MongoServerError, ObjectId -} from '../../../src'; +} from '../../mongodb'; import { setupDatabase } from '../shared'; describe('Collection (#findOneAnd...)', function () { diff --git a/test/integration/crud/find_cursor_methods.test.ts b/test/integration/crud/find_cursor_methods.test.ts index 9a9c2569a55..fd2b66f679d 100644 --- a/test/integration/crud/find_cursor_methods.test.ts +++ b/test/integration/crud/find_cursor_methods.test.ts @@ -2,14 +2,14 @@ import { expect } from 'chai'; import { type Collection, + CursorTimeoutContext, type FindCursor, MongoAPIError, type MongoClient, - MongoCursorExhaustedError -} from '../../../src'; -import { CursorTimeoutContext } from '../../../src/cursor/abstract_cursor'; -import { TimeoutContext } from '../../../src/timeout'; -import { promiseWithResolvers } from '../../../src/utils'; + MongoCursorExhaustedError, + promiseWithResolvers, + TimeoutContext +} from '../../mongodb'; import { filterForCommands } from '../shared'; describe('Find Cursor', function () { diff --git a/test/integration/crud/insert.test.ts b/test/integration/crud/insert.test.ts index 88e0bc50649..b649d6a5b5c 100644 --- a/test/integration/crud/insert.test.ts +++ b/test/integration/crud/insert.test.ts @@ -19,11 +19,11 @@ import { type MongoClient, MongoInvalidArgumentError, MongoServerError, + noop, ObjectId, ReturnDocument, Timestamp -} from '../../../src'; -import { noop } from '../../../src/utils'; +} from '../../mongodb'; import { assert as test, setupDatabase } from '../shared'; describe('crud - insert', function () { diff --git a/test/integration/crud/maxTimeMS.test.ts b/test/integration/crud/maxTimeMS.test.ts index 62052b544cf..f4d83ddc2f3 100644 --- a/test/integration/crud/maxTimeMS.test.ts +++ b/test/integration/crud/maxTimeMS.test.ts @@ -8,7 +8,7 @@ import { type MongoClient, MongoCursorExhaustedError, MongoServerError -} from '../../../src'; +} from '../../mongodb'; describe('MaxTimeMS', function () { let client: MongoClient; diff --git a/test/integration/crud/misc_cursors.test.ts b/test/integration/crud/misc_cursors.test.ts index d1543b8755e..70a8ccf196d 100644 --- a/test/integration/crud/misc_cursors.test.ts +++ b/test/integration/crud/misc_cursors.test.ts @@ -1,11 +1,13 @@ import { expect } from 'chai'; import { once } from 'events'; -import { MongoClientClosedError } from '../../../src/error'; -import { type MongoClient } from '../../../src/mongo_client'; -import { ReadPreference } from '../../../src/read_preference'; -import { ServerType } from '../../../src/sdam/common'; -import { formatSort } from '../../../src/sort'; +import { + formatSort, + type MongoClient, + MongoClientClosedError, + ReadPreference, + ServerType +} from '../../mongodb'; import { runLater, sleep } from '../../tools/utils'; import { assert as test, filterForCommands, setupDatabase } from '../shared'; diff --git a/test/integration/crud/remove.test.ts b/test/integration/crud/remove.test.ts index 91d99f5dae6..6e5ea8b41d2 100644 --- a/test/integration/crud/remove.test.ts +++ b/test/integration/crud/remove.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type MongoClient } from '../../../src'; +import { type MongoClient } from '../../mongodb'; describe('Remove', function () { let client: MongoClient; diff --git a/test/integration/crud/server_errors.test.ts b/test/integration/crud/server_errors.test.ts index 3414dd14674..b3f0191e072 100644 --- a/test/integration/crud/server_errors.test.ts +++ b/test/integration/crud/server_errors.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type MongoClient, MongoServerError } from '../../../src'; +import { type MongoClient, MongoServerError } from '../../mongodb'; import { setupDatabase } from '../shared'; describe('Errors', function () { diff --git a/test/integration/crud/stats.test.ts b/test/integration/crud/stats.test.ts index 0a521c00e81..aadb9dedac3 100644 --- a/test/integration/crud/stats.test.ts +++ b/test/integration/crud/stats.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type MongoClient } from '../../../src'; +import { type MongoClient } from '../../mongodb'; describe('stats', function () { let client: MongoClient; diff --git a/test/integration/crud/unicode.test.ts b/test/integration/crud/unicode.test.ts index ac86eb8fabd..8d4e898f2ab 100644 --- a/test/integration/crud/unicode.test.ts +++ b/test/integration/crud/unicode.test.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import * as process from 'process'; import { satisfies } from 'semver'; -import type { MongoClient } from '../../../src'; +import type { MongoClient } from '../../mongodb'; import { assert as test, setupDatabase } from '../shared'; describe('Unicode', function () { diff --git a/test/integration/enumerate_databases.prose.test.ts b/test/integration/enumerate_databases.prose.test.ts index 4d3bad1e649..9528d68fada 100644 --- a/test/integration/enumerate_databases.prose.test.ts +++ b/test/integration/enumerate_databases.prose.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import type { MongoClient } from '../../src'; +import type { MongoClient } from '../mongodb'; const REQUIRED_DBS = ['admin', 'local', 'config']; const DB_NAME = 'listDatabasesTest'; diff --git a/test/integration/enumerate_databases.test.ts b/test/integration/enumerate_databases.test.ts index 37bc84fe65e..0b52ade1303 100644 --- a/test/integration/enumerate_databases.test.ts +++ b/test/integration/enumerate_databases.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { once } from 'events'; -import { type MongoClient, MongoServerError } from '../../src'; +import { type MongoClient, MongoServerError } from '../mongodb'; import { TestBuilder, UnifiedTestSuiteBuilder } from '../tools/unified_suite_builder'; const metadata: MongoDBMetadataUI = { diff --git a/test/integration/gridfs/gridfs.test.ts b/test/integration/gridfs/gridfs.test.ts index 2883b863947..20ac793e809 100644 --- a/test/integration/gridfs/gridfs.test.ts +++ b/test/integration/gridfs/gridfs.test.ts @@ -8,7 +8,7 @@ import { GridFSBucket, type MongoClient, ObjectId -} from '../../../src'; +} from '../../mongodb'; import { sleep } from '../../tools/utils'; describe('GridFS', () => { diff --git a/test/integration/gridfs/gridfs_stream.test.ts b/test/integration/gridfs/gridfs_stream.test.ts index be047aec4eb..df34a239a68 100644 --- a/test/integration/gridfs/gridfs_stream.test.ts +++ b/test/integration/gridfs/gridfs_stream.test.ts @@ -7,7 +7,7 @@ import { promisify } from 'node:util'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { type Db, GridFSBucket, MongoAPIError, type MongoClient, ObjectId } from '../../../src'; +import { type Db, GridFSBucket, MongoAPIError, type MongoClient, ObjectId } from '../../mongodb'; describe('GridFS Stream', function () { let client: MongoClient; diff --git a/test/integration/index-management/search-index-management.test.ts b/test/integration/index-management/search-index-management.test.ts index f8e98fae91b..39d17f22818 100644 --- a/test/integration/index-management/search-index-management.test.ts +++ b/test/integration/index-management/search-index-management.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type Collection, type CommandStartedEvent, type MongoClient } from '../../../src'; +import { type Collection, type CommandStartedEvent, type MongoClient } from '../../mongodb'; describe('Search Index Management Integration Tests', function () { describe('read concern and write concern ', function () { diff --git a/test/integration/index_management.test.ts b/test/integration/index_management.test.ts index c46abc7f8e2..d824dea7d76 100644 --- a/test/integration/index_management.test.ts +++ b/test/integration/index_management.test.ts @@ -7,7 +7,7 @@ import { type Db, type MongoClient, MongoServerError -} from '../../src'; +} from '../mongodb'; import { type FailCommandFailPoint } from '../tools/utils'; import { assert as test, filterForCommands, setupDatabase } from './shared'; diff --git a/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts b/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts index 15ad016cc3d..a27172c5741 100644 --- a/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts +++ b/test/integration/initial-dns-seedlist-discovery/dns_seedlist.test.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import * as dns from 'dns'; import * as sinon from 'sinon'; -import { MongoClient } from '../../../src'; +import { MongoClient } from '../../mongodb'; const metadata: MongoDBMetadataUI = { requires: { topology: '!single', tls: 'disabled' } }; diff --git a/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.prose.test.ts b/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.prose.test.ts index c36e675ae58..3f931c019c6 100644 --- a/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.prose.test.ts +++ b/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.prose.test.ts @@ -2,11 +2,7 @@ import { expect } from 'chai'; import * as dns from 'dns'; import * as sinon from 'sinon'; -import { ConnectionPool } from '../../../src/cmap/connection_pool'; -import { MongoAPIError } from '../../../src/error'; -import { Server } from '../../../src/sdam/server'; -import { ServerDescription } from '../../../src/sdam/server_description'; -import { Topology } from '../../../src/sdam/topology'; +import { ConnectionPool, MongoAPIError, Server, ServerDescription, Topology } from '../../mongodb'; import { topologyWithPlaceholderClient } from '../../tools/utils'; describe('Initial DNS Seedlist Discovery (Prose Tests)', () => { diff --git a/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.spec.test.ts b/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.spec.test.ts index a0136c331ec..141c5d6fe58 100644 --- a/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.spec.test.ts +++ b/test/integration/initial-dns-seedlist-discovery/initial_dns_seedlist_discovery.spec.test.ts @@ -4,7 +4,7 @@ import * as fs from 'fs'; import * as path from 'path'; import { promisify } from 'util'; -import { HostAddress, MongoClient } from '../../../src'; +import { HostAddress, MongoClient } from '../../mongodb'; function makeTest(test, topology) { let client; diff --git a/test/integration/max-staleness/max_staleness.test.js b/test/integration/max-staleness/max_staleness.test.js index 867bdc92fed..b555eb16ce0 100644 --- a/test/integration/max-staleness/max_staleness.test.js +++ b/test/integration/max-staleness/max_staleness.test.js @@ -2,8 +2,8 @@ const { Long } = require('bson'); const { expect } = require('chai'); const mock = require('../../tools/mongodb-mock/index'); -const { ReadPreference } = require('../../../src'); -const { isHello } = require('../../../src/utils'); +const { ReadPreference } = require('../../mongodb'); +const { isHello } = require('../../mongodb'); const test = {}; // TODO (NODE-3799): convert these to run against a real server diff --git a/test/integration/mongodb-handshake/mongodb-handshake.prose.test.ts b/test/integration/mongodb-handshake/mongodb-handshake.prose.test.ts index 219ef6f70e7..6b9dad60995 100644 --- a/test/integration/mongodb-handshake/mongodb-handshake.prose.test.ts +++ b/test/integration/mongodb-handshake/mongodb-handshake.prose.test.ts @@ -2,10 +2,16 @@ import { expect } from 'chai'; import * as process from 'process'; import * as sinon from 'sinon'; -import { type ClientMetadata, type DriverInfo, Int32, type MongoClient } from '../../../src'; -import { Connection } from '../../../src/cmap/connection'; -import { getFAASEnv, isDriverInfoEqual } from '../../../src/cmap/handshake/client_metadata'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; +import { + type ClientMetadata, + Connection, + type DriverInfo, + getFAASEnv, + Int32, + isDriverInfoEqual, + LEGACY_HELLO_COMMAND, + type MongoClient +} from '../../mongodb'; import { sleep } from '../../tools/utils'; type EnvironmentVariables = Array<[string, string]>; diff --git a/test/integration/mongodb-handshake/mongodb-handshake.test.ts b/test/integration/mongodb-handshake/mongodb-handshake.test.ts index 92b538a5f66..528fb0d1c43 100644 --- a/test/integration/mongodb-handshake/mongodb-handshake.test.ts +++ b/test/integration/mongodb-handshake/mongodb-handshake.test.ts @@ -1,13 +1,15 @@ import { expect } from 'chai'; -import type Sinon from 'sinon'; -// eslint-disable-next-line no-duplicate-imports import * as sinon from 'sinon'; -import { MongoServerError, MongoServerSelectionError, ServerApiVersion } from '../../../src'; -import { OpMsgRequest, OpQueryRequest } from '../../../src/cmap/commands'; -import { Connection } from '../../../src/cmap/connection'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; - +import { + Connection, + LEGACY_HELLO_COMMAND, + MongoServerError, + MongoServerSelectionError, + OpMsgRequest, + OpQueryRequest, + ServerApiVersion +} from '../../mongodb'; describe('MongoDB Handshake', () => { let client; diff --git a/test/integration/node-specific/abort_signal.test.ts b/test/integration/node-specific/abort_signal.test.ts index db26f80ecc1..6cec61ec391 100644 --- a/test/integration/node-specific/abort_signal.test.ts +++ b/test/integration/node-specific/abort_signal.test.ts @@ -10,18 +10,19 @@ import { AggregationCursor, Code, type Collection, + Connection, + ConnectionPool, type Db, FindCursor, ListCollectionsCursor, type Log, type MongoClient, MongoServerError, - ReadPreference -} from '../../../src'; -import { StateMachine } from '../../../src/client-side-encryption/state_machine'; -import { Connection } from '../../../src/cmap/connection'; -import { ConnectionPool } from '../../../src/cmap/connection_pool'; -import { promiseWithResolvers, setDifference } from '../../../src/utils'; + promiseWithResolvers, + ReadPreference, + setDifference, + StateMachine +} from '../../mongodb'; import { clearFailPoint, configureFailPoint, diff --git a/test/integration/node-specific/abstract_cursor.test.ts b/test/integration/node-specific/abstract_cursor.test.ts index 7a5e7151f23..3a39cfe03e5 100644 --- a/test/integration/node-specific/abstract_cursor.test.ts +++ b/test/integration/node-specific/abstract_cursor.test.ts @@ -7,15 +7,16 @@ import { AbstractCursor, type Collection, type CommandStartedEvent, + CSOTTimeoutContext, + CursorTimeoutContext, CursorTimeoutMode, type FindCursor, MongoAPIError, type MongoClient, MongoCursorExhaustedError, - MongoOperationTimeoutError -} from '../../../src'; -import { CursorTimeoutContext } from '../../../src/cursor/abstract_cursor'; -import { CSOTTimeoutContext, TimeoutContext } from '../../../src/timeout'; + MongoOperationTimeoutError, + TimeoutContext +} from '../../mongodb'; import { clearFailPoint, configureFailPoint } from '../../tools/utils'; import { filterForCommands } from '../shared'; diff --git a/test/integration/node-specific/async_dispose.test.ts b/test/integration/node-specific/async_dispose.test.ts index dfd6ad6a89e..729b665455f 100644 --- a/test/integration/node-specific/async_dispose.test.ts +++ b/test/integration/node-specific/async_dispose.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { type MongoClient } from '../../../src'; +import { type MongoClient } from '../../mongodb'; describe('Symbol.asyncDispose implementation tests', function () { let client: MongoClient; diff --git a/test/integration/node-specific/auto_connect.test.ts b/test/integration/node-specific/auto_connect.test.ts index 42bf6ba947c..f0850049632 100644 --- a/test/integration/node-specific/auto_connect.test.ts +++ b/test/integration/node-specific/auto_connect.test.ts @@ -10,9 +10,9 @@ import { MongoClient, MongoNotConnectedError, ProfilingLevel, + Topology, TopologyType -} from '../../../src'; -import { Topology } from '../../../src/sdam/topology'; +} from '../../mongodb'; import { sleep } from '../../tools/utils'; describe('When executing an operation for the first time', () => { diff --git a/test/integration/node-specific/auto_encrypter.test.ts b/test/integration/node-specific/auto_encrypter.test.ts index 3e80ad5fb0c..1f29951e1ba 100644 --- a/test/integration/node-specific/auto_encrypter.test.ts +++ b/test/integration/node-specific/auto_encrypter.test.ts @@ -7,10 +7,9 @@ import { type MongoClient, MongoNetworkTimeoutError, MongoRuntimeError, + StateMachine, type UUID -} from '../../../src'; -import { StateMachine } from '../../../src/client-side-encryption/state_machine'; - +} from '../../mongodb'; describe('mongocryptd auto spawn', function () { let client: MongoClient; const kmsProviders: KMSProviders = { diff --git a/test/integration/node-specific/bson-options/bsonRegExp.test.ts b/test/integration/node-specific/bson-options/bsonRegExp.test.ts index 452e0a60456..d1c06f538c4 100644 --- a/test/integration/node-specific/bson-options/bsonRegExp.test.ts +++ b/test/integration/node-specific/bson-options/bsonRegExp.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { BSONRegExp, type MongoClient } from '../../../../src'; +import { BSONRegExp, type MongoClient } from '../../../mongodb'; describe('BSONRegExp', () => { describe('bsonRegExp option', () => { diff --git a/test/integration/node-specific/bson-options/ignore_undefined.test.ts b/test/integration/node-specific/bson-options/ignore_undefined.test.ts index 5b7593a1644..0cbcf43b9c5 100644 --- a/test/integration/node-specific/bson-options/ignore_undefined.test.ts +++ b/test/integration/node-specific/bson-options/ignore_undefined.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type MongoClient, ObjectId } from '../../../../src'; +import { type MongoClient, ObjectId } from '../../../mongodb'; import { assert as test, setupDatabase } from '../../shared'; describe('Ignore Undefined', function () { diff --git a/test/integration/node-specific/bson-options/promote_values.test.ts b/test/integration/node-specific/bson-options/promote_values.test.ts index a114c395955..6be7e9960c4 100644 --- a/test/integration/node-specific/bson-options/promote_values.test.ts +++ b/test/integration/node-specific/bson-options/promote_values.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { Double, Int32, Long } from '../../../../src'; +import { Double, Int32, Long } from '../../../mongodb'; import { assert as test, setupDatabase } from '../../shared'; describe('Promote Values', function () { diff --git a/test/integration/node-specific/bson-options/raw.test.ts b/test/integration/node-specific/bson-options/raw.test.ts index 33ace0b1d6e..455344f9a92 100644 --- a/test/integration/node-specific/bson-options/raw.test.ts +++ b/test/integration/node-specific/bson-options/raw.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type Collection, type MongoClient, ObjectId } from '../../../../src'; +import { type Collection, type MongoClient, ObjectId } from '../../../mongodb'; describe('raw bson support', () => { describe('raw', () => { diff --git a/test/integration/node-specific/bson-options/use_bigint_64.test.ts b/test/integration/node-specific/bson-options/use_bigint_64.test.ts index d0c981f0af2..8adec9807d3 100644 --- a/test/integration/node-specific/bson-options/use_bigint_64.test.ts +++ b/test/integration/node-specific/bson-options/use_bigint_64.test.ts @@ -1,14 +1,15 @@ import { expect } from 'chai'; import { + BSONError, type Collection, type Db, + type Document, + Long, MongoAPIError, type MongoClient, type WithId -} from '../../../../src'; -import { BSONError, type Document, Long } from '../../../../src/bson'; - +} from '../../../mongodb'; describe('useBigInt64 option', function () { let client: MongoClient; let db: Db; diff --git a/test/integration/node-specific/bson-options/utf8_validation.test.ts b/test/integration/node-specific/bson-options/utf8_validation.test.ts index b5e0b751b27..e9920834bd0 100644 --- a/test/integration/node-specific/bson-options/utf8_validation.test.ts +++ b/test/integration/node-specific/bson-options/utf8_validation.test.ts @@ -3,10 +3,14 @@ import * as net from 'net'; import * as process from 'process'; import * as sinon from 'sinon'; -import { type Collection, type MongoClient, MongoServerError } from '../../../../src'; -import { BSONError, deserialize } from '../../../../src/bson'; -import { OpMsgResponse } from '../../../../src/cmap/commands'; - +import { + BSONError, + type Collection, + deserialize, + type MongoClient, + MongoServerError, + OpMsgResponse +} from '../../../mongodb'; describe('class MongoDBResponse', () => { let client; diff --git a/test/integration/node-specific/client_close.test.ts b/test/integration/node-specific/client_close.test.ts index 74f380e9386..98053aa0afb 100644 --- a/test/integration/node-specific/client_close.test.ts +++ b/test/integration/node-specific/client_close.test.ts @@ -3,13 +3,13 @@ import * as events from 'node:events'; import { expect } from 'chai'; import * as process from 'process'; +import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; import { type Collection, type CommandStartedEvent, type FindCursor, type MongoClient -} from '../../../src'; -import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; +} from '../../mongodb'; import { configureMongocryptdSpawnHooks } from '../../tools/utils'; import { filterForCommands } from '../shared'; import { runScriptAndGetProcessInfo } from './resource_tracking_script_builder'; diff --git a/test/integration/node-specific/client_encryption.test.ts b/test/integration/node-specific/client_encryption.test.ts index fb9743198b0..033b27e08f9 100644 --- a/test/integration/node-specific/client_encryption.test.ts +++ b/test/integration/node-specific/client_encryption.test.ts @@ -4,20 +4,17 @@ import * as sinon from 'sinon'; import { Binary, + ClientEncryption, type Collection, + type DataKey, Int32, Long, type MongoClient, MongoCryptError, + MongoCryptInvalidArgumentError, + StateMachine, UUID -} from '../../../src'; -import { - ClientEncryption, - type DataKey -} from '../../../src/client-side-encryption/client_encryption'; -import { MongoCryptInvalidArgumentError } from '../../../src/client-side-encryption/errors'; -import { StateMachine } from '../../../src/client-side-encryption/state_machine'; - +} from '../../mongodb'; function readHttpResponse(path) { let data = readFileSync(path, 'utf8').toString(); data = data.split('\n').join('\r\n'); diff --git a/test/integration/node-specific/comment_with_falsy_values.test.ts b/test/integration/node-specific/comment_with_falsy_values.test.ts index 6be4ba54965..6d0819fd33b 100644 --- a/test/integration/node-specific/comment_with_falsy_values.test.ts +++ b/test/integration/node-specific/comment_with_falsy_values.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type Collection, type CommandStartedEvent, Long, type MongoClient } from '../../../src'; +import { type Collection, type CommandStartedEvent, Long, type MongoClient } from '../../mongodb'; import { TestBuilder, UnifiedTestSuiteBuilder } from '../../tools/unified_suite_builder'; const falsyValues = [0, false, '', Long.ZERO, null, NaN] as const; diff --git a/test/integration/node-specific/convert_socket_errors.test.ts b/test/integration/node-specific/convert_socket_errors.test.ts index 6e9c38d5ae3..e13a2167119 100644 --- a/test/integration/node-specific/convert_socket_errors.test.ts +++ b/test/integration/node-specific/convert_socket_errors.test.ts @@ -3,9 +3,14 @@ import { Duplex } from 'node:stream'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { type Collection, type Document, type MongoClient, MongoNetworkError } from '../../../src'; -import { Connection } from '../../../src/cmap/connection'; -import { ns } from '../../../src/utils'; +import { + type Collection, + Connection, + type Document, + type MongoClient, + MongoNetworkError, + ns +} from '../../mongodb'; import { clearFailPoint, configureFailPoint } from '../../tools/utils'; import { filterForCommands } from '../shared'; diff --git a/test/integration/node-specific/crypt_shared_lib.test.ts b/test/integration/node-specific/crypt_shared_lib.test.ts index 8d78c00be1e..5020e8579dd 100644 --- a/test/integration/node-specific/crypt_shared_lib.test.ts +++ b/test/integration/node-specific/crypt_shared_lib.test.ts @@ -3,7 +3,7 @@ import { spawnSync } from 'child_process'; import { dirname } from 'path'; import * as process from 'process'; -import { EJSON } from '../../../src/bson'; +import { EJSON } from '../../mongodb'; import { getEncryptExtraOptions } from '../../tools/utils'; describe('crypt shared library', () => { diff --git a/test/integration/node-specific/cursor_stream.test.ts b/test/integration/node-specific/cursor_stream.test.ts index 103196e0dc8..4181b1c0258 100644 --- a/test/integration/node-specific/cursor_stream.test.ts +++ b/test/integration/node-specific/cursor_stream.test.ts @@ -4,7 +4,13 @@ import { on, once } from 'node:events'; import { expect } from 'chai'; import * as process from 'process'; -import { Binary, type Collection, type Db, type MongoClient, MongoServerError } from '../../../src'; +import { + Binary, + type Collection, + type Db, + type MongoClient, + MongoServerError +} from '../../mongodb'; import { sleep } from '../../tools/utils'; describe('Cursor Streams', function () { diff --git a/test/integration/node-specific/db.test.ts b/test/integration/node-specific/db.test.ts index 206d32c5163..6b8541667ed 100644 --- a/test/integration/node-specific/db.test.ts +++ b/test/integration/node-specific/db.test.ts @@ -6,7 +6,7 @@ import { MongoClient, MongoInvalidArgumentError, MongoServerError -} from '../../../src'; +} from '../../mongodb'; import { setupDatabase } from '../shared'; describe('Db', function () { diff --git a/test/integration/node-specific/errors.test.ts b/test/integration/node-specific/errors.test.ts index 83edcff62dd..ff00db65647 100644 --- a/test/integration/node-specific/errors.test.ts +++ b/test/integration/node-specific/errors.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { MongoClient, MongoServerSelectionError, ReadPreference } from '../../../src'; +import { MongoClient, MongoServerSelectionError, ReadPreference } from '../../mongodb'; describe('Error (Integration)', function () { it('NODE-5296: handles aggregate errors from dns lookup', async function () { diff --git a/test/integration/node-specific/ipv6.test.ts b/test/integration/node-specific/ipv6.test.ts index 09157633b87..13534158174 100644 --- a/test/integration/node-specific/ipv6.test.ts +++ b/test/integration/node-specific/ipv6.test.ts @@ -8,7 +8,7 @@ import { type MongoClient, ReadPreference, TopologyType -} from '../../../src'; +} from '../../mongodb'; describe('IPv6 Addresses', () => { let client: MongoClient; diff --git a/test/integration/node-specific/mongo_client.test.ts b/test/integration/node-specific/mongo_client.test.ts index 001c33a919c..65eeb73ad2a 100644 --- a/test/integration/node-specific/mongo_client.test.ts +++ b/test/integration/node-specific/mongo_client.test.ts @@ -8,16 +8,16 @@ import { type Collection, type CommandStartedEvent, type CommandSucceededEvent, + Connection, Db, MongoClient, MongoNetworkError, MongoNotConnectedError, MongoServerSelectionError, - ReadPreference -} from '../../../src'; -import { Connection } from '../../../src/cmap/connection'; -import { ServerDescription } from '../../../src/sdam/server_description'; -import { Topology } from '../../../src/sdam/topology'; + ReadPreference, + ServerDescription, + Topology +} from '../../mongodb'; import { clearFailPoint, configureFailPoint } from '../../tools/utils'; import { setupDatabase } from '../shared'; diff --git a/test/integration/node-specific/operation_examples.test.ts b/test/integration/node-specific/operation_examples.test.ts index 81c18307423..4573198f625 100644 --- a/test/integration/node-specific/operation_examples.test.ts +++ b/test/integration/node-specific/operation_examples.test.ts @@ -1,8 +1,13 @@ import { expect } from 'chai'; import * as process from 'process'; -import { Code, type MongoClient, ProfilingLevel, ReturnDocument } from '../../../src'; -import { enumToString } from '../../../src/utils'; +import { + Code, + enumToString, + type MongoClient, + ProfilingLevel, + ReturnDocument +} from '../../mongodb'; import { sleep as delay } from '../../tools/utils'; import { setupDatabase } from '../shared'; diff --git a/test/integration/node-specific/resource_tracking_script_builder.ts b/test/integration/node-specific/resource_tracking_script_builder.ts index 5f2a5daa9ad..fd835611c0b 100644 --- a/test/integration/node-specific/resource_tracking_script_builder.ts +++ b/test/integration/node-specific/resource_tracking_script_builder.ts @@ -9,7 +9,7 @@ import { AssertionError, expect } from 'chai'; import * as process from 'process'; import type * as timers from 'timers'; -import type * as mongodb from '../../../src'; +import type * as mongodb from '../../mongodb'; import { type TestConfiguration } from '../../tools/runner/config'; import { type sleep } from '../../tools/utils'; diff --git a/test/integration/node-specific/topology.test.ts b/test/integration/node-specific/topology.test.ts index b4ab8fd9fb7..4d2a223ff65 100644 --- a/test/integration/node-specific/topology.test.ts +++ b/test/integration/node-specific/topology.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { MongoClient, type MongoClientOptions, type Topology } from '../../../src'; +import { MongoClient, type MongoClientOptions, type Topology } from '../../mongodb'; describe('Topology', function () { it('should correctly track states of a topology', { diff --git a/test/integration/node-specific/validate_collection.test.ts b/test/integration/node-specific/validate_collection.test.ts index d1c4ac790ff..b19f19e708a 100644 --- a/test/integration/node-specific/validate_collection.test.ts +++ b/test/integration/node-specific/validate_collection.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { ValidateCollectionOperation } from '../../../src/operations/validate_collection'; +import { ValidateCollectionOperation } from '../../mongodb'; describe('ValidateCollectionOperation', function () { let client; diff --git a/test/integration/objectid.test.ts b/test/integration/objectid.test.ts index 3c52dcc993d..e1b61b8b4ec 100644 --- a/test/integration/objectid.test.ts +++ b/test/integration/objectid.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type Collection, type Db, type MongoClient, ObjectId } from '../../src'; +import { type Collection, type Db, type MongoClient, ObjectId } from '../mongodb'; import { sleep } from '../tools/utils'; // TODO(NODE-4989): Improve these tests, likely can be made unit tests, or migrated to CRUD coverage (find oid range) diff --git a/test/integration/read-write-concern/readconcern.test.ts b/test/integration/read-write-concern/readconcern.test.ts index 96c1e39ca85..06348eaf4e6 100644 --- a/test/integration/read-write-concern/readconcern.test.ts +++ b/test/integration/read-write-concern/readconcern.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type MongoClient, ReadConcernLevel } from '../../../src'; +import { type MongoClient, ReadConcernLevel } from '../../mongodb'; import { filterForCommands, setupDatabase } from '../shared'; describe('ReadConcern', function () { diff --git a/test/integration/read-write-concern/write_concern.test.ts b/test/integration/read-write-concern/write_concern.test.ts index 5eb903460e6..44dfe658c2e 100644 --- a/test/integration/read-write-concern/write_concern.test.ts +++ b/test/integration/read-write-concern/write_concern.test.ts @@ -8,10 +8,10 @@ import { type CommandStartedEvent, type CommandSucceededEvent, type Db, - MongoClient -} from '../../../src'; -import { OpMsgRequest } from '../../../src/cmap/commands'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; + LEGACY_HELLO_COMMAND, + MongoClient, + OpMsgRequest +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import { filterForCommands } from '../shared'; diff --git a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts index 65791c2ed68..ca0576d218a 100644 --- a/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts +++ b/test/integration/retryable-reads/retryable_reads.spec.prose.test.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import { expect } from 'chai'; -import { type Collection, type MongoClient } from '../../../src'; +import { type Collection, type MongoClient } from '../../mongodb'; describe('Retryable Reads Spec Prose', () => { let client: MongoClient, failPointName; diff --git a/test/integration/retryable-writes/non-server-retryable_writes.test.ts b/test/integration/retryable-writes/non-server-retryable_writes.test.ts index 3cfd4677738..0e2a06c7cff 100644 --- a/test/integration/retryable-writes/non-server-retryable_writes.test.ts +++ b/test/integration/retryable-writes/non-server-retryable_writes.test.ts @@ -1,10 +1,13 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { type Collection, type MongoClient, MongoWriteConcernError } from '../../../src'; -import { PoolClearedError } from '../../../src/cmap/errors'; -import { Server } from '../../../src/sdam/server'; - +import { + type Collection, + type MongoClient, + MongoWriteConcernError, + PoolClearedError, + Server +} from '../../mongodb'; describe('Non Server Retryable Writes', function () { let client: MongoClient; let collection: Collection<{ _id: 1 }>; diff --git a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts index 58fe83ca97a..22f475978d0 100644 --- a/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts +++ b/test/integration/retryable-writes/retryable_writes.spec.prose.test.ts @@ -9,9 +9,9 @@ import { type MongoClient, MongoError, MongoServerError, - MongoWriteConcernError -} from '../../../src'; -import { Server } from '../../../src/sdam/server'; + MongoWriteConcernError, + Server +} from '../../mongodb'; import { sleep } from '../../tools/utils'; describe('Retryable Writes Spec Prose', () => { diff --git a/test/integration/run-command/run_command.test.ts b/test/integration/run-command/run_command.test.ts index eaa744806b6..e71d3887bfe 100644 --- a/test/integration/run-command/run_command.test.ts +++ b/test/integration/run-command/run_command.test.ts @@ -7,7 +7,7 @@ import { ReadConcern, ReadPreference, WriteConcern -} from '../../../src'; +} from '../../mongodb'; describe('RunCommand API', () => { let client: MongoClient; diff --git a/test/integration/run-command/run_cursor_command.test.ts b/test/integration/run-command/run_cursor_command.test.ts index 4b4fd80b5be..8b88c313f73 100644 --- a/test/integration/run-command/run_cursor_command.test.ts +++ b/test/integration/run-command/run_cursor_command.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { type Db, type MongoClient } from '../../../src'; +import { type Db, type MongoClient } from '../../mongodb'; describe('runCursorCommand API', () => { let client: MongoClient; diff --git a/test/integration/server-discovery-and-monitoring/server_description.test.ts b/test/integration/server-discovery-and-monitoring/server_description.test.ts index de14fb21bbb..0bc9112c4b0 100644 --- a/test/integration/server-discovery-and-monitoring/server_description.test.ts +++ b/test/integration/server-discovery-and-monitoring/server_description.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { MongoClient } from '../../../src'; +import { MongoClient } from '../../mongodb'; import { configureMongocryptdSpawnHooks } from '../../tools/utils'; describe('class ServerDescription', function () { diff --git a/test/integration/server-discovery-and-monitoring/server_discover_and_monitoring.test.ts b/test/integration/server-discovery-and-monitoring/server_discover_and_monitoring.test.ts index 3299bcde543..282d081b45c 100644 --- a/test/integration/server-discovery-and-monitoring/server_discover_and_monitoring.test.ts +++ b/test/integration/server-discovery-and-monitoring/server_discover_and_monitoring.test.ts @@ -3,9 +3,12 @@ import { setTimeout } from 'node:timers/promises'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { type MongoClient, type ServerHeartbeatSucceededEvent } from '../../../src'; -import { Connection } from '../../../src/cmap/connection'; -import { promiseWithResolvers } from '../../../src/utils'; +import { + Connection, + type MongoClient, + promiseWithResolvers, + type ServerHeartbeatSucceededEvent +} from '../../mongodb'; import { loadSpecTests } from '../../spec'; import { runUnifiedSuite } from '../../tools/unified-spec-runner/runner'; diff --git a/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts b/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts index 7201a4386a3..1f4cec00571 100644 --- a/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts +++ b/test/integration/server-discovery-and-monitoring/server_discovery_and_monitoring.prose.test.ts @@ -1,17 +1,15 @@ import { expect } from 'chai'; import { once } from 'events'; -import { - type ConnectionCheckOutFailedEvent, - type ConnectionPoolClearedEvent, - type MongoClient -} from '../../../src'; import { CONNECTION_POOL_CLEARED, CONNECTION_POOL_READY, + type ConnectionCheckOutFailedEvent, + type ConnectionPoolClearedEvent, + type MongoClient, SERVER_HEARTBEAT_FAILED, SERVER_HEARTBEAT_SUCCEEDED -} from '../../../src/constants'; +} from '../../mongodb'; import { sleep } from '../../tools/utils'; describe('Server Discovery and Monitoring Prose Tests', function () { diff --git a/test/integration/server-discovery-and-monitoring/topology_description.test.ts b/test/integration/server-discovery-and-monitoring/topology_description.test.ts index 47f5fcb862d..18a6824d1d6 100644 --- a/test/integration/server-discovery-and-monitoring/topology_description.test.ts +++ b/test/integration/server-discovery-and-monitoring/topology_description.test.ts @@ -1,8 +1,11 @@ import { expect } from 'chai'; -import { type MongoClient, type MongoClientOptions, TopologyType } from '../../../src'; -import { getTopology } from '../../../src/utils'; - +import { + getTopology, + type MongoClient, + type MongoClientOptions, + TopologyType +} from '../../mongodb'; describe('TopologyDescription (integration tests)', function () { let client: MongoClient; diff --git a/test/integration/server-selection/operation_count.test.ts b/test/integration/server-selection/operation_count.test.ts index 6a74bfe9984..6f6a68f10a9 100644 --- a/test/integration/server-selection/operation_count.test.ts +++ b/test/integration/server-selection/operation_count.test.ts @@ -1,8 +1,12 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { type AbstractCursor, type Collection, type MongoClient } from '../../../src'; -import { ConnectionPool } from '../../../src/cmap/connection_pool'; +import { + type AbstractCursor, + type Collection, + ConnectionPool, + type MongoClient +} from '../../mongodb'; import { type FailCommandFailPoint } from '../../tools/utils'; const testMetadata: MongoDBMetadataUI = { diff --git a/test/integration/server-selection/readpreference.test.ts b/test/integration/server-selection/readpreference.test.ts index 49658fc09de..e3ff9e47a82 100644 --- a/test/integration/server-selection/readpreference.test.ts +++ b/test/integration/server-selection/readpreference.test.ts @@ -1,7 +1,11 @@ import { expect } from 'chai'; -import { type CommandStartedEvent, type MongoClient, ReadPreference } from '../../../src'; -import { Topology } from '../../../src/sdam/topology'; +import { + type CommandStartedEvent, + type MongoClient, + ReadPreference, + Topology +} from '../../mongodb'; import { assert as test, filterForCommands, setupDatabase } from '../shared'; describe('ReadPreference', function () { diff --git a/test/integration/server-selection/server_selection.prose.operation_count.test.ts b/test/integration/server-selection/server_selection.prose.operation_count.test.ts index fc8da79bdb9..b4a7d9bf47b 100644 --- a/test/integration/server-selection/server_selection.prose.operation_count.test.ts +++ b/test/integration/server-selection/server_selection.prose.operation_count.test.ts @@ -1,7 +1,11 @@ import { expect } from 'chai'; -import { type Collection, type CommandStartedEvent, type MongoClient } from '../../../src'; -import { HostAddress } from '../../../src/utils'; +import { + type Collection, + type CommandStartedEvent, + HostAddress, + type MongoClient +} from '../../mongodb'; import { waitUntilPoolsFilled } from '../../tools/utils'; const failPoint = { diff --git a/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts b/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts index c70148e7441..3b72fe93eb1 100644 --- a/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts +++ b/test/integration/server-selection/server_selection.prose.sharded_retryable_reads.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import type { CommandFailedEvent, CommandSucceededEvent } from '../../../src'; +import type { CommandFailedEvent, CommandSucceededEvent } from '../../mongodb'; const TEST_METADATA = { requires: { mongodb: '>=4.2.9', topology: 'sharded' } }; const FAIL_COMMAND = { diff --git a/test/integration/server-selection/server_selection.prose.sharded_retryable_writes.test.ts b/test/integration/server-selection/server_selection.prose.sharded_retryable_writes.test.ts index c12f918d01f..29cb5d11ddc 100644 --- a/test/integration/server-selection/server_selection.prose.sharded_retryable_writes.test.ts +++ b/test/integration/server-selection/server_selection.prose.sharded_retryable_writes.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import type { CommandFailedEvent, CommandSucceededEvent } from '../../../src'; +import type { CommandFailedEvent, CommandSucceededEvent } from '../../mongodb'; const TEST_METADATA = { requires: { mongodb: '>=4.3.1', topology: 'sharded' } }; const FAIL_COMMAND = { diff --git a/test/integration/sessions/sessions.prose.test.ts b/test/integration/sessions/sessions.prose.test.ts index 0595bfb3ad4..b6be8d763ed 100644 --- a/test/integration/sessions/sessions.prose.test.ts +++ b/test/integration/sessions/sessions.prose.test.ts @@ -1,10 +1,13 @@ import { expect } from 'chai'; import { once } from 'events'; -import { type CommandStartedEvent } from '../../../src/cmap/command_monitoring_events'; -import { type Collection } from '../../../src/collection'; -import { MongoDriverError, MongoInvalidArgumentError } from '../../../src/error'; -import { MongoClient } from '../../../src/mongo_client'; +import { + type Collection, + type CommandStartedEvent, + MongoClient, + MongoDriverError, + MongoInvalidArgumentError +} from '../../mongodb'; import { configureMongocryptdSpawnHooks, sleep } from '../../tools/utils'; describe('Sessions Prose Tests', () => { diff --git a/test/integration/sessions/sessions.test.ts b/test/integration/sessions/sessions.test.ts index 58e59c13122..a4b292ca9d0 100644 --- a/test/integration/sessions/sessions.test.ts +++ b/test/integration/sessions/sessions.test.ts @@ -2,11 +2,11 @@ import { expect } from 'chai'; import { type CommandStartedEvent, - type CommandSucceededEvent -} from '../../../src/cmap/command_monitoring_events'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; -import { MongoServerError } from '../../../src/error'; -import { type MongoClient } from '../../../src/mongo_client'; + type CommandSucceededEvent, + LEGACY_HELLO_COMMAND, + type MongoClient, + MongoServerError +} from '../../mongodb'; import type { TestConfiguration } from '../../tools/runner/config'; import { setupDatabase } from '../shared'; diff --git a/test/integration/transactions-convenient-api/transactions-convenient-api.prose.test.ts b/test/integration/transactions-convenient-api/transactions-convenient-api.prose.test.ts index ad508660b21..1f4e67687de 100644 --- a/test/integration/transactions-convenient-api/transactions-convenient-api.prose.test.ts +++ b/test/integration/transactions-convenient-api/transactions-convenient-api.prose.test.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { test } from 'mocha'; import * as sinon from 'sinon'; -import { type ClientSession, type Collection, type MongoClient } from '../../../src'; +import { type ClientSession, type Collection, type MongoClient } from '../../mongodb'; import { configureFailPoint, type FailCommandFailPoint, measureDuration } from '../../tools/utils'; const failCommand: FailCommandFailPoint = { diff --git a/test/integration/transactions/transactions.prose.test.ts b/test/integration/transactions/transactions.prose.test.ts index 79faf077c7b..89b1e574faf 100644 --- a/test/integration/transactions/transactions.prose.test.ts +++ b/test/integration/transactions/transactions.prose.test.ts @@ -1,7 +1,7 @@ import { type ObjectId } from 'bson'; import { expect } from 'chai'; -import { type MongoClient } from '../../../src/mongo_client'; +import { type MongoClient } from '../../mongodb'; const metadata: MongoDBMetadataUI = { requires: { diff --git a/test/integration/transactions/transactions.test.ts b/test/integration/transactions/transactions.test.ts index acd4579e371..eb5406ea9ee 100644 --- a/test/integration/transactions/transactions.test.ts +++ b/test/integration/transactions/transactions.test.ts @@ -1,10 +1,14 @@ import { expect } from 'chai'; -import { type CommandStartedEvent } from '../../../src/cmap/command_monitoring_events'; -import { type Collection } from '../../../src/collection'; -import { MongoInvalidArgumentError, MongoNetworkError } from '../../../src/error'; -import { type MongoClient } from '../../../src/mongo_client'; -import { ClientSession, type ServerSessionPool } from '../../../src/sessions'; +import { + ClientSession, + type Collection, + type CommandStartedEvent, + type MongoClient, + MongoInvalidArgumentError, + MongoNetworkError, + type ServerSessionPool +} from '../../mongodb'; import { type FailCommandFailPoint } from '../../tools/utils'; describe('Transactions', function () { diff --git a/test/integration/uri-options/uri.test.ts b/test/integration/uri-options/uri.test.ts index 3444eef188d..ba531ff7850 100644 --- a/test/integration/uri-options/uri.test.ts +++ b/test/integration/uri-options/uri.test.ts @@ -3,7 +3,7 @@ import * as os from 'os'; import * as process from 'process'; import * as sinon from 'sinon'; -import { Topology } from '../../../src/sdam/topology'; +import { Topology } from '../../mongodb'; describe('URI', function () { let client; diff --git a/test/manual/atlas_connectivity.test.ts b/test/manual/atlas_connectivity.test.ts index 2e729846c49..15fd2d91b33 100644 --- a/test/manual/atlas_connectivity.test.ts +++ b/test/manual/atlas_connectivity.test.ts @@ -1,8 +1,6 @@ import * as process from 'process'; -import { MongoClient } from '../../src'; -import { LEGACY_HELLO_COMMAND } from '../../src/constants'; - +import { LEGACY_HELLO_COMMAND, MongoClient } from '../mongodb'; /** * ATLAS_CONNECTIVITY env variable is JSON * Here's some typescript describing the shape: diff --git a/test/manual/kerberos.test.ts b/test/manual/kerberos.test.ts index 3260f455eb3..ff6352e7c97 100644 --- a/test/manual/kerberos.test.ts +++ b/test/manual/kerberos.test.ts @@ -4,7 +4,7 @@ import * as os from 'os'; import * as process from 'process'; import * as sinon from 'sinon'; -import { MongoClient } from '../../src'; +import { MongoClient } from '../mongodb'; const expect = chai.expect; diff --git a/test/manual/ldap.test.ts b/test/manual/ldap.test.ts index 201b2186411..e110b910581 100644 --- a/test/manual/ldap.test.ts +++ b/test/manual/ldap.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import * as process from 'process'; -import { MongoClient } from '../../src'; +import { MongoClient } from '../mongodb'; describe('LDAP', function () { const { SASL_USER, SASL_PASS, SASL_HOST } = process.env; diff --git a/test/manual/search-index-management.prose.test.ts b/test/manual/search-index-management.prose.test.ts index bfdee35bcef..fd2f2f63a7c 100644 --- a/test/manual/search-index-management.prose.test.ts +++ b/test/manual/search-index-management.prose.test.ts @@ -5,7 +5,13 @@ import { Readable } from 'stream'; import { clearTimeout, setTimeout as setTimeoutCb } from 'timers'; import { setInterval } from 'timers/promises'; -import { type Collection, type Document, type MongoClient, ObjectId, ReadConcern } from '../../src'; +import { + type Collection, + type Document, + type MongoClient, + ObjectId, + ReadConcern +} from '../mongodb'; class TimeoutController extends AbortController { timeoutId: NodeJS.Timeout; diff --git a/test/manual/socks5.test.ts b/test/manual/socks5.test.ts index 4039f1d5dde..34e4f57ef85 100644 --- a/test/manual/socks5.test.ts +++ b/test/manual/socks5.test.ts @@ -2,9 +2,7 @@ import { expect } from 'chai'; import ConnectionString from 'mongodb-connection-string-url'; import * as process from 'process'; -import { MongoClient, MongoParseError } from '../../src'; -import { LEGACY_HELLO_COMMAND } from '../../src/constants'; - +import { LEGACY_HELLO_COMMAND, MongoClient, MongoParseError } from '../mongodb'; /** * The SOCKS5_CONFIG environment variable is either a JSON 4-tuple * [host, port, username, password] or just [host, port]. diff --git a/test/manual/tls_support.test.ts b/test/manual/tls_support.test.ts index 01b22a2769b..c576c05a2c2 100644 --- a/test/manual/tls_support.test.ts +++ b/test/manual/tls_support.test.ts @@ -7,9 +7,12 @@ import * as os from 'os'; import * as process from 'process'; import * as sinon from 'sinon'; -import { MongoClient, type MongoClientOptions, MongoServerSelectionError } from '../../src'; -import { LEGACY_HELLO_COMMAND } from '../../src/constants'; - +import { + LEGACY_HELLO_COMMAND, + MongoClient, + type MongoClientOptions, + MongoServerSelectionError +} from '../mongodb'; const REQUIRED_ENV = ['MONGODB_URI', 'TLS_KEY_FILE', 'TLS_CA_FILE', 'TLS_CRL_FILE']; describe('TLS Support', function () { diff --git a/test/manual/x509_auth.test.ts b/test/manual/x509_auth.test.ts index 9567f508ba2..d6e7a10e176 100644 --- a/test/manual/x509_auth.test.ts +++ b/test/manual/x509_auth.test.ts @@ -7,7 +7,7 @@ import { type MongoClientOptions, MongoServerError, MongoServerSelectionError -} from '../../src'; +} from '../mongodb'; // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const connectionString = new ConnectionString(process.env.MONGODB_URI!); diff --git a/test/mongodb.ts b/test/mongodb.ts new file mode 100644 index 00000000000..52b5d1b0f5a --- /dev/null +++ b/test/mongodb.ts @@ -0,0 +1,133 @@ +// As the centralized import for all src code for tests, we intentionally import from `src` in this file. +/* eslint-disable @typescript-eslint/no-restricted-imports */ + +export * from '../src/admin'; +export * from '../src/bson'; +export * from '../src/bulk/common'; +export * from '../src/bulk/ordered'; +export * from '../src/bulk/unordered'; +export * from '../src/change_stream'; +export * from '../src/client-side-encryption/auto_encrypter'; +export * from '../src/client-side-encryption/client_encryption'; +export * from '../src/client-side-encryption/errors'; +export * from '../src/client-side-encryption/mongocryptd_manager'; +export * from '../src/client-side-encryption/providers/aws'; +export * from '../src/client-side-encryption/providers/azure'; +export * from '../src/client-side-encryption/providers/gcp'; +export * from '../src/client-side-encryption/providers/index'; +export * from '../src/client-side-encryption/state_machine'; +export * from '../src/cmap/auth/auth_provider'; +export * from '../src/cmap/auth/aws_temporary_credentials'; +export * from '../src/cmap/auth/aws4'; +export * from '../src/cmap/auth/gssapi'; +export * from '../src/cmap/auth/mongo_credentials'; +export * from '../src/cmap/auth/mongodb_aws'; +export * from '../src/cmap/auth/mongodb_oidc'; +export * from '../src/cmap/auth/mongodb_oidc/automated_callback_workflow'; +export * from '../src/cmap/auth/mongodb_oidc/azure_machine_workflow'; +export * from '../src/cmap/auth/mongodb_oidc/callback_workflow'; +export * from '../src/cmap/auth/mongodb_oidc/command_builders'; +export * from '../src/cmap/auth/mongodb_oidc/gcp_machine_workflow'; +export * from '../src/cmap/auth/mongodb_oidc/human_callback_workflow'; +export * from '../src/cmap/auth/mongodb_oidc/k8s_machine_workflow'; +export * from '../src/cmap/auth/mongodb_oidc/token_cache'; +export * from '../src/cmap/auth/mongodb_oidc/token_machine_workflow'; +export * from '../src/cmap/auth/plain'; +export * from '../src/cmap/auth/providers'; +export * from '../src/cmap/auth/scram'; +export * from '../src/cmap/auth/x509'; +export * from '../src/cmap/command_monitoring_events'; +export * from '../src/cmap/commands'; +export * from '../src/cmap/connect'; +export * from '../src/cmap/connection'; +export * from '../src/cmap/connection_pool'; +export * from '../src/cmap/connection_pool_events'; +export * from '../src/cmap/errors'; +export * from '../src/cmap/handshake/client_metadata'; +export * from '../src/cmap/metrics'; +export * from '../src/cmap/stream_description'; +export * from '../src/cmap/wire_protocol/compression'; +export * from '../src/cmap/wire_protocol/constants'; +export * from '../src/cmap/wire_protocol/on_data'; +export * from '../src/cmap/wire_protocol/on_demand/document'; +export * from '../src/cmap/wire_protocol/responses'; +export * from '../src/cmap/wire_protocol/shared'; +export * from '../src/collection'; +export * from '../src/connection_string'; +export * from '../src/constants'; +export * from '../src/cursor/abstract_cursor'; +export * from '../src/cursor/aggregation_cursor'; +export * from '../src/cursor/change_stream_cursor'; +export * from '../src/cursor/client_bulk_write_cursor'; +export * from '../src/cursor/explainable_cursor'; +export * from '../src/cursor/find_cursor'; +export * from '../src/cursor/list_collections_cursor'; +export * from '../src/cursor/list_indexes_cursor'; +export * from '../src/cursor/list_search_indexes_cursor'; +export * from '../src/cursor/run_command_cursor'; +export * from '../src/db'; +export * from '../src/deps'; +export * from '../src/encrypter'; +export * from '../src/error'; +export * from '../src/explain'; +export * from '../src/gridfs/download'; +export * from '../src/gridfs/index'; +export * from '../src/gridfs/upload'; +export * from '../src/mongo_client'; +export * from '../src/mongo_client_auth_providers'; +export * from '../src/mongo_logger'; +export * from '../src/mongo_types'; +export * from '../src/operations/aggregate'; +export * from '../src/operations/client_bulk_write/client_bulk_write'; +export * from '../src/operations/client_bulk_write/command_builder'; +export * from '../src/operations/client_bulk_write/common'; +export * from '../src/operations/client_bulk_write/executor'; +export * from '../src/operations/client_bulk_write/results_merger'; +export * from '../src/operations/command'; +export * from '../src/operations/count'; +export * from '../src/operations/create_collection'; +export * from '../src/operations/delete'; +export * from '../src/operations/distinct'; +export * from '../src/operations/drop'; +export * from '../src/operations/end_sessions'; +export * from '../src/operations/estimated_document_count'; +export * from '../src/operations/execute_operation'; +export * from '../src/operations/find'; +export * from '../src/operations/find_and_modify'; +export * from '../src/operations/get_more'; +export * from '../src/operations/indexes'; +export * from '../src/operations/insert'; +export * from '../src/operations/kill_cursors'; +export * from '../src/operations/list_collections'; +export * from '../src/operations/list_databases'; +export * from '../src/operations/operation'; +export * from '../src/operations/profiling_level'; +export * from '../src/operations/remove_user'; +export * from '../src/operations/rename'; +export * from '../src/operations/run_command'; +export * from '../src/operations/search_indexes/create'; +export * from '../src/operations/search_indexes/drop'; +export * from '../src/operations/search_indexes/update'; +export * from '../src/operations/set_profiling_level'; +export * from '../src/operations/stats'; +export * from '../src/operations/update'; +export * from '../src/operations/validate_collection'; +export * from '../src/read_concern'; +export * from '../src/read_preference'; +export * from '../src/runtime_adapters'; +export * from '../src/sdam/common'; +export * from '../src/sdam/events'; +export * from '../src/sdam/monitor'; +export * from '../src/sdam/server'; +export * from '../src/sdam/server_description'; +export * from '../src/sdam/server_selection'; +export * from '../src/sdam/server_selection_events'; +export * from '../src/sdam/srv_polling'; +export * from '../src/sdam/topology'; +export * from '../src/sdam/topology_description'; +export * from '../src/sessions'; +export * from '../src/sort'; +export * from '../src/timeout'; +export * from '../src/transactions'; +export * from '../src/utils'; +export * from '../src/write_concern'; diff --git a/test/spec/index.ts b/test/spec/index.ts index fc43b748715..221d6671893 100644 --- a/test/spec/index.ts +++ b/test/spec/index.ts @@ -1,7 +1,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import { EJSON } from '../../src/bson'; +import { EJSON } from '../mongodb'; function hasDuplicates(testArray) { const testNames = testArray.map(test => test.description); diff --git a/test/tools/cmap_spec_runner.ts b/test/tools/cmap_spec_runner.ts index 38759f582ed..9bdf85bee83 100644 --- a/test/tools/cmap_spec_runner.ts +++ b/test/tools/cmap_spec_runner.ts @@ -5,17 +5,17 @@ import { clearTimeout, setTimeout } from 'timers'; import { inspect } from 'util'; import { + CMAP_EVENTS, type Connection, + ConnectionPool, type ConnectionPoolOptions, type HostAddress, type MongoClient, type MongoClientOptions, - type Server -} from '../../src'; -import { ConnectionPool } from '../../src/cmap/connection_pool'; -import { CMAP_EVENTS } from '../../src/constants'; -import { TimeoutContext } from '../../src/timeout'; -import { shuffle } from '../../src/utils'; + type Server, + shuffle, + TimeoutContext +} from '../mongodb'; import { isAnyRequirementSatisfied } from './unified-spec-runner/unified-utils'; import { type FailCommandFailPoint, sleep } from './utils'; diff --git a/test/tools/common.js b/test/tools/common.js index a2b15dd9a00..30732d247c0 100644 --- a/test/tools/common.js +++ b/test/tools/common.js @@ -1,9 +1,8 @@ 'use strict'; const mock = require('./mongodb-mock/index'); -const { ObjectId, Timestamp, Long, Binary } = require('../../src'); -const { LEGACY_HELLO_COMMAND } = require('../../src/constants'); -const { isHello } = require('../../src/utils'); +const { ObjectId, Timestamp, Long, Binary } = require('../mongodb'); +const { LEGACY_HELLO_COMMAND, isHello } = require('../mongodb'); class ReplSetFixture { constructor() { diff --git a/test/tools/mongodb-mock/index.js b/test/tools/mongodb-mock/index.js index 50dcdc8aeb6..11427450f77 100644 --- a/test/tools/mongodb-mock/index.js +++ b/test/tools/mongodb-mock/index.js @@ -1,6 +1,6 @@ const fs = require('fs'); -const { MockServer } = require('./src/server.js'); -const { LEGACY_HELLO_COMMAND } = require('../../../src/constants'); +const { LEGACY_HELLO_COMMAND } = require('../../mongodb'); +const { MockServer } = require('./src/server'); const process = require('node:process'); let mockServers = []; diff --git a/test/tools/mongodb-mock/src/server.js b/test/tools/mongodb-mock/src/server.js index e4cad7bef10..57ccefb6107 100644 --- a/test/tools/mongodb-mock/src/server.js +++ b/test/tools/mongodb-mock/src/server.js @@ -9,7 +9,7 @@ const Request = require('./request'); const { Query } = require('./protocol'); const EventEmitter = require('events'); const { setTimeout } = require('timers'); -const { HostAddress } = require('../../../../src/utils'); +const { HostAddress } = require('../../../mongodb'); /* * MockServer class diff --git a/test/tools/runner/config.ts b/test/tools/runner/config.ts index adcb31674a6..a16661f5d67 100644 --- a/test/tools/runner/config.ts +++ b/test/tools/runner/config.ts @@ -10,7 +10,9 @@ import * as url from 'url'; import { type AuthMechanism, + type CompressorName, Double, + HostAddress, Long, MongoClient, type MongoClientOptions, @@ -18,9 +20,7 @@ import { type ServerApi, TopologyType, type WriteConcernSettings -} from '../../../src'; -import { type CompressorName } from '../../../src/cmap/wire_protocol/compression'; -import { HostAddress } from '../../../src/utils'; +} from '../../mongodb'; import { getEnvironmentalOptions } from '../utils'; import { type Filter } from './filters/filter'; import { flakyTests } from './flaky'; diff --git a/test/tools/runner/filters/api_version_filter.ts b/test/tools/runner/filters/api_version_filter.ts index 78724c2f802..ce7df6f1fe0 100755 --- a/test/tools/runner/filters/api_version_filter.ts +++ b/test/tools/runner/filters/api_version_filter.ts @@ -1,6 +1,6 @@ import * as process from 'process'; -import { type MongoClient } from '../../../../src'; +import { type MongoClient } from '../../../mongodb'; import { Filter } from './filter'; /** diff --git a/test/tools/runner/filters/client_encryption_filter.ts b/test/tools/runner/filters/client_encryption_filter.ts index 5a168816831..57895525748 100644 --- a/test/tools/runner/filters/client_encryption_filter.ts +++ b/test/tools/runner/filters/client_encryption_filter.ts @@ -4,8 +4,8 @@ import { dirname, resolve } from 'path'; import * as process from 'process'; import { satisfies } from 'semver'; -import { type MongoClient } from '../../../../src'; import { kmsCredentialsPresent } from '../../../csfle-kms-providers'; +import { type MongoClient } from '../../../mongodb'; import { Filter } from './filter'; /** diff --git a/test/tools/runner/filters/crypt_shared_filter.ts b/test/tools/runner/filters/crypt_shared_filter.ts index 2879d55e09f..bf824357081 100644 --- a/test/tools/runner/filters/crypt_shared_filter.ts +++ b/test/tools/runner/filters/crypt_shared_filter.ts @@ -1,4 +1,4 @@ -import { type AutoEncrypter, MongoClient } from '../../../../src'; +import { type AutoEncrypter, MongoClient } from '../../../mongodb'; import { getEncryptExtraOptions } from '../../utils'; import { Filter } from './filter'; diff --git a/test/tools/runner/filters/filter.ts b/test/tools/runner/filters/filter.ts index bc7f6512bbe..6251cf44c8c 100644 --- a/test/tools/runner/filters/filter.ts +++ b/test/tools/runner/filters/filter.ts @@ -1,4 +1,4 @@ -import { type MongoClient } from '../../../../src'; +import { type MongoClient } from '../../../mongodb'; export abstract class Filter { async initializeFilter(_client: MongoClient, _context: Record): Promise { diff --git a/test/tools/runner/filters/mongodb_topology_filter.ts b/test/tools/runner/filters/mongodb_topology_filter.ts index 98f53155551..429b028b8b3 100755 --- a/test/tools/runner/filters/mongodb_topology_filter.ts +++ b/test/tools/runner/filters/mongodb_topology_filter.ts @@ -1,4 +1,4 @@ -import { type MongoClient, TopologyType } from '../../../../src'; +import { type MongoClient, TopologyType } from '../../../mongodb'; import { Filter } from './filter'; /** diff --git a/test/tools/runner/filters/mongodb_version_filter.ts b/test/tools/runner/filters/mongodb_version_filter.ts index 93fc6ad86a4..8d1eb6307ff 100755 --- a/test/tools/runner/filters/mongodb_version_filter.ts +++ b/test/tools/runner/filters/mongodb_version_filter.ts @@ -1,6 +1,6 @@ import * as semver from 'semver'; -import { type MongoClient } from '../../../../src'; +import { type MongoClient } from '../../../mongodb'; import { Filter } from './filter'; /** diff --git a/test/tools/runner/filters/tls_filter.ts b/test/tools/runner/filters/tls_filter.ts index aa51c88f7c1..b08b03a0a7a 100644 --- a/test/tools/runner/filters/tls_filter.ts +++ b/test/tools/runner/filters/tls_filter.ts @@ -1,6 +1,6 @@ import * as process from 'process'; -import { type MongoClient } from '../../../../src'; +import { type MongoClient } from '../../../mongodb'; import { Filter } from './filter'; export const isTLSEnabled = process.env.SSL === 'ssl'; diff --git a/test/tools/runner/hooks/configuration.ts b/test/tools/runner/hooks/configuration.ts index 87f7502825b..0220d81fb9b 100644 --- a/test/tools/runner/hooks/configuration.ts +++ b/test/tools/runner/hooks/configuration.ts @@ -8,7 +8,7 @@ require('source-map-support').install({ import * as process from 'process'; import * as os from 'os'; -import { MongoClient } from '../../../../src'; +import { MongoClient } from '../../../mongodb'; import { AlpineTestConfiguration, AstrolabeTestConfiguration, TestConfiguration } from '../config'; import { getEnvironmentalOptions } from '../../utils'; import * as mock from '../../mongodb-mock/index'; diff --git a/test/tools/runner/hooks/leak_checker.ts b/test/tools/runner/hooks/leak_checker.ts index f0304cfaa28..fab12158fc6 100644 --- a/test/tools/runner/hooks/leak_checker.ts +++ b/test/tools/runner/hooks/leak_checker.ts @@ -5,9 +5,7 @@ import * as chalk from 'chalk'; import * as net from 'net'; import * as process from 'process'; -import { MongoClient } from '../../../../src'; -import { ServerSessionPool } from '../../../../src/sessions'; - +import { MongoClient, ServerSessionPool } from '../../../mongodb'; class LeakChecker { static originalAcquire: typeof ServerSessionPool.prototype.acquire; static originalRelease: typeof ServerSessionPool.prototype.release; diff --git a/test/tools/spec-runner/context.js b/test/tools/spec-runner/context.js index 9bcc93acb3f..22871c707d5 100644 --- a/test/tools/spec-runner/context.js +++ b/test/tools/spec-runner/context.js @@ -2,7 +2,7 @@ const { expect } = require('chai'); const { setTimeout } = require('timers'); const { resolveConnectionString } = require('./utils'); -const { ns } = require('../../../src/utils'); +const { ns } = require('../../mongodb'); const { extractAuthFromConnectionString } = require('../utils'); const process = require('node:process'); diff --git a/test/tools/spec-runner/index.js b/test/tools/spec-runner/index.js index f8b285aa007..2043ba395a6 100644 --- a/test/tools/spec-runner/index.js +++ b/test/tools/spec-runner/index.js @@ -6,7 +6,7 @@ const process = require('node:process'); const expect = chai.expect; const { EJSON } = require('bson'); -const { isRecord } = require('../../../src/utils'); +const { isRecord } = require('../../mongodb'); const TestRunnerContext = require('./context').TestRunnerContext; const resolveConnectionString = require('./utils').resolveConnectionString; const { @@ -14,7 +14,7 @@ const { CMAP_EVENTS: SOURCE_CMAP_EVENTS, TOPOLOGY_EVENTS, HEARTBEAT_EVENTS -} = require('../../../src/constants'); +} = require('../../mongodb'); const { isAnyRequirementSatisfied } = require('../unified-spec-runner/unified-utils'); const { getCSFLEKMSProviders } = require('../../csfle-kms-providers'); diff --git a/test/tools/unified-spec-runner/entities.ts b/test/tools/unified-spec-runner/entities.ts index 534071749a5..2c4f257b15e 100644 --- a/test/tools/unified-spec-runner/entities.ts +++ b/test/tools/unified-spec-runner/entities.ts @@ -35,20 +35,21 @@ import { type MongoCredentials, ReadConcern, ReadPreference, + SENSITIVE_COMMANDS, type ServerClosedEvent, type ServerDescriptionChangedEvent, type ServerHeartbeatFailedEvent, type ServerHeartbeatStartedEvent, type ServerHeartbeatSucceededEvent, type ServerOpeningEvent, + Timeout, + TimeoutError, type TopologyClosedEvent, type TopologyDescription, type TopologyDescriptionChangedEvent, type TopologyOpeningEvent, WriteConcern -} from '../../../src'; -import { SENSITIVE_COMMANDS } from '../../../src/cmap/command_monitoring_events'; -import { Timeout, TimeoutError } from '../../../src/timeout'; +} from '../../mongodb'; import { getEncryptExtraOptions, getEnvironmentalOptions } from '../../tools/utils'; import { AlpineTestConfiguration, type TestConfiguration } from '../runner/config'; import { EntityEventRegistry } from './entity_event_registry'; diff --git a/test/tools/unified-spec-runner/entity_event_registry.ts b/test/tools/unified-spec-runner/entity_event_registry.ts index 9b392c0be31..d62e1069886 100644 --- a/test/tools/unified-spec-runner/entity_event_registry.ts +++ b/test/tools/unified-spec-runner/entity_event_registry.ts @@ -15,7 +15,7 @@ import { CONNECTION_POOL_CREATED, CONNECTION_POOL_READY, CONNECTION_READY -} from '../../../src/constants'; +} from '../../mongodb'; import { type EntitiesMap, type UnifiedMongoClient } from './entities'; import { type ClientEntity } from './schema'; diff --git a/test/tools/unified-spec-runner/match.ts b/test/tools/unified-spec-runner/match.ts index 9c61ccac1ce..112748a10a8 100644 --- a/test/tools/unified-spec-runner/match.ts +++ b/test/tools/unified-spec-runner/match.ts @@ -38,7 +38,7 @@ import { TopologyClosedEvent, TopologyDescriptionChangedEvent, TopologyOpeningEvent -} from '../../../src'; +} from '../../mongodb'; import { ejson } from '../utils'; import { type CmapEvent, type CommandEvent, type EntitiesMap, type SdamEvent } from './entities'; import { diff --git a/test/tools/unified-spec-runner/operations.ts b/test/tools/unified-spec-runner/operations.ts index 150d30680c0..d0bf5969e79 100644 --- a/test/tools/unified-spec-runner/operations.ts +++ b/test/tools/unified-spec-runner/operations.ts @@ -17,13 +17,13 @@ import { MongoError, ReadConcern, ReadPreference, + SERVER_DESCRIPTION_CHANGED, ServerType, type TopologyDescription, type TopologyType, type TransactionOptions, WriteConcern -} from '../../../src'; -import { SERVER_DESCRIPTION_CHANGED } from '../../../src/constants'; +} from '../../mongodb'; import { sleep } from '../../tools/utils'; import { type TestConfiguration } from '../runner/config'; import { EntitiesMap } from './entities'; diff --git a/test/tools/unified-spec-runner/runner.ts b/test/tools/unified-spec-runner/runner.ts index d2be0f01c5f..f58d01f98bd 100644 --- a/test/tools/unified-spec-runner/runner.ts +++ b/test/tools/unified-spec-runner/runner.ts @@ -5,13 +5,13 @@ import { gte as semverGte, satisfies as semverSatisfies } from 'semver'; import { type MongoClient, + MONGODB_ERROR_CODES, MongoParseError, MongoServerError, + ns, ReadPreference, TopologyType -} from '../../../src'; -import { MONGODB_ERROR_CODES } from '../../../src/error'; -import { ns } from '../../../src/utils'; +} from '../../mongodb'; import { ejson } from '../utils'; import { AstrolabeResultsWriter } from './astrolabe_results_writer'; import { EntitiesMap, type UnifiedMongoClient } from './entities'; diff --git a/test/tools/unified-spec-runner/schema.ts b/test/tools/unified-spec-runner/schema.ts index 7b03f0f0d12..0f7e048b17b 100644 --- a/test/tools/unified-spec-runner/schema.ts +++ b/test/tools/unified-spec-runner/schema.ts @@ -10,7 +10,7 @@ import type { TagSet, TopologyType, W -} from '../../../src'; +} from '../../mongodb'; import { type TestConfiguration } from '../runner/config'; import { type UnifiedThread } from './entities'; diff --git a/test/tools/unified-spec-runner/unified-utils.ts b/test/tools/unified-spec-runner/unified-utils.ts index f51f12dafbc..1d4973734ac 100644 --- a/test/tools/unified-spec-runner/unified-utils.ts +++ b/test/tools/unified-spec-runner/unified-utils.ts @@ -4,17 +4,17 @@ import * as process from 'process'; import { coerce, gte as semverGte, lte as semverLte } from 'semver'; import { isDeepStrictEqual } from 'util'; +import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; import { type AutoEncryptionOptions, + ClientEncryption, type CollectionOptions, type DbOptions, type Document, + getMongoDBClientEncryption, type MongoClient, ReturnDocument -} from '../../../src'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; -import { getMongoDBClientEncryption } from '../../../src/deps'; -import { getCSFLEKMSProviders } from '../../csfle-kms-providers'; +} from '../../mongodb'; import type { CmapEvent, CommandEvent, EntitiesMap, SdamEvent } from './entities'; import { matchesEvents } from './match'; import { MalformedOperationError } from './operations'; diff --git a/test/tools/uri_spec_runner.ts b/test/tools/uri_spec_runner.ts index 78d4f45aef9..bb6f44459a1 100644 --- a/test/tools/uri_spec_runner.ts +++ b/test/tools/uri_spec_runner.ts @@ -6,7 +6,7 @@ import { MongoInvalidArgumentError, MongoParseError, MongoRuntimeError -} from '../../src'; +} from '../mongodb'; type HostObject = { type: 'ipv4' | 'ip_literal' | 'hostname' | 'unix'; diff --git a/test/tools/utils.ts b/test/tools/utils.ts index d3948d773cd..d587e9864d4 100644 --- a/test/tools/utils.ts +++ b/test/tools/utils.ts @@ -4,7 +4,6 @@ import * as fs from 'node:fs/promises'; import { tmpdir } from 'node:os'; import * as path from 'node:path'; -import { EJSON } from 'bson'; import * as BSON from 'bson'; import { expect } from 'chai'; import * as process from 'process'; @@ -18,14 +17,14 @@ import { type HostAddress, MongoClient, type MongoClientOptions, + OP_MSG, + processTimeMS, + resolveRuntimeAdapters, type Runtime, type ServerApiVersion, + Topology, type TopologyOptions -} from '../../src'; -import { OP_MSG } from '../../src/cmap/wire_protocol/constants'; -import { resolveRuntimeAdapters } from '../../src/runtime_adapters'; -import { Topology } from '../../src/sdam/topology'; -import { processTimeMS } from '../../src/utils'; +} from '../mongodb'; import { type TestConfiguration } from './runner/config'; import { isTLSEnabled } from './runner/filters/tls_filter'; diff --git a/test/types/admin.test-d.ts b/test/types/admin.test-d.ts index b109391ce90..180dbca9e69 100644 --- a/test/types/admin.test-d.ts +++ b/test/types/admin.test-d.ts @@ -1,6 +1,6 @@ import { expectType } from 'tsd'; -import { type Document, MongoClient } from '../../src'; +import { type Document, MongoClient } from '../mongodb'; const client = new MongoClient(''); const admin = client.db().admin(); diff --git a/test/types/basic_schema.test-d.ts b/test/types/basic_schema.test-d.ts index e45f5fc23d7..d066257cbab 100644 --- a/test/types/basic_schema.test-d.ts +++ b/test/types/basic_schema.test-d.ts @@ -1,6 +1,6 @@ import { expectAssignable, expectNotAssignable, expectNotType, expectType } from 'tsd'; -import { Collection, Db, type Document, type InferIdType, MongoClient, ObjectId } from '../../src'; +import { Collection, Db, type Document, type InferIdType, MongoClient, ObjectId } from '../mongodb'; const db = new Db(new MongoClient(''), ''); diff --git a/test/types/bson.test-d.ts b/test/types/bson.test-d.ts index 1ae3b9817b2..b011e9369c2 100644 --- a/test/types/bson.test-d.ts +++ b/test/types/bson.test-d.ts @@ -1,6 +1,6 @@ import { expectType } from 'tsd'; -import type { BSONSerializeOptions, Document } from '../../src'; +import type { BSONSerializeOptions, Document } from '../mongodb'; const options: BSONSerializeOptions = {}; diff --git a/test/types/change_stream.test-d.ts b/test/types/change_stream.test-d.ts index b76eec9f772..ea689a61ea5 100644 --- a/test/types/change_stream.test-d.ts +++ b/test/types/change_stream.test-d.ts @@ -27,7 +27,7 @@ import type { ServerSessionId, Timestamp, UpdateDescription -} from '../../src'; +} from '../mongodb'; declare const changeStreamOptions: ChangeStreamOptions; type ChangeStreamOperationType = diff --git a/test/types/client-side-encryption.test-d.ts b/test/types/client-side-encryption.test-d.ts index 925af0c69ca..9437413450d 100644 --- a/test/types/client-side-encryption.test-d.ts +++ b/test/types/client-side-encryption.test-d.ts @@ -10,7 +10,7 @@ import type { KMSProviders, RangeOptions } from '../..'; -import { Binary, type ClientEncryptionDataKeyProvider } from '../../src'; +import { Binary, type ClientEncryptionDataKeyProvider } from '../mongodb'; type RequiredCreateEncryptedCollectionSettings = Parameters< ClientEncryption['createEncryptedCollection'] diff --git a/test/types/client_bulk_write.test-d.ts b/test/types/client_bulk_write.test-d.ts index 7079a9804d7..834b68b19cd 100644 --- a/test/types/client_bulk_write.test-d.ts +++ b/test/types/client_bulk_write.test-d.ts @@ -15,7 +15,7 @@ import { type UpdateFilter, type UUID, type WithoutId -} from '../../src'; +} from '../mongodb'; declare const client: MongoClient; type Book = { title: string; released: Date }; diff --git a/test/types/community/bulk/bulk-operation-base.test-d.ts b/test/types/community/bulk/bulk-operation-base.test-d.ts index a2f97d811d3..06f2f9c3a75 100644 --- a/test/types/community/bulk/bulk-operation-base.test-d.ts +++ b/test/types/community/bulk/bulk-operation-base.test-d.ts @@ -1,16 +1,16 @@ import { expectType } from 'tsd'; import { + Batch, type BatchType, + BulkOperationBase, type BulkWriteOptions, type BulkWriteResult, type DeleteStatement, type Document, MongoClient, type UpdateStatement -} from '../../../../src'; -import { Batch, BulkOperationBase } from '../../../../src/bulk/common'; - +} from '../../../mongodb'; const client = new MongoClient(''); const db = client.db('test'); const collection = db.collection('test'); diff --git a/test/types/community/changes_from_36.test-d.ts b/test/types/community/changes_from_36.test-d.ts index f6a44808646..6e95fdc0a2b 100644 --- a/test/types/community/changes_from_36.test-d.ts +++ b/test/types/community/changes_from_36.test-d.ts @@ -6,7 +6,7 @@ import { type MongoClientOptions, type ReadPreference, type ReadPreferenceMode -} from '../../../src'; +} from '../../mongodb'; import type { PropExists } from '../utility_types'; type MongoDBImport = typeof import('../../../src'); diff --git a/test/types/community/client.test-d.ts b/test/types/community/client.test-d.ts index c6ae23b91fd..0f290239aa8 100644 --- a/test/types/community/client.test-d.ts +++ b/test/types/community/client.test-d.ts @@ -9,7 +9,7 @@ import { ReadPreference, type ReadPreferenceMode, type W -} from '../../../src'; +} from '../../mongodb'; // TODO(NODE-3348): Improve the tests to expectType assertions diff --git a/test/types/community/collection/aggregate.test-d.ts b/test/types/community/collection/aggregate.test-d.ts index 9625f4005ac..840443f74d9 100644 --- a/test/types/community/collection/aggregate.test-d.ts +++ b/test/types/community/collection/aggregate.test-d.ts @@ -1,6 +1,6 @@ import { expectNotType, expectType } from 'tsd'; -import { type AggregationCursor, type Document, MongoClient } from '../../../../src'; +import { type AggregationCursor, type Document, MongoClient } from '../../../mongodb'; // collection.aggregate tests const client = new MongoClient(''); diff --git a/test/types/community/collection/bulkWrite.test-d.ts b/test/types/community/collection/bulkWrite.test-d.ts index 1813ec2627d..49c36539d63 100644 --- a/test/types/community/collection/bulkWrite.test-d.ts +++ b/test/types/community/collection/bulkWrite.test-d.ts @@ -6,7 +6,7 @@ import { type Document, MongoClient, ObjectId -} from '../../../../src'; +} from '../../../mongodb'; // TODO(NODE-3347): Improve these tests to use more expect assertions diff --git a/test/types/community/collection/count.test-d.ts b/test/types/community/collection/count.test-d.ts index 2c1a3cecc8b..70d183e2bc7 100644 --- a/test/types/community/collection/count.test-d.ts +++ b/test/types/community/collection/count.test-d.ts @@ -1,6 +1,6 @@ import { expectDeprecated, expectType } from 'tsd'; -import { MongoClient } from '../../../../src'; +import { MongoClient } from '../../../mongodb'; // test collection.countDocuments const client = new MongoClient(''); diff --git a/test/types/community/collection/distinct.test-d.ts b/test/types/community/collection/distinct.test-d.ts index ebe0e13697a..4292be71c6b 100644 --- a/test/types/community/collection/distinct.test-d.ts +++ b/test/types/community/collection/distinct.test-d.ts @@ -1,6 +1,6 @@ import { expectType } from 'tsd'; -import { MongoClient, type ObjectId } from '../../../../src'; +import { MongoClient, type ObjectId } from '../../../mongodb'; // test collection.distinct functions interface Collection { diff --git a/test/types/community/collection/filterQuery.test-d.ts b/test/types/community/collection/filterQuery.test-d.ts index 73a3f7c31f0..7030b70b9b3 100644 --- a/test/types/community/collection/filterQuery.test-d.ts +++ b/test/types/community/collection/filterQuery.test-d.ts @@ -18,7 +18,7 @@ import { MongoClient, type UpdateFilter, type WithId -} from '../../../../src'; +} from '../../../mongodb'; /** * test the Filter type using collection.find() method diff --git a/test/types/community/collection/findX.test-d.ts b/test/types/community/collection/findX.test-d.ts index f0624e3d5a6..051b1519cbc 100644 --- a/test/types/community/collection/findX.test-d.ts +++ b/test/types/community/collection/findX.test-d.ts @@ -9,7 +9,7 @@ import { MongoClient, ObjectId, type WithId -} from '../../../../src'; +} from '../../../mongodb'; import type { PropExists } from '../../utility_types'; // collection.findX tests diff --git a/test/types/community/collection/insertX.test-d.ts b/test/types/community/collection/insertX.test-d.ts index 1f6fa57d8ae..97deddc3c41 100644 --- a/test/types/community/collection/insertX.test-d.ts +++ b/test/types/community/collection/insertX.test-d.ts @@ -1,6 +1,6 @@ import { expectError, expectNotAssignable, expectNotType, expectType } from 'tsd'; -import { MongoClient, ObjectId, type OptionalId } from '../../../../src'; +import { MongoClient, ObjectId, type OptionalId } from '../../../mongodb'; import type { PropExists } from '../../utility_types'; // test collection.insertX functions diff --git a/test/types/community/collection/recursive-types.test-d.ts b/test/types/community/collection/recursive-types.test-d.ts index 388bfc893a8..39ccd9fbd68 100644 --- a/test/types/community/collection/recursive-types.test-d.ts +++ b/test/types/community/collection/recursive-types.test-d.ts @@ -1,6 +1,6 @@ import { expectAssignable, expectError, expectNotAssignable, expectNotType } from 'tsd'; -import type { Collection, StrictFilter, StrictUpdateFilter, UpdateFilter } from '../../../../src'; +import type { Collection, StrictFilter, StrictUpdateFilter, UpdateFilter } from '../../../mongodb'; /** * mutually recursive types are not supported and will not get type safety diff --git a/test/types/community/collection/replaceX.test-d.ts b/test/types/community/collection/replaceX.test-d.ts index 78656073edc..3fa08c90a23 100644 --- a/test/types/community/collection/replaceX.test-d.ts +++ b/test/types/community/collection/replaceX.test-d.ts @@ -1,6 +1,6 @@ import { expectError } from 'tsd'; -import { MongoClient, ObjectId } from '../../../../src'; +import { MongoClient, ObjectId } from '../../../mongodb'; // test collection.replaceX functions const client = new MongoClient(''); diff --git a/test/types/community/collection/updateX.test-d.ts b/test/types/community/collection/updateX.test-d.ts index b2aaa03e445..1a6926facdc 100644 --- a/test/types/community/collection/updateX.test-d.ts +++ b/test/types/community/collection/updateX.test-d.ts @@ -19,7 +19,7 @@ import { type StrictUpdateFilter, type Timestamp, type UpdateFilter -} from '../../../../src'; +} from '../../../mongodb'; // MatchKeysAndValues - for basic mapping keys to their values, restricts that key types must be the same but optional, and permit dot array notation expectAssignable>({ diff --git a/test/types/community/createIndex.test-d.ts b/test/types/community/createIndex.test-d.ts index c81d8720f48..f8f9168492d 100644 --- a/test/types/community/createIndex.test-d.ts +++ b/test/types/community/createIndex.test-d.ts @@ -1,6 +1,6 @@ import { expectType } from 'tsd'; -import { type CreateIndexesOptions, type Document, MongoClient } from '../../../src'; +import { type CreateIndexesOptions, type Document, MongoClient } from '../../mongodb'; const client = new MongoClient(''); const db = client.db('test'); diff --git a/test/types/community/cursor.test-d.ts b/test/types/community/cursor.test-d.ts index 3fb171b8da6..6be7a85776c 100644 --- a/test/types/community/cursor.test-d.ts +++ b/test/types/community/cursor.test-d.ts @@ -1,7 +1,7 @@ import type { Readable } from 'stream'; import { expectNotType, expectType } from 'tsd'; -import { Db, type Document, type FindCursor, MongoClient } from '../../../src'; +import { Db, type Document, type FindCursor, MongoClient } from '../../mongodb'; // TODO(NODE-3346): Improve these tests to use expect assertions more diff --git a/test/types/community/db/createCollection.test-d.ts b/test/types/community/db/createCollection.test-d.ts index 5f167ae23bb..9194cbf6012 100644 --- a/test/types/community/db/createCollection.test-d.ts +++ b/test/types/community/db/createCollection.test-d.ts @@ -5,7 +5,7 @@ import { type CreateCollectionOptions, MongoClient, type ObjectId -} from '../../../../src'; +} from '../../../mongodb'; const client = new MongoClient(''); const db = client.db('test'); diff --git a/test/types/community/slow-model.test-d.ts b/test/types/community/slow-model.test-d.ts index 96a356af3a6..cad5fc44fd4 100644 --- a/test/types/community/slow-model.test-d.ts +++ b/test/types/community/slow-model.test-d.ts @@ -7,7 +7,7 @@ import type { UUID } from 'bson'; -import type { Collection, Db } from '../../../src'; +import type { Collection, Db } from '../../mongodb'; interface MomentInputObject { years?: number; diff --git a/test/types/community/transaction.test-d.ts b/test/types/community/transaction.test-d.ts index 01d4cf98a82..949d5a17f6f 100644 --- a/test/types/community/transaction.test-d.ts +++ b/test/types/community/transaction.test-d.ts @@ -1,6 +1,6 @@ import { expectType } from 'tsd'; -import { type ClientSession, type InsertOneResult, MongoClient, ReadConcern } from '../../../src'; +import { type ClientSession, type InsertOneResult, MongoClient, ReadConcern } from '../../mongodb'; // TODO(NODE-3345): Improve these tests to use expect assertions more diff --git a/test/types/connection.test-d.ts b/test/types/connection.test-d.ts index 0fef49ff680..aa31b06a515 100644 --- a/test/types/connection.test-d.ts +++ b/test/types/connection.test-d.ts @@ -1,9 +1,6 @@ import { expectError, expectType } from 'tsd'; -import { type Connection, type Document } from '../../src'; -import { MongoDBResponse } from '../../src/cmap/wire_protocol/responses'; -import { ns } from '../../src/utils'; - +import { type Connection, type Document, MongoDBResponse, ns } from '../mongodb'; declare const connection: Connection; expectType(await connection.command(ns('a'), { cmd: 1 })); diff --git a/test/types/connection_pool_events.test-d.ts b/test/types/connection_pool_events.test-d.ts index 5e9acc7d0c6..348d5c52d30 100644 --- a/test/types/connection_pool_events.test-d.ts +++ b/test/types/connection_pool_events.test-d.ts @@ -1,7 +1,7 @@ import { once } from 'events'; import { expectType } from 'tsd'; -import { type ConnectionPoolCreatedEvent, MongoClient } from '../../src'; +import { type ConnectionPoolCreatedEvent, MongoClient } from '../mongodb'; const client: MongoClient = new MongoClient(''); const p = once(client, 'connectionPoolCreated'); diff --git a/test/types/encryption.test-d.ts b/test/types/encryption.test-d.ts index f32006b763f..a22400e6190 100644 --- a/test/types/encryption.test-d.ts +++ b/test/types/encryption.test-d.ts @@ -1,6 +1,6 @@ import { expectAssignable } from 'tsd'; -import type { AutoEncryptionOptions } from '../../src'; +import type { AutoEncryptionOptions } from '../mongodb'; // Empty credentials support on each provider expectAssignable({ diff --git a/test/types/enum.test-d.ts b/test/types/enum.test-d.ts index ed07529bfc6..537ec202da2 100644 --- a/test/types/enum.test-d.ts +++ b/test/types/enum.test-d.ts @@ -18,7 +18,7 @@ import { ServerApiVersion, ServerType, TopologyType -} from '../../src'; +} from '../mongodb'; const num: number = Math.random(); diff --git a/test/types/example_schemas.ts b/test/types/example_schemas.ts index 08368dc1501..7ce9fa9f038 100644 --- a/test/types/example_schemas.ts +++ b/test/types/example_schemas.ts @@ -1,4 +1,4 @@ -import type { Double, Int32 } from '../../src'; +import type { Double, Int32 } from '../mongodb'; export type MediaType = 'movie' | 'tv' | 'web series'; diff --git a/test/types/gridfs_types.test-d.ts b/test/types/gridfs_types.test-d.ts index eb6a1277cb7..fe6cd5fa195 100644 --- a/test/types/gridfs_types.test-d.ts +++ b/test/types/gridfs_types.test-d.ts @@ -1,7 +1,7 @@ import { Readable } from 'stream'; import { expectType } from 'tsd'; -import type { GridFSBucket, GridFSBucketWriteStream } from '../../src'; +import type { GridFSBucket, GridFSBucketWriteStream } from '../mongodb'; (function test(bucket: GridFSBucket) { const readable = new Readable(); diff --git a/test/types/helper_types.test-d.ts b/test/types/helper_types.test-d.ts index 489120fd219..26dfb5ca5f7 100644 --- a/test/types/helper_types.test-d.ts +++ b/test/types/helper_types.test-d.ts @@ -16,7 +16,7 @@ import { type NumericType, type OneOrMore, type OnlyFieldsOfType -} from '../../src'; +} from '../mongodb'; expectType>(true); expectNotType>(true); diff --git a/test/types/index_options.test-d.ts b/test/types/index_options.test-d.ts index 169b226daf8..e540f9654ab 100644 --- a/test/types/index_options.test-d.ts +++ b/test/types/index_options.test-d.ts @@ -1,6 +1,6 @@ import { expectAssignable, expectNotAssignable } from 'tsd'; -import type { IndexDescription } from '../../src'; +import type { IndexDescription } from '../mongodb'; // test that all valid index options are allowed in IndexDescription expectAssignable({ key: {}, background: true }); diff --git a/test/types/indexed_schema.test-d.ts b/test/types/indexed_schema.test-d.ts index ee47e3f6da4..97e05edde30 100644 --- a/test/types/indexed_schema.test-d.ts +++ b/test/types/indexed_schema.test-d.ts @@ -1,6 +1,6 @@ import { expectError, expectNotType, expectType } from 'tsd'; -import { Collection, Db, MongoClient, ObjectId } from '../../src'; +import { Collection, Db, MongoClient, ObjectId } from '../mongodb'; const db = new Db(new MongoClient(''), ''); diff --git a/test/types/indexes_test-d.ts b/test/types/indexes_test-d.ts index 57cb9277feb..93cd036da00 100644 --- a/test/types/indexes_test-d.ts +++ b/test/types/indexes_test-d.ts @@ -5,7 +5,7 @@ import { type IndexDescriptionInfo, type IndexInformationOptions, MongoClient -} from '../../src'; +} from '../mongodb'; const client = new MongoClient(''); const db = client.db('test'); diff --git a/test/types/list_collections.test-d.ts b/test/types/list_collections.test-d.ts index 42438302f88..06d2b471d9b 100644 --- a/test/types/list_collections.test-d.ts +++ b/test/types/list_collections.test-d.ts @@ -1,6 +1,6 @@ import { expectNotType, expectType } from 'tsd'; -import { type CollectionInfo, type ListCollectionsCursor, MongoClient } from '../../src'; +import { type CollectionInfo, type ListCollectionsCursor, MongoClient } from '../mongodb'; const db = new MongoClient('').db(); diff --git a/test/types/mongodb.test-d.ts b/test/types/mongodb.test-d.ts index f48b03e169c..97f74ad35e3 100644 --- a/test/types/mongodb.test-d.ts +++ b/test/types/mongodb.test-d.ts @@ -20,7 +20,7 @@ import { type WithId, type WriteConcern, type WriteConcernSettings -} from '../../src'; +} from '../mongodb'; // We wish to keep these APIs but continue to ensure they are marked as deprecated. expectDeprecated(Collection.prototype.count); diff --git a/test/types/schema_helpers.test-d.ts b/test/types/schema_helpers.test-d.ts index 8c7ca305661..c769729510c 100644 --- a/test/types/schema_helpers.test-d.ts +++ b/test/types/schema_helpers.test-d.ts @@ -9,7 +9,7 @@ import type { OptionalUnlessRequiredId, WithId, WithoutId -} from '../../src'; +} from '../mongodb'; /** ---------------------------------------------------------------------- * InferIdType diff --git a/test/types/sessions.test-d.ts b/test/types/sessions.test-d.ts index ea39fb6b714..0945f26093b 100644 --- a/test/types/sessions.test-d.ts +++ b/test/types/sessions.test-d.ts @@ -9,7 +9,7 @@ import { ReadConcern, ReadConcernLevel, type Timestamp -} from '../../src'; +} from '../mongodb'; // test mapped cursor types const client = new MongoClient(''); diff --git a/test/types/sort.test-d.ts b/test/types/sort.test-d.ts index 87f91283349..63f7bc3efe7 100644 --- a/test/types/sort.test-d.ts +++ b/test/types/sort.test-d.ts @@ -6,7 +6,7 @@ import { type MongoClient, ObjectId, type Sort -} from '../../src'; +} from '../mongodb'; const sortFieldName: Sort = 'a'; const sortFieldNameObject: Sort = { a: 1, b: -1 }; diff --git a/test/types/type_errors.test-d.ts b/test/types/type_errors.test-d.ts index 5335785ad4e..f29fa8540ee 100644 --- a/test/types/type_errors.test-d.ts +++ b/test/types/type_errors.test-d.ts @@ -1,4 +1,4 @@ -import { MongoClient } from '../../src'; +import { MongoClient } from '../mongodb'; /** * This test file should contain examples of known compilation errors diff --git a/test/types/union_schema.test-d.ts b/test/types/union_schema.test-d.ts index 83b4d7c8c9f..efdbf19e6fb 100644 --- a/test/types/union_schema.test-d.ts +++ b/test/types/union_schema.test-d.ts @@ -1,6 +1,6 @@ import { expectAssignable, expectError, expectNotAssignable, expectNotType, expectType } from 'tsd'; -import { type Collection, type Document, ObjectId, type WithId } from '../../src'; +import { type Collection, type Document, ObjectId, type WithId } from '../mongodb'; type InsertOneFirstParam = Parameters['insertOne']>[0]; diff --git a/test/types/write_concern.test-d.ts b/test/types/write_concern.test-d.ts index 8564eee5c87..2b10824a1c6 100644 --- a/test/types/write_concern.test-d.ts +++ b/test/types/write_concern.test-d.ts @@ -6,7 +6,7 @@ import type { ListCollectionsOptions, ListIndexesOptions, WriteConcern -} from '../../src'; +} from '../mongodb'; expectNotAssignable({ writeConcern: { w: 0 } }); expectNotAssignable({ writeConcern: { w: 0 } }); diff --git a/test/unit/assorted/client.test.js b/test/unit/assorted/client.test.js index 9013069e24b..ec9b82237a9 100644 --- a/test/unit/assorted/client.test.js +++ b/test/unit/assorted/client.test.js @@ -2,8 +2,7 @@ const { expect } = require('chai'); const mock = require('../../tools/mongodb-mock/index'); -const { isHello } = require('../../../src/utils'); -const { MongoClient } = require('../../../src/mongo_client'); +const { isHello, MongoClient } = require('../../mongodb'); describe('Client (unit)', function () { let server, client; diff --git a/test/unit/assorted/collations.test.js b/test/unit/assorted/collations.test.js index 6efc253c93b..8a245a0288d 100644 --- a/test/unit/assorted/collations.test.js +++ b/test/unit/assorted/collations.test.js @@ -1,9 +1,7 @@ 'use strict'; const mock = require('../../tools/mongodb-mock/index'); const { expect } = require('chai'); -const { Long } = require('../../../src/bson'); -const { isHello } = require('../../../src/utils'); -const { MongoClient } = require('../../../src/mongo_client'); +const { Long, isHello, MongoClient } = require('../../mongodb'); const testContext = {}; describe('Collation', function () { diff --git a/test/unit/assorted/max_staleness.spec.test.js b/test/unit/assorted/max_staleness.spec.test.js index 582787ce9ea..37ea4da2939 100644 --- a/test/unit/assorted/max_staleness.spec.test.js +++ b/test/unit/assorted/max_staleness.spec.test.js @@ -2,7 +2,7 @@ const path = require('path'); const fs = require('fs'); const { executeServerSelectionTest } = require('./server_selection_spec_helper'); -const { Server } = require('../../../src/sdam/server'); +const { Server } = require('../../mongodb'); const { EJSON } = require('bson'); diff --git a/test/unit/assorted/optional_require.test.ts b/test/unit/assorted/optional_require.test.ts index 463f7f95ffb..95145391186 100644 --- a/test/unit/assorted/optional_require.test.ts +++ b/test/unit/assorted/optional_require.test.ts @@ -2,11 +2,13 @@ import { expect } from 'chai'; import { existsSync } from 'fs'; import { resolve } from 'path'; -import { AuthContext } from '../../../src/cmap/auth/auth_provider'; -import { GSSAPI } from '../../../src/cmap/auth/gssapi'; -import { compress } from '../../../src/cmap/wire_protocol/compression'; -import { MongoMissingDependencyError } from '../../../src/error'; -import { HostAddress } from '../../../src/utils'; +import { + AuthContext, + compress, + GSSAPI, + HostAddress, + MongoMissingDependencyError +} from '../../mongodb'; import { runtime } from '../../tools/utils'; function moduleExistsSync(moduleName) { diff --git a/test/unit/assorted/polling_srv_records_for_mongos_discovery.prose.test.ts b/test/unit/assorted/polling_srv_records_for_mongos_discovery.prose.test.ts index 4db98a5c7db..13cceae3dad 100644 --- a/test/unit/assorted/polling_srv_records_for_mongos_discovery.prose.test.ts +++ b/test/unit/assorted/polling_srv_records_for_mongos_discovery.prose.test.ts @@ -5,11 +5,17 @@ import * as process from 'process'; import { satisfies } from 'semver'; import * as sinon from 'sinon'; -import { MongoClient } from '../../../src/mongo_client'; -import { TopologyType } from '../../../src/sdam/common'; -import { SrvPoller, type SrvPollerOptions, SrvPollingEvent } from '../../../src/sdam/srv_polling'; -import type { Topology, TopologyOptions } from '../../../src/sdam/topology'; -import { HostAddress, isHello } from '../../../src/utils'; +import { + HostAddress, + isHello, + MongoClient, + SrvPoller, + type SrvPollerOptions, + SrvPollingEvent, + type Topology, + type TopologyOptions, + TopologyType +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import type { MockServer } from '../../tools/mongodb-mock/src/server'; import { processTick, topologyWithPlaceholderClient } from '../../tools/utils'; diff --git a/test/unit/assorted/scram_iterations.test.ts b/test/unit/assorted/scram_iterations.test.ts index c28c6cf30be..106550ae106 100644 --- a/test/unit/assorted/scram_iterations.test.ts +++ b/test/unit/assorted/scram_iterations.test.ts @@ -1,9 +1,12 @@ import { expect } from 'chai'; -import { MongoCredentials } from '../../../src/cmap/auth/mongo_credentials'; -import { MongoNetworkError, MongoRuntimeError } from '../../../src/error'; -import { MongoClient } from '../../../src/mongo_client'; -import { isHello } from '../../../src/utils'; +import { + isHello, + MongoClient, + MongoCredentials, + MongoNetworkError, + MongoRuntimeError +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; describe('SCRAM Iterations Tests', function () { diff --git a/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts b/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts index e86afa05cb6..7012836395b 100644 --- a/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts +++ b/test/unit/assorted/server_discovery_and_monitoring.spec.test.ts @@ -4,43 +4,42 @@ import * as fs from 'fs'; import * as path from 'path'; import * as sinon from 'sinon'; -import { Connection } from '../../../src/cmap/connection'; -import { ConnectionPool } from '../../../src/cmap/connection_pool'; import { + Connection, + ConnectionPool, HEARTBEAT_EVENTS, + isRecord, LEGACY_HELLO_COMMAND, - SERVER_CLOSED, - SERVER_DESCRIPTION_CHANGED, - SERVER_OPENING, - TOPOLOGY_CLOSED, - TOPOLOGY_DESCRIPTION_CHANGED, - TOPOLOGY_OPENING -} from '../../../src/constants'; -import { + MongoClient, MongoCompatibilityError, MongoError, MongoNetworkError, MongoNetworkTimeoutError, - MongoServerError -} from '../../../src/error'; -import { MongoClient } from '../../../src/mongo_client'; -import { RunCommandOperation } from '../../../src/operations/run_command'; -import { + MongoServerError, + ns, + RunCommandOperation, + Server, + SERVER_CLOSED, + SERVER_DESCRIPTION_CHANGED, + SERVER_OPENING, ServerClosedEvent, + ServerDescription, ServerDescriptionChangedEvent, ServerHeartbeatFailedEvent, ServerHeartbeatStartedEvent, ServerHeartbeatSucceededEvent, ServerOpeningEvent, + squashError, + TimeoutContext, + Topology, + TOPOLOGY_CLOSED, + TOPOLOGY_DESCRIPTION_CHANGED, + TOPOLOGY_OPENING, TopologyClosedEvent, TopologyDescriptionChangedEvent, - TopologyOpeningEvent -} from '../../../src/sdam/events'; -import { Server } from '../../../src/sdam/server'; -import { ServerDescription, type TopologyVersion } from '../../../src/sdam/server_description'; -import { Topology } from '../../../src/sdam/topology'; -import { TimeoutContext } from '../../../src/timeout'; -import { isRecord, ns, squashError } from '../../../src/utils'; + TopologyOpeningEvent, + type TopologyVersion +} from '../../mongodb'; import { ejson, fakeServer } from '../../tools/utils'; const SDAM_EVENT_CLASSES = { diff --git a/test/unit/assorted/server_discovery_and_monitoring.test.ts b/test/unit/assorted/server_discovery_and_monitoring.test.ts index b3db313ea7e..a00f8477392 100644 --- a/test/unit/assorted/server_discovery_and_monitoring.test.ts +++ b/test/unit/assorted/server_discovery_and_monitoring.test.ts @@ -2,12 +2,14 @@ import { ObjectId } from 'bson'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { MongoClient } from '../../../src/mongo_client'; -import { type TopologyDescriptionChangedEvent } from '../../../src/sdam/events'; -import { Server } from '../../../src/sdam/server'; -import { ServerDescription } from '../../../src/sdam/server_description'; -import { Topology } from '../../../src/sdam/topology'; -import { type TopologyDescription } from '../../../src/sdam/topology_description'; +import { + MongoClient, + Server, + ServerDescription, + Topology, + type TopologyDescription, + type TopologyDescriptionChangedEvent +} from '../../mongodb'; import { fakeServer } from '../../tools/utils'; describe('Server Discovery and Monitoring', function () { diff --git a/test/unit/assorted/server_selection.spec.test.ts b/test/unit/assorted/server_selection.spec.test.ts index 46ce5bbd677..44707aa7580 100644 --- a/test/unit/assorted/server_selection.spec.test.ts +++ b/test/unit/assorted/server_selection.spec.test.ts @@ -1,7 +1,7 @@ import { join, resolve } from 'path'; import * as sinon from 'sinon'; -import { Server } from '../../../src/sdam/server'; +import { Server } from '../../mongodb'; import { loadLatencyWindowTests, runServerSelectionLatencyWindowTest diff --git a/test/unit/assorted/server_selection_latency_window_utils.ts b/test/unit/assorted/server_selection_latency_window_utils.ts index 2b6a38392f9..47526deb19e 100644 --- a/test/unit/assorted/server_selection_latency_window_utils.ts +++ b/test/unit/assorted/server_selection_latency_window_utils.ts @@ -3,11 +3,15 @@ import { expect } from 'chai'; import { readdirSync, readFileSync } from 'fs'; import { join } from 'path'; -import { ReadPreference } from '../../../src/read_preference'; -import { type ServerType, STATE_CONNECTED, type TopologyType } from '../../../src/sdam/common'; -import { type Server } from '../../../src/sdam/server'; -import { DeprioritizedServers } from '../../../src/sdam/server_selection'; -import { type Topology } from '../../../src/sdam/topology'; +import { + DeprioritizedServers, + ReadPreference, + type Server, + type ServerType, + STATE_CONNECTED, + type Topology, + type TopologyType +} from '../../mongodb'; import { topologyWithPlaceholderClient } from '../../tools/utils'; import { serverDescriptionFromDefinition } from './server_selection_spec_helper'; diff --git a/test/unit/assorted/server_selection_logic_spec_utils.ts b/test/unit/assorted/server_selection_logic_spec_utils.ts index 685da3a1102..82a57346b5f 100644 --- a/test/unit/assorted/server_selection_logic_spec_utils.ts +++ b/test/unit/assorted/server_selection_logic_spec_utils.ts @@ -4,19 +4,19 @@ import { readdirSync, readFileSync, statSync } from 'fs'; import { basename, extname, join } from 'path'; import { + DeprioritizedServers, ReadPreference, type ReadPreferenceMode, - type ReadPreferenceOptions -} from '../../../src/read_preference'; -import { type ServerType, type TopologyType } from '../../../src/sdam/common'; -import { type ServerDescription, type TagSet } from '../../../src/sdam/server_description'; -import { - DeprioritizedServers, + type ReadPreferenceOptions, readPreferenceServerSelector, + type ServerDescription, type ServerSelector, + type ServerType, + type TagSet, + TopologyDescription, + type TopologyType, writableServerSelector -} from '../../../src/sdam/server_selection'; -import { TopologyDescription } from '../../../src/sdam/topology_description'; +} from '../../mongodb'; import { serverDescriptionFromDefinition } from './server_selection_spec_helper'; interface ServerSelectionLogicTestServer { diff --git a/test/unit/assorted/server_selection_spec_helper.js b/test/unit/assorted/server_selection_spec_helper.js index ea294df6d57..573788c9e7d 100644 --- a/test/unit/assorted/server_selection_spec_helper.js +++ b/test/unit/assorted/server_selection_spec_helper.js @@ -1,11 +1,14 @@ 'use strict'; -const { MongoServerSelectionError } = require('../../../src/error'); -const { ReadPreference } = require('../../../src/read_preference'); -const { ServerType, TopologyType } = require('../../../src/sdam/common'); -const { ServerDescription } = require('../../../src/sdam/server_description'); -const { Topology } = require('../../../src/sdam/topology'); -const ServerSelectors = require('../../../src/sdam/server_selection'); +const { + MongoServerSelectionError, + ReadPreference, + ServerType, + TopologyType, + ServerDescription, + Topology +} = require('../../mongodb'); +const ServerSelectors = require('../../mongodb'); const sinon = require('sinon'); const { expect } = require('chai'); diff --git a/test/unit/assorted/sessions_client.test.js b/test/unit/assorted/sessions_client.test.js index 8f4eabc6353..574a0007d19 100644 --- a/test/unit/assorted/sessions_client.test.js +++ b/test/unit/assorted/sessions_client.test.js @@ -3,8 +3,7 @@ const expect = require('chai').expect; const mock = require('../../tools/mongodb-mock/index'); const { ReplSetFixture } = require('../../tools/common'); -const { isHello } = require('../../../src/utils'); -const { MongoClient } = require('../../../src/mongo_client'); +const { isHello, MongoClient } = require('../../mongodb'); const test = {}; describe('Sessions - client/unit', function () { diff --git a/test/unit/assorted/sessions_collection.test.js b/test/unit/assorted/sessions_collection.test.js index 0593ab8c42a..e7711efb6b5 100644 --- a/test/unit/assorted/sessions_collection.test.js +++ b/test/unit/assorted/sessions_collection.test.js @@ -2,8 +2,8 @@ const { Timestamp } = require('bson'); const { expect } = require('chai'); const mock = require('../../tools/mongodb-mock/index'); -const { isHello } = require('../../../src/utils'); -const { MongoClient } = require('../../../src'); +const { isHello } = require('../../mongodb'); +const { MongoClient } = require('../../mongodb'); const test = {}; describe('Sessions - unit/sessions', function () { diff --git a/test/unit/assorted/wire_version.test.ts b/test/unit/assorted/wire_version.test.ts index 4bbab4fde5e..448622ce20f 100644 --- a/test/unit/assorted/wire_version.test.ts +++ b/test/unit/assorted/wire_version.test.ts @@ -1,11 +1,12 @@ import { expect } from 'chai'; -import { MongoClient, MongoServerSelectionError } from '../../../src'; import { + isHello, MAX_SUPPORTED_WIRE_VERSION, - MIN_SUPPORTED_WIRE_VERSION -} from '../../../src/cmap/wire_protocol/constants'; -import { isHello } from '../../../src/utils'; + MIN_SUPPORTED_WIRE_VERSION, + MongoClient, + MongoServerSelectionError +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; const minCompatErrMsg = `minimum wire version ${ diff --git a/test/unit/assorted/write_concern.test.js b/test/unit/assorted/write_concern.test.js index ed0368b5c95..f2afbf80322 100644 --- a/test/unit/assorted/write_concern.test.js +++ b/test/unit/assorted/write_concern.test.js @@ -2,9 +2,7 @@ const mock = require('../../tools/mongodb-mock/index'); const { expect } = require('chai'); -const { isHello } = require('../../../src/utils'); -const { LEGACY_HELLO_COMMAND } = require('../../../src/constants'); -const { MongoClient } = require('../../../src/mongo_client'); +const { isHello, LEGACY_HELLO_COMMAND, MongoClient } = require('../../mongodb'); const { ObjectId } = require('bson'); const TEST_OPTIONS = { writeConcern: { w: 2, wtimeoutMS: 1000 } }; diff --git a/test/unit/aws4.test.ts b/test/unit/aws4.test.ts index 11e69bb76df..b894a6452b8 100644 --- a/test/unit/aws4.test.ts +++ b/test/unit/aws4.test.ts @@ -2,7 +2,7 @@ import * as aws4sign from 'aws4'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { aws4Sign, type AwsSigv4Options } from '../../src/cmap/auth/aws4'; +import { aws4Sign, type AwsSigv4Options } from '../mongodb'; describe('Verify AWS4 signature generation', () => { const date = new Date('2025-12-15T12:34:56Z'); diff --git a/test/unit/change_stream.test.ts b/test/unit/change_stream.test.ts index cefdd58a482..2eac004f3da 100644 --- a/test/unit/change_stream.test.ts +++ b/test/unit/change_stream.test.ts @@ -2,10 +2,7 @@ import { Long, Timestamp } from 'bson'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { filterOutOptions } from '../../src/change_stream'; -import { ChangeStreamCursor } from '../../src/cursor/change_stream_cursor'; -import { MongoClient } from '../../src/mongo_client'; -import { MongoDBNamespace } from '../../src/utils'; +import { ChangeStreamCursor, filterOutOptions, MongoClient, MongoDBNamespace } from '../mongodb'; describe('ChangeStreamCursor', function () { afterEach(function () { diff --git a/test/unit/client-side-encryption/auto_encrypter.test.ts b/test/unit/client-side-encryption/auto_encrypter.test.ts index 106b995e968..17fe6436b39 100644 --- a/test/unit/client-side-encryption/auto_encrypter.test.ts +++ b/test/unit/client-side-encryption/auto_encrypter.test.ts @@ -5,11 +5,13 @@ import * as net from 'net'; import * as process from 'process'; import * as sinon from 'sinon'; -import { AutoEncrypter } from '../../../src/client-side-encryption/auto_encrypter'; -import { type DataKey } from '../../../src/client-side-encryption/client_encryption'; -import { MongocryptdManager } from '../../../src/client-side-encryption/mongocryptd_manager'; -import { StateMachine } from '../../../src/client-side-encryption/state_machine'; -import { MongoClient } from '../../../src/mongo_client'; +import { + AutoEncrypter, + type DataKey, + MongoClient, + MongocryptdManager, + StateMachine +} from '../../mongodb'; import * as requirements from './requirements.helper'; const bson = BSON; diff --git a/test/unit/client-side-encryption/client_encryption.test.ts b/test/unit/client-side-encryption/client_encryption.test.ts index 1f9c416c136..7914c6ae328 100644 --- a/test/unit/client-side-encryption/client_encryption.test.ts +++ b/test/unit/client-side-encryption/client_encryption.test.ts @@ -2,13 +2,12 @@ import { Binary } from 'bson'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption'; import { + ClientEncryption, + MongoClient, MongoCryptCreateDataKeyError, MongoCryptCreateEncryptedCollectionError -} from '../../../src/client-side-encryption/errors'; -import { MongoClient } from '../../../src/mongo_client'; - +} from '../../mongodb'; class MockClient { options: any; s: { options: any }; diff --git a/test/unit/client-side-encryption/errors.test.ts b/test/unit/client-side-encryption/errors.test.ts index 885fc7dab85..13e3490b2ac 100644 --- a/test/unit/client-side-encryption/errors.test.ts +++ b/test/unit/client-side-encryption/errors.test.ts @@ -5,10 +5,9 @@ import { MongoCryptCreateDataKeyError, MongoCryptCreateEncryptedCollectionError, MongoCryptError, - MongoCryptInvalidArgumentError -} from '../../../src/client-side-encryption/errors'; -import { MongoError } from '../../../src/error'; - + MongoCryptInvalidArgumentError, + MongoError +} from '../../mongodb'; describe('MongoCryptError', function () { const errors = [ new MongoCryptAzureKMSRequestError(''), diff --git a/test/unit/client-side-encryption/mongocryptd_manager.test.ts b/test/unit/client-side-encryption/mongocryptd_manager.test.ts index eb199eb7c26..cb9774375cb 100644 --- a/test/unit/client-side-encryption/mongocryptd_manager.test.ts +++ b/test/unit/client-side-encryption/mongocryptd_manager.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { MongocryptdManager } from '../../../src/client-side-encryption/mongocryptd_manager'; +import { MongocryptdManager } from '../../mongodb'; describe('MongocryptdManager', function () { it('should default to having spawnArgs of --idleShutdownTimeoutSecs=60', function () { diff --git a/test/unit/client-side-encryption/providers/credentialsProvider.test.ts b/test/unit/client-side-encryption/providers/credentialsProvider.test.ts index 4b1e06528aa..7e8ce19ebbc 100644 --- a/test/unit/client-side-encryption/providers/credentialsProvider.test.ts +++ b/test/unit/client-side-encryption/providers/credentialsProvider.test.ts @@ -3,19 +3,19 @@ import * as http from 'http'; import * as process from 'process'; import * as sinon from 'sinon'; -import { MongoCryptAzureKMSRequestError } from '../../../../src/client-side-encryption/errors'; +// Intentionally import from src, because we need to stub the `get()` function. +// eslint-disable-next-line @typescript-eslint/no-restricted-imports +import * as utils from '../../../../src/utils'; import { + AWSSDKCredentialProvider, + fetchAzureKMSToken, isEmptyCredentials, type KMSProviders, - refreshKMSCredentials -} from '../../../../src/client-side-encryption/providers'; -import { - fetchAzureKMSToken, + MongoCryptAzureKMSRequestError, + MongoNetworkTimeoutError, + refreshKMSCredentials, tokenCache -} from '../../../../src/client-side-encryption/providers/azure'; -import { AWSSDKCredentialProvider } from '../../../../src/cmap/auth/aws_temporary_credentials'; -import { MongoNetworkTimeoutError } from '../../../../src/error'; -import * as utils from '../../../../src/utils'; +} from '../../../mongodb'; import * as requirements from '../requirements.helper'; const originalAccessKeyId = process.env.AWS_ACCESS_KEY_ID; diff --git a/test/unit/client-side-encryption/requirements.helper.ts b/test/unit/client-side-encryption/requirements.helper.ts index c9f3c435659..ce4963358f1 100644 --- a/test/unit/client-side-encryption/requirements.helper.ts +++ b/test/unit/client-side-encryption/requirements.helper.ts @@ -1,6 +1,6 @@ import * as process from 'process'; -import { getAwsCredentialProvider, getGcpMetadata } from '../../../src/deps'; +import { getAwsCredentialProvider, getGcpMetadata } from '../../mongodb'; // Data Key Stuff export const AWS_ACCESS_KEY_ID = process.env.AWS_ACCESS_KEY_ID; diff --git a/test/unit/client-side-encryption/state_machine.test.ts b/test/unit/client-side-encryption/state_machine.test.ts index 1ce00c011e1..0060954c31a 100644 --- a/test/unit/client-side-encryption/state_machine.test.ts +++ b/test/unit/client-side-encryption/state_machine.test.ts @@ -8,14 +8,16 @@ import * as sinon from 'sinon'; import { setTimeout as setTimeoutAsync } from 'timers/promises'; import * as tls from 'tls'; -import { StateMachine } from '../../../src/client-side-encryption/state_machine'; -import { Collection } from '../../../src/collection'; -import { CursorTimeoutContext } from '../../../src/cursor/abstract_cursor'; -import { Db } from '../../../src/db'; -import { MongoClient } from '../../../src/mongo_client'; -import { type FindOptions } from '../../../src/operations/find'; -import { CSOTTimeoutContext } from '../../../src/timeout'; -import { squashError } from '../../../src/utils'; +import { + Collection, + CSOTTimeoutContext, + CursorTimeoutContext, + Db, + type FindOptions, + MongoClient, + squashError, + StateMachine +} from '../../mongodb'; import { sleep } from '../../tools/utils'; describe('StateMachine', function () { diff --git a/test/unit/cmap/auth/auth_provider.test.ts b/test/unit/cmap/auth/auth_provider.test.ts index 067a691dd5d..7c9b530e69f 100644 --- a/test/unit/cmap/auth/auth_provider.test.ts +++ b/test/unit/cmap/auth/auth_provider.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { type AuthContext, AuthProvider } from '../../../../src/cmap/auth/auth_provider'; -import { MongoRuntimeError } from '../../../../src/error'; +import { type AuthContext, AuthProvider, MongoRuntimeError } from '../../../mongodb'; describe('AuthProvider', function () { describe('#reauth', function () { diff --git a/test/unit/cmap/auth/gssapi.test.ts b/test/unit/cmap/auth/gssapi.test.ts index 9df2500b8e0..1d803a05528 100644 --- a/test/unit/cmap/auth/gssapi.test.ts +++ b/test/unit/cmap/auth/gssapi.test.ts @@ -6,7 +6,7 @@ import { GSSAPICanonicalizationValue, performGSSAPICanonicalizeHostName, resolveCname -} from '../../../../src/cmap/auth/gssapi'; +} from '../../../mongodb'; describe('GSSAPI', () => { let lookupSpy; diff --git a/test/unit/cmap/auth/mongodb_oidc/automated_callback_workflow.test.ts b/test/unit/cmap/auth/mongodb_oidc/automated_callback_workflow.test.ts index 017387685b8..49d925b0b1d 100644 --- a/test/unit/cmap/auth/mongodb_oidc/automated_callback_workflow.test.ts +++ b/test/unit/cmap/auth/mongodb_oidc/automated_callback_workflow.test.ts @@ -1,12 +1,14 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { MongoCredentials } from '../../../../../src/cmap/auth/mongo_credentials'; -import { AutomatedCallbackWorkflow } from '../../../../../src/cmap/auth/mongodb_oidc/automated_callback_workflow'; -import { CallbackWorkflow } from '../../../../../src/cmap/auth/mongodb_oidc/callback_workflow'; -import { callback } from '../../../../../src/cmap/auth/mongodb_oidc/gcp_machine_workflow'; -import { TokenCache } from '../../../../../src/cmap/auth/mongodb_oidc/token_cache'; -import { Connection } from '../../../../../src/cmap/connection'; +import { + AutomatedCallbackWorkflow, + CallbackWorkflow, + Connection, + gcpCallback, + MongoCredentials, + TokenCache +} from '../../../../mongodb'; describe('AutomatedCallbackWorkflow', function () { describe('#execute', function () { @@ -20,7 +22,7 @@ describe('AutomatedCallbackWorkflow', function () { const connection = sandbox.createStubInstance(Connection); const credentials = sandbox.createStubInstance(MongoCredentials); sandbox.stub(CallbackWorkflow.prototype, 'finishAuthentication').resolves(); - const workflow = new AutomatedCallbackWorkflow(cache, callback); + const workflow = new AutomatedCallbackWorkflow(cache, gcpCallback); beforeEach(function () { cache.put({ accessToken: 'test', expiresInSeconds: 7200 }); diff --git a/test/unit/cmap/auth/mongodb_oidc/azure_machine_workflow.test.ts b/test/unit/cmap/auth/mongodb_oidc/azure_machine_workflow.test.ts index 26d0795cd11..5deac2fe495 100644 --- a/test/unit/cmap/auth/mongodb_oidc/azure_machine_workflow.test.ts +++ b/test/unit/cmap/auth/mongodb_oidc/azure_machine_workflow.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { OIDC_VERSION, type OIDCCallbackParams } from '../../../../../src/cmap/auth/mongodb_oidc'; -import { callback } from '../../../../../src/cmap/auth/mongodb_oidc/azure_machine_workflow'; +import { azureCallback, OIDC_VERSION, type OIDCCallbackParams } from '../../../../mongodb'; describe('Azure machine workflow', function () { describe('#callback', function () { @@ -13,7 +12,7 @@ describe('Azure machine workflow', function () { }; it('throws an error', async function () { - const error = await callback(params).catch(error => error); + const error = await azureCallback(params).catch(error => error); expect(error.message).to.include('TOKEN_RESOURCE'); }); }); diff --git a/test/unit/cmap/auth/mongodb_oidc/gcp_machine_workflow.test.ts b/test/unit/cmap/auth/mongodb_oidc/gcp_machine_workflow.test.ts index 56f1ed673d7..403c05ff360 100644 --- a/test/unit/cmap/auth/mongodb_oidc/gcp_machine_workflow.test.ts +++ b/test/unit/cmap/auth/mongodb_oidc/gcp_machine_workflow.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { OIDC_VERSION, type OIDCCallbackParams } from '../../../../../src/cmap/auth/mongodb_oidc'; -import { callback } from '../../../../../src/cmap/auth/mongodb_oidc/gcp_machine_workflow'; +import { gcpCallback, OIDC_VERSION, type OIDCCallbackParams } from '../../../../mongodb'; describe('GCP machine workflow', function () { describe('#callback', function () { @@ -13,7 +12,7 @@ describe('GCP machine workflow', function () { }; it('throws an error', async function () { - const error = await callback(params).catch(error => error); + const error = await gcpCallback(params).catch(error => error); expect(error.message).to.include('TOKEN_RESOURCE'); }); }); diff --git a/test/unit/cmap/auth/mongodb_oidc/token_machine_workflow.test.ts b/test/unit/cmap/auth/mongodb_oidc/token_machine_workflow.test.ts index b3427ac9c66..75870c5e417 100644 --- a/test/unit/cmap/auth/mongodb_oidc/token_machine_workflow.test.ts +++ b/test/unit/cmap/auth/mongodb_oidc/token_machine_workflow.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import * as process from 'process'; -import { callback } from '../../../../../src/cmap/auth/mongodb_oidc/token_machine_workflow'; +import { tokenMachineCallback } from '../../../../mongodb'; describe('Token machine workflow', function () { describe('#callback', function () { @@ -20,7 +20,7 @@ describe('Token machine workflow', function () { }); it('throws an error', async function () { - const error = await callback().catch(error => error); + const error = await tokenMachineCallback().catch(error => error); expect(error.message).to.include('OIDC_TOKEN_FILE'); }); }); diff --git a/test/unit/cmap/command_monitoring_events.test.js b/test/unit/cmap/command_monitoring_events.test.js index 8ae42bb32bf..ae5dcfa57ed 100644 --- a/test/unit/cmap/command_monitoring_events.test.js +++ b/test/unit/cmap/command_monitoring_events.test.js @@ -1,7 +1,6 @@ 'use strict'; -const { OpQueryRequest, OpMsgRequest } = require('../../../src/cmap/commands'); -const { CommandStartedEvent } = require('../../../src/cmap/command_monitoring_events'); +const { OpQueryRequest, OpMsgRequest, CommandStartedEvent } = require('../../mongodb'); const { expect } = require('chai'); describe('Command Monitoring Events - unit/cmap', function () { diff --git a/test/unit/cmap/commands.test.ts b/test/unit/cmap/commands.test.ts index 7666a4a6552..5725f5b2490 100644 --- a/test/unit/cmap/commands.test.ts +++ b/test/unit/cmap/commands.test.ts @@ -1,7 +1,7 @@ import * as BSON from 'bson'; import { expect } from 'chai'; -import { DocumentSequence, OpMsgRequest, OpReply } from '../../../src/cmap/commands'; +import { DocumentSequence, OpMsgRequest, OpReply } from '../../mongodb'; describe('commands', function () { describe('OpMsgRequest', function () { diff --git a/test/unit/cmap/connect.test.ts b/test/unit/cmap/connect.test.ts index cd205de976c..5a8e8baafc3 100644 --- a/test/unit/cmap/connect.test.ts +++ b/test/unit/cmap/connect.test.ts @@ -1,18 +1,21 @@ import { expect } from 'chai'; import * as process from 'process'; -import { MongoCredentials } from '../../../src/cmap/auth/mongo_credentials'; -import { connect, prepareHandshakeDocument } from '../../../src/cmap/connect'; -import { type Connection, type ConnectionOptions } from '../../../src/cmap/connection'; import { + CancellationToken, type ClientMetadata, - makeClientMetadata -} from '../../../src/cmap/handshake/client_metadata'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; -import { MongoNetworkError } from '../../../src/error'; -import { MongoClientAuthProviders } from '../../../src/mongo_client_auth_providers'; -import { CancellationToken } from '../../../src/mongo_types'; -import { HostAddress, isHello } from '../../../src/utils'; + connect, + type Connection, + type ConnectionOptions, + HostAddress, + isHello, + LEGACY_HELLO_COMMAND, + makeClientMetadata, + MongoClientAuthProviders, + MongoCredentials, + MongoNetworkError, + prepareHandshakeDocument +} from '../../mongodb'; import { genClusterTime } from '../../tools/common'; import * as mock from '../../tools/mongodb-mock/index'; import { runtime } from '../../tools/utils'; diff --git a/test/unit/cmap/connection.test.ts b/test/unit/cmap/connection.test.ts index 779a3208726..c55caac422d 100644 --- a/test/unit/cmap/connection.test.ts +++ b/test/unit/cmap/connection.test.ts @@ -5,18 +5,21 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; import { setTimeout } from 'timers/promises'; -import { connect } from '../../../src/cmap/connect'; -import { Connection, CryptoConnection, SizedMessageTransform } from '../../../src/cmap/connection'; -import { MongoNetworkTimeoutError, MongoRuntimeError } from '../../../src/error'; -import { MongoClientAuthProviders } from '../../../src/mongo_client_auth_providers'; import { + connect, + Connection, + CryptoConnection, HostAddress, isHello, + MongoClientAuthProviders, MongoDBCollectionNamespace, MongoDBNamespace, + MongoNetworkTimeoutError, + MongoRuntimeError, ns, - promiseWithResolvers -} from '../../../src/utils'; + promiseWithResolvers, + SizedMessageTransform +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; const connectionOptionsDefaults = { diff --git a/test/unit/cmap/connection_pool.test.js b/test/unit/cmap/connection_pool.test.js index 81bff92d0fd..54307980dd3 100644 --- a/test/unit/cmap/connection_pool.test.js +++ b/test/unit/cmap/connection_pool.test.js @@ -1,18 +1,20 @@ 'use strict'; -const { ConnectionPool } = require('../../../src/cmap/connection_pool'); -const { MongoError } = require('../../../src/error'); -const { WaitQueueTimeoutError } = require('../../../src/cmap/errors'); +const { + ConnectionPool, + MongoError, + WaitQueueTimeoutError, + isHello, + ns, + MongoClientAuthProviders, + TimeoutContext +} = require('../../mongodb'); const mock = require('../../tools/mongodb-mock/index'); const sinon = require('sinon'); const { expect } = require('chai'); const { setImmediate } = require('timers/promises'); -const { isHello } = require('../../../src/utils'); -const { ns } = require('../../../src/utils'); const { createTimerSandbox } = require('../timer_sandbox'); const { topologyWithPlaceholderClient } = require('../../tools/utils'); -const { MongoClientAuthProviders } = require('../../../src/mongo_client_auth_providers'); -const { TimeoutContext } = require('../../../src/timeout'); describe('Connection Pool', function () { let timeoutContext; diff --git a/test/unit/cmap/connection_pool_events.test.ts b/test/unit/cmap/connection_pool_events.test.ts index 5281f66f9ec..54337fbaa27 100644 --- a/test/unit/cmap/connection_pool_events.test.ts +++ b/test/unit/cmap/connection_pool_events.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { type ConnectionPool } from '../../../src/cmap/connection_pool'; -import { ConnectionPoolCreatedEvent } from '../../../src/cmap/connection_pool_events'; +import { type ConnectionPool, ConnectionPoolCreatedEvent } from '../../mongodb'; describe('Connection Pool Events', function () { const connectionPoolMock = { diff --git a/test/unit/cmap/handshake/client_metadata.test.ts b/test/unit/cmap/handshake/client_metadata.test.ts index a7c5e864d7e..0915f2e2bd5 100644 --- a/test/unit/cmap/handshake/client_metadata.test.ts +++ b/test/unit/cmap/handshake/client_metadata.test.ts @@ -9,11 +9,10 @@ import { version as NODE_DRIVER_VERSION } from '../../../../package.json'; import { getFAASEnv, LimitedSizeDocument, - makeClientMetadata -} from '../../../../src/cmap/handshake/client_metadata'; -import { MongoInvalidArgumentError } from '../../../../src/error'; + makeClientMetadata, + MongoInvalidArgumentError +} from '../../../mongodb'; import { runtime } from '../../../tools/utils'; - describe('client metadata module', () => { afterEach(() => sinon.restore()); diff --git a/test/unit/cmap/metrics.test.js b/test/unit/cmap/metrics.test.js index 50e2fc3d4e0..bef221121f6 100644 --- a/test/unit/cmap/metrics.test.js +++ b/test/unit/cmap/metrics.test.js @@ -1,7 +1,7 @@ 'use strict'; const { expect } = require('chai'); -const { ConnectionPoolMetrics } = require('../../../src/cmap/metrics'); +const { ConnectionPoolMetrics } = require('../../mongodb'); describe('ConnectionPoolMetrics', function () { describe('#constructor', function () { diff --git a/test/unit/cmap/stream_description.test.js b/test/unit/cmap/stream_description.test.js index 8af7ba85947..687a0342053 100644 --- a/test/unit/cmap/stream_description.test.js +++ b/test/unit/cmap/stream_description.test.js @@ -1,7 +1,7 @@ 'use strict'; const { Double, Long } = require('bson'); -const { StreamDescription } = require('../../../src/cmap/stream_description'); +const { StreamDescription } = require('../../mongodb'); const { expect } = require('chai'); describe('StreamDescription - unit/cmap', function () { diff --git a/test/unit/cmap/wire_protocol/compression.test.ts b/test/unit/cmap/wire_protocol/compression.test.ts index 77aec98e457..e67fa0afb7b 100644 --- a/test/unit/cmap/wire_protocol/compression.test.ts +++ b/test/unit/cmap/wire_protocol/compression.test.ts @@ -1,7 +1,7 @@ import * as zstd from '@mongodb-js/zstd'; import { expect } from 'chai'; -import { compress, Compressor, decompress } from '../../../../src/cmap/wire_protocol/compression'; +import { compress, Compressor, decompress } from '../../../mongodb'; describe('compression', function () { describe('.compress()', function () { diff --git a/test/unit/cmap/wire_protocol/constants.test.ts b/test/unit/cmap/wire_protocol/constants.test.ts index 3ba696b7293..e43b2051926 100644 --- a/test/unit/cmap/wire_protocol/constants.test.ts +++ b/test/unit/cmap/wire_protocol/constants.test.ts @@ -5,7 +5,7 @@ import { MAX_SUPPORTED_WIRE_VERSION, MIN_SUPPORTED_SERVER_VERSION, MIN_SUPPORTED_WIRE_VERSION -} from '../../../../src/cmap/wire_protocol/constants'; +} from '../../../mongodb'; describe('Wire Protocol Constants', function () { describe('MIN_SUPPORTED_SERVER_VERSION', function () { diff --git a/test/unit/cmap/wire_protocol/on_demand/document.test.ts b/test/unit/cmap/wire_protocol/on_demand/document.test.ts index 1ab39d8c46f..2ccdac05972 100644 --- a/test/unit/cmap/wire_protocol/on_demand/document.test.ts +++ b/test/unit/cmap/wire_protocol/on_demand/document.test.ts @@ -1,7 +1,7 @@ import { Binary, BSON, BSONError, BSONType, ObjectId, Timestamp } from 'bson'; import { expect } from 'chai'; -import { OnDemandDocument } from '../../../../../src/cmap/wire_protocol/on_demand/document'; +import { OnDemandDocument } from '../../../../mongodb'; describe('class OnDemandDocument', () => { context('when given an empty BSON sequence', () => { diff --git a/test/unit/cmap/wire_protocol/responses.test.ts b/test/unit/cmap/wire_protocol/responses.test.ts index 50368489190..9f2527d8a3c 100644 --- a/test/unit/cmap/wire_protocol/responses.test.ts +++ b/test/unit/cmap/wire_protocol/responses.test.ts @@ -1,9 +1,13 @@ import { expect } from 'chai'; -import { Int32, serialize } from '../../../../src/bson'; -import { OnDemandDocument } from '../../../../src/cmap/wire_protocol/on_demand/document'; -import { CursorResponse, MongoDBResponse } from '../../../../src/cmap/wire_protocol/responses'; -import { MongoUnexpectedServerResponseError } from '../../../../src/error'; +import { + CursorResponse, + Int32, + MongoDBResponse, + MongoUnexpectedServerResponseError, + OnDemandDocument, + serialize +} from '../../../mongodb'; describe('class MongoDBResponse', () => { it('is a subclass of OnDemandDocument', () => { diff --git a/test/unit/collection.test.ts b/test/unit/collection.test.ts index f7c3b017771..91cf4aa4fdb 100644 --- a/test/unit/collection.test.ts +++ b/test/unit/collection.test.ts @@ -1,8 +1,7 @@ import { Long } from 'bson'; import { expect } from 'chai'; -import { MongoClient } from '../../src/mongo_client'; -import { isHello } from '../../src/utils'; +import { isHello, MongoClient } from '../mongodb'; import { cleanup, createServer, HELLO } from '../tools/mongodb-mock'; describe('Collection', function () { diff --git a/test/unit/commands.test.ts b/test/unit/commands.test.ts index fcf951dcd68..3f601c678c0 100644 --- a/test/unit/commands.test.ts +++ b/test/unit/commands.test.ts @@ -1,14 +1,18 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { OpCompressedRequest, OpMsgRequest, OpQueryRequest } from '../../src/cmap/commands'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import * as compression from '../../src/cmap/wire_protocol/compression'; import { compress, Compressor, + OP_MSG, + OP_QUERY, + OpCompressedRequest, + OpMsgRequest, + OpQueryRequest, uncompressibleCommands -} from '../../src/cmap/wire_protocol/compression'; -import { OP_MSG, OP_QUERY } from '../../src/cmap/wire_protocol/constants'; +} from '../mongodb'; describe('class OpCompressedRequest', () => { context('canCompress()', () => { diff --git a/test/unit/connection_string.test.ts b/test/unit/connection_string.test.ts index 7b3cfdb9eda..3c5d32bccb2 100644 --- a/test/unit/connection_string.test.ts +++ b/test/unit/connection_string.test.ts @@ -4,20 +4,24 @@ import * as process from 'process'; import * as sinon from 'sinon'; import { inspect } from 'util'; -import { DEFAULT_ALLOWED_HOSTS, MongoCredentials } from '../../src/cmap/auth/mongo_credentials'; -import { AUTH_MECHS_AUTH_SRC_EXTERNAL, AuthMechanism } from '../../src/cmap/auth/providers'; -import { parseOptions, resolveSRVRecord } from '../../src/connection_string'; import { + AUTH_MECHS_AUTH_SRC_EXTERNAL, + AuthMechanism, + COSMOS_DB_MSG, + DEFAULT_ALLOWED_HOSTS, + DOCUMENT_DB_MSG, + type Log, MongoAPIError, + MongoClient, + MongoCredentials, MongoDriverError, MongoInvalidArgumentError, + type MongoOptions, MongoParseError, - MongoRuntimeError -} from '../../src/error'; -import { MongoClient, type MongoOptions } from '../../src/mongo_client'; -import { type Log } from '../../src/mongo_logger'; -import { COSMOS_DB_MSG, DOCUMENT_DB_MSG } from '../../src/utils'; - + MongoRuntimeError, + parseOptions, + resolveSRVRecord +} from '../mongodb'; describe('Connection String', function () { context('when serverMonitoringMode is set', function () { context('when it is valid', function () { diff --git a/test/unit/cursor/abstract_cursor.test.ts b/test/unit/cursor/abstract_cursor.test.ts index deb7784c83a..c28a54fcdcd 100644 --- a/test/unit/cursor/abstract_cursor.test.ts +++ b/test/unit/cursor/abstract_cursor.test.ts @@ -1,16 +1,15 @@ import { expect } from 'chai'; -import { CursorResponse } from '../../../src/cmap/wire_protocol/responses'; import { AbstractCursor, type AbstractCursorOptions, - type InitialCursorResponse -} from '../../../src/cursor/abstract_cursor'; -import { MongoClient } from '../../../src/mongo_client'; -import { type Server } from '../../../src/sdam/server'; -import { type ClientSession } from '../../../src/sessions'; -import { ns } from '../../../src/utils'; - + type ClientSession, + CursorResponse, + type InitialCursorResponse, + MongoClient, + ns, + type Server +} from '../../mongodb'; /** Minimal do nothing cursor to focus on testing the base cursor behavior */ class ConcreteCursor extends AbstractCursor { constructor(client: MongoClient, options: AbstractCursorOptions = {}) { diff --git a/test/unit/cursor/aggregation_cursor.test.ts b/test/unit/cursor/aggregation_cursor.test.ts index ac8b6c0d610..e0d7a1223c1 100644 --- a/test/unit/cursor/aggregation_cursor.test.ts +++ b/test/unit/cursor/aggregation_cursor.test.ts @@ -1,10 +1,12 @@ import { expect } from 'chai'; -import { CursorTimeoutMode } from '../../../src/cursor/abstract_cursor'; -import { AggregationCursor } from '../../../src/cursor/aggregation_cursor'; -import { MongoAPIError } from '../../../src/error'; -import { MongoClient } from '../../../src/mongo_client'; -import { ns } from '../../../src/utils'; +import { + AggregationCursor, + CursorTimeoutMode, + MongoAPIError, + MongoClient, + ns +} from '../../mongodb'; describe('class AggregationCursor', () => { let client: MongoClient; diff --git a/test/unit/cursor/run_command_cursor.test.ts b/test/unit/cursor/run_command_cursor.test.ts index 12a820e27d6..361fb2df889 100644 --- a/test/unit/cursor/run_command_cursor.test.ts +++ b/test/unit/cursor/run_command_cursor.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { MongoAPIError } from '../../../src/error'; -import { MongoClient } from '../../../src/mongo_client'; +import { MongoAPIError, MongoClient } from '../../mongodb'; describe('class RunCommandCursor', () => { let client: MongoClient; diff --git a/test/unit/db.test.ts b/test/unit/db.test.ts index 6535e49c78f..d9eaebfdbe4 100644 --- a/test/unit/db.test.ts +++ b/test/unit/db.test.ts @@ -1,8 +1,6 @@ import { expect } from 'chai'; -import { Db, type DbOptions } from '../../src/db'; -import { MongoClient } from '../../src/mongo_client'; -import { ReadPreference } from '../../src/read_preference'; +import { Db, type DbOptions, MongoClient, ReadPreference } from '../mongodb'; describe('class Db', function () { describe('secondaryOk', function () { diff --git a/test/unit/error.test.ts b/test/unit/error.test.ts index c860d142775..5315dcdea2d 100644 --- a/test/unit/error.test.ts +++ b/test/unit/error.test.ts @@ -1,24 +1,20 @@ import { expect } from 'chai'; import { setTimeout } from 'timers'; -import { - PoolClosedError as MongoPoolClosedError, - WaitQueueTimeoutError as MongoWaitQueueTimeoutError -} from '../../src/cmap/errors'; // Exception to the import from mongodb rule we're unit testing our public Errors API +// eslint-disable-next-line @typescript-eslint/no-restricted-imports import * as importsFromErrorSrc from '../../src/error'; +// eslint-disable-next-line @typescript-eslint/no-restricted-imports +import * as importsFromEntryPoint from '../../src/index'; import { + DeprioritizedServers, + isHello, isResumableError, isRetryableReadError, isStateChangeError, LEGACY_NOT_PRIMARY_OR_SECONDARY_ERROR_MESSAGE, LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE, MONGODB_ERROR_CODES, - needsRetryableWriteLabel, - NODE_IS_RECOVERING_ERROR_MESSAGE -} from '../../src/error'; -import * as importsFromEntryPoint from '../../src/index'; -import { MongoDriverError, MongoError, MongoErrorLabel, @@ -30,14 +26,18 @@ import { MongoServerError, MongoSystemError, MongoWriteConcernError, + needsRetryableWriteLabel, + NODE_IS_RECOVERING_ERROR_MESSAGE, + ns, + PoolClosedError as MongoPoolClosedError, + RunCommandOperation, + setDifference, + TimeoutContext, + type Topology, type TopologyDescription, - type TopologyOptions -} from '../../src/index'; -import { RunCommandOperation } from '../../src/operations/run_command'; -import { DeprioritizedServers } from '../../src/sdam/server_selection'; -import { type Topology } from '../../src/sdam/topology'; -import { TimeoutContext } from '../../src/timeout'; -import { isHello, ns, setDifference } from '../../src/utils'; + type TopologyOptions, + WaitQueueTimeoutError as MongoWaitQueueTimeoutError +} from '../mongodb'; import { ReplSetFixture } from '../tools/common'; import { cleanup } from '../tools/mongodb-mock/index'; import { topologyWithPlaceholderClient } from '../tools/utils'; diff --git a/test/unit/explain.test.ts b/test/unit/explain.test.ts index 403709e0b41..adfcfd866c6 100644 --- a/test/unit/explain.test.ts +++ b/test/unit/explain.test.ts @@ -1,10 +1,7 @@ import { expect } from 'chai'; import { it } from 'mocha'; -import { FindCursor } from '../../src/cursor/find_cursor'; -import { Explain, ExplainVerbosity } from '../../src/explain'; -import { MongoClient } from '../../src/mongo_client'; -import { MongoDBNamespace } from '../../src/utils'; +import { Explain, ExplainVerbosity, FindCursor, MongoClient, MongoDBNamespace } from '../mongodb'; describe('class Explain {}', function () { describe('static .fromOptions()', function () { diff --git a/test/unit/index.test.ts b/test/unit/index.test.ts index 7b73c22b82b..8f32cc3698c 100644 --- a/test/unit/index.test.ts +++ b/test/unit/index.test.ts @@ -1,8 +1,8 @@ import { expect } from 'chai'; +import * as mongodb from '../../src'; // Exception to the import from mongodb rule we're unit testing our public API -import * as mongodb from '../../src/index'; -import { setDifference } from '../../src/utils'; +import { setDifference } from '../mongodb'; const EXPECTED_EXPORTS = [ 'AbstractCursor', diff --git a/test/unit/mongo_client.test.ts b/test/unit/mongo_client.test.ts index 7f87043066a..80e53450dd4 100644 --- a/test/unit/mongo_client.test.ts +++ b/test/unit/mongo_client.test.ts @@ -6,14 +6,23 @@ import * as sinon from 'sinon'; import { Writable } from 'stream'; import { inspect } from 'util'; -import { MongoCredentials } from '../../src/cmap/auth/mongo_credentials'; -import { parseOptions, resolveSRVRecord } from '../../src/connection_string'; -import { MongoAPIError, MongoInvalidArgumentError, MongoParseError } from '../../src/error'; -import { MongoClient, type MongoClientOptions, ServerApiVersion } from '../../src/mongo_client'; -import { MongoLoggableComponent, MongoLogger, SeverityLevel } from '../../src/mongo_logger'; -import { ReadConcern } from '../../src/read_concern'; -import { ReadPreference } from '../../src/read_preference'; -import { WriteConcern } from '../../src/write_concern'; +import { + MongoAPIError, + MongoClient, + type MongoClientOptions, + MongoCredentials, + MongoInvalidArgumentError, + MongoLoggableComponent, + MongoLogger, + MongoParseError, + parseOptions, + ReadConcern, + ReadPreference, + resolveSRVRecord, + ServerApiVersion, + SeverityLevel, + WriteConcern +} from '../mongodb'; describe('MongoClient', function () { it('programmatic options should override URI options', function () { diff --git a/test/unit/mongo_logger.test.ts b/test/unit/mongo_logger.test.ts index bf6cef7c1ed..77aacda5d07 100644 --- a/test/unit/mongo_logger.test.ts +++ b/test/unit/mongo_logger.test.ts @@ -19,9 +19,7 @@ import { CONNECTION_POOL_CLOSED, CONNECTION_POOL_CREATED, CONNECTION_POOL_READY, - CONNECTION_READY -} from '../../src/constants'; -import { + CONNECTION_READY, createStdioLogger, DEFAULT_MAX_DOCUMENT_LENGTH, type Log, @@ -32,7 +30,7 @@ import { parseSeverityFromString, SeverityLevel, stringifyWithMaxLen -} from '../../src/mongo_logger'; +} from '../mongodb'; import { sleep } from '../tools/utils'; class BufferingStream extends Writable { diff --git a/test/unit/operations/aggregate.test.ts b/test/unit/operations/aggregate.test.ts index 92ef7c3065d..4ae888a2d63 100644 --- a/test/unit/operations/aggregate.test.ts +++ b/test/unit/operations/aggregate.test.ts @@ -1,9 +1,6 @@ import { expect } from 'chai'; -import { WriteConcern } from '../../../src'; -import { AggregateOperation } from '../../../src/operations/aggregate'; -import { MongoDBNamespace } from '../../../src/utils'; - +import { AggregateOperation, MongoDBNamespace, WriteConcern } from '../../mongodb'; describe('AggregateOperation', function () { const ns = new MongoDBNamespace('test', 'coll'); diff --git a/test/unit/operations/client_bulk_write/command_builder.test.ts b/test/unit/operations/client_bulk_write/command_builder.test.ts index d19caf1d0d2..7b833ca1084 100644 --- a/test/unit/operations/client_bulk_write/command_builder.test.ts +++ b/test/unit/operations/client_bulk_write/command_builder.test.ts @@ -1,7 +1,6 @@ import { ObjectId } from 'bson'; import { expect } from 'chai'; -import { DocumentSequence } from '../../../../src/cmap/commands'; import { buildDeleteManyOperation, buildDeleteOneOperation, @@ -9,18 +8,16 @@ import { buildReplaceOneOperation, buildUpdateManyOperation, buildUpdateOneOperation, - ClientBulkWriteCommandBuilder -} from '../../../../src/operations/client_bulk_write/command_builder'; -import { + ClientBulkWriteCommandBuilder, type ClientDeleteManyModel, type ClientDeleteOneModel, type ClientInsertOneModel, type ClientReplaceOneModel, type ClientUpdateManyModel, - type ClientUpdateOneModel -} from '../../../../src/operations/client_bulk_write/common'; -import { DEFAULT_PK_FACTORY } from '../../../../src/utils'; - + type ClientUpdateOneModel, + DEFAULT_PK_FACTORY, + DocumentSequence +} from '../../../mongodb'; describe('ClientBulkWriteCommandBuilder', function () { describe('#buildBatch', function () { context('when custom options are provided', function () { diff --git a/test/unit/operations/client_bulk_write/results_merger.test.ts b/test/unit/operations/client_bulk_write/results_merger.test.ts index cfe3da67fbb..aec48fcc40f 100644 --- a/test/unit/operations/client_bulk_write/results_merger.test.ts +++ b/test/unit/operations/client_bulk_write/results_merger.test.ts @@ -1,9 +1,11 @@ import { BSON, type Document, Long } from 'bson'; import { expect } from 'chai'; -import { ClientBulkWriteCursorResponse } from '../../../../src/cmap/wire_protocol/responses'; -import { type ClientBulkWriteResult } from '../../../../src/operations/client_bulk_write/common'; -import { ClientBulkWriteResultsMerger } from '../../../../src/operations/client_bulk_write/results_merger'; +import { + ClientBulkWriteCursorResponse, + type ClientBulkWriteResult, + ClientBulkWriteResultsMerger +} from '../../../mongodb'; class MockCursor { operations: Document[]; diff --git a/test/unit/operations/find.test.ts b/test/unit/operations/find.test.ts index 883588535ea..81ab4f16718 100644 --- a/test/unit/operations/find.test.ts +++ b/test/unit/operations/find.test.ts @@ -1,8 +1,7 @@ import { expect } from 'chai'; import * as sinon from 'sinon'; -import { FindOperation } from '../../../src/operations/find'; -import { ns } from '../../../src/utils'; +import { FindOperation, ns } from '../../mongodb'; describe('FindOperation', function () { const namespace = ns('db.coll'); diff --git a/test/unit/operations/get_more.test.ts b/test/unit/operations/get_more.test.ts index 3599e79cde4..f9067afcfc8 100644 --- a/test/unit/operations/get_more.test.ts +++ b/test/unit/operations/get_more.test.ts @@ -1,12 +1,14 @@ import { Long } from 'bson'; import { expect } from 'chai'; -import { GetMoreOperation } from '../../../src/operations/get_more'; -import { Aspect } from '../../../src/operations/operation'; -import { ReadPreference } from '../../../src/read_preference'; -import { Server } from '../../../src/sdam/server'; -import { ServerDescription } from '../../../src/sdam/server_description'; -import { ns } from '../../../src/utils'; +import { + Aspect, + GetMoreOperation, + ns, + ReadPreference, + Server, + ServerDescription +} from '../../mongodb'; import { topologyWithPlaceholderClient } from '../../tools/utils'; describe('GetMoreOperation', function () { diff --git a/test/unit/operations/indexes.test.ts b/test/unit/operations/indexes.test.ts index cbb9de56ce8..585da82356a 100644 --- a/test/unit/operations/indexes.test.ts +++ b/test/unit/operations/indexes.test.ts @@ -3,10 +3,9 @@ import { expect } from 'chai'; import { CreateIndexesOperation, type CreateIndexesOptions, - type IndexDirection -} from '../../../src/operations/indexes'; -import { ns } from '../../../src/utils'; - + type IndexDirection, + ns +} from '../../mongodb'; describe('class CreateIndexesOperation', () => { const testCases = [ { diff --git a/test/unit/operations/kill_cursors.test.ts b/test/unit/operations/kill_cursors.test.ts index f1c5e8ac708..cc65509377a 100644 --- a/test/unit/operations/kill_cursors.test.ts +++ b/test/unit/operations/kill_cursors.test.ts @@ -1,10 +1,13 @@ import { Long } from 'bson'; import { expect } from 'chai'; -import { KillCursorsOperation } from '../../../src/operations/kill_cursors'; -import { Server } from '../../../src/sdam/server'; -import { ServerDescription } from '../../../src/sdam/server_description'; -import { MongoDBNamespace, ns } from '../../../src/utils'; +import { + KillCursorsOperation, + MongoDBNamespace, + ns, + Server, + ServerDescription +} from '../../mongodb'; import { topologyWithPlaceholderClient } from '../../tools/utils'; describe('class KillCursorsOperation', () => { diff --git a/test/unit/operations/list_collections.test.js b/test/unit/operations/list_collections.test.js index 46a91e46e1d..927f94a725f 100644 --- a/test/unit/operations/list_collections.test.js +++ b/test/unit/operations/list_collections.test.js @@ -1,8 +1,7 @@ 'use strict'; const { expect } = require('chai'); -const { StreamDescription } = require('../../../src/cmap/stream_description'); -const { ListCollectionsOperation } = require('../../../src/operations/list_collections'); +const { StreamDescription, ListCollectionsOperation } = require('../../mongodb'); describe('ListCollectionsOperation', function () { const db = 'test'; diff --git a/test/unit/operations/list_databases.test.ts b/test/unit/operations/list_databases.test.ts index 7daf7eb3d14..b5f49f4b0aa 100644 --- a/test/unit/operations/list_databases.test.ts +++ b/test/unit/operations/list_databases.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { ListDatabasesOperation } from '../../../src/operations/list_databases'; -import { MongoDBNamespace } from '../../../src/utils'; +import { ListDatabasesOperation, MongoDBNamespace } from '../../mongodb'; const mockDB = { s: { diff --git a/test/unit/read_preference.test.ts b/test/unit/read_preference.test.ts index 4dbcd91517f..2744e8cf774 100644 --- a/test/unit/read_preference.test.ts +++ b/test/unit/read_preference.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { ReadPreference } from '../../src/read_preference'; +import { ReadPreference } from '../mongodb'; describe('class ReadPreference', function () { const maxStalenessSeconds = 1234; diff --git a/test/unit/sdam/monitor.test.ts b/test/unit/sdam/monitor.test.ts index 6473953b0ca..03edc953618 100644 --- a/test/unit/sdam/monitor.test.ts +++ b/test/unit/sdam/monitor.test.ts @@ -9,17 +9,19 @@ import * as sinon from 'sinon'; import { setTimeout } from 'timers'; import { setTimeout as setTimeoutPromise } from 'timers/promises'; -import { LEGACY_HELLO_COMMAND } from '../../../src/constants'; -import { MongoClient } from '../../../src/mongo_client'; -import { ServerType } from '../../../src/sdam/common'; import { + isHello, + LEGACY_HELLO_COMMAND, + MongoClient, + Monitor, + MonitorInterval, + RTTSampler, + ServerDescription, type ServerHeartbeatFailedEvent, type ServerHeartbeatStartedEvent, - ServerHeartbeatSucceededEvent -} from '../../../src/sdam/events'; -import { Monitor, MonitorInterval, RTTSampler } from '../../../src/sdam/monitor'; -import { ServerDescription } from '../../../src/sdam/server_description'; -import { isHello } from '../../../src/utils'; + ServerHeartbeatSucceededEvent, + ServerType +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import { topologyWithPlaceholderClient } from '../../tools/utils'; import { createTimerSandbox } from '../timer_sandbox'; diff --git a/test/unit/sdam/server.test.ts b/test/unit/sdam/server.test.ts index 4f4c9588d5a..1537648ce6d 100644 --- a/test/unit/sdam/server.test.ts +++ b/test/unit/sdam/server.test.ts @@ -4,16 +4,17 @@ import { expect } from 'chai'; import { once } from 'events'; import * as sinon from 'sinon'; -import { type Connection } from '../../../src/cmap/connection'; import { + type Connection, MongoError, MongoErrorLabel, MongoNetworkError, - MongoNetworkTimeoutError -} from '../../../src/error'; -import { ServerType, TopologyType } from '../../../src/sdam/common'; -import { Server } from '../../../src/sdam/server'; -import { ServerDescription } from '../../../src/sdam/server_description'; + MongoNetworkTimeoutError, + Server, + ServerDescription, + ServerType, + TopologyType +} from '../../mongodb'; import { sleep, topologyWithPlaceholderClient } from '../../tools/utils'; const handledErrors = [ diff --git a/test/unit/sdam/server_description.test.ts b/test/unit/sdam/server_description.test.ts index ac2edd7c5c2..dcab9491968 100644 --- a/test/unit/sdam/server_description.test.ts +++ b/test/unit/sdam/server_description.test.ts @@ -1,13 +1,12 @@ import { Long, ObjectId } from 'bson'; import { expect } from 'chai'; -import { MongoRuntimeError } from '../../../src/error'; import { compareTopologyVersion, + MongoRuntimeError, ServerDescription, type TopologyVersion -} from '../../../src/sdam/server_description'; - +} from '../../mongodb'; describe('ServerDescription', function () { describe('constructor()', () => { it('should throw if given a null address', () => { diff --git a/test/unit/sdam/server_discovery_and_monitoring.prose.test.ts b/test/unit/sdam/server_discovery_and_monitoring.prose.test.ts index d7a76e1eaa1..debd4a233a4 100644 --- a/test/unit/sdam/server_discovery_and_monitoring.prose.test.ts +++ b/test/unit/sdam/server_discovery_and_monitoring.prose.test.ts @@ -2,8 +2,7 @@ import { expect } from 'chai'; import { once } from 'events'; import { createServer, type Server } from 'net'; -import { SERVER_HEARTBEAT_FAILED, SERVER_HEARTBEAT_STARTED } from '../../../src/constants'; -import { MongoClient } from '../../../src/mongo_client'; +import { MongoClient, SERVER_HEARTBEAT_FAILED, SERVER_HEARTBEAT_STARTED } from '../../mongodb'; describe('Heartbeat tests', function () { let client: MongoClient; diff --git a/test/unit/sdam/server_selection.test.ts b/test/unit/sdam/server_selection.test.ts index 5a8fe60f6f4..f8e8d5eed64 100644 --- a/test/unit/sdam/server_selection.test.ts +++ b/test/unit/sdam/server_selection.test.ts @@ -2,18 +2,18 @@ import { ObjectId } from 'bson'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { MongoLogger } from '../../../src/mongo_logger'; -import { ReadPreference } from '../../../src/read_preference'; -import { TopologyType } from '../../../src/sdam/common'; -import { ServerDescription } from '../../../src/sdam/server_description'; import { DeprioritizedServers, MIN_SECONDARY_WRITE_WIRE_VERSION, + MongoLogger, + ReadPreference, sameServerSelector, - secondaryWritableServerSelector -} from '../../../src/sdam/server_selection'; -import { ServerSelectionEvent } from '../../../src/sdam/server_selection_events'; -import { TopologyDescription } from '../../../src/sdam/topology_description'; + secondaryWritableServerSelector, + ServerDescription, + ServerSelectionEvent, + TopologyDescription, + TopologyType +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import { topologyWithPlaceholderClient } from '../../tools/utils'; diff --git a/test/unit/sdam/srv_polling.test.ts b/test/unit/sdam/srv_polling.test.ts index f38dfd646de..2a22ddcc8ef 100644 --- a/test/unit/sdam/srv_polling.test.ts +++ b/test/unit/sdam/srv_polling.test.ts @@ -4,11 +4,14 @@ import { EventEmitter, once } from 'events'; import * as sinon from 'sinon'; import { clearTimeout } from 'timers'; -import { MongoDriverError } from '../../../src/error'; -import { TopologyType } from '../../../src/sdam/common'; -import { TopologyDescriptionChangedEvent } from '../../../src/sdam/events'; -import { SrvPoller, SrvPollingEvent } from '../../../src/sdam/srv_polling'; -import { TopologyDescription } from '../../../src/sdam/topology_description'; +import { + MongoDriverError, + SrvPoller, + SrvPollingEvent, + TopologyDescription, + TopologyDescriptionChangedEvent, + TopologyType +} from '../../mongodb'; import { topologyWithPlaceholderClient } from '../../tools/utils'; describe('Mongos SRV Polling', function () { diff --git a/test/unit/sdam/topology.test.ts b/test/unit/sdam/topology.test.ts index 8db64288bd9..23930ad2f67 100644 --- a/test/unit/sdam/topology.test.ts +++ b/test/unit/sdam/topology.test.ts @@ -1,32 +1,31 @@ import { expect } from 'chai'; import { once } from 'events'; import * as net from 'net'; -import { type AddressInfo } from 'net'; import * as process from 'process'; import { satisfies } from 'semver'; import * as sinon from 'sinon'; import { clearTimeout } from 'timers'; -import { ConnectionPool } from '../../../src/cmap/connection_pool'; -import { makeClientMetadata } from '../../../src/cmap/handshake/client_metadata'; import { + ConnectionPool, + isHello, LEGACY_NOT_WRITABLE_PRIMARY_ERROR_MESSAGE, - MongoServerSelectionError -} from '../../../src/error'; -import { MongoClient } from '../../../src/mongo_client'; -import { + makeClientMetadata, + MongoClient, + MongoServerSelectionError, + ns, + ReadPreference, RunCommandOperation, - RunCursorCommandOperation -} from '../../../src/operations/run_command'; -import { ReadPreference } from '../../../src/read_preference'; -import { TopologyType } from '../../../src/sdam/common'; -import { TopologyDescriptionChangedEvent } from '../../../src/sdam/events'; -import { Server } from '../../../src/sdam/server'; -import { SrvPoller, SrvPollingEvent } from '../../../src/sdam/srv_polling'; -import { Topology } from '../../../src/sdam/topology'; -import { TopologyDescription } from '../../../src/sdam/topology_description'; -import { TimeoutContext } from '../../../src/timeout'; -import { isHello, ns } from '../../../src/utils'; + RunCursorCommandOperation, + Server, + SrvPoller, + SrvPollingEvent, + TimeoutContext, + Topology, + TopologyDescription, + TopologyDescriptionChangedEvent, + TopologyType +} from '../../mongodb'; import * as mock from '../../tools/mongodb-mock/index'; import { runtime, topologyWithPlaceholderClient } from '../../tools/utils'; diff --git a/test/unit/sdam/topology_description.test.ts b/test/unit/sdam/topology_description.test.ts index 01c572cea97..a30eddd9a6e 100644 --- a/test/unit/sdam/topology_description.test.ts +++ b/test/unit/sdam/topology_description.test.ts @@ -1,8 +1,6 @@ import { expect } from 'chai'; -import { TopologyType } from '../../../src/sdam/common'; -import { ServerDescription } from '../../../src/sdam/server_description'; -import { TopologyDescription } from '../../../src/sdam/topology_description'; +import { ServerDescription, TopologyDescription, TopologyType } from '../../mongodb'; describe('TopologyDescription', function () { describe('#constructor', function () { diff --git a/test/unit/sessions.test.ts b/test/unit/sessions.test.ts index d03006bb26f..f6b3a09f17d 100644 --- a/test/unit/sessions.test.ts +++ b/test/unit/sessions.test.ts @@ -2,10 +2,16 @@ import { BSON, Long } from 'bson'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { MongoRuntimeError } from '../../src/error'; -import { MongoClient } from '../../src/mongo_client'; -import { applySession, ClientSession, ServerSession, ServerSessionPool } from '../../src/sessions'; -import { isHello, processTimeMS } from '../../src/utils'; +import { + applySession, + ClientSession, + isHello, + MongoClient, + MongoRuntimeError, + processTimeMS, + ServerSession, + ServerSessionPool +} from '../mongodb'; import { genClusterTime } from '../tools/common'; import * as mock from '../tools/mongodb-mock/index'; diff --git a/test/unit/timeout.test.ts b/test/unit/timeout.test.ts index eca9681ac5b..1dd7e83feb5 100644 --- a/test/unit/timeout.test.ts +++ b/test/unit/timeout.test.ts @@ -1,13 +1,14 @@ import { expect } from 'chai'; -import { MongoInvalidArgumentError, MongoRuntimeError } from '../../src/error'; import { CSOTTimeoutContext, LegacyTimeoutContext, + MongoInvalidArgumentError, + MongoRuntimeError, Timeout, TimeoutContext, TimeoutError -} from '../../src/timeout'; +} from '../mongodb'; describe('Timeout', function () { let timeout: Timeout; diff --git a/test/unit/tools/unified_spec_runner/entity_event_registry.test.ts b/test/unit/tools/unified_spec_runner/entity_event_registry.test.ts index 0fd3bb08224..8457ff4026b 100644 --- a/test/unit/tools/unified_spec_runner/entity_event_registry.test.ts +++ b/test/unit/tools/unified_spec_runner/entity_event_registry.test.ts @@ -15,7 +15,7 @@ import { CONNECTION_POOL_CREATED, CONNECTION_POOL_READY, CONNECTION_READY -} from '../../../../src/constants'; +} from '../../../mongodb'; import { EntitiesMap, UnifiedMongoClient } from '../../../tools/unified-spec-runner/entities'; import { EntityEventRegistry } from '../../../tools/unified-spec-runner/entity_event_registry'; diff --git a/test/unit/transactions.test.ts b/test/unit/transactions.test.ts index 09b0e91038e..789c0b1cb6f 100644 --- a/test/unit/transactions.test.ts +++ b/test/unit/transactions.test.ts @@ -1,7 +1,6 @@ import { expect } from 'chai'; -import { ReadPreference } from '../../src/read_preference'; -import { Transaction } from '../../src/transactions'; +import { ReadPreference, Transaction } from '../mongodb'; describe('class Transaction', () => { describe('constructor()', () => { diff --git a/test/unit/utils.test.ts b/test/unit/utils.test.ts index 6914bb6ce3d..e0783eb5302 100644 --- a/test/unit/utils.test.ts +++ b/test/unit/utils.test.ts @@ -4,24 +4,26 @@ import { ByteUtils, ObjectId } from 'bson'; import { expect } from 'chai'; import * as sinon from 'sinon'; -import { LEGACY_HELLO_COMMAND } from '../../src/constants'; -import { MongoInvalidArgumentError, MongoRuntimeError } from '../../src/error'; -import { decorateWithExplain, Explain } from '../../src/explain'; import { abortable, BufferPool, checkParentDomainMatch, compareObjectId, + decorateWithExplain, + Explain, hasAtomicOperators, HostAddress, hostMatchesWildcards, isHello, isUint8Array, + LEGACY_HELLO_COMMAND, List, MongoDBCollectionNamespace, MongoDBNamespace, + MongoInvalidArgumentError, + MongoRuntimeError, shuffle -} from '../../src/utils'; +} from '../mongodb'; import { sleep } from '../tools/utils'; describe('driver utils', function () { diff --git a/test/unit/write_concern.test.ts b/test/unit/write_concern.test.ts index 420c6dce14c..0f59a2c3b04 100644 --- a/test/unit/write_concern.test.ts +++ b/test/unit/write_concern.test.ts @@ -1,6 +1,6 @@ import { expect } from 'chai'; -import { WriteConcern } from '../../src/write_concern'; +import { WriteConcern } from '../mongodb'; describe('WriteConcern', function () { describe('#constructor', function () {