chore: linting rule tweaks and error fixes (#21678)

This commit is contained in:
Charis
2024-03-04 23:32:46 -05:00
committed by GitHub
parent 21d1b8afbb
commit cb7c67864b
43 changed files with 281 additions and 157 deletions
+4 -2
View File
@@ -8,5 +8,7 @@ mdx = md
[*]
BasedOnStyles = Vale, Custom
BlockIgnores = (?s) *(<StepHikeCompact>.*?</StepHikeCompact>)
TokenIgnores = (href=".*?")
BlockIgnores = (?s) *(<StepHikeCompact>.*?</StepHikeCompact>), \
(?s) *(export\s+const\s+\S+\s*=\s*\[.*?\]), \
(?s) *(<Image.*?/>)
TokenIgnores = (href\s*([=:])\s*['"].*?\1), \
+12
View File
@@ -20,6 +20,8 @@ The toolkit includes:
Check out all of the AI [templates and examples](https://github.com/supabase/supabase/tree/master/examples/ai) in our GitHub repository.
{/* <!-- vale off --> */}
<div className="grid md:grid-cols-12 gap-4 not-prose">
{examples.map((x) => (
<div className="col-span-4" key={x.href}>
@@ -66,8 +68,12 @@ export const examples = [
},
]
{/* <!-- vale on --> */}
## Integrations
{/* <!-- vale off --> */}
<div className="grid md:grid-cols-12 gap-4 not-prose">
{integrations.map((x) => (
<div className="col-span-4" key={x.href}>
@@ -104,8 +110,12 @@ export const integrations = [
},
]
{/* <!-- vale on --> */}
## Case studies
{/* <!-- vale off --> */}
<div className="grid md:grid-cols-12 gap-4 not-prose">
{[
{
@@ -134,3 +144,5 @@ export const integrations = [
</div>
))}
</div>
{/* <!-- vale on --> */}
@@ -36,7 +36,7 @@ drop
extension pgtap;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension call `drop extension`.
</TabPanel>
@@ -48,7 +48,7 @@ Most extensions are installed under the `extensions` schema, which is accessible
If you need to restrict user access to tables managed by extensions, we recommend creating a separate schema for installing that specific extension.
Some extensions can only be created under a specific schema, for eg. `postgis_tiger_geocoder` extension creates a schema named `tiger`. Before enabling such extensions, make sure you have not created a conflicting schema with the same name.
Some extensions can only be created under a specific schema, for example, `postgis_tiger_geocoder` extension creates a schema named `tiger`. Before enabling such extensions, make sure you have not created a conflicting schema with the same name.
In addition to the pre-configured extensions, you can also install your own SQL extensions directly in the database using Supabase's SQL editor. The SQL code for the extensions, including plpgsql extensions, can be added through the SQL editor.
@@ -21,7 +21,7 @@ The motivation for HypoPG is to allow users to quickly search for an index to im
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "hypopg" and enable the extension.
3. Search for `hypopg` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -35,7 +35,7 @@ create extension hypopg with schema extensions;
drop extension if exists hypopg;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension you can call `drop extension`.
It's good practice to create the extension within a separate schema (like `extensions`) to keep the `public` schema clean.
@@ -104,10 +104,10 @@ create index on account(id);
- [`hypo_create_index(text)`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#create-a-hypothetical-index): A function to create a hypothetical index.
- [`hypopg_list_indexes`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A View that lists all hypothetical indexes that have been created.
- [`hypopg()`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A function that lists all hypothetical indexes that have been created with the same format as pg_index.
- [`hypopg()`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A function that lists all hypothetical indexes that have been created with the same format as `pg_index`.
- [`hypopg_get_index_def(oid)`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A function to display the `create index` statement that would create the index.
- [`hypopg_get_relation_size(oid)`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A function to estimate how large a hypothetical index would be.
- [`hypopg_drop_index(oid)`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A function to remove a given hypothetical index by oid.
- [`hypopg_drop_index(oid)`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A function to remove a given hypothetical index by `oid`.
- [`hypopg_reset()`](https://hypopg.readthedocs.io/en/rel1_stable/usage.html#manipulate-hypothetical-indexes): A function to remove all hypothetical indexes.
## Resources
@@ -19,7 +19,7 @@ description: 'Validate json/jsonb with JSON Schema in PostgreSQL.'
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pg_jsonschema" and enable the extension.
3. Search for `pg_jsonschema` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -33,7 +33,7 @@ create extension pg_jsonschema with schema extensions;
drop extension if exists pg_jsonschema;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension you can call `drop extension`.
It's good practice to create the extension within a separate schema (like `extensions`) to keep the `public` schema clean.
@@ -4,7 +4,7 @@ title: 'pg_plan_filter: Restrict Total Cost'
description: 'Block queries over a total cost limit'
---
[pg_plan_filter](https://github.com/pgexperts/pg_plan_filter) is PostgreSQL extension to block execution of statements where query planner's estimate of the total cost exceeds a threshold. This is intended to give database administrators a way to restrict the contribution an individual query has on database load.
[`pg_plan_filter`](https://github.com/pgexperts/pg_plan_filter) is PostgreSQL extension to block execution of statements where query planner's estimate of the total cost exceeds a threshold. This is intended to give database administrators a way to restrict the contribution an individual query has on database load.
## Enable the extension
@@ -27,7 +27,7 @@ alter database some_db set session_preload_libraries = 'plan_filter';
`plan_filter.statement_cost_limit`: restricts the maximum total cost for executed statements
`plan_filter.limit_select_only`: restricts to `select` statements
Note that `limit_select_only = true` is not the same as read-only because `select` statements may modify data e.g. through a function call.
Note that `limit_select_only = true` is not the same as read-only because `select` statements may modify data, for example, through a function call.
## Example
@@ -88,4 +88,4 @@ HINT: The plan for your query shows that it would probably have an excessive ru
## Resources
- Official [pg_plan_filter documentation](https://github.com/pgexperts/pg_plan_filter)
- Official [`pg_plan_filter` documentation](https://github.com/pgexperts/pg_plan_filter)
@@ -21,7 +21,7 @@ PGAudit grants fine grain control over which statements and objects are emitted
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pgaudit" and enable the extension.
3. Search for `pgaudit` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -35,7 +35,7 @@ create extension pgaudit;
drop extension if exists pgaudit;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension you can call `drop extension`.
</TabPanel>
@@ -45,13 +45,13 @@ To disable an extension you can call `drop extension`.
The `pgaudit.log` setting controls which statements to log. Available values include:
- **read**: `SELECT` and `COPY` when the source is a relation or a query.
- **write**: `INSERT`, `UPDATE`, `DELETE`, `TRUNCATE`, and `COPY` when the destination is a relation.
- **function**: Function calls and `DO` blocks.
- **role**: Statements related to roles and privileges: `GRANT`, `REVOKE`, `CREATE/ALTER/DROP ROLE`.
- **ddl**: All `DDL` that is not included in the `ROLE` class.
- **misc**: Miscellaneous commands, e.g. `DISCARD`, `FETCH`, `CHECKPOINT`, `VACUUM`, `SET`.
- **misc_set**: Miscellaneous `SET` commands, e.g. `SET ROLE`.
- `read`: `SELECT` and `COPY` when the source is a relation or a query.
- `write`: `INSERT`, `UPDATE`, `DELETE`, `TRUNCATE`, and `COPY` when the destination is a relation.
- `function`: Function calls and `DO` blocks.
- `role`: Statements related to roles and privileges: `GRANT`, `REVOKE`, `CREATE/ALTER/DROP ROLE`.
- `ddl`: All `DDL` that is not included in the `ROLE` class.
- `misc`: Miscellaneous commands, for example, `DISCARD`, `FETCH`, `CHECKPOINT`, `VACUUM`, `SET`.
- `misc_set`: Miscellaneous `SET` commands, for example, `SET ROLE`.
- **all**: Include all of the above.
@@ -59,7 +59,7 @@ For a full list of available settings see [settings docs](https://github.com/pga
<Admonition type="note">
We don't currently support configuring `pgaudit.log_parameter` because it may log secrets in encrypted columns if you are using [pgsodium](/docs/guides/database/extensions/pgsodium) or [Vault](/docs/guides/database/vault).
We don't currently support configuring `pgaudit.log_parameter` because it may log secrets in encrypted columns if you are using [`pgsodium`](/docs/guides/database/extensions/pgsodium) or [Vault](/docs/guides/database/vault).
You can upvote this [feature request](https://github.com/orgs/supabase/discussions/20183) if you'd like this restriction lifted.
@@ -67,7 +67,7 @@ You can upvote this [feature request](https://github.com/orgs/supabase/discussio
## Example
Given a pgaudit setting
Given a `pgaudit` setting
{/* prettier-ignore */}
```sql
@@ -4,7 +4,7 @@ title: 'pgjwt: JSON Web Tokens'
description: 'Encode and decode JWTs in PostgreSQL'
---
The [pgjwt](https://github.com/michelp/pgjwt) (PostgreSQL JSON Web Token) extension allows you to create and parse [JSON Web Tokens (JWTs)](https://en.wikipedia.org/wiki/JSON_Web_Token) within a PostgreSQL database. JWTs are commonly used for authentication and authorization in web applications and services.
The [`pgjwt`](https://github.com/michelp/pgjwt) (PostgreSQL JSON Web Token) extension allows you to create and parse [JSON Web Tokens (JWTs)](https://en.wikipedia.org/wiki/JSON_Web_Token) within a PostgreSQL database. JWTs are commonly used for authentication and authorization in web applications and services.
## Enable the extension
@@ -19,7 +19,7 @@ The [pgjwt](https://github.com/michelp/pgjwt) (PostgreSQL JSON Web Token) extens
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pgjwt" and enable the extension.
3. Search for `pgjwt` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -33,7 +33,7 @@ create extension pgjwt schema extensions;
drop extension if exists pgjwt;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension you can call `drop extension`.
It's good practice to create the extension within a separate schema (like `extensions`) to keep the `public` schema clean.
@@ -67,7 +67,7 @@ select
);
```
The pgjwt_encode function returns a string that represents the JWT, which can then be safely transmitted between parties.
The `pgjwt_encode` function returns a string that represents the JWT, which can then be safely transmitted between parties.
{/* prettier-ignore */}
```
@@ -20,7 +20,7 @@ tocVideo: 'Mmmv9g_MiBA'
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pgroonga" and enable the extension.
3. Search for `pgroonga` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -34,7 +34,7 @@ create extension pgroonga with schema extensions;
drop extension if exists pgroonga;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension you can call `drop extension`.
</TabPanel>
@@ -92,7 +92,7 @@ Index Scan using ix_memos_content on memos (cost=0.00..1.11 rows=1 width=36)
(2 rows)
```
The pgroonga index is used to retrieve the result set:
The `pgroonga` index is used to retrieve the result set:
```markdown
| id | content |
@@ -102,7 +102,7 @@ The pgroonga index is used to retrieve the result set:
## Full text search
The `&@~` operator performs full text search. It returns any matching results. Unlike `LIKE` operator, pgroonga can search any text that contains the keyword case insensitive.
The `&@~` operator performs full text search. It returns any matching results. Unlike `LIKE` operator, `pgroonga` can search any text that contains the keyword case insensitive.
Take the following example:
@@ -4,7 +4,7 @@ title: 'pgrouting: Geospatial Routing'
description: 'Extends PostGIS with Geospatial Routing'
---
[pgRouting](http://pgrouting.org) is PostgreSQL and [PostGIS](http://postgis.net) extension adding geospatial routing functionality.
[`pgRouting`](http://pgrouting.org) is PostgreSQL and [PostGIS](http://postgis.net) extension adding geospatial routing functionality.
The core functionality of `pgRouting` is a set of path finding algorithms including:
@@ -33,7 +33,7 @@ The core functionality of `pgRouting` is a set of path finding algorithms includ
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pgrouting" and enable the extension.
3. Search for `pgrouting` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -47,7 +47,7 @@ create extension pgrouting cascade;
drop extension if exists pgRouting;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension you can call `drop extension`.
</TabPanel>
@@ -55,9 +55,9 @@ To disable an extension you can call `drop extension`.
## Example
As an example, we'll solve the [traveling salesman problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem) using the pgRouting's `pgr_TSPeuclidean` function from some PostGIS coordinates.
As an example, we'll solve the [traveling salesperson problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem) using the `pgRouting`'s `pgr_TSPeuclidean` function from some PostGIS coordinates.
A summary of the traveling salesman problem is, given a set of city coordinates, solve for a path that goes through each city and minimizes the total distance traveled.
A summary of the traveling salesperson problem is, given a set of city coordinates, solve for a path that goes through each city and minimizes the total distance traveled.
First we populate a table with some X, Y coordinates
@@ -4,13 +4,13 @@ title: 'pgsodium: Encryption Features'
description: 'Encryption library for PostgreSQL'
---
[pgsodium](https://github.com/michelp/pgsodium) is a PostgreSQL extension which provides SQL access to [libsodium's](https://doc.libsodium.org/) high-level cryptographic algorithms.
[`pgsodium`](https://github.com/michelp/pgsodium) is a PostgreSQL extension which provides SQL access to [`libsodium`'s](https://doc.libsodium.org/) high-level cryptographic algorithms.
libsodium is a modern, easy-to-use software library for encryption, decryption, signatures, password hashing, and more. It is a portable, cross-compilable, installable, and packageable fork of the [NaCl](http://nacl.cr.yp.to/) library, with a compatible but extended API to improve usability even further.
`libsodium` is a modern, easy-to-use software library for encryption, decryption, signatures, password hashing, and more. It is a portable, cross-compilable, installable, and packageable fork of the [NaCl](http://nacl.cr.yp.to/) library, with a compatible but extended API to improve usability even further.
The design choices emphasize security and ease of use. But despite the emphasis on high security, primitives are faster across-the-board than most implementations.
pgsodium exposes the following libsodium APIs to SQL:
`pgsodium` exposes the following `libsodium` APIs to SQL:
- [Generating Random Data](https://github.com/michelp/pgsodium/#generating-random-data)
- [Secret key cryptography](https://github.com/michelp/pgsodium/#secret-key-cryptography)
@@ -53,7 +53,7 @@ Note that Supabase projects are already encrypted at rest by default.
## Get the root encryption key for your Supabase project
Encryption requires keys. Keeping the keys in the same database as the encrypted data would be unsafe. For more information about managing the pgsodium root encryption key on your Supabase project see **[encryption key location](/docs/guides/database/vault#encryption-key-location)**. This key is required to decrypt values stored in [Supabase Vault](/docs/guides/database/vault) and data encrypted with Transparent Column Encryption.
Encryption requires keys. Keeping the keys in the same database as the encrypted data would be unsafe. For more information about managing the `pgsodium` root encryption key on your Supabase project see **[encryption key location](/docs/guides/database/vault#encryption-key-location)**. This key is required to decrypt values stored in [Supabase Vault](/docs/guides/database/vault) and data encrypted with Transparent Column Encryption.
## Enable the extension
@@ -68,7 +68,7 @@ Encryption requires keys. Keeping the keys in the same database as the encrypted
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pgsodium" and enable the extension.
3. Search for `pgsodium` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -26,7 +26,7 @@ Let's cover some basic concepts:
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pgtap" and enable the extension.
3. Search for `pgtap` and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -39,7 +39,7 @@ create extension pgtap with schema extensions;
drop extension if exists pgtap;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension you can call `drop extension`.
It's good practice to create the extension within a separate schema (like `extensions`) to keep the `public` schema clean.
@@ -149,7 +149,7 @@ rollback;
API:
- [`function_returns()`](https://pgtap.org/documentation.html#function_returns): Tests that a particular function returns a particular data type
- [`is_definer()`](https://pgtap.org/documentation.html#is_definer): Tests that a function is a security definer (i.e., a setuid function).
- [`is_definer()`](https://pgtap.org/documentation.html#is_definer): Tests that a function is a security definer (that is, a `setuid` function).
## Resources
@@ -8,7 +8,7 @@ The `plv8` extension allows you use JavaScript within Postgres.
## Overview
While Postgres natively runs SQL, it can also run other "procedural languages".
While Postgres natively runs SQL, it can also run other procedural languages.
`plv8` allows you to run JavaScript code - specifically any code that runs on the [V8 JavaScript engine](https://v8.dev).
It can be used for database functions, triggers, queries and more.
@@ -39,7 +39,7 @@ create extension plv8;
drop extension if exists plv8;
```
Even though the SQL code is `create extension`, this is the equivalent of "enabling the extension".
Even though the SQL code is `create extension`, this is the equivalent of enabling the extension.
To disable an extension, call `drop extension`.
Procedural languages are automatically installed within `pg_catalog`, so you don't need to specify a schema.
@@ -30,6 +30,8 @@ For this guide we'll use the following example data:
>
<TabPanel id="data" label="Data">
{/* <!-- vale off --> */}
| id | title | author | description |
| --- | ----------------------------------- | ---------------------- | ------------------------------------------------------------------ |
| 1 | The Poky Little Puppy | Janette Sebring Lowrey | Puppy is slower than other, bigger animals. |
@@ -38,6 +40,8 @@ For this guide we'll use the following example data:
| 4 | Green Eggs and Ham | Dr. Seuss | Sam has changing food preferences and eats unusually colored food. |
| 5 | Harry Potter and the Goblet of Fire | J.K. Rowling | Fourth year of school starts, big drama ensues. |
{/* <!-- vale on --> */}
</TabPanel>
<TabPanel id="sql" label="SQL">
@@ -80,7 +84,7 @@ The functions we'll cover in this guide are:
### `to_tsvector()` [#to-tsvector]
Converts your data into searchable "tokens". `to_tsvector()` stands for "to text search vector". For example:
Converts your data into searchable tokens. `to_tsvector()` stands for "to text search vector." For example:
```sql
select to_tsvector('green eggs and ham');
@@ -91,10 +95,10 @@ Collectively these tokens are called a "document" which Postgres can use for com
### `to_tsquery()` [#to-tsquery]
Converts a query string into "tokens" to match. `to_tsquery()` stands for "to text search query".
Converts a query string into tokens to match. `to_tsquery()` stands for "to text search query."
This conversion step is important because we will want to "fuzzy match" on keywords.
For example if a user searches for "eggs", and a column has the value "egg", we probably still want to return a match.
For example if a user searches for `eggs`, and a column has the value `egg`, we probably still want to return a match.
### Match: `@@` [#match]
@@ -253,11 +257,15 @@ val data = supabase.from("books").select {
</TabPanel>
<TabPanel id="data" label="Data">
{/* <!-- vale off --> */}
| id | title | author | description |
| --- | ----------------------------------- | ----------------- | ----------------------------------------------- |
| 3 | Tootle | Gertrude Crampton | Little toy train has big dreams. |
| 5 | Harry Potter and the Goblet of Fire | J.K. Rowling | Fourth year of school starts, big drama ensues. |
{/* <!-- vale on --> */}
</TabPanel>
</Tabs>
@@ -338,11 +346,15 @@ val data = supabase.from("books").select {
</TabPanel>
<TabPanel id="data" label="Data">
{/* <!-- vale off --> */}
| id | title | author | description |
| --- | --------------------- | ---------------------- | ------------------------------------------- |
| 1 | The Poky Little Puppy | Janette Sebring Lowrey | Puppy is slower than other, bigger animals. |
| 3 | Tootle | Gertrude Crampton | Little toy train has big dreams. |
{/* <!-- vale on --> */}
</TabPanel>
</Tabs>
@@ -403,10 +415,14 @@ val data = supabase.from("books").select {
</TabPanel>
<TabPanel id="data" label="Data">
{/* <!-- vale off --> */}
| id | title | author | description |
| --- | ------ | ----------------- | -------------------------------- |
| 3 | Tootle | Gertrude Crampton | Little toy train has big dreams. |
{/* <!-- vale on --> */}
</TabPanel>
</Tabs>
@@ -467,11 +483,15 @@ val data = supabase.from("books").select {
</TabPanel>
<TabPanel id="data" label="Data">
{/* <!-- vale off --> */}
| id | title | author | description |
| --- | --------------------- | ---------------------- | ------------------------------------------- |
| 1 | The Poky Little Puppy | Janette Sebring Lowrey | Puppy is slower than other, bigger animals. |
| 3 | Tootle | Gertrude Crampton | Little toy train has big dreams. |
{/* <!-- vale on --> */}
</TabPanel>
</Tabs>
@@ -514,6 +534,8 @@ from books;
</TabPanel>
<TabPanel id="data" label="Data">
{/* <!-- vale off --> */}
| id | fts |
| --- | --------------------------------------------------------------------------------------------------------------- |
| 1 | 'anim':7 'bigger':6 'littl':10 'poki':9 'puppi':1,11 'slower':3 |
@@ -522,6 +544,8 @@ from books;
| 4 | 'chang':3 'color':9 'eat':7 'egg':12 'food':4,10 'green':11 'ham':14 'prefer':5 'sam':1 'unus':8 |
| 5 | 'big':6 'drama':7 'ensu':8 'fire':15 'fourth':1 'goblet':13 'harri':9 'potter':10 'school':4 'start':5 'year':2 |
{/* <!-- vale on --> */}
</TabPanel>
</Tabs>
@@ -578,10 +602,14 @@ val data = supabase.from("books").select {
</TabPanel>
<TabPanel id="data" label="Data">
{/* <!-- vale off --> */}
| id | title | author | description | fts |
| --- | ------ | ----------------- | -------------------------------- | ------------------------------------------------------- |
| 3 | Tootle | Gertrude Crampton | Little toy train has big dreams. | 'big':5 'dream':6 'littl':1 'tootl':7 'toy':2 'train':3 |
{/* <!-- vale on --> */}
</TabPanel>
</Tabs>
@@ -6,7 +6,7 @@ description: 'How to change your database timezone.'
---
Every Supabase database is set to UTC timezone by default. We strongly recommend keeping it this way, even if your users are in a different location.
This is because it makes it much easier to calculate differences between timezones if you adopt the mental model that "everything in my database is in UTC time".
This is because it makes it much easier to calculate differences between timezones if you adopt the mental model that "everything in my database is in UTC time."
### Change timezone
@@ -6,10 +6,10 @@ footerHelpType: 'postgres'
There are 5 options for foreign key constraint deletes:
1. **CASCADE:** When a row is deleted from the parent table, all related rows in the child table(s) are deleted as well.
2. **RESTRICT:** When a row is deleted from the parent table, the delete operation is aborted if there are any related rows in the child table(s).
3. **SET NULL:** When a row is deleted from the parent table, the values of the foreign key columns in the child table(s) are set to NULL.
4. **SET DEFAULT:** When a row is deleted from the parent table, the values of the foreign key columns in the child table(s) are set to their default values.
1. **CASCADE:** When a row is deleted from the parent table, all related rows in the child tables are deleted as well.
2. **RESTRICT:** When a row is deleted from the parent table, the delete operation is aborted if there are any related rows in the child tables.
3. **SET NULL:** When a row is deleted from the parent table, the values of the foreign key columns in the child tables are set to NULL.
4. **SET DEFAULT:** When a row is deleted from the parent table, the values of the foreign key columns in the child tables are set to their default values.
5. **NO ACTION:** This option is similar to RESTRICT, but it also has the option to be “deferred” to the end of a transaction. This means that other cascading deletes can run first, and then this delete constraint will only throw an error if there is referenced data remaining _at the end of the transaction_.
These options can be specified when defining a foreign key constraint using the "ON DELETE" clause. For example, the following SQL statement creates a foreign key constraint with the `CASCADE` option:
@@ -20,7 +20,7 @@ add constraint fk_parent foreign key (parent_id) references parent_table (id)
on delete cascade;
```
This means that when a row is deleted from the "parent_table", all related rows in the "child_table" will be deleted as well.
This means that when a row is deleted from the `parent_table`, all related rows in the `child_table` will be deleted as well.
## `RESTRICT` vs `NO ACTION`
@@ -28,11 +28,11 @@ The difference between `NO ACTION` and `RESTRICT` is subtle and can be a bit con
Both `NO ACTION` and `RESTRICT` are used to prevent deletion of a row in a parent table if there are related rows in a child table. However, there is a subtle difference in how they behave.
When a foreign key constraint is defined with the option `RESTRICT`, it means that if a row in the parent table is deleted, the database will immediately raise an error and prevent the deletion of the row in the parent table. The database will not delete, update or set to NULL any rows in the referenced table(s).
When a foreign key constraint is defined with the option `RESTRICT`, it means that if a row in the parent table is deleted, the database will immediately raise an error and prevent the deletion of the row in the parent table. The database will not delete, update or set to NULL any rows in the referenced tables.
When a foreign key constraint is defined with the option `NO ACTION`, it means that if a row in the parent table is deleted, the database will also raise an error and prevent the deletion of the row in the parent table. However unlike `RESTRICT`, `NO ACTION` has the option defer the check using `INITIALLY DEFERRED`. This will only raise the above error _if_ the referenced rows still exist at the end of the transaction.
The difference from `RESTRICT` is that a constraint marked as `NO ACTION INITIALLY DEFERRED` is deferred until the end of the transaction, rather than running immediately. If, for example there is another foreign key constraint between the same tables marked as `CASCADE`, the cascade will occur first and delete the referenced rows, and no error will be thrown by the deferred constraint. Otherwise if there are still rows referencing the parent row by the end of the transaction, an error will be raised just like before. Just like `RESTRICT`, the database will not delete, update or set to NULL any rows in the referenced table(s).
The difference from `RESTRICT` is that a constraint marked as `NO ACTION INITIALLY DEFERRED` is deferred until the end of the transaction, rather than running immediately. If, for example there is another foreign key constraint between the same tables marked as `CASCADE`, the cascade will occur first and delete the referenced rows, and no error will be thrown by the deferred constraint. Otherwise if there are still rows referencing the parent row by the end of the transaction, an error will be raised just like before. Just like `RESTRICT`, the database will not delete, update or set to NULL any rows in the referenced tables.
In practice, you can use either `NO ACTION` or `RESTRICT` depending on your needs. `NO ACTION` is the default behavior if you do not specify anything. If you prefer to defer the check until the end of the transaction, use `NO ACTION INITIALLY DEFERRED`.
@@ -48,10 +48,10 @@ Let's further illustrate the difference with an example. We'll use the following
`parent`
| id | name | parent_id |
| --- | ------- | --------- |
| 1 | Charles | 1 |
| 2 | Diana | 1 |
| id | name | `parent_id` |
| --- | ------- | ----------- |
| 1 | Charles | 1 |
| 2 | Diana | 1 |
`child`
@@ -36,7 +36,7 @@ This data can further be used in conjunction with the [`explain`](https://www.po
## Managing timezones
Every Supabase database is set to UTC timezone by default. We strongly recommend keeping it this way, even if your users are in a different location.
This is because it makes it much easier to calculate differences between timezones if you adopt the mental model that "everything in my database is in UTC time".
This is because it makes it much easier to calculate differences between timezones if you adopt the mental model that "everything in my database is in UTC time."
### Change timezone
@@ -38,11 +38,11 @@ Your Postgres database is the core of your Supabase project, so it's important t
### Special symbols in passwords
If you use special symbols in your postgres password, you must remember to [percent-encode](https://en.wikipedia.org/wiki/Percent-encoding) your password later if using the postgres connection string e.g. `postgresql://postgres.projectref:p%3Dword@aws-0-us-east-1.pooler.supabase.com:6543/postgres`
If you use special symbols in your postgres password, you must remember to [percent-encode](https://en.wikipedia.org/wiki/Percent-encoding) your password later if using the postgres connection string, for example, `postgresql://postgres.projectref:p%3Dword@aws-0-us-east-1.pooler.supabase.com:6543/postgres`
### Changing your project password
When you created your project you were also asked to enter a password. This is actually the password for the `postgres` role in your database. You can update this from the Dashboard under the [database settings](https://supabase.com/dashboard/project/_/settings/database) page. You should _never_ give this to 3rd-party service unless you absolutely trust them. Instead, we recommend that you create a new user for every service that you want to give access too. This will also help you with debugging - you can see every query that each role is executing in your database within `pg_stat_statements`.
When you created your project you were also asked to enter a password. This is actually the password for the `postgres` role in your database. You can update this from the Dashboard under the [database settings](https://supabase.com/dashboard/project/_/settings/database) page. You should _never_ give this to third-party service unless you absolutely trust them. Instead, we recommend that you create a new user for every service that you want to give access too. This will also help you with debugging - you can see every query that each role is executing in your database within `pg_stat_statements`.
## Granting permissions
@@ -86,7 +86,7 @@ The default Postgres role. This has admin privileges.
### `anon`
For "anonymous access". This is the role which the API (PostgREST) will use when a user _is not_ logged in.
For "anonymous access." This is the role which the API (PostgREST) will use when a user _is not_ logged in.
### `authenticator`
@@ -95,7 +95,7 @@ A special role for the API (PostgREST). It has very limited access, and is used
### `authenticated`
For "authenticated access". This is the role which the API (PostgREST) will use when a user _is_ logged in.
For "authenticated access." This is the role which the API (PostgREST) will use when a user _is_ logged in.
### `service_role`
@@ -11,7 +11,7 @@ When you need granular authorization rules, nothing beats Postgres's [Row Level
RLS is incredibly powerful and flexible, allowing you to write complex SQL rules that fit your unique business needs. RLS can be [combined with Supabase Auth](/docs/guides/auth/row-level-security) for end-to-end user security from the browser to the database.
RLS is a Postgres primitive and can provide "[defense in depth](<https://en.wikipedia.org/wiki/Defense_in_depth_(computing)>)" to protect your data from malicious actors even when accessed through 3rd party tooling.
RLS is a Postgres primitive and can provide "[defense in depth](<https://en.wikipedia.org/wiki/Defense_in_depth_(computing)>)" to protect your data from malicious actors even when accessed through third-party tooling.
## Policies
@@ -219,7 +219,7 @@ to authenticated
using ( (select auth.uid()) = user_id );
```
This method works well for JWT functions like `auth.uid()` and `auth.jwt()` as well as `security definer` Functions. Wrapping the function causes an initPlan to be run by the Postgres optimizer, which allows it to "cache" the results per-statement, rather than calling the function on each row.
This method works well for JWT functions like `auth.uid()` and `auth.jwt()` as well as `security definer` Functions. Wrapping the function causes an `initPlan` to be run by the Postgres optimizer, which allows it to "cache" the results per-statement, rather than calling the function on each row.
<Admonition type="caution">
@@ -239,7 +239,7 @@ You can only use this technique if the results of the query or function do not c
### Add filters to every query
Policies are "implicit where clauses", so it's common to run `select` statements without any filters. This is a bad pattern for performance. Instead of doing this (JS client example):
Policies are "implicit where clauses," so it's common to run `select` statements without any filters. This is a bad pattern for performance. Instead of doing this (JS client example):
{/* prettier-ignore */}
```js
@@ -99,7 +99,7 @@ execute function after_delete_function();
There are two options available for executing triggers:
- `for each row`: specifies that the trigger function should be executed once for each affected row.
- `for each statement`: the trigger is executed once for the entire operation (eg, once on insert). This can be more efficient than `for each row` when dealing with multiple rows affected by a single SQL statement, as they allow you to perform calculations or updates on groups of rows at once.
- `for each statement`: the trigger is executed once for the entire operation (for example, once on insert). This can be more efficient than `for each row` when dealing with multiple rows affected by a single SQL statement, as they allow you to perform calculations or updates on groups of rows at once.
## Dropping a trigger
@@ -14,7 +14,7 @@ This guide is intended to:
This is not a comprehensive resource, but rather a helpful starting point for your optimization journey.
If you're new to query optimization, you may be interested in [index_advisor](/docs/guides/database/extensions/index_advisor), our tool for automatically detecting indexes that improve performance on a given query.
If you're new to query optimization, you may be interested in [`index_advisor`](/docs/guides/database/extensions/index_advisor), our tool for automatically detecting indexes that improve performance on a given query.
## Example query
@@ -66,7 +66,7 @@ create index idx_orders_customer_id on orders (customer_id);
Sorting can also be optimized by indexing:
- An index on `b.date_of_purchase` wcan improve the sorting process, and is particularly beneficial when a subset of rows is being returned with a `limit` clause.
- An index on `b.date_of_purchase` can improve the sorting process, and is particularly beneficial when a subset of rows is being returned with a `limit` clause.
```sql
create index idx_orders_date_of_purchase on orders (date_of_purchase);
+4 -4
View File
@@ -79,7 +79,7 @@ updated_at | 2022-12-14 02:34:23.85159+00
</details>
Alternatively, you can create a secret by `insert`ing data into the `vault.secret` table:
Alternatively, you can create a secret by inserting data into the `vault.secret` table:
{/* prettier-ignore */}
```sql
@@ -206,11 +206,11 @@ updated_at | 2022-12-14 02:51:13.938396+00
></iframe>
</div>
As we mentioned, the Vault uses pgsodium's Transparent Column Encryption (TCE) to store secrets in an authenticated encrypted form. There are some details around that you may be curious about, what does authenticated mean, and where are encryption keys store? This section explains those details.
As we mentioned, the Vault uses `pgsodium`'s Transparent Column Encryption (TCE) to store secrets in an authenticated encrypted form. There are some details around that you may be curious about, what does authenticated mean, and where are encryption keys store? This section explains those details.
### Authenticated encryption with associated data
The first important feature of TCE is that it uses an [Authenticated Encryption with Associated Data](<https://en.wikipedia.org/wiki/Authenticated_encryption#Authenticated_encryption_with_associated_data_(AEAD)>) encryption algorithm (based on libsodium).
The first important feature of TCE is that it uses an [Authenticated Encryption with Associated Data](<https://en.wikipedia.org/wiki/Authenticated_encryption#Authenticated_encryption_with_associated_data_(AEAD)>) encryption algorithm (based on `libsodium`).
### Encryption key location
@@ -218,7 +218,7 @@ The first important feature of TCE is that it uses an [Authenticated Encryption
**Associated Data** means that you can include any other columns from the same row as part of the signature computation. This doesn't encrypt those other columns - rather it ensures that your encrypted value is only associated with columns from that row. If an attacker were to copy an encrypted value from another row to the current one, the signature would be rejected (assuming you used a unique column in the associated data).
Another important feature of pgsodium is that the encryption keys are never stored in the database alongside the encrypted data. Instead, only a **Key ID** is stored, which is a reference to the key that is only accessible outside of SQL. Even if an attacker can capture a dump of your entire database, they will see only encrypted data and key IDs, _never the raw key itself_.
Another important feature of `pgsodium` is that the encryption keys are never stored in the database alongside the encrypted data. Instead, only a **Key ID** is stored, which is a reference to the key that is only accessible outside of SQL. Even if an attacker can capture a dump of your entire database, they will see only encrypted data and key IDs, _never the raw key itself_.
This is an important safety precaution - there is little value in storing the encryption key in the database itself as this would be like locking your front door but leaving the key in the lock! Storing the key outside the database fixes this issue.
@@ -13,7 +13,7 @@ Dart Edge is an experimental project - it's probably not ready for production us
</Admonition>
## Pre requirements
## Prerequisites
Make sure you have [the edge CLI](https://docs.dartedge.dev/#getting-started) installed in addition to [the Supabase CLI](https://supabase.com/docs/guides/cli#installation).
@@ -74,7 +74,7 @@ Now lets try to interact with our Supabase database. We will start by install
### Add dependencies
Add [supabase](https://pub.dev/packages/supabase) to interact with Supabase service.
Add [`supabase`](https://pub.dev/packages/supabase) to interact with Supabase service.
```bash
dart pub add supabase
@@ -125,14 +125,13 @@ supabase:
project_path: './supabase'
```
Also, currently Dart Edge doesn't work with the latest versions of Flutter. If you do have the latest version of Flutter on your machine, you can use [FVM](https://fvm.app/) to use an older version of Flutter for your Dart Edge project.
Also, currently Dart Edge doesn't work with the latest versions of Flutter. If you do have the latest version of Flutter on your machine, you can use [Flutter Version Management (FVM)](https://fvm.app/) to use an older version of Flutter for your Dart Edge project.
```bash
fvm use 3.7.12 -f
```
You can read more about how to configure FVM (Flutter
Version Management) for your project in the [FVM documentation](https://fvm.app/documentation/getting-started).
You can read more about how to configure FVM for your project in the [FVM documentation](https://fvm.app/documentation/getting-started).
Run the following command to compile your Dart code. This command will start a watcher that will recompile anytime you make changes to your code.
@@ -29,7 +29,7 @@ Each Supabase project consists of several tools:
### PostgreSQL (database)
PostgreSQL is the core of Supabase. We do not abstract the PostgreSQL databaseyou can access it and use it with full privileges. We simply provide tools which makes PostgreSQL as easy to use as Firebase.
PostgreSQL is the core of Supabase. We do not abstract the PostgreSQL databaseyou can access it and use it with full privileges. We simply provide tools which makes PostgreSQL as easy to use as Firebase.
- Official Docs: [postgresql.org/docs](https://www.postgresql.org/docs/current/index.html)
- Source code: [github.com/postgres/postgres](https://github.com/postgres/postgres) (mirror)
@@ -57,7 +57,7 @@ A JWT-based API for managing users and issuing access tokens. This integrates wi
### PostgREST (API)
A standalone web server that turns your PostgreSQL database directly into a RESTful API.
We use this with our [pg_graphql](https://github.com/supabase/pg_graphql) extension to provide a GraphQL API.
We use this with our [`pg_graphql`](https://github.com/supabase/pg_graphql) extension to provide a GraphQL API.
- Official Docs: [postgrest.org](https://postgrest.org/)
- Source code: [github.com/PostgREST/postgrest](https://github.com/PostgREST/postgrest)
@@ -86,8 +86,8 @@ An S3-compatible object storage service that stores metadata in Postgres.
A modern runtime for JavaScript and TypeScript.
- Official Docs: [deno.land](https://deno.land/)
- Source code: [github.com/denoland/deno](https://github.com/denoland/deno)
- Official Docs: [Deno documentation](https://deno.land/)
- Source code: [Deno source code](https://github.com/denoland/deno)
- License: [MIT](https://github.com/denoland/deno/blob/main/LICENSE.md)
- Language: TypeScript / Rust
@@ -104,14 +104,14 @@ A RESTful API for managing your Postgres. Fetch tables, add roles, and run queri
A cloud-native, multi-tenant Postgres connection pooler.
- Official Docs: [Supavisor Github Pages](https://supabase.github.io/supavisor/)
- Source code: [supabase/supavisor](https://github.com/supabase/supavisor)
- Official Docs: [Supavisor GitHub Pages](https://supabase.github.io/supavisor/)
- Source code: [`supabase/supavisor`](https://github.com/supabase/supavisor)
- License: [Apache 2.0](https://github.com/supabase/supavisor/blob/main/LICENSE)
- Language: Elixir
### Kong (API gateway)
A cloud-native API gateway, built on top of Nginx.
A cloud-native API gateway, built on top of NGINX.
- Official Docs: [docs.konghq.com](https://docs.konghq.com/)
- Source code: [github.com/kong/kong](https://github.com/kong/kong)
@@ -144,7 +144,7 @@ Less, but better.
### Everything is portable
To avoid lock-in, we make it easy to migrate in and out. Our cloud offering is compatible with our self-hosted product.
We use existing standards to increase portability (like pg_dump and CSV files). If a new standard emerges which competes with a "Supabase" approach, we will deprecate the approach in favor of the standard.
We use existing standards to increase portability (like `pg_dump` and CSV files). If a new standard emerges which competes with a "Supabase" approach, we will deprecate the approach in favor of the standard.
This forces us compete on experience. We aim to be the best Postgres hosting service.
### Play the long game
@@ -68,7 +68,7 @@ Provide phone logins using a third-party SMS provider. [Docs](/docs/guides/auth/
Control the data each user can access with Postgres Policies. [Docs](/docs/guides/auth/row-level-security).
### Serverside Auth helpers
### Server-side Auth helpers
Helpers for implementing user authentication in popular frameworks like [Next.js](/docs/guides/auth/auth-helpers/nextjs) and [SvelteKit](/docs/guides/auth/auth-helpers/sveltekit)
@@ -82,7 +82,7 @@ Build login and registration pages with custom themes. [Docs](/docs/guides/auth/
### Auto-generated REST API
RESTful APIs are autogenerated from your database, without a single line of code. [Docs](/docs/guides/api#rest-api-overview).
RESTful APIs are auto-generated from your database, without a single line of code. [Docs](/docs/guides/api#rest-api-overview).
### Auto-generated GraphQL API
@@ -492,7 +492,7 @@ export class AvatarComponent {
### Add the new widget
And then we can add the widget on top of the **AccountComponent** html template:
And then we can add the widget on top of the **AccountComponent** HTML template:
```html src/app/account.component.html
<form [formGroup]="updateProfileForm" (ngSubmit)="updateProfile()" class="form-widget">
@@ -460,6 +460,8 @@ expo install expo-image-picker
Let's create an avatar for the user so that they can upload a profile photo.
We can start by creating a new component:
{/* <!-- vale off --> */}
```tsx components/Avatar.tsx
import { useState, useEffect } from 'react'
import { supabase } from '../lib/supabase'
@@ -593,6 +595,8 @@ const styles = StyleSheet.create({
})
```
{/* <!-- vale on --> */}
### Add the new widget
And then we can add the widget to the Account page:
@@ -138,7 +138,7 @@ export class SupabaseService {
Let's set up a route to manage logins and signups. We'll use Magic Links so users can sign in with their email without using passwords.
Create a **LoginPage** with the `ionic g page login` Ionic CLI command.
> This guide will show the template inline, but the example app will have templateUrls
> This guide will show the template inline, but the example app will have `templateUrl`s
```ts src/app/login/login.page.ts
import { Component, OnInit } from '@angular/core'
@@ -33,7 +33,7 @@ Open Android Studio > New Project > Base Activity (Jetpack Compose).
Create or edit the `local.properties` file at the root (same level as `build.gradle`) of your project.
> **Note**: Do not commit this file to your source control, e.g. by adding it to your `.gitignore` file!
> **Note**: Do not commit this file to your source control, for example, by adding it to your `.gitignore` file!
```kotlin
SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
@@ -75,7 +75,7 @@ val apiKey = BuildConfig.SUPABASE_ANON_KEY
![Gradle dependencies](/docs/img/guides/kotlin/gradle-dependencies.png)
In the `build.gradle` (app) file, add these dependencies then press "Sync now". Replace the dependency version placeholders `$supabase_version` and `$ktor_version` with their respective latest versions.
In the `build.gradle` (app) file, add these dependencies then press "Sync now." Replace the dependency version placeholders `$supabase_version` and `$ktor_version` with their respective latest versions.
```kotlin
implementation "io.github.jan-tennert.supabase:postgrest-kt:$supabase_version"
@@ -17,12 +17,12 @@ If you get stuck while working through this guide, refer to the [full example on
A Redwood application is split into two parts: a frontend and a backend. This is represented as two node projects within a single monorepo.
The frontend project is called **`web`** and the backend project is called **`api`**. For clarity, we will refer to these in prose as **"sides"**, i.e. the "web side" and the "api side".
The frontend project is called **`web`** and the backend project is called **`api`**. For clarity, we will refer to these in prose as **"sides,"** that is, the `web side` and the `api side`.
They are separate projects because code on the `web side` will end up running in the user's browser while code on the `api side` will run on a server somewhere.
<Admonition type="note">
Important: When this guide refers to "API", that means the Supabase API and when it refers to "api side", that means the RedwoodJS `api side`.
Important: When this guide refers to "API," that means the Supabase API and when it refers to `api side`, that means the RedwoodJS `api side`.
</Admonition>
@@ -51,7 +51,7 @@ RedwoodJS requires Node.js `>= 14.x <= 16.x` and Yarn `>= 1.15`.
</Admonition>
Make sure you have installed yarn since RedwoodJS relies on it to [manage its packages in workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/) for its `web` and `api` "sides".
Make sure you have installed yarn since RedwoodJS relies on it to [manage its packages in workspaces](https://classic.yarnpkg.com/lang/en/docs/workspaces/) for its `web` and `api` "sides."
### Initialize a RedwoodJS app
@@ -428,7 +428,7 @@ export default Account
```
You'll see the use of `useAuth()` several times. Redwood's `useAuth` hook provides convenient ways to access
logIn, logOut, currentUser, and access the `supabase` authenticate client. We'll use it to get an instance
`logIn`, `logOut`, `currentUser`, and access the `supabase` authenticate client. We'll use it to get an instance
of the supabase client to interact with your API.
### Update home page
@@ -90,7 +90,7 @@ VITE_SUPABASE_URL=YOUR_SUPABASE_URL
VITE_SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
```
The `supabaseClient` will be used in fetch calls to Supabase endpoints from our app. As we'll see below, the client is instrumental in implementing authentication using refine's auth provider methods and CRUD actions with appropriate data provider methods.
The `supabaseClient` will be used in fetch calls to Supabase endpoints from our app. As we'll see below, the client is instrumental in implementing authentication using Refine's auth provider methods and CRUD actions with appropriate data provider methods.
One optional step is to update the CSS file `src/App.css` to make the app look nice.
You can find the full contents of this file [here](https://raw.githubusercontent.com/supabase/supabase/master/examples/user-management/refine-user-management/src/App.css).
@@ -404,7 +404,7 @@ Notice above that, we are using three refine hooks, namely the [`useGetIdentity(
`useForm()`, in contrast, is a data hook that exposes a series of useful objects that serve the edit form. For example, we are grabbing the `onFinish` function to submit the form with the `handleSubmit` event handler. We are also using `formLoading` property to present state changes of the submitted form.
The `useForm()` hook is a higher-level hook built on top of refine's `useForm()` core hook. It fully supports form state management, field validation and submission using React Hook Form. Behind the scenes, it invokes the `dataProvider.getOne` method to get the user profile data from our Supabase `/profiles` endpoint and also invokes `dataProvider.update` method when `onFinish()` is called.
The `useForm()` hook is a higher-level hook built on top of Refine's `useForm()` core hook. It fully supports form state management, field validation and submission using React Hook Form. Behind the scenes, it invokes the `dataProvider.getOne` method to get the user profile data from our Supabase `/profiles` endpoint and also invokes `dataProvider.update` method when `onFinish()` is called.
### Launch!
@@ -228,7 +228,7 @@ Add the `Auth` component to your home page
</div>
```
Create a `src/routes/+page.server.ts` file that will return our website url to be used in our `redirectTo` above.
Create a `src/routes/+page.server.ts` file that will return our website URL to be used in our `redirectTo` above.
```ts
// src/routes/+page.server.ts
+7 -9
View File
@@ -120,7 +120,13 @@ called `supabase_realtime`, and by managing this publication you can control whi
## Examples
<div className="grid md:grid-cols-12 gap-4 not-prose">
{examples.map((x) => (
{[
{
name: 'Multiplayer.dev',
description: 'Mouse movements and chat messages.',
href: 'https://multiplayer.dev',
},
].map((x) => (
<div className="col-span-12" key={x.href}>
<Link href={x.href} passHref>
<GlassPanel title={x.name}>{x.description}</GlassPanel>
@@ -129,14 +135,6 @@ called `supabase_realtime`, and by managing this publication you can control whi
))}
</div>
export const examples = [
{
name: 'Multiplayer.dev',
description: 'Mouse movements and chat messages.',
href: 'https://multiplayer.dev',
},
]
## Resources
Find the source code and documentation in the Supabase GitHub repository.
+2
View File
@@ -4,6 +4,8 @@ description: 'Resources for getting started building with Supabase.'
hideToc: true
---
{/* <!-- vale off --> */}
<div className="flex flex-col gap-12 my-12">
<div>
@@ -57,7 +57,7 @@ You should change these credentials as soon as possible using the [instructions]
### Accessing the APIs
Each of the APIs are available through the the same API gateway:
Each of the APIs are available through the same API gateway:
- REST: `http://<your-ip>:8000/rest/v1/`
- Auth: `http://<your-domain>:8000/auth/v1/`
@@ -243,7 +243,7 @@ Each system can be [configured](../self-hosting#configuration) independently. So
#### Configuring an email server
You will need to use a production-ready SMTP server for sending emails. You can configure the SMTP server by updating the the following environment variables:
You will need to use a production-ready SMTP server for sending emails. You can configure the SMTP server by updating the following environment variables:
```sh .env
SMTP_ADMIN_EMAIL=
@@ -318,8 +318,6 @@ docker rm supabase-analytics
---
{/* Finish with a video. This also appears in the Sidebar via the "tocVideo" metadata */}
## Demo
A minimal setup working on Ubuntu, hosted on Digital Ocean.
+4 -1
View File
@@ -1,5 +1,5 @@
extends: conditional
message: "Spell out '%s', if it's unfamiliar to the audience."
message: "The first instance of '%s' should be spelled out, followed by the acronym in brackets. For example: 'Data Definition Language (DDL)'"
link: 'https://developers.google.com/style/abbreviations'
level: suggestion
ignorecase: false
@@ -9,6 +9,7 @@ second: '(?:\b[A-Z][a-z]+ )+\(([A-Z]{3,5})\)'
# ... with the exception of these:
exceptions:
- API
- ARM
- ASP
- CLI
- CPU
@@ -20,6 +21,7 @@ exceptions:
- FAQ
- GCC
- GDB
- GDPR
- GET
- GPT
- GPU
@@ -61,6 +63,7 @@ exceptions:
- URI
- URL
- USB
- USD
- UTF
- XML
- XSS
+11
View File
@@ -0,0 +1,11 @@
extends: substitution
message: "Captalize this to make it a proper noun: '%s' -> '%s'"
link: 'https://developers.google.com/style/word-list'
level: warning
ignorecase: false
action:
name: replace
swap:
auth hooks?: Auth Hooks?
edge functions?: Edge Functions?
'role[- ]?based access control: Role-Based Access Control
-12
View File
@@ -1,12 +0,0 @@
extends: existence
message: "Don't use exclamation points in text."
link: "https://developers.google.com/style/exclamation-points"
nonword: true
level: error
action:
name: edit
params:
- trim_right
- "!"
tokens:
- '\w+!(?:\s|$)'
+12
View File
@@ -0,0 +1,12 @@
extends: existence
message: "Don't use '%s'. The sentence is more concise and/or the tone is more neutral without it."
ignorecase: true
level: error
tokens:
- easily
- easy
- just
- please
- simple
- simply
- that's it
+2 -1
View File
@@ -4,4 +4,5 @@ link: 'https://developers.google.com/style/parentheses'
nonword: true
level: suggestion
tokens:
- '\(.+\)'
# Ignore acronym definitions
- '\([^A-Z]+\)'
-7
View File
@@ -1,7 +0,0 @@
extends: existence
message: "Avoid using '%s'."
link: 'https://developers.google.com/style/tense'
ignorecase: true
level: warning
tokens:
- will
+25 -16
View File
@@ -1,40 +1,42 @@
extends: substitution
message: "Use '%s' instead of '%s'."
link: "https://developers.google.com/style/word-list"
link: 'https://developers.google.com/style/word-list'
level: warning
ignorecase: false
action:
name: replace
swap:
"(?:API Console|dev|developer) key": API key
"(?:cell ?phone|smart ?phone)": phone|mobile phone
"(?:dev|developer|APIs) console": API console
"(?:e-mail|Email|E-mail)": email
"(?:file ?path|path ?name)": path
"(?:kill|terminate|abort)": stop|exit|cancel|end
"(?:OAuth ?2|Oauth)": OAuth 2.0
"(?:ok|Okay)": OK|okay
"(?:WiFi|wifi)": Wi-Fi
"(?i)postgresql": Postgres
"(?i)repository": repo
'(?:API Console|dev|developer) key': API key
'(?:cell ?phone|smart ?phone)': phone|mobile phone
'(?:dev|developer|APIs) console': API console
'(?:e-mail|Email|E-mail)': email
'(?:file ?path|path ?name)': path
'(?:kill|terminate|abort)': stop|exit|cancel|end
'(?:Nginx|nginx)': NGINX
'(?:OAuth ?2|Oauth)': OAuth 2.0
'(?:ok|Okay)': OK|okay
'(?:WiFi|wifi)': Wi-Fi
'(?i)postgresql': Postgres
'(?i)repository': repo
'[\.]+apk': APK
'3\-D': 3D
'Google (?:I\-O|IO)': Google I/O
"tap (?:&|and) hold": touch & hold
"un(?:check|select)": clear
'Next(?:js)?': Next.js (if referring to the framework)
'tap (?:&|and) hold': touch & hold
'un(?:check|select)': clear
'utili[sz](?:e[ds]|ing)': use, used, uses, etc.
above: preceding
account name: username
action bar: app bar
admin: administrator
Ajax: AJAX
a\.k\.a|aka: or|also known as
Android device: Android-powered device
android: Android
API explorer: APIs Explorer
application: app
approx\.: approximately
authN: authentication
authZ: authorization
autogenerated: auto-generated
autoupdate: automatically update
cellular data: mobile data
cellular network: mobile network
@@ -54,10 +56,12 @@ swap:
file name: filename
firewalls: firewall rules
functionality: capability|feature
Github: GitHub
Google account: Google Account
Google accounts: Google Accounts
Googling: search with Google
grayed-out: unavailable
head over to: go to|see
HTTPs: HTTPS
in order to: to
ingest: import|load
@@ -68,9 +72,14 @@ swap:
open-source: open source
overview screen: recents screen
regex: regular expression
refer to: see
serverside: server-side
SHA1: SHA-1|HAS-SHA1
sign into: sign in to
sign-ins?: signin(s) (noun) or sign in (verb)
sign-?on: single sign-on
sign-outs?: signout(s) (noun) or sign out (verb)
sign-ups?: signup(s) (noun) or sign up (verb)
static IP address: static external IP address
stylesheet: style sheet
synch: sync
@@ -1,18 +1,82 @@
APIs
[Aa]uth
Berri
[Cc]hatbots?
ChatGPT
Clippy
Colab
[Cc]omposable
CPUs?
[Dd]eclarative(ly)?
[Dd]eduplicat(e|ion)
[Dd]eeplinks?
[Dd]egit
[Dd]eserializ(e|ed|es|ing)
Deno
[Dd]ev
[Dd]otenv
[Ee]nv
[Ee]nums?
Firestore
Hashicorp
[Gg]eospatial
GPUs?
Gradle
GraphQL
Groonga
href
Infisical
IVFFlat
JetBrains
Jetpack
JWTs
Lua
Markprompt
[Mm]iddleware
[Nn]amespace(d|s)?
Next.js
Nuxt
OAuth
OpenAI
[Pp]ackageable
[Pp]asscodes?
[Pp]asswordless
[Pp]erformant
PGAudit
PGroonga
pgvector
Postgres
Pinecone
plpgsql
[Pp]olyfill(s|ed)?
[Pp]ooler
[Pp]ostgres
[Pp]rebuild
Prisma
[Rr]ealtime
Refine's
[Rr]eindex(ed|es|ing)?
repo
RESTful
[Rr]evalidated?
Roboflow
[Ss]crollable
[Ss]erializ(e|ed|es|ing)
[Ss]igncryption
[Ss]ignins?
[Ss]ignouts?
[Ss]ignups?
SQLAlchemy
Supabase
[Uu]psert
[Ss]upabase
Supavisor
[Ss]upersets?
Terraform
[Tt]odos?
[Uu]npaus(e|es|ed|ing)
[Uu]psert(s|ed|ing)?
[Uu]pvot(es|ed|ing)
Vercel
Vite
VSCode
Vue
[Ww]eb[Ss]ockets?
Xcode