From 1b20dd74d13c9519db21e27d2d6904f2b8c3d11d Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 15 Mar 2025 12:15:21 -0600 Subject: [PATCH] refactor: clean up Deno function and logging URIs in Supabase template - Reformatted Deno function response and improved readability. - Updated logging URIs to use consistent string interpolation syntax. - Ensured error messages and log paths are correctly formatted for clarity. --- blueprints/supabase/template.yml | 48 ++++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/blueprints/supabase/template.yml b/blueprints/supabase/template.yml index a36e028..4e9292b 100644 --- a/blueprints/supabase/template.yml +++ b/blueprints/supabase/template.yml @@ -544,22 +544,22 @@ config: COMMIT; - filePath: /volumes/functions/hello/index.ts content: | - // Follow this setup guide to integrate the Deno language server with your editor: - // https://deno.land/manual/getting_started/setup_your_environment - // This enables autocomplete, go to definition, etc. + // Follow this setup guide to integrate the Deno language server with your editor: + // https://deno.land/manual/getting_started/setup_your_environment + // This enables autocomplete, go to definition, etc. - import { serve } from "https://deno.land/std@0.177.1/http/server.ts" + import { serve } from "https://deno.land/std@0.177.1/http/server.ts" - serve(async () => { - return new Response( - \`"Hello from Edge Functions!"\`, - { headers: { "Content-Type": "application/json" } }, - ) - }) + serve(async () => { + return new Response( + `"Hello from Edge Functions!"`, + { headers: { "Content-Type": "application/json" } } + ) + }) - // To invoke: - // curl 'http://localhost:/functions/v1/hello' \\ - // --header 'Authorization: Bearer ' + // To invoke: + // curl 'http://localhost:/functions/v1/hello' \ + // --header 'Authorization: Bearer ' - filePath: /volumes/functions/main/index.ts content: | import { serve } from 'https://deno.land/std@0.131.0/http/server.ts' @@ -577,7 +577,7 @@ config: } const [bearer, token] = authHeader.split(' ') if (bearer !== 'Bearer') { - throw new Error(\`Auth header is not 'Bearer {token}'\`) + throw new Error(`Auth header is not 'Bearer {token}'`) } return token } @@ -628,8 +628,8 @@ config: }) } - const servicePath = \`/home/deno/functions/\${service_name}\` - console.error(\`serving the request with \${servicePath}\`) + const servicePath = `/home/deno/functions/${service_name}` + console.error(`serving the request with ${servicePath}`) const memoryLimitMb = 150 const workerTimeoutMs = 1 * 60 * 1000 @@ -772,7 +772,7 @@ config: source: |- .metadata.project = del(.project) .metadata.external_id = .metadata.project - parsed, err = parse_regex(.event_message, r'^(?P