The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Tests the new library in the Todo example - working well
Paul Copplestone4afdb8383320
diff --git a/examples/todo-next-js/components/Auth.js b/examples/todo-next-js/components/Auth.jsindex 9a5af500427..9aba65c3748 100644--- a/examples/todo-next-js/components/Auth.js+++ b/examples/todo-next-js/components/Auth.js@@ -6,19 +6,13 @@ export default function Auth({ onLogin }) {const [password, setPassword] = useState('')const handleLogin = async (type, email, password) => {- try {- const {- body: { user },- } =- type === 'LOGIN'- ? await supabase.auth.login(email, password)- : await supabase.auth.signup(email, password)+ const { user, error } =+ type === 'LOGIN'+ ? await supabase.auth.signIn({email, password})+ : await supabase.auth.signUp({email, password})- onLogin(user)- } catch (error) {- console.log('error', error)- alert(error.error_description || error)- }+ if (error) alert(error.message || error)+ else onLogin(user)}return (diff --git a/examples/todo-next-js/components/TodoList.js b/examples/todo-next-js/components/TodoList.jsindex a859f1ce0de..a0536a4c915 100644--- a/examples/todo-next-js/components/TodoList.js+++ b/examples/todo-next-js/components/TodoList.js@@ -11,26 +11,19 @@ export default function Todos({ user }) {}, [])const fetchTodos = async () => {- try {- let { body: todos } = await supabase.from('todos').select('*').order('id', true)- setTodos(todos)- } catch (error) {- console.log('error', error)- }+ let { data: todos, error } = await supabase.from('todos').select('*').order('id', true)+ if (error) console.log('error', error)+ else setTodos(todos)}const addTodo = async (taskText) => {- try {- let task = taskText.trim()- if (task.length) {- let { body: todo } = await supabase- .from('todos')- .insert({ task, user_id: user.id })- .single()- setTodos([...todos, todo])- }- } catch (error) {- console.log('error', error)- setError(JSON.parse(error.message).message)+ let task = taskText.trim()+ if (task.length) {+ let { data: todo, error } = await supabase+ .from('todos')+ .insert({ task, user_id: user.id })+ .single()+ if (error) setError(error.message)+ else setTodos([...todos, todo])}}@@ -97,35 +90,35 @@ const Todo = ({ todo, onDelete }) => {}}className="w-full block cursor-pointer hover:bg-gray-200 focus:outline-none focus:bg-gray-200 transition duration-150 ease-in-out">- <div className="flex items-center px-4 py-4 sm:px-6">- <div className="min-w-0 flex-1 flex items-center">- <div className="text-sm leading-5 font-medium truncate">{todo.task}</div>- </div>- <div>- <input- className="cursor-pointer"- onChange={(e) => toggle()}- type="checkbox"- checked={isCompleted ? true : ''}- />- </div>- <button- onClick={(e) => {- e.preventDefault()- e.stopPropagation()- onDelete()- }}- className="w-4 h-4 ml-2 border-2 hover:border-black rounded"- >- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="gray">- <path- fillRule="evenodd"- d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"- clipRule="evenodd"- />- </svg>- </button>+ <div className="flex items-center px-4 py-4 sm:px-6">+ <div className="min-w-0 flex-1 flex items-center">+ <div className="text-sm leading-5 font-medium truncate">{todo.task}</div></div>+ <div>+ <input+ className="cursor-pointer"+ onChange={(e) => toggle()}+ type="checkbox"+ checked={isCompleted ? true : ''}+ />+ </div>+ <button+ onClick={(e) => {+ e.preventDefault()+ e.stopPropagation()+ onDelete()+ }}+ className="w-4 h-4 ml-2 border-2 hover:border-black rounded"+ >+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="gray">+ <path+ fillRule="evenodd"+ d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"+ clipRule="evenodd"+ />+ </svg>+ </button>+ </div></li>)}diff --git a/examples/todo-next-js/package-lock.json b/examples/todo-next-js/package-lock.jsonindex f7d6f4b7517..a07b07c9ebd 100644--- a/examples/todo-next-js/package-lock.json+++ b/examples/todo-next-js/package-lock.json@@ -1273,9 +1273,9 @@}},"@supabase/gotrue-js": {- "version": "1.5.10",- "resolved": "https://registry.npmjs.org/@supabase/gotrue-js/-/gotrue-js-1.5.10.tgz",- "integrity": "sha512-SAoT5znv6r/nasJQp35n72dYGkBMWgKsCHc45vrCu8M/XDNpU/9vN8TzzziK4M0tWg3LGKm7MbRkNOwLEk5a8A==",+ "version": "1.7.1",+ "resolved": "https://registry.npmjs.org/@supabase/gotrue-js/-/gotrue-js-1.7.1.tgz",+ "integrity": "sha512-EebUhGRf+5s+HjBmbiBXEk4yP2zp0HOwZFLwRFXvJVyixx4jE/FDeXghJrnhoG/zlxWXcHTGHOdVfJ1k6rWMTA==","requires": {"cross-fetch": "^3.0.6"},@@ -1296,9 +1296,9 @@}},"@supabase/postgrest-js": {- "version": "0.21.0",- "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-0.21.0.tgz",- "integrity": "sha512-2MxPodIf1Ij+iR2RYVxziZpBv/9j6zT2d2UWSvdu2GT8yODo1hO2oXXT4cFJqvxmVX6A+z4J39wBqutt9vlttQ==",+ "version": "0.21.1",+ "resolved": "https://registry.npmjs.org/@supabase/postgrest-js/-/postgrest-js-0.21.1.tgz",+ "integrity": "sha512-KHM+cDaxI5iIXl8uXQPsxjRqZHRnltav4Yq8juehn3wkXxsZS01LT6E3zdGn401a/yZgiJJWAp0m31BAql27vg==","requires": {"cross-fetch": "^3.0.6"},@@ -1329,11 +1329,12 @@}},"@supabase/supabase-js": {- "version": "github:kiwicopple/supabase-js#6199fa765eee19a83befd755faff9c9dcb250a00",- "from": "github:kiwicopple/supabase-js#feature/migrate_to_typescript",+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-1.0.1.tgz",+ "integrity": "sha512-ThlQcixzPSp1HNOA6XD1+iC38q1e7bGEHSVUowxmLfULB0dYaL5539JJb6kfIjM1XHf/p5JP22BAU3QRi/6n1Q==","requires": {- "@supabase/gotrue-js": "^1.5.10",- "@supabase/postgrest-js": "^0.21.0",+ "@supabase/gotrue-js": "^1.7.1",+ "@supabase/postgrest-js": "^0.21.1","@supabase/realtime-js": "^1.0.6"}},@@ -1343,9 +1344,9 @@"integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw=="},"@types/node": {- "version": "14.14.0",- "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.0.tgz",- "integrity": "sha512-BfbIHP9IapdupGhq/hc+jT5dyiBVZ2DdeC5WwJWQWDb0GijQlzUFAeIQn/2GtvZcd2HVUU7An8felIICFTC2qg=="+ "version": "14.14.6",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.6.tgz",+ "integrity": "sha512-6QlRuqsQ/Ox/aJEQWBEJG7A9+u7oSYl3mem/K8IzxXG/kAGbV1YPD9Bg9Zw3vyxC/YP+zONKwy8hGkSt1jxFMw=="},"@types/websocket": {"version": "1.0.1",@@ -2056,11 +2057,11 @@"integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk="},"bufferutil": {- "version": "4.0.1",- "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.1.tgz",- "integrity": "sha512-xowrxvpxojqkagPcWRQVXZl0YXhRhAtBEIq3VoER1NH5Mw1n1o0ojdspp+GS2J//2gCVyrzQDApQ4unGF+QOoA==",+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.2.tgz",+ "integrity": "sha512-AtnG3W6M8B2n4xDQ5R+70EXvOpnXsFYg/AK2yTZd+HQ/oxAdz+GI+DvjmhBw3L0ole+LJ0ngqY4JMbDzkfNzhA==","requires": {- "node-gyp-build": "~3.7.0"+ "node-gyp-build": "^4.2.0"}},"builtin-status-codes": {@@ -4156,9 +4157,9 @@"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="},"node-gyp-build": {- "version": "3.7.0",- "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.7.0.tgz",- "integrity": "sha512-L/Eg02Epx6Si2NXmedx+Okg+4UHqmaf3TNcxd50SF9NQGcJaON3AtU++kax69XV7YWz4tUspqZSAsVofhFKG2w=="+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.2.3.tgz",+ "integrity": "sha512-MN6ZpzmfNCRM+3t57PTJHgHyw/h4OWnZ6mR8P5j/uZtqQr46RRuDE/P+g3n0YR/AiYXeWixZZzaip77gdICfRg=="},"node-html-parser": {"version": "1.3.1",@@ -6524,11 +6525,11 @@}},"utf-8-validate": {- "version": "5.0.2",- "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.2.tgz",- "integrity": "sha512-SwV++i2gTD5qh2XqaPzBnNX88N6HdyhQrNNRykvcS0QKvItV9u3vPEJr+X5Hhfb1JC0r0e1alL0iB09rY8+nmw==",+ "version": "5.0.3",+ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.3.tgz",+ "integrity": "sha512-jtJM6fpGv8C1SoH4PtG22pGto6x+Y8uPprW0tw3//gGFhDDTiuksgradgFN6yRayDP4SyZZa6ZMGHLIa17+M8A==","requires": {- "node-gyp-build": "~3.7.0"+ "node-gyp-build": "^4.2.0"}},"util": {diff --git a/examples/todo-next-js/package.json b/examples/todo-next-js/package.jsonindex 08615355505..8a1679cb963 100644--- a/examples/todo-next-js/package.json+++ b/examples/todo-next-js/package.json@@ -7,7 +7,7 @@"start": "next start"},"dependencies": {- "@supabase/supabase-js": "github:kiwicopple/supabase-js#feature/migrate_to_typescript",+ "@supabase/supabase-js": "^1.0.1","next": "latest","react": "^16.13.1","react-dom": "^16.13.1"diff --git a/web/blog/2020-10-30-improved-dx.md b/web/blog/2020-10-30-improved-dx.mdindex 3112d7c4bca..5aaac3f5f42 100644--- a/web/blog/2020-10-30-improved-dx.md+++ b/web/blog/2020-10-30-improved-dx.md@@ -11,7 +11,7 @@ tags:- supabase----Today we're releasing [supabase-js](https://github.com/supabase/supabase-js) version 1.0.0, and it comes with some major Developer Experience improvements.+Today we're releasing [supabase-js](https://github.com/supabase/supabase-js) version 1.0, and it comes with some major Developer Experience improvements.<!--truncate-->