@distilled.cloud/prisma-postgres 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.prisma.io";
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,0BAA0B,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAEhC;CAAG;AAEJ,eAAO,MAAM,kBAAkB,8CAgB9B,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,0BAA0B,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;;AAED,qBAAa,WAAY,SAAQ,gBAEhC;CAAG;AAMJ,eAAO,MAAM,kBAAkB,8CAc9B,CAAC"}
@@ -1,21 +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.prisma.io";
7
8
  export class Credentials extends Context.Service()("PrismaPostgresCredentials") {
8
9
  }
9
- export const CredentialsFromEnv = Layer.effect(Credentials, Effect.gen(function* () {
10
- const apiToken = process.env.PRISMA_POSTGRES_API_TOKEN;
11
- if (!apiToken) {
12
- return yield* new ConfigError({
13
- message: "PRISMA_POSTGRES_API_TOKEN environment variable is required",
14
- });
15
- }
16
- return {
17
- apiToken: Redacted.make(apiToken),
18
- apiBaseUrl: DEFAULT_API_BASE_URL,
19
- };
20
- }));
10
+ const envConfig = EffectConfig.all({
11
+ apiToken: EffectConfig.string("PRISMA_POSTGRES_API_TOKEN"),
12
+ });
13
+ export const CredentialsFromEnv = Layer.effect(Credentials, envConfig.asEffect().pipe(Effect.mapError(() => new ConfigError({
14
+ message: "PRISMA_POSTGRES_API_TOKEN environment variable is required",
15
+ })), Effect.map(({ apiToken }) => ({
16
+ apiToken: Redacted.make(apiToken),
17
+ apiBaseUrl: DEFAULT_API_BASE_URL,
18
+ }))));
21
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,O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,YAAY,CAAC,GAAG,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC,2BAA2B,CAAC;CAC3D,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,4DAA4D;CACtE,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC;IACjC,UAAU,EAAE,oBAAoB;CACjC,CAAC,CAAC,CACJ,CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/prisma-postgres",
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/distilled-spec-prisma-postgres fetch && git -C specs/distilled-spec-prisma-postgres checkout main && git -C specs/distilled-spec-prisma-postgres 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.prisma.io";
@@ -15,20 +16,22 @@ export class Credentials extends Context.Service<Credentials, Config>()(
15
16
  "PrismaPostgresCredentials",
16
17
  ) {}
17
18
 
19
+ const envConfig = EffectConfig.all({
20
+ apiToken: EffectConfig.string("PRISMA_POSTGRES_API_TOKEN"),
21
+ });
22
+
18
23
  export const CredentialsFromEnv = Layer.effect(
19
24
  Credentials,
20
- Effect.gen(function* () {
21
- const apiToken = process.env.PRISMA_POSTGRES_API_TOKEN;
22
-
23
- if (!apiToken) {
24
- return yield* new ConfigError({
25
- message: "PRISMA_POSTGRES_API_TOKEN environment variable is required",
26
- });
27
- }
28
-
29
- return {
25
+ envConfig.asEffect().pipe(
26
+ Effect.mapError(
27
+ () =>
28
+ new ConfigError({
29
+ message: "PRISMA_POSTGRES_API_TOKEN environment variable is required",
30
+ }),
31
+ ),
32
+ Effect.map(({ apiToken }) => ({
30
33
  apiToken: Redacted.make(apiToken),
31
34
  apiBaseUrl: DEFAULT_API_BASE_URL,
32
- };
33
- }),
35
+ })),
36
+ ),
34
37
  );