diff --git a/Cargo.toml b/Cargo.toml index 669766e..c1ded67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ crate-type = ["cdylib"] [dependencies] anyhow = "1.0.99" -atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "df190245295e6675949fb5c63a164fadc0007dab" } +atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "f874fe90553e5158034aea0587669f0e8ac75127" } bollard = "0.19.2" napi = { version = "^3.3.0", features = ["async", "anyhow"] } napi-derive = "^3.2.5" diff --git a/__test__/index.spec.ts b/__test__/index.spec.ts index 72881d4..3f38dc7 100644 --- a/__test__/index.spec.ts +++ b/__test__/index.spec.ts @@ -37,6 +37,11 @@ test('smoke test', async (t) => { let deployment = await client.createDeployment(createDeploymentOptions) t.is(deployment.name, createDeploymentOptions.name) + // Get the deployment id twice, make sure it's the same + let deploymentId = await client.getDeploymentId(createDeploymentOptions.name) + let deploymentId2 = await client.getDeploymentId(createDeploymentOptions.name) + t.is(deploymentId, deploymentId2) + // Get deployment let getDeployment = await client.getDeployment(createDeploymentOptions.name) t.is(getDeployment.name,createDeploymentOptions.name) diff --git a/index.d.ts b/index.d.ts index 6c98179..192fc78 100644 --- a/index.d.ts +++ b/index.d.ts @@ -7,6 +7,7 @@ export declare class Client { deleteDeployment(deploymentName: string): Promise getDeployment(deploymentName: string): Promise getConnectionString(options: GetConnectionStringOptions): Promise + getDeploymentId(clusterIdOrName: string): Promise } export declare const enum BindingType { diff --git a/index.js b/index.js index 4faeb3a..b74b245 100644 --- a/index.js +++ b/index.js @@ -80,8 +80,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-android-arm64') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-android-arm64/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -96,8 +96,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-android-arm-eabi') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-android-arm-eabi/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -116,8 +116,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-win32-x64-msvc') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-win32-x64-msvc/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -132,8 +132,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-win32-ia32-msvc') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-win32-ia32-msvc/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -148,8 +148,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-win32-arm64-msvc') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-win32-arm64-msvc/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -167,8 +167,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-darwin-universal') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-darwin-universal/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -183,8 +183,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-darwin-x64') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-darwin-x64/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -199,8 +199,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-darwin-arm64') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-darwin-arm64/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -219,8 +219,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-freebsd-x64') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-freebsd-x64/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -235,8 +235,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-freebsd-arm64') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-freebsd-arm64/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -256,8 +256,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-x64-musl') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-x64-musl/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -272,8 +272,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-x64-gnu') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-x64-gnu/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -290,8 +290,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-arm64-musl') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-arm64-musl/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -306,8 +306,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-arm64-gnu') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-arm64-gnu/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -324,8 +324,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-arm-musleabihf') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-arm-musleabihf/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -340,8 +340,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-arm-gnueabihf') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-arm-gnueabihf/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -358,8 +358,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-loong64-musl') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-loong64-musl/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -374,8 +374,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-loong64-gnu') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-loong64-gnu/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -392,8 +392,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-riscv64-musl') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-riscv64-musl/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -408,8 +408,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-riscv64-gnu') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-riscv64-gnu/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -425,8 +425,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-ppc64-gnu') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-ppc64-gnu/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -441,8 +441,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-linux-s390x-gnu') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-linux-s390x-gnu/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -461,8 +461,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-openharmony-arm64') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-openharmony-arm64/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -477,8 +477,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-openharmony-x64') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-openharmony-x64/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { @@ -493,8 +493,8 @@ function requireNative() { try { const binding = require('@mongodb-js-preview/atlas-local-openharmony-arm') const bindingPackageVersion = require('@mongodb-js-preview/atlas-local-openharmony-arm/package.json').version - if (bindingPackageVersion !== '0.0.0-preview.3' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { - throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.3 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) + if (bindingPackageVersion !== '0.0.0-preview.4' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') { + throw new Error(`Native binding package version mismatch, expected 0.0.0-preview.4 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`) } return binding } catch (e) { diff --git a/package.json b/package.json index ba797ae..0953d2e 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "@oxc-node/core": "^0.0.32", "@taplo/cli": "^0.7.0", "@tybys/wasm-util": "^0.10.0", + "@types/node": "^24.5.2", "ava": "^6.4.1", "chalk": "^5.4.1", "husky": "^9.1.7", diff --git a/src/lib.rs b/src/lib.rs index e6f2fc0..83a681e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -82,4 +82,13 @@ impl Client { .await .context("get connection string") } + + #[napi] + pub async fn get_deployment_id(&self, cluster_id_or_name: String) -> Result { + self + .client + .get_deployment_id(&cluster_id_or_name) + .await + .context("get deployment id") + } } diff --git a/yarn.lock b/yarn.lock index 4175191..09c0b1b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -569,6 +569,7 @@ __metadata: "@oxc-node/core": "npm:^0.0.32" "@taplo/cli": "npm:^0.7.0" "@tybys/wasm-util": "npm:^0.10.0" + "@types/node": "npm:^24.5.2" ava: "npm:^6.4.1" chalk: "npm:^5.4.1" husky: "npm:^9.1.7" @@ -1510,58 +1511,58 @@ __metadata: languageName: node linkType: hard -"@oxlint/darwin-arm64@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/darwin-arm64@npm:1.15.0" +"@oxlint/darwin-arm64@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/darwin-arm64@npm:1.18.0" conditions: os=darwin & cpu=arm64 languageName: node linkType: hard -"@oxlint/darwin-x64@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/darwin-x64@npm:1.15.0" +"@oxlint/darwin-x64@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/darwin-x64@npm:1.18.0" conditions: os=darwin & cpu=x64 languageName: node linkType: hard -"@oxlint/linux-arm64-gnu@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/linux-arm64-gnu@npm:1.15.0" +"@oxlint/linux-arm64-gnu@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/linux-arm64-gnu@npm:1.18.0" conditions: os=linux & cpu=arm64 & libc=glibc languageName: node linkType: hard -"@oxlint/linux-arm64-musl@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/linux-arm64-musl@npm:1.15.0" +"@oxlint/linux-arm64-musl@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/linux-arm64-musl@npm:1.18.0" conditions: os=linux & cpu=arm64 & libc=musl languageName: node linkType: hard -"@oxlint/linux-x64-gnu@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/linux-x64-gnu@npm:1.15.0" +"@oxlint/linux-x64-gnu@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/linux-x64-gnu@npm:1.18.0" conditions: os=linux & cpu=x64 & libc=glibc languageName: node linkType: hard -"@oxlint/linux-x64-musl@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/linux-x64-musl@npm:1.15.0" +"@oxlint/linux-x64-musl@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/linux-x64-musl@npm:1.18.0" conditions: os=linux & cpu=x64 & libc=musl languageName: node linkType: hard -"@oxlint/win32-arm64@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/win32-arm64@npm:1.15.0" +"@oxlint/win32-arm64@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/win32-arm64@npm:1.18.0" conditions: os=win32 & cpu=arm64 languageName: node linkType: hard -"@oxlint/win32-x64@npm:1.15.0": - version: 1.15.0 - resolution: "@oxlint/win32-x64@npm:1.15.0" +"@oxlint/win32-x64@npm:1.18.0": + version: 1.18.0 + resolution: "@oxlint/win32-x64@npm:1.18.0" conditions: os=win32 & cpu=x64 languageName: node linkType: hard @@ -1621,6 +1622,15 @@ __metadata: languageName: node linkType: hard +"@types/node@npm:^24.5.2": + version: 24.5.2 + resolution: "@types/node@npm:24.5.2" + dependencies: + undici-types: "npm:~7.12.0" + checksum: 10c0/96baaca6564d39c6f7f6eddd73ce41e2a7594ef37225cd52df3be36fad31712af8ae178387a72d0b80f2e2799e7fd30c014bc0ae9eb9f962d9079b691be00c48 + languageName: node + linkType: hard + "@vercel/nft@npm:^0.29.4": version: 0.29.4 resolution: "@vercel/nft@npm:0.29.4" @@ -1695,11 +1705,11 @@ __metadata: linkType: hard "ansi-escapes@npm:^7.0.0": - version: 7.1.0 - resolution: "ansi-escapes@npm:7.1.0" + version: 7.1.1 + resolution: "ansi-escapes@npm:7.1.1" dependencies: environment: "npm:^1.0.0" - checksum: 10c0/c3aeb677bb272213936e8b96250d742f4d3a17b8135189cc22295713392de84c40765599d16ad2d4e30db38283355e77c8be2aa0441b733c48d7fb960782fbe3 + checksum: 10c0/6014258af7f606f1d98192c6b8815f83d9f45e43613a985b7e86b176534329c9d75ca3db15710c3e354cede940c729d6906613d5861aa0b151d7d186d8f97f29 languageName: node linkType: hard @@ -1855,12 +1865,12 @@ __metadata: languageName: node linkType: hard -"baseline-browser-mapping@npm:^2.8.2": - version: 2.8.4 - resolution: "baseline-browser-mapping@npm:2.8.4" +"baseline-browser-mapping@npm:^2.8.3": + version: 2.8.6 + resolution: "baseline-browser-mapping@npm:2.8.6" bin: baseline-browser-mapping: dist/cli.js - checksum: 10c0/d85c8e9b919d4f7d5b46cf3d89e6a8be6e74086934ff6f362b720be8e06656021a0207e2ba1efe8ae2563dec893a76ad15633e06f3e153984fab8118e2dc4ae7 + checksum: 10c0/ea628db5048d1e5c0251d4783e0496f5ce8de7a0e20ea29c8876611cb0acf58ffc76bf6561786c6388db22f130646e3ecb91eebc1c03954552a21d38fa38320f languageName: node linkType: hard @@ -1916,17 +1926,17 @@ __metadata: linkType: hard "browserslist@npm:^4.24.0": - version: 4.26.0 - resolution: "browserslist@npm:4.26.0" + version: 4.26.2 + resolution: "browserslist@npm:4.26.2" dependencies: - baseline-browser-mapping: "npm:^2.8.2" + baseline-browser-mapping: "npm:^2.8.3" caniuse-lite: "npm:^1.0.30001741" electron-to-chromium: "npm:^1.5.218" node-releases: "npm:^2.0.21" update-browserslist-db: "npm:^1.1.3" bin: browserslist: cli.js - checksum: 10c0/49be9a9cb27ca959f85c23f638c60680e21aab0e34130ff7cb8dae0be9426769124576e834c971150a471561abc67afee4e864262ce7345f5e961ff465879cac + checksum: 10c0/1146339dad33fda77786b11ea07f1c40c48899edd897d73a9114ee0dbb1ee6475bb4abda263a678c104508bdca8e66760ff8e10be1947d3e20d34bae01d8b89b languageName: node linkType: hard @@ -1957,9 +1967,9 @@ __metadata: linkType: hard "caniuse-lite@npm:^1.0.30001741": - version: 1.0.30001741 - resolution: "caniuse-lite@npm:1.0.30001741" - checksum: 10c0/45746f896205a61a8eeb85a32aeca243ebce640cd6eb80d04949d9389a13f4659c737860300d7b988057599f0958c55eeab74ec02ce9ef137feb7d006e75fec1 + version: 1.0.30001743 + resolution: "caniuse-lite@npm:1.0.30001743" + checksum: 10c0/1bd730ca10d881a1ca9f55ce864d34c3b18501718c03976e0d3419f4694b715159e13fdef6d58ad47b6d2445d315940f3a01266658876828c820a3331aac021d languageName: node linkType: hard @@ -1972,7 +1982,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:^5.4.1, chalk@npm:^5.6.0": +"chalk@npm:^5.4.1": version: 5.6.2 resolution: "chalk@npm:5.6.2" checksum: 10c0/99a4b0f0e7991796b1e7e3f52dceb9137cae2a9dfc8fc0784a550dc4c558e15ab32ed70b14b21b52beb2679b4892b41a0aa44249bcb996f01e125d58477c6976 @@ -2122,7 +2132,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^14.0.0": +"commander@npm:14.0.1": version: 14.0.1 resolution: "commander@npm:14.0.1" checksum: 10c0/64439c0651ddd01c1d0f48c8f08e97c18a0a1fa693879451f1203ad01132af2c2aa85da24cf0d8e098ab9e6dc385a756be670d2999a3c628ec745c3ec124587b @@ -2252,9 +2262,9 @@ __metadata: linkType: hard "detect-libc@npm:^2.0.0": - version: 2.1.0 - resolution: "detect-libc@npm:2.1.0" - checksum: 10c0/4d0d36c77fdcb1d3221779d8dfc7d5808dd52530d49db67193fb3cd8149e2d499a1eeb87bb830ad7c442294929992c12e971f88ae492965549f8f83e5336eba6 + version: 2.1.1 + resolution: "detect-libc@npm:2.1.1" + checksum: 10c0/97053299c1f68c7c4adf7b78c8d506e1d5f3a3fbc775920aaa0ecf7f8fcc6dfa46338a6ca82fe4500b4a51937def314584265a4ec9d565577485c4496aa7d64e languageName: node linkType: hard @@ -2266,9 +2276,9 @@ __metadata: linkType: hard "electron-to-chromium@npm:^1.5.218": - version: 1.5.218 - resolution: "electron-to-chromium@npm:1.5.218" - checksum: 10c0/d625e825834d862a33ed17da60d607267569cea6ff7c498c181dac285e037cce18b46ae810e8328a4dc26559a358d22b77d0a5c75aba182d39621947a7c62a34 + version: 1.5.223 + resolution: "electron-to-chromium@npm:1.5.223" + checksum: 10c0/1c07c34b6d8eca9b5a587e9a7ffdb4502d9cd346cf7a0446b5bbf9056395b06f3d95774c7b221b8060184771ac536f4653a06811dd4ea5c20a1a071349e84120 languageName: node linkType: hard @@ -2975,34 +2985,24 @@ __metadata: languageName: node linkType: hard -"lilconfig@npm:^3.1.3": - version: 3.1.3 - resolution: "lilconfig@npm:3.1.3" - checksum: 10c0/f5604e7240c5c275743561442fbc5abf2a84ad94da0f5adc71d25e31fa8483048de3dcedcb7a44112a942fed305fd75841cdf6c9681c7f640c63f1049e9a5dcc - languageName: node - linkType: hard - "lint-staged@npm:^16.1.2": - version: 16.1.6 - resolution: "lint-staged@npm:16.1.6" - dependencies: - chalk: "npm:^5.6.0" - commander: "npm:^14.0.0" - debug: "npm:^4.4.1" - lilconfig: "npm:^3.1.3" - listr2: "npm:^9.0.3" - micromatch: "npm:^4.0.8" - nano-spawn: "npm:^1.0.2" - pidtree: "npm:^0.6.0" - string-argv: "npm:^0.3.2" - yaml: "npm:^2.8.1" + version: 16.2.0 + resolution: "lint-staged@npm:16.2.0" + dependencies: + commander: "npm:14.0.1" + listr2: "npm:9.0.4" + micromatch: "npm:4.0.8" + nano-spawn: "npm:1.0.3" + pidtree: "npm:0.6.0" + string-argv: "npm:0.3.2" + yaml: "npm:2.8.1" bin: lint-staged: bin/lint-staged.js - checksum: 10c0/e695edfec7e330f2c7cd0bb0e56220aa95d3b3655fe64a87a02140609a3594df67e1ea7abc2cc4ce69aa010418e406b1b24703ba4bd026c873a5b43a5ab16c6a + checksum: 10c0/0903eea526d390fd04ec10c2b6c3c3accdff53647d1918d3c30236d46fa7714a4a109d1aeda7364ecc689728c7b188bc430911b170834228fe0010d938c9a631 languageName: node linkType: hard -"listr2@npm:^9.0.3": +"listr2@npm:9.0.4": version: 9.0.4 resolution: "listr2@npm:9.0.4" dependencies: @@ -3143,7 +3143,7 @@ __metadata: languageName: node linkType: hard -"micromatch@npm:^4.0.8": +"micromatch@npm:4.0.8, micromatch@npm:^4.0.8": version: 4.0.8 resolution: "micromatch@npm:4.0.8" dependencies: @@ -3185,21 +3185,12 @@ __metadata: languageName: node linkType: hard -"minizlib@npm:^3.0.1": - version: 3.0.2 - resolution: "minizlib@npm:3.0.2" +"minizlib@npm:^3.1.0": + version: 3.1.0 + resolution: "minizlib@npm:3.1.0" dependencies: minipass: "npm:^7.1.2" - checksum: 10c0/9f3bd35e41d40d02469cb30470c55ccc21cae0db40e08d1d0b1dff01cc8cc89a6f78e9c5d2b7c844e485ec0a8abc2238111213fdc5b2038e6d1012eacf316f78 - languageName: node - linkType: hard - -"mkdirp@npm:^3.0.1": - version: 3.0.1 - resolution: "mkdirp@npm:3.0.1" - bin: - mkdirp: dist/cjs/src/bin.js - checksum: 10c0/9f2b975e9246351f5e3a40dcfac99fcd0baa31fbfab615fe059fb11e51f10e4803c63de1f384c54d656e4db31d000e4767e9ef076a22e12a641357602e31d57d + checksum: 10c0/5aad75ab0090b8266069c9aabe582c021ae53eb33c6c691054a13a45db3b4f91a7fb1bd79151e6b4e9e9a86727b522527c0a06ec7d45206b745d54cd3097bcec languageName: node linkType: hard @@ -3217,7 +3208,7 @@ __metadata: languageName: node linkType: hard -"nano-spawn@npm:^1.0.2": +"nano-spawn@npm:1.0.3": version: 1.0.3 resolution: "nano-spawn@npm:1.0.3" checksum: 10c0/ea18857e493710a50ded333dd71677953bd9bd9e6a17ade74af957763c50a9a02205ef31bc0d6784f5b3ad82db3d9f47531e9baac2acf01118f9b7c35bd9d5de @@ -3367,17 +3358,17 @@ __metadata: linkType: hard "oxlint@npm:^1.8.0": - version: 1.15.0 - resolution: "oxlint@npm:1.15.0" - dependencies: - "@oxlint/darwin-arm64": "npm:1.15.0" - "@oxlint/darwin-x64": "npm:1.15.0" - "@oxlint/linux-arm64-gnu": "npm:1.15.0" - "@oxlint/linux-arm64-musl": "npm:1.15.0" - "@oxlint/linux-x64-gnu": "npm:1.15.0" - "@oxlint/linux-x64-musl": "npm:1.15.0" - "@oxlint/win32-arm64": "npm:1.15.0" - "@oxlint/win32-x64": "npm:1.15.0" + version: 1.18.0 + resolution: "oxlint@npm:1.18.0" + dependencies: + "@oxlint/darwin-arm64": "npm:1.18.0" + "@oxlint/darwin-x64": "npm:1.18.0" + "@oxlint/linux-arm64-gnu": "npm:1.18.0" + "@oxlint/linux-arm64-musl": "npm:1.18.0" + "@oxlint/linux-x64-gnu": "npm:1.18.0" + "@oxlint/linux-x64-musl": "npm:1.18.0" + "@oxlint/win32-arm64": "npm:1.18.0" + "@oxlint/win32-x64": "npm:1.18.0" peerDependencies: oxlint-tsgolint: ">=0.2.0" dependenciesMeta: @@ -3403,7 +3394,7 @@ __metadata: bin: oxc_language_server: bin/oxc_language_server oxlint: bin/oxlint - checksum: 10c0/3eb2a27b972f2a02200b068345ab6a3a17f7bc29c4546c6b3478727388d8d59b94a554f9b6bb1320b71a75cc598b728de0ffee5e4e70ac27457104b8efebb257 + checksum: 10c0/a8922b7cf0a7921237945b0eedf41e9a47db51784a667092cffede9038227a5a5e2e409e6fc237a0c061aaee3b2a8a20e63de5fb324deec17ca5db64bf34f84e languageName: node linkType: hard @@ -3568,7 +3559,7 @@ __metadata: languageName: node linkType: hard -"pidtree@npm:^0.6.0": +"pidtree@npm:0.6.0, pidtree@npm:^0.6.0": version: 0.6.0 resolution: "pidtree@npm:0.6.0" bin: @@ -3871,7 +3862,7 @@ __metadata: languageName: node linkType: hard -"string-argv@npm:^0.3.2": +"string-argv@npm:0.3.2": version: 0.3.2 resolution: "string-argv@npm:0.3.2" checksum: 10c0/75c02a83759ad1722e040b86823909d9a2fc75d15dd71ec4b537c3560746e33b5f5a07f7332d1e3f88319909f82190843aa2f0a0d8c8d591ec08e93d5b8dec82 @@ -3968,16 +3959,15 @@ __metadata: linkType: hard "tar@npm:^7.4.0": - version: 7.4.3 - resolution: "tar@npm:7.4.3" + version: 7.5.1 + resolution: "tar@npm:7.5.1" dependencies: "@isaacs/fs-minipass": "npm:^4.0.0" chownr: "npm:^3.0.0" minipass: "npm:^7.1.2" - minizlib: "npm:^3.0.1" - mkdirp: "npm:^3.0.1" + minizlib: "npm:^3.1.0" yallist: "npm:^5.0.0" - checksum: 10c0/d4679609bb2a9b48eeaf84632b6d844128d2412b95b6de07d53d8ee8baf4ca0857c9331dfa510390a0727b550fd543d4d1a10995ad86cdf078423fbb8d99831d + checksum: 10c0/0dad0596a61586180981133b20c32cfd93c5863c5b7140d646714e6ea8ec84583b879e5dc3928a4d683be6e6109ad7ea3de1cf71986d5194f81b3a016c8858c9 languageName: node linkType: hard @@ -4086,6 +4076,13 @@ __metadata: languageName: node linkType: hard +"undici-types@npm:~7.12.0": + version: 7.12.0 + resolution: "undici-types@npm:7.12.0" + checksum: 10c0/326e455bbc0026db1d6b81c76a1cf10c63f7e2f9821db2e24fdc258f482814e5bfa8481f8910d07c68e305937c5c049610fdc441c5e8b7bb0daca7154fb8a306 + languageName: node + linkType: hard + "unicorn-magic@npm:^0.1.0": version: 0.1.0 resolution: "unicorn-magic@npm:0.1.0" @@ -4284,7 +4281,7 @@ __metadata: languageName: node linkType: hard -"yaml@npm:^2.8.1": +"yaml@npm:2.8.1": version: 2.8.1 resolution: "yaml@npm:2.8.1" bin: