From c434561caba54bd4170cb0743a163e0f0d2c19af Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Sun, 27 Mar 2022 10:48:46 +0200 Subject: [PATCH 01/97] add toggle for update password require reauthentication --- studio/pages/api/auth/[ref]/config.ts | 1 + studio/pages/project/[ref]/auth/settings.tsx | 3 +++ studio/stores/jsonSchema/auth_gotrue_config.json | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/studio/pages/api/auth/[ref]/config.ts b/studio/pages/api/auth/[ref]/config.ts index 53973f4dca4..c2cadffa6d5 100644 --- a/studio/pages/api/auth/[ref]/config.ts +++ b/studio/pages/api/auth/[ref]/config.ts @@ -38,6 +38,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => { MAILER_URLPATHS_CONFIRMATION: '', MAILER_URLPATHS_RECOVERY: '', MAILER_URLPATHS_EMAIL_CHANGE: '', + SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION: false, SMTP_ADMIN_EMAIL: '', SMTP_HOST: null, SMTP_PORT: null, diff --git a/studio/pages/project/[ref]/auth/settings.tsx b/studio/pages/project/[ref]/auth/settings.tsx index c596728347b..362d6830190 100644 --- a/studio/pages/project/[ref]/auth/settings.tsx +++ b/studio/pages/project/[ref]/auth/settings.tsx @@ -121,6 +121,7 @@ const Settings = () => { 'JWT_EXP', 'DISABLE_SIGNUP', 'PASSWORD_MIN_LENGTH', + 'SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION', ])} model={{ SITE_URL: model.SITE_URL || undefined, @@ -128,6 +129,7 @@ const Settings = () => { DISABLE_SIGNUP: model.DISABLE_SIGNUP, JWT_EXP: model.JWT_EXP || undefined, PASSWORD_MIN_LENGTH: model.PASSWORD_MIN_LENGTH || undefined, + SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION: model.SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION || false, }} onSubmit={(model: any) => onFormSubmit(model)} > @@ -143,6 +145,7 @@ const Settings = () => { /> + diff --git a/studio/stores/jsonSchema/auth_gotrue_config.json b/studio/stores/jsonSchema/auth_gotrue_config.json index 1bb8bdd280d..794016f0eb9 100644 --- a/studio/stores/jsonSchema/auth_gotrue_config.json +++ b/studio/stores/jsonSchema/auth_gotrue_config.json @@ -6,6 +6,7 @@ "JWT_EXP", "JWT_AUD", "JWT_DEFAULT_GROUP_NAME", + "SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION", "EXTERNAL_EMAIL_ENABLED", "EXTERNAL_PHONE_ENABLED", "EXTERNAL_APPLE_ENABLED", @@ -396,6 +397,11 @@ "title": "Minimum password length", "type": "integer" }, + "SECURITY_UPDATE_PASSWORD_REQUIRE_REAUTHENTICATION": { + "title": "Enable strict password updates", + "type": "boolean", + "help": "If enabled, users need to reauthenticate via email or phone before updating their passwords." + }, "SMS_AUTOCONFIRM": { "title": "Enable phone confirmations", "type": "boolean", From 3b60fa9b5bca075391ef4c556b4c9e2c70d3ddc5 Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Tue, 29 Mar 2022 12:45:24 +0200 Subject: [PATCH 02/97] refactor auth settings labels to sentence case --- .../stores/jsonSchema/auth_gotrue_config.json | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/studio/stores/jsonSchema/auth_gotrue_config.json b/studio/stores/jsonSchema/auth_gotrue_config.json index 794016f0eb9..53d872f0ceb 100644 --- a/studio/stores/jsonSchema/auth_gotrue_config.json +++ b/studio/stores/jsonSchema/auth_gotrue_config.json @@ -53,27 +53,27 @@ "help": "The base URL of your website. Used as an allow-list for redirects and for constructing URLs used in emails." }, "URI_ALLOW_LIST": { - "title": "Additional Redirect URLs", + "title": "Additional redirect URLs", "type": "string", "help": "A comma separated list of *exact* URLs that auth providers are permitted to redirect to post authentication." }, "DISABLE_SIGNUP": { - "title": "Disable Signup", + "title": "Disable signup", "type": "boolean", "help": "Allow/disallow new user signups to your project." }, "EXTERNAL_EMAIL_ENABLED": { - "title": "Enable Email Signup", + "title": "Enable email signup", "type": "boolean", "help": "Allow/disallow new user signups via email to your project." }, "EXTERNAL_PHONE_ENABLED": { - "title": "Enable Phone Signup", + "title": "Enable phone signup", "type": "boolean", "help": "Allow/disallow new user signups via phone to your project." }, "JWT_EXP": { - "title": "JWT Expiry", + "title": "JWT expiry", "type": "integer", "help": "How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 seconds (one week).", "minimum": 1, @@ -81,7 +81,7 @@ "multipleof": 1 }, "JWT_AUD": { - "title": "JWT Audience", + "title": "JWT audience", "type": "string" }, "JWT_DEFAULT_GROUP_NAME": { @@ -277,35 +277,35 @@ "type": "string" }, "SMTP_ADMIN_EMAIL": { - "title": "SMTP Admin Email", + "title": "SMTP admin email", "type": "string" }, "SMTP_HOST": { - "title": "SMTP Host", + "title": "SMTP host", "type": "string" }, "SMTP_PORT": { - "title": "SMTP Port", + "title": "SMTP port", "type": "string" }, "SMTP_USER": { - "title": "SMTP User", + "title": "SMTP user", "type": "string" }, "SMTP_PASS": { - "title": "SMTP Password", + "title": "SMTP password", "type": "string" }, "SMTP_PASS_ENCRYPTED": { - "title": "SMTP Password", + "title": "SMTP password", "type": "string" }, "SMTP_SENDER_NAME": { - "title": "SMTP Sender Name", + "title": "SMTP sender name", "type": "string" }, "RATE_LIMIT_EMAIL_SENT": { - "title": "Rate Limit", + "title": "Rate limit", "type": "number", "help": "Maximum number of emails sent per hour (Default: 30, Max: 32,767)", "minimum": 1, @@ -408,7 +408,7 @@ "help": "If enabled, users need to confirm their phone number before signing in." }, "SMS_PROVIDER": { - "title": "Sms Provider", + "title": "Sms provider", "type": "string", "options": [ { @@ -430,24 +430,24 @@ ] }, "SMS_TEXTLOCAL_API_KEY": { - "title": "Textlocal API Key", + "title": "Textlocal API key", "type": "string" }, "SMS_TEXTLOCAL_SENDER": { - "title": "Textlocal Sender", + "title": "Textlocal sender", "type": "string", "help": "Textlocal sender phone number" }, "SMS_TWILIO_ACCOUNT_SID": { - "title": "Twilio Account SID", + "title": "Twilio account SID", "type": "string" }, "SMS_TWILIO_AUTH_TOKEN": { - "title": "Twilio Auth Token", + "title": "Twilio auth token", "type": "string" }, "SMS_TWILIO_MESSAGE_SERVICE_SID": { - "title": "Twilio Message Service SID", + "title": "Twilio message service SID", "type": "string", "help": "Twilio message service SID or twilio phone number" }, @@ -461,15 +461,15 @@ "help": "Messagebird sender name or phone number" }, "SMS_VONAGE_API_KEY": { - "title": "Vonage API Key", + "title": "Vonage API key", "type": "string" }, "SMS_VONAGE_API_SECRET": { - "title": "Vonage API Secret", + "title": "Vonage API secret", "type": "string" }, "SMS_VONAGE_FROM": { - "title": "Vonage Sender", + "title": "Vonage sender", "type": "string", "help": "Vonage sender phone number" }, From c13db73a603ba17bbe03178f9147c5159624d183 Mon Sep 17 00:00:00 2001 From: Roj Date: Tue, 5 Apr 2022 13:47:18 +0300 Subject: [PATCH 03/97] chore: correct "JavaScript" cases --- about/docs/careers/developer-success.mdx | 2 +- about/docs/careers/front-end-developers.mdx | 2 +- .../nuxtjs-user-management/plugins/README.md | 2 +- .../interfaces/Home/Home.constants.ts | 2 +- .../StoragePolicies/StoragePoliciesEditor.js | 2 +- web/docs/about.mdx | 2 +- web/docs/guides/api.mdx | 8 ++++---- web/docs/guides/auth/auth-email.mdx | 4 ++-- web/docs/guides/auth/auth-magic-link.mdx | 4 ++-- web/docs/guides/auth/auth-messagebird.mdx | 10 +++++----- web/docs/guides/auth/auth-twilio.mdx | 10 +++++----- web/docs/guides/auth/auth-vonage.mdx | 10 +++++----- web/docs/guides/database/arrays.mdx | 6 +++--- web/docs/guides/database/extensions/plv8.mdx | 12 ++++++------ web/docs/guides/database/full-text-search.mdx | 18 +++++++++--------- web/docs/guides/database/sql-to-api.mdx | 10 +++++----- web/docs/guides/examples.mdx | 2 +- web/sidebars.js | 2 +- 18 files changed, 54 insertions(+), 54 deletions(-) diff --git a/about/docs/careers/developer-success.mdx b/about/docs/careers/developer-success.mdx index 25a81df2d7c..e7be5de18a2 100644 --- a/about/docs/careers/developer-success.mdx +++ b/about/docs/careers/developer-success.mdx @@ -34,7 +34,7 @@ Supabase is hiring Developer Success Engineers. Help us build the easiest databa ## Bonus if you: -- Are a Polyglot developer, with some skill in NodeJS/Javascript. +- Are a Polyglot developer, with some skill in Node.js/JavaScript. - Have PostgreSQL experience. ## About Supabase diff --git a/about/docs/careers/front-end-developers.mdx b/about/docs/careers/front-end-developers.mdx index 5f0768f27c5..3f190eaef65 100644 --- a/about/docs/careers/front-end-developers.mdx +++ b/about/docs/careers/front-end-developers.mdx @@ -42,7 +42,7 @@ You've worked in multi disciplinary teams before, working with designers, develo ## Must have skills -- 5+ years experience in web development (Javascript, HTML5, CSS3, SCSS/LESS). +- 5+ years experience in web development (JavaScript, HTML5, CSS3, SCSS/LESS). - Have an understanding of modern JS (ES6 etc). - Experience with Node. - Experience with React (We use NextJS everywhere). diff --git a/examples/nuxtjs-user-management/plugins/README.md b/examples/nuxtjs-user-management/plugins/README.md index ca1f9d8a452..1736413ee11 100644 --- a/examples/nuxtjs-user-management/plugins/README.md +++ b/examples/nuxtjs-user-management/plugins/README.md @@ -2,6 +2,6 @@ **This directory is not required, you can delete it if you don't want to use it.** -This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. +This directory contains JavaScript plugins that you want to run before mounting the root Vue.js application. More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). diff --git a/studio/components/interfaces/Home/Home.constants.ts b/studio/components/interfaces/Home/Home.constants.ts index d49bcb8907e..f2cab0a2e69 100644 --- a/studio/components/interfaces/Home/Home.constants.ts +++ b/studio/components/interfaces/Home/Home.constants.ts @@ -1,6 +1,6 @@ export const CLIENT_LIBRARIES = [ { - language: 'Javascript', + language: 'JavaScript', officialSupport: true, releaseState: undefined, docsUrl: 'https://supabase.com/docs/reference/javascript/installing', diff --git a/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditor.js b/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditor.js index 1dc41d7b7c5..7ec39085dad 100644 --- a/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditor.js +++ b/studio/components/to-be-cleaned/Storage/StoragePolicies/StoragePoliciesEditor.js @@ -55,7 +55,7 @@ const PolicyAllowedOperations = ({ allowedOperations = [], onToggleOperation = (

Based on the operations you have selected, you can use any of the highlighted functions in - the supabase-js Javascript library + the supabase-js JavaScript library

diff --git a/web/docs/about.mdx b/web/docs/about.mdx index 67a2be47967..2fd2d7ed03d 100755 --- a/web/docs/about.mdx +++ b/web/docs/about.mdx @@ -33,7 +33,7 @@ const frameworks = [ }, { name: 'Flutter', logo: DartLogo, href: '/docs/guides/with-flutter' }, { - name: 'Javascript', + name: 'JavaScript', logo: JavascriptLogo, href: 'https://github.com/supabase/supabase/tree/master/examples/javascript-auth', }, diff --git a/web/docs/guides/api.mdx b/web/docs/guides/api.mdx index a7fb8dfc992..b0169cc15fd 100644 --- a/web/docs/guides/api.mdx +++ b/web/docs/guides/api.mdx @@ -158,7 +158,7 @@ values={[ ```sh 1. Go to the "API" section. 2. Find "todos" in the "Tables and Views" section. -3. Switch between the Javascript and the cURL docs using the tabs. +3. Switch between the JavaScript and the cURL docs using the tabs. ``` @@ -174,12 +174,12 @@ using the API URL (`[SUPABASE_URL]`) and Key (`[SUPABASE_ANON_KEY]`) we provided - + ```javascript // Initialize the JS client diff --git a/web/docs/guides/auth/auth-email.mdx b/web/docs/guides/auth/auth-email.mdx index e2c3811c9e1..b044cf8a56f 100644 --- a/web/docs/guides/auth/auth-email.mdx +++ b/web/docs/guides/auth/auth-email.mdx @@ -12,7 +12,7 @@ import TabItem from '@theme/TabItem' Setting up Email logins for your Supabase application. - Add Email authenticator to your [Supabase Project](https://app.supabase.io) -- Add the login code to your application - [Javascript](https://github.com/supabase/supabase-js) | [Dart](https://github.com/supabase/supabase-dart) +- Add the login code to your application - [JavaScript](https://github.com/supabase/supabase-js) | [Dart](https://github.com/supabase/supabase-dart) ## Add Email into your Supabase Project @@ -27,7 +27,7 @@ Setting up Email logins for your Supabase application. Add logins using our client libraries: -- [Javascript](/docs/reference/javascript/auth-signin#sign-in-with-email) +- [JavaScript](/docs/reference/javascript/auth-signin#sign-in-with-email) - [Dart](/docs/reference/dart/auth-signin#sign-in-with-email) @@ -118,7 +118,7 @@ You should present a form to the user so they can input the 6 digit pin, then se @@ -165,7 +165,7 @@ Also now that the mobile has been verified, the user can use the number and pass @@ -202,7 +202,7 @@ In javascript we can use the `signIn` method with a single parameter: `phone` @@ -233,7 +233,7 @@ The second step is the same as the previous section, you need to collect the 6-d diff --git a/web/docs/guides/auth/auth-twilio.mdx b/web/docs/guides/auth/auth-twilio.mdx index 8186dce707e..e7b9839cb91 100644 --- a/web/docs/guides/auth/auth-twilio.mdx +++ b/web/docs/guides/auth/auth-twilio.mdx @@ -100,7 +100,7 @@ Using supabase-js on the client you'll want to use the same `signUp` method that @@ -135,7 +135,7 @@ You should present a form to the user so they can input the 6 digit pin, then se @@ -182,7 +182,7 @@ Also now that the mobile has been verified, the user can use the number and pass @@ -219,7 +219,7 @@ In javascript we can use the `signIn` method with a single parameter: `phone` @@ -250,7 +250,7 @@ The second step is the same as the previous section, you need to collect the 6-d diff --git a/web/docs/guides/auth/auth-vonage.mdx b/web/docs/guides/auth/auth-vonage.mdx index b9bb13551d5..63709aa6753 100644 --- a/web/docs/guides/auth/auth-vonage.mdx +++ b/web/docs/guides/auth/auth-vonage.mdx @@ -75,7 +75,7 @@ Using supabase-js on the client you'll want to use the same `signUp` method that @@ -110,7 +110,7 @@ You should present a form to the user so they can input the 6 digit pin, then se @@ -157,7 +157,7 @@ Also now that the mobile has been verified, the user can use the number and pass @@ -194,7 +194,7 @@ In javascript we can use the `signIn` method with a single parameter: `phone` @@ -225,7 +225,7 @@ The second step is the same as the previous section, you need to collect the 6-d diff --git a/web/docs/guides/database/arrays.mdx b/web/docs/guides/database/arrays.mdx index 4b0afcabbba..4d3341a5021 100644 --- a/web/docs/guides/database/arrays.mdx +++ b/web/docs/guides/database/arrays.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs' import TabItem from '@theme/TabItem' PostgreSQL supports flexible [array types](https://www.postgresql.org/docs/12/arrays.html). -These arrays are also supported in the Supabase dashboard and in the Javascript API. +These arrays are also supported in the Supabase dashboard and in the API. ## Steps @@ -79,7 +79,7 @@ INSERT INTO arraytest (id, textarray) VALUES (1, ARRAY['Harry', 'Larry', 'Moe']) -To insert a record from the Javascript client: +To insert a record from the client: ```js const { data, error } = await supabase @@ -131,7 +131,7 @@ Your first array data! ### Query Array Data -To query an array, PostgreSQL uses 1-based arrays, so be careful, since you're probably used to 0-based arrays in Javascript. +To query an array, PostgreSQL uses 1-based arrays, so be careful, since you're probably used to 0-based arrays in . diff --git a/web/docs/guides/database/full-text-search.mdx b/web/docs/guides/database/full-text-search.mdx index c043e80298e..9ae1550ada4 100644 --- a/web/docs/guides/database/full-text-search.mdx +++ b/web/docs/guides/database/full-text-search.mdx @@ -91,7 +91,7 @@ Take the following example: defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, ]}> @@ -135,7 +135,7 @@ example above: defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, ]}> @@ -180,7 +180,7 @@ To find all `books` where the `description` contain the word `big`: defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, {label: 'Data', value: 'Data'}, ]}> @@ -269,7 +269,7 @@ To find all `books` where `description` contains BOTH of the words `little` and defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, {label: 'Data', value: 'Data'}, ]}> @@ -324,7 +324,7 @@ To find all `books` where `description` contain ANY of the words `little` or `bi defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, {label: 'Data', value: 'Data'}, ]}> @@ -429,7 +429,7 @@ Now that we've created and populated our index, we can search it using the same defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, {label: 'Data', value: 'Data'}, ]}> @@ -490,7 +490,7 @@ For example, to find the phrase `big dreams`, where the a match for "big" is fol defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, ]}> @@ -535,7 +535,7 @@ We can also use the `<->` to find words within a certain distance of eachother. defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, ]}> @@ -583,7 +583,7 @@ For example, to find records that have the word `big` but not `little`: defaultValue="SQL" values={[ {label: 'SQL', value: 'SQL'}, - {label: 'Javascript', value: 'JS'}, + {label: 'JavaScript', value: 'JS'}, {label: 'Dart', value: 'DART'}, ]}> diff --git a/web/docs/guides/database/sql-to-api.mdx b/web/docs/guides/database/sql-to-api.mdx index 570166e3267..6cba7fc175c 100644 --- a/web/docs/guides/database/sql-to-api.mdx +++ b/web/docs/guides/database/sql-to-api.mdx @@ -1,7 +1,7 @@ --- id: sql-to-api -title: 'Converting SQL to Javascript API' -description: Implementing common SQL patterns in the Javascript API +title: 'Converting SQL to API' +description: Implementing common SQL patterns in the API --- import Tabs from '@theme/Tabs' @@ -78,6 +78,6 @@ const { data, error } = await supabase - [Supabase Account - Free Tier OK](https://supabase.com) - [Postgrest Operators](https://postgrest.org/en/stable/api.html#operators) -- [Supabase Javascript API: select](/docs/reference/javascript/select) -- [Supabase Javascript API: modifiers](/docs/reference/javascript/using-modifiers) -- [Supabase Javascript API: filters](/docs/reference/javascript/using-filters) +- [Supabase API: select](/docs/reference/javascript/select) +- [Supabase API: modifiers](/docs/reference/javascript/using-modifiers) +- [Supabase API: filters](/docs/reference/javascript/using-filters) diff --git a/web/docs/guides/examples.mdx b/web/docs/guides/examples.mdx index 077ff5ca371..cd9eefc9174 100644 --- a/web/docs/guides/examples.mdx +++ b/web/docs/guides/examples.mdx @@ -67,7 +67,7 @@ Build a basic Todo List with Supabase and your favorite frontend framework: ### Auth examples -- [Supabase Auth with vanilla Javascript.](https://github.com/supabase/supabase/tree/master/examples/javascript-auth). Use Supabase without any frontend frameworks. +- [Supabase Auth with vanilla JavaScript.](https://github.com/supabase/supabase/tree/master/examples/javascript-auth). Use Supabase without any frontend frameworks. - [Supabase Auth with Next.js SSR.](https://github.com/supabase/supabase/tree/master/examples/nextjs-with-supabase-auth) Uses cookies to persist auth between the server and the client. - [Supabase Auth with RedwoodJS.](https://redwood-playground-auth.netlify.app/supabase) Try out Supabase authentication in the [RedwoodJS](https://redwoodjs.com) Authentication Playground complete with OAuth support and code samples. diff --git a/web/sidebars.js b/web/sidebars.js index 961dfd8ab69..eb2df627c33 100755 --- a/web/sidebars.js +++ b/web/sidebars.js @@ -13,7 +13,7 @@ module.exports = { supabaseClient: [ { type: 'category', - label: 'Javascript', + label: 'JavaScript', collapsed: false, items: supabaseClient.docs, }, From c833244b7e145859338b7b600083825a72fa7de7 Mon Sep 17 00:00:00 2001 From: lyqht Date: Mon, 11 Apr 2022 23:32:20 +0800 Subject: [PATCH 04/97] improve generate types docs on GitHub Action section --- web/spec/supabase.yml | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index 70b613f12d6..f6e2c17b26e 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -394,14 +394,20 @@ pages: ### Update types automatically with GitHub Actions One way to keep your type definitions in sync with your database is to set up a GitHub action that runs on a schedule. + Supabase offers a Swagger OpenAPI specification for the REST data endpoint which you can retrieve definitions for. - Add a script to your package.json to generate the types: - + The following script can be run in your terminal to test this. ``` - "update-types": "npx openapi-typescript https://your-project.supabase.co/rest/v1/?apikey=your-anon-key --output types/database/index.ts" + npx openapi-typescript https://your-project.supabase.co/rest/v1/?apikey=your-anon-key --output types/database/index.ts ``` - In your repo, create the file `.github/workflows/update-types.yml`. Add the following snippet into this file to define the action. If there is a change to your definitions, this script will commit the change to your repo. + For the GitHub action, add a script to your package.json to generate the types: + + ``` + "update-types": "npx openapi-typescript \"${SUPABASE_URL}/rest/v1/?apikey=${SUPABASE_ANON_KEY}\" --version=2 --output types/database/index.ts" + ``` + + Then in your repo, create the file `.github/workflows/update-types.yml`. Add the following snippet into this file to define the action along with the environment variables. If there is a change to your definitions, this script will commit the change to your repo. ([Reference Article](https://blog.esteetey.dev/how-to-create-and-test-a-github-action-that-generates-types-from-supabase-database#heading-how-to-create-the-github-workflow)) ```yml name: Update database types @@ -414,6 +420,9 @@ pages: jobs: update: runs-on: ubuntu-latest + env: + SUPABASE_URL: ${{secrets.SUPABASE_URL}} + SUPABASE_ANON_KEY: ${{secrets.SUPABASE_URL}} steps: - uses: actions/checkout@v2 with: @@ -442,6 +451,27 @@ pages: branch: ${{ github.ref }} ``` + Alternatively, you can also try out a GitHub action created by a community member, [@lyqht](https://github.com/lyqht). Here's a [reference project workflow using it](https://github.com/lyqht/Billy/actions/workflows/update-types.yml), and this is how you can use it. + ``` + name: Update database types + + on: + schedule: + - cron: '*/5 * * * *' + workflow_dispatch: + + jobs: + update: + runs-on: ubuntu-latest + steps: + - name: Generate Supabase Database types + uses: lyqht/generate-supabase-db-types-github-action@v0.0.2 + with: + SUPABASE_URL: ${{secrets.SUPABASE_URL }} + SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} + OUTPUT_PATH: src/types/supabase.ts + ``` + auth.signUp(): title: 'signUp()' $ref: '@supabase/gotrue-js.GoTrueClient.signUp' From bcbc4cc4e790173b118863ba4c1911ba052bb95c Mon Sep 17 00:00:00 2001 From: lyqht Date: Tue, 12 Apr 2022 09:38:26 +0800 Subject: [PATCH 05/97] update generate type docs to remove example github action workflow using community action --- web/spec/supabase.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index f6e2c17b26e..4421245c199 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -451,26 +451,7 @@ pages: branch: ${{ github.ref }} ``` - Alternatively, you can also try out a GitHub action created by a community member, [@lyqht](https://github.com/lyqht). Here's a [reference project workflow using it](https://github.com/lyqht/Billy/actions/workflows/update-types.yml), and this is how you can use it. - ``` - name: Update database types - - on: - schedule: - - cron: '*/5 * * * *' - workflow_dispatch: - - jobs: - update: - runs-on: ubuntu-latest - steps: - - name: Generate Supabase Database types - uses: lyqht/generate-supabase-db-types-github-action@v0.0.2 - with: - SUPABASE_URL: ${{secrets.SUPABASE_URL }} - SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }} - OUTPUT_PATH: src/types/supabase.ts - ``` + Alternatively, you can also try out a GitHub action created by a community member at https://github.com/lyqht/generate-supabase-db-types-github-action. auth.signUp(): title: 'signUp()' From d1c0a0e49990fc6b58fef29a19158f44600028f9 Mon Sep 17 00:00:00 2001 From: Rahul Date: Tue, 12 Apr 2022 16:52:06 +0530 Subject: [PATCH 06/97] Added naming Info for "file/folder/bucket" User need to know what names or ok to use, and what names are not --- web/docs/guides/storage.mdx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/web/docs/guides/storage.mdx b/web/docs/guides/storage.mdx index 08ca8beb291..a6bee82ef2e 100644 --- a/web/docs/guides/storage.mdx +++ b/web/docs/guides/storage.mdx @@ -33,6 +33,9 @@ This is a quick guide that shows the basic functionality of Supabase Storage. Fi [example application in GitHub](https://github.com/supabase/supabase/edit/master/examples/nextjs-ts-user-management), which you can deploy yourself. +**Note before begin** : File, Folder, and Bucket names **must follow** [AWS Safe Characters naming guideline](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html) and avoid use of any other characters + + [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fsupabase%2Fsupabase%2Ftree%2Fmaster%2Fexamples%2Fnextjs-ts-user-management&project-name=supabase-user-management&repository-name=supabase-user-management&demo-title=Supabase%20User%20Management&demo-description=An%20example%20web%20app%20using%20Supabase%20and%20Next.js&demo-url=https%3A%2F%2Fsupabase-nextjs-ts-user-management.vercel.app&demo-image=https%3A%2F%2Fi.imgur.com%2FZ3HkQqe.png&integration-ids=oac_jUduyjQgOyzev1fjrW83NYOv&external-id=nextjs-user-management) ### Create a bucket From 4afbfd498e0b86092c6c346ed4d38557015eef52 Mon Sep 17 00:00:00 2001 From: Rahul Date: Tue, 12 Apr 2022 16:54:00 +0530 Subject: [PATCH 07/97] Update storage.mdx --- web/docs/guides/storage.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/web/docs/guides/storage.mdx b/web/docs/guides/storage.mdx index a6bee82ef2e..7be8aa1fe43 100644 --- a/web/docs/guides/storage.mdx +++ b/web/docs/guides/storage.mdx @@ -35,7 +35,6 @@ which you can deploy yourself. **Note before begin** : File, Folder, and Bucket names **must follow** [AWS Safe Characters naming guideline](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html) and avoid use of any other characters - [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/external?repository-url=https%3A%2F%2Fgithub.com%2Fsupabase%2Fsupabase%2Ftree%2Fmaster%2Fexamples%2Fnextjs-ts-user-management&project-name=supabase-user-management&repository-name=supabase-user-management&demo-title=Supabase%20User%20Management&demo-description=An%20example%20web%20app%20using%20Supabase%20and%20Next.js&demo-url=https%3A%2F%2Fsupabase-nextjs-ts-user-management.vercel.app&demo-image=https%3A%2F%2Fi.imgur.com%2FZ3HkQqe.png&integration-ids=oac_jUduyjQgOyzev1fjrW83NYOv&external-id=nextjs-user-management) ### Create a bucket From b15080c07365d43d6663ca9066eacfbadca6f1b4 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue, 12 Apr 2022 15:44:35 +0200 Subject: [PATCH 08/97] Update web/spec/supabase.yml --- web/spec/supabase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index 4421245c199..e1bc52f66fb 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -451,7 +451,7 @@ pages: branch: ${{ github.ref }} ``` - Alternatively, you can also try out a GitHub action created by a community member at https://github.com/lyqht/generate-supabase-db-types-github-action. + Alternatively, you can use a community-supported GitHub action: [generate-supabase-db-types-github-action](https://github.com/lyqht/generate-supabase-db-types-github-action). auth.signUp(): title: 'signUp()' From 294d50324d1de486c6a6505bbab328bff3026785 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue, 12 Apr 2022 15:45:13 +0200 Subject: [PATCH 09/97] Update web/spec/supabase.yml --- web/spec/supabase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index e1bc52f66fb..c4ea0678ce6 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -394,7 +394,7 @@ pages: ### Update types automatically with GitHub Actions One way to keep your type definitions in sync with your database is to set up a GitHub action that runs on a schedule. - Supabase offers a Swagger OpenAPI specification for the REST data endpoint which you can retrieve definitions for. + Supabase offers a Swagger OpenAPI specification for the REST data endpoint which you can use to generate definitions. The following script can be run in your terminal to test this. ``` From 87eaa51b1184efb75e4f1f700145c7413723ca50 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue, 12 Apr 2022 15:48:37 +0200 Subject: [PATCH 10/97] Update web/spec/supabase.yml --- web/spec/supabase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index c4ea0678ce6..474589a1468 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -401,7 +401,7 @@ pages: npx openapi-typescript https://your-project.supabase.co/rest/v1/?apikey=your-anon-key --output types/database/index.ts ``` - For the GitHub action, add a script to your package.json to generate the types: + You can add this script to your `package.json` and run it using `npm run update-types`: ``` "update-types": "npx openapi-typescript \"${SUPABASE_URL}/rest/v1/?apikey=${SUPABASE_ANON_KEY}\" --version=2 --output types/database/index.ts" From 2b858ab5e2aa742434d861a79cb5469cf2d6e2c8 Mon Sep 17 00:00:00 2001 From: Copple <10214025+kiwicopple@users.noreply.github.com> Date: Tue, 12 Apr 2022 15:50:02 +0200 Subject: [PATCH 11/97] Update web/spec/supabase.yml --- web/spec/supabase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index 474589a1468..1e295be78b1 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -396,7 +396,7 @@ pages: One way to keep your type definitions in sync with your database is to set up a GitHub action that runs on a schedule. Supabase offers a Swagger OpenAPI specification for the REST data endpoint which you can use to generate definitions. - The following script can be run in your terminal to test this. + The following script can be run in your terminal to produce the file `types/database/index.ts`. ``` npx openapi-typescript https://your-project.supabase.co/rest/v1/?apikey=your-anon-key --output types/database/index.ts ``` From 5df415e2895985857aaeda9e34d46749e6125e69 Mon Sep 17 00:00:00 2001 From: ndrohith09 Date: Tue, 12 Apr 2022 19:38:50 +0530 Subject: [PATCH 12/97] chore:Added i18n translations for Tamil --- i18n/README.ta.md | 190 ++++++++++++++++++++++++++++++++++++++++++++++ i18n/languages.md | 1 + 2 files changed, 191 insertions(+) create mode 100644 i18n/README.ta.md diff --git a/i18n/README.ta.md b/i18n/README.ta.md new file mode 100644 index 00000000000..47aecf8b5a5 --- /dev/null +++ b/i18n/README.ta.md @@ -0,0 +1,190 @@ +

+ +

+ +--- + +# சுபாபேஸ் + +[சுபாபேஸ்](https://supabase.com) என்பது ஒரு திறந்த மூல ஃபயர்பேஸ் மாற்றாகும். நிறுவன-தர திறந்த மூல கருவிகளைப் பயன்படுத்தி ஃபயர்பேஸ் இன் அம்சங்களை நாங்கள் உருவாக்குகிறோம். + +- [x] ஹோஸ்ட் செய்யப்பட்ட பூஸ்ட்ஜீஆர்இஎஸ் தரவுத்தளம். [ஆவணம்](https://supabase.com/docs/guides/database) +- [x] அங்கீகாரம் மற்றும் அங்கீகாரம்.. [ஆவணம்](https://supabase.com/docs/guides/auth) +- [x] தானாக உருவாக்கப்பட்ட ஏபிஐ கள். + - [x] ராஸ்ட். [ஆவணம்](https://supabase.com/docs/guides/api#rest-api) + - [x] நிகழ்நேர சந்தாக்கள். [ஆவணம்](https://supabase.com/docs/guides/api#realtime-api) + - [x] கிராப்க்யூஎல் (பீட்டா). [ஆவணம்](https://supabase.com/docs/guides/api#graphql-api) +- [x] செயல்பாடுகள். + - [x] தரவுத்தளம் செயல்பாடுகள். [ஆவணம்](https://supabase.com/docs/guides/database/functions) + - [x] விளிம்பு செயல்பாடுகள் [ஆவணம்](https://supabase.com/docs/guides/functions) +- [x] கோப்பு சேமிப்பகம். [ஆவணம்](https://supabase.com/docs/guides/storage) +- [x] டாஷ்போர்டு + +![Supabase Dashboard](https://raw.githubusercontent.com/supabase/supabase/master/www/public/images/github/supabase-dashboard.png) + +## ஆவணப்படுத்தல் + +முழு ஆவணங்களுக்கு, பார்வையிடவும் [supabase.com/docs](https://supabase.com/docs) + +எவ்வாறு பங்களிப்பது என்பதைப் பார்க்க, பார்வையிடவும் [Getting Started](./DEVELOPERS.md) + +## சமூகம் மற்றும் ஆதரவு + +- [சமூக மன்றம்](https://github.com/supabase/supabase/discussions). சிறந்த: கட்டிடம் உதவி, தரவுத்தள சிறந்த நடைமுறைகள் பற்றி விவாதம். +- [கிட்ஹப் சிக்கல்கள்](https://github.com/supabase/supabase/issues). சிறந்தது: சுபாபேஸைப் பயன்படுத்தி நீங்கள் சந்திக்கும் பிழைகள் மற்றும் பிழைகள். +- [மின்னஞ்சல் ஆதரவு](https://supabase.com/docs/support#business-support). சிறந்தது: உங்கள் தரவுத்தளம் அல்லது உள்கட்டமைப்பில் உள்ள சிக்கல்கள். +- [திஸ்கார்ட்](https://discord.supabase.com). இதற்கு சிறந்தது: உங்கள் விண்ணப்பங்களைப் பகிர்வது மற்றும் சமூகத்துடன் ஹேங்அவுட் செய்வது. + +## நிலை + +- [x] ஆல்ஃபா: நாங்கள் வாடிக்கையாளர்களின் மூடிய தொகுப்புடன் சுபாபேஸை சோதிக்கிறோம் +- [x] பொது ஆல்ஃபா: எவரும் [app.supabase.io](https://app.supabase.io) இல் பதிவு செய்யலாம், ஆனால் எங்களுக்கு எளிதாக செல்லுங்கள், ஒரு சில கின்க்ஸ் உள்ளன +- [x] பொது பீட்டா: பெரும்பாலான அல்லாத நிறுவன பயன்பாட்டு-வழக்குகளுக்கு போதுமான நிலையானது +- [ ] பொது: உற்பத்தி-தயார் + +நாங்கள் தற்போது பொது பீட்டாவில் இருக்கிறோம். முக்கிய துப்பிப்புகளைப் பற்றி அறிவிக்க இந்த ரெப்போவின் "வெளியீடுகளைப்" பாருங்கள். + +இந்த ரெப்போவைப் பாருங்கள் + +--- + +## இது எவ்வாறு செயல்படுகிறது + +சுபாபேஸ் என்பது திறந்த மூல கருவிகளின் கலவையாகும். நிறுவன-தர, திறந்த மூல தயாரிப்புகளைப் பயன்படுத்தி ஃபயர்பேஸ் இன் அம்சங்களை நாங்கள் உருவாக்குகிறோம். கருவிகள் மற்றும் சமூகங்கள் இருந்தால், ஒரு எம்ஐடி, அப்பாச்சி 2, அல்லது அதற்கு சமமான திறந்த உரிமத்துடன், நாங்கள் அந்த கருவியைப் பயன்படுத்துவோம் மற்றும் ஆதரிப்போம். கருவி இல்லை என்றால், நாமே அதை உருவாக்கி திறக்கிறோம். சுபாபேஸ் ஃபயர்பேஸின் 1-க்கு-1 மேப்பிங் அல்ல. திறந்த மூல கருவிகளைப் பயன்படுத்தி டெவலப்பர்களுக்கு ஃபயர்பேஸ் போன்ற டெவலப்பர் அனுபவத்தை வழங்குவதே எங்கள் நோக்கம். + +**கட்டிடக்கலை** + +சுபாபேஸ் ஒரு [ஹோஸ்ட் செய்யப்பட்ட தளம்](https://app.supabase.io). எதையும் நிறுவாமல் நீங்கள் பதிவுசெய்து Supabase ஐப் பயன்படுத்தத் தொடங்கலாம். +நீங்கள் [சுய ஹோஸ்ட்](https://supabase.com/docs/guides/self-hosting) மற்றும் [உள்நாட்டில் உருவாக்க](https://supabase.com/docs/guides/local-development) ஆகியவற்றையும் செய்யலாம். + +![கட்டிடக்கலை](https://supabase.com/docs/assets/images/supabase-architecture-9050a7317e9ec7efb7807f5194122e48.png) + +- [பூஸ்ட்ஜீஆர்இஎஸ்கியூஎல்](https://www.postgresql.org/) என்பது 30 ஆண்டுகளுக்கும் மேலான செயலில் உள்ள வளர்ச்சியுடன் கூடிய ஒரு பொருள்-தொடர்புடைய தரவுத்தள அமைப்பாகும், இது நம்பகத்தன்மை, அம்ச உறுதிப்பாடு மற்றும் செயல்திறனுக்கான வலுவான நற்பெயரைப் பெற்றுள்ளது. +- [நிகழ்நேரம்](https://github.com/supabase/realtime) என்பது ஒரு எலிக்சர் சேவையகமாகும், இது வெப்சாக்கெட்டுகளைப் பயன்படுத்தி பூஸ்ட்ஜீஆர்இஎஸ்கியூஎல் செருகல்கள், புதுப்பிப்புகள் மற்றும் நீக்குதல்களைக் கேட்க உங்களை அனுமதிக்கிறது. நிகழ்நேர கருத்துக் கணிப்புகள் தரவுத்தள மாற்றங்களுக்கான போஸ்ட்கிரஸின் உள்ளமைக்கப்பட்ட பிரதிபலிப்பு செயல்பாடு, ஜே.எஸ்.ஆனுக்கு மாற்றங்களை மாற்றுகிறது, பின்னர் அங்கீகரிக்கப்பட்ட வாடிக்கையாளர்களுக்கு வெப்சாக்கெட்டுகள் மூலம் ஜே.எஸ்.என் ஐ ஒளிபரப்புகிறது. +- [போஸ்ட்ஜீராஸ்ட்](http://postgrest.org/) என்பது உங்கள் பூஸ்ட்ஜீஆர்இஎஸ்கியூஎல் தரவுத்தளத்தை நேரடியாக ராஸ்ட் ஏபிஐ ஆக மாற்றும் ஒரு வலை சேவையகமாகும் +- [சேமிப்பகம்](https://github.com/supabase/storage-api) அனுமதிகளை நிர்வகிக்க போஸ்ட்கிரெஸைப் பயன்படுத்தி, S3 இல் சேமிக்கப்பட்ட கோப்புகளை நிர்வகிப்பதற்கான ராஸ்ட் இடைமுகத்தை வழங்குகிறது. +- [பூஸ்ட்ஜீஆர்இ-மெட்டா](https://github.com/supabase/postgres-meta) என்பது உங்கள் போஸ்ட்கிரேஸை நிர்வகிப்பதற்கான ஒரு ராஸ்ட் ஏபிஐ ஆகும், இது அட்டவணைகளைப் பெறவும், பாத்திரங்களைச் சேர்க்கவும், கேள்விகளை இயக்கவும் உங்களை அனுமதிக்கிறது. +- [கூட்ரூ](https://github.com/netlify/gotrue) என்பது பயனர்களை நிர்வகிப்பதற்கும் எஸ்டபிள்யூடி டோக்கன்கள் வழங்குவதற்கும் எஸ்டபிள்யூடி அடிப்படையிலான ஏபிஐ ஆகும். +- [காங்](https://github.com/Kong/kong) என்பது கிளவுட்-நேட்டிவ் ஏபிஐ நுழைவாயில் ஆகும். + +#### வாடிக்கையாளர் நூலகங்கள் + +கிளையன்ட் லைப்ரரிகளுக்கான எங்கள் அணுகுமுறை மட்டு. ஒவ்வொரு துணை நூலகமும் ஒரு வெளிப்புற அமைப்பிற்கான ஒரு முழுமையான செயலாக்கமாகும். ஏற்கனவே உள்ள கருவிகளை நாங்கள் ஆதரிக்கும் வழிகளில் இதுவும் ஒன்றாகும். + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
மொழிவாடிக்கையாளர் +அம்சம்-வாடிக்கையாளர் (சுபாபேஸ் கிளையண்டில் தொகுக்கப்பட்டுள்ளது)
சுபாபேஸ்போஸ்ட்ஜீராஸ்ட்கூட்ரூநிகழ்நேரம்சேமிப்பு
⚡️ அதிகாரி ⚡️
ஜாவாஸ்கிரிப்ட் (டைப்ஸ்கிரிப்ட்)சுபாபேஸ்-ஜேஎஸ்போஸ்ட்ஜீராஸ்ட்-ஜேஎஸ்கூட்ரூ-ஜேஎஸ்நிகழ்நேரம்-ஜேஎஸ்சேமிப்பு-ஜேஎஸ்
💚 பொதுச் சொத்துரிமை 💚
C#சுபாபேஸ்-ஸேசர்பபோஸ்ட்ஜீராஸ்ட்-ஸேசர்பகூட்ரூ-ஸேசர்பநிகழ்நேரம்-ஸேசர்பசேமிப்பு-ஸேசர்ப
டார்ட் (ஃப்ளடர்)சுபாபேஸ்-டார்ட்போஸ்ட்ஜீராஸ்ட்-டார்ட்கூட்ரூ-டார்ட்நிகழ்நேரம்-டார்ட்சேமிப்பு-டார்ட்
கோ-போஸ்ட்ஜீராஸ்ட்-கோ---
ஜாவா--கூட்ரூ-ஜாவா--
கோட்லின்-போஸ்ட்ஜீராஸ்ட்-கேடிகூட்ரூ-கேடி--
பித்தன்சுபாபேஸ்-பைபோஸ்ட்ஜீராஸ்ட்-பைகூட்ரூ-பைநிகழ்நேரம்-பை-
ராபிசுபாபேஸ்-ஆர்பிபோஸ்ட்ஜீராஸ்ட்-ஆர்பி---
ரோஸ்ட்-போஸ்ட்ஜீராஸ்ட்-ஆர்எஸ்---
சஃப்ட்சுபாபேஸ்-சஃப்ட்போஸ்ட்ஜீராஸ்ட்-சஃப்ட்கூட்ரூ-சஃப்ட்நிகழ்நேரம்-சஃப்ட்சேமிப்பு-சஃப்ட்
+ +## மொழிபெயர்ப்புகள் +- [மொழிபெயர்ப்புகளின் பட்டியல்](/i18n/languages.md) + + +## ஸ்பான்சர்கள் + +[![புதிய ஸ்பான்சர்கள்](https://user-images.githubusercontent.com/10214025/90518111-e74bbb00-e198-11ea-8f88-c9e3c1aa4b5b.png)](https://github.com/sponsors/supabase) diff --git a/i18n/languages.md b/i18n/languages.md index 3c98bb5228e..4efbb0e398a 100644 --- a/i18n/languages.md +++ b/i18n/languages.md @@ -32,6 +32,7 @@ - [Spanish / Español](/i18n/README.es.md) - [Simplified Chinese / 简体中文](/i18n/README.zh-cn.md) - [Swedish / Svenska](/i18n/README.sv.md) +- [Tamil / தமிழ்](/i18n/README.ta.md) - [Thai / ไทย](/i18n/README.th.md) - [Traditional Chinese / 繁体中文](/i18n/README.zh-tw.md) - [Turkish / Türkçe](/i18n/README.tr.md) From 80318f534085196c94dd602427ac5c6f2ee01c1c Mon Sep 17 00:00:00 2001 From: ndrohith09 Date: Tue, 12 Apr 2022 19:40:52 +0530 Subject: [PATCH 13/97] chore:Added i18n translations for Tamil --- i18n/README.ta.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/README.ta.md b/i18n/README.ta.md index 47aecf8b5a5..e38182f55d0 100644 --- a/i18n/README.ta.md +++ b/i18n/README.ta.md @@ -26,7 +26,7 @@ முழு ஆவணங்களுக்கு, பார்வையிடவும் [supabase.com/docs](https://supabase.com/docs) -எவ்வாறு பங்களிப்பது என்பதைப் பார்க்க, பார்வையிடவும் [Getting Started](./DEVELOPERS.md) +எவ்வாறு பங்களிப்பது என்பதைப் பார்க்க, பார்வையிடவும் [தொடங்குதல்](./DEVELOPERS.md) ## சமூகம் மற்றும் ஆதரவு From fb5c747d65b77a602b9c4f7963ec61da68121de4 Mon Sep 17 00:00:00 2001 From: Estee Tey Siew Wen Date: Wed, 13 Apr 2022 00:14:01 +0800 Subject: [PATCH 14/97] Update web/spec/supabase.yml Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com> --- web/spec/supabase.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index 1e295be78b1..0b83b45cc2c 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -407,7 +407,7 @@ pages: "update-types": "npx openapi-typescript \"${SUPABASE_URL}/rest/v1/?apikey=${SUPABASE_ANON_KEY}\" --version=2 --output types/database/index.ts" ``` - Then in your repo, create the file `.github/workflows/update-types.yml`. Add the following snippet into this file to define the action along with the environment variables. If there is a change to your definitions, this script will commit the change to your repo. ([Reference Article](https://blog.esteetey.dev/how-to-create-and-test-a-github-action-that-generates-types-from-supabase-database#heading-how-to-create-the-github-workflow)) + You can use GitHub actions to generate this file automatically. Create a file `.github/workflows/update-types.yml` and add the following snippet into this file to define the action along with the environment variables. If there is a change to your definitions, this script will commit the change to your repo. ```yml name: Update database types From 05d202f0a8d5fefdbfacf296577170dcef202eae Mon Sep 17 00:00:00 2001 From: lyqht Date: Wed, 13 Apr 2022 11:52:38 +0800 Subject: [PATCH 15/97] moved generating types with github action section out of supabase.yml --- web/docs/guides/database/generating-types.mdx | 71 +++++++++++++++++++ web/spec/supabase.yml | 61 +--------------- 2 files changed, 73 insertions(+), 59 deletions(-) create mode 100644 web/docs/guides/database/generating-types.mdx diff --git a/web/docs/guides/database/generating-types.mdx b/web/docs/guides/database/generating-types.mdx new file mode 100644 index 00000000000..56c3f55101d --- /dev/null +++ b/web/docs/guides/database/generating-types.mdx @@ -0,0 +1,71 @@ +--- +id: generating-types +title: "Generating Types with GitHub Action" +description: How to generate Supabase types +--- + +## Update types automatically with GitHub Actions + +One way to keep your type definitions in sync with your database is to set up a GitHub action that runs on a schedule. +Supabase offers a Swagger OpenAPI specification for the REST data endpoint which you can use to generate definitions. + +The following script can be run in your terminal to produce the file `types/database/index.ts`. +``` +npx openapi-typescript https://your-project.supabase.co/rest/v1/?apikey=your-anon-key --output types/database/index.ts +``` + +You can add this script to your `package.json` and run it using `npm run update-types`: + +``` +"update-types": "npx openapi-typescript \"${SUPABASE_URL}/rest/v1/?apikey=${SUPABASE_ANON_KEY}\" --version=2 --output types/database/index.ts" +``` + +You can use GitHub actions to generate this file automatically. Create a file `.github/workflows/update-types.yml` and add the following snippet into this file to define the action along with the environment variables. If there is a change to your definitions, this script will commit the change to your repo. + +```yml +name: Update database types + +on: + schedule: + # sets the action to run daily. You can modify this to run the action more or less frequently + - cron: '0 0 * * *' + +jobs: + update: + runs-on: ubuntu-latest + env: + SUPABASE_URL: ${{secrets.SUPABASE_URL}} + SUPABASE_ANON_KEY: ${{secrets.SUPABASE_URL}} + steps: + - uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + - uses: actions/setup-node@v2.1.5 + with: + node-version: 14 + - run: npm run update-types + - name: check for file changes + id: git_status + run: | + echo "::set-output name=status::$(git status -s)" + - name: Commit files + if: ${{contains(steps.git_status.outputs.status, ' ')}} + run: | + git add types/database/index.ts + git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -m "Update database types" -a + - name: Push changes + if: ${{contains(steps.git_status.outputs.status, ' ')}} + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} +``` + +Alternatively, you can use a community-supported GitHub action: [generate-supabase-db-types-github-action](https://github.com/lyqht/generate-supabase-db-types-github-action). + +## Resources + +- [How to create and test a GitHub Action that generates Supabase database types](https://blog.esteetey.dev/how-to-create-and-test-a-github-action-that-generates-types-from-supabase-database) \ No newline at end of file diff --git a/web/spec/supabase.yml b/web/spec/supabase.yml index 0b83b45cc2c..723226c4e78 100644 --- a/web/spec/supabase.yml +++ b/web/spec/supabase.yml @@ -390,69 +390,12 @@ pages: For more advance type-support, check out [`postgrest-js-tools`](https://github.com/mzalevski/postgrest-js-tools). - ### Update types automatically with GitHub Actions - One way to keep your type definitions in sync with your database is to set up a GitHub action that runs on a schedule. - Supabase offers a Swagger OpenAPI specification for the REST data endpoint which you can use to generate definitions. + For updating types automatically with GitHub actions, please refer to [this guide](/docs/guides/database/generating-types). - The following script can be run in your terminal to produce the file `types/database/index.ts`. - ``` - npx openapi-typescript https://your-project.supabase.co/rest/v1/?apikey=your-anon-key --output types/database/index.ts - ``` - - You can add this script to your `package.json` and run it using `npm run update-types`: - - ``` - "update-types": "npx openapi-typescript \"${SUPABASE_URL}/rest/v1/?apikey=${SUPABASE_ANON_KEY}\" --version=2 --output types/database/index.ts" - ``` - - You can use GitHub actions to generate this file automatically. Create a file `.github/workflows/update-types.yml` and add the following snippet into this file to define the action along with the environment variables. If there is a change to your definitions, this script will commit the change to your repo. - - ```yml - name: Update database types - - on: - schedule: - # sets the action to run daily. You can modify this to run the action more or less frequently - - cron: '0 0 * * *' - - jobs: - update: - runs-on: ubuntu-latest - env: - SUPABASE_URL: ${{secrets.SUPABASE_URL}} - SUPABASE_ANON_KEY: ${{secrets.SUPABASE_URL}} - steps: - - uses: actions/checkout@v2 - with: - persist-credentials: false - fetch-depth: 0 - - uses: actions/setup-node@v2.1.5 - with: - node-version: 14 - - run: npm run update-types - - name: check for file changes - id: git_status - run: | - echo "::set-output name=status::$(git status -s)" - - name: Commit files - if: ${{contains(steps.git_status.outputs.status, ' ')}} - run: | - git add types/database/index.ts - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git commit -m "Update database types" -a - - name: Push changes - if: ${{contains(steps.git_status.outputs.status, ' ')}} - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ github.ref }} - ``` - - Alternatively, you can use a community-supported GitHub action: [generate-supabase-db-types-github-action](https://github.com/lyqht/generate-supabase-db-types-github-action). + auth.signUp(): title: 'signUp()' $ref: '@supabase/gotrue-js.GoTrueClient.signUp' From 712b5ca764d8ab61508de4bdab450fb0d58e364b Mon Sep 17 00:00:00 2001 From: lyqht Date: Fri, 15 Apr 2022 14:14:13 +0800 Subject: [PATCH 16/97] add generating types doc to api section --- web/sidebars.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/sidebars.js b/web/sidebars.js index 889ed674fc5..c5e55c7df44 100755 --- a/web/sidebars.js +++ b/web/sidebars.js @@ -109,7 +109,7 @@ module.exports = { type: 'category', label: 'APIs', collapsed: false, - items: ['guides/api'], + items: ['guides/api', 'guides/database/generating-types'], }, { type: 'category', From aec38b69caa8fe8dde8d82990b442034aed16443 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Mon, 18 Apr 2022 16:02:18 +0700 Subject: [PATCH 17/97] chore: clean up ProjectBuildingState --- .../{to-be-cleaned => layouts/ProjectLayout}/BuildingState.tsx | 0 studio/components/layouts/ProjectLayout/TestConnection.tsx | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename studio/components/{to-be-cleaned => layouts/ProjectLayout}/BuildingState.tsx (100%) diff --git a/studio/components/to-be-cleaned/BuildingState.tsx b/studio/components/layouts/ProjectLayout/BuildingState.tsx similarity index 100% rename from studio/components/to-be-cleaned/BuildingState.tsx rename to studio/components/layouts/ProjectLayout/BuildingState.tsx diff --git a/studio/components/layouts/ProjectLayout/TestConnection.tsx b/studio/components/layouts/ProjectLayout/TestConnection.tsx index 867d41ed7c6..7543fd5388e 100644 --- a/studio/components/layouts/ProjectLayout/TestConnection.tsx +++ b/studio/components/layouts/ProjectLayout/TestConnection.tsx @@ -2,8 +2,8 @@ import { useRouter } from 'next/router' import { observer } from 'mobx-react-lite' import { FC, ReactNode } from 'react' import { Project } from 'types' -import BuildingState from 'components/to-be-cleaned/BuildingState' import { PROJECT_STATUS } from 'lib/constants' +import BuildingState from './BuildingState' interface Props { project: Project From c915520784a6ce3f1561ebd1d6eaa5026539deb4 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Mon, 18 Apr 2022 16:32:27 +0700 Subject: [PATCH 18/97] chore: clean up withAuth --- studio/hooks/misc/withAuth.tsx | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/studio/hooks/misc/withAuth.tsx b/studio/hooks/misc/withAuth.tsx index 1ebbe3ef816..11d4b57e5ee 100644 --- a/studio/hooks/misc/withAuth.tsx +++ b/studio/hooks/misc/withAuth.tsx @@ -1,10 +1,8 @@ import { useProfile, useStore } from 'hooks' -import { ComponentType, useEffect, useState } from 'react' -import { flatten, isUndefined } from 'lodash' +import { ComponentType, useEffect } from 'react' import { NextRouter, useRouter } from 'next/router' import { IS_PLATFORM } from 'lib/constants' import Connecting from 'components/ui/Loading' -import { Project } from 'types' const PLATFORM_ONLY_PAGES = ['storage', 'reports', 'settings'] @@ -18,7 +16,6 @@ export function withAuth( return (props: any) => { const router = useRouter() const rootStore = useStore() - const [isConnecting, setConnecting] = useState(true) const { ref, slug } = router.query const { app, ui } = rootStore @@ -35,6 +32,7 @@ export function withAuth( const isRedirecting = isAccessingBlockedPage || checkRedirectTo(isLoading, router, profile, redirectTo, redirectIfFound) + const isConnecting = !isLoading && !isRedirecting && router.isReady ? false : true useEffect(() => { // this should run before redirecting @@ -66,12 +64,6 @@ export function withAuth( } }, [isLoading, router.isReady, ref, slug]) - useEffect(() => { - if (!isLoading && !isRedirecting && router.isReady) { - setConnecting(false) - } - }, [isLoading, isRedirecting, router.isReady]) - if (isConnecting) return return @@ -79,7 +71,7 @@ export function withAuth( } function defaultRedirectTo(ref: string | string[] | undefined) { - return IS_PLATFORM ? '/' : !isUndefined(ref) ? `/project/${ref}` : '/' + return IS_PLATFORM ? '/' : ref !== undefined ? `/project/${ref}` : '/' } function checkRedirectTo( From edc536f9cbea9d23d094091e26110971ff09be74 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Mon, 18 Apr 2022 17:06:31 +0700 Subject: [PATCH 19/97] fix: update store after project creation --- studio/pages/new/[slug].tsx | 5 ++--- studio/stores/app/AppStore.ts | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/studio/pages/new/[slug].tsx b/studio/pages/new/[slug].tsx index 3fe60a07230..b8d9107377c 100644 --- a/studio/pages/new/[slug].tsx +++ b/studio/pages/new/[slug].tsx @@ -188,9 +188,8 @@ export const Wizard = observer(() => { message: `Failed to create new project: ${response.error.message}`, }) } else { - // Use redirect to reload store data properly - // after creating a new project - window.location.replace(`/project/${response.ref}/building`) + app.onProjectCreated(response) + router.push(`/project/${response.ref}/building`) } } diff --git a/studio/stores/app/AppStore.ts b/studio/stores/app/AppStore.ts index 63ff300c127..4e0118c4225 100644 --- a/studio/stores/app/AppStore.ts +++ b/studio/stores/app/AppStore.ts @@ -12,6 +12,7 @@ export interface IAppStore { projects: IProjectStore organizations: OrganizationStore database: IDatabaseStore + onProjectCreated: (project: any) => void onProjectUpdated: (project: any) => void onProjectDeleted: (project: any) => void onProjectConnectionStringUpdated: (projectId: number, value: string) => void @@ -39,6 +40,25 @@ export default class AppStore implements IAppStore { this.database = new DatabaseStore(rootStore, `${this.baseUrl}/database`, headers) } + onProjectCreated(project: any) { + if (project && project.id) { + const temp: Project = { + id: project.id, + ref: project.ref, + name: project.name, + status: project.status, + organization_id: project.organization_id, + cloud_provider: project.cloud_provider, + region: project.region, + inserted_at: project.inserted_at, + subscription_id: project.subscription_id, + kpsVersion: undefined, + connectionString: undefined, + } + this.projects.data[project.id] = temp + } + } + onProjectUpdated(project: any) { if (project && project.id) { const clone = cloneDeep(this.projects.data[project.id]) From 1254c60b52c7bd64cf5afe69b10734662a80adf9 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Mon, 18 Apr 2022 17:15:43 +0700 Subject: [PATCH 20/97] Revert "chore: clean up withAuth" This reverts commit c915520784a6ce3f1561ebd1d6eaa5026539deb4. --- studio/hooks/misc/withAuth.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/studio/hooks/misc/withAuth.tsx b/studio/hooks/misc/withAuth.tsx index 11d4b57e5ee..1ebbe3ef816 100644 --- a/studio/hooks/misc/withAuth.tsx +++ b/studio/hooks/misc/withAuth.tsx @@ -1,8 +1,10 @@ import { useProfile, useStore } from 'hooks' -import { ComponentType, useEffect } from 'react' +import { ComponentType, useEffect, useState } from 'react' +import { flatten, isUndefined } from 'lodash' import { NextRouter, useRouter } from 'next/router' import { IS_PLATFORM } from 'lib/constants' import Connecting from 'components/ui/Loading' +import { Project } from 'types' const PLATFORM_ONLY_PAGES = ['storage', 'reports', 'settings'] @@ -16,6 +18,7 @@ export function withAuth( return (props: any) => { const router = useRouter() const rootStore = useStore() + const [isConnecting, setConnecting] = useState(true) const { ref, slug } = router.query const { app, ui } = rootStore @@ -32,7 +35,6 @@ export function withAuth( const isRedirecting = isAccessingBlockedPage || checkRedirectTo(isLoading, router, profile, redirectTo, redirectIfFound) - const isConnecting = !isLoading && !isRedirecting && router.isReady ? false : true useEffect(() => { // this should run before redirecting @@ -64,6 +66,12 @@ export function withAuth( } }, [isLoading, router.isReady, ref, slug]) + useEffect(() => { + if (!isLoading && !isRedirecting && router.isReady) { + setConnecting(false) + } + }, [isLoading, isRedirecting, router.isReady]) + if (isConnecting) return return @@ -71,7 +79,7 @@ export function withAuth( } function defaultRedirectTo(ref: string | string[] | undefined) { - return IS_PLATFORM ? '/' : ref !== undefined ? `/project/${ref}` : '/' + return IS_PLATFORM ? '/' : !isUndefined(ref) ? `/project/${ref}` : '/' } function checkRedirectTo( From a1e3a2b7b16d42291cc3c9f4a032f78b79c90603 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Mon, 18 Apr 2022 17:16:55 +0700 Subject: [PATCH 21/97] chore: clean up --- studio/hooks/misc/withAuth.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/studio/hooks/misc/withAuth.tsx b/studio/hooks/misc/withAuth.tsx index 1ebbe3ef816..2c6e1b84f74 100644 --- a/studio/hooks/misc/withAuth.tsx +++ b/studio/hooks/misc/withAuth.tsx @@ -1,10 +1,8 @@ import { useProfile, useStore } from 'hooks' import { ComponentType, useEffect, useState } from 'react' -import { flatten, isUndefined } from 'lodash' import { NextRouter, useRouter } from 'next/router' import { IS_PLATFORM } from 'lib/constants' import Connecting from 'components/ui/Loading' -import { Project } from 'types' const PLATFORM_ONLY_PAGES = ['storage', 'reports', 'settings'] @@ -79,7 +77,7 @@ export function withAuth( } function defaultRedirectTo(ref: string | string[] | undefined) { - return IS_PLATFORM ? '/' : !isUndefined(ref) ? `/project/${ref}` : '/' + return IS_PLATFORM ? '/' : ref !== undefined ? `/project/${ref}` : '/' } function checkRedirectTo( From dcbbe583527aa58322934c4fa8e65cc296768d84 Mon Sep 17 00:00:00 2001 From: egor-romanov <58992960+egor-romanov@users.noreply.github.com> Date: Mon, 18 Apr 2022 19:20:44 +0400 Subject: [PATCH 22/97] fix: path to test results dir --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ef7a2ecb2e0..56122b17af5 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -67,7 +67,7 @@ jobs: if: always() with: github_repo: test-reports - allure_results: allure-results + allure_results: tests/allure-results allure_history: allure-history subfolder: supabase-integration keep_reports: 50 From 9aa62d767ea47ebec8054a46a1bfae24fbf5da8a Mon Sep 17 00:00:00 2001 From: Roj Date: Mon, 18 Apr 2022 19:57:18 +0300 Subject: [PATCH 23/97] Apply suggestions from code review Co-authored-by: Copple <10214025+kiwicopple@users.noreply.github.com> --- web/docs/guides/database/arrays.mdx | 6 +++--- web/docs/guides/database/extensions/plv8.mdx | 10 +++++----- web/docs/guides/database/sql-to-api.mdx | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/web/docs/guides/database/arrays.mdx b/web/docs/guides/database/arrays.mdx index 4d3341a5021..2d71ec4c437 100644 --- a/web/docs/guides/database/arrays.mdx +++ b/web/docs/guides/database/arrays.mdx @@ -8,7 +8,7 @@ import Tabs from '@theme/Tabs' import TabItem from '@theme/TabItem' PostgreSQL supports flexible [array types](https://www.postgresql.org/docs/12/arrays.html). -These arrays are also supported in the Supabase dashboard and in the API. +These arrays are also supported in the Supabase dashboard and in the JavaScript API. ## Steps @@ -79,7 +79,7 @@ INSERT INTO arraytest (id, textarray) VALUES (1, ARRAY['Harry', 'Larry', 'Moe'])
-To insert a record from the client: +To insert a record from the JavaScript client: ```js const { data, error } = await supabase @@ -131,7 +131,7 @@ Your first array data! ### Query Array Data -To query an array, PostgreSQL uses 1-based arrays, so be careful, since you're probably used to 0-based arrays in . +To query an array, PostgreSQL uses 1-based arrays, so be careful, since you're probably used to 0-based arrays in JavaScript. Date: Mon, 18 Apr 2022 15:57:17 -0400 Subject: [PATCH 24/97] docs: add workaround to make Prisma compatible with Realtime --- web/docs/guides/integrations/prisma.mdx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/web/docs/guides/integrations/prisma.mdx b/web/docs/guides/integrations/prisma.mdx index 5cfc4546964..a064b0765fa 100644 --- a/web/docs/guides/integrations/prisma.mdx +++ b/web/docs/guides/integrations/prisma.mdx @@ -117,6 +117,27 @@ This will create a `prisma/migrations` folder inside your `prisma` directory and > ![tables created in the UI](/img/guides/integrations/prisma/7y4qq4wwvfrheti6r09u.png) > That’s it! You have now successfully connected a Prisma project to a PostgreSQL database hosted on Supabase and ran your first migration. +### Confirming Realtime Functionality + +There is an existing issue where Prisma will create Enum Types wrapped in double quotation marks in PostgreSQL. This is not compatible with Realtime-enabled database tables whose columns rely on those Enum Types. We are working on a fix but the workaround is to alter and rename the Enum Types. You can use the following query to find all Types with double quotation marks in the `public` schema: + +```sql +select distinct(a.atttypid::regtype) + from pg_class as c + join pg_namespace as n + on c.relnamespace = n.oid + join pg_attribute as a + on c.oid = a.attrelid + where nspname = 'public' + and a.atttypid::regtype::text like '"%"'; +``` + +Then use the following example query to strip the double quotation marks: + +```sql +alter type "Incompatible" rename to compatible; +``` + ## Connection pooling with Supabase If you’re working in a serverless environment (for example Node.js functions hosted on AWS Lambda, Vercel or Netlify Functions), you need to set up [connection pooling](https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#serverless-environments-faas) using a tool like [PgBouncer](https://www.pgbouncer.org/). That’s because every function invocation may result in a [new connection to the database](https://www.prisma.io/docs/guides/performance-and-optimization/connection-management#the-serverless-challenge). Supabase [support connection management using PgBouncer](https://supabase.io/blog/2021/04/02/supabase-pgbouncer#what-is-connection-pooling) and are enabled by default. From ce69b77de8ab52d8987fc28af872f039e127e5b2 Mon Sep 17 00:00:00 2001 From: Nokome Bentley Date: Tue, 19 Apr 2022 15:39:57 +1200 Subject: [PATCH 25/97] Update storage.mdx --- web/docs/guides/storage.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/docs/guides/storage.mdx b/web/docs/guides/storage.mdx index d17525e76e8..dc84ba49558 100644 --- a/web/docs/guides/storage.mdx +++ b/web/docs/guides/storage.mdx @@ -313,7 +313,7 @@ helper method returns the full public URL for an asset. This calls the `/object/
Advanced: reverse proxy -The URLs returned are proxied through the API Proxy. They are suffixed by /storage/v1. +The URLs returned are proxied through the API Proxy. They are prefixed by /storage/v1. For example, on the hosted Platform they will be From 5622d0e74b46bda75ec086d7c3fe4c94da033dd2 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Tue, 19 Apr 2022 11:07:04 +0700 Subject: [PATCH 26/97] chore: clean up --- studio/components/layouts/ProjectLayout/ProjectLayout.tsx | 5 ++--- studio/pages/project/[ref]/index.tsx | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx b/studio/components/layouts/ProjectLayout/ProjectLayout.tsx index be75878a99f..38de7719bf5 100644 --- a/studio/components/layouts/ProjectLayout/ProjectLayout.tsx +++ b/studio/components/layouts/ProjectLayout/ProjectLayout.tsx @@ -76,15 +76,14 @@ interface ContentWrapperProps { const ContentWrapper: FC = observer(({ isLoading, children }) => { const { ui } = useStore() const router = useRouter() - const project = ui.selectedProject const requiresDbConnection: boolean = router.pathname !== '/project/[ref]/settings/general' return ( <> - {isLoading || project === undefined ? ( + {isLoading || ui.selectedProject === undefined ? ( ) : requiresDbConnection ? ( - +
{children}
) : ( diff --git a/studio/pages/project/[ref]/index.tsx b/studio/pages/project/[ref]/index.tsx index 36d861d5660..4cb7affddc4 100644 --- a/studio/pages/project/[ref]/index.tsx +++ b/studio/pages/project/[ref]/index.tsx @@ -5,7 +5,7 @@ import { useStore, withAuth } from 'hooks' import { ExampleProject, ClientLibrary } from 'components/interfaces/Home' import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants' import { IS_PLATFORM } from 'lib/constants' -import BaseLayout from 'components/layouts' +import ProjectLayout from 'components/layouts' import ProjectUsageSection from 'components/interfaces/Home/ProjectUsageSection' const Home: NextPage = () => { @@ -18,7 +18,7 @@ const Home: NextPage = () => { : 'Welcome to your project' return ( - +

{projectName}

@@ -45,7 +45,7 @@ const Home: NextPage = () => {
- + ) } From 1d47fc5e769fc44c4dac1467a5dd9cdee816ea0e Mon Sep 17 00:00:00 2001 From: phamhieu Date: Tue, 19 Apr 2022 11:40:59 +0700 Subject: [PATCH 27/97] refactor: DisplayConfigSettings and DisplayApiSettings --- .../Home/NewProjectPanel/NewProjectPanel.tsx | 7 +- .../layouts/ProjectLayout/BuildingState.tsx | 5 +- .../to-be-cleaned/DisplayProjectSettings.tsx | 230 ------------------ studio/components/to-be-cleaned/Panel.tsx | 2 +- .../ui/ProjectSettings/DisplayApiSettings.tsx | 108 ++++++++ .../ProjectSettings/DisplayConfigSettings.tsx | 92 +++++++ .../ProjectSettings/SettingsLoadingState.tsx | 24 ++ .../SettingsLoadingState.types.tsx | 4 + .../ui/ProjectSettings/index.constants.tsx | 1 + .../components/ui/ProjectSettings/index.tsx | 4 + studio/pages/project/[ref]/settings/api.tsx | 2 +- 11 files changed, 237 insertions(+), 242 deletions(-) delete mode 100644 studio/components/to-be-cleaned/DisplayProjectSettings.tsx create mode 100644 studio/components/ui/ProjectSettings/DisplayApiSettings.tsx create mode 100644 studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx create mode 100644 studio/components/ui/ProjectSettings/SettingsLoadingState.tsx create mode 100644 studio/components/ui/ProjectSettings/SettingsLoadingState.types.tsx create mode 100644 studio/components/ui/ProjectSettings/index.constants.tsx create mode 100644 studio/components/ui/ProjectSettings/index.tsx diff --git a/studio/components/interfaces/Home/NewProjectPanel/NewProjectPanel.tsx b/studio/components/interfaces/Home/NewProjectPanel/NewProjectPanel.tsx index fba67f8d2b9..2bae2c671a6 100644 --- a/studio/components/interfaces/Home/NewProjectPanel/NewProjectPanel.tsx +++ b/studio/components/interfaces/Home/NewProjectPanel/NewProjectPanel.tsx @@ -1,11 +1,6 @@ +import { DisplayApiSettings, DisplayConfigSettings } from 'components/ui/ProjectSettings' import { FC } from 'react' -import { Typography } from '@supabase/ui' - import GetStartedPanel from './GetStartedPanel' -import { - DisplayApiSettings, - DisplayConfigSettings, -} from 'components/to-be-cleaned/DisplayProjectSettings' interface Props {} diff --git a/studio/components/layouts/ProjectLayout/BuildingState.tsx b/studio/components/layouts/ProjectLayout/BuildingState.tsx index e23caf7c2af..19fe8106372 100644 --- a/studio/components/layouts/ProjectLayout/BuildingState.tsx +++ b/studio/components/layouts/ProjectLayout/BuildingState.tsx @@ -2,10 +2,6 @@ import Link from 'next/link' import { FC, useEffect, useRef } from 'react' import { observer } from 'mobx-react-lite' import { Badge, IconArrowRight, IconLoader, Button } from '@supabase/ui' -import { - DisplayApiSettings, - DisplayConfigSettings, -} from 'components/to-be-cleaned/DisplayProjectSettings' import ExampleProject from 'components/interfaces/Home/ExampleProject' import ClientLibrary from 'components/interfaces/Home/ClientLibrary' import { CLIENT_LIBRARIES, EXAMPLE_PROJECTS } from 'components/interfaces/Home/Home.constants' @@ -14,6 +10,7 @@ import { API_URL, PROJECT_STATUS } from 'lib/constants' import { useStore } from 'hooks' import { get } from 'lib/common/fetch' import { Project } from 'types' +import { DisplayApiSettings, DisplayConfigSettings } from 'components/ui/ProjectSettings' type ProjectBuildingState = { project: Project } const ProjectBuildingState: FC = ({ project }) => { diff --git a/studio/components/to-be-cleaned/DisplayProjectSettings.tsx b/studio/components/to-be-cleaned/DisplayProjectSettings.tsx deleted file mode 100644 index a120dc92352..00000000000 --- a/studio/components/to-be-cleaned/DisplayProjectSettings.tsx +++ /dev/null @@ -1,230 +0,0 @@ -import useSWR from 'swr' -import { FC } from 'react' -import { useRouter } from 'next/router' -import { get } from 'lib/common/fetch' -import { Badge, IconAlertCircle, Input, Loading, Typography } from '@supabase/ui' -import { JwtSecretUpdateStatus, ProjectEvents } from '@supabase/shared-types/out/events' - -import { useJwtSecretUpdateStatus } from 'hooks' -import { API_URL } from 'lib/constants' -import Panel from './Panel' - -const { Text, Title } = Typography -const API_SERVICE_ID = 1 - -export const DisplayApiSettings = () => { - const router = useRouter() - const { ref } = router.query - - const { data, error }: any = useSWR(`${API_URL}/props/project/${ref}/settings`, get) - const { - isError: isJwtSecretUpdateStatusError, - isLoading: isJwtSecretUpdateStatusLoading, - jwtSecretUpdateStatus, - }: any = useJwtSecretUpdateStatus(ref) - - const isNotUpdatingJwtSecret = - jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated - - if (!data || isJwtSecretUpdateStatusLoading) - return ( - - - {error || isJwtSecretUpdateStatusError ? ( -
- - - - Failed to fetch API keys -
- ) : ( -
- {/* @ts-ignore */} - -
- )} -
-
- ) - - // Get the API service - const apiService = (data?.services ?? []).find((x: any) => x.app.id == API_SERVICE_ID) - const apiKeys = apiService?.service_api_keys ?? [] - - return ( - - {!data || isJwtSecretUpdateStatusLoading ? ( - // @ts-ignore - - ) : ( - apiKeys.map((x: any, i: number) => ( - = 1 && - 'border-t border-panel-border-interior-light dark:border-panel-border-interior-dark' - } - > - - {x.tags?.split(',').map((x: any, i: number) => ( - - {x} - - ))} - {x.tags === 'service_role' && ( - <> - {'secret'} - - )} - {x.tags === 'anon' && {'public'}} - - } - readOnly - copy={isNotUpdatingJwtSecret} - className="input-mono" - disabled - reveal={x.tags !== 'anon' && isNotUpdatingJwtSecret} - value={ - jwtSecretUpdateStatus === JwtSecretUpdateStatus.Failed - ? 'JWT secret update failed, new API key may have issues' - : jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updating - ? 'Updating JWT secret...' - : x.api_key - } - onChange={() => {}} - descriptionText={ - x.tags === 'service_role' - ? 'This key has the ability to bypass Row Level Security. Never share it publicly.' - : 'This key is safe to use in a browser if you have enabled Row Level Security for your tables and configured policies.' - } - /> - - )) - )} - - ) -} - -export const DisplayConfigSettings = () => { - const router = useRouter() - const { ref } = router.query - - const { data, error }: any = useSWR(`${API_URL}/props/project/${ref}/settings`, get) - const { - isError: isJwtSecretUpdateStatusError, - isLoading: isJwtSecretUpdateStatusLoading, - jwtSecretUpdateStatus, - }: any = useJwtSecretUpdateStatus(ref) - - const isNotUpdatingJwtSecret = - jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated - - if (!data || isJwtSecretUpdateStatusLoading) - return ( - - - {error || isJwtSecretUpdateStatusError ? ( -
- - - - - Failed to fetch project configuration - -
- ) : ( -
- {/* @ts-ignore */} - -
- )} -
-
- ) - - // Get the API service - const jwtSecret = data?.project.jwt_secret ?? '' - const apiService = (data?.services ?? []).find((x: any) => x.app.id == API_SERVICE_ID) - const apiConfig = apiService.app_config - - return ( -
- - Project Configuration - - } - > - - - - - - - -
- ) -} - -const ApiContentWrapper: FC = ({ children }) => { - return ( - -
Project API keys
-

- Your API is secured behind an API gateway which requires an API Key for every request. -
- You can use the keys below to use Supabase client libraries. -

- - } - > - {children} -
- ) -} - -const ConfigContentWrapper: FC = ({ children }) => { - return ( - -
Project Configuration
- - } - > - {children} -
- ) -} diff --git a/studio/components/to-be-cleaned/Panel.tsx b/studio/components/to-be-cleaned/Panel.tsx index 59ffd62aa81..9ee51559ef7 100644 --- a/studio/components/to-be-cleaned/Panel.tsx +++ b/studio/components/to-be-cleaned/Panel.tsx @@ -22,7 +22,7 @@ function Panel(props: any) { className={` border border-panel-border-light dark:border-panel-border-dark shadow-sm overflow-hidden - rounded rounded-md ${props.noMargin ? '' : 'mb-8'} ${props.className}`} + rounded-md ${props.noMargin ? '' : 'mb-8'} ${props.className}`} > {props.title && (
diff --git a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx new file mode 100644 index 00000000000..1ff735751ed --- /dev/null +++ b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx @@ -0,0 +1,108 @@ +import { FC } from 'react' +import { useRouter } from 'next/router' +import { Input } from '@supabase/ui' +import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events' +import { useJwtSecretUpdateStatus, useProjectSettings } from 'hooks' +import { SettingsLoadingState } from './SettingsLoadingState' +import { DEFAULT_API_SERVICE_ID } from './index.constants' +import Panel from 'components/to-be-cleaned/Panel' + +const DisplayApiSettings = () => { + const router = useRouter() + const { ref } = router.query + const { + services, + isLoading: isProjectSettingsLoading, + isError: isProjectSettingsError, + } = useProjectSettings(ref as string | undefined) + const { + isError: isJwtSecretUpdateStatusError, + isLoading: isJwtSecretUpdateStatusLoading, + jwtSecretUpdateStatus, + }: any = useJwtSecretUpdateStatus(ref) + + const isNotUpdatingJwtSecret = + jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated + // Get the API service + const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) + const apiKeys = apiService?.service_api_keys ?? [] + + return ( + + {!isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? ( + + ) : ( + apiKeys.map((x: any, i: number) => ( + = 1 && + 'border-t border-panel-border-interior-light dark:border-panel-border-interior-dark' + } + > + + {x.tags?.split(',').map((x: any, i: number) => ( + + {x} + + ))} + {x.tags === 'service_role' && ( + <> + {'secret'} + + )} + {x.tags === 'anon' && {'public'}} + + } + readOnly + copy={isNotUpdatingJwtSecret} + className="input-mono" + disabled + reveal={x.tags !== 'anon' && isNotUpdatingJwtSecret} + value={ + jwtSecretUpdateStatus === JwtSecretUpdateStatus.Failed + ? 'JWT secret update failed, new API key may have issues' + : jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updating + ? 'Updating JWT secret...' + : x.api_key + } + onChange={() => {}} + descriptionText={ + x.tags === 'service_role' + ? 'This key has the ability to bypass Row Level Security. Never share it publicly.' + : 'This key is safe to use in a browser if you have enabled Row Level Security for your tables and configured policies.' + } + /> + + )) + )} + + ) +} +export default DisplayApiSettings + +const ApiContentWrapper: FC = ({ children }) => { + return ( + +
Project API keys
+

+ Your API is secured behind an API gateway which requires an API Key for every request. +
+ You can use the keys below to use Supabase client libraries. +

+
+ } + > + {children} + + ) +} diff --git a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx new file mode 100644 index 00000000000..8ef447a0b79 --- /dev/null +++ b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx @@ -0,0 +1,92 @@ +import { FC } from 'react' +import { useRouter } from 'next/router' +import { Input } from '@supabase/ui' +import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events' +import { useJwtSecretUpdateStatus, useProjectSettings } from 'hooks' +import { SettingsLoadingState } from './SettingsLoadingState' +import { DEFAULT_API_SERVICE_ID } from './index.constants' +import Panel from 'components/to-be-cleaned/Panel' + +const DisplayConfigSettings = () => { + const router = useRouter() + const { ref } = router.query + const { + project, + services, + isLoading: isProjectSettingsLoading, + isError: isProjectSettingsError, + } = useProjectSettings(ref as string | undefined) + const { + isError: isJwtSecretUpdateStatusError, + isLoading: isJwtSecretUpdateStatusLoading, + jwtSecretUpdateStatus, + }: any = useJwtSecretUpdateStatus(ref) + + const isNotUpdatingJwtSecret = + jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated + // Get the API service + const jwtSecret = project?.jwt_secret ?? '' + const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) + const apiConfig = apiService?.app_config + + return ( + + {isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? ( + + ) : ( + <> + + + + + + + + )} + + ) +} + +export default DisplayConfigSettings + +const ConfigContentWrapper: FC = ({ children }) => { + return ( + +
Project Configuration
+ + } + > + {children} +
+ ) +} diff --git a/studio/components/ui/ProjectSettings/SettingsLoadingState.tsx b/studio/components/ui/ProjectSettings/SettingsLoadingState.tsx new file mode 100644 index 00000000000..1c8dd232659 --- /dev/null +++ b/studio/components/ui/ProjectSettings/SettingsLoadingState.tsx @@ -0,0 +1,24 @@ +import { FC } from 'react' +import { IconAlertCircle, Loading, Typography } from '@supabase/ui' +import { SettingsLoadingStateProps } from './SettingsLoadingState.types' +import Panel from 'components/to-be-cleaned/Panel' + +export const SettingsLoadingState: FC = ({ isError, errorMessage }) => { + return ( + + {isError ? ( +
+ + + + {errorMessage} +
+ ) : ( +
+ {/* @ts-ignore */} + +
+ )} +
+ ) +} diff --git a/studio/components/ui/ProjectSettings/SettingsLoadingState.types.tsx b/studio/components/ui/ProjectSettings/SettingsLoadingState.types.tsx new file mode 100644 index 00000000000..b3c9248594d --- /dev/null +++ b/studio/components/ui/ProjectSettings/SettingsLoadingState.types.tsx @@ -0,0 +1,4 @@ +export interface SettingsLoadingStateProps { + isError: boolean + errorMessage: string +} diff --git a/studio/components/ui/ProjectSettings/index.constants.tsx b/studio/components/ui/ProjectSettings/index.constants.tsx new file mode 100644 index 00000000000..fdd902e2733 --- /dev/null +++ b/studio/components/ui/ProjectSettings/index.constants.tsx @@ -0,0 +1 @@ +export const DEFAULT_API_SERVICE_ID = 1 diff --git a/studio/components/ui/ProjectSettings/index.tsx b/studio/components/ui/ProjectSettings/index.tsx new file mode 100644 index 00000000000..37e2dcc5b8b --- /dev/null +++ b/studio/components/ui/ProjectSettings/index.tsx @@ -0,0 +1,4 @@ +import DisplayApiSettings from './DisplayApiSettings' +import DisplayConfigSettings from './DisplayConfigSettings' + +export { DisplayApiSettings, DisplayConfigSettings } diff --git a/studio/pages/project/[ref]/settings/api.tsx b/studio/pages/project/[ref]/settings/api.tsx index dfe96adce81..4e83547e1ef 100644 --- a/studio/pages/project/[ref]/settings/api.tsx +++ b/studio/pages/project/[ref]/settings/api.tsx @@ -45,7 +45,7 @@ import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog' import Panel from 'components/to-be-cleaned/Panel' import MultiSelectUI from 'components/to-be-cleaned/MultiSelect' import SchemaFormPanel from 'components/to-be-cleaned/forms/SchemaFormPanel' -import { DisplayApiSettings } from 'components/to-be-cleaned/DisplayProjectSettings' +import { DisplayApiSettings } from 'components/ui/ProjectSettings' const JWT_SECRET_UPDATE_ERROR_MESSAGES = { [JwtSecretUpdateError.APIServicesConfigurationUpdateFailed]: From 7c1136307aef0397ff746a0fdbd592855c1ca579 Mon Sep 17 00:00:00 2001 From: phamhieu Date: Tue, 19 Apr 2022 11:44:59 +0700 Subject: [PATCH 28/97] fix: apiConfig undefined --- studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx index 8ef447a0b79..aea68e910dc 100644 --- a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx +++ b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx @@ -27,7 +27,7 @@ const DisplayConfigSettings = () => { // Get the API service const jwtSecret = project?.jwt_secret ?? '' const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) - const apiConfig = apiService?.app_config + const apiConfig = apiService?.app_config ?? {} return ( From f723d165891bc91791b77db78904f1885e3ddaff Mon Sep 17 00:00:00 2001 From: phamhieu Date: Tue, 19 Apr 2022 11:46:10 +0700 Subject: [PATCH 29/97] fix: typo --- studio/components/ui/ProjectSettings/DisplayApiSettings.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx index 1ff735751ed..8f59b791745 100644 --- a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx +++ b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx @@ -29,7 +29,7 @@ const DisplayApiSettings = () => { return ( - {!isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? ( + {isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? ( Date: Tue, 19 Apr 2022 12:19:52 +0700 Subject: [PATCH 30/97] fix: useProjectSettings refreshInterval to wait for service_api_keys data --- studio/hooks/queries/useProjectSettings.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/studio/hooks/queries/useProjectSettings.ts b/studio/hooks/queries/useProjectSettings.ts index 833bb17f489..e97eba1a0c9 100644 --- a/studio/hooks/queries/useProjectSettings.ts +++ b/studio/hooks/queries/useProjectSettings.ts @@ -4,7 +4,18 @@ import useSWR from 'swr' export function useProjectSettings(ref?: string) { const url = `${API_URL}/props/project/${ref}/settings` - const { data, error } = useSWR(ref ? url : null, get) + const { data, error } = useSWR(ref ? url : null, get, { + /** + * on project creation, the service_api_keys will be populated with a delay + * check for data.services.service_api_keys, return a valid refresh interval if it's empty + */ + refreshInterval: function (data: any) { + const apiService = (data?.services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) + const apiKeys = apiService?.service_api_keys ?? [] + const interval = apiKeys.length === 0 ? 2000 : 0 + return interval + }, + }) const anyError = data?.error || error return { @@ -15,3 +26,5 @@ export function useProjectSettings(ref?: string) { isError: !!anyError, } } + +const DEFAULT_API_SERVICE_ID = 1 From 7b4e1d2de4554868b181c17e8f2361266b1cff9e Mon Sep 17 00:00:00 2001 From: phamhieu Date: Tue, 19 Apr 2022 12:23:57 +0700 Subject: [PATCH 31/97] fix: show loading state when apikeys is empty --- studio/components/ui/ProjectSettings/DisplayApiSettings.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx index 8f59b791745..249b9f3c34d 100644 --- a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx +++ b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx @@ -26,10 +26,12 @@ const DisplayApiSettings = () => { // Get the API service const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) const apiKeys = apiService?.service_api_keys ?? [] + // api keys should not be empty. However it can be populated with a delay on project creation + const isApikeysEmpty = apiKeys.length === 0 return ( - {isProjectSettingsLoading || isJwtSecretUpdateStatusLoading ? ( + {isProjectSettingsLoading || isJwtSecretUpdateStatusLoading || isApikeysEmpty ? ( Date: Tue, 19 Apr 2022 12:29:43 +0700 Subject: [PATCH 32/97] fix: create DEFAULT_PROJECT_API_SERVICE_ID constant --- .../components/ui/ProjectSettings/DisplayApiSettings.tsx | 4 ++-- .../ui/ProjectSettings/DisplayConfigSettings.tsx | 4 ++-- studio/components/ui/ProjectSettings/index.constants.tsx | 1 - studio/hooks/queries/useProjectSettings.ts | 8 ++++---- studio/lib/constants/infrastructure.ts | 2 ++ 5 files changed, 10 insertions(+), 9 deletions(-) delete mode 100644 studio/components/ui/ProjectSettings/index.constants.tsx diff --git a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx index 249b9f3c34d..512a986c997 100644 --- a/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx +++ b/studio/components/ui/ProjectSettings/DisplayApiSettings.tsx @@ -4,7 +4,7 @@ import { Input } from '@supabase/ui' import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events' import { useJwtSecretUpdateStatus, useProjectSettings } from 'hooks' import { SettingsLoadingState } from './SettingsLoadingState' -import { DEFAULT_API_SERVICE_ID } from './index.constants' +import { DEFAULT_PROJECT_API_SERVICE_ID } from 'lib/constants' import Panel from 'components/to-be-cleaned/Panel' const DisplayApiSettings = () => { @@ -24,7 +24,7 @@ const DisplayApiSettings = () => { const isNotUpdatingJwtSecret = jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated // Get the API service - const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) + const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_PROJECT_API_SERVICE_ID) const apiKeys = apiService?.service_api_keys ?? [] // api keys should not be empty. However it can be populated with a delay on project creation const isApikeysEmpty = apiKeys.length === 0 diff --git a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx index aea68e910dc..eb099f75976 100644 --- a/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx +++ b/studio/components/ui/ProjectSettings/DisplayConfigSettings.tsx @@ -4,7 +4,7 @@ import { Input } from '@supabase/ui' import { JwtSecretUpdateStatus } from '@supabase/shared-types/out/events' import { useJwtSecretUpdateStatus, useProjectSettings } from 'hooks' import { SettingsLoadingState } from './SettingsLoadingState' -import { DEFAULT_API_SERVICE_ID } from './index.constants' +import { DEFAULT_PROJECT_API_SERVICE_ID } from 'lib/constants' import Panel from 'components/to-be-cleaned/Panel' const DisplayConfigSettings = () => { @@ -26,7 +26,7 @@ const DisplayConfigSettings = () => { jwtSecretUpdateStatus === undefined || jwtSecretUpdateStatus === JwtSecretUpdateStatus.Updated // Get the API service const jwtSecret = project?.jwt_secret ?? '' - const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) + const apiService = (services ?? []).find((x: any) => x.app.id == DEFAULT_PROJECT_API_SERVICE_ID) const apiConfig = apiService?.app_config ?? {} return ( diff --git a/studio/components/ui/ProjectSettings/index.constants.tsx b/studio/components/ui/ProjectSettings/index.constants.tsx deleted file mode 100644 index fdd902e2733..00000000000 --- a/studio/components/ui/ProjectSettings/index.constants.tsx +++ /dev/null @@ -1 +0,0 @@ -export const DEFAULT_API_SERVICE_ID = 1 diff --git a/studio/hooks/queries/useProjectSettings.ts b/studio/hooks/queries/useProjectSettings.ts index e97eba1a0c9..946c4cc074d 100644 --- a/studio/hooks/queries/useProjectSettings.ts +++ b/studio/hooks/queries/useProjectSettings.ts @@ -1,5 +1,5 @@ import { get } from 'lib/common/fetch' -import { API_URL } from 'lib/constants' +import { API_URL, DEFAULT_PROJECT_API_SERVICE_ID } from 'lib/constants' import useSWR from 'swr' export function useProjectSettings(ref?: string) { @@ -10,7 +10,9 @@ export function useProjectSettings(ref?: string) { * check for data.services.service_api_keys, return a valid refresh interval if it's empty */ refreshInterval: function (data: any) { - const apiService = (data?.services ?? []).find((x: any) => x.app.id == DEFAULT_API_SERVICE_ID) + const apiService = (data?.services ?? []).find( + (x: any) => x.app.id == DEFAULT_PROJECT_API_SERVICE_ID + ) const apiKeys = apiService?.service_api_keys ?? [] const interval = apiKeys.length === 0 ? 2000 : 0 return interval @@ -26,5 +28,3 @@ export function useProjectSettings(ref?: string) { isError: !!anyError, } } - -const DEFAULT_API_SERVICE_ID = 1 diff --git a/studio/lib/constants/infrastructure.ts b/studio/lib/constants/infrastructure.ts index da1d6c4efaf..4dbba6f83e8 100644 --- a/studio/lib/constants/infrastructure.ts +++ b/studio/lib/constants/infrastructure.ts @@ -140,3 +140,5 @@ export const PASSWORD_STRENGTH_PERCENTAGE = { export const DEFAULT_FREE_PROJECTS_LIMIT = 2 export const STORAGE_FILE_SIZE_LIMIT_MAX_BYTES = 5 * 1024 * 1024 * 1024 // 5 GB + +export const DEFAULT_PROJECT_API_SERVICE_ID = 1 From 55579a1b0fe92daece86f671d2f3db32b9150653 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Tue, 19 Apr 2022 13:53:11 +0800 Subject: [PATCH 33/97] Fix table editor hiding errors when updating columns --- .../SidePanelEditor/SidePanelEditor.tsx | 25 ++++++++++++++----- .../TableEditor/TableEditor.tsx | 1 - studio/stores/pgmeta/MetaStore.ts | 17 +++++++++++-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx index 2efd9fe712d..85eed831540 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx @@ -195,12 +195,25 @@ const SidePanelEditor: FC = ({ category: 'loading', message: `Updating table: ${selectedTableToEdit?.name}...`, }) - const table: any = await meta.updateTable(toastId, selectedTableToEdit, payload, columns) - ui.setNotification({ - id: toastId, - category: 'success', - message: `Successfully updated ${table.name}!`, - }) + const { table, hasError }: any = await meta.updateTable( + toastId, + selectedTableToEdit, + payload, + columns + ) + if (hasError) { + ui.setNotification({ + id: toastId, + category: 'info', + message: `Table ${table.name} has been updated, but there were some errors`, + }) + } else { + ui.setNotification({ + id: toastId, + category: 'success', + message: `Successfully updated ${table.name}!`, + }) + } } } catch (error: any) { saveTableError = true diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx index 9a32b3f4cc9..fcf02df4032 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx @@ -22,7 +22,6 @@ import { generateTableFieldFromPostgresTable, formatImportedContentToColumnFields, } from './TableEditor.utils' -import SidePanelEditor from '..' interface Props { table?: PostgresTable diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.ts index c2954314903..c625ac9339b 100644 --- a/studio/stores/pgmeta/MetaStore.ts +++ b/studio/stores/pgmeta/MetaStore.ts @@ -516,6 +516,7 @@ export default class MetaStore implements IMetaStore { } // Add any new columns / Update any existing columns + let hasError = false for (const column of columns) { if (!column.id.includes(table.id.toString())) { this.rootStore.ui.setNotification({ @@ -546,7 +547,19 @@ export default class MetaStore implements IMetaStore { category: 'loading', message: `Updating column ${column.name} from ${updatedTable.name}`, }) - await this.updateColumn(column.id, columnPayload, updatedTable, column.foreignKey) + const res: any = await this.updateColumn( + column.id, + columnPayload, + updatedTable, + column.foreignKey + ) + if (res?.error) { + hasError = true + this.rootStore.ui.setNotification({ + category: 'error', + message: `Failed to update column "${column.name}": ${res.error.message}`, + }) + } } } } @@ -562,7 +575,7 @@ export default class MetaStore implements IMetaStore { if (primaryKeys.error) throw primaryKeys.error } - return await this.tables.loadById(table.id) + return { table: await this.tables.loadById(table.id), hasError } } async insertRowsViaSpreadsheet( From e524ec6665609ad2d2f581677c9a1bf4924e74bb Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Tue, 19 Apr 2022 13:54:43 +0800 Subject: [PATCH 34/97] Fix small styling issue with ProductMenuItem --- studio/components/ui/ProductMenu/ProductMenuItem.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/studio/components/ui/ProductMenu/ProductMenuItem.tsx b/studio/components/ui/ProductMenu/ProductMenuItem.tsx index db1090ecb59..077f4e40fd2 100644 --- a/studio/components/ui/ProductMenu/ProductMenuItem.tsx +++ b/studio/components/ui/ProductMenu/ProductMenuItem.tsx @@ -1,6 +1,6 @@ import { FC, ReactNode } from 'react' import Link from 'next/link' -import { Menu, Typography } from '@supabase/ui' +import { Menu } from '@supabase/ui' interface Props { name: string | ReactNode @@ -25,10 +25,8 @@ const ProductMenuItem: FC = ({ }) => { const menuItem = ( -
- - {name} - +
+ {name} {action}
From d889b46ebfb38e5fc97dd186afb61fe7e324f5d5 Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Tue, 19 Apr 2022 15:10:36 +0800 Subject: [PATCH 35/97] Implement enum types store and hide system enum types from table editor --- .../ColumnEditor/ColumnDefaultValue.tsx | 8 ++-- .../ColumnEditor/ColumnEditor.tsx | 16 ++++---- .../ColumnEditor/ColumnEditor.utils.ts | 18 ++++----- .../ColumnEditor/ColumnType.tsx | 7 ++-- .../SidePanelEditor/SidePanelEditor.tsx | 15 +------- .../SidePanelEditor/SidePanelEditor.types.ts | 6 --- .../SidePanelEditor/TableEditor/Column.tsx | 7 ++-- .../TableEditor/ColumnManagement.tsx | 11 ++++-- .../TableEditor/TableEditor.tsx | 13 ++----- .../TableEditorLayout/TableEditorLayout.tsx | 1 + studio/pages/api/pg-meta/[ref]/types.ts | 38 +++++++++++++++++++ studio/stores/pgmeta/MetaStore.ts | 6 ++- studio/stores/pgmeta/SchemaStore.ts | 13 ------- studio/stores/pgmeta/TypesStore.ts | 16 ++++++++ 14 files changed, 103 insertions(+), 72 deletions(-) create mode 100644 studio/pages/api/pg-meta/[ref]/types.ts create mode 100644 studio/stores/pgmeta/TypesStore.ts diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx index c7f02815118..460b4fb811d 100644 --- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx +++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnDefaultValue.tsx @@ -1,17 +1,18 @@ import React, { FC } from 'react' import { isNil } from 'lodash' import { Select } from '@supabase/ui' +import { PostgresType } from '@supabase/postgres-meta' import InputWithSuggestions from './InputWithSuggestions' import { POSTGRES_DATA_TYPES } from '../SidePanelEditor.constants' -import { ColumnField, EnumType } from '../SidePanelEditor.types' +import { ColumnField } from '../SidePanelEditor.types' import { Suggestion } from './ColumnEditor.types' import { getSelectedEnumValues } from './ColumnEditor.utils' import { typeExpressionSuggestions } from './ColumnEditor.constants' interface Props { columnFields: ColumnField - enumTypes: EnumType[] + enumTypes: PostgresType[] onUpdateField: (changes: Partial) => void } @@ -27,6 +28,7 @@ const ColumnDefaultValue: FC = ({ isNil(columnFields.format) && !POSTGRES_DATA_TYPES.includes(columnFields.format) if (isUserDefinedEnum) { + const enumValues = getSelectedEnumValues(columnFields.format, enumTypes) return (