The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Re-orders all filters in preparation for typescript support
Paul Copplestonefcd8404d5354
diff --git a/web/docs/library/examples/get.js b/web/docs/library/examples/get.jsindex ae61f433b28..d0ca653756e 100644--- a/web/docs/library/examples/get.js+++ b/web/docs/library/examples/get.js@@ -63,8 +63,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .order('id').select('name', 'country_id')+ .order('id')return cities${errorJs}`.trim()@@ -75,9 +75,9 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .order('cities.name')- .eq('name', 'United States').select('name, cities(name)')+ .eq('name', 'United States')+ .order('cities.name')return countries${errorJs}`.trim()@@ -100,8 +100,8 @@ const getCountries = async () => {try {let countries = await supabase.from('cities')- .eq('name', 'United States').select('name, cities(name)')+ .eq('name', 'United States').limit(1, 'cities')return countries${errorJs}@@ -125,9 +125,9 @@ const getCountries = async () => {try {let countries = await supabase.from('cities')- .eq('name', 'United States').select('name, cities(name)')- .limit(1, 'cities')+ .eq('name', 'United States')+ .offset(1, 'cities')return countries${errorJs}`.trim()@@ -138,8 +138,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .range(0,3).select('name, country_id')+ .range(0,3)return cities${errorJs}`.trim()@@ -150,9 +150,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .range(0)- .single().select('name, country_id')+ .single()return cities${errorJs}`.trim()@@ -163,8 +162,20 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .filter('name', 'eq', 'Paris').select('name, country_id')+ .filter('name', 'eq', 'Paris')+ return cities+ ${errorJs}+`.trim()++export const getFilterJsEmbedded = `+${importJs}+const getCities = async () => {+ try {+ let cities = await supabase+ .from('cities')+ .select('name, countries ( name )')+ .filter('countries.name', 'eq', 'France')return cities${errorJs}`.trim()@@ -175,8 +186,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .not('name', 'eq', 'Paris').select('name, country_id')+ .not('name', 'eq', 'Paris')return cities${errorJs}`.trim()@@ -199,8 +210,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .match({name: 'Beijing', country_id: 156}).select('name, country_id')+ .match({name: 'Beijing', country_id: 156})return cities${errorJs}`.trim()@@ -211,8 +222,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .eq('name', 'San Francisco').select('name, country_id')+ .eq('name', 'San Francisco')return cities${errorJs}`.trim()@@ -223,8 +234,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .neq('name', 'Lagos').select('name, country_id')+ .neq('name', 'Lagos')return cities${errorJs}`.trim()@@ -235,8 +246,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .gt('country_id', 250).select('name, country_id')+ .gt('country_id', 250)return cities${errorJs}`.trim()@@ -247,8 +258,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .lt('country_id', 250).select('name, country_id')+ .lt('country_id', 250)return cities${errorJs}`.trim()@@ -259,8 +270,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .gte('country_id', 250).select('name, country_id')+ .gte('country_id', 250)return cities${errorJs}`.trim()@@ -271,8 +282,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .lte('country_id', 250).select('name, country_id')+ .lte('country_id', 250)return cities${errorJs}`.trim()@@ -283,8 +294,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .like('name', '%la%').select('name, country_id')+ .like('name', '%la%')return cities${errorJs}`.trim()@@ -295,8 +306,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .ilike('name', '%la%').select('name, country_id')+ .ilike('name', '%la%')return cities${errorJs}`.trim()@@ -307,8 +318,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .is('name', null).select('name, country_id')+ .is('name', null)return cities${errorJs}`.trim()@@ -319,8 +330,8 @@ const getCities = async () => {try {let cities = await supabase.from('cities')- .in('name', ['Rio de Janeiro', 'San Francisco']).select('name, country_id')+ .in('name', ['Rio de Janeiro', 'San Francisco'])return cities${errorJs}`.trim()@@ -331,8 +342,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .cs('main_exports', ['oil']).select('name, id, main_exports')+ .cs('main_exports', ['oil'])return countries${errorJs}`.trim()@@ -343,8 +354,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .cd('main_exports', ['cars', 'food', 'machine']).select('name, id, main_exports')+ .cd('main_exports', ['cars', 'food', 'machine'])return countries${errorJs}`.trim()@@ -355,8 +366,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .ova('main_exports', ['computers', 'minerals']).select('name, id, main_exports')+ .ova('main_exports', ['computers', 'minerals'])return countries${errorJs}`.trim()@@ -367,8 +378,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .ovr('population_range_millions', [150, 250]).select('name, id, population_range_millions')+ .ovr('population_range_millions', [150, 250])return countries${errorJs}`.trim()@@ -379,8 +390,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .sl('population_range_millions', [150, 250]).select('name, id, population_range_millions')+ .sl('population_range_millions', [150, 250])return countries${errorJs}`.trim()@@ -391,8 +402,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .sr('population_range_millions', [150, 250]).select('name, id, population_range_millions')+ .sr('population_range_millions', [150, 250])return countries${errorJs}`.trim()@@ -403,8 +414,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .nxl('population_range_millions', [150, 250]).select('name, id, population_range_millions')+ .nxl('population_range_millions', [150, 250])return countries${errorJs}`.trim()@@ -415,8 +426,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .nxr('population_range_millions', [150, 250]).select('name, id, population_range_millions')+ .nxr('population_range_millions', [150, 250])return countries${errorJs}`.trim()@@ -427,8 +438,8 @@ const getCountries = async () => {try {let countries = await supabase.from('countries')- .adj('population_range_millions', [70, 185]).select('name, id, population_range_millions')+ .adj('population_range_millions', [70, 185])return countries${errorJs}`.trim()diff --git a/web/docs/library/examples/users.js b/web/docs/library/examples/users.jsdeleted file mode 100644index 6a969397077..00000000000--- a/web/docs/library/examples/users.js+++ /dev/null@@ -1,25 +0,0 @@-export const signup = `-const {- body: { user },-} = await supabase.auth.signup(- '[email protected]',- 'fOdaPdyTpkpxJgDVIORt'-)-`.trim()--export const login = `-const {- body: { user },-} = await supabase.auth.login(- '[email protected]',- 'fOdaPdyTpkpxJgDVIORt'-)-`.trim()--export const userData = `-const user = await supabase.auth.user()-`.trim()--export const logout = `-await supabase.auth.logout()-`.trim()diff --git a/web/docs/library/get.mdx b/web/docs/library/get.mdxindex 4921a71880d..724c4eacfb3 100644--- a/web/docs/library/get.mdx+++ b/web/docs/library/get.mdx@@ -24,6 +24,7 @@ import {getRangeJs,getSingleJs,getFilterJs,+ getFilterJsEmbedded,getNotJs,getOrJs,getMatchJs,@@ -223,7 +224,7 @@ supabase<CustomCodeBlockheader="Shows how to use order( ) with select( )"js={getOrderJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "San Francisco", "country_id": 840 },@@ -245,7 +246,7 @@ supabase<CustomCodeBlockheader="Shows how to use order( ) with select( ) and foreign tables present"js={getEmbeddedOrderJs}- jsHighlight="{9}"+ jsHighlight="{11}"response={`{"body": [{@@ -292,7 +293,7 @@ Specifies whether null values will be displayed first.<CustomCodeBlockheader="Shows how to use limit( ) with select( )"js={getLimitJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Rio de Janeiro", "country_id": 76 }@@ -308,7 +309,7 @@ Specifies whether null values will be displayed first.<CustomCodeBlockheader="Shows how to use limit( ) and foreign tables present"js={getEmbeddedLimitJs}- jsHighlight="{9}"+ jsHighlight="{11}"response={`{"body": [{@@ -350,7 +351,7 @@ Name of chosen foreignTable to apply the limit on. Used if foreign tables are pr<CustomCodeBlockheader="Shows how to use offset( ) with select( )"js={getOffsetJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Beijing", "country_id": 156 },@@ -371,7 +372,7 @@ Name of chosen foreignTable to apply the limit on. Used if foreign tables are pr<CustomCodeBlockheader="Shows how to use offset( ) with select( ) and foreign tables present"js={getEmbeddedOffsetJs}- jsHighlight="{9}"+ jsHighlight="{11}"response={`{"body": [{@@ -413,7 +414,7 @@ Name of chosen foreignTable to apply the limit on. Used if foreign tables are pr<CustomCodeBlockheader="Shows how to use range( ) with select( )"js={getRangeJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Rio de Janeiro", "country_id": 76 },@@ -485,7 +486,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use filter( ) with select( )"js={getFilterJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Paris", "country_id": 250 },@@ -499,12 +500,15 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<br /><CustomCodeBlock- header="Shows how to use filter( ) with select( )"- js={getFilterJs}- jsHighlight="{9}"+ header="Shows how to use filter embedded tables"+ js={getFilterJsEmbedded}+ jsHighlight="{10}"response={`{"body": [- { "name": "Paris", "country_id": 250 },+ {+ "name": "Paris",+ "country": { "name": "France" }+ },],"status": 200,"statusCode": 200,@@ -521,7 +525,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use not( ) with select( )"js={getNotJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Rio de Janeiro", "country_id": 76 },@@ -545,7 +549,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use or( ) with select( )"js={getOrJs}- jsHighlight="{9}"+ jsHighlight="{10}"/><br />@@ -557,7 +561,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use match( ) with select( )"js={getMatchJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Beijing", "country_id": 156 },@@ -577,7 +581,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use eq( ) with select( )"js={getEqJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "San Francisco", "country_id": 840 },@@ -597,7 +601,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use neq( ) with select( )"js={getNeqJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Rio de Janeiro", "country_id": 76 },@@ -622,7 +626,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use gt( ) with select( )"js={getGtJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Auckland", "country_id": 554 },@@ -645,7 +649,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use lt( ) with select( )"js={getLtJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Rio de Janeiro", "country_id": 76 },@@ -666,7 +670,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use gte( ) with select( )"js={getGteJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Paris", "country_id": 250 },@@ -690,7 +694,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use lte( ) with select( )"js={getLteJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Rio de Janeiro", "country_id": 76 },@@ -712,7 +716,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use like( ) with select( )"js={getLikeJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Auckland", "country_id": 554 },@@ -732,7 +736,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use ilike( ) with select( )"js={getIlikeJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Auckland", "country_id": 554 },@@ -753,7 +757,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use is( ) with select( )"js={getIsJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [],@@ -772,7 +776,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use in( ) with select( )"js={getInJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Rio de Janeiro", "country_id": 76 },@@ -793,7 +797,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use cs( ) with select( )"js={getCsJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Nigeria", "id": 556, "main_exports": ["oil", "beans"] },@@ -814,7 +818,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use cd( ) with select( )"js={getCdJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "France", "id": 250, "main_exports": ["cars", "machines"] },@@ -835,7 +839,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use ova( ) with select( )"js={getOvaJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Brazil", "id": 76, "main_exports": ["beans", "minerals"] },@@ -856,7 +860,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use ovr( ) with select( )"js={getOvrJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Brazil", "id": 76, "population_range_millions": [205, 215] },@@ -877,7 +881,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use sl( ) with select( )"js={getSlJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "France", "id": 250, "population_range_millions": [60, 70] },@@ -898,7 +902,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use sr( ) with select( )"js={getSrJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "China", "id": 156, "population_range_millions": [1380, 1390] },@@ -919,7 +923,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use nxl( ) with select( )"js={getNxlJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Brazil", "id": 76, "population_range_millions": [205, 215] },@@ -942,7 +946,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use nxr( ) with select( )"js={getNxrJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "Brazil", "id": 76, "population_range_millions": [205, 215] },@@ -965,7 +969,7 @@ with `200 OK`. Otherwise, it will return an error with `406 Not Acceptable`.<CustomCodeBlockheader="Shows how to use adj( ) with select( )"js={getAdjJs}- jsHighlight="{9}"+ jsHighlight="{10}"response={`{"body": [{ "name": "France", "id": 250, "population_range_millions": [60, 70] },diff --git a/web/src/examples/users.js b/web/src/examples/users.jsnew file mode 100644index 00000000000..c39ae2dd236--- /dev/null+++ b/web/src/examples/users.js@@ -0,0 +1,47 @@+export const signup = `+const {+ body: { user },+} = await supabase.auth.signup(+ '[email protected]',+ 'password'+)+`.trim()++export const login = `+const {+ body: { user },+} = await supabase.auth.login(+ '[email protected]',+ 'password'+)+`.trim()++export const userData = `+const user = await supabase.auth.user()+`.trim()++export const logout = `+await supabase.auth.logout()+`.trim()++export const errorHandling = `+try {+ const res = await supabase+ .auth+ .login('[email protected]', 'password')+} catch (error) {+ if (error.response === undefined) {+ // No response from server+ } else {+ const server_response = error.response+ // Here you can further process the response ..+ }++ if (error.status === undefined) {+ // No HTTP status code+ } else {+ const http_code = error.status+ // Further processing ..+ }+}+`.trim()