The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
better sections
Coppleed50a7790810
diff --git a/apps/www/_blog/2022-08-16-supabase-js-v2.mdx b/apps/www/_blog/2022-08-16-supabase-js-v2.mdxindex 8a352fa6d65..bcb79a3ea27 100644--- a/apps/www/_blog/2022-08-16-supabase-js-v2.mdx+++ b/apps/www/_blog/2022-08-16-supabase-js-v2.mdx@@ -19,11 +19,11 @@ Since then it has been used in over [17K repositories](https://github.com/supabato [50K weekly downloads](https://www.npmjs.com/package/@supabase/supabase-js). Supabase users give a lot of great feedback and we'velearned some of the largest pain-points as a result.+## Major Updates+This release focuses on solving these pain-points. At the same time we want to make the upgrade path for supabase-js as easy as possible,so we've been strategic about the changes we're making. We plan to follow this model going forward: incremental changes over huge rewrites.-## Major Updates-### Type supportIf you followed yesterday's announcement, you will have noticed that we added@@ -58,6 +58,8 @@ supabase.from<Database['Message']>('messages').select('*')</details>+---+### New Auth methodsWe're removing the `signIn()` method in favor of more explicit method signatures:@@ -106,6 +108,8 @@ Previously you could pass a `returning: 'minimal'` option to the `insert()`, `up</details>+---+### Auth Admin methodsWe've move all server-side Auth methods from `supabase.auth.api` to `supabase.auth.admin`:@@ -121,6 +125,8 @@ const { data: user, error } = await supabase.auth.api.listUsers()All `admin` methods expect a `SERVICE_ROLE` key.This change makes it clear that any methods under the `admin` namespace should only be used on a trusted server-side environment.+---+### Async Auth overhaulWe've rebuilt the Auth library, making it async for almost all methods.@@ -144,6 +150,8 @@ for a valid/invalid session before taking any action.</details>+---+### Scoped constructor configWe're being much more explicit about the modular approach that `supabase-js` uses:@@ -180,6 +188,8 @@ For example, Auth has a config parameter called "storageKey", which was was ofte</details>+---+### Better ErrorsWe've created error types for all of the sub-libraries in `supabase-js`. Here's a example for Edge Functions:@@ -198,6 +208,8 @@ if (error instanceof FunctionsHttpError) {}```+---+### Improvements for Edge Functions`supabase-js` now automatically detects the content type for the request/response bodies for all Edge Function invocations:@@ -217,6 +229,8 @@ const { data: user, error } = await supabase.functions.invoke('hello', {This improvement inspired by a Supabase community member. Thanks [@vejja](https://github.com/supabase/functions-js/pull/23)!+---+### Multiplayer Sneak PeekThere is a new `channel()` interface which are releasing in v2.@@ -262,6 +276,8 @@ supabaseYou can listen to PostgreSQL database changes on any channel you want by subscribing to the `'postgres_changes'` event.For now, we will continue to support `from().on().subscribe()`, but in the future we will deprecate this in favor of the `channel().on().subscribe()` method.+---+## CommunityVersion 2.0 is the result of the combined work of over 100 contributors to our libraries, and over 450 contributors to our docs and websites.