@distilled.cloud/turso 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 declare const DEFAULT_API_BASE_URL = "https://api.turso.tech";
6
6
  export interface Config {
@@ -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,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;AAEJ,eAAO,MAAM,kBAAkB,8CAa9B,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,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;AAMJ,eAAO,MAAM,kBAAkB,8CAc9B,CAAC"}
@@ -1,18 +1,19 @@
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 const DEFAULT_API_BASE_URL = "https://api.turso.tech";
7
8
  export class Credentials extends Context.Service()("TursoCredentials") {
8
9
  }
9
- export const CredentialsFromEnv = Layer.effect(Credentials, Effect.gen(function* () {
10
- const apiKey = process.env.TURSO_API_KEY;
11
- if (!apiKey) {
12
- return yield* new ConfigError({
13
- message: "TURSO_API_KEY environment variable is required",
14
- });
15
- }
16
- return { apiKey: Redacted.make(apiKey), apiBaseUrl: DEFAULT_API_BASE_URL };
17
- }));
10
+ const envConfig = EffectConfig.all({
11
+ apiKey: EffectConfig.string("TURSO_API_KEY"),
12
+ });
13
+ export const CredentialsFromEnv = Layer.effect(Credentials, envConfig.asEffect().pipe(Effect.mapError(() => new ConfigError({
14
+ message: "TURSO_API_KEY environment variable is required",
15
+ })), Effect.map(({ apiKey }) => ({
16
+ apiKey: Redacted.make(apiKey),
17
+ apiBaseUrl: DEFAULT_API_BASE_URL,
18
+ }))));
18
19
  //# 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,C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C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAC5C,WAAW,EACX,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,CACvB,MAAM,CAAC,QAAQ,CACb,GAAG,EAAE,CACH,IAAI,WAAW,CAAC;IACd,OAAO,EAAE,gDAAgD;CAC1D,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAC1B,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7B,UAAU,EAAE,oBAAoB;CACjC,CAAC,CAAC,CACJ,CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/turso",
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/turso-docs fetch && git -C specs/turso-docs checkout main && git -C specs/turso-docs 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 const DEFAULT_API_BASE_URL = "https://api.turso.tech";
@@ -15,17 +16,22 @@ export class Credentials extends Context.Service<Credentials, Config>()(
15
16
  "TursoCredentials",
16
17
  ) {}
17
18
 
19
+ const envConfig = EffectConfig.all({
20
+ apiKey: EffectConfig.string("TURSO_API_KEY"),
21
+ });
22
+
18
23
  export const CredentialsFromEnv = Layer.effect(
19
24
  Credentials,
20
- Effect.gen(function* () {
21
- const apiKey = process.env.TURSO_API_KEY;
22
-
23
- if (!apiKey) {
24
- return yield* new ConfigError({
25
- message: "TURSO_API_KEY environment variable is required",
26
- });
27
- }
28
-
29
- return { apiKey: Redacted.make(apiKey), apiBaseUrl: DEFAULT_API_BASE_URL };
30
- }),
25
+ envConfig.asEffect().pipe(
26
+ Effect.mapError(
27
+ () =>
28
+ new ConfigError({
29
+ message: "TURSO_API_KEY environment variable is required",
30
+ }),
31
+ ),
32
+ Effect.map(({ apiKey }) => ({
33
+ apiKey: Redacted.make(apiKey),
34
+ apiBaseUrl: DEFAULT_API_BASE_URL,
35
+ })),
36
+ ),
31
37
  );