@distilled.cloud/workos 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.
- package/lib/credentials.d.ts +1 -1
- package/lib/credentials.d.ts.map +1 -1
- package/lib/credentials.js +12 -11
- package/lib/credentials.js.map +1 -1
- package/package.json +2 -3
- package/src/credentials.ts +21 -13
package/lib/credentials.d.ts
CHANGED
|
@@ -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
|
/**
|
|
6
6
|
* WorkOS production API base URL.
|
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,
|
|
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;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,2BAA2B,CAAC;AAE7D,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;AASJ,eAAO,MAAM,kBAAkB,8CAc9B,CAAC"}
|
package/lib/credentials.js
CHANGED
|
@@ -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
|
* WorkOS production API base URL.
|
|
@@ -12,14 +13,14 @@ import { ConfigError } from "@distilled.cloud/core/errors";
|
|
|
12
13
|
export const DEFAULT_API_BASE_URL = "https://api.workos.com";
|
|
13
14
|
export class Credentials extends Context.Service()("WorkosCredentials") {
|
|
14
15
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}));
|
|
16
|
+
const envConfig = EffectConfig.all({
|
|
17
|
+
apiKey: EffectConfig.string("WORKOS_API_KEY"),
|
|
18
|
+
apiBaseUrl: EffectConfig.string("WORKOS_API_URL").pipe(EffectConfig.withDefault(DEFAULT_API_BASE_URL)),
|
|
19
|
+
});
|
|
20
|
+
export const CredentialsFromEnv = Layer.effect(Credentials, envConfig.asEffect().pipe(Effect.mapError(() => new ConfigError({
|
|
21
|
+
message: "WORKOS_API_KEY environment variable is required",
|
|
22
|
+
})), Effect.map(({ apiKey, apiBaseUrl }) => ({
|
|
23
|
+
apiKey: Redacted.make(apiKey),
|
|
24
|
+
apiBaseUrl,
|
|
25
|
+
}))));
|
|
25
26
|
//# 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,
|
|
1
|
+
{"version":3,"file":"credentials.js","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"m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
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/alchemy-run/distilled",
|
|
@@ -73,8 +73,7 @@
|
|
|
73
73
|
"specs:update": "git -C specs/openapi-spec fetch && git -C specs/openapi-spec checkout main && git -C specs/openapi-spec pull"
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@distilled.cloud/core": "0.
|
|
77
|
-
"effect": ">=4.0.0-beta.60 || >=4.0.0"
|
|
76
|
+
"@distilled.cloud/core": "0.18.0"
|
|
78
77
|
},
|
|
79
78
|
"devDependencies": {
|
|
80
79
|
"@types/bun": "^1.3.0",
|
package/src/credentials.ts
CHANGED
|
@@ -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
|
/**
|
|
@@ -21,18 +22,25 @@ export class Credentials extends Context.Service<Credentials, Config>()(
|
|
|
21
22
|
"WorkosCredentials",
|
|
22
23
|
) {}
|
|
23
24
|
|
|
25
|
+
const envConfig = EffectConfig.all({
|
|
26
|
+
apiKey: EffectConfig.string("WORKOS_API_KEY"),
|
|
27
|
+
apiBaseUrl: EffectConfig.string("WORKOS_API_URL").pipe(
|
|
28
|
+
EffectConfig.withDefault(DEFAULT_API_BASE_URL),
|
|
29
|
+
),
|
|
30
|
+
});
|
|
31
|
+
|
|
24
32
|
export const CredentialsFromEnv = Layer.effect(
|
|
25
33
|
Credentials,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
envConfig.asEffect().pipe(
|
|
35
|
+
Effect.mapError(
|
|
36
|
+
() =>
|
|
37
|
+
new ConfigError({
|
|
38
|
+
message: "WORKOS_API_KEY environment variable is required",
|
|
39
|
+
}),
|
|
40
|
+
),
|
|
41
|
+
Effect.map(({ apiKey, apiBaseUrl }) => ({
|
|
42
|
+
apiKey: Redacted.make(apiKey),
|
|
43
|
+
apiBaseUrl,
|
|
44
|
+
})),
|
|
45
|
+
),
|
|
38
46
|
);
|