Skip to content

Commit ea4d84b

Browse files
authored
Merge branch 'main' into feat/expose-change-stream-cursor-buffer-count
2 parents cc16a74 + 4d6e2a2 commit ea4d84b

311 files changed

Lines changed: 13946 additions & 859 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintrc.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@
186186
{
187187
"patterns": [
188188
"**/../lib/**",
189+
"**/../src/**",
189190
"mongodb-mock-server"
190191
]
191192
}
@@ -224,7 +225,8 @@
224225
{
225226
"patterns": [
226227
"**/../lib/**",
227-
"mongodb-mock-server"
228+
"mongodb-mock-server",
229+
"**/../src/**"
228230
]
229231
}
230232
]
@@ -331,6 +333,15 @@
331333
"disallowTypeAnnotations": false,
332334
"fixStyle": "separate-type-imports"
333335
}
336+
],
337+
"no-restricted-imports": [
338+
"error",
339+
{
340+
"patterns": [
341+
"**/../lib/**",
342+
"**/../src/**"
343+
]
344+
}
334345
]
335346
}
336347
}

.evergreen/run-mongodb-aws-test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ source .evergreen/setup-mongodb-aws-auth-tests.sh
99
# load node.js environment
1010
source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh
1111

12+
# clear AWS_PROFILE, so it doesn't interfere with env-creds
13+
unset AWS_PROFILE
14+
1215
npm run check:aws

drivers-evergreen-tools

src/cmap/auth/mongodb_oidc.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ import type { Connection } from '../connection';
55
import { type AuthContext, AuthProvider } from './auth_provider';
66
import type { MongoCredentials } from './mongo_credentials';
77
import { AutomatedCallbackWorkflow } from './mongodb_oidc/automated_callback_workflow';
8-
import { callback as azureCallback } from './mongodb_oidc/azure_machine_workflow';
9-
import { callback as gcpCallback } from './mongodb_oidc/gcp_machine_workflow';
10-
import { callback as k8sCallback } from './mongodb_oidc/k8s_machine_workflow';
8+
import { azureCallback } from './mongodb_oidc/azure_machine_workflow';
9+
import { gcpCallback } from './mongodb_oidc/gcp_machine_workflow';
10+
import { k8sCallback } from './mongodb_oidc/k8s_machine_workflow';
1111
import { TokenCache } from './mongodb_oidc/token_cache';
12-
import { callback as testCallback } from './mongodb_oidc/token_machine_workflow';
12+
import { tokenMachineCallback as testCallback } from './mongodb_oidc/token_machine_workflow';
1313

1414
/** Error when credentials are missing. */
1515
const MISSING_CREDENTIALS_ERROR = 'AuthContext must provide credentials.';

src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const TOKEN_RESOURCE_MISSING_ERROR =
1919
* @param params - The OIDC callback parameters.
2020
* @returns The OIDC response.
2121
*/
22-
export const callback: OIDCCallbackFunction = async (
22+
export const azureCallback: OIDCCallbackFunction = async (
2323
params: OIDCCallbackParams
2424
): Promise<OIDCResponse> => {
2525
const tokenAudience = params.tokenAudience;

src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const TOKEN_RESOURCE_MISSING_ERROR =
1818
* @param params - The OIDC callback parameters.
1919
* @returns The OIDC response.
2020
*/
21-
export const callback: OIDCCallbackFunction = async (
21+
export const gcpCallback: OIDCCallbackFunction = async (
2222
params: OIDCCallbackParams
2323
): Promise<OIDCResponse> => {
2424
const tokenAudience = params.tokenAudience;

src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const AWS_FILENAME = 'AWS_WEB_IDENTITY_TOKEN_FILE';
1717
* @param params - The OIDC callback parameters.
1818
* @returns The OIDC response.
1919
*/
20-
export const callback: OIDCCallbackFunction = async (): Promise<OIDCResponse> => {
20+
export const k8sCallback: OIDCCallbackFunction = async (): Promise<OIDCResponse> => {
2121
let filename: string;
2222
if (process.env[AZURE_FILENAME]) {
2323
filename = process.env[AZURE_FILENAME];

src/cmap/auth/mongodb_oidc/token_machine_workflow.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const TOKEN_MISSING_ERROR = 'OIDC_TOKEN_FILE must be set in the environment.';
1212
* @param params - The OIDC callback parameters.
1313
* @returns The OIDC response.
1414
*/
15-
export const callback: OIDCCallbackFunction = async (): Promise<OIDCResponse> => {
15+
export const tokenMachineCallback: OIDCCallbackFunction = async (): Promise<OIDCResponse> => {
1616
const tokenFile = process.env.OIDC_TOKEN_FILE;
1717
if (!tokenFile) {
1818
throw new MongoAWSError(TOKEN_MISSING_ERROR);

src/cmap/connect.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ export interface HandshakeDocument extends Document {
224224
compression: string[];
225225
saslSupportedMechs?: string;
226226
loadBalanced?: boolean;
227+
backpressure: true;
227228
}
228229

229230
/**
@@ -241,6 +242,7 @@ export async function prepareHandshakeDocument(
241242

242243
const handshakeDoc: HandshakeDocument = {
243244
[serverApi?.version || options.loadBalanced === true ? 'hello' : LEGACY_HELLO_COMMAND]: 1,
245+
backpressure: true,
244246
helloOk: true,
245247
client: clientMetadata,
246248
compression: compressors

src/cmap/connection.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,9 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
586586
this.throwIfAborted();
587587
}
588588
} catch (error) {
589+
if (options.session != null && !(error instanceof MongoServerError)) {
590+
updateSessionFromResponse(options.session, MongoDBResponse.empty);
591+
}
589592
if (this.shouldEmitAndLogCommand) {
590593
this.emitAndLogCommand(
591594
this.monitorCommands,

0 commit comments

Comments
 (0)