The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Applied Prettier in quickstart.mdx file
Ayushh Khare1a1e1c3804e8
diff --git a/apps/docs/pages/guides/functions/quickstart.mdx b/apps/docs/pages/guides/functions/quickstart.mdxindex 9c77be26d04..3c14d2a760b 100644--- a/apps/docs/pages/guides/functions/quickstart.mdx+++ b/apps/docs/pages/guides/functions/quickstart.mdx@@ -1,12 +1,12 @@-import Layout from '~/layouts/DefaultGuideLayout'+import Layout from "~/layouts/DefaultGuideLayout";export const meta = {- id: 'functions-quickstart',- title: 'Edge Functions Quickstart',- description: 'Globally distributed TypeScript Functions.',- sidebar_label: 'Quickstart',- video: 'https://www.youtube.com/v/rzglqRdZUQE',-}+ id: "functions-quickstart",+ title: "Edge Functions Quickstart",+ description: "Globally distributed TypeScript Functions.",+ sidebar_label: "Quickstart",+ video: "https://www.youtube.com/v/rzglqRdZUQE",+};Learn how to build an Edge Function locally and deploy it to the Supabase Platform in less than 7 minutes.@@ -94,14 +94,17 @@ or using one of the [client libraries](/docs#reference-documentation), e.g. usin```js// https://supabase.com/docs/reference/javascript/installing-import { createClient } from '@supabase/supabase-js'+import { createClient } from "@supabase/supabase-js";// Create a single supabase client for interacting with your database-const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')--const { data, error } = await supabase.functions.invoke('hello-world', {- body: { name: 'Functions' },-})+const supabase = createClient(+ "https://xyzcompany.supabase.co",+ "public-anon-key",+);++const { data, error } = await supabase.functions.invoke("hello-world", {+ body: { name: "Functions" },+});```After invoking your Edge Function you should see the response `{ "message":"Hello Functions!" }`.@@ -111,24 +114,29 @@ After invoking your Edge Function you should see the response `{ "message":"HellWhen interacting with Edge Functions, it's important to be prepared for potential errors that might occur during the invocation. To handle errors effectively, the following error handling code can be used:```js-import { FunctionsHttpError, FunctionsRelayError, FunctionsFetchError } from "@supabase/supabase-js";+import {+ FunctionsHttpError,+ FunctionsRelayError,+ FunctionsFetchError,+} from "@supabase/supabase-js";-const { data, error } = await supabase.functions.invoke('hello', {+const { data, error } = await supabase.functions.invoke("hello", {headers: {- "my-custom-header": 'my-custom-header-value'+ "my-custom-header": "my-custom-header-value",},- body: { foo: 'bar' }-})+ body: { foo: "bar" },+});if (error instanceof FunctionsHttpError) {- const errorMessage = await error.context.json()- console.log('Function returned an error', errorMessage)+ const errorMessage = await error.context.json();+ console.log("Function returned an error", errorMessage);} else if (error instanceof FunctionsRelayError) {- console.log('Relay error:', error.message)+ console.log("Relay error:", error.message);} else if (error instanceof FunctionsFetchError) {- console.log('Fetch error:', error.message)+ console.log("Fetch error:", error.message);}```+In the provided error handling code, we're checking the type of error that occurred using the "instanceof" operator. This helps us differentiate between different types of errors and handle them appropriately. Depending on the type of error, we either log the error message or information specific to that type of error.This error handling mechanism ensures that your application can gracefully handle errors that might arise during the execution of Edge Functions, providing a more robust user experience.@@ -140,7 +148,7 @@ We recommend using [esm.sh](https://esm.sh/) for importing Node.js modules thatFor example, when you want to use supabase-js within Supabase Edge Functions, you would import `createClient` as follows:```ts-import { createClient } from 'https://esm.sh/@supabase/supabase-js@2'+import { createClient } from "https://esm.sh/@supabase/supabase-js@2";```As long as your environment is set up properly and the module you're importing is exporting types, the import will have types and autocompletion support.@@ -265,6 +273,8 @@ Edge Functions supports `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, and `OPTIONS`.- Edge Functions- Serving of HTML content is not supported (`GET` requests that return `text/html` will be rewritten to `text/plain`).-export const Page = ({ children }) => <Layout meta={meta} children={children} />+export const Page = ({ children }) => (+ <Layout meta={meta} children={children} />+);-export default Page+export default Page;diff --git a/package-lock.json b/package-lock.jsonindex 61d4264c609..eb04f2ab31e 100644--- a/package-lock.json+++ b/package-lock.json@@ -18,7 +18,7 @@"devDependencies": {"eslint": "^8.41.0","eslint-config-custom": "*",- "prettier": "^2.8.8",+ "prettier": "2.8.8","prettier-plugin-sql-cst": "^0.5.0","supabase": "^1.45.2","turbo": "^1.10.13"@@ -34725,8 +34725,9 @@},"node_modules/prettier": {"version": "2.8.8",+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz",+ "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==","dev": true,- "license": "MIT","bin": {"prettier": "bin-prettier.js"},diff --git a/package.json b/package.jsonindex 3f8d338576e..bd188f04809 100644--- a/package.json+++ b/package.json@@ -41,7 +41,7 @@"devDependencies": {"eslint": "^8.41.0","eslint-config-custom": "*",- "prettier": "^2.8.8",+ "prettier": "2.8.8","prettier-plugin-sql-cst": "^0.5.0","supabase": "^1.45.2","turbo": "^1.10.13"