@distilled.cloud/mongodb-atlas 0.2.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -0
- package/lib/client.d.ts +1 -8
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +2 -1
- package/lib/client.js.map +1 -1
- package/lib/credentials.d.ts +2 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +2 -1
- package/lib/credentials.js.map +1 -1
- package/package.json +2 -2
- package/src/client.ts +2 -1
- package/src/credentials.ts +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @distilled.cloud/mongodb-atlas
|
|
2
|
+
|
|
3
|
+
Effect-native MongoDB Atlas SDK generated from the [MongoDB Atlas Administration API specification](https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/). Manage clusters, database users, projects, organizations, backups, and 390+ operations with exhaustive error typing.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @distilled.cloud/mongodb-atlas effect
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { Effect, Layer } from "effect";
|
|
15
|
+
import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
|
|
16
|
+
import { listGroupClusters } from "@distilled.cloud/mongodb-atlas/Operations";
|
|
17
|
+
import { CredentialsFromEnv } from "@distilled.cloud/mongodb-atlas";
|
|
18
|
+
|
|
19
|
+
const program = Effect.gen(function* () {
|
|
20
|
+
const clusters = yield* listGroupClusters({ groupId: "my-project-id" });
|
|
21
|
+
return clusters;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const AtlasLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv);
|
|
25
|
+
|
|
26
|
+
program.pipe(Effect.provide(AtlasLive), Effect.runPromise);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Configuration
|
|
30
|
+
|
|
31
|
+
Set the following environment variable:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
MONGODB_ATLAS_API_KEY=your-api-key
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Create an API key in the [MongoDB Atlas console](https://cloud.mongodb.com/) under **Organization Settings > API Keys** or **Project Settings > API Keys**. Grant the key an appropriate role (e.g. Organization Member, Project Owner).
|
|
38
|
+
|
|
39
|
+
## Error Handling
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { getGroupCluster } from "@distilled.cloud/mongodb-atlas/Operations";
|
|
43
|
+
|
|
44
|
+
getGroupCluster({ groupId: "my-project", clusterName: "missing" }).pipe(
|
|
45
|
+
Effect.catchTags({
|
|
46
|
+
NotFound: () => Effect.succeed(null),
|
|
47
|
+
UnknownMongodbAtlasError: (e) => Effect.fail(new Error(`Unknown: ${e.message}`)),
|
|
48
|
+
}),
|
|
49
|
+
);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Services
|
|
53
|
+
|
|
54
|
+
Key operation areas include:
|
|
55
|
+
|
|
56
|
+
- **Clusters** -- create, update, delete, status, process args, global writes, performance advisor
|
|
57
|
+
- **Flex Clusters** -- create, update, delete, backups, restore, upgrade
|
|
58
|
+
- **Database Users** -- CRUD, certificates
|
|
59
|
+
- **Groups (Projects)** -- CRUD, settings, limits, events, teams, users, API keys
|
|
60
|
+
- **Organizations** -- CRUD, settings, billing, invoices, federation, teams, users
|
|
61
|
+
- **Backups** -- compliance policies, snapshots, restore jobs, export buckets, schedules
|
|
62
|
+
- **Network** -- VPC peering, containers, private endpoints, encryption at rest
|
|
63
|
+
- **Search** -- Atlas Search indexes and deployments
|
|
64
|
+
- **Streams** -- Atlas Stream Processing workspaces, connections, processors
|
|
65
|
+
- **Data Federation** -- create, update, query logs, limits
|
|
66
|
+
- **Alerts** -- alert configurations, acknowledgment
|
|
67
|
+
- **Live Migrations** -- create, validate, cutover
|
|
68
|
+
- **Integrations** -- third-party and log integrations
|
|
69
|
+
- **Auditing** -- audit log configuration
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
package/lib/client.d.ts
CHANGED
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mongodb-atlas API Client.
|
|
3
|
-
*
|
|
4
|
-
* Wraps the shared REST client from sdk-core with Mongodb-atlas-specific
|
|
5
|
-
* error matching and credential handling.
|
|
6
|
-
*/
|
|
7
|
-
import * as Effect from "effect/Effect";
|
|
8
1
|
import * as Schema from "effect/Schema";
|
|
9
2
|
export { UnknownMongodbAtlasError } from "./errors.ts";
|
|
10
3
|
/**
|
|
@@ -12,6 +5,6 @@ export { UnknownMongodbAtlasError } from "./errors.ts";
|
|
|
12
5
|
*/
|
|
13
6
|
export declare const API: {
|
|
14
7
|
make: <I extends Schema.Top, O extends Schema.Top, const E extends readonly import("@distilled.cloud/core/client").ApiErrorClass[] = readonly []>(configFn: () => import("@distilled.cloud/core/client").OperationConfig<I, O, E>) => any;
|
|
15
|
-
makePaginated: <I extends Schema.Top, O extends Schema.Top, const E extends readonly import("@distilled.cloud/core/client").ApiErrorClass[] = readonly []>(configFn: () => import("@distilled.cloud/core/client").PaginatedOperationConfig<I, O, E>, paginateFn?:
|
|
8
|
+
makePaginated: <I extends Schema.Top, O extends Schema.Top, const E extends readonly import("@distilled.cloud/core/client").ApiErrorClass[] = readonly []>(configFn: () => import("@distilled.cloud/core/client").PaginatedOperationConfig<I, O, E>, paginateFn?: import("@distilled.cloud/core/pagination").PaginationStrategy | undefined) => any;
|
|
16
9
|
};
|
|
17
10
|
//# sourceMappingURL=client.d.ts.map
|
package/lib/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAkCvD;;GAEG;AACH,eAAO,MAAM,GAAG;;;CAQd,CAAC"}
|
package/lib/client.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* error matching and credential handling.
|
|
6
6
|
*/
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Redacted from "effect/Redacted";
|
|
8
9
|
import * as Schema from "effect/Schema";
|
|
9
10
|
import { makeAPI } from "@distilled.cloud/core/client";
|
|
10
11
|
import { HTTP_STATUS_MAP, UnknownMongodbAtlasError, MongodbAtlasParseError, } from "./errors.js";
|
|
@@ -43,7 +44,7 @@ export const API = makeAPI({
|
|
|
43
44
|
credentials: Credentials,
|
|
44
45
|
getBaseUrl: (creds) => creds.apiBaseUrl,
|
|
45
46
|
getAuthHeaders: (creds) => ({
|
|
46
|
-
Authorization: `Bearer ${creds.apiKey}`,
|
|
47
|
+
Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
|
|
47
48
|
}),
|
|
48
49
|
matchError,
|
|
49
50
|
ParseError: MongodbAtlasParseError,
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AACvD,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAErB,wCAAwC;AACxC,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,4BAA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wBAAwB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACxE,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC;IACzB,WAAW,EAAE,WAAkB;IAC/B,UAAU,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU;IAC5C,cAAc,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;QAC/B,aAAa,EAAE,UAAU,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;KACxD,CAAC;IACF,UAAU;IACV,UAAU,EAAE,sBAA6B;CAC1C,CAAC,CAAC"}
|
package/lib/credentials.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as Layer from "effect/Layer";
|
|
2
|
+
import * as Redacted from "effect/Redacted";
|
|
2
3
|
import * as ServiceMap from "effect/ServiceMap";
|
|
3
4
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
4
5
|
export declare const DEFAULT_API_BASE_URL = "https://api.mongodb-atlas.com";
|
|
5
6
|
export interface Config {
|
|
6
|
-
readonly apiKey: string
|
|
7
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
7
8
|
readonly apiBaseUrl: string;
|
|
8
9
|
}
|
|
9
10
|
declare const Credentials_base: ServiceMap.ServiceClass<Credentials, "Mongodb-atlasCredentials", Config>;
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AAEpE,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AAEpE,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAEhC;CAAG;AAEJ,eAAO,MAAM,kBAAkB,8CAa9B,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as Redacted from "effect/Redacted";
|
|
3
4
|
import * as ServiceMap from "effect/ServiceMap";
|
|
4
5
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
5
6
|
export const DEFAULT_API_BASE_URL = "https://api.mongodb-atlas.com";
|
|
@@ -12,6 +13,6 @@ export const CredentialsFromEnv = Layer.effect(Credentials, Effect.gen(function*
|
|
|
12
13
|
message: "MONGODB_ATLAS_API_KEY environment variable is required",
|
|
13
14
|
});
|
|
14
15
|
}
|
|
15
|
-
return { apiKey, apiBaseUrl: DEFAULT_API_BASE_URL };
|
|
16
|
+
return { apiKey: Redacted.make(apiKey), apiBaseUrl: DEFAULT_API_BASE_URL };
|
|
16
17
|
}));
|
|
17
18
|
//# sourceMappingURL=credentials.js.map
|
package/lib/credentials.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAOpE,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,OAAO,EAAuB,CACxE,0BAA0B,CAC3B;CAAG;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAC5C,WAAW,EACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAEjD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC;YAC5B,OAAO,EAAE,wDAAwD;SAClE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAOpE,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,OAAO,EAAuB,CACxE,0BAA0B,CAC3B;CAAG;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAC5C,WAAW,EACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAEjD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC;YAC5B,OAAO,EAAE,wDAAwD;SAClE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;AAC7E,CAAC,CAAC,CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/mongodb-atlas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/alchemy-run/distilled",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"specs:update": "git -C specs/distilled-spec-mongodb-atlas fetch && git -C specs/distilled-spec-mongodb-atlas checkout main && git -C specs/distilled-spec-mongodb-atlas pull"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@distilled.cloud/core": "0.
|
|
76
|
+
"@distilled.cloud/core": "0.4.0",
|
|
77
77
|
"effect": "4.0.0-beta.30"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
package/src/client.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* error matching and credential handling.
|
|
6
6
|
*/
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
+
import * as Redacted from "effect/Redacted";
|
|
8
9
|
import * as Schema from "effect/Schema";
|
|
9
10
|
import { makeAPI } from "@distilled.cloud/core/client";
|
|
10
11
|
import {
|
|
@@ -55,7 +56,7 @@ export const API = makeAPI({
|
|
|
55
56
|
credentials: Credentials as any,
|
|
56
57
|
getBaseUrl: (creds: any) => creds.apiBaseUrl,
|
|
57
58
|
getAuthHeaders: (creds: any) => ({
|
|
58
|
-
Authorization: `Bearer ${creds.apiKey}`,
|
|
59
|
+
Authorization: `Bearer ${Redacted.value(creds.apiKey)}`,
|
|
59
60
|
}),
|
|
60
61
|
matchError,
|
|
61
62
|
ParseError: MongodbAtlasParseError as any,
|
package/src/credentials.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
|
+
import * as Redacted from "effect/Redacted";
|
|
3
4
|
import * as ServiceMap from "effect/ServiceMap";
|
|
4
5
|
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
5
6
|
|
|
6
7
|
export const DEFAULT_API_BASE_URL = "https://api.mongodb-atlas.com";
|
|
7
8
|
|
|
8
9
|
export interface Config {
|
|
9
|
-
readonly apiKey: string
|
|
10
|
+
readonly apiKey: Redacted.Redacted<string>;
|
|
10
11
|
readonly apiBaseUrl: string;
|
|
11
12
|
}
|
|
12
13
|
|
|
@@ -25,6 +26,6 @@ export const CredentialsFromEnv = Layer.effect(
|
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
return { apiKey, apiBaseUrl: DEFAULT_API_BASE_URL };
|
|
29
|
+
return { apiKey: Redacted.make(apiKey), apiBaseUrl: DEFAULT_API_BASE_URL };
|
|
29
30
|
}),
|
|
30
31
|
);
|