The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Rename js_v2.yml file
dannykngc126cef022a5
diff --git a/apps/docs/package.json b/apps/docs/package.jsonindex 49c24da1863..34a0cf4f481 100644--- a/apps/docs/package.json+++ b/apps/docs/package.json@@ -28,7 +28,7 @@"gen:supabase-js:v1": "npm-run-all gen:supabase-js:v1:ref","gen:supabase-js:v1:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v1.yml --output ./docs/reference/javascript/v1/generated","gen:supabase-js:v2": "npm-run-all gen:supabase-js:v2:ref",- "gen:supabase-js:v2:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v2_temp.yml --output ./docs/reference/javascript/generated"+ "gen:supabase-js:v2:ref": "ts-node ./generator/index.ts gen --type legacy --input ../../spec/supabase_js_v2.yml --output ./docs/reference/javascript/generated"},"dependencies": {"@algolia/autocomplete-js": "^1.7.2",diff --git a/spec/supabase_js_v2.yml b/spec/supabase_js_v2.ymlindex 070741bb0b8..40d534300f0 100644--- a/spec/supabase_js_v2.yml+++ b/spec/supabase_js_v2.yml@@ -333,14 +333,14 @@ pages:title: 'setSession()'$ref: '@supabase/gotrue-js.GoTrueClient.setSession'notes: |- - `setSession()` takes in a refresh token and access token and uses it to get a new session.+ - `setSession()` takes in a refresh token and access token to get a new session.- The refresh token can only be used once to obtain a new session.- [Refresh token rotation](/docs/reference/auth/config#refresh_token_rotation_enabled) is enabled by default on all projects to guard against replay attacks.- You can configure the [`REFRESH_TOKEN_REUSE_INTERVAL`](https://supabase.com/docs/reference/auth/config#refresh_token_reuse_interval) which provides a short window in which the same refresh token can be used multiple times in the event of concurrency or offline issues.- If you are using React Native, you will need to install a Buffer polyfill via a library such as [rn-nodeify](https://github.com/tradle/rn-nodeify) to properly use the library.examples:- name: Set the session- description: Sets the session data from a refresh_token and access_token and returns current session or an error if the tokens are invalid.+ description: Sets the session data from a `refresh_token` and `access_token` and returns the current session or an error if the tokens are invalid.isSpotlight: truejs: |```js@@ -692,8 +692,8 @@ pages:examples:- name: Getting your datadescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -707,8 +707,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -716,8 +716,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -740,7 +740,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -754,8 +754,8 @@ pages:description: |You can select specific fields from your tables.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -769,8 +769,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -778,8 +778,8 @@ pages:.select('name')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -799,15 +799,15 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Query foreign tablesdescription: |If your database has foreign key relationships, you can query related tables too.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -831,8 +831,8 @@ pages:(2, 1, 'Munich');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -845,8 +845,8 @@ pages:`)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -873,7 +873,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Query foreign tables through a join table@@ -883,8 +883,8 @@ pages:the `select()` method to query the related data. The join table needsto have the foreign keys as part of its composite primary key.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -924,8 +924,8 @@ pages:(2, 2);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -938,8 +938,8 @@ pages:`)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -969,7 +969,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Query the same foreign table multiple times@@ -978,8 +978,8 @@ pages:joined column to identify which join to use. You can also give eachcolumn an alias.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1004,8 +1004,8 @@ pages:(1, 2, '👋');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1017,8 +1017,8 @@ pages:`)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1038,7 +1038,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Filtering through foreign tables@@ -1046,8 +1046,8 @@ pages:If the filter on a foreign table's column is not satisfied, the foreigntable returns `[]` or `null` but the parent table is not filtered out.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1071,8 +1071,8 @@ pages:(2, 1, 'Munich');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1081,8 +1081,8 @@ pages:.eq('countries.name', 'Estonia')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1101,13 +1101,13 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>If you want to filter out the parent table rows, use the `!inner` hint:- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1116,8 +1116,8 @@ pages:.eq('countries.name', 'Estonia')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1127,7 +1127,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Querying with count option@@ -1136,8 +1136,8 @@ pages:[count](/docs/reference/javascript/select#parameters) option. Forexample, to get the table count without returning all rows:- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1151,8 +1151,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { count, error } = await supabase@@ -1160,8 +1160,8 @@ pages:.select('*', { count: 'exact', head: true })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1171,7 +1171,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Querying JSON data@@ -1181,8 +1181,8 @@ pages:[operators](/docs/guides/database/json#query-the-jsonb-data) forquerying JSON data.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1198,8 +1198,8 @@ pages:(1, 'Avdotya', '{"city":"Saint Petersburg"}');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1210,8 +1210,8 @@ pages:`)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1227,7 +1227,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -1237,16 +1237,16 @@ pages:examples:- name: Create a recorddescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate tablecountries (id int8 primary key, name text);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { error } = await supabase@@ -1254,8 +1254,8 @@ pages:.insert({ id: 1, name: 'Denmark' })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1263,11 +1263,11 @@ pages:"statusText": "Created"}```- </TabItem>+ </TabPanel></Tabs>- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1275,8 +1275,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1291,7 +1291,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -1303,16 +1303,16 @@ pages:```- name: Create a record and return itdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate tablecountries (id int8 primary key, name text);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1321,8 +1321,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1337,7 +1337,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Bulk create@@ -1345,16 +1345,16 @@ pages:A bulk create operation is handled in a single transaction.If any of the inserts fail, none of the rows are inserted.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate tablecountries (id int8 primary key, name text);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { error } = await supabase@@ -1365,8 +1365,8 @@ pages:])```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1381,11 +1381,11 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1393,8 +1393,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1404,7 +1404,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -1416,8 +1416,8 @@ pages:examples:- name: Updating your datadescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1429,8 +1429,8 @@ pages:(1, 'Taiwan');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { error } = await supabase@@ -1439,8 +1439,8 @@ pages:.eq('id', 1)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1449,11 +1449,11 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1461,8 +1461,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1477,7 +1477,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -1490,8 +1490,8 @@ pages:```- name: Update a record and return itdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1503,8 +1503,8 @@ pages:(1, 'Taiwan');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1514,8 +1514,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1530,7 +1530,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Updating JSON data@@ -1539,8 +1539,8 @@ pages:[operators](/docs/guides/database/json#query-the-jsonb-data) forworking with JSON data.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1556,8 +1556,8 @@ pages:(1, 'Michael', '{ "postcode": 90210 }');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1572,8 +1572,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1592,7 +1592,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>Currently, it is only possible to update the entire JSON document.@@ -1606,8 +1606,8 @@ pages:examples:- name: Upsert your datadescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1619,8 +1619,8 @@ pages:(1, 'Afghanistan');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1629,8 +1629,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1645,7 +1645,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -1658,8 +1658,8 @@ pages:```- name: Bulk Upsert your datadescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1671,8 +1671,8 @@ pages:(1, 'Afghanistan');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1684,8 +1684,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1704,7 +1704,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Upserting into tables with constraints@@ -1714,8 +1714,8 @@ pages:row with the same `id`, `upsert()` inserts a new row, whichwill fail in this case as there is already a row with `handle` `"saoirse"`.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1731,8 +1731,8 @@ pages:(1, 'saoirse', null);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1741,8 +1741,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1757,14 +1757,14 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>Using the `onConflict` option, you can instruct `upsert()` to useanother column with a unique constraint to determine conflicts:- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsawait supabase@@ -1778,8 +1778,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1795,7 +1795,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -1812,8 +1812,8 @@ pages:examples:- name: Delete recordsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -1825,8 +1825,8 @@ pages:(1, 'Spain');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { error } = await supabase@@ -1835,8 +1835,8 @@ pages:.eq('id', 1)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1845,11 +1845,11 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -1857,8 +1857,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1868,7 +1868,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -1895,8 +1895,8 @@ pages:examples:- name: Call a Postgres function without argumentsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate function hello_world() returns text as $$@@ -1904,15 +1904,15 @@ pages:$$ language sql;```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase.rpc('hello_world')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1922,7 +1922,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -1932,8 +1932,8 @@ pages:```- name: Call a Postgres function with argumentsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate function echo(say text) returns text as $$@@ -1941,15 +1941,15 @@ pages:$$ language sql;```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase.rpc('echo', { say: '👋' })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1959,15 +1959,15 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Bulk processingdescription: |You can process large payloads by passing in an array as an argument:- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate function add_one_each(arr int[]) returns int[] as $$@@ -1975,15 +1975,15 @@ pages:$$ language sql;```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase.rpc('add_one_each', { arr: [1, 2, 3] })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -1997,7 +1997,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Call a Postgres function with filters@@ -2006,8 +2006,8 @@ pages:[Filters](/docs/reference/javascript/using-filters) and[Modifiers](/docs/reference/javascript/using-modifiers).- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2024,8 +2024,8 @@ pages:$$ language sql;```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2034,8 +2034,8 @@ pages:.single()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2048,7 +2048,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -2113,8 +2113,8 @@ pages:### Filter by values within a JSON column- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2131,8 +2131,8 @@ pages:(2, 'Jane', null);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2141,8 +2141,8 @@ pages:.eq('address->postcode', 90210)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2160,7 +2160,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>### Filter Foreign Tables@@ -2168,8 +2168,8 @@ pages:You can filter on foreign tables in your `select()` query using dotnotation:- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2193,8 +2193,8 @@ pages:(2, 1, 'Munich');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2208,8 +2208,8 @@ pages:.eq('cities.name', 'Bali')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2228,7 +2228,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>eq():@@ -2236,8 +2236,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2251,8 +2251,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2261,8 +2261,8 @@ pages:.eq('name', 'Albania')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2277,7 +2277,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2294,8 +2294,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2309,8 +2309,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2319,8 +2319,8 @@ pages:.neq('name', 'Albania')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2339,7 +2339,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2356,8 +2356,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2371,8 +2371,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2381,8 +2381,8 @@ pages:.gt('id', 2)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2397,7 +2397,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2414,8 +2414,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2429,8 +2429,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2439,8 +2439,8 @@ pages:.gte('id', 2)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2459,7 +2459,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2476,8 +2476,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2491,8 +2491,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2501,8 +2501,8 @@ pages:.lt('id', 2)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2517,7 +2517,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2534,8 +2534,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2549,8 +2549,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2559,8 +2559,8 @@ pages:.lte('id', 2)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2579,7 +2579,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2596,8 +2596,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2611,8 +2611,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2621,8 +2621,8 @@ pages:.like('name', '%Alba%')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2637,7 +2637,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2654,8 +2654,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2669,8 +2669,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2679,8 +2679,8 @@ pages:.like('name', '%alba%')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2695,7 +2695,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2712,10 +2712,10 @@ pages:examples:- name: Checking nullnessdescription: |- Using the `eq()` filter doesn't work when filtering for `null`, `true`, or `false`:+ Using the `eq()` filter doesn't work when filtering for `null`:- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2728,8 +2728,8 @@ pages:(2, null);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2738,8 +2738,8 @@ pages:.eq('name', null)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2754,13 +2754,13 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>Instead, you need to use `is()`:- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2769,8 +2769,8 @@ pages:.is('name', null)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2785,7 +2785,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2802,8 +2802,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2817,8 +2817,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2827,8 +2827,8 @@ pages:.in('name', ['Albania', 'Algeria'])```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2847,7 +2847,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2864,8 +2864,8 @@ pages:examples:- name: On array columnsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2882,8 +2882,8 @@ pages:(2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2892,8 +2892,8 @@ pages:.contains('tags', ['is:open', 'severity:high'])```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2907,7 +2907,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -2925,8 +2925,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2943,8 +2943,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -2953,8 +2953,8 @@ pages:.contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -2970,13 +2970,13 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: On `jsonb` columnsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -2993,8 +2993,8 @@ pages:(2, 'Jane', '{}');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3003,8 +3003,8 @@ pages:.contains('address', { postcode: 90210 })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3018,7 +3018,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -3027,8 +3027,8 @@ pages:examples:- name: On array columnsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3045,8 +3045,8 @@ pages:(2, 'History', array['monday', 'wednesday', 'thursday']);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3055,8 +3055,8 @@ pages:.containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3070,7 +3070,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3088,8 +3088,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3106,8 +3106,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3116,8 +3116,8 @@ pages:.containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3133,13 +3133,13 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: On `jsonb` columnsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3156,8 +3156,8 @@ pages:(2, 'Jane', '{}');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3166,8 +3166,8 @@ pages:.containedBy('address', {})```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3181,7 +3181,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -3195,8 +3195,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3213,8 +3213,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3223,8 +3223,8 @@ pages:.rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3240,7 +3240,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3262,8 +3262,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3280,8 +3280,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3290,8 +3290,8 @@ pages:.rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3307,7 +3307,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3329,8 +3329,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3347,8 +3347,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3357,8 +3357,8 @@ pages:.rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3374,7 +3374,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3396,8 +3396,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3414,8 +3414,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3424,8 +3424,8 @@ pages:.rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3441,7 +3441,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3463,8 +3463,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3481,8 +3481,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3491,8 +3491,8 @@ pages:.rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3508,7 +3508,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3525,8 +3525,8 @@ pages:examples:- name: On array columnsdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3543,8 +3543,8 @@ pages:(2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3553,8 +3553,8 @@ pages:.overlaps('tags', ['is:closed', 'severity:high'])```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3568,7 +3568,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3586,8 +3586,8 @@ pages:can filter on range columns using the string representation of rangevalues.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3604,8 +3604,8 @@ pages:(2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3614,8 +3614,8 @@ pages:.overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3631,7 +3631,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -3702,8 +3702,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3717,8 +3717,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3727,8 +3727,8 @@ pages:.match({ id: 2, name: 'Albania' })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3742,7 +3742,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3766,8 +3766,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3780,8 +3780,8 @@ pages:(2, null);```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3790,8 +3790,8 @@ pages:.not('name', 'is', null)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3806,7 +3806,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3830,8 +3830,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3845,8 +3845,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3855,8 +3855,8 @@ pages:.or('id.eq.2,name.eq.Algeria')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3873,7 +3873,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -3886,8 +3886,8 @@ pages:```- name: Use `or` with `and`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3901,8 +3901,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3911,8 +3911,8 @@ pages:.or('id.gt.3,and(id.eq.1,name.eq.Afghanistan)')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json@@ -3927,13 +3927,13 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true- name: Use `or` on foreign tablesdescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -3957,8 +3957,8 @@ pages:(2, 1, 'Munich');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -3972,8 +3972,8 @@ pages:.or('country_id.eq.1,name.eq.Beijing', { foreignTable: 'cities' })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -3992,7 +3992,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -4008,8 +4008,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4023,8 +4023,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4033,8 +4033,8 @@ pages:.filter('name', 'in', '("Algeria","Japan")')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4049,7 +4049,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4062,8 +4062,8 @@ pages:```- name: On a foreign tabledescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4087,8 +4087,8 @@ pages:(2, 1, 'Munich');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4102,8 +4102,8 @@ pages:.filter('cities.name', 'eq', 'Bali')```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4122,7 +4122,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: truejs: |@@ -4155,8 +4155,8 @@ pages:examples:- name: With `upsert()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4168,8 +4168,8 @@ pages:(1, 'Afghanistan');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4177,8 +4177,8 @@ pages:.upsert({ id: 1, name: 'Albania' })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4187,11 +4187,11 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>- <Tabs>- <TabItem default value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4200,8 +4200,8 @@ pages:.select()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4216,7 +4216,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4233,8 +4233,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4248,8 +4248,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4258,8 +4258,8 @@ pages:.order('name', { ascending: false })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4282,7 +4282,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4298,8 +4298,8 @@ pages:Ordering on foreign tables doesn't affect the ordering ofthe parent table.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4323,8 +4323,8 @@ pages:(2, 1, 'New York City');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4338,8 +4338,8 @@ pages:.order('name', { foreignTable: 'cities', ascending: false })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4365,7 +4365,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -4374,8 +4374,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4389,8 +4389,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4399,8 +4399,8 @@ pages:.limit(1)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4414,7 +4414,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4427,8 +4427,8 @@ pages:```- name: On a foreign tabledescription: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4451,8 +4451,8 @@ pages:(2, 1, 'New York City');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4466,8 +4466,8 @@ pages:.limit(1, { foreignTable: 'cities' })```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4486,7 +4486,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: true@@ -4495,8 +4495,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4510,8 +4510,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4520,8 +4520,8 @@ pages:.range(0, 1)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4538,7 +4538,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4558,8 +4558,8 @@ pages:description: |You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled.- <Tabs>- <TabItem value="js" label="JavaScript">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="js">+ <TabPanel id="js" label="JavaScript">```tsconst ac = new AbortController()@@ -4570,8 +4570,8 @@ pages:.abortSignal(ac.signal)```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4586,7 +4586,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4605,8 +4605,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4620,8 +4620,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4631,8 +4631,8 @@ pages:.single()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4644,7 +4644,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4662,8 +4662,8 @@ pages:examples:- name: With `select()`description: |- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4677,8 +4677,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4688,8 +4688,8 @@ pages:.maybeSingle()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4698,7 +4698,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: true@@ -4719,8 +4719,8 @@ pages:description: |By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.- <Tabs>- <TabItem value="schema" label="Schema">+ <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">+ <TabPanel id="schema" label="Schema">```sqlcreate table@@ -4734,8 +4734,8 @@ pages:(3, 'Algeria');```- </TabItem>- <TabItem default value="js" label="JavaScript">+ </TabPanel>+ <TabPanel id="js" label="JavaScript">```tsconst { data, error } = await supabase@@ -4744,8 +4744,8 @@ pages:.csv()```- </TabItem>- <TabItem value="result" label="Result">+ </TabPanel>+ <TabPanel id="result" label="Result">```json{@@ -4755,7 +4755,7 @@ pages:}```- </TabItem>+ </TabPanel></Tabs>hideCodeBlock: trueisSpotlight: truediff --git a/spec/supabase_js_v2_temp.yml b/spec/supabase_js_v2_temp.ymldeleted file mode 100644index 40d534300f0..00000000000--- a/spec/supabase_js_v2_temp.yml+++ /dev/null@@ -1,5390 +0,0 @@-openref: 0.1--info:- id: reference/supabase-js- title: Supabase Client- description: |-- Supabase JavaScript.-- definition: ../../spec/enrichments/tsdoc_v2/combined.json- specUrl: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2.yml- slugPrefix: '/'- libraries:- - name: 'JavaScript'- id: 'js'- version: '0.0.1'--pages:- Initializing:- $ref: '@supabase/supabase-js.index.SupabaseClient.constructor'- description: |- You can initialize a new Supabase client using the `createClient()` method.-- The Supabase client is your entrypoint to the rest of the Supabase functionality- and is the easiest way to interact with everything we offer within the Supabase ecosystem.-- examples:- - name: createClient()- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- // Create a single supabase client for interacting with your database- const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')- ```- - name: With additional parameters- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- const options = {- db: {- schema: 'public',- },- auth: {- autoRefreshToken: true,- persistSession: true,- detectSessionInUrl: true- },- global: {- headers: { 'x-my-custom-header': 'my-app-name' },- },- }- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", options)- ```- - name: API schemas- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- // Provide a custom schema. Defaults to "public".- const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {- db: { schema: 'other_schema' }- })- ```-- By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.- Go to `Settings > API > Schema` and add the schema which you want to expose to the API.-- Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.- - name: Custom `fetch` implementation- js: |- ```js- import { createClient } from '@supabase/supabase-js'-- const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key', {- global: { fetch: fetch.bind(globalThis) }- })- ```-- `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests,- but an alternative `fetch` implementation can be provided as an option.- This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers).- - name: React Native options- js: |- ```js- import { createClient } from '@supabase/supabase-js'- import AsyncStorage from "@react-native-async-storage/async-storage";-- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key", {- auth: {- storage: AsyncStorage,- autoRefreshToken: true,- persistSession: true,- detectSessionInUrl: false,- },- });- ```-- For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth.- auth.signUp():- title: 'signUp()'- $ref: '@supabase/gotrue-js.GoTrueClient.signUp'- notes: |- - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](https://app.supabase.com/project/_/auth/settings).- - **Confirm email** determines if users need to confirm their email address after signing up.- - If **Confirm email** is enabled, a `user` is returned but `session` is null.- - If **Confirm email** is disabled, both a `user` and a `session` are returned.- - When the user confirms their email address, they are redirected to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](https://app.supabase.com/project/_/auth/settings).- - If signUp() is called for an existing confirmed user:- - If **Confirm email** is enabled in [your project](https://app.supabase.com/project/_/auth/settings), an obfuscated/fake user object is returned.- - If **Confirm email** is disabled, the error message, `User already registered` is returned.- - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).- examples:- - name: Sign up.- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.signUp({- email: '[email protected]',- password: 'example-password',- })- ```- - name: Sign up with additional user metadata.- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.signUp(- {- email: '[email protected]',- password: 'example-password',- options: {- data: {- first_name: 'John',- age: 27,- }- }- }- )- ```- auth.signInWithPassword():- title: 'signInWithPassword()'- $ref: '@supabase/gotrue-js.GoTrueClient.signInWithPassword'- notes: |- - Requires either an email and password or a phone number and password.- examples:- - name: Sign in with email and password- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.signInWithPassword({- email: '[email protected]',- password: 'example-password',- })- ```- - name: Sign in with phone and password- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.signInWithPassword({- phone: '+13334445555',- password: 'some-password',- })-- // After receiving a SMS with a OTP.- const { data, error } = await supabase.auth.verifyOtp({- phone: '+13334445555',- token: '123456',- })- ```- auth.signInWithOtp():- title: 'signInWithOtp()'- $ref: '@supabase/gotrue-js.GoTrueClient.signInWithOtp'- notes: |- - Requires either an email or phone number.- - This method is used for passwordless sign-ins where a OTP is sent to the user's email or phone number.- - If you're using an email, you can configure whether you want the user to receive a magiclink or a OTP.- - If you're using phone, you can configure whether you want the user to receive a OTP.- - The magic link's destination URL is determined by the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings).- examples:- - name: Sign in with email.- isSpotlight: true- description: The user will be sent an email which contains either a magiclink or a OTP or both. By default, a given user can only request a OTP once every 60 seconds.- js: |- ```js- const { data, error } = await supabase.auth.signInWithOtp({- email: '[email protected]',- })- ```- - name: Sign in with SMS OTP.- isSpotlight: false- description: The user will be sent a SMS which contains a OTP. By default, a given user can only request a OTP once every 60 seconds.- js: |- ```js- const { data, error } = await supabase.auth.signInWithOtp({- phone: '+13334445555',- })- ```- auth.signInWithOAuth():- title: 'signInWithOAuth()'- $ref: '@supabase/gotrue-js.GoTrueClient.signInWithOAuth'- notes: |- - This method is used for signing in using a third-party provider.- - Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).- examples:- - name: Sign in using a third-party provider- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.signInWithOAuth({- provider: 'github'- })- ```- - name: Sign in using a third-party provider with redirect- isSpotlight: false- description: |- When the third-party provider successfully authenticates the user, the provider will redirect the user to the URL specified in the `redirectTo` parameter. This parameter defaults to the [`SITE_URL`](https://supabase.com/docs/reference/auth/config#site_url). It does not redirect the user immediately after invoking this method.- You can modify the `SITE_URL` or add additional redirect urls in [your project](https://app.supabase.com/project/_/auth/settings).- js: |- ```js- const { data, error } = await supabase.auth.signInWithOAuth({- provider: 'github'- options: {- redirectTo: 'https://example.com/welcome'- }- }- ```- - name: Sign in with scopes- isSpotlight: false- description: |- If you need additional data from an OAuth provider, you can include a space-separated list of scopes in your request to get back an OAuth provider token.- You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider. The list of scopes will be documented by the third-party provider you are using and specifying scopes will enable you to use the OAuth provider token to call additional APIs supported by the third-party provider to get more information.- js: |- ```js- const { data, error } = await supabase.auth.signInWithOAuth({- provider: 'github'- options: {- scopes: 'repo gist notifications'- }- })- const oAuthToken = data.session.provider_token // use to access provider API- ```- auth.signOut():- title: 'signOut()'- $ref: '@supabase/gotrue-js.GoTrueClient.signOut'- notes: |- - In order to use the `signOut()` method, the user needs to be signed in first.- examples:- - name: Sign out- isSpotlight: true- js: |- ```js- const { error } = await supabase.auth.signOut()- ```- auth.verifyOtp():- title: 'verifyOtp()'- $ref: '@supabase/gotrue-js.GoTrueClient.verifyOtp'- notes: |- - The `verifyOtp` method takes in different verification types. If a phone number is used, the type can either be `sms` or `phone_change`. If an email address is used, the type can be one of the following: `signup`, `magiclink`, `recovery`, `invite` or `email_change`.- - The verification type used should be determined based on the corresponding auth method called before `verifyOtp` to sign up / sign-in a user.- examples:- - name: Verify Sms One-Time Password (OTP)- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.verifyOtp({ phone, token, type: 'sms'})- ```- - name: Verify Signup One-Time Password (OTP)- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.verifyOtp({ email, token, type: 'signup'})- ```- auth.getSession():- title: 'getSession()'- $ref: '@supabase/gotrue-js.GoTrueClient.getSession'- examples:- - name: Get the session data- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.getSession()- ```- auth.getUser():- title: 'getUser()'- $ref: '@supabase/gotrue-js.GoTrueClient.getUser'- notes: |- - This method gets the user object from the current session.- - Fetches the user object from the database instead of local session.- examples:- - name: Get the logged in user with the current existing session- isSpotlight: true- js: |- ```js- const { data: { user } } = await supabase.auth.getUser()- ```- - name: Get the logged in user with a custom access token jwt.- isSpotlight: false- js: |- ```js- const { data: { user } } = await supabase.auth.getUser(jwt)- ```- auth.updateUser():- title: 'updateUser()'- $ref: '@supabase/gotrue-js.GoTrueClient.updateUser'- notes: |- - In order to use the `updateUser()` method, the user needs to be signed in first.- - By Default, email updates sends a confirmation link to both the user's current and new email.- To only send a confirmation link to the user's new email, disable **Secure email change** in your project's [email auth provider settings](https://app.supabase.com/project/_/auth/settings).- examples:- - name: Update the email for an authenticated user- description: Sends a "Confirm Email Change" email to the new email address.- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.updateUser({email: '[email protected]'})- ```- - name: Update the password for an authenticated user- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.updateUser({password: 'new password'})- ```- - name: Update the user's metadata- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.updateUser({- data: { hello: 'world' }- })- ```- auth.setSession():- title: 'setSession()'- $ref: '@supabase/gotrue-js.GoTrueClient.setSession'- notes: |- - `setSession()` takes in a refresh token and access token to get a new session.- - The refresh token can only be used once to obtain a new session.- - [Refresh token rotation](/docs/reference/auth/config#refresh_token_rotation_enabled) is enabled by default on all projects to guard against replay attacks.- - You can configure the [`REFRESH_TOKEN_REUSE_INTERVAL`](https://supabase.com/docs/reference/auth/config#refresh_token_reuse_interval) which provides a short window in which the same refresh token can be used multiple times in the event of concurrency or offline issues.- - If you are using React Native, you will need to install a Buffer polyfill via a library such as [rn-nodeify](https://github.com/tradle/rn-nodeify) to properly use the library.- examples:- - name: Set the session- description: Sets the session data from a `refresh_token` and `access_token` and returns the current session or an error if the tokens are invalid.- isSpotlight: true- js: |- ```js- const { data, error } = supabase.auth.setSession({refresh_token, access_token})- ```- auth.refreshSession():- title: 'refreshSession()'- $ref: '@supabase/gotrue-js.GoTrueClient.refreshSession'- notes: |- - This method will refresh the session whether the current one is expired or not.- - Both examples destructure `user` and `session` from `data`. This is not required; so `const { data, error } =` is also valid.- examples:- - name: Refresh session using the current session- isSpotlight: true- js: |- ```js- const { data: { user, session }, error } = await supabase.auth.refreshSession()- ```- - name: Refresh session using a passed-in session- isSpotlight: true- js: |- ```js- const { data: { user, session }, error } = await supabase.auth.refreshSession({ refresh_token })- ```- auth.onAuthStateChange():- title: 'onAuthStateChange()'- $ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange'- notes: |- - Types of auth events: `SIGNED_IN`, `SIGNED_OUT`, `TOKEN_REFRESHED`, `USER_UPDATED`, `USER_DELETED`, `PASSWORD_RECOVERY`- examples:- - name: Listen to auth changes- isSpotlight: true- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- console.log(event, session)- })- ```- - name: Listen to sign in- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'SIGNED_IN') console.log('SIGNED_IN', session)- })- ```- - name: Listen to sign out- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'SIGNED_OUT') console.log('SIGNED_OUT', session)- })- ```- - name: Listen to token refresh- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'TOKEN_REFRESHED') console.log('TOKEN_REFRESHED', session)- })- ```- - name: Listen to user updates- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'USER_UPDATED') console.log('USER_UPDATED', session)- })- ```- - name: Listen to user deleted- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'USER_DELETED') console.log('USER_DELETED', session)- })- ```- - name: Listen to password recovery events- js: |- ```js- supabase.auth.onAuthStateChange((event, session) => {- if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session)- })- ```- Supabase Auth Admin Api:- title: 'Overview'- notes: |- - Any method under the `supabase.auth.admin` namespace requires a `service_role` key.- - These methods are considered admin methods and should be called on a trusted server. Never expose your `service_role` key in the browser.-- auth.admin.getUserById():- title: 'getUserById()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.getUserById'- notes: |- - Fetches the user object from the database based on the user's id.- - The `getUserById()` method requires the user's id which maps to the `auth.users.id` column.- examples:- - name: Fetch the user object using the access_token jwt.- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.getUserById(1)- ```-- auth.admin.listUsers():- title: 'listUsers()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.listUsers'- examples:- - name: Get a full list of users.- isSpotlight: true- js: |- ```js- const { data: { users }, error } = await supabase.auth.admin.listUsers()- ```- auth.admin.createUser():- title: 'createUser()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.createUser'- notes: |- - To confirm the user's email address or phone number, set `email_confirm` or `phone_confirm` to true. Both arguments default to false.- examples:- - name: Create a new user with custom user metadata- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.createUser({- email: '[email protected]',- password: 'password',- user_metadata: { name: 'Yoda' }- })- ```- - name: Auto-confirm the user's email- js: |- ```js- const { data, error } = await supabase.auth.admin.createUser({- email: '[email protected]',- email_confirm: true- })- ```- - name: Auto-confirm the user's phone number- js: |- ```js- const { data, error } = await supabase.auth.admin.createUser({- phone: '1234567890',- phone_confirm: true- })- ```- auth.admin.deleteUser():- title: 'deleteUser()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.deleteUser'- notes: |- - The `deleteUser()` method requires the user's ID, which maps to the `auth.users.id` column.- examples:- - name: Removes a user- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.deleteUser(- '715ed5db-f090-4b8c-a067-640ecee36aa0'- )- ```-- auth.admin.inviteUserByEmail():- title: 'inviteUserByEmail()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.inviteUserByEmail'- notes: |- - Sends an invite link to the user's email address.- examples:- - name: Invite a user- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.inviteUserByEmail('[email protected]')- ```-- auth.resetPasswordForEmail():- title: 'resetPasswordForEmail()'- $ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail'- notes: |- Sends a password reset request to an email address.- When the user clicks the reset link in the email they are redirected back to your application.- Prompt the user for a new password and call `auth.updateUser()`:- ```js- const { data, error } = await supabase.auth- .updateUser({ password: new_password })- ```- examples:- - name: Reset password- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.resetPasswordForEmail(email, {- redirectTo: 'https://example.com/update-password',- })- ```- - name: Reset password (React)- isSpotlight: true- js: |- ```js- /**- * Step 1: Send the user an email to get a password reset token.- * This email contains a link which sends the user back to your application.- */- const { data, error } = await supabase.auth- .resetPasswordForEmail('[email protected]')-- /**- * Step 2: Once the user is redirected back to your application,- * ask the user to reset their password.- */- useEffect(() => {- supabase.auth.onAuthStateChange(async (event, session) => {- if (event == "PASSWORD_RECOVERY") {- const newPassword = prompt("What would you like your new password to be?");- const { data, error } = await supabase.auth- .updateUser({ password: newPassword })-- if (data) alert("Password updated successfully!")- if (error) alert("There was an error updating your password.")- }- })- }, [])- ```-- auth.admin.generateLink():- title: 'generateLink()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink'- examples:- - name: Generate a signup link- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'signup',- email: '[email protected]',- options: {- 'password': 'secret'- }- })- ```- - name: Generate an invite link- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'invite',- email: '[email protected]'- })- ```- - name: Generate a magic link- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'magiclink',- email: '[email protected]'- })- ```- - name: Generate a recovery link- isSpotlight: false- js: |- ```js- const { data, error } = await supabase.auth.admin.generateLink({- type: 'recovery',- email: '[email protected]'- })- ```- - name: Generate links to change current email address- isSpotlight: false- js: |- ```js- // generate an email change link to be sent to the current email address- const { data, error } = await supabase.auth.admin.generateLink({- type: 'email_change_current',- email: '[email protected]',- newEmail: '[email protected]'- })-- // generate an email change link to be sent to the new email address- const { data, error } = await supabase.auth.admin.generateLink({- type: 'email_change_new',- email: '[email protected]',- newEmail: '[email protected]'- })- ```-- auth.admin.updateUserById():- title: 'updateUserById()'- $ref: '@supabase/gotrue-js.GoTrueAdminApi.updateUserById'- examples:- - name: Updates a user's email.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { email: '[email protected]' }- )- ```- - name: Updates a user's password.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { password: 'new_password' }- )- ```- - name: Updates a user's metadata.- isSpotlight: true- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { user_metadata: { hello: 'world' } }- )- ```- - name: Updates a user's app_metadata.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { app_metadata: { plan: 'trial' } }- )- ```- - name: Confirms a user's email address.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { email_confirm: true }- )- ```- - name: Confirms a user's phone number.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth.admin.updateUserById(- '6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',- { phone_confirm: true }- )- ```-- select():- title: 'Fetch data: select()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.select'- notes: |- - By default, Supabase projects return a maximum of 1,000 rows. This setting can be changed in your project's [API settings](https://app.supabase.com/project/_/settings/api). It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data.- - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters)- - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers)- - `apikey` is a reserved keyword if you're using the [Supabase Platform](/docs/guides/hosting/platform) and should be avoided as a column name](https://github.com/supabase/supabase/issues/5465).- examples:- - name: Getting your data- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Afghanistan"- },- {- "id": 2,- "name": "Albania"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```- - name: Selecting specific columns- description: |- You can select specific fields from your tables.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Afghanistan"- },- {- "name": "Albania"- },- {- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Query foreign tables- description: |- If your database has foreign key relationships, you can query related tables too.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities (- name- )- `)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Germany",- "cities": [- {- "name": "Munich"- }- ]- },- {- "name": "Indonesia",- "cities": [- {- "name": "Bali"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Query foreign tables through a join table- description: |- If you're in a situation where your tables are **NOT** directly- related, but instead are joined by a _join table_, you can still use- the `select()` method to query the related data. The join table needs- to have the foreign keys as part of its composite primary key.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text- );- create table- teams (- id int8 primary key,- name text- );- -- join table- create table- users_teams (- user_id int8 not null references users,- team_id int8 not null references teams,- -- both foreign keys must be part of a composite primary key- primary key (user_id, team_id)- );-- insert into- users (id, name)- values- (1, 'Kiran'),- (2, 'Evan');- insert into- teams (id, name)- values- (1, 'Green'),- (2, 'Blue');- insert into- users_teams (user_id, team_id)- values- (1, 1),- (1, 2),- (2, 2);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select(`- name,- teams (- name- )- `)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Kiran",- "teams": [- {- "name": "Green"- },- {- "name": "Blue"- }- ]- },- {- "name": "Evan",- "teams": [- {- "name": "Blue"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Query the same foreign table multiple times- description: |- If you need to query the same foreign table twice, use the name of the- joined column to identify which join to use. You can also give each- column an alias.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (id int8 primary key, name text);-- create table- messages (- sender_id int8 not null references users,- receiver_id int8 not null references users,- content text- );-- insert into- users (id, name)- values- (1, 'Kiran'),- (2, 'Evan');-- insert into- messages (sender_id, receiver_id, content)- values- (1, 2, '👋');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('messages')- .select(`- content,- from:sender_id(name),- to:receiver_id(name)- `)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "content": "👋",- "from": {- "name": "Kiran"- },- "to": {- "name": "Evan"- }- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Filtering through foreign tables- description: |- If the filter on a foreign table's column is not satisfied, the foreign- table returns `[]` or `null` but the parent table is not filtered out.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, countries(*)')- .eq('countries.name', 'Estonia')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Bali",- "countries": null- },- {- "name": "Munich",- "countries": null- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- If you want to filter out the parent table rows, use the `!inner` hint:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, countries!inner(*)')- .eq('countries.name', 'Estonia')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Querying with count option- description: |- You can get the number of rows by using the- [count](/docs/reference/javascript/select#parameters) option. For- example, to get the table count without returning all rows:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { count, error } = await supabase- .from('countries')- .select('*', { count: 'exact', head: true })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "count": 3,- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Querying JSON data- description: |- You can select and filter data inside of- [JSON](/docs/guides/database/json) columns. Postgres offers some- [operators](/docs/guides/database/json#query-the-jsonb-data) for- querying JSON data.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Avdotya', '{"city":"Saint Petersburg"}');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select(`- id, name,- address->city- `)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Avdotya",- "city": "Saint Petersburg"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- insert():- title: 'Create data: insert()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.insert'- examples:- - name: Create a record- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .insert({ id: 1, name: 'Denmark' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 201,- "statusText": "Created"- }- ```- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Denmark"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { error } = await supabase- .from('countries')- .insert({ id: 1, name: 'Denmark' })- ```- - name: Create a record and return it- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .insert({ id: 1, name: 'Denmark' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Denmark"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Bulk create- description: |- A bulk create operation is handled in a single transaction.- If any of the inserts fail, none of the rows are inserted.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .insert([- { id: 1, name: 'Nepal' },- { id: 1, name: 'Vietnam' },- ])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "error": {- "code": "23505",- "details": "Key (id)=(1) already exists.",- "hint": null,- "message": "duplicate key value violates unique constraint \"countries_pkey\""- },- "status": 409,- "statusText": "Conflict"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- update():- title: 'Modify data: update()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.update'- notes: |- - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.- examples:- - name: Updating your data- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Taiwan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .update({ name: 'Australia' })- .eq('id', 1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 204,- "statusText": "No Content"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Australia"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { error } = await supabase- .from('countries')- .update({ name: 'Australia' })- .eq('id', 1)- ```- - name: Update a record and return it- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Taiwan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .update({ name: 'Australia' })- .eq('id', 1)- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Australia"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Updating JSON data- description: |- Postgres offers some- [operators](/docs/guides/database/json#query-the-jsonb-data) for- working with JSON data.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210 }');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .update({- address: {- street: 'Melrose Place',- postcode: 90210- }- })- .eq('address->postcode', 90210)- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Michael",- "address": {- "street": "Melrose Place",- "postcode": 90210- }- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- Currently, it is only possible to update the entire JSON document.- hideCodeBlock: true-- upsert():- title: 'Upsert data: upsert()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.upsert'- notes: |- - Primary keys must be included in `values` to use upsert.- examples:- - name: Upsert your data- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Albania' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Albania"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Albania' })- .select()- ```- - name: Bulk Upsert your data- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert([- { id: 1, name: 'Albania' },- { id: 2, name: 'Algeria' },- ])- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Albania"- },- {- "id": 2,- "name": "Algeria"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Upserting into tables with constraints- description: |- In the following query, `upsert()` implicitly uses the `id`- (primary key) column to determine conflicts. If there is no existing- row with the same `id`, `upsert()` inserts a new row, which- will fail in this case as there is already a row with `handle` `"saoirse"`.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 generated by default as identity primary key,- handle text not null unique,- display_name text- );-- insert into- users (id, handle, display_name)- values- (1, 'saoirse', null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "error": {- "code": "23505",- "details": "Key (handle)=(saoirse) already exists.",- "hint": null,- "message": "duplicate key value violates unique constraint \"users_handle_key\""- },- "status": 409,- "statusText": "Conflict"- }- ```-- </TabPanel>- </Tabs>-- Using the `onConflict` option, you can instruct `upsert()` to use- another column with a unique constraint to determine conflicts:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- await supabase- .from('users')- .upsert(- { id: 42, handle: 'saoirse', display_name: 'Saoirse' },- { onConflict: 'handle' },- )- const { data, error } = await supabase- .from('users')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 42,- "handle": "saoirse",- "display_name": "Saoirse"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- delete():- title: 'Delete data: delete()'- $ref: '@supabase/postgrest-js.PostgrestQueryBuilder.delete'- notes: |- - `delete()` should always be combined with [filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to delete.- - If you use `delete()` with filters and you have- [RLS](/docs/learn/auth-deep-dive/auth-row-level-security) enabled, only- rows visible through `SELECT` policies are deleted. Note that by default- no rows are visible, so you need at least one `SELECT`/`ALL` policy that- makes the rows visible.- examples:- - name: Delete records- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Spain');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { error } = await supabase- .from('countries')- .delete()- .eq('id', 1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 204,- "statusText": "No Content"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { error } = await supabase- .from('countries')- .delete()- .eq('id', 1)- ```-- rpc():- title: 'Postgres functions: rpc()'- description: |- You can call Postgres functions as _Remote Procedure Calls_, logic in your database that you can execute from anywhere.- Functions are useful when the logic rarely changes—like for password resets and updates.-- ```sql- create or replace function hello_world() returns text as $$- select 'Hello world';- $$ language sql;- ```- $ref: '@supabase/postgrest-js.PostgrestClient.rpc'- examples:- - name: Call a Postgres function without arguments- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create function hello_world() returns text as $$- select 'Hello world';- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase.rpc('hello_world')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": "Hello world",- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase.rpc('hello_world')- ```- - name: Call a Postgres function with arguments- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create function echo(say text) returns text as $$- select say;- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase.rpc('echo', { say: '👋' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": "👋",- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Bulk processing- description: |- You can process large payloads by passing in an array as an argument:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create function add_one_each(arr int[]) returns int[] as $$- select array_agg(n + 1) from unnest(arr) as n;- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase.rpc('add_one_each', { arr: [1, 2, 3] })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- 2,- 3,- 4- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Call a Postgres function with filters- description: |- Postgres functions that return tables can also be combined with- [Filters](/docs/reference/javascript/using-filters) and- [Modifiers](/docs/reference/javascript/using-modifiers).-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'France'),- (2, 'United Kingdom');-- create function list_stored_countries() returns setof countries as $$- select * from countries;- $$ language sql;- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .rpc('list_stored_countries')- .eq('id', 1)- .single()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": {- "id": 1,- "name": "France"- },- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- Using Filters:- description: |- Filters allow you to only return rows that match certain conditions.-- Filters can be used on `select()`, `update()`, `upsert()`, and `delete()` queries.-- If a Postgres function returns a table response, you can also apply filters.-- ### Applying Filters-- Filters must be applied after any of `select()`, `update()`, `upsert()`,- `delete()`, and `rpc()` and before- [modifiers](/docs/reference/javascript/using-modifiers).-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, country_id')- .eq('name', 'The Shire') // Correct-- const { data, error } = await supabase- .from('cities')- .eq('name', 'The Shire') // Incorrect- .select('name, country_id')- ```-- ### Chaining-- Filters can be chained together to produce advanced queries. For example,- to query cities with population between 1,000 and 10,000:-- ```ts- const { data, error } = await supabase- .from('cities')- .select('name, country_id')- .gte('population', 1000)- .lt('population', 10000)- ```-- ### Conditional Chaining-- Filters can be built up one step at a time and then executed. For example:-- ```ts- const filterByName = null- const filterPopLow = 1000- const filterPopHigh = 10000-- let query = supabase- .from('cities')- .select('name, country_id')-- if (filterByName) { query = query.eq('name', filterByName) }- if (filterPopLow) { query = query.gte('population', filterPopLow) }- if (filterPopHigh) { query = query.lt('population', filterPopHigh) }-- const { data, error } = await query- ```-- ### Filter by values within a JSON column-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210 }'),- (2, 'Jane', null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select()- .eq('address->postcode', 90210)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Michael",- "address": {- "postcode": 90210- }- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- ### Filter Foreign Tables-- You can filter on foreign tables in your `select()` query using dot- notation:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .eq('cities.name', 'Bali')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Indonesia",- "cities": [- {- "name": "Bali"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- eq():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.eq'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Albania')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Albania')- ```-- neq():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.neq'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .neq('name', 'Albania')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Afghanistan"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .neq('name', 'Albania')- ```-- gt():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.gt'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gt('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gt('id', 2)- ```-- gte():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.gte'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gte('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .gte('id', 2)- ```-- lt():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lt'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lt('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lt('id', 2)- ```-- lte():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.lte'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lte('id', 2)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Afghanistan"- },- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .lte('id', 2)- ```-- like():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.like'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%Alba%')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%Alba%')- ```-- ilike():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.ilike'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%alba%')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .like('name', '%alba%')- ```-- is():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.is'- examples:- - name: Checking nullness- description: |- Using the `eq()` filter doesn't work when filtering for `null`:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'null'),- (2, null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', null)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "null"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>-- Instead, you need to use `is()`:-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .is('name', null)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": null- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .is('name', null)- ```-- in():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.in'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .in('name', ['Albania', 'Algeria'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "name": "Albania"- },- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .in('name', ['Albania', 'Algeria'])- ```-- contains():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.contains'- examples:- - name: On array columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- issues (- id int8 primary key,- title text,- tags text[]- );-- insert into- issues (id, title, tags)- values- (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),- (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('issues')- .select('title')- .contains('tags', ['is:open', 'severity:high'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "title": "Cache invalidation is not working"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('users')- .select()- .contains('name', ['is:online', 'faction:red'])- ```- - name: On range columns- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .contains('during', '[2000-01-01 13:00, 2000-01-01 13:30)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: On `jsonb` columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),- (2, 'Jane', '{}');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select('name')- .contains('address', { postcode: 90210 })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Michael"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- containedBy():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.containedBy'- examples:- - name: On array columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- classes (- id int8 primary key,- name text,- days text[]- );-- insert into- classes (id, name, days)- values- (1, 'Chemistry', array['monday', 'friday']),- (2, 'History', array['monday', 'wednesday', 'thursday']);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('classes')- .select('name')- .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Chemistry"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('classes')- .select('name')- .containedBy('days', ['monday', 'tuesday', 'wednesday', 'friday'])- ```- - name: On range columns- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .containedBy('during', '[2000-01-01 00:00, 2000-01-01 23:59)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: On `jsonb` columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- users (- id int8 primary key,- name text,- address jsonb- );-- insert into- users (id, name, address)- values- (1, 'Michael', '{ "postcode": 90210, "street": "Melrose Place" }'),- (2, 'Jane', '{}');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('users')- .select('name')- .containedBy('address', {})- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Jane"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- rangeGt():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeGt'- examples:- - name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "room_name": "Topaz",- "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGt('during', '[2000-01-02 08:00, 2000-01-02 09:00)')- ```-- rangeGte():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeGte'- examples:- - name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 2,- "room_name": "Topaz",- "during": "[\"2000-01-02 09:00:00\",\"2000-01-02 10:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeGte('during', '[2000-01-02 08:30, 2000-01-02 09:30)')- ```-- rangeLt():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeLt'- examples:- - name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLt('during', '[2000-01-01 15:00, 2000-01-01 16:00)')- ```-- rangeLte():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeLte'- examples:- - name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeLte('during', '[2000-01-01 14:00, 2000-01-01 16:00)')- ```-- rangeAdjacent():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.rangeAdjacent'- examples:- - name: With `select()`- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .rangeAdjacent('during', '[2000-01-01 12:00, 2000-01-01 13:00)')- ```-- overlaps():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.overlaps'- examples:- - name: On array columns- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- issues (- id int8 primary key,- title text,- tags text[]- );-- insert into- issues (id, title, tags)- values- (1, 'Cache invalidation is not working', array['is:open', 'severity:high', 'priority:low']),- (2, 'Use better names', array['is:open', 'severity:low', 'priority:medium']);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('issues')- .select('title')- .overlaps('tags', ['is:closed', 'severity:high'])- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "title": "Cache invalidation is not working"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('issues')- .select('title')- .overlaps('tags', ['is:closed', 'severity:high'])- ```- - name: On range columns- description: |- Postgres supports a number of [range- types](https://www.postgresql.org/docs/current/rangetypes.html). You- can filter on range columns using the string representation of range- values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- reservations (- id int8 primary key,- room_name text,- during tsrange- );-- insert into- reservations (id, room_name, during)- values- (1, 'Emerald', '[2000-01-01 13:00, 2000-01-01 15:00)'),- (2, 'Topaz', '[2000-01-02 09:00, 2000-01-02 10:00)');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('reservations')- .select()- .overlaps('during', '[2000-01-01 12:45, 2000-01-01 13:15)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "room_name": "Emerald",- "during": "[\"2000-01-01 13:00:00\",\"2000-01-01 15:00:00\")"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- # TODO: schema & result- textSearch():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.textSearch'- notes:- - For more information, see [Postgres full text search](/docs/guides/database/full-text-search).- examples:- - name: Text search- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat' & 'cat'`, {- config: 'english'- })- ```- - name: Basic normalization- description: Uses PostgreSQL's `plainto_tsquery` function.- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat' & 'cat'`, {- type: 'plain',- config: 'english'- })- ```- - name: Full normalization- description: Uses PostgreSQL's `phraseto_tsquery` function.- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat' & 'cat'`, {- type: 'phrase',- config: 'english'- })- ```- - name: Websearch- description: |- Uses PostgreSQL's `websearch_to_tsquery` function.- This function will never raise syntax errors, which makes it possible to use raw user-supplied input for search, and can be used- with advanced operators.-- - `unquoted text`: text not inside quote marks will be converted to terms separated by & operators, as if processed by plainto_tsquery.- - `"quoted text"`: text inside quote marks will be converted to terms separated by <-> operators, as if processed by phraseto_tsquery.- - `OR`: the word “or” will be converted to the | operator.- - `-`: a dash will be converted to the ! operator.-- js: |- ```ts- const { data, error } = await supabase- .from('quotes')- .select('catchphrase')- .textSearch('catchphrase', `'fat or cat'`, {- type: 'websearch',- config: 'english'- })- ```-- match():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.match'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .match({ id: 2, name: 'Albania' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .match({ id: 2, name: 'Albania' })- ```-- not():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.not'- notes: |- not() expects you to use the raw PostgREST syntax for the filter values.-- ```ts- .not('id', 'in', '(5,6,7)') // Use `()` for `in` filter- .not('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values- ```- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'null'),- (2, null);- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .not('name', 'is', null)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "null"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .not('name', 'is', null)- ```-- or():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.or'- notes: |- or() expects you to use the raw PostgREST syntax for the filter names and values.-- ```ts- .or('id.in.(5,6,7), arraycol.cs.{"a","b"}') // Use `()` for `in` filter, `{}` for array values and `cs` for `contains()`.- .or('id.in.(5,6,7), arraycol.cd.{"a","b"}') // Use `cd` for `containedBy()`- ```- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .or('id.eq.2,name.eq.Algeria')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Albania"- },- {- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .or('id.eq.2,name.eq.Algeria')- ```- - name: Use `or` with `and`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .or('id.gt.3,and(id.eq.1,name.eq.Afghanistan)')- ```-- </TabPanel>- <TabPanel id="result" label="Result">--- ```json- {- "data": [- {- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- - name: Use `or` on foreign tables- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .or('country_id.eq.1,name.eq.Beijing', { foreignTable: 'cities' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Germany",- "cities": [- {- "name": "Munich"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- filter():- $ref: '@supabase/postgrest-js.PostgrestFilterBuilder.filter'- notes: |- filter() expects you to use the raw PostgREST syntax for the filter values.-- ```ts- .filter('id', 'in', '(5,6,7)') // Use `()` for `in` filter- .filter('arraycol', 'cs', '{"a","b"}') // Use `cs` for `contains()`, `{}` for array values- ```- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .filter('name', 'in', '("Algeria","Japan")')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 3,- "name": "Algeria"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .filter('name', 'in', '("Algeria","Japan")')- ```- - name: On a foreign table- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'Germany'),- (2, 'Indonesia');- insert into- cities (id, country_id, name)- values- (1, 2, 'Bali'),- (2, 1, 'Munich');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .filter('cities.name', 'eq', 'Bali')- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Indonesia",- "cities": [- {- "name": "Bali"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities!inner (- name- )- `)- .filter('cities.name', 'eq', 'Bali')- ```-- Using Modifiers:- description: |- Filters work on the row level—they allows you to return rows that- only match certain conditions without changing the shape of the rows.- Modifiers are everything that don't fit that definition—allowing you to- change the format of the response (e.g., returning a CSV string).-- Modifiers must be specified after filters. Some modifiers only apply for- queries that return rows (e.g., `select()` or `rpc()` on a function that- returns a table response).-- db.modifiers.select():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.select'- title: select()- examples:- - name: With `upsert()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Albania' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Algeria' })- .select()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 1,- "name": "Algeria"- }- ],- "status": 201,- "statusText": "Created"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .upsert({ id: 1, name: 'Algeria' })- .select()- ```-- order():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.order'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .order('name', { ascending: false })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "id": 3,- "name": "Algeria"- },- {- "id": 2,- "name": "Albania"- },- {- "id": 1,- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('cities')- .select('name', 'country_id')- .order('id', { ascending: false })- ```- - name: On a foreign table- description: |- Ordering on foreign tables doesn't affect the ordering of- the parent table.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'United States'),- (2, 'Vanuatu');- insert into- cities (id, country_id, name)- values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities (- name- )- `)- .order('name', { foreignTable: 'cities', ascending: false })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "United States",- "cities": [- {- "name": "New York City"- },- {- "name": "Atlanta"- }- ]- },- {- "name": "Vanuatu",- "cities": []- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- limit():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.limit'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Afghanistan"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- ```- - name: On a foreign table- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);- create table- cities (- id int8 primary key,- country_id int8 not null references countries,- name text- );-- insert into- countries (id, name)- values- (1, 'United States');- insert into- cities (id, country_id, name)- values- (1, 1, 'Atlanta'),- (2, 1, 'New York City');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select(`- name,- cities (- name- )- `)- .limit(1, { foreignTable: 'cities' })- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "United States",- "cities": [- {- "name": "Atlanta"- }- ]- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true-- range():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.range'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .range(0, 1)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": [- {- "name": "Afghanistan"- },- {- "name": "Albania"- }- ],- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .range(0, 1)- ```-- db.abortSignal():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.abortSignal'- title: abortSignal()- examples:- - name: Aborting requests in-flight- description: |- You can use an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) to abort requests. Note that `status` and `statusText` don't mean anything for aborted requests as the request wasn't fulfilled.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="js">- <TabPanel id="js" label="JavaScript">-- ```ts- const ac = new AbortController()- ac.abort()- const { data, error } = await supabase- .from('very_big_table')- .select()- .abortSignal(ac.signal)- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "error": {- "message": "FetchError: The user aborted a request.",- "details": "",- "hint": "",- "code": ""- },- "status": 400,- "statusText": "Bad Request"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const ac = new AbortController()- ac.abort()- const { data, error } = await supabase- .from('very_big_table')- .select()- .abortSignal(ac.signal)- ```-- single():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.single'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- .single()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": {- "name": "Afghanistan"- },- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select('name')- .limit(1)- .single()- ```-- maybeSingle():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.maybeSingle'- examples:- - name: With `select()`- description: |- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Singapore')- .maybeSingle()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .eq('name', 'Singapore')- .maybeSingle()- ```-- db.csv():- $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.csv'- title: csv()- examples:- - name: Return data as CSV- description: |- By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.-- <Tabs scrollable size="small" type="underlined" defaultActiveId="schema">- <TabPanel id="schema" label="Schema">-- ```sql- create table- countries (id int8 primary key, name text);-- insert into- countries (id, name)- values- (1, 'Afghanistan'),- (2, 'Albania'),- (3, 'Algeria');- ```-- </TabPanel>- <TabPanel id="js" label="JavaScript">-- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .csv()- ```-- </TabPanel>- <TabPanel id="result" label="Result">-- ```json- {- "data": "id,name\n1,Afghanistan\n2,Albania\n3,Algeria",- "status": 200,- "statusText": "OK"- }- ```-- </TabPanel>- </Tabs>- hideCodeBlock: true- isSpotlight: true- js: |- ```ts- const { data, error } = await supabase- .from('countries')- .select()- .csv()- ```-- # NOTE: Not available on currently deployed PostgREST- # db.geojson():- # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.geojson'- # title: geojson()-- # NOTE: Not available on currently deployed PostgREST- # db.explain():- # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.explain'- # title: explain()-- # NOTE: Not available on currently deployed PostgREST- # db.rollback():- # $ref: '@supabase/postgrest-js.PostgrestTransformBuilder.rollback'- # title: rollback()- # examples:- # - name: With `delete()`- # description: |- # <details>- # <summary>Schema</summary>-- # ```sql- # create table- # countries (id int8 primary key, name text);-- # insert into- # countries (id, name)- # values- # (1, 'Spain');- # ```- # </details>-- # ```ts- # const { error } = await supabase- # .from('countries')- # .delete()- # .eq('id', 1)- # .rollback()- # ```-- # <details>- # <summary>Result</summary>-- # ```json- # {- # "status": 204,- # "statusText": "No Content"- # }- # ```- # </details>-- # ```ts- # const { data, error } = await supabase- # .from('countries')- # .select()- # ```-- # <details>- # <summary>Result</summary>-- # ```json- # {- # "data": [- # {- # "id": 1,- # "name": "Spain"- # }- # ],- # "status": 200,- # "statusText": "OK"- # }- # ```- # </details>- # hideCodeBlock: true- # isSpotlight: true- # js: |- # ```ts- # const { error } = await supabase- # .from('countries')- # .delete()- # .eq('id', 1)- # ```-- invoke():- title: 'invoke()'- description: |- Invoke a Supabase Function.- $ref: '@supabase/functions-js.FunctionsClient.invoke'- notes: |- - Requires an Authorization header.- - Invoke params generally match the [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) spec.- - When you pass in a body to your function, we automatically attach the Content-Type header for `Blob`, `ArrayBuffer`, `File`, `FormData` and `String`. If it doesn't match any of these types we assume the payload is `json`, serialise it and attach the `Content-Type` header as `application/json`. You can override this behaviour by passing in a `Content-Type` header of your own.- - Responses are automatically parsed as `json`, `blob` and `form-data` depending on the `Content-Type` header sent by your function. Responses are parsed as `text` by default.- examples:- - name: Basic invocation.- description:- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.functions.invoke('hello', {- body: { foo: 'bar' }- })- ```- - name: Error handling.- description: |- A `FunctionsHttpError` error is returned if your function throws an error, `FunctionsRelayError` if the Supabase Relay has an error processing your function and `FunctionsFetchError` if there is a network error in calling your function.- isSpotlight: true- js: |- ```js- import { FunctionsHttpError, FunctionsRelayError, FunctionsFetchError } from "@supabase/supabase-js";-- const { data, error } = await supabase.functions.invoke('hello', {- headers: {- "my-custom-header": 'my-custom-header-value'- },- body: { foo: 'bar' }- })-- if (error instanceof FunctionsHttpError) {- console.log('Function returned an error', error.message)- } else if (error instanceof FunctionsRelayError) {- console.log('Relay error:', error.message)- } else if (error instanceof FunctionsFetchError) {- console.log('Fetch error:', error.message)- }- ```- - name: Passing custom headers.- description: |- You can pass custom headers to your function. Note: supabase-js automatically passes the `Authorization` header with the signed in user's JWT.- isSpotlight: true- js: |- ```js- const { data, error } = await supabase.functions.invoke('hello', {- headers: {- "my-custom-header": 'my-custom-header-value'- },- body: { foo: 'bar' }- })- ```-- subscribe():- title: 'on().subscribe()'- $ref: '@supabase/realtime-js.RealtimeChannel.on'- notes: |- - Realtime is disabled by default for new Projects for better database performance and security. You can turn it on by [managing replication](/docs/guides/api#managing-realtime).- - Row level security is not applied to delete statements.- - If you want to receive the "previous" data for updates and deletes, you will need to set `REPLICA IDENTITY` to `FULL`, like this: `ALTER TABLE your_table REPLICA IDENTITY FULL;`- - When a delete occurs, the contents of old_record will be broadcast to all subscribers to that table so ensure that each table's replica identity only contains information that is safe to expose publicly.- - The channel name must exactly match the schema/table/filter you want to listen to separated by colons. See below examples for additional context.- examples:- - name: Listen to all database changes- isSpotlight: true- js: |- ```js- supabase- .channel('*')- .on('postgres_changes', { event: '*', schema: '*' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - name: Listening to a specific table- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: '*', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - name: Listening to inserts- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - name: Listening to updates- description: |- By default, Supabase will send only the updated record. If you want to receive the previous values as well you can- enable full replication for the table you are listening to:-- ```sql- alter table "your_table" replica identity full;- ```- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - name: Listening to deletes- description: |- By default, Supabase does not send deleted records. If you want to receive the deleted record you can- enable full replication for the table you are listening too:-- ```sql- alter table "your_table" replica identity full;- ```- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, payload => {- console.log('Change received!', payload)- })- .subscribe()- ```- - name: Listening to multiple events- description: You can chain listeners if you want to listen to multiple events for each table.- js: |- ```js- supabase- .channel('public:countries')- .on('postgres_changes', { event: 'INSERT', schema: 'public', table: 'countries' }, handleRecordInserted)- .on('postgres_changes', { event: 'DELETE', schema: 'public', table: 'countries' }, handleRecordDeleted)- .subscribe()- ```- - name: Listening to row level changes- description: You can listen to individual rows using the format `{table}:{col}=eq.{val}` - where `{col}` is the column name, and `{val}` is the value which you want to match.- notes: |- - ``eq`` filter works with all database types as under the hood, it's casting both the filter value and the database value to the correct type and then comparing them.- js: |- ```js- supabase- .channel('public:countries:id=eq.200')- .on('postgres_changes', { event: 'UPDATE', schema: 'public', table: 'countries', filter: 'id=eq.200' }, handleRecordUpdated)- .subscribe()- ```-- getChannels():- title: 'getChannels()'- $ref: '@supabase/supabase-js.index.SupabaseClient.getChannels'- examples:- - name: Get all channels- isSpotlight: true- js: |- ```js- const channels = supabase.getChannels()- ```-- removeChannel():- title: 'removeChannel()'- $ref: '@supabase/supabase-js.index.SupabaseClient.removeChannel'- notes: |- - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.- examples:- - name: Removes a channel- isSpotlight: true- js: |- ```js- supabase.removeChannel(myChannel)- ```-- removeAllChannels():- title: 'removeAllChannels()'- $ref: '@supabase/supabase-js.index.SupabaseClient.removeAllChannels'- notes: |- - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.- examples:- - name: Remove all channels- isSpotlight: true- js: |- ```js- supabase.removeAllChannels()- ```-- storage.listBuckets():- title: 'listBuckets()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.listBuckets'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: List buckets- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .listBuckets()- ```-- storage.getBucket():- title: 'getBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.getBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Get bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .getBucket('avatars')- ```-- storage.createBucket():- title: 'createBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.createBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `insert`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Create bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .createBucket('avatars', { public: false })- ```-- storage.emptyBucket():- title: 'emptyBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.emptyBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select`- - `objects` table permissions: `select` and `delete`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Empty bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .emptyBucket('avatars')- ```- storage.updateBucket():- title: 'updateBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.updateBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `update`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Update bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .updateBucket('avatars', { public: false })- ```-- storage.deleteBucket():- title: 'deleteBucket()'- $ref: '@supabase/storage-js.packages/StorageBucketApi.default.deleteBucket'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: `select` and `delete`- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Delete bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .deleteBucket('avatars')- ```-- storage.from.upload():- title: 'from.upload()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.upload'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `insert`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below.- examples:- - name: Upload file- isSpotlight: true- js: |- ```js- const avatarFile = event.target.files[0]- const { data, error } = await supabase- .storage- .from('avatars')- .upload('public/avatar1.png', avatarFile, {- cacheControl: '3600',- upsert: false- })- ```- - name: Upload file using `ArrayBuffer` from base64 file data- js: |- ```js- import { decode } from 'base64-arraybuffer'-- const { data, error } = await supabase- .storage- .from('avatars')- .upload('public/avatar1.png', decode('base64FileData'), {- contentType: 'image/png'- })- ```-- storage.from.update():- title: 'from.update()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.update'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `update` and `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below.- examples:- - name: Update file- isSpotlight: true- js: |- ```js- const avatarFile = event.target.files[0]- const { data, error } = await supabase- .storage- .from('avatars')- .update('public/avatar1.png', avatarFile, {- cacheControl: '3600',- upsert: false- })- ```- - name: Update file using `ArrayBuffer` from base64 file data- js: |- ```js- import {decode} from 'base64-arraybuffer'-- const { data, error } = await supabase- .storage- .from('avatars')- .update('public/avatar1.png', decode('base64FileData'), {- contentType: 'image/png'- })- ```-- storage.from.move():- title: 'from.move()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.move'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `update` and `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Move file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .move('public/avatar1.png', 'private/avatar2.png')- ```-- storage.from.copy():- title: 'from.copy()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.copy'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `insert` and `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Copy file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .copy('public/avatar1.png', 'private/avatar2.png')- ```-- storage.from.createSignedUrl():- title: 'from.createSignedUrl()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.createSignedUrl'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Create Signed URL- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .createSignedUrl('folder/avatar1.png', 60)- ```-- storage.from.createSignedUrls():- title: 'from.createSignedUrls()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.createSignedUrls'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Create Signed URLs- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)- ```-- storage.from.getPublicUrl():- title: 'from.getPublicUrl()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.getPublicUrl'- notes: |- - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [app.supabase.com](https://app.supabase.com), clicking the overflow menu on a bucket and choosing "Make public"- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: none- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Returns the URL for an asset in a public bucket- isSpotlight: true- js: |- ```js- const { data } = supabase- .storage- .from('public-bucket')- .getPublicUrl('folder/avatar1.png')- ```-- storage.from.download():- title: 'from.download()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.download'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Download file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .download('folder/avatar1.png')- ```-- storage.from.remove():- title: 'from.remove()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.remove'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `delete` and `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: Delete file- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .remove(['folder/avatar1.png'])- ```-- storage.from.list():- title: 'from.list()'- $ref: '@supabase/storage-js.packages/StorageFileApi.default.list'- notes: |- - RLS policy permissions required:- - `buckets` table permissions: none- - `objects` table permissions: `select`- - Refer to the [Storage guide](/docs/guides/storage#access-control) on how access control works- examples:- - name: List files in a bucket- isSpotlight: true- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .list('folder', {- limit: 100,- offset: 0,- sortBy: { column: 'name', order: 'asc' },- })- ```- - name: Search files in a bucket- js: |- ```js- const { data, error } = await supabase- .storage- .from('avatars')- .list('folder', {- limit: 100,- offset: 0,- sortBy: { column: 'name', order: 'asc' },- search: 'jon'- })- ```