@distilled.cloud/kubernetes 0.16.9 → 0.18.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.
@@ -1,6 +1,6 @@
1
+ import * as Context from "effect/Context";
1
2
  import * as Layer from "effect/Layer";
2
3
  import * as Redacted from "effect/Redacted";
3
- import * as Context from "effect/Context";
4
4
  import { ConfigError } from "@distilled.cloud/core/errors";
5
5
  export interface Config {
6
6
  /**
@@ -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,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE1C;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAEhC;CAAG;AAEJ;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,8CAyB9B,CAAC"}
1
+ {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAE1C,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,WAAW,MAAM;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAE1C;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAEhC;CAAG;AAOJ;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,8CAkB9B,CAAC"}
@@ -1,10 +1,15 @@
1
+ import * as EffectConfig from "effect/Config";
2
+ import * as Context from "effect/Context";
1
3
  import * as Effect from "effect/Effect";
2
4
  import * as Layer from "effect/Layer";
3
5
  import * as Redacted from "effect/Redacted";
4
- import * as Context from "effect/Context";
5
6
  import { ConfigError } from "@distilled.cloud/core/errors";
6
7
  export class Credentials extends Context.Service()("KubernetesCredentials") {
7
8
  }
9
+ const envConfig = EffectConfig.all({
10
+ token: EffectConfig.string("KUBERNETES_TOKEN"),
11
+ apiBaseUrl: EffectConfig.string("KUBERNETES_API_URL"),
12
+ });
8
13
  /**
9
14
  * Build a credentials layer from environment variables.
10
15
  *
@@ -13,22 +18,13 @@ export class Credentials extends Context.Service()("KubernetesCredentials") {
13
18
  * | `KUBERNETES_TOKEN` | yes | Bearer token for authentication |
14
19
  * | `KUBERNETES_API_URL` | yes | API server URL (e.g. from `kubectl cluster-info`) |
15
20
  */
16
- export const CredentialsFromEnv = Layer.effect(Credentials, Effect.gen(function* () {
17
- const token = process.env.KUBERNETES_TOKEN;
18
- const apiBaseUrl = process.env.KUBERNETES_API_URL;
19
- if (!token) {
20
- return yield* new ConfigError({
21
- message: "KUBERNETES_TOKEN environment variable is required. " +
22
- "Set it to a bearer token for your Kubernetes cluster.",
23
- });
24
- }
25
- if (!apiBaseUrl) {
26
- return yield* new ConfigError({
27
- message: "KUBERNETES_API_URL environment variable is required. " +
28
- "Set it to the API server URL for your Kubernetes cluster " +
29
- "(e.g. from `kubectl cluster-info` or the EKS cluster endpoint).",
30
- });
31
- }
32
- return { token: Redacted.make(token), apiBaseUrl };
33
- }));
21
+ export const CredentialsFromEnv = Layer.effect(Credentials, envConfig.asEffect().pipe(Effect.mapError(() => new ConfigError({
22
+ message: "KUBERNETES_TOKEN and KUBERNETES_API_URL environment variables are required. " +
23
+ "Set KUBERNETES_TOKEN to a bearer token for your Kubernetes cluster, " +
24
+ "and KUBERNETES_API_URL to the API server URL (e.g. from `kubectl cluster-info` " +
25
+ "or the EKS cluster endpoint).",
26
+ })), Effect.map(({ token, apiBaseUrl }) => ({
27
+ token: Redacted.make(token),
28
+ apiBaseUrl,
29
+ }))));
34
30
  //# sourceMappingURL=credentials.js.map
@@ -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,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAqB3D,MAAM,OAAO,WAAY,SAAQ,OAAO,CAAC,OAAO,EAAuB,CACrE,uBAAuB,CACxB;CAAG;AAEJ;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAC5C,WAAW,EACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAElD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC;YAC5B,OAAO,EACL,qDAAqD;gBACrD,uDAAuD;SAC1D,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC;YAC5B,OAAO,EACL,uDAAuD;gBACvD,2DAA2D;gBAC3D,iEAAiE;S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json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/kubernetes",
3
- "version": "0.16.9",
3
+ "version": "0.18.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/alchemy-run/distilled",
@@ -74,8 +74,7 @@
74
74
  "specs:update": "git -C specs/kubernetes fetch && git -C specs/kubernetes checkout master && git -C specs/kubernetes pull"
75
75
  },
76
76
  "dependencies": {
77
- "@distilled.cloud/core": "0.16.9",
78
- "effect": ">=4.0.0-beta.60 || >=4.0.0"
77
+ "@distilled.cloud/core": "0.18.0"
79
78
  },
80
79
  "devDependencies": {
81
80
  "@types/bun": "^1.3.0",
@@ -1,7 +1,8 @@
1
+ import * as EffectConfig from "effect/Config";
2
+ import * as Context from "effect/Context";
1
3
  import * as Effect from "effect/Effect";
2
4
  import * as Layer from "effect/Layer";
3
5
  import * as Redacted from "effect/Redacted";
4
- import * as Context from "effect/Context";
5
6
  import { ConfigError } from "@distilled.cloud/core/errors";
6
7
 
7
8
  export interface Config {
@@ -27,6 +28,11 @@ export class Credentials extends Context.Service<Credentials, Config>()(
27
28
  "KubernetesCredentials",
28
29
  ) {}
29
30
 
31
+ const envConfig = EffectConfig.all({
32
+ token: EffectConfig.string("KUBERNETES_TOKEN"),
33
+ apiBaseUrl: EffectConfig.string("KUBERNETES_API_URL"),
34
+ });
35
+
30
36
  /**
31
37
  * Build a credentials layer from environment variables.
32
38
  *
@@ -37,27 +43,20 @@ export class Credentials extends Context.Service<Credentials, Config>()(
37
43
  */
38
44
  export const CredentialsFromEnv = Layer.effect(
39
45
  Credentials,
40
- Effect.gen(function* () {
41
- const token = process.env.KUBERNETES_TOKEN;
42
- const apiBaseUrl = process.env.KUBERNETES_API_URL;
43
-
44
- if (!token) {
45
- return yield* new ConfigError({
46
- message:
47
- "KUBERNETES_TOKEN environment variable is required. " +
48
- "Set it to a bearer token for your Kubernetes cluster.",
49
- });
50
- }
51
-
52
- if (!apiBaseUrl) {
53
- return yield* new ConfigError({
54
- message:
55
- "KUBERNETES_API_URL environment variable is required. " +
56
- "Set it to the API server URL for your Kubernetes cluster " +
57
- "(e.g. from `kubectl cluster-info` or the EKS cluster endpoint).",
58
- });
59
- }
60
-
61
- return { token: Redacted.make(token), apiBaseUrl };
62
- }),
46
+ envConfig.asEffect().pipe(
47
+ Effect.mapError(
48
+ () =>
49
+ new ConfigError({
50
+ message:
51
+ "KUBERNETES_TOKEN and KUBERNETES_API_URL environment variables are required. " +
52
+ "Set KUBERNETES_TOKEN to a bearer token for your Kubernetes cluster, " +
53
+ "and KUBERNETES_API_URL to the API server URL (e.g. from `kubectl cluster-info` " +
54
+ "or the EKS cluster endpoint).",
55
+ }),
56
+ ),
57
+ Effect.map(({ token, apiBaseUrl }) => ({
58
+ token: Redacted.make(token),
59
+ apiBaseUrl,
60
+ })),
61
+ ),
63
62
  );