Skip to content

Commit 9769b6f

Browse files
Merge pull request #12 from mongodb-js/MCP-174
feat: Added getDeploymentId
2 parents bbd569b + 7c1f3f3 commit 9769b6f

File tree

7 files changed

+167
-154
lines changed

7 files changed

+167
-154
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ crate-type = ["cdylib"]
1010

1111
[dependencies]
1212
anyhow = "1.0.99"
13-
atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "df190245295e6675949fb5c63a164fadc0007dab" }
13+
atlas-local = { git = "https://github.com/mongodb/atlas-local-lib.git", rev = "f874fe90553e5158034aea0587669f0e8ac75127" }
1414
bollard = "0.19.2"
1515
napi = { version = "^3.3.0", features = ["async", "anyhow"] }
1616
napi-derive = "^3.2.5"

__test__/index.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ test('smoke test', async (t) => {
3737
let deployment = await client.createDeployment(createDeploymentOptions)
3838
t.is(deployment.name, createDeploymentOptions.name)
3939

40+
// Get the deployment id twice, make sure it's the same
41+
let deploymentId = await client.getDeploymentId(createDeploymentOptions.name)
42+
let deploymentId2 = await client.getDeploymentId(createDeploymentOptions.name)
43+
t.is(deploymentId, deploymentId2)
44+
4045
// Get deployment
4146
let getDeployment = await client.getDeployment(createDeploymentOptions.name)
4247
t.is(getDeployment.name,createDeploymentOptions.name)

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export declare class Client {
77
deleteDeployment(deploymentName: string): Promise<void>
88
getDeployment(deploymentName: string): Promise<Deployment>
99
getConnectionString(options: GetConnectionStringOptions): Promise<string>
10+
getDeploymentId(clusterIdOrName: string): Promise<string>
1011
}
1112

1213
export declare const enum BindingType {

index.js

Lines changed: 50 additions & 50 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"@oxc-node/core": "^0.0.32",
6262
"@taplo/cli": "^0.7.0",
6363
"@tybys/wasm-util": "^0.10.0",
64+
"@types/node": "^24.5.2",
6465
"ava": "^6.4.1",
6566
"chalk": "^5.4.1",
6667
"husky": "^9.1.7",

src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,13 @@ impl Client {
8282
.await
8383
.context("get connection string")
8484
}
85+
86+
#[napi]
87+
pub async fn get_deployment_id(&self, cluster_id_or_name: String) -> Result<String> {
88+
self
89+
.client
90+
.get_deployment_id(&cluster_id_or_name)
91+
.await
92+
.context("get deployment id")
93+
}
8594
}

0 commit comments

Comments
 (0)