@distilled.cloud/mongodb-atlas 0.23.1 → 0.24.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/lib/credentials.d.ts +3 -3
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +2 -2
- package/lib/credentials.js.map +1 -1
- package/package.json +2 -2
- package/src/credentials.ts +6 -5
package/lib/credentials.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ConfigError } from "@distilled.cloud/core/errors";
|
|
2
1
|
import * as Context from "effect/Context";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as Redacted from "effect/Redacted";
|
|
5
5
|
export declare const DEFAULT_API_BASE_URL = "https://cloud.mongodb.com";
|
|
@@ -7,9 +7,9 @@ export interface Config {
|
|
|
7
7
|
readonly accessToken: Redacted.Redacted<string>;
|
|
8
8
|
readonly apiBaseUrl: string;
|
|
9
9
|
}
|
|
10
|
-
declare const Credentials_base: Context.ServiceClass<Credentials, "Mongodb-atlasCredentials", Config
|
|
10
|
+
declare const Credentials_base: Context.ServiceClass<Credentials, "Mongodb-atlasCredentials", Effect.Effect<Config, never, never>>;
|
|
11
11
|
export declare class Credentials extends Credentials_base {
|
|
12
12
|
}
|
|
13
|
-
export declare const CredentialsFromEnv: Layer.Layer<Credentials,
|
|
13
|
+
export declare const CredentialsFromEnv: Layer.Layer<Credentials, never, never>;
|
|
14
14
|
export {};
|
|
15
15
|
//# sourceMappingURL=credentials.d.ts.map
|
package/lib/credentials.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,oBAAoB,8BAA8B,CAAC;AAEhE,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAGF;CAAG;AAUlC,eAAO,MAAM,kBAAkB,wCA0C9B,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -12,7 +12,7 @@ const envConfig = EffectConfig.all({
|
|
|
12
12
|
clientSecret: EffectConfig.string("MONGODB_ATLAS_CLIENT_SECRET"),
|
|
13
13
|
apiBaseUrl: EffectConfig.string("MONGODB_ATLAS_API_BASE_URL").pipe(EffectConfig.withDefault(DEFAULT_API_BASE_URL)),
|
|
14
14
|
});
|
|
15
|
-
export const CredentialsFromEnv = Layer.
|
|
15
|
+
export const CredentialsFromEnv = Layer.succeed(Credentials, Effect.gen(function* () {
|
|
16
16
|
const { clientId, clientSecret, apiBaseUrl } = yield* envConfig.pipe(Effect.mapError(() => new ConfigError({
|
|
17
17
|
message: "MONGODB_ATLAS_CLIENT_ID and MONGODB_ATLAS_CLIENT_SECRET environment variables are required",
|
|
18
18
|
})));
|
|
@@ -36,5 +36,5 @@ export const CredentialsFromEnv = Layer.effect(Credentials, Effect.gen(function*
|
|
|
36
36
|
accessToken: Redacted.make(data.access_token),
|
|
37
37
|
apiBaseUrl,
|
|
38
38
|
};
|
|
39
|
-
}));
|
|
39
|
+
}).pipe(Effect.orDie));
|
|
40
40
|
//# sourceMappingURL=credentials.js.map
|
package/lib/credentials.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credent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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@distilled.cloud/mongodb-atlas",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/alchemy-run/distilled",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"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"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@distilled.cloud/core": "0.
|
|
77
|
+
"@distilled.cloud/core": "0.24.0"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
80
|
"@types/bun": "^1.3.0",
|
package/src/credentials.ts
CHANGED
|
@@ -12,9 +12,10 @@ export interface Config {
|
|
|
12
12
|
readonly apiBaseUrl: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export class Credentials extends Context.Service<
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export class Credentials extends Context.Service<
|
|
16
|
+
Credentials,
|
|
17
|
+
Effect.Effect<Config>
|
|
18
|
+
>()("Mongodb-atlasCredentials") {}
|
|
18
19
|
|
|
19
20
|
const envConfig = EffectConfig.all({
|
|
20
21
|
clientId: EffectConfig.string("MONGODB_ATLAS_CLIENT_ID"),
|
|
@@ -24,7 +25,7 @@ const envConfig = EffectConfig.all({
|
|
|
24
25
|
),
|
|
25
26
|
});
|
|
26
27
|
|
|
27
|
-
export const CredentialsFromEnv = Layer.
|
|
28
|
+
export const CredentialsFromEnv = Layer.succeed(
|
|
28
29
|
Credentials,
|
|
29
30
|
Effect.gen(function* () {
|
|
30
31
|
const { clientId, clientSecret, apiBaseUrl } = yield* envConfig.pipe(
|
|
@@ -65,5 +66,5 @@ export const CredentialsFromEnv = Layer.effect(
|
|
|
65
66
|
accessToken: Redacted.make(data.access_token),
|
|
66
67
|
apiBaseUrl,
|
|
67
68
|
};
|
|
68
|
-
}),
|
|
69
|
+
}).pipe(Effect.orDie),
|
|
69
70
|
);
|