Skip to content

Commit fbba5ad

Browse files
authored
chore(cli-repl): account for changes to nightly driver typings (#2556)
Specifically, match the stricter typing in mongodb/node-mongodb-native@dab4c7c.
1 parent 0afc1fc commit fbba5ad

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/cli-repl/src/crypt-library-paths.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import path from 'path';
22
import { promises as fs, constants as fsConstants } from 'fs';
33
import type { MongoshBus } from '@mongosh/types';
4+
import type { AutoEncryptionOptions } from 'mongodb';
45

5-
export const SHARED_LIBRARY_SUFFIX =
6+
type SharedObjectSuffix = 'so' | 'dylib' | 'dll';
7+
export const SHARED_LIBRARY_SUFFIX: SharedObjectSuffix =
68
process.platform === 'win32'
79
? 'dll'
810
: process.platform === 'darwin'
911
? 'dylib'
1012
: 'so';
13+
export type CryptSharedLibPath = NonNullable<
14+
NonNullable<AutoEncryptionOptions['extraOptions']>['cryptSharedLibPath']
15+
>;
1116

1217
export interface CryptLibraryPathResult {
13-
cryptSharedLibPath?: string;
18+
cryptSharedLibPath?: CryptSharedLibPath;
1419
expectedVersion?: { version: bigint; versionStr: string };
1520
}
1621

@@ -54,7 +59,10 @@ export async function getCryptLibraryPaths(
5459
),
5560
// Location of the shared library in the zip and tgz packages
5661
path.resolve(bindir, `mongosh_crypt_v1.${SHARED_LIBRARY_SUFFIX}`),
57-
]) {
62+
// NB: The types here intentionally mismatch, as we rename the
63+
// library file to avoid conflicts with system installations of
64+
// the crypt_shared library.
65+
] as CryptSharedLibPath[]) {
5866
try {
5967
const permissionsMismatch = await ensureMatchingPermissions(
6068
libraryCandidate,

0 commit comments

Comments
 (0)