From d27db81d36e480a61cb3738981718740b77f6534 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 15 Jan 2025 01:15:15 +0800 Subject: [PATCH 01/22] fix: exclude pgmq schema from db dump and pull (#3043) fix: exclude pgmq schema from db dump --- internal/db/dump/dump.go | 1 + internal/utils/misc.go | 1 + pkg/migration/drop.go | 1 + 3 files changed, 3 insertions(+) diff --git a/internal/db/dump/dump.go b/internal/db/dump/dump.go index 94e2ba7af..352942921 100644 --- a/internal/db/dump/dump.go +++ b/internal/db/dump/dump.go @@ -82,6 +82,7 @@ func dumpData(ctx context.Context, config pgconn.Config, schema, excludeTable [] "graphql", "graphql_public", // "net", + // "pgmq", // "pgsodium", // "pgsodium_masks", "pgtle", diff --git a/internal/utils/misc.go b/internal/utils/misc.go index 202d80d0a..32a2fdf15 100644 --- a/internal/utils/misc.go +++ b/internal/utils/misc.go @@ -74,6 +74,7 @@ var ( "graphql", "graphql_public", "net", + "pgmq", "pgsodium", "pgsodium_masks", "pgtle", diff --git a/pkg/migration/drop.go b/pkg/migration/drop.go index 362f2a9d2..4fcdd805c 100644 --- a/pkg/migration/drop.go +++ b/pkg/migration/drop.go @@ -24,6 +24,7 @@ var ( `\_realtime`, `\_supavisor`, "pgbouncer", + "pgmq", "pgsodium", "pgtle", `supabase\_migrations`, From 7417d66fd0ce7cad4ae760d4666ae61c1524f66b Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Wed, 15 Jan 2025 14:08:01 +0900 Subject: [PATCH 02/22] fix(config): dotenvx loading (#3042) * fix(secrets): look for and try all DOTENV_PRIVATE_KEY * fix(env): look for dotenv in supabase folder and look for local env.keys * fix: apply pr comments * fix: apply PR comments --- pkg/config/config.go | 3 ++- pkg/config/secret.go | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index b2104e507..4d9a971ea 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -806,6 +806,7 @@ func sanitizeProjectId(src string) string { func loadDefaultEnv() error { env := viper.GetString("ENV") + if env == "" { env = "development" } @@ -813,7 +814,7 @@ func loadDefaultEnv() error { if env != "test" { filenames = append(filenames, ".env.local") } - filenames = append(filenames, ".env."+env, ".env") + filenames = append(filenames, ".env."+env, ".env", filepath.Join("supabase", ".env."+env), filepath.Join("supabase", ".env")) for _, path := range filenames { if err := loadEnvIfExists(path); err != nil { return err diff --git a/pkg/config/secret.go b/pkg/config/secret.go index 3f0611673..eab7f3f00 100644 --- a/pkg/config/secret.go +++ b/pkg/config/secret.go @@ -64,8 +64,20 @@ func DecryptSecretHookFunc(hashKey string) mapstructure.DecodeHookFunc { if t != reflect.TypeOf(result) { return data, nil } + // Get all env vars and filter for DOTENV_PRIVATE_KEY + var privateKeys []string + for _, env := range os.Environ() { + key := strings.Split(env, "=")[0] + if key == "DOTENV_PRIVATE_KEY" || strings.HasPrefix(key, "DOTENV_PRIVATE_KEY_") { + if value := os.Getenv(key); value != "" { + privateKeys = append(privateKeys, value) + } + } + } + + // Try each private key var err error - privKey := os.Getenv("DOTENV_PRIVATE_KEY") + privKey := strings.Join(privateKeys, ",") for _, k := range strings.Split(privKey, ",") { // Use the first private key that successfully decrypts the secret if result.Value, err = decrypt(k, data.(string)); err == nil { @@ -77,6 +89,7 @@ func DecryptSecretHookFunc(hashKey string) mapstructure.DecodeHookFunc { break } } + // If we get here, none of the keys worked return result, err } } From 678f978e1101ed508a4af5cf5741fe4b39984293 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 15 Jan 2025 21:30:57 +0800 Subject: [PATCH 03/22] fix: load nested env files up to repo directory (#3048) --- pkg/config/config.go | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 4d9a971ea..b11844d45 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -475,7 +475,7 @@ func (c *config) loadFromEnv() error { func (c *config) Load(path string, fsys fs.FS) error { builder := NewPathBuilder(path) // Load secrets from .env file - if err := loadDefaultEnv(); err != nil { + if err := loadNestedEnv(builder.SupabaseDirPath); err != nil { return err } if err := c.loadFromFile(builder.ConfigPath, fsys); err != nil { @@ -804,9 +804,30 @@ func sanitizeProjectId(src string) string { return truncateText(sanitized, maxProjectIdLength) } -func loadDefaultEnv() error { +func loadNestedEnv(basePath string) error { + repoDir, err := os.Getwd() + if err != nil { + return errors.Errorf("failed to get repo directory: %w", err) + } + if !filepath.IsAbs(basePath) { + basePath = filepath.Join(repoDir, basePath) + } env := viper.GetString("ENV") + for cwd := basePath; cwd != repoDir; cwd = filepath.Dir(cwd) { + if err := os.Chdir(cwd); err != nil && !errors.Is(err, os.ErrNotExist) { + return errors.Errorf("failed to change directory: %w", err) + } + if err := loadDefaultEnv(env); err != nil { + return err + } + } + if err := os.Chdir(repoDir); err != nil { + return errors.Errorf("failed to restore directory: %w", err) + } + return nil +} +func loadDefaultEnv(env string) error { if env == "" { env = "development" } @@ -814,7 +835,7 @@ func loadDefaultEnv() error { if env != "test" { filenames = append(filenames, ".env.local") } - filenames = append(filenames, ".env."+env, ".env", filepath.Join("supabase", ".env."+env), filepath.Join("supabase", ".env")) + filenames = append(filenames, ".env."+env, ".env") for _, path := range filenames { if err := loadEnvIfExists(path); err != nil { return err From fb0cd153aaca87e654b86699d2760b9324c490f8 Mon Sep 17 00:00:00 2001 From: Lakshan Perera Date: Thu, 16 Jan 2025 01:10:03 +1100 Subject: [PATCH 04/22] feat: support adding static files to Edge Functions (#3045) --- internal/functions/deploy/bundle.go | 6 +++++- internal/functions/deploy/bundle_test.go | 2 +- internal/functions/serve/serve.go | 3 +++ internal/functions/serve/templates/main.ts | 3 +++ pkg/config/config.go | 12 ++++++++---- pkg/config/constants.go | 2 +- pkg/config/templates/config.toml | 3 +++ pkg/function/api.go | 2 +- pkg/function/batch.go | 2 +- pkg/function/batch_test.go | 2 +- pkg/function/bundle.go | 5 ++++- pkg/function/bundle_test.go | 2 +- 12 files changed, 32 insertions(+), 12 deletions(-) diff --git a/internal/functions/deploy/bundle.go b/internal/functions/deploy/bundle.go index 02f31863f..c82826bec 100644 --- a/internal/functions/deploy/bundle.go +++ b/internal/functions/deploy/bundle.go @@ -25,7 +25,7 @@ func NewDockerBundler(fsys afero.Fs) function.EszipBundler { return &dockerBundler{fsys: fsys} } -func (b *dockerBundler) Bundle(ctx context.Context, entrypoint string, importMap string, output io.Writer) error { +func (b *dockerBundler) Bundle(ctx context.Context, entrypoint string, importMap string, staticFiles []string, output io.Writer) error { // Create temp directory to store generated eszip slug := filepath.Base(filepath.Dir(entrypoint)) fmt.Fprintln(os.Stderr, "Bundling Function:", utils.Bold(slug)) @@ -54,9 +54,13 @@ func (b *dockerBundler) Bundle(ctx context.Context, entrypoint string, importMap if len(importMap) > 0 { cmd = append(cmd, "--import-map", utils.ToDockerPath(importMap)) } + for _, staticFile := range staticFiles { + cmd = append(cmd, "--static", utils.ToDockerPath(staticFile)) + } if viper.GetBool("DEBUG") { cmd = append(cmd, "--verbose") } + env := []string{} if custom_registry := os.Getenv("NPM_CONFIG_REGISTRY"); custom_registry != "" { env = append(env, "NPM_CONFIG_REGISTRY="+custom_registry) diff --git a/internal/functions/deploy/bundle_test.go b/internal/functions/deploy/bundle_test.go index f8a68f439..45b5aedd3 100644 --- a/internal/functions/deploy/bundle_test.go +++ b/internal/functions/deploy/bundle_test.go @@ -43,7 +43,7 @@ func TestDockerBundle(t *testing.T) { apitest.MockDockerStart(utils.Docker, imageUrl, containerId) require.NoError(t, apitest.MockDockerLogsExitCode(utils.Docker, containerId, 1)) // Run test - err = NewDockerBundler(fsys).Bundle(context.Background(), "", "", &body) + err = NewDockerBundler(fsys).Bundle(context.Background(), "", "", []string{}, &body) // Check error assert.ErrorContains(t, err, "error running container: exit 1") assert.Empty(t, apitest.ListUnmatchedRequests()) diff --git a/internal/functions/serve/serve.go b/internal/functions/serve/serve.go index 485d8c7cf..2f09fed16 100644 --- a/internal/functions/serve/serve.go +++ b/internal/functions/serve/serve.go @@ -230,6 +230,9 @@ func populatePerFunctionConfigs(cwd, importMapPath string, noVerifyJWT *bool, fs fc.ImportMap = utils.ToDockerPath(fc.ImportMap) fc.Entrypoint = utils.ToDockerPath(fc.Entrypoint) functionsConfig[slug] = fc + for i, val := range fc.StaticFiles { + fc.StaticFiles[i] = utils.ToDockerPath(val) + } } functionsConfigBytes, err := json.Marshal(functionsConfig) if err != nil { diff --git a/internal/functions/serve/templates/main.ts b/internal/functions/serve/templates/main.ts index 03d4bc9a1..534409a98 100644 --- a/internal/functions/serve/templates/main.ts +++ b/internal/functions/serve/templates/main.ts @@ -178,6 +178,8 @@ Deno.serve({ const absEntrypoint = posix.join(Deno.cwd(), functionsConfig[functionName].entrypointPath); const maybeEntrypoint = posix.toFileUrl(absEntrypoint).href; + const staticPatterns = functionsConfig[functionName].staticFiles; + try { const worker = await EdgeRuntime.userWorkers.create({ servicePath, @@ -195,6 +197,7 @@ Deno.serve({ context: { useReadSyncFileAPI: true, }, + staticPatterns, }); return await worker.fetch(req); diff --git a/pkg/config/config.go b/pkg/config/config.go index b11844d45..a0bddf074 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -178,10 +178,11 @@ type ( FunctionConfig map[string]function function struct { - Enabled *bool `toml:"enabled" json:"-"` - VerifyJWT *bool `toml:"verify_jwt" json:"verifyJWT"` - ImportMap string `toml:"import_map" json:"importMapPath,omitempty"` - Entrypoint string `toml:"entrypoint" json:"entrypointPath,omitempty"` + Enabled *bool `toml:"enabled" json:"-"` + VerifyJWT *bool `toml:"verify_jwt" json:"verifyJWT"` + ImportMap string `toml:"import_map" json:"importMapPath,omitempty"` + Entrypoint string `toml:"entrypoint" json:"entrypointPath,omitempty"` + StaticFiles []string `toml:"static_files" json:"staticFiles,omitempty"` } analytics struct { @@ -592,6 +593,9 @@ func (c *baseConfig) resolve(builder pathBuilder, fsys fs.FS) error { } else if !filepath.IsAbs(function.ImportMap) { function.ImportMap = filepath.Join(builder.SupabaseDirPath, function.ImportMap) } + for i, val := range function.StaticFiles { + function.StaticFiles[i] = filepath.Join(builder.SupabaseDirPath, val) + } c.Functions[slug] = function } return c.Db.Seed.loadSeedPaths(builder.SupabaseDirPath, fsys) diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 3aa5c9d7d..4183b4857 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -12,7 +12,7 @@ const ( pgmetaImage = "supabase/postgres-meta:v0.84.2" studioImage = "supabase/studio:20250113-83c9420" imageProxyImage = "darthsim/imgproxy:v3.8.0" - edgeRuntimeImage = "supabase/edge-runtime:v1.66.4" + edgeRuntimeImage = "supabase/edge-runtime:v1.66.5" vectorImage = "timberio/vector:0.28.1-alpine" supavisorImage = "supabase/supavisor:1.1.56" gotrueImage = "supabase/gotrue:v2.167.0" diff --git a/pkg/config/templates/config.toml b/pkg/config/templates/config.toml index 6c50b1447..c8528d8f5 100644 --- a/pkg/config/templates/config.toml +++ b/pkg/config/templates/config.toml @@ -257,6 +257,9 @@ inspector_port = 8083 # Uncomment to specify a custom file path to the entrypoint. # Supported file extensions are: .ts, .js, .mjs, .jsx, .tsx # entrypoint = "./functions/MY_FUNCTION_NAME/index.ts" +# Specifies static files to be bundled with the function. Supports glob patterns. +# For example, if you want to serve static HTML pages in your function: +# static_files = [ "./functions/MY_FUNCTION_NAME/*.html" ] [analytics] enabled = true diff --git a/pkg/function/api.go b/pkg/function/api.go index e3f641dee..9fdf52b51 100644 --- a/pkg/function/api.go +++ b/pkg/function/api.go @@ -14,7 +14,7 @@ type EdgeRuntimeAPI struct { } type EszipBundler interface { - Bundle(ctx context.Context, entrypoint string, importMap string, output io.Writer) error + Bundle(ctx context.Context, entrypoint string, importMap string, staticFiles []string, output io.Writer) error } func NewEdgeRuntimeAPI(project string, client api.ClientWithResponses, bundler EszipBundler) EdgeRuntimeAPI { diff --git a/pkg/function/batch.go b/pkg/function/batch.go index 43f837fc4..d06e5bf04 100644 --- a/pkg/function/batch.go +++ b/pkg/function/batch.go @@ -45,7 +45,7 @@ func (s *EdgeRuntimeAPI) UpsertFunctions(ctx context.Context, functionConfig con } } var body bytes.Buffer - if err := s.eszip.Bundle(ctx, function.Entrypoint, function.ImportMap, &body); err != nil { + if err := s.eszip.Bundle(ctx, function.Entrypoint, function.ImportMap, function.StaticFiles, &body); err != nil { return err } // Update if function already exists diff --git a/pkg/function/batch_test.go b/pkg/function/batch_test.go index 1489cd329..101cabb79 100644 --- a/pkg/function/batch_test.go +++ b/pkg/function/batch_test.go @@ -17,7 +17,7 @@ import ( type MockBundler struct { } -func (b *MockBundler) Bundle(ctx context.Context, entrypoint string, importMap string, output io.Writer) error { +func (b *MockBundler) Bundle(ctx context.Context, entrypoint string, importMap string, staticFiles []string, output io.Writer) error { return nil } diff --git a/pkg/function/bundle.go b/pkg/function/bundle.go index ed12806e8..d015624ba 100644 --- a/pkg/function/bundle.go +++ b/pkg/function/bundle.go @@ -28,7 +28,7 @@ func NewNativeBundler(tempDir string, fsys fs.FS) EszipBundler { // Use a package private variable to allow testing without gosec complaining about G204 var edgeRuntimeBin = "edge-runtime" -func (b *nativeBundler) Bundle(ctx context.Context, entrypoint string, importMap string, output io.Writer) error { +func (b *nativeBundler) Bundle(ctx context.Context, entrypoint string, importMap string, staticFiles []string, output io.Writer) error { slug := filepath.Base(filepath.Dir(entrypoint)) outputPath := filepath.Join(b.tempDir, slug+".eszip") // TODO: make edge runtime write to stdout @@ -36,6 +36,9 @@ func (b *nativeBundler) Bundle(ctx context.Context, entrypoint string, importMap if len(importMap) > 0 { args = append(args, "--import-map", importMap) } + for _, staticFile := range staticFiles { + args = append(args, "--static", staticFile) + } cmd := exec.CommandContext(ctx, edgeRuntimeBin, args...) cmd.Stderr = os.Stderr cmd.Stdout = os.Stdout diff --git a/pkg/function/bundle_test.go b/pkg/function/bundle_test.go index 1aa63f212..b29d3bc87 100644 --- a/pkg/function/bundle_test.go +++ b/pkg/function/bundle_test.go @@ -36,7 +36,7 @@ func TestBundleFunction(t *testing.T) { // Setup mock bundler bundler := nativeBundler{fsys: fsys} // Run test - err := bundler.Bundle(context.Background(), "hello/index.ts", "", &body) + err := bundler.Bundle(context.Background(), "hello/index.ts", "", nil, &body) // Check error assert.NoError(t, err) assert.Equal(t, compressedEszipMagicID+";", body.String()) From 694c4c00f92c6cd7a8d6f33af97e043fbc171fed Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Thu, 16 Jan 2025 15:37:59 +0800 Subject: [PATCH 05/22] fix: update gitignore file to exclude dotenvx files (#3049) --- internal/init/templates/.gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/init/templates/.gitignore b/internal/init/templates/.gitignore index a3ad88055..ad9264f0b 100644 --- a/internal/init/templates/.gitignore +++ b/internal/init/templates/.gitignore @@ -1,4 +1,8 @@ # Supabase .branches .temp -.env + +# dotenvx +.env.keys +.env.local +.env.*.local From ec01c4b975614d13b815c58bc6976273b1e3e352 Mon Sep 17 00:00:00 2001 From: Qiao Han Date: Fri, 17 Jan 2025 02:54:05 +0800 Subject: [PATCH 06/22] fix: stop nested env at cwd --- pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index a0bddf074..24487cafa 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -817,7 +817,7 @@ func loadNestedEnv(basePath string) error { basePath = filepath.Join(repoDir, basePath) } env := viper.GetString("ENV") - for cwd := basePath; cwd != repoDir; cwd = filepath.Dir(cwd) { + for cwd := basePath; cwd != filepath.Dir(repoDir); cwd = filepath.Dir(cwd) { if err := os.Chdir(cwd); err != nil && !errors.Is(err, os.ErrNotExist) { return errors.Errorf("failed to change directory: %w", err) } From 48b977abe01645e35e2649ddfd05c0e5c6d5c8d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Jan 2025 04:54:16 +0000 Subject: [PATCH 07/22] chore(deps): bump github.com/containers/common from 0.61.0 to 0.61.1 (#3053) Bumps [github.com/containers/common](https://github.com/containers/common) from 0.61.0 to 0.61.1. - [Release notes](https://github.com/containers/common/releases) - [Commits](https://github.com/containers/common/compare/v0.61.0...v0.61.1) --- updated-dependencies: - dependency-name: github.com/containers/common dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index efa4c92b8..ac6ee387e 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/charmbracelet/bubbletea v0.25.0 github.com/charmbracelet/glamour v0.7.0 github.com/charmbracelet/lipgloss v0.12.1 - github.com/containers/common v0.61.0 + github.com/containers/common v0.61.1 github.com/deepmap/oapi-codegen/v2 v2.2.0 github.com/docker/cli v27.5.0+incompatible github.com/docker/docker v27.5.0+incompatible @@ -107,7 +107,7 @@ require ( github.com/cloudflare/circl v1.3.7 // indirect github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect github.com/containerd/log v0.1.0 // indirect - github.com/containers/storage v1.56.0 // indirect + github.com/containers/storage v1.56.1 // indirect github.com/curioswitch/go-reassign v0.3.0 // indirect github.com/cyphar/filepath-securejoin v0.3.6 // indirect github.com/daixiang0/gci v0.13.5 // indirect diff --git a/go.sum b/go.sum index aa602cf62..f33730d7b 100644 --- a/go.sum +++ b/go.sum @@ -192,10 +192,10 @@ github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2 github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= -github.com/containers/common v0.61.0 h1:j/84PTqZIKKYy42OEJsZmjZ4g4Kq2ERuC3tqp2yWdh4= -github.com/containers/common v0.61.0/go.mod h1:NGRISq2vTFPSbhNqj6MLwyes4tWSlCnqbJg7R77B8xc= -github.com/containers/storage v1.56.0 h1:DZ9KSkj6M2tvj/4bBoaJu3QDHRl35BwsZ4kmLJS97ZI= -github.com/containers/storage v1.56.0/go.mod h1:c6WKowcAlED/DkWGNuL9bvGYqIWCVy7isRMdCSKWNjk= +github.com/containers/common v0.61.1 h1:jpk385ZFEx3MAX+sjwOoTZElvpgsGi0YJHuRmrhF/j8= +github.com/containers/common v0.61.1/go.mod h1:C+TfkhTV+ADp1Hu+BMIAYPvSFix21swYo9PZuCKoSUM= +github.com/containers/storage v1.56.1 h1:gDZj/S6Zxus4Xx42X6iNB3ODXuh0qoOdH/BABfrvcKo= +github.com/containers/storage v1.56.1/go.mod h1:c6WKowcAlED/DkWGNuL9bvGYqIWCVy7isRMdCSKWNjk= github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= From 8c03aa7c84b5fad5d9ae8637a9fc634d76018719 Mon Sep 17 00:00:00 2001 From: Fabrizio Date: Fri, 17 Jan 2025 09:18:31 +0100 Subject: [PATCH 08/22] fix(storage): enhance imgproxy limits (#3054) fix: enhance imgproxy limits --- internal/start/start.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/start/start.go b/internal/start/start.go index 2501d5b8d..1359d78a8 100644 --- a/internal/start/start.go +++ b/internal/start/start.go @@ -883,6 +883,10 @@ EOF "IMGPROXY_BIND=:5001", "IMGPROXY_LOCAL_FILESYSTEM_ROOT=/", "IMGPROXY_USE_ETAG=/", + "IMGPROXY_MAX_SRC_RESOLUTION=50", + "IMGPROXY_MAX_SRC_FILE_SIZE=25000000", + "IMGPROXY_MAX_ANIMATION_FRAMES=60", + "IMGPROXY_ENABLE_WEBP_DETECTION=true", }, Healthcheck: &container.HealthConfig{ Test: []string{"CMD", "imgproxy", "health"}, From 26d1a02e560f40813b0e4e597a0f66b01de7d3f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 04:46:38 +0000 Subject: [PATCH 09/22] chore(deps): bump go.opentelemetry.io/otel from 1.33.0 to 1.34.0 (#3057) Bumps [go.opentelemetry.io/otel](https://github.com/open-telemetry/opentelemetry-go) from 1.33.0 to 1.34.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-go/releases) - [Changelog](https://github.com/open-telemetry/opentelemetry-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-telemetry/opentelemetry-go/compare/v1.33.0...v1.34.0) --- updated-dependencies: - dependency-name: go.opentelemetry.io/otel dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index ac6ee387e..f287b4b97 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( github.com/tidwall/jsonc v0.3.2 github.com/withfig/autocomplete-tools/packages/cobra v1.2.0 github.com/zalando/go-keyring v0.2.6 - go.opentelemetry.io/otel v1.33.0 + go.opentelemetry.io/otel v1.34.0 golang.org/x/mod v0.22.0 golang.org/x/oauth2 v0.25.0 golang.org/x/term v0.28.0 @@ -314,10 +314,10 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 // indirect - go.opentelemetry.io/otel/metric v1.33.0 // indirect + go.opentelemetry.io/otel/metric v1.34.0 // indirect go.opentelemetry.io/otel/sdk v1.31.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect - go.opentelemetry.io/otel/trace v1.33.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect diff --git a/go.sum b/go.sum index f33730d7b..0b1a3f5a5 100644 --- a/go.sum +++ b/go.sum @@ -1018,8 +1018,8 @@ go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJyS go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8= -go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= -go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0 h1:U2guen0GhqH8o/G2un8f/aG/y++OuW6MyCo6hT9prXk= go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.28.0/go.mod h1:yeGZANgEcpdx/WK0IvvRFC+2oLiMS2u4L/0Rj2M2Qr0= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= @@ -1028,14 +1028,14 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 h1:R3X6Z go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0/go.mod h1:QWFXnDavXWwMx2EEcZsf3yxgEKAqsxQ+Syjp+seyInw= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03ymgYhPKmeXGk5Zu+cIZOlVzd9Zv7QIiyItjFBU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk= -go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ= -go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= -go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= -go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= From 38a8816b7ec208331aa55b78538c7f0946675b36 Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Mon, 20 Jan 2025 18:07:50 +0900 Subject: [PATCH 10/22] feat(settings): add track_activity_query_size setting configuration (#3052) * feat(settings): add track_activity_query_size setting configuration * Update cmd/snippets.go Co-authored-by: Han Qiao * chore: fix lint * chore: use single quotes * chore: remove prettierc * chore: use string instead of number for size --------- Co-authored-by: Han Qiao --- api/beta.yaml | 533 +++++++++++--- internal/branches/list/list.go | 7 +- internal/snippets/download/download.go | 8 +- pkg/api/client.gen.go | 943 ++++++++++++++++++++++++- pkg/api/types.gen.go | 262 ++++++- pkg/config/db.go | 3 + 6 files changed, 1608 insertions(+), 148 deletions(-) diff --git a/api/beta.yaml b/api/beta.yaml index cd6c20a15..5163460d6 100644 --- a/api/beta.yaml +++ b/api/beta.yaml @@ -79,6 +79,31 @@ paths: - Environments security: - bearer: [] + /v1/branches/{branch_id}/push: + post: + operationId: v1-push-a-branch + summary: Pushes a database branch + description: Pushes the specified database branch + parameters: + - name: branch_id + required: true + in: path + description: Branch ID + schema: + type: string + responses: + '201': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/BranchUpdateResponse' + '500': + description: Failed to push database branch + tags: + - Environments + security: + - bearer: [] /v1/branches/{branch_id}/reset: post: operationId: v1-reset-a-branch @@ -97,7 +122,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BranchResetResponse' + $ref: '#/components/schemas/BranchUpdateResponse' '500': description: Failed to reset database branch tags: @@ -272,11 +297,58 @@ paths: security: - oauth2: - write + /v1/oauth/revoke: + post: + operationId: v1-revoke-token + summary: '[Beta] Revoke oauth app authorization and it''s corresponding tokens' + parameters: [] + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/OAuthRevokeTokenBodyDto' + responses: + '204': + description: '' + tags: + - OAuth + security: + - oauth2: + - write /v1/snippets: get: operationId: v1-list-all-snippets summary: Lists SQL snippets for the logged in user parameters: + - name: cursor + required: false + in: query + schema: + type: string + - name: limit + required: false + in: query + schema: + type: string + minimum: 1 + maximum: 100 + - name: sort_by + required: false + in: query + schema: + enum: + - name + - inserted_at + type: string + - name: sort_order + required: false + in: query + schema: + enum: + - asc + - desc + type: string - name: project_ref required: false in: query @@ -304,6 +376,7 @@ paths: required: true in: path schema: + format: uuid type: string responses: '200': @@ -1962,6 +2035,133 @@ paths: - Auth security: - bearer: [] + /v1/projects/{ref}/pause: + post: + operationId: v1-pause-a-project + summary: Pauses the given project + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + responses: + '200': + description: '' + '403': + description: '' + tags: + - Projects + security: + - bearer: [] + /v1/projects/{ref}/restore: + get: + operationId: v1-list-available-restore-versions + summary: Lists available restore versions for the given project + parameters: + - name: ref + required: true + in: path + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: >- + #/components/schemas/GetProjectAvailableRestoreVersionsResponse + '403': + description: '' + tags: + - Projects + security: + - bearer: [] + post: + operationId: v1-restore-a-project + summary: Restores the given project + parameters: + - name: ref + required: true + in: path + schema: + type: string + requestBody: + required: true + content: + application/json: + schema: + $ref: '#/components/schemas/RestoreProjectBodyDto' + responses: + '200': + description: '' + '403': + description: '' + tags: + - Projects + security: + - bearer: [] + /v1/projects/{ref}/restore/cancel: + post: + operationId: v1-cancel-a-project-restoration + summary: Cancels the given project restoration + parameters: + - name: ref + required: true + in: path + schema: + type: string + responses: + '200': + description: '' + '403': + description: '' + tags: + - Projects + security: + - bearer: [] + /v1/projects/{ref}/analytics/endpoints/logs.all: + get: + operationId: getLogs + summary: Gets project's logs + parameters: + - name: iso_timestamp_end + required: false + in: query + schema: + type: string + - name: iso_timestamp_start + required: false + in: query + schema: + type: string + - name: sql + required: false + in: query + schema: + type: string + - name: ref + required: true + in: path + schema: + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/V1AnalyticsResponse' + '403': + description: '' + tags: + - Analytics + security: + - bearer: [] /v1/projects/{ref}/database/query: post: operationId: v1-run-a-query @@ -2021,6 +2221,36 @@ paths: security: - bearer: [] /v1/projects/{ref}/functions: + get: + operationId: v1-list-all-functions + summary: List all functions + description: Returns all functions you've previously added to the specified project. + parameters: + - name: ref + required: true + in: path + description: Project ref + schema: + minLength: 20 + maxLength: 20 + type: string + responses: + '200': + description: '' + content: + application/json: + schema: + type: array + items: + $ref: '#/components/schemas/FunctionResponse' + '403': + description: '' + '500': + description: Failed to retrieve project's functions + tags: + - Edge Functions + security: + - bearer: [] post: operationId: v1-create-a-function summary: Create a function @@ -2096,36 +2326,6 @@ paths: - Edge Functions security: - bearer: [] - get: - operationId: v1-list-all-functions - summary: List all functions - description: Returns all functions you've previously added to the specified project. - parameters: - - name: ref - required: true - in: path - description: Project ref - schema: - minLength: 20 - maxLength: 20 - type: string - responses: - '200': - description: '' - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/FunctionResponse' - '403': - description: '' - '500': - description: Failed to retrieve project's functions - tags: - - Edge Functions - security: - - bearer: [] /v1/projects/{ref}/functions/{function_slug}: get: operationId: v1-get-a-function @@ -2645,33 +2845,33 @@ components: BranchDetailResponse: type: object properties: - db_port: - type: integer - ref: - type: string - postgres_version: - type: string - postgres_engine: - type: string - release_channel: - type: string status: + type: string enum: + - INACTIVE - ACTIVE_HEALTHY - ACTIVE_UNHEALTHY - COMING_UP + - UNKNOWN - GOING_DOWN - - INACTIVE - INIT_FAILED - REMOVED - - RESTARTING - - UNKNOWN + - RESTORING - UPGRADING - PAUSING - - RESTORING - RESTORE_FAILED + - RESTARTING - PAUSE_FAILED - RESIZING + db_port: + type: integer + ref: + type: string + postgres_version: + type: string + postgres_engine: + type: string + release_channel: type: string db_host: type: string @@ -2682,25 +2882,30 @@ components: jwt_secret: type: string required: + - status - db_port - ref - postgres_version - postgres_engine - release_channel - - status - db_host UpdateBranchBody: type: object properties: + reset_on_push: + type: boolean + deprecated: true + description: >- + This field is deprecated and will be ignored. Use v1-reset-a-branch + endpoint directly instead. branch_name: type: string git_branch: type: string - reset_on_push: - type: boolean persistent: type: boolean status: + type: string enum: - CREATING_PROJECT - RUNNING_MIGRATIONS @@ -2708,7 +2913,6 @@ components: - MIGRATIONS_FAILED - FUNCTIONS_DEPLOYED - FUNCTIONS_FAILED - type: string BranchResponse: type: object properties: @@ -2716,8 +2920,18 @@ components: type: integer format: int32 latest_check_run_id: - type: integer - format: int64 + type: number + deprecated: true + description: This field is deprecated and will not be populated. + status: + type: string + enum: + - CREATING_PROJECT + - RUNNING_MIGRATIONS + - MIGRATIONS_PASSED + - MIGRATIONS_FAILED + - FUNCTIONS_DEPLOYED + - FUNCTIONS_FAILED id: type: string name: @@ -2730,32 +2944,20 @@ components: type: boolean git_branch: type: string - reset_on_push: - type: boolean persistent: type: boolean - status: - enum: - - CREATING_PROJECT - - RUNNING_MIGRATIONS - - MIGRATIONS_PASSED - - MIGRATIONS_FAILED - - FUNCTIONS_DEPLOYED - - FUNCTIONS_FAILED - type: string created_at: type: string updated_at: type: string required: + - status - id - name - project_ref - parent_project_ref - is_default - - reset_on_push - persistent - - status - created_at - updated_at BranchDeleteResponse: @@ -2765,7 +2967,7 @@ components: type: string required: - message - BranchResetResponse: + BranchUpdateResponse: type: object properties: workflow_run_id: @@ -2815,34 +3017,34 @@ components: type: string description: Creation timestamp example: '2023-03-29T16:32:59Z' - database: - $ref: '#/components/schemas/V1DatabaseResponse' status: + type: string enum: + - INACTIVE - ACTIVE_HEALTHY - ACTIVE_UNHEALTHY - COMING_UP + - UNKNOWN - GOING_DOWN - - INACTIVE - INIT_FAILED - REMOVED - - RESTARTING - - UNKNOWN + - RESTORING - UPGRADING - PAUSING - - RESTORING - RESTORE_FAILED + - RESTARTING - PAUSE_FAILED - RESIZING - type: string + database: + $ref: '#/components/schemas/V1DatabaseResponse' required: - id - organization_id - name - region - created_at - - database - status + - database V1CreateProjectBodyDto: type: object properties: @@ -2851,7 +3053,7 @@ components: description: Database password name: type: string - description: Name of your project, should not contain dots + description: Name of your project organization_id: type: string description: Slug of your organization @@ -2917,11 +3119,13 @@ components: - beta - ga - withdrawn + - preview description: Release channel. If not provided, GA will be used. postgres_engine: type: string enum: - '15' + - 17-oriole description: >- Postgres engine version. If not provided, the latest version will be used. @@ -2952,23 +3156,23 @@ components: description: Creation timestamp example: '2023-03-29T16:32:59Z' status: + type: string enum: + - INACTIVE - ACTIVE_HEALTHY - ACTIVE_UNHEALTHY - COMING_UP + - UNKNOWN - GOING_DOWN - - INACTIVE - INIT_FAILED - REMOVED - - RESTARTING - - UNKNOWN + - RESTORING - UPGRADING - PAUSING - - RESTORING - RESTORE_FAILED + - RESTARTING - PAUSE_FAILED - RESIZING - type: string required: - id - organization_id @@ -3037,6 +3241,21 @@ components: - token_type - access_token - refresh_token + OAuthRevokeTokenBodyDto: + type: object + properties: + client_id: + type: string + format: uuid + client_secret: + type: string + refresh_token: + type: string + required: + - client_id + - client_secret + - refresh_token + additionalProperties: false SnippetProject: type: object properties: @@ -3083,6 +3302,7 @@ components: type: string description: type: string + nullable: true project: $ref: '#/components/schemas/SnippetProject' owner: @@ -3096,6 +3316,7 @@ components: - type - visibility - name + - description - project - owner - updated_by @@ -3106,6 +3327,8 @@ components: type: array items: $ref: '#/components/schemas/SnippetMeta' + cursor: + type: string required: - data SnippetContent: @@ -3145,6 +3368,7 @@ components: type: string description: type: string + nullable: true project: $ref: '#/components/schemas/SnippetProject' owner: @@ -3160,6 +3384,7 @@ components: - type - visibility - name + - description - project - owner - updated_by @@ -3258,6 +3483,7 @@ components: - beta - ga - withdrawn + - preview PostgresEngine: type: string description: >- @@ -3265,6 +3491,7 @@ components: used. enum: - '15' + - 17-oriole CreateBranchBody: type: object properties: @@ -3852,13 +4079,23 @@ components: type: boolean required: - enabled + StorageFeatureS3Protocol: + type: object + properties: + enabled: + type: boolean + required: + - enabled StorageFeatures: type: object properties: imageTransformation: $ref: '#/components/schemas/StorageFeatureImageTransformation' + s3Protocol: + $ref: '#/components/schemas/StorageFeatureS3Protocol' required: - imageTransformation + - s3Protocol StorageConfigResponse: type: object properties: @@ -3889,6 +4126,8 @@ components: type: string maintenance_work_mem: type: string + track_activity_query_size: + type: string max_connections: type: integer minimum: 1 @@ -3952,6 +4191,8 @@ components: type: string maintenance_work_mem: type: string + track_activity_query_size: + type: string max_connections: type: integer minimum: 1 @@ -4028,6 +4269,11 @@ components: SupavisorConfigResponse: type: object properties: + database_type: + type: string + enum: + - PRIMARY + - READ_REPLICA db_port: type: integer default_pool_size: @@ -4038,11 +4284,6 @@ components: nullable: true identifier: type: string - database_type: - enum: - - PRIMARY - - READ_REPLICA - type: string is_using_scram_auth: type: boolean db_user: @@ -4059,11 +4300,11 @@ components: - session type: string required: + - database_type - db_port - default_pool_size - max_client_conn - identifier - - database_type - is_using_scram_auth - db_user - db_host @@ -5208,33 +5449,101 @@ components: - type - inserted_at - updated_at - V1RunQueryBody: + ProjectAvailableRestoreVersion: type: object properties: - query: + version: + type: string + release_channel: + type: string + enum: + - internal + - alpha + - beta + - ga + - withdrawn + - preview + postgres_engine: type: string + enum: + - '13' + - '14' + - '15' + - 17-oriole required: - - query - V1CreateFunctionBody: + - version + - release_channel + - postgres_engine + GetProjectAvailableRestoreVersionsResponse: type: object properties: - slug: + available_versions: + type: array + items: + $ref: '#/components/schemas/ProjectAvailableRestoreVersion' + required: + - available_versions + RestoreProjectBodyDto: + type: object + properties: + release_channel: type: string - pattern: /^[A-Za-z0-9_-]+$/ - name: + enum: + - internal + - alpha + - beta + - ga + - withdrawn + - preview + description: >- + Release channel version. If not provided, GeneralAvailability will + be used. + postgres_engine: type: string - body: + enum: + - '15' + - 17-oriole + description: >- + Postgres engine version. If not provided, the latest version from + the given release channel will be used. + V1AnalyticsResponse: + type: object + properties: + error: + oneOf: + - properties: + code: + type: number + errors: + type: array + items: + properties: + domain: + type: string + location: + type: string + locationType: + type: string + message: + type: string + reason: + type: string + message: + type: string + status: + type: string + - type: string + result: + type: array + items: + type: object + V1RunQueryBody: + type: object + properties: + query: type: string - verify_jwt: - type: boolean - compute_multiplier: - type: number - minimum: 1 - maximum: 4 required: - - slug - - name - - body + - query FunctionResponse: type: object properties: @@ -5276,6 +5585,26 @@ components: - slug - name - status + V1CreateFunctionBody: + type: object + properties: + slug: + type: string + pattern: /^[A-Za-z0-9_-]+$/ + name: + type: string + body: + type: string + verify_jwt: + type: boolean + compute_multiplier: + type: number + minimum: 1 + maximum: 4 + required: + - slug + - name + - body FunctionSlugResponse: type: object properties: diff --git a/internal/branches/list/list.go b/internal/branches/list/list.go index 7a153138f..79eb75e2a 100644 --- a/internal/branches/list/list.go +++ b/internal/branches/list/list.go @@ -22,8 +22,8 @@ func Run(ctx context.Context, fsys afero.Fs) error { return errors.New("Unexpected error listing preview branches: " + string(resp.Body)) } - table := `|ID|NAME|DEFAULT|GIT BRANCH|RESET ON PUSH|STATUS|CREATED AT (UTC)|UPDATED AT (UTC)| -|-|-|-|-|-|-|-|-| + table := `|ID|NAME|DEFAULT|GIT BRANCH|STATUS|CREATED AT (UTC)|UPDATED AT (UTC)| +|-|-|-|-|-|-|-| ` for _, branch := range *resp.JSON200 { gitBranch := " " @@ -31,12 +31,11 @@ func Run(ctx context.Context, fsys afero.Fs) error { gitBranch = *branch.GitBranch } table += fmt.Sprintf( - "|`%s`|`%s`|`%t`|`%s`|`%t`|`%s`|`%s`|`%s`|\n", + "|`%s`|`%s`|`%t`|`%s`|`%s`|`%s`|`%s`|\n", branch.Id, strings.ReplaceAll(branch.Name, "|", "\\|"), branch.IsDefault, strings.ReplaceAll(gitBranch, "|", "\\|"), - branch.ResetOnPush, branch.Status, utils.FormatTimestamp(branch.CreatedAt), utils.FormatTimestamp(branch.UpdatedAt), diff --git a/internal/snippets/download/download.go b/internal/snippets/download/download.go index 7f1f3a463..22b45dd68 100644 --- a/internal/snippets/download/download.go +++ b/internal/snippets/download/download.go @@ -5,12 +5,18 @@ import ( "fmt" "github.com/go-errors/errors" + "github.com/google/uuid" "github.com/spf13/afero" "github.com/supabase/cli/internal/utils" ) func Run(ctx context.Context, snippetId string, fsys afero.Fs) error { - resp, err := utils.GetSupabase().V1GetASnippetWithResponse(ctx, snippetId) + // Convert string to UUID + id, err := uuid.Parse(snippetId) + if err != nil { + return fmt.Errorf("invalid snippet ID: %w", err) + } + resp, err := utils.GetSupabase().V1GetASnippetWithResponse(ctx, id) if err != nil { return errors.Errorf("failed to download snippet: %w", err) } diff --git a/pkg/api/client.gen.go b/pkg/api/client.gen.go index fcbe8eaeb..8a5b498d4 100644 --- a/pkg/api/client.gen.go +++ b/pkg/api/client.gen.go @@ -14,6 +14,7 @@ import ( "strings" "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" ) // RequestEditorFn is the function signature for the RequestEditor callback function @@ -100,12 +101,20 @@ type ClientInterface interface { V1UpdateABranchConfig(ctx context.Context, branchId string, body V1UpdateABranchConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1PushABranch request + V1PushABranch(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1ResetABranch request V1ResetABranch(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*http.Response, error) // V1AuthorizeUser request V1AuthorizeUser(ctx context.Context, params *V1AuthorizeUserParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1RevokeTokenWithBody request with any body + V1RevokeTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1RevokeToken(ctx context.Context, body V1RevokeTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1ExchangeOauthTokenWithBody request with any body V1ExchangeOauthTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -139,6 +148,9 @@ type ClientInterface interface { // V1GetProject request V1GetProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetLogs request + GetLogs(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetProjectApiKeys request V1GetProjectApiKeys(ctx context.Context, ref string, params *V1GetProjectApiKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -311,6 +323,9 @@ type ClientInterface interface { V1UpdateNetworkRestrictions(ctx context.Context, ref string, body V1UpdateNetworkRestrictionsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1PauseAProject request + V1PauseAProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1GetPgsodiumConfig request V1GetPgsodiumConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -343,6 +358,17 @@ type ClientInterface interface { // V1DisableReadonlyModeTemporarily request V1DisableReadonlyModeTemporarily(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1ListAvailableRestoreVersions request + V1ListAvailableRestoreVersions(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1RestoreAProjectWithBody request with any body + V1RestoreAProjectWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + V1RestoreAProject(ctx context.Context, ref string, body V1RestoreAProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // V1CancelAProjectRestoration request + V1CancelAProjectRestoration(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) + // V1BulkDeleteSecretsWithBody request with any body V1BulkDeleteSecretsWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -401,7 +427,7 @@ type ClientInterface interface { V1ListAllSnippets(ctx context.Context, params *V1ListAllSnippetsParams, reqEditors ...RequestEditorFn) (*http.Response, error) // V1GetASnippet request - V1GetASnippet(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) + V1GetASnippet(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) } func (c *Client) V1DeleteABranch(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*http.Response, error) { @@ -452,6 +478,18 @@ func (c *Client) V1UpdateABranchConfig(ctx context.Context, branchId string, bod return c.Client.Do(req) } +func (c *Client) V1PushABranch(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1PushABranchRequest(c.Server, branchId) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1ResetABranch(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1ResetABranchRequest(c.Server, branchId) if err != nil { @@ -476,6 +514,30 @@ func (c *Client) V1AuthorizeUser(ctx context.Context, params *V1AuthorizeUserPar return c.Client.Do(req) } +func (c *Client) V1RevokeTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1RevokeTokenRequestWithBody(c.Server, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1RevokeToken(ctx context.Context, body V1RevokeTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1RevokeTokenRequest(c.Server, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1ExchangeOauthTokenWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1ExchangeOauthTokenRequestWithBody(c.Server, contentType, body) if err != nil { @@ -620,6 +682,18 @@ func (c *Client) V1GetProject(ctx context.Context, ref string, reqEditors ...Req return c.Client.Do(req) } +func (c *Client) GetLogs(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetLogsRequest(c.Server, ref, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1GetProjectApiKeys(ctx context.Context, ref string, params *V1GetProjectApiKeysParams, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1GetProjectApiKeysRequest(c.Server, ref, params) if err != nil { @@ -1376,6 +1450,18 @@ func (c *Client) V1UpdateNetworkRestrictions(ctx context.Context, ref string, bo return c.Client.Do(req) } +func (c *Client) V1PauseAProject(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1PauseAProjectRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1GetPgsodiumConfig(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1GetPgsodiumConfigRequest(c.Server, ref) if err != nil { @@ -1520,6 +1606,54 @@ func (c *Client) V1DisableReadonlyModeTemporarily(ctx context.Context, ref strin return c.Client.Do(req) } +func (c *Client) V1ListAvailableRestoreVersions(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1ListAvailableRestoreVersionsRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1RestoreAProjectWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1RestoreAProjectRequestWithBody(c.Server, ref, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1RestoreAProject(ctx context.Context, ref string, body V1RestoreAProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1RestoreAProjectRequest(c.Server, ref, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) V1CancelAProjectRestoration(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewV1CancelAProjectRestorationRequest(c.Server, ref) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) V1BulkDeleteSecretsWithBody(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1BulkDeleteSecretsRequestWithBody(c.Server, ref, contentType, body) if err != nil { @@ -1772,7 +1906,7 @@ func (c *Client) V1ListAllSnippets(ctx context.Context, params *V1ListAllSnippet return c.Client.Do(req) } -func (c *Client) V1GetASnippet(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) { +func (c *Client) V1GetASnippet(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewV1GetASnippetRequest(c.Server, id) if err != nil { return nil, err @@ -1899,6 +2033,40 @@ func NewV1UpdateABranchConfigRequestWithBody(server string, branchId string, con return req, nil } +// NewV1PushABranchRequest generates requests for V1PushABranch +func NewV1PushABranchRequest(server string, branchId string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "branch_id", runtime.ParamLocationPath, branchId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/branches/%s/push", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewV1ResetABranchRequest generates requests for V1ResetABranch func NewV1ResetABranchRequest(server string, branchId string) (*http.Request, error) { var err error @@ -2082,6 +2250,46 @@ func NewV1AuthorizeUserRequest(server string, params *V1AuthorizeUserParams) (*h return req, nil } +// NewV1RevokeTokenRequest calls the generic V1RevokeToken builder with application/json body +func NewV1RevokeTokenRequest(server string, body V1RevokeTokenJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1RevokeTokenRequestWithBody(server, "application/json", bodyReader) +} + +// NewV1RevokeTokenRequestWithBody generates requests for V1RevokeToken with any type of body +func NewV1RevokeTokenRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/oauth/revoke") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + // NewV1ExchangeOauthTokenRequestWithFormdataBody calls the generic V1ExchangeOauthToken builder with application/x-www-form-urlencoded body func NewV1ExchangeOauthTokenRequestWithFormdataBody(server string, body V1ExchangeOauthTokenFormdataRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -2392,6 +2600,94 @@ func NewV1GetProjectRequest(server string, ref string) (*http.Request, error) { return req, nil } +// NewGetLogsRequest generates requests for GetLogs +func NewGetLogsRequest(server string, ref string, params *GetLogsParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/analytics/endpoints/logs.all", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.IsoTimestampEnd != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "iso_timestamp_end", runtime.ParamLocationQuery, *params.IsoTimestampEnd); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.IsoTimestampStart != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "iso_timestamp_start", runtime.ParamLocationQuery, *params.IsoTimestampStart); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Sql != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sql", runtime.ParamLocationQuery, *params.Sql); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewV1GetProjectApiKeysRequest generates requests for V1GetProjectApiKeys func NewV1GetProjectApiKeysRequest(server string, ref string, params *V1GetProjectApiKeysParams) (*http.Request, error) { var err error @@ -4621,8 +4917,8 @@ func NewV1UpdateNetworkRestrictionsRequestWithBody(server string, ref string, co return req, nil } -// NewV1GetPgsodiumConfigRequest generates requests for V1GetPgsodiumConfig -func NewV1GetPgsodiumConfigRequest(server string, ref string) (*http.Request, error) { +// NewV1PauseAProjectRequest generates requests for V1PauseAProject +func NewV1PauseAProjectRequest(server string, ref string) (*http.Request, error) { var err error var pathParam0 string @@ -4637,7 +4933,7 @@ func NewV1GetPgsodiumConfigRequest(server string, ref string) (*http.Request, er return nil, err } - operationPath := fmt.Sprintf("/v1/projects/%s/pgsodium", pathParam0) + operationPath := fmt.Sprintf("/v1/projects/%s/pause", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -4647,7 +4943,7 @@ func NewV1GetPgsodiumConfigRequest(server string, ref string) (*http.Request, er return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + req, err := http.NewRequest("POST", queryURL.String(), nil) if err != nil { return nil, err } @@ -4655,14 +4951,48 @@ func NewV1GetPgsodiumConfigRequest(server string, ref string) (*http.Request, er return req, nil } -// NewV1UpdatePgsodiumConfigRequest calls the generic V1UpdatePgsodiumConfig builder with application/json body -func NewV1UpdatePgsodiumConfigRequest(server string, ref string, body V1UpdatePgsodiumConfigJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) - if err != nil { - return nil, err - } - bodyReader = bytes.NewReader(buf) +// NewV1GetPgsodiumConfigRequest generates requests for V1GetPgsodiumConfig +func NewV1GetPgsodiumConfigRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/pgsodium", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1UpdatePgsodiumConfigRequest calls the generic V1UpdatePgsodiumConfig builder with application/json body +func NewV1UpdatePgsodiumConfigRequest(server string, ref string, body V1UpdatePgsodiumConfigJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) return NewV1UpdatePgsodiumConfigRequestWithBody(server, ref, "application/json", bodyReader) } @@ -4945,6 +5275,121 @@ func NewV1DisableReadonlyModeTemporarilyRequest(server string, ref string) (*htt return req, nil } +// NewV1ListAvailableRestoreVersionsRequest generates requests for V1ListAvailableRestoreVersions +func NewV1ListAvailableRestoreVersionsRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/restore", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewV1RestoreAProjectRequest calls the generic V1RestoreAProject builder with application/json body +func NewV1RestoreAProjectRequest(server string, ref string, body V1RestoreAProjectJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewV1RestoreAProjectRequestWithBody(server, ref, "application/json", bodyReader) +} + +// NewV1RestoreAProjectRequestWithBody generates requests for V1RestoreAProject with any type of body +func NewV1RestoreAProjectRequestWithBody(server string, ref string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/restore", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewV1CancelAProjectRestorationRequest generates requests for V1CancelAProjectRestoration +func NewV1CancelAProjectRestorationRequest(server string, ref string) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "ref", runtime.ParamLocationPath, ref) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/v1/projects/%s/restore/cancel", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + // NewV1BulkDeleteSecretsRequest calls the generic V1BulkDeleteSecrets builder with application/json body func NewV1BulkDeleteSecretsRequest(server string, ref string, body V1BulkDeleteSecretsJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader @@ -5565,6 +6010,70 @@ func NewV1ListAllSnippetsRequest(server string, params *V1ListAllSnippetsParams) if params != nil { queryValues := queryURL.Query() + if params.Cursor != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "cursor", runtime.ParamLocationQuery, *params.Cursor); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Limit != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.SortBy != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sort_by", runtime.ParamLocationQuery, *params.SortBy); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.SortOrder != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "sort_order", runtime.ParamLocationQuery, *params.SortOrder); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + if params.ProjectRef != nil { if queryFrag, err := runtime.StyleParamWithLocation("form", true, "project_ref", runtime.ParamLocationQuery, *params.ProjectRef); err != nil { @@ -5593,7 +6102,7 @@ func NewV1ListAllSnippetsRequest(server string, params *V1ListAllSnippetsParams) } // NewV1GetASnippetRequest generates requests for V1GetASnippet -func NewV1GetASnippetRequest(server string, id string) (*http.Request, error) { +func NewV1GetASnippetRequest(server string, id openapi_types.UUID) (*http.Request, error) { var err error var pathParam0 string @@ -5680,12 +6189,20 @@ type ClientWithResponsesInterface interface { V1UpdateABranchConfigWithResponse(ctx context.Context, branchId string, body V1UpdateABranchConfigJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateABranchConfigResponse, error) + // V1PushABranchWithResponse request + V1PushABranchWithResponse(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*V1PushABranchResponse, error) + // V1ResetABranchWithResponse request V1ResetABranchWithResponse(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*V1ResetABranchResponse, error) // V1AuthorizeUserWithResponse request V1AuthorizeUserWithResponse(ctx context.Context, params *V1AuthorizeUserParams, reqEditors ...RequestEditorFn) (*V1AuthorizeUserResponse, error) + // V1RevokeTokenWithBodyWithResponse request with any body + V1RevokeTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RevokeTokenResponse, error) + + V1RevokeTokenWithResponse(ctx context.Context, body V1RevokeTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*V1RevokeTokenResponse, error) + // V1ExchangeOauthTokenWithBodyWithResponse request with any body V1ExchangeOauthTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1ExchangeOauthTokenResponse, error) @@ -5719,6 +6236,9 @@ type ClientWithResponsesInterface interface { // V1GetProjectWithResponse request V1GetProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetProjectResponse, error) + // GetLogsWithResponse request + GetLogsWithResponse(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*GetLogsResponse, error) + // V1GetProjectApiKeysWithResponse request V1GetProjectApiKeysWithResponse(ctx context.Context, ref string, params *V1GetProjectApiKeysParams, reqEditors ...RequestEditorFn) (*V1GetProjectApiKeysResponse, error) @@ -5891,6 +6411,9 @@ type ClientWithResponsesInterface interface { V1UpdateNetworkRestrictionsWithResponse(ctx context.Context, ref string, body V1UpdateNetworkRestrictionsJSONRequestBody, reqEditors ...RequestEditorFn) (*V1UpdateNetworkRestrictionsResponse, error) + // V1PauseAProjectWithResponse request + V1PauseAProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1PauseAProjectResponse, error) + // V1GetPgsodiumConfigWithResponse request V1GetPgsodiumConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetPgsodiumConfigResponse, error) @@ -5923,6 +6446,17 @@ type ClientWithResponsesInterface interface { // V1DisableReadonlyModeTemporarilyWithResponse request V1DisableReadonlyModeTemporarilyWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1DisableReadonlyModeTemporarilyResponse, error) + // V1ListAvailableRestoreVersionsWithResponse request + V1ListAvailableRestoreVersionsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1ListAvailableRestoreVersionsResponse, error) + + // V1RestoreAProjectWithBodyWithResponse request with any body + V1RestoreAProjectWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RestoreAProjectResponse, error) + + V1RestoreAProjectWithResponse(ctx context.Context, ref string, body V1RestoreAProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*V1RestoreAProjectResponse, error) + + // V1CancelAProjectRestorationWithResponse request + V1CancelAProjectRestorationWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1CancelAProjectRestorationResponse, error) + // V1BulkDeleteSecretsWithBodyWithResponse request with any body V1BulkDeleteSecretsWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1BulkDeleteSecretsResponse, error) @@ -5981,7 +6515,7 @@ type ClientWithResponsesInterface interface { V1ListAllSnippetsWithResponse(ctx context.Context, params *V1ListAllSnippetsParams, reqEditors ...RequestEditorFn) (*V1ListAllSnippetsResponse, error) // V1GetASnippetWithResponse request - V1GetASnippetWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*V1GetASnippetResponse, error) + V1GetASnippetWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1GetASnippetResponse, error) } type V1DeleteABranchResponse struct { @@ -6050,10 +6584,32 @@ func (r V1UpdateABranchConfigResponse) StatusCode() int { return 0 } +type V1PushABranchResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *BranchUpdateResponse +} + +// Status returns HTTPResponse.Status +func (r V1PushABranchResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1PushABranchResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1ResetABranchResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *BranchResetResponse + JSON201 *BranchUpdateResponse } // Status returns HTTPResponse.Status @@ -6093,6 +6649,27 @@ func (r V1AuthorizeUserResponse) StatusCode() int { return 0 } +type V1RevokeTokenResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r V1RevokeTokenResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1RevokeTokenResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1ExchangeOauthTokenResponse struct { Body []byte HTTPResponse *http.Response @@ -6291,6 +6868,28 @@ func (r V1GetProjectResponse) StatusCode() int { return 0 } +type GetLogsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *V1AnalyticsResponse +} + +// Status returns HTTPResponse.Status +func (r GetLogsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetLogsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1GetProjectApiKeysResponse struct { Body []byte HTTPResponse *http.Response @@ -7295,6 +7894,27 @@ func (r V1UpdateNetworkRestrictionsResponse) StatusCode() int { return 0 } +type V1PauseAProjectResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r V1PauseAProjectResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1PauseAProjectResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1GetPgsodiumConfigResponse struct { Body []byte HTTPResponse *http.Response @@ -7468,6 +8088,70 @@ func (r V1DisableReadonlyModeTemporarilyResponse) StatusCode() int { return 0 } +type V1ListAvailableRestoreVersionsResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *GetProjectAvailableRestoreVersionsResponse +} + +// Status returns HTTPResponse.Status +func (r V1ListAvailableRestoreVersionsResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1ListAvailableRestoreVersionsResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1RestoreAProjectResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r V1RestoreAProjectResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1RestoreAProjectResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type V1CancelAProjectRestorationResponse struct { + Body []byte + HTTPResponse *http.Response +} + +// Status returns HTTPResponse.Status +func (r V1CancelAProjectRestorationResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r V1CancelAProjectRestorationResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type V1BulkDeleteSecretsResponse struct { Body []byte HTTPResponse *http.Response @@ -7853,6 +8537,15 @@ func (c *ClientWithResponses) V1UpdateABranchConfigWithResponse(ctx context.Cont return ParseV1UpdateABranchConfigResponse(rsp) } +// V1PushABranchWithResponse request returning *V1PushABranchResponse +func (c *ClientWithResponses) V1PushABranchWithResponse(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*V1PushABranchResponse, error) { + rsp, err := c.V1PushABranch(ctx, branchId, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1PushABranchResponse(rsp) +} + // V1ResetABranchWithResponse request returning *V1ResetABranchResponse func (c *ClientWithResponses) V1ResetABranchWithResponse(ctx context.Context, branchId string, reqEditors ...RequestEditorFn) (*V1ResetABranchResponse, error) { rsp, err := c.V1ResetABranch(ctx, branchId, reqEditors...) @@ -7871,6 +8564,23 @@ func (c *ClientWithResponses) V1AuthorizeUserWithResponse(ctx context.Context, p return ParseV1AuthorizeUserResponse(rsp) } +// V1RevokeTokenWithBodyWithResponse request with arbitrary body returning *V1RevokeTokenResponse +func (c *ClientWithResponses) V1RevokeTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RevokeTokenResponse, error) { + rsp, err := c.V1RevokeTokenWithBody(ctx, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1RevokeTokenResponse(rsp) +} + +func (c *ClientWithResponses) V1RevokeTokenWithResponse(ctx context.Context, body V1RevokeTokenJSONRequestBody, reqEditors ...RequestEditorFn) (*V1RevokeTokenResponse, error) { + rsp, err := c.V1RevokeToken(ctx, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1RevokeTokenResponse(rsp) +} + // V1ExchangeOauthTokenWithBodyWithResponse request with arbitrary body returning *V1ExchangeOauthTokenResponse func (c *ClientWithResponses) V1ExchangeOauthTokenWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1ExchangeOauthTokenResponse, error) { rsp, err := c.V1ExchangeOauthTokenWithBody(ctx, contentType, body, reqEditors...) @@ -7976,6 +8686,15 @@ func (c *ClientWithResponses) V1GetProjectWithResponse(ctx context.Context, ref return ParseV1GetProjectResponse(rsp) } +// GetLogsWithResponse request returning *GetLogsResponse +func (c *ClientWithResponses) GetLogsWithResponse(ctx context.Context, ref string, params *GetLogsParams, reqEditors ...RequestEditorFn) (*GetLogsResponse, error) { + rsp, err := c.GetLogs(ctx, ref, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetLogsResponse(rsp) +} + // V1GetProjectApiKeysWithResponse request returning *V1GetProjectApiKeysResponse func (c *ClientWithResponses) V1GetProjectApiKeysWithResponse(ctx context.Context, ref string, params *V1GetProjectApiKeysParams, reqEditors ...RequestEditorFn) (*V1GetProjectApiKeysResponse, error) { rsp, err := c.V1GetProjectApiKeys(ctx, ref, params, reqEditors...) @@ -8526,6 +9245,15 @@ func (c *ClientWithResponses) V1UpdateNetworkRestrictionsWithResponse(ctx contex return ParseV1UpdateNetworkRestrictionsResponse(rsp) } +// V1PauseAProjectWithResponse request returning *V1PauseAProjectResponse +func (c *ClientWithResponses) V1PauseAProjectWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1PauseAProjectResponse, error) { + rsp, err := c.V1PauseAProject(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1PauseAProjectResponse(rsp) +} + // V1GetPgsodiumConfigWithResponse request returning *V1GetPgsodiumConfigResponse func (c *ClientWithResponses) V1GetPgsodiumConfigWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1GetPgsodiumConfigResponse, error) { rsp, err := c.V1GetPgsodiumConfig(ctx, ref, reqEditors...) @@ -8630,6 +9358,41 @@ func (c *ClientWithResponses) V1DisableReadonlyModeTemporarilyWithResponse(ctx c return ParseV1DisableReadonlyModeTemporarilyResponse(rsp) } +// V1ListAvailableRestoreVersionsWithResponse request returning *V1ListAvailableRestoreVersionsResponse +func (c *ClientWithResponses) V1ListAvailableRestoreVersionsWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1ListAvailableRestoreVersionsResponse, error) { + rsp, err := c.V1ListAvailableRestoreVersions(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1ListAvailableRestoreVersionsResponse(rsp) +} + +// V1RestoreAProjectWithBodyWithResponse request with arbitrary body returning *V1RestoreAProjectResponse +func (c *ClientWithResponses) V1RestoreAProjectWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1RestoreAProjectResponse, error) { + rsp, err := c.V1RestoreAProjectWithBody(ctx, ref, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1RestoreAProjectResponse(rsp) +} + +func (c *ClientWithResponses) V1RestoreAProjectWithResponse(ctx context.Context, ref string, body V1RestoreAProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*V1RestoreAProjectResponse, error) { + rsp, err := c.V1RestoreAProject(ctx, ref, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1RestoreAProjectResponse(rsp) +} + +// V1CancelAProjectRestorationWithResponse request returning *V1CancelAProjectRestorationResponse +func (c *ClientWithResponses) V1CancelAProjectRestorationWithResponse(ctx context.Context, ref string, reqEditors ...RequestEditorFn) (*V1CancelAProjectRestorationResponse, error) { + rsp, err := c.V1CancelAProjectRestoration(ctx, ref, reqEditors...) + if err != nil { + return nil, err + } + return ParseV1CancelAProjectRestorationResponse(rsp) +} + // V1BulkDeleteSecretsWithBodyWithResponse request with arbitrary body returning *V1BulkDeleteSecretsResponse func (c *ClientWithResponses) V1BulkDeleteSecretsWithBodyWithResponse(ctx context.Context, ref string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*V1BulkDeleteSecretsResponse, error) { rsp, err := c.V1BulkDeleteSecretsWithBody(ctx, ref, contentType, body, reqEditors...) @@ -8814,7 +9577,7 @@ func (c *ClientWithResponses) V1ListAllSnippetsWithResponse(ctx context.Context, } // V1GetASnippetWithResponse request returning *V1GetASnippetResponse -func (c *ClientWithResponses) V1GetASnippetWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*V1GetASnippetResponse, error) { +func (c *ClientWithResponses) V1GetASnippetWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*V1GetASnippetResponse, error) { rsp, err := c.V1GetASnippet(ctx, id, reqEditors...) if err != nil { return nil, err @@ -8900,6 +9663,32 @@ func ParseV1UpdateABranchConfigResponse(rsp *http.Response) (*V1UpdateABranchCon return response, nil } +// ParseV1PushABranchResponse parses an HTTP response from a V1PushABranchWithResponse call +func ParseV1PushABranchResponse(rsp *http.Response) (*V1PushABranchResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1PushABranchResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest BranchUpdateResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + } + + return response, nil +} + // ParseV1ResetABranchResponse parses an HTTP response from a V1ResetABranchWithResponse call func ParseV1ResetABranchResponse(rsp *http.Response) (*V1ResetABranchResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -8915,7 +9704,7 @@ func ParseV1ResetABranchResponse(rsp *http.Response) (*V1ResetABranchResponse, e switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest BranchResetResponse + var dest BranchUpdateResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -8942,6 +9731,22 @@ func ParseV1AuthorizeUserResponse(rsp *http.Response) (*V1AuthorizeUserResponse, return response, nil } +// ParseV1RevokeTokenResponse parses an HTTP response from a V1RevokeTokenWithResponse call +func ParseV1RevokeTokenResponse(rsp *http.Response) (*V1RevokeTokenResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1RevokeTokenResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + // ParseV1ExchangeOauthTokenResponse parses an HTTP response from a V1ExchangeOauthTokenWithResponse call func ParseV1ExchangeOauthTokenResponse(rsp *http.Response) (*V1ExchangeOauthTokenResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -9176,6 +9981,32 @@ func ParseV1GetProjectResponse(rsp *http.Response) (*V1GetProjectResponse, error return response, nil } +// ParseGetLogsResponse parses an HTTP response from a GetLogsWithResponse call +func ParseGetLogsResponse(rsp *http.Response) (*GetLogsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetLogsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest V1AnalyticsResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + // ParseV1GetProjectApiKeysResponse parses an HTTP response from a V1GetProjectApiKeysWithResponse call func ParseV1GetProjectApiKeysResponse(rsp *http.Response) (*V1GetProjectApiKeysResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -10292,6 +11123,22 @@ func ParseV1UpdateNetworkRestrictionsResponse(rsp *http.Response) (*V1UpdateNetw return response, nil } +// ParseV1PauseAProjectResponse parses an HTTP response from a V1PauseAProjectWithResponse call +func ParseV1PauseAProjectResponse(rsp *http.Response) (*V1PauseAProjectResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1PauseAProjectResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + // ParseV1GetPgsodiumConfigResponse parses an HTTP response from a V1GetPgsodiumConfigWithResponse call func ParseV1GetPgsodiumConfigResponse(rsp *http.Response) (*V1GetPgsodiumConfigResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -10470,6 +11317,64 @@ func ParseV1DisableReadonlyModeTemporarilyResponse(rsp *http.Response) (*V1Disab return response, nil } +// ParseV1ListAvailableRestoreVersionsResponse parses an HTTP response from a V1ListAvailableRestoreVersionsWithResponse call +func ParseV1ListAvailableRestoreVersionsResponse(rsp *http.Response) (*V1ListAvailableRestoreVersionsResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1ListAvailableRestoreVersionsResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest GetProjectAvailableRestoreVersionsResponse + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + } + + return response, nil +} + +// ParseV1RestoreAProjectResponse parses an HTTP response from a V1RestoreAProjectWithResponse call +func ParseV1RestoreAProjectResponse(rsp *http.Response) (*V1RestoreAProjectResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1RestoreAProjectResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + +// ParseV1CancelAProjectRestorationResponse parses an HTTP response from a V1CancelAProjectRestorationWithResponse call +func ParseV1CancelAProjectRestorationResponse(rsp *http.Response) (*V1CancelAProjectRestorationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &V1CancelAProjectRestorationResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + return response, nil +} + // ParseV1BulkDeleteSecretsResponse parses an HTTP response from a V1BulkDeleteSecretsWithResponse call func ParseV1BulkDeleteSecretsResponse(rsp *http.Response) (*V1BulkDeleteSecretsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/pkg/api/types.gen.go b/pkg/api/types.gen.go index 4cfa1556b..1bb326b91 100644 --- a/pkg/api/types.gen.go +++ b/pkg/api/types.gen.go @@ -7,6 +7,7 @@ import ( "encoding/json" "github.com/oapi-codegen/runtime" + openapi_types "github.com/oapi-codegen/runtime/types" ) const ( @@ -169,7 +170,26 @@ const ( // Defines values for PostgresEngine. const ( - PostgresEngineN15 PostgresEngine = "15" + PostgresEngineN15 PostgresEngine = "15" + PostgresEngineN17Oriole PostgresEngine = "17-oriole" +) + +// Defines values for ProjectAvailableRestoreVersionPostgresEngine. +const ( + ProjectAvailableRestoreVersionPostgresEngineN13 ProjectAvailableRestoreVersionPostgresEngine = "13" + ProjectAvailableRestoreVersionPostgresEngineN14 ProjectAvailableRestoreVersionPostgresEngine = "14" + ProjectAvailableRestoreVersionPostgresEngineN15 ProjectAvailableRestoreVersionPostgresEngine = "15" + ProjectAvailableRestoreVersionPostgresEngineN17Oriole ProjectAvailableRestoreVersionPostgresEngine = "17-oriole" +) + +// Defines values for ProjectAvailableRestoreVersionReleaseChannel. +const ( + ProjectAvailableRestoreVersionReleaseChannelAlpha ProjectAvailableRestoreVersionReleaseChannel = "alpha" + ProjectAvailableRestoreVersionReleaseChannelBeta ProjectAvailableRestoreVersionReleaseChannel = "beta" + ProjectAvailableRestoreVersionReleaseChannelGa ProjectAvailableRestoreVersionReleaseChannel = "ga" + ProjectAvailableRestoreVersionReleaseChannelInternal ProjectAvailableRestoreVersionReleaseChannel = "internal" + ProjectAvailableRestoreVersionReleaseChannelPreview ProjectAvailableRestoreVersionReleaseChannel = "preview" + ProjectAvailableRestoreVersionReleaseChannelWithdrawn ProjectAvailableRestoreVersionReleaseChannel = "withdrawn" ) // Defines values for ReleaseChannel. @@ -178,9 +198,26 @@ const ( ReleaseChannelBeta ReleaseChannel = "beta" ReleaseChannelGa ReleaseChannel = "ga" ReleaseChannelInternal ReleaseChannel = "internal" + ReleaseChannelPreview ReleaseChannel = "preview" ReleaseChannelWithdrawn ReleaseChannel = "withdrawn" ) +// Defines values for RestoreProjectBodyDtoPostgresEngine. +const ( + RestoreProjectBodyDtoPostgresEngineN15 RestoreProjectBodyDtoPostgresEngine = "15" + RestoreProjectBodyDtoPostgresEngineN17Oriole RestoreProjectBodyDtoPostgresEngine = "17-oriole" +) + +// Defines values for RestoreProjectBodyDtoReleaseChannel. +const ( + RestoreProjectBodyDtoReleaseChannelAlpha RestoreProjectBodyDtoReleaseChannel = "alpha" + RestoreProjectBodyDtoReleaseChannelBeta RestoreProjectBodyDtoReleaseChannel = "beta" + RestoreProjectBodyDtoReleaseChannelGa RestoreProjectBodyDtoReleaseChannel = "ga" + RestoreProjectBodyDtoReleaseChannelInternal RestoreProjectBodyDtoReleaseChannel = "internal" + RestoreProjectBodyDtoReleaseChannelPreview RestoreProjectBodyDtoReleaseChannel = "preview" + RestoreProjectBodyDtoReleaseChannelWithdrawn RestoreProjectBodyDtoReleaseChannel = "withdrawn" +) + // Defines values for SetUpReadReplicaBodyReadReplicaRegion. const ( SetUpReadReplicaBodyReadReplicaRegionApEast1 SetUpReadReplicaBodyReadReplicaRegion = "ap-east-1" @@ -319,7 +356,8 @@ const ( // Defines values for V1CreateProjectBodyDtoPostgresEngine. const ( - V1CreateProjectBodyDtoPostgresEngineN15 V1CreateProjectBodyDtoPostgresEngine = "15" + V1CreateProjectBodyDtoPostgresEngineN15 V1CreateProjectBodyDtoPostgresEngine = "15" + V1CreateProjectBodyDtoPostgresEngineN17Oriole V1CreateProjectBodyDtoPostgresEngine = "17-oriole" ) // Defines values for V1CreateProjectBodyDtoRegion. @@ -350,6 +388,7 @@ const ( V1CreateProjectBodyDtoReleaseChannelBeta V1CreateProjectBodyDtoReleaseChannel = "beta" V1CreateProjectBodyDtoReleaseChannelGa V1CreateProjectBodyDtoReleaseChannel = "ga" V1CreateProjectBodyDtoReleaseChannelInternal V1CreateProjectBodyDtoReleaseChannel = "internal" + V1CreateProjectBodyDtoReleaseChannelPreview V1CreateProjectBodyDtoReleaseChannel = "preview" V1CreateProjectBodyDtoReleaseChannelWithdrawn V1CreateProjectBodyDtoReleaseChannel = "withdrawn" ) @@ -451,6 +490,18 @@ const ( V1GetServicesHealthParamsServicesStorage V1GetServicesHealthParamsServices = "storage" ) +// Defines values for V1ListAllSnippetsParamsSortBy. +const ( + InsertedAt V1ListAllSnippetsParamsSortBy = "inserted_at" + Name V1ListAllSnippetsParamsSortBy = "name" +) + +// Defines values for V1ListAllSnippetsParamsSortOrder. +const ( + Asc V1ListAllSnippetsParamsSortOrder = "asc" + Desc V1ListAllSnippetsParamsSortOrder = "desc" +) + // ActivateVanitySubdomainResponse defines model for ActivateVanitySubdomainResponse. type ActivateVanitySubdomainResponse struct { CustomDomain string `json:"custom_domain"` @@ -715,25 +766,21 @@ type BranchDetailResponse struct { // BranchDetailResponseStatus defines model for BranchDetailResponse.Status. type BranchDetailResponseStatus string -// BranchResetResponse defines model for BranchResetResponse. -type BranchResetResponse struct { - Message string `json:"message"` - WorkflowRunId string `json:"workflow_run_id"` -} - // BranchResponse defines model for BranchResponse. type BranchResponse struct { - CreatedAt string `json:"created_at"` - GitBranch *string `json:"git_branch,omitempty"` - Id string `json:"id"` - IsDefault bool `json:"is_default"` - LatestCheckRunId *int64 `json:"latest_check_run_id,omitempty"` + CreatedAt string `json:"created_at"` + GitBranch *string `json:"git_branch,omitempty"` + Id string `json:"id"` + IsDefault bool `json:"is_default"` + + // LatestCheckRunId This field is deprecated and will not be populated. + // Deprecated: + LatestCheckRunId *float32 `json:"latest_check_run_id,omitempty"` Name string `json:"name"` ParentProjectRef string `json:"parent_project_ref"` Persistent bool `json:"persistent"` PrNumber *int32 `json:"pr_number,omitempty"` ProjectRef string `json:"project_ref"` - ResetOnPush bool `json:"reset_on_push"` Status BranchResponseStatus `json:"status"` UpdatedAt string `json:"updated_at"` } @@ -741,6 +788,12 @@ type BranchResponse struct { // BranchResponseStatus defines model for BranchResponse.Status. type BranchResponseStatus string +// BranchUpdateResponse defines model for BranchUpdateResponse. +type BranchUpdateResponse struct { + Message string `json:"message"` + WorkflowRunId string `json:"workflow_run_id"` +} + // CfResponse defines model for CfResponse. type CfResponse struct { Errors []map[string]interface{} `json:"errors"` @@ -907,6 +960,11 @@ type FunctionSlugResponse struct { // FunctionSlugResponseStatus defines model for FunctionSlugResponse.Status. type FunctionSlugResponseStatus string +// GetProjectAvailableRestoreVersionsResponse defines model for GetProjectAvailableRestoreVersionsResponse. +type GetProjectAvailableRestoreVersionsResponse struct { + AvailableVersions []ProjectAvailableRestoreVersion `json:"available_versions"` +} + // GetProviderResponse defines model for GetProviderResponse. type GetProviderResponse struct { CreatedAt *string `json:"created_at,omitempty"` @@ -946,6 +1004,13 @@ type NetworkRestrictionsResponseEntitlement string // NetworkRestrictionsResponseStatus defines model for NetworkRestrictionsResponse.Status. type NetworkRestrictionsResponseStatus string +// OAuthRevokeTokenBodyDto defines model for OAuthRevokeTokenBodyDto. +type OAuthRevokeTokenBodyDto struct { + ClientId openapi_types.UUID `json:"client_id"` + ClientSecret string `json:"client_secret"` + RefreshToken string `json:"refresh_token"` +} + // OAuthTokenBody defines model for OAuthTokenBody. type OAuthTokenBody struct { ClientId string `json:"client_id"` @@ -1009,6 +1074,7 @@ type PostgresConfigResponse struct { SessionReplicationRole *PostgresConfigResponseSessionReplicationRole `json:"session_replication_role,omitempty"` SharedBuffers *string `json:"shared_buffers,omitempty"` StatementTimeout *string `json:"statement_timeout,omitempty"` + TrackActivityQuerySize *string `json:"track_activity_query_size,omitempty"` TrackCommitTimestamp *bool `json:"track_commit_timestamp,omitempty"` WalKeepSize *string `json:"wal_keep_size,omitempty"` WalSenderTimeout *string `json:"wal_sender_timeout,omitempty"` @@ -1032,6 +1098,19 @@ type PostgrestConfigWithJWTSecretResponse struct { MaxRows int `json:"max_rows"` } +// ProjectAvailableRestoreVersion defines model for ProjectAvailableRestoreVersion. +type ProjectAvailableRestoreVersion struct { + PostgresEngine ProjectAvailableRestoreVersionPostgresEngine `json:"postgres_engine"` + ReleaseChannel ProjectAvailableRestoreVersionReleaseChannel `json:"release_channel"` + Version string `json:"version"` +} + +// ProjectAvailableRestoreVersionPostgresEngine defines model for ProjectAvailableRestoreVersion.PostgresEngine. +type ProjectAvailableRestoreVersionPostgresEngine string + +// ProjectAvailableRestoreVersionReleaseChannel defines model for ProjectAvailableRestoreVersion.ReleaseChannel. +type ProjectAvailableRestoreVersionReleaseChannel string + // ProjectUpgradeEligibilityResponse defines model for ProjectUpgradeEligibilityResponse. type ProjectUpgradeEligibilityResponse struct { CurrentAppVersion string `json:"current_app_version"` @@ -1093,6 +1172,21 @@ type RemoveReadReplicaBody struct { DatabaseIdentifier string `json:"database_identifier"` } +// RestoreProjectBodyDto defines model for RestoreProjectBodyDto. +type RestoreProjectBodyDto struct { + // PostgresEngine Postgres engine version. If not provided, the latest version from the given release channel will be used. + PostgresEngine *RestoreProjectBodyDtoPostgresEngine `json:"postgres_engine,omitempty"` + + // ReleaseChannel Release channel version. If not provided, GeneralAvailability will be used. + ReleaseChannel *RestoreProjectBodyDtoReleaseChannel `json:"release_channel,omitempty"` +} + +// RestoreProjectBodyDtoPostgresEngine Postgres engine version. If not provided, the latest version from the given release channel will be used. +type RestoreProjectBodyDtoPostgresEngine string + +// RestoreProjectBodyDtoReleaseChannel Release channel version. If not provided, GeneralAvailability will be used. +type RestoreProjectBodyDtoReleaseChannel string + // SamlDescriptor defines model for SamlDescriptor. type SamlDescriptor struct { AttributeMapping *AttributeMapping `json:"attribute_mapping,omitempty"` @@ -1126,12 +1220,13 @@ type SnippetContent struct { // SnippetList defines model for SnippetList. type SnippetList struct { - Data []SnippetMeta `json:"data"` + Cursor *string `json:"cursor,omitempty"` + Data []SnippetMeta `json:"data"` } // SnippetMeta defines model for SnippetMeta. type SnippetMeta struct { - Description *string `json:"description,omitempty"` + Description *string `json:"description"` Id string `json:"id"` InsertedAt string `json:"inserted_at"` Name string `json:"name"` @@ -1158,7 +1253,7 @@ type SnippetProject struct { // SnippetResponse defines model for SnippetResponse. type SnippetResponse struct { Content SnippetContent `json:"content"` - Description *string `json:"description,omitempty"` + Description *string `json:"description"` Id string `json:"id"` InsertedAt string `json:"inserted_at"` Name string `json:"name"` @@ -1216,9 +1311,15 @@ type StorageFeatureImageTransformation struct { Enabled bool `json:"enabled"` } +// StorageFeatureS3Protocol defines model for StorageFeatureS3Protocol. +type StorageFeatureS3Protocol struct { + Enabled bool `json:"enabled"` +} + // StorageFeatures defines model for StorageFeatures. type StorageFeatures struct { ImageTransformation StorageFeatureImageTransformation `json:"imageTransformation"` + S3Protocol StorageFeatureS3Protocol `json:"s3Protocol"` } // SubdomainAvailabilityResponse defines model for SubdomainAvailabilityResponse. @@ -1449,9 +1550,12 @@ type UpdateAuthConfigBodyPasswordRequiredCharacters string // UpdateBranchBody defines model for UpdateBranchBody. type UpdateBranchBody struct { - BranchName *string `json:"branch_name,omitempty"` - GitBranch *string `json:"git_branch,omitempty"` - Persistent *bool `json:"persistent,omitempty"` + BranchName *string `json:"branch_name,omitempty"` + GitBranch *string `json:"git_branch,omitempty"` + Persistent *bool `json:"persistent,omitempty"` + + // ResetOnPush This field is deprecated and will be ignored. Use v1-reset-a-branch endpoint directly instead. + // Deprecated: ResetOnPush *bool `json:"reset_on_push,omitempty"` Status *UpdateBranchBodyStatus `json:"status,omitempty"` } @@ -1500,6 +1604,7 @@ type UpdatePostgresConfigBody struct { SessionReplicationRole *UpdatePostgresConfigBodySessionReplicationRole `json:"session_replication_role,omitempty"` SharedBuffers *string `json:"shared_buffers,omitempty"` StatementTimeout *string `json:"statement_timeout,omitempty"` + TrackActivityQuerySize *string `json:"track_activity_query_size,omitempty"` TrackCommitTimestamp *bool `json:"track_commit_timestamp,omitempty"` WalKeepSize *string `json:"wal_keep_size,omitempty"` WalSenderTimeout *string `json:"wal_sender_timeout,omitempty"` @@ -1567,6 +1672,34 @@ type UpgradeDatabaseBody struct { TargetVersion string `json:"target_version"` } +// V1AnalyticsResponse defines model for V1AnalyticsResponse. +type V1AnalyticsResponse struct { + Error *V1AnalyticsResponse_Error `json:"error,omitempty"` + Result *[]map[string]interface{} `json:"result,omitempty"` +} + +// V1AnalyticsResponseError0 defines model for . +type V1AnalyticsResponseError0 struct { + Code *float32 `json:"code,omitempty"` + Errors *[]struct { + Domain *string `json:"domain,omitempty"` + Location *string `json:"location,omitempty"` + LocationType *string `json:"locationType,omitempty"` + Message *string `json:"message,omitempty"` + Reason *string `json:"reason,omitempty"` + } `json:"errors,omitempty"` + Message *string `json:"message,omitempty"` + Status *string `json:"status,omitempty"` +} + +// V1AnalyticsResponseError1 defines model for . +type V1AnalyticsResponseError1 = string + +// V1AnalyticsResponse_Error defines model for V1AnalyticsResponse.Error. +type V1AnalyticsResponse_Error struct { + union json.RawMessage +} + // V1Backup defines model for V1Backup. type V1Backup struct { InsertedAt string `json:"inserted_at"` @@ -1605,7 +1738,7 @@ type V1CreateProjectBodyDto struct { // Deprecated: KpsEnabled *bool `json:"kps_enabled,omitempty"` - // Name Name of your project, should not contain dots + // Name Name of your project Name string `json:"name"` // OrganizationId Slug of your organization @@ -1850,6 +1983,13 @@ type V1AuthorizeUserParamsResponseType string // V1AuthorizeUserParamsCodeChallengeMethod defines parameters for V1AuthorizeUser. type V1AuthorizeUserParamsCodeChallengeMethod string +// GetLogsParams defines parameters for GetLogs. +type GetLogsParams struct { + IsoTimestampEnd *string `form:"iso_timestamp_end,omitempty" json:"iso_timestamp_end,omitempty"` + IsoTimestampStart *string `form:"iso_timestamp_start,omitempty" json:"iso_timestamp_start,omitempty"` + Sql *string `form:"sql,omitempty" json:"sql,omitempty"` +} + // V1GetProjectApiKeysParams defines parameters for V1GetProjectApiKeys. type V1GetProjectApiKeysParams struct { Reveal bool `form:"reveal" json:"reveal"` @@ -1924,12 +2064,25 @@ type V1GetPostgresUpgradeStatusParams struct { // V1ListAllSnippetsParams defines parameters for V1ListAllSnippets. type V1ListAllSnippetsParams struct { - ProjectRef *string `form:"project_ref,omitempty" json:"project_ref,omitempty"` + Cursor *string `form:"cursor,omitempty" json:"cursor,omitempty"` + Limit *string `form:"limit,omitempty" json:"limit,omitempty"` + SortBy *V1ListAllSnippetsParamsSortBy `form:"sort_by,omitempty" json:"sort_by,omitempty"` + SortOrder *V1ListAllSnippetsParamsSortOrder `form:"sort_order,omitempty" json:"sort_order,omitempty"` + ProjectRef *string `form:"project_ref,omitempty" json:"project_ref,omitempty"` } +// V1ListAllSnippetsParamsSortBy defines parameters for V1ListAllSnippets. +type V1ListAllSnippetsParamsSortBy string + +// V1ListAllSnippetsParamsSortOrder defines parameters for V1ListAllSnippets. +type V1ListAllSnippetsParamsSortOrder string + // V1UpdateABranchConfigJSONRequestBody defines body for V1UpdateABranchConfig for application/json ContentType. type V1UpdateABranchConfigJSONRequestBody = UpdateBranchBody +// V1RevokeTokenJSONRequestBody defines body for V1RevokeToken for application/json ContentType. +type V1RevokeTokenJSONRequestBody = OAuthRevokeTokenBodyDto + // V1ExchangeOauthTokenFormdataRequestBody defines body for V1ExchangeOauthToken for application/x-www-form-urlencoded ContentType. type V1ExchangeOauthTokenFormdataRequestBody = OAuthTokenBody @@ -2002,6 +2155,9 @@ type V1RemoveAReadReplicaJSONRequestBody = RemoveReadReplicaBody // V1SetupAReadReplicaJSONRequestBody defines body for V1SetupAReadReplica for application/json ContentType. type V1SetupAReadReplicaJSONRequestBody = SetUpReadReplicaBody +// V1RestoreAProjectJSONRequestBody defines body for V1RestoreAProject for application/json ContentType. +type V1RestoreAProjectJSONRequestBody = RestoreProjectBodyDto + // V1BulkDeleteSecretsJSONRequestBody defines body for V1BulkDeleteSecrets for application/json ContentType. type V1BulkDeleteSecretsJSONRequestBody = V1BulkDeleteSecretsJSONBody @@ -2134,6 +2290,68 @@ func (t *AttributeValue_Default) UnmarshalJSON(b []byte) error { return err } +// AsV1AnalyticsResponseError0 returns the union data inside the V1AnalyticsResponse_Error as a V1AnalyticsResponseError0 +func (t V1AnalyticsResponse_Error) AsV1AnalyticsResponseError0() (V1AnalyticsResponseError0, error) { + var body V1AnalyticsResponseError0 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromV1AnalyticsResponseError0 overwrites any union data inside the V1AnalyticsResponse_Error as the provided V1AnalyticsResponseError0 +func (t *V1AnalyticsResponse_Error) FromV1AnalyticsResponseError0(v V1AnalyticsResponseError0) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeV1AnalyticsResponseError0 performs a merge with any union data inside the V1AnalyticsResponse_Error, using the provided V1AnalyticsResponseError0 +func (t *V1AnalyticsResponse_Error) MergeV1AnalyticsResponseError0(v V1AnalyticsResponseError0) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsV1AnalyticsResponseError1 returns the union data inside the V1AnalyticsResponse_Error as a V1AnalyticsResponseError1 +func (t V1AnalyticsResponse_Error) AsV1AnalyticsResponseError1() (V1AnalyticsResponseError1, error) { + var body V1AnalyticsResponseError1 + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromV1AnalyticsResponseError1 overwrites any union data inside the V1AnalyticsResponse_Error as the provided V1AnalyticsResponseError1 +func (t *V1AnalyticsResponse_Error) FromV1AnalyticsResponseError1(v V1AnalyticsResponseError1) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeV1AnalyticsResponseError1 performs a merge with any union data inside the V1AnalyticsResponse_Error, using the provided V1AnalyticsResponseError1 +func (t *V1AnalyticsResponse_Error) MergeV1AnalyticsResponseError1(v V1AnalyticsResponseError1) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t V1AnalyticsResponse_Error) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *V1AnalyticsResponse_Error) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + // AsAuthHealthResponse returns the union data inside the V1ServiceHealthResponse_Info as a AuthHealthResponse func (t V1ServiceHealthResponse_Info) AsAuthHealthResponse() (AuthHealthResponse, error) { var body AuthHealthResponse diff --git a/pkg/config/db.go b/pkg/config/db.go index 2a1d31cad..d18cf8ebd 100644 --- a/pkg/config/db.go +++ b/pkg/config/db.go @@ -43,6 +43,7 @@ type ( SessionReplicationRole *SessionReplicationRole `toml:"session_replication_role"` SharedBuffers *string `toml:"shared_buffers"` StatementTimeout *string `toml:"statement_timeout"` + TrackActivityQuerySize *string `toml:"track_activity_query_size"` TrackCommitTimestamp *bool `toml:"track_commit_timestamp"` WalKeepSize *string `toml:"wal_keep_size"` WalSenderTimeout *string `toml:"wal_sender_timeout"` @@ -105,6 +106,7 @@ func (a *settings) ToUpdatePostgresConfigBody() v1API.UpdatePostgresConfigBody { body.MaxWalSize = a.MaxWalSize body.SessionReplicationRole = (*v1API.UpdatePostgresConfigBodySessionReplicationRole)(a.SessionReplicationRole) body.StatementTimeout = a.StatementTimeout + body.TrackActivityQuerySize = a.TrackActivityQuerySize body.TrackCommitTimestamp = a.TrackCommitTimestamp body.WalKeepSize = a.WalKeepSize body.WalSenderTimeout = a.WalSenderTimeout @@ -131,6 +133,7 @@ func (a *settings) FromRemotePostgresConfig(remoteConfig v1API.PostgresConfigRes a.SessionReplicationRole = (*SessionReplicationRole)(remoteConfig.SessionReplicationRole) a.SharedBuffers = remoteConfig.SharedBuffers a.StatementTimeout = remoteConfig.StatementTimeout + a.TrackActivityQuerySize = remoteConfig.TrackActivityQuerySize a.TrackCommitTimestamp = remoteConfig.TrackCommitTimestamp a.WalKeepSize = remoteConfig.WalKeepSize a.WalSenderTimeout = remoteConfig.WalSenderTimeout From 9509bc68fae7c93907f64941ea08aa4fe243f5aa Mon Sep 17 00:00:00 2001 From: Takumi Hara <69781798+takumihara@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:04:29 +0900 Subject: [PATCH 11/22] fix: use direct DbHost from response in `branches get` (#3056) --- internal/branches/get/get.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/branches/get/get.go b/internal/branches/get/get.go index 22f3274e7..387e4ab79 100644 --- a/internal/branches/get/get.go +++ b/internal/branches/get/get.go @@ -34,7 +34,7 @@ func Run(ctx context.Context, branchId string, fsys afero.Fs) error { } config := pgconn.Config{ - Host: utils.GetSupabaseDbHost(resp.JSON200.DbHost), + Host: resp.JSON200.DbHost, Port: cast.UIntToUInt16(cast.IntToUint(resp.JSON200.DbPort)), User: *resp.JSON200.DbUser, Password: *resp.JSON200.DbPass, From 3f522278340482c68308a4cb5e099c83c5933663 Mon Sep 17 00:00:00 2001 From: Andrew Valleteau Date: Wed, 22 Jan 2025 10:23:25 +0900 Subject: [PATCH 12/22] feat(postgrest-config): add delete command to cli for convenience (#3060) --- cmd/postgres.go | 16 ++++++++ internal/postgresConfig/delete/delete.go | 48 ++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 internal/postgresConfig/delete/delete.go diff --git a/cmd/postgres.go b/cmd/postgres.go index 1c2e0e127..a1f9c376b 100644 --- a/cmd/postgres.go +++ b/cmd/postgres.go @@ -3,6 +3,7 @@ package cmd import ( "github.com/spf13/afero" "github.com/spf13/cobra" + "github.com/supabase/cli/internal/postgresConfig/delete" "github.com/supabase/cli/internal/postgresConfig/get" "github.com/supabase/cli/internal/postgresConfig/update" "github.com/supabase/cli/internal/utils/flags" @@ -33,8 +34,18 @@ Custom configuration also overrides the optimizations generated based on the com }, } + postgresConfigDeleteCmd = &cobra.Command{ + Use: "delete", + Short: "Delete specific Postgres database config overrides", + Long: "Delete specific config overrides, reverting them to their default values.", + RunE: func(cmd *cobra.Command, args []string) error { + return delete.Run(cmd.Context(), flags.ProjectRef, postgresConfigKeysToDelete, noRestart, afero.NewOsFs()) + }, + } + postgresConfigValues []string postgresConfigUpdateReplaceMode bool + postgresConfigKeysToDelete []string noRestart bool ) @@ -42,11 +53,16 @@ func init() { postgresCmd.PersistentFlags().StringVar(&flags.ProjectRef, "project-ref", "", "Project ref of the Supabase project.") postgresCmd.AddCommand(postgresConfigGetCmd) postgresCmd.AddCommand(postgresConfigUpdateCmd) + postgresCmd.AddCommand(postgresConfigDeleteCmd) updateFlags := postgresConfigUpdateCmd.Flags() updateFlags.StringSliceVar(&postgresConfigValues, "config", []string{}, "Config overrides specified as a 'key=value' pair") updateFlags.BoolVar(&postgresConfigUpdateReplaceMode, "replace-existing-overrides", false, "If true, replaces all existing overrides with the ones provided. If false (default), merges existing overrides with the ones provided.") updateFlags.BoolVar(&noRestart, "no-restart", false, "Do not restart the database after updating config.") + deleteFlags := postgresConfigDeleteCmd.Flags() + deleteFlags.StringSliceVar(&postgresConfigKeysToDelete, "config", []string{}, "Config keys to delete (comma-separated)") + deleteFlags.BoolVar(&noRestart, "no-restart", false, "Do not restart the database after deleting config.") + rootCmd.AddCommand(postgresCmd) } diff --git a/internal/postgresConfig/delete/delete.go b/internal/postgresConfig/delete/delete.go new file mode 100644 index 000000000..20b7b978f --- /dev/null +++ b/internal/postgresConfig/delete/delete.go @@ -0,0 +1,48 @@ +package delete + +import ( + "bytes" + "context" + "encoding/json" + "strings" + + "github.com/go-errors/errors" + "github.com/spf13/afero" + "github.com/supabase/cli/internal/postgresConfig/get" + "github.com/supabase/cli/internal/utils" +) + +func Run(ctx context.Context, projectRef string, configKeys []string, noRestart bool, fsys afero.Fs) error { + // 1. Get current config + currentConfig, err := get.GetCurrentPostgresConfig(ctx, projectRef) + if err != nil { + return err + } + + // 2. Remove specified keys + for _, key := range configKeys { + delete(currentConfig, strings.TrimSpace(key)) + } + + // 3. Update config with removed keys + if noRestart { + currentConfig["restart_database"] = false + } + bts, err := json.Marshal(currentConfig) + if err != nil { + return errors.Errorf("failed to serialize config overrides: %w", err) + } + + resp, err := utils.GetSupabase().V1UpdatePostgresConfigWithBodyWithResponse(ctx, projectRef, "application/json", bytes.NewReader(bts)) + if err != nil { + return errors.Errorf("failed to update config overrides: %w", err) + } + if resp.JSON200 == nil { + if resp.StatusCode() == 400 { + return errors.Errorf("failed to update config overrides: %s (%s). This usually indicates that an unsupported or invalid config override was attempted. Please refer to https://supabase.com/docs/guides/platform/custom-postgres-config", resp.Status(), string(resp.Body)) + } + return errors.Errorf("failed to update config overrides: %s (%s)", resp.Status(), string(resp.Body)) + } + + return get.Run(ctx, projectRef, fsys) +} From 7c26c046e3e680ef4279f54601fc219ef0e3be82 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Wed, 22 Jan 2025 15:37:53 +0800 Subject: [PATCH 13/22] fix: ignore envs declared with empty value (#3062) --- pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 24487cafa..56c76323e 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -782,7 +782,7 @@ func LoadEnvHook(f reflect.Kind, t reflect.Kind, data interface{}) (interface{}, } value := data.(string) if matches := envPattern.FindStringSubmatch(value); len(matches) > 1 { - if env, exists := os.LookupEnv(matches[1]); exists { + if env := os.Getenv(matches[1]); len(env) > 0 { value = env } } From 73e0b2d43d53ddcd6cecc1bcf67a1186ab682bc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20Caba=C3=A7o?= Date: Thu, 23 Jan 2025 03:09:51 +0000 Subject: [PATCH 14/22] fix: Exclude realtime messages publication from publication dropping (#3063) --- pkg/migration/queries/drop.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/migration/queries/drop.sql b/pkg/migration/queries/drop.sql index ae2332524..c25d1a14f 100644 --- a/pkg/migration/queries/drop.sql +++ b/pkg/migration/queries/drop.sql @@ -81,7 +81,7 @@ begin select * from pg_publication p where - p.pubname != 'supabase_realtime' + p.pubname not like 'supabase_realtime%' loop execute format('drop publication if exists %I', rec.pubname); end loop; From 354815f5c2c42c660ef2bb9dc3811d57b66d8702 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 04:18:30 +0000 Subject: [PATCH 15/22] chore(deps): bump github.com/docker/cli from 27.5.0+incompatible to 27.5.1+incompatible (#3066) chore(deps): bump github.com/docker/cli Bumps [github.com/docker/cli](https://github.com/docker/cli) from 27.5.0+incompatible to 27.5.1+incompatible. - [Commits](https://github.com/docker/cli/compare/v27.5.0...v27.5.1) --- updated-dependencies: - dependency-name: github.com/docker/cli dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f287b4b97..3dc66254c 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/charmbracelet/lipgloss v0.12.1 github.com/containers/common v0.61.1 github.com/deepmap/oapi-codegen/v2 v2.2.0 - github.com/docker/cli v27.5.0+incompatible + github.com/docker/cli v27.5.1+incompatible github.com/docker/docker v27.5.0+incompatible github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 diff --git a/go.sum b/go.sum index 0b1a3f5a5..dc4acad16 100644 --- a/go.sum +++ b/go.sum @@ -228,8 +228,8 @@ github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxK github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= github.com/dnephin/pflag v1.0.7 h1:oxONGlWxhmUct0YzKTgrpQv9AUA1wtPBn7zuSjJqptk= github.com/dnephin/pflag v1.0.7/go.mod h1:uxE91IoWURlOiTUIA8Mq5ZZkAv3dPUfZNaT80Zm7OQE= -github.com/docker/cli v27.5.0+incompatible h1:aMphQkcGtpHixwwhAXJT1rrK/detk2JIvDaFkLctbGM= -github.com/docker/cli v27.5.0+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= +github.com/docker/cli v27.5.1+incompatible h1:JB9cieUT9YNiMITtIsguaN55PLOHhBSz3LKVc6cqWaY= +github.com/docker/cli v27.5.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= From db01dd3254cc3bb8c64d810ada204685ca7383cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 04:23:04 +0000 Subject: [PATCH 16/22] chore(deps): bump github.com/go-git/go-git/v5 from 5.13.1 to 5.13.2 (#3067) Bumps [github.com/go-git/go-git/v5](https://github.com/go-git/go-git) from 5.13.1 to 5.13.2. - [Release notes](https://github.com/go-git/go-git/releases) - [Commits](https://github.com/go-git/go-git/compare/v5.13.1...v5.13.2) --- updated-dependencies: - dependency-name: github.com/go-git/go-git/v5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 10 +++++----- go.sum | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 3dc66254c..b17612180 100644 --- a/go.mod +++ b/go.mod @@ -20,7 +20,7 @@ require ( github.com/ecies/go/v2 v2.0.10 github.com/getsentry/sentry-go v0.31.1 github.com/go-errors/errors v1.5.1 - github.com/go-git/go-git/v5 v5.13.1 + github.com/go-git/go-git/v5 v5.13.2 github.com/go-xmlfmt/xmlfmt v1.1.3 github.com/golang-jwt/jwt/v5 v5.2.1 github.com/golangci/golangci-lint v1.63.4 @@ -74,7 +74,7 @@ require ( github.com/Masterminds/semver/v3 v3.3.0 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect - github.com/ProtonMail/go-crypto v1.1.3 // indirect + github.com/ProtonMail/go-crypto v1.1.5 // indirect github.com/alecthomas/chroma/v2 v2.8.0 // indirect github.com/alecthomas/go-check-sumtype v0.3.1 // indirect github.com/alexkohler/nakedret/v2 v2.0.5 // indirect @@ -136,7 +136,7 @@ require ( github.com/ghostiam/protogetter v0.3.8 // indirect github.com/go-critic/go-critic v0.11.5 // indirect github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect - github.com/go-git/go-billy/v5 v5.6.1 // indirect + github.com/go-git/go-billy/v5 v5.6.2 // indirect github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect @@ -243,7 +243,7 @@ require ( github.com/opencontainers/image-spec v1.1.0 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/perimeterx/marshmallow v1.1.5 // indirect - github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/pjbgf/sha1cd v0.3.2 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/polyfloyd/go-errorlint v1.7.0 // indirect @@ -326,7 +326,7 @@ require ( golang.org/x/crypto v0.32.0 // indirect golang.org/x/exp v0.0.0-20241009180824-f66d83c29e7c // indirect golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect - golang.org/x/net v0.33.0 // indirect + golang.org/x/net v0.34.0 // indirect golang.org/x/sync v0.10.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect diff --git a/go.sum b/go.sum index dc4acad16..3859da0f1 100644 --- a/go.sum +++ b/go.sum @@ -71,8 +71,8 @@ github.com/Netflix/go-env v0.1.2 h1:0DRoLR9lECQ9Zqvkswuebm3jJ/2enaDX6Ei8/Z+EnK0= github.com/Netflix/go-env v0.1.2/go.mod h1:WlIhYi++8FlKNJtrop1mjXYAJMzv1f43K4MqCoh0yGE= github.com/OpenPeeDeeP/depguard/v2 v2.2.0 h1:vDfG60vDtIuf0MEOhmLlLLSzqaRM8EMcgJPdp74zmpA= github.com/OpenPeeDeeP/depguard/v2 v2.2.0/go.mod h1:CIzddKRvLBC4Au5aYP/i3nyaWQ+ClszLIuVocRiCYFQ= -github.com/ProtonMail/go-crypto v1.1.3 h1:nRBOetoydLeUb4nHajyO2bKqMLfWQ/ZPwkXqXxPxCFk= -github.com/ProtonMail/go-crypto v1.1.3/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= +github.com/ProtonMail/go-crypto v1.1.5 h1:eoAQfK2dwL+tFSFpr7TbOaPNUbPiJj4fLYwwGE1FQO4= +github.com/ProtonMail/go-crypto v1.1.5/go.mod h1:rA3QumHc/FZ8pAHreoekgiAbzpNsfQAosU5td4SnOrE= github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d h1:hi6J4K6DKrR4/ljxn6SF6nURyu785wKMuQcjt7H3VCQ= github.com/Shopify/logrus-bugsnag v0.0.0-20170309145241-6dbc35f2c30d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ= @@ -252,8 +252,8 @@ github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7/go.mod h1:cyGadeNE github.com/dvsekhvalnov/jose2go v0.0.0-20170216131308-f21a8cedbbae/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/ecies/go/v2 v2.0.10 h1:AaLxGio0MLLbvWur4rKnLzw+K9zI+wMScIDAtqCqOtU= github.com/ecies/go/v2 v2.0.10/go.mod h1:N73OyuR6tuKznit2LhXjrZ0XAQ234uKbzYz8pEPYzlI= -github.com/elazarl/goproxy v1.2.3 h1:xwIyKHbaP5yfT6O9KIeYJR5549MXRQkoQMRXGztz8YQ= -github.com/elazarl/goproxy v1.2.3/go.mod h1:YfEbZtqP4AetfO6d40vWchF3znWX7C7Vd6ZMfdL8z64= +github.com/elazarl/goproxy v1.4.0 h1:4GyuSbFa+s26+3rmYNSuUVsx+HgPrV1bk1jXI0l9wjM= +github.com/elazarl/goproxy v1.4.0/go.mod h1:X/5W/t+gzDyLfHW4DrMdpjqYjpXsURlBt9lpBDxZZZQ= github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -299,12 +299,12 @@ github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8b github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= -github.com/go-git/go-billy/v5 v5.6.1 h1:u+dcrgaguSSkbjzHwelEjc0Yj300NUevrrPphk/SoRA= -github.com/go-git/go-billy/v5 v5.6.1/go.mod h1:0AsLr1z2+Uksi4NlElmMblP5rPcDZNRCD8ujZCRR2BE= +github.com/go-git/go-billy/v5 v5.6.2 h1:6Q86EsPXMa7c3YZ3aLAQsMA0VlWmy43r6FHqa/UNbRM= +github.com/go-git/go-billy/v5 v5.6.2/go.mod h1:rcFC2rAsp/erv7CMz9GczHcuD0D32fWzH+MJAU+jaUU= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= -github.com/go-git/go-git/v5 v5.13.1 h1:DAQ9APonnlvSWpvolXWIuV6Q6zXy2wHbN4cVlNR5Q+M= -github.com/go-git/go-git/v5 v5.13.1/go.mod h1:qryJB4cSBoq3FRoBRf5A77joojuBcmPJ0qu3XXXVixc= +github.com/go-git/go-git/v5 v5.13.2 h1:7O7xvsK7K+rZPKW6AQR1YyNhfywkv7B8/FsP3ki6Zv0= +github.com/go-git/go-git/v5 v5.13.2/go.mod h1:hWdW5P4YZRjmpGHwRH2v3zkWcNl6HeXaXQEMGb3NJ9A= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -773,8 +773,8 @@ github.com/perimeterx/marshmallow v1.1.5 h1:a2LALqQ1BlHM8PZblsDdidgv1mWi1DgC2UmX github.com/perimeterx/marshmallow v1.1.5/go.mod h1:dsXbUu8CRzfYP5a87xpp0xq9S3u0Vchtcl8we9tYaXw= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= github.com/pingcap/errors v0.11.4/go.mod h1:Oi8TUi2kEtXXLMJk9l1cGmz20kV3TaQ0usTwv5KuLY8= -github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= -github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= +github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1182,8 +1182,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= -golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I= -golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= From 3952af0512c1da1b3521e28ec464f53482f882fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jan 2025 04:27:55 +0000 Subject: [PATCH 17/22] chore(deps): bump github.com/docker/docker from 27.5.0+incompatible to 27.5.1+incompatible (#3068) chore(deps): bump github.com/docker/docker Bumps [github.com/docker/docker](https://github.com/docker/docker) from 27.5.0+incompatible to 27.5.1+incompatible. - [Release notes](https://github.com/docker/docker/releases) - [Commits](https://github.com/docker/docker/compare/v27.5.0...v27.5.1) --- updated-dependencies: - dependency-name: github.com/docker/docker dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index b17612180..9a03e71a0 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/containers/common v0.61.1 github.com/deepmap/oapi-codegen/v2 v2.2.0 github.com/docker/cli v27.5.1+incompatible - github.com/docker/docker v27.5.0+incompatible + github.com/docker/docker v27.5.1+incompatible github.com/docker/go-connections v0.5.0 github.com/docker/go-units v0.5.0 github.com/ecies/go/v2 v2.0.10 diff --git a/go.sum b/go.sum index 3859da0f1..7a82524d1 100644 --- a/go.sum +++ b/go.sum @@ -233,8 +233,8 @@ github.com/docker/cli v27.5.1+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvM github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk= github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v27.5.0+incompatible h1:um++2NcQtGRTz5eEgO6aJimo6/JxrTXC941hd05JO6U= -github.com/docker/docker v27.5.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.5.1+incompatible h1:4PYU5dnBYqRQi0294d1FBECqT9ECWeQAIfE8q4YnPY8= +github.com/docker/docker v27.5.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker-credential-helpers v0.8.2 h1:bX3YxiGzFP5sOXWc3bTPEXdEaZSeVMrFgOr3T+zrFAo= github.com/docker/docker-credential-helpers v0.8.2/go.mod h1:P3ci7E3lwkZg6XiHdRKft1KckHiO9a2rNtyFbZ/ry9M= github.com/docker/go v1.5.1-1.0.20160303222718-d30aec9fd63c h1:lzqkGL9b3znc+ZUgi7FlLnqjQhcXxkNM/quxIjBVMD0= From 60b221e8d0b2d1b09ae843389ffcd09a0521d16e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20Caba=C3=A7o?= Date: Thu, 23 Jan 2025 08:26:29 +0000 Subject: [PATCH 18/22] fix: Bump realtime image (#3069) --- pkg/config/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 4183b4857..300754972 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -16,7 +16,7 @@ const ( vectorImage = "timberio/vector:0.28.1-alpine" supavisorImage = "supabase/supavisor:1.1.56" gotrueImage = "supabase/gotrue:v2.167.0" - realtimeImage = "supabase/realtime:v2.33.70" + realtimeImage = "supabase/realtime:v2.34.2" storageImage = "supabase/storage-api:v1.14.5" logflareImage = "supabase/logflare:1.4.0" // Append to JobImages when adding new dependencies below From 337aacd0dc90f25d2a65a3c4af2030e44ee588d5 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Thu, 23 Jan 2025 18:00:05 +0800 Subject: [PATCH 19/22] fix: warn uninitialised envs instead of error (#3065) --- pkg/config/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/config.go b/pkg/config/config.go index 56c76323e..5d7616575 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -771,7 +771,7 @@ func (c *config) Validate(fsys fs.FS) error { func assertEnvLoaded(s string) error { if matches := envPattern.FindStringSubmatch(s); len(matches) > 1 { - return errors.Errorf(`Error evaluating "%s": environment variable %s is unset.`, s, matches[1]) + fmt.Fprintln(os.Stderr, "WARN: environment variable is unset:", matches[1]) } return nil } From c45c25701ed3535d715aadade54f46e5753fb7ab Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 24 Jan 2025 04:16:38 +0000 Subject: [PATCH 20/22] chore(deps): bump google.golang.org/grpc from 1.69.4 to 1.70.0 (#3072) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.4 to 1.70.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.69.4...v1.70.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 6 +++--- go.sum | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 9a03e71a0..caefe0083 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,7 @@ require ( golang.org/x/mod v0.22.0 golang.org/x/oauth2 v0.25.0 golang.org/x/term v0.28.0 - google.golang.org/grpc v1.69.4 + google.golang.org/grpc v1.70.0 gopkg.in/yaml.v3 v3.0.1 gotest.tools/gotestsum v1.12.0 ) @@ -315,8 +315,8 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.28.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 // indirect go.opentelemetry.io/otel/metric v1.34.0 // indirect - go.opentelemetry.io/otel/sdk v1.31.0 // indirect - go.opentelemetry.io/otel/sdk/metric v1.31.0 // indirect + go.opentelemetry.io/otel/sdk v1.32.0 // indirect + go.opentelemetry.io/otel/sdk/metric v1.32.0 // indirect go.opentelemetry.io/otel/trace v1.34.0 // indirect go.opentelemetry.io/proto/otlp v1.3.1 // indirect go.uber.org/atomic v1.9.0 // indirect diff --git a/go.sum b/go.sum index 7a82524d1..7607a8b4e 100644 --- a/go.sum +++ b/go.sum @@ -1030,10 +1030,10 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0 h1:j9+03 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.28.0/go.mod h1:Y5+XiUG4Emn1hTfciPzGPJaSI+RpDts6BnCIir0SLqk= go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= -go.opentelemetry.io/otel/sdk v1.31.0 h1:xLY3abVHYZ5HSfOg3l2E5LUj2Cwva5Y7yGxnSW9H5Gk= -go.opentelemetry.io/otel/sdk v1.31.0/go.mod h1:TfRbMdhvxIIr/B2N2LQW2S5v9m3gOQ/08KsbbO5BPT0= -go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= -go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4= +go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU= +go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU= +go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ= go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= @@ -1464,8 +1464,8 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= -google.golang.org/grpc v1.69.4 h1:MF5TftSMkd8GLw/m0KM6V8CMOCY6NZ1NQDPGFgbTt4A= -google.golang.org/grpc v1.69.4/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ= +google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= From dde5a42b25e6f090e6d09a9db9b16349ce9eb605 Mon Sep 17 00:00:00 2001 From: Han Qiao Date: Fri, 24 Jan 2025 17:13:50 +0800 Subject: [PATCH 21/22] fix: ignore deprecated realtime publication (#3073) --- pkg/migration/queries/drop.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/migration/queries/drop.sql b/pkg/migration/queries/drop.sql index c25d1a14f..6dd8d8647 100644 --- a/pkg/migration/queries/drop.sql +++ b/pkg/migration/queries/drop.sql @@ -81,7 +81,7 @@ begin select * from pg_publication p where - p.pubname not like 'supabase_realtime%' + p.pubname not like 'supabase_realtime%' and p.pubname not like 'realtime_messages%' loop execute format('drop publication if exists %I', rec.pubname); end loop; From f158e2b7745ec0f5b0de7a0bbb9da0e903f2b0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20Caba=C3=A7o?= Date: Fri, 24 Jan 2025 11:58:48 +0000 Subject: [PATCH 22/22] fix: Bump realtime image (#3074) --- pkg/config/constants.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/config/constants.go b/pkg/config/constants.go index 300754972..43054e3d5 100644 --- a/pkg/config/constants.go +++ b/pkg/config/constants.go @@ -16,7 +16,7 @@ const ( vectorImage = "timberio/vector:0.28.1-alpine" supavisorImage = "supabase/supavisor:1.1.56" gotrueImage = "supabase/gotrue:v2.167.0" - realtimeImage = "supabase/realtime:v2.34.2" + realtimeImage = "supabase/realtime:v2.34.7" storageImage = "supabase/storage-api:v1.14.5" logflareImage = "supabase/logflare:1.4.0" // Append to JobImages when adding new dependencies below