@distilled.cloud/supabase 0.17.0 → 0.18.1

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.supabase.com";
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,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
+ {"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,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;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.supabase.com";
7
8
  export class Credentials extends Context.Service()("SupabaseCredentials") {
8
9
  }
9
- export const CredentialsFromEnv = Layer.effect(Credentials, Effect.gen(function* () {
10
- const accessToken = process.env.SUPABASE_ACCESS_TOKEN;
11
- if (!accessToken) {
12
- return yield* new ConfigError({
13
- message: "SUPABASE_ACCESS_TOKEN environment variable is required",
14
- });
15
- }
16
- return {
17
- accessToken: Redacted.make(accessToken),
18
- apiBaseUrl: DEFAULT_API_BASE_URL,
19
- };
20
- }));
10
+ const envConfig = EffectConfig.all({
11
+ accessToken: EffectConfig.string("SUPABASE_ACCESS_TOKEN"),
12
+ });
13
+ export const CredentialsFromEnv = Layer.effect(Credentials, envConfig.asEffect().pipe(Effect.mapError(() => new ConfigError({
14
+ message: "SUPABASE_ACCESS_TOKEN environment variable is required",
15
+ })), Effect.map(({ accessToken }) => ({
16
+ accessToken: Redacted.make(accessToken),
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,OAAO,KAAK,QAAQ,MAAM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C,WAAW,EAAE,YAAY,CAAC,MAAM,CAAC,uBAAuB,CAAC;CAC1D,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,wDAAwD;CAClE,CAAC,CACL,EACD,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/B,WAAW,EAAE,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC;IACvC,UAAU,EAAE,oBAAoB;CACjC,CAAC,CAAC,CACJ,CACF,CAAC"}
@@ -0,0 +1,19 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { Forbidden } from "../errors.ts";
3
+ export declare const V1RestorePhysicalBackupInput: Schema.Struct<{
4
+ readonly ref: Schema.String;
5
+ readonly id: Schema.Number;
6
+ }>;
7
+ export type V1RestorePhysicalBackupInput = typeof V1RestorePhysicalBackupInput.Type;
8
+ export declare const V1RestorePhysicalBackupOutput: Schema.Void;
9
+ export type V1RestorePhysicalBackupOutput = typeof V1RestorePhysicalBackupOutput.Type;
10
+ /**
11
+ * Restores a physical backup for a database
12
+ *
13
+ * @param ref - Project ref
14
+ */
15
+ export declare const v1RestorePhysicalBackup: import("@distilled.cloud/core/client").OperationMethod<{
16
+ readonly id: number;
17
+ readonly ref: string;
18
+ }, void, Forbidden, import("../credentials.ts").Credentials>;
19
+ //# sourceMappingURL=v1RestorePhysicalBackup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1RestorePhysicalBackup.d.ts","sourceRoot":"","sources":["../../src/operations/v1RestorePhysicalBackup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGzC,eAAO,MAAM,4BAA4B;;;EAStC,CAAC;AACJ,MAAM,MAAM,4BAA4B,GACtC,OAAO,4BAA4B,CAAC,IAAI,CAAC;AAG3C,eAAO,MAAM,6BAA6B,aACD,CAAC;AAC1C,MAAM,MAAM,6BAA6B,GACvC,OAAO,6BAA6B,CAAC,IAAI,CAAC;AAG5C;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;4DAMnC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { API } from "../client.js";
3
+ import * as T from "../traits.js";
4
+ import { Forbidden } from "../errors.js";
5
+ // Input Schema
6
+ export const V1RestorePhysicalBackupInput =
7
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
8
+ ref: Schema.String.pipe(T.PathParam()),
9
+ id: Schema.Number,
10
+ }).pipe(T.Http({
11
+ method: "POST",
12
+ path: "/v1/projects/{ref}/database/backups/restore",
13
+ }));
14
+ // Output Schema
15
+ export const V1RestorePhysicalBackupOutput =
16
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Void;
17
+ // The operation
18
+ /**
19
+ * Restores a physical backup for a database
20
+ *
21
+ * @param ref - Project ref
22
+ */
23
+ export const v1RestorePhysicalBackup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
24
+ inputSchema: V1RestorePhysicalBackupInput,
25
+ outputSchema: V1RestorePhysicalBackupOutput,
26
+ errors: [Forbidden],
27
+ }));
28
+ //# sourceMappingURL=v1RestorePhysicalBackup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v1RestorePhysicalBackup.js","sourceRoot":"","sources":["../../src/operations/v1RestorePhysicalBackup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,CAAC,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAe;AACf,MAAM,CAAC,MAAM,4BAA4B;AACvC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;IACxC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;IACtC,EAAE,EAAE,MAAM,CAAC,MAAM;CAClB,CAAC,CAAC,IAAI,CACL,CAAC,CAAC,IAAI,CAAC;IACL,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,6CAA6C;CACpD,CAAC,CACH,CAAC;AAIJ,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B;AACxC,aAAa,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC;AAI1C,gBAAgB;AAChB;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CACzE,GAAG,EAAE,CAAC,CAAC;IACL,WAAW,EAAE,4BAA4B;IACzC,YAAY,EAAE,6BAA6B;IAC3C,MAAM,EAAE,CAAC,SAAS,CAAU;CAC7B,CAAC,CACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distilled.cloud/supabase",
3
- "version": "0.17.0",
3
+ "version": "0.18.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/alchemy-run/distilled",
@@ -74,7 +74,7 @@
74
74
  "specs:update": "git -C specs/distilled-spec-supabase fetch && git -C specs/distilled-spec-supabase checkout main && git -C specs/distilled-spec-supabase pull"
75
75
  },
76
76
  "dependencies": {
77
- "@distilled.cloud/core": "0.17.0"
77
+ "@distilled.cloud/core": "0.18.1"
78
78
  },
79
79
  "devDependencies": {
80
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.supabase.com";
@@ -15,20 +16,22 @@ export class Credentials extends Context.Service<Credentials, Config>()(
15
16
  "SupabaseCredentials",
16
17
  ) {}
17
18
 
19
+ const envConfig = EffectConfig.all({
20
+ accessToken: EffectConfig.string("SUPABASE_ACCESS_TOKEN"),
21
+ });
22
+
18
23
  export const CredentialsFromEnv = Layer.effect(
19
24
  Credentials,
20
- Effect.gen(function* () {
21
- const accessToken = process.env.SUPABASE_ACCESS_TOKEN;
22
-
23
- if (!accessToken) {
24
- return yield* new ConfigError({
25
- message: "SUPABASE_ACCESS_TOKEN environment variable is required",
26
- });
27
- }
28
-
29
- return {
25
+ envConfig.asEffect().pipe(
26
+ Effect.mapError(
27
+ () =>
28
+ new ConfigError({
29
+ message: "SUPABASE_ACCESS_TOKEN environment variable is required",
30
+ }),
31
+ ),
32
+ Effect.map(({ accessToken }) => ({
30
33
  accessToken: Redacted.make(accessToken),
31
34
  apiBaseUrl: DEFAULT_API_BASE_URL,
32
- };
33
- }),
35
+ })),
36
+ ),
34
37
  );
@@ -0,0 +1,38 @@
1
+ import * as Schema from "effect/Schema";
2
+ import { API } from "../client.ts";
3
+ import * as T from "../traits.ts";
4
+ import { Forbidden } from "../errors.ts";
5
+
6
+ // Input Schema
7
+ export const V1RestorePhysicalBackupInput =
8
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
9
+ ref: Schema.String.pipe(T.PathParam()),
10
+ id: Schema.Number,
11
+ }).pipe(
12
+ T.Http({
13
+ method: "POST",
14
+ path: "/v1/projects/{ref}/database/backups/restore",
15
+ }),
16
+ );
17
+ export type V1RestorePhysicalBackupInput =
18
+ typeof V1RestorePhysicalBackupInput.Type;
19
+
20
+ // Output Schema
21
+ export const V1RestorePhysicalBackupOutput =
22
+ /*@__PURE__*/ /*#__PURE__*/ Schema.Void;
23
+ export type V1RestorePhysicalBackupOutput =
24
+ typeof V1RestorePhysicalBackupOutput.Type;
25
+
26
+ // The operation
27
+ /**
28
+ * Restores a physical backup for a database
29
+ *
30
+ * @param ref - Project ref
31
+ */
32
+ export const v1RestorePhysicalBackup = /*@__PURE__*/ /*#__PURE__*/ API.make(
33
+ () => ({
34
+ inputSchema: V1RestorePhysicalBackupInput,
35
+ outputSchema: V1RestorePhysicalBackupOutput,
36
+ errors: [Forbidden] as const,
37
+ }),
38
+ );