@distilled.cloud/supabase 0.2.6 → 0.3.0-alpha

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/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # @distilled.cloud/supabase
2
+
3
+ Effect-native Supabase Management API SDK generated from the [Supabase OpenAPI specification](https://supabase.com/docs/reference/api). Manage projects, databases, branches, functions, secrets, auth, storage, and more with exhaustive error typing.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @distilled.cloud/supabase effect
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { Effect, Layer } from "effect";
15
+ import * as FetchHttpClient from "effect/unstable/http/FetchHttpClient";
16
+ import { v1ListAllProjects } from "@distilled.cloud/supabase/Operations";
17
+ import { CredentialsFromEnv } from "@distilled.cloud/supabase";
18
+
19
+ const program = Effect.gen(function* () {
20
+ const projects = yield* v1ListAllProjects({});
21
+ return projects;
22
+ });
23
+
24
+ const SupabaseLive = Layer.mergeAll(FetchHttpClient.layer, CredentialsFromEnv);
25
+
26
+ program.pipe(Effect.provide(SupabaseLive), Effect.runPromise);
27
+ ```
28
+
29
+ ## Configuration
30
+
31
+ Set the following environment variable:
32
+
33
+ ```bash
34
+ SUPABASE_ACCESS_TOKEN=sbp_...
35
+ ```
36
+
37
+ Generate an access token in the [Supabase dashboard](https://supabase.com/dashboard/account/tokens) under **Account > Access Tokens**.
38
+
39
+ ## Error Handling
40
+
41
+ ```typescript
42
+ import { v1GetProject } from "@distilled.cloud/supabase/Operations";
43
+
44
+ v1GetProject({ ref: "missing-project" }).pipe(
45
+ Effect.catchTags({
46
+ NotFound: () => Effect.succeed(null),
47
+ UnknownSupabaseError: (e) => Effect.fail(new Error(`Unknown: ${e.message}`)),
48
+ }),
49
+ );
50
+ ```
51
+
52
+ ## Services
53
+
54
+ Key operation areas include:
55
+
56
+ - **Projects** -- list, create, get, update, delete, pause, restore, upgrade, usage, health
57
+ - **Branches** -- list, create, get, delete, push, merge, reset, restore, diff, config
58
+ - **Organizations** -- list, create, get, members
59
+ - **Functions** -- list, get, deploy, update, delete, stats
60
+ - **Secrets** -- list, bulk create, bulk delete
61
+ - **Database** -- run queries, generate TypeScript types, migration history, apply/rollback migrations
62
+ - **Auth** -- config, OAuth, token exchange
63
+ - **Network** -- restrictions, bans, IP addresses, SSL enforcement
64
+ - **Custom Hostname** -- activate, verify DNS, manage vanity subdomains
65
+ - **Postgres** -- config, PgBouncer, upgrade eligibility
66
+ - **Storage & Pooler** -- storage and connection pooler configuration
67
+ - **Addons & Replicas** -- manage addons, read replicas
68
+ - **Disk** -- get, modify, autoscale config, utilization
69
+ - **Backups** -- list, restore PITR, create restore points
70
+ - **API Keys** -- list, create, get, update, delete, signing keys
71
+ - **SSO Providers** -- CRUD for single sign-on providers
72
+ - **JIT Access** -- just-in-time database access management
73
+
74
+ ## License
75
+
76
+ MIT
package/lib/client.d.ts CHANGED
@@ -1,10 +1,3 @@
1
- /**
2
- * Supabase API Client.
3
- *
4
- * Wraps the shared REST client from sdk-core with Supabase-specific
5
- * error matching and credential handling.
6
- */
7
- import * as Effect from "effect/Effect";
8
1
  import * as Schema from "effect/Schema";
9
2
  export { UnknownSupabaseError } from "./errors.ts";
10
3
  /**
@@ -12,6 +5,6 @@ export { UnknownSupabaseError } from "./errors.ts";
12
5
  */
13
6
  export declare const API: {
14
7
  make: <I extends Schema.Top, O extends Schema.Top, const E extends readonly import("@distilled.cloud/core/client").ApiErrorClass[] = readonly []>(configFn: () => import("@distilled.cloud/core/client").OperationConfig<I, O, E>) => any;
15
- makePaginated: <I extends Schema.Top, O extends Schema.Top, const E extends readonly import("@distilled.cloud/core/client").ApiErrorClass[] = readonly []>(configFn: () => import("@distilled.cloud/core/client").PaginatedOperationConfig<I, O, E>, paginateFn?: ((baseFn: (input: any) => Effect.Effect<any, any, any>, input: any, pagination: import("@distilled.cloud/core/pagination").PaginatedTrait) => import("effect/Stream").Stream<any, any, any>) | undefined) => any;
8
+ makePaginated: <I extends Schema.Top, O extends Schema.Top, const E extends readonly import("@distilled.cloud/core/client").ApiErrorClass[] = readonly []>(configFn: () => import("@distilled.cloud/core/client").PaginatedOperationConfig<I, O, E>, paginateFn?: import("@distilled.cloud/core/pagination").PaginationStrategy | undefined) => any;
16
9
  };
17
10
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAgCnD;;GAEG;AACH,eAAO,MAAM,GAAG;;;CAQd,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAgCnD;;GAEG;AACH,eAAO,MAAM,GAAG;;;CAQd,CAAC"}
package/lib/client.js CHANGED
@@ -5,6 +5,7 @@
5
5
  * error matching and credential handling.
6
6
  */
7
7
  import * as Effect from "effect/Effect";
8
+ import * as Redacted from "effect/Redacted";
8
9
  import * as Schema from "effect/Schema";
9
10
  import { makeAPI } from "@distilled.cloud/core/client";
10
11
  import { HTTP_STATUS_MAP, UnknownSupabaseError, SupabaseParseError, } from "./errors.js";
@@ -41,7 +42,7 @@ export const API = makeAPI({
41
42
  credentials: Credentials,
42
43
  getBaseUrl: (creds) => creds.apiBaseUrl,
43
44
  getAuthHeaders: (creds) => ({
44
- Authorization: `Bearer ${creds.accessToken}`,
45
+ Authorization: `Bearer ${Redacted.value(creds.accessToken)}`,
45
46
  }),
46
47
  matchError,
47
48
  ParseError: SupabaseParseError,
package/lib/client.js.map CHANGED
@@ -1 +1 @@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C,OAAO,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;QACxE,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAChB,IAAI,oBAAoB,CAAC;YACvB,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,IAAI,EAAE,SAAS;SAChB,CAAC,CACH,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,OAAO,CAAC;IACzB,WAAW,EAAE,WAAkB;IAC/B,UAAU,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,KAAK,CAAC,UAAU;IAC5C,cAAc,EAAE,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;QAC/B,aAAa,EAAE,UAAU,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE;KAC7D,CAAC;IACF,UAAU;IACV,UAAU,EAAE,kBAAyB;CACtC,CAAC,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import * as Layer from "effect/Layer";
2
+ import * as Redacted from "effect/Redacted";
2
3
  import * as ServiceMap from "effect/ServiceMap";
3
4
  import { ConfigError } from "@distilled.cloud/core/errors";
4
5
  export declare const DEFAULT_API_BASE_URL = "https://api.supabase.com";
5
6
  export interface Config {
6
- readonly accessToken: string;
7
+ readonly accessToken: Redacted.Redacted<string>;
7
8
  readonly apiBaseUrl: string;
8
9
  }
9
10
  declare const Credentials_base: ServiceMap.ServiceClass<Credentials, "SupabaseCredentials", 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,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,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,KAAK,MAAM,cAAc,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,eAAO,MAAM,oBAAoB,6BAA6B,CAAC;AAE/D,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,gBAEhC;CAAG;AAEJ,eAAO,MAAM,kBAAkB,8CAgB9B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Layer from "effect/Layer";
3
+ import * as Redacted from "effect/Redacted";
3
4
  import * as ServiceMap from "effect/ServiceMap";
4
5
  import { ConfigError } from "@distilled.cloud/core/errors";
5
6
  export const DEFAULT_API_BASE_URL = "https://api.supabase.com";
@@ -12,6 +13,9 @@ export const CredentialsFromEnv = Layer.effect(Credentials, Effect.gen(function*
12
13
  message: "SUPABASE_ACCESS_TOKEN environment variable is required",
13
14
  });
14
15
  }
15
- return { accessToken, apiBaseUrl: DEFAULT_API_BASE_URL };
16
+ return {
17
+ accessToken: Redacted.make(accessToken),
18
+ apiBaseUrl: DEFAULT_API_BASE_URL,
19
+ };
16
20
  }));
17
21
  //# 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,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAO/D,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,OAAO,EAAuB,CACxE,qBAAqB,CACtB;CAAG;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAC5C,WAAW,EACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAEtD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC;YAC5B,OAAO,EAAE,wDAAwD;SAClE,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,oBAAoB,EAAE,CAAC;AAC3D,CAAC,CAAC,CACH,CAAC"}
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,UAAU,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAO/D,MAAM,OAAO,WAAY,SAAQ,UAAU,CAAC,OAAO,EAAuB,CACxE,qBAAqB,CACtB;CAAG;AAEJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC,MAAM,CAC5C,WAAW,EACX,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC;IAEtD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,KAAK,CAAC,CAAC,IAAI,WAAW,CAAC;YAC5B,OAAO,EAAE,wDAAwD;SAClE,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;QACvC,UAAU,EAAE,oBAAoB;KACjC,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/supabase",
3
- "version": "0.2.6",
3
+ "version": "0.3.0-alpha",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/alchemy-run/distilled",
@@ -73,7 +73,7 @@
73
73
  "specs:update": "git -C specs/distilled-spec-supabase fetch && git -C specs/distilled-spec-supabase checkout main && git -C specs/distilled-spec-supabase pull"
74
74
  },
75
75
  "dependencies": {
76
- "@distilled.cloud/core": "0.2.6",
76
+ "@distilled.cloud/core": "0.3.0-alpha",
77
77
  "effect": "4.0.0-beta.30"
78
78
  },
79
79
  "devDependencies": {
package/src/client.ts CHANGED
@@ -5,6 +5,7 @@
5
5
  * error matching and credential handling.
6
6
  */
7
7
  import * as Effect from "effect/Effect";
8
+ import * as Redacted from "effect/Redacted";
8
9
  import * as Schema from "effect/Schema";
9
10
  import { makeAPI } from "@distilled.cloud/core/client";
10
11
  import {
@@ -53,7 +54,7 @@ export const API = makeAPI({
53
54
  credentials: Credentials as any,
54
55
  getBaseUrl: (creds: any) => creds.apiBaseUrl,
55
56
  getAuthHeaders: (creds: any) => ({
56
- Authorization: `Bearer ${creds.accessToken}`,
57
+ Authorization: `Bearer ${Redacted.value(creds.accessToken)}`,
57
58
  }),
58
59
  matchError,
59
60
  ParseError: SupabaseParseError as any,
@@ -1,12 +1,13 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Layer from "effect/Layer";
3
+ import * as Redacted from "effect/Redacted";
3
4
  import * as ServiceMap from "effect/ServiceMap";
4
5
  import { ConfigError } from "@distilled.cloud/core/errors";
5
6
 
6
7
  export const DEFAULT_API_BASE_URL = "https://api.supabase.com";
7
8
 
8
9
  export interface Config {
9
- readonly accessToken: string;
10
+ readonly accessToken: Redacted.Redacted<string>;
10
11
  readonly apiBaseUrl: string;
11
12
  }
12
13
 
@@ -25,6 +26,9 @@ export const CredentialsFromEnv = Layer.effect(
25
26
  });
26
27
  }
27
28
 
28
- return { accessToken, apiBaseUrl: DEFAULT_API_BASE_URL };
29
+ return {
30
+ accessToken: Redacted.make(accessToken),
31
+ apiBaseUrl: DEFAULT_API_BASE_URL,
32
+ };
29
33
  }),
30
34
  );