The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fixes broken references
Copple4b25ddcd4a34
diff --git a/apps/reference/_supabase_js/generated/auth-api-generatelink.mdx b/apps/reference/_supabase_js/generated/auth-api-generatelink.mdxindex 47acfee4f4c..ddff873d518 100644--- a/apps/reference/_supabase_js/generated/auth-api-generatelink.mdx+++ b/apps/reference/_supabase_js/generated/auth-api-generatelink.mdx@@ -17,21 +17,25 @@ Generates links to be sent via email or other.<li className="method-list-item"><h4 className="method-list-item-label"><span className="method-list-item-label-name">- type+ GenerateLinkType</span><span className="method-list-item-label-badge required">required</span><span className="method-list-item-validation">- <code>signup</code> | <code>invite</code> | <code>magiclink</code> | <code>recovery</code>+ <code>signup</code> | <code>invite</code> | <code>magiclink</code> | <code>recovery</code> | <code>email_change_current</code> | <code>email_change_new</code></span></h4><div class="method-list-item-description">-The link type ("signup" or "magiclink" or "recovery" or "invite").+The link type</div>+<ul className="method-list-group">+ <h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>+</ul>+</li><li className="method-list-item">@@ -129,7 +133,7 @@ User password. For signup only.</h4><div class="method-list-item-description">-The link type ("signup" or "magiclink" or "recovery" or "invite").+The redirect url which should be appended to the generated link</div>diff --git a/apps/reference/_supabase_js/generated/auth-api-getuserbyid.mdx b/apps/reference/_supabase_js/generated/auth-api-getuserbyid.mdxnew file mode 100644index 00000000000..cfc5568aeb3--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-api-getuserbyid.mdx@@ -0,0 +1,57 @@+---+id: auth-api-getuserbyid+title: 'getUser()'+slug: /auth-api-getuserbyid+custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml+---++import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'++Get user by id.++```js+const { user, error } = await supabase.auth.api.getUserById(1)+```++## Parameters++<ul className="method-list-group">++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ uid+ </span>+ <span className="method-list-item-label-badge required">+ required+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">++The user's unique identifier++This function should only be called on a server. Never expose your `service_role` key in the browser.++ </div>++</li>++</ul>++## Notes++- Fetches the user object from the database instead of local storage.+- Note that user() fetches the user object from local storage which might not be the most updated.+- Requires the user's access_token.++## Examples++### Fetch the user object using the access_token jwt.++```js+const { user, error } = await supabase.auth.api.getUserById(1)+```diff --git a/apps/reference/_supabase_js/generated/auth-api-resetpasswordforemail.mdx b/apps/reference/_supabase_js/generated/auth-api-resetpasswordforemail.mdxindex 4ee7c069f94..79be4e6db18 100644--- a/apps/reference/_supabase_js/generated/auth-api-resetpasswordforemail.mdx+++ b/apps/reference/_supabase_js/generated/auth-api-resetpasswordforemail.mdx@@ -75,7 +75,7 @@ No description provided.</h4><div class="method-list-item-description">-No description provided.+Verification token received when the user completes the captcha on the site.</div>@@ -95,7 +95,7 @@ No description provided.</h4><div class="method-list-item-description">-A URL or mobile address to send the user to after they are confirmed.+A URL to send the user to after they are confirmed.</div>diff --git a/apps/reference/_supabase_js/generated/auth-api-sendmobileotp.mdx b/apps/reference/_supabase_js/generated/auth-api-sendmobileotp.mdxdeleted file mode 100644index 5359e8b0aa2..00000000000--- a/apps/reference/_supabase_js/generated/auth-api-sendmobileotp.mdx+++ /dev/null@@ -1,115 +0,0 @@-----id: auth-api-sendmobileotp-title: 'sendMobileOTP()'-slug: /auth-api-sendmobileotp-custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml------import Tabs from '@theme/Tabs'-import TabItem from '@theme/TabItem'--Sends a mobile OTP via SMS. Will register the account if it doesn't already exist--## Parameters--<ul className="method-list-group">--<li className="method-list-item">- <h4 className="method-list-item-label">- <span className="method-list-item-label-name">- phone- </span>- <span className="method-list-item-label-badge required">- required- </span>- <span className="method-list-item-validation">- <code>string</code>- </span>- </h4>- <div class="method-list-item-description">--The user's phone number WITH international prefix-- </div>--</li>--<li className="method-list-item">- <h4 className="method-list-item-label">- <span className="method-list-item-label-name">- options- </span>- <span className="method-list-item-label-badge required">- required- </span>- <span className="method-list-item-validation">- <code>object</code>- </span>- </h4>- <div class="method-list-item-description">--No description provided.-- </div>--<ul className="method-list-group">- <h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>--<li className="method-list-item">- <h4 className="method-list-item-label">- <span className="method-list-item-label-name">- captchaToken- </span>- <span className="method-list-item-label-badge false">- optional- </span>- <span className="method-list-item-validation">- <code>string</code>- </span>- </h4>- <div class="method-list-item-description">--No description provided.-- </div>--</li>--<li className="method-list-item">- <h4 className="method-list-item-label">- <span className="method-list-item-label-name">- shouldCreateUser- </span>- <span className="method-list-item-label-badge false">- optional- </span>- <span className="method-list-item-validation">- <code>boolean</code>- </span>- </h4>- <div class="method-list-item-description">--A boolean flag to indicate whether to automatically create a user on magiclink / otp sign-ins if the user doesn't exist. Defaults to true.-- </div>--</li>--</ul>--</li>--</ul>--## Notes--- Requires a `service_role` key.-- This function should only be called on a server. Never expose your `service_role` key in the browser.--## Examples--### Basic example.--```js-const { data: user, error } = await supabase.auth.api.sendMobileOTP('12345879')-```diff --git a/apps/reference/_supabase_js/generated/auth-getuser.mdx b/apps/reference/_supabase_js/generated/auth-getuser.mdxindex 4f3cc0eb488..e178d2112ea 100644--- a/apps/reference/_supabase_js/generated/auth-getuser.mdx+++ b/apps/reference/_supabase_js/generated/auth-getuser.mdx@@ -1,6 +1,6 @@---id: auth-getuser-title: 'getUser()'+title: 'getUserById()'slug: /auth-getusercustom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml---@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'Gets the current user details if there is an existing session.```js-const user = supabase.auth.user()+const user = await supabase.auth.getUser()```## Parameters@@ -49,5 +49,5 @@ This method gets the user object from memory.### Get the logged in user```js-const user = supabase.auth.user()+const user = await supabase.auth.getUser()```diff --git a/apps/reference/_supabase_js/generated/auth-updateuser.mdx b/apps/reference/_supabase_js/generated/auth-updateuser.mdxnew file mode 100644index 00000000000..fa19294716f--- /dev/null+++ b/apps/reference/_supabase_js/generated/auth-updateuser.mdx@@ -0,0 +1,184 @@+---+id: auth-updateuser+title: 'updateUser()'+slug: /auth-updateuser+custom_edit_url: https://github.com/supabase/supabase/edit/master/spec/supabase_js_v2_legacy.yml+---++import Tabs from '@theme/Tabs'+import TabItem from '@theme/TabItem'++Updates user data, if there is a logged in user.++```js+const { user, error } = await supabase.auth.updateUser({+ email: '[email protected]',+})+```++## Parameters++<ul className="method-list-group">++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ UserAttributes+ </span>+ <span className="method-list-item-label-badge required">+ required+ </span>+ <span className="method-list-item-validation">+ <code>object</code>+ </span>+ </h4>+ <div class="method-list-item-description">++No description provided.++ </div>++<ul className="method-list-group">+ <h5 class="method-list-title method-list-title-isChild expanded">Properties</h5>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ data+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>object</code>+ </span>+ </h4>+ <div class="method-list-item-description">++A custom data object for user_metadata that a user can modify. Can be any JSON.++ </div>++</li>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">++The user's email.++ </div>++</li>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ email_change_token+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">++An email change token.++ </div>++</li>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ password+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">++The user's password.++ </div>++</li>++<li className="method-list-item">+ <h4 className="method-list-item-label">+ <span className="method-list-item-label-name">+ phone+ </span>+ <span className="method-list-item-label-badge false">+ optional+ </span>+ <span className="method-list-item-validation">+ <code>string</code>+ </span>+ </h4>+ <div class="method-list-item-description">++The user's phone.++ </div>++</li>++</ul>++</li>++</ul>++## Notes++User email: Email updates will send an email to both the user's current and new email with a confirmation link by default.+To toggle this behavior off and only send a single confirmation link to the new email, toggle "Double confirm email changes" under "Authentication" -> "Settings" off.++User metadata: It's generally better to store user data in a table inside your public schema (i.e. `public.users`).+Use the `update()` method if you have data which rarely changes or is specific only to the logged in user.++## Examples++### Update email for authenticated user.++Sends a "Confirm Email Change" email to the new email address.++```js+const { user, error } = await supabase.auth.updateUser({+ email: '[email protected]',+})+```++### Update password for authenticated user.++```js+const { user, error } = await supabase.auth.updateUser({+ password: 'new password',+})+```++### Update a user's metadata.++```js+const { user, error } = await supabase.auth.updateUser({+ data: { hello: 'world' },+})+```diff --git a/apps/reference/nav/supabase_js_sidebars.js b/apps/reference/nav/supabase_js_sidebars.jsindex 8d3dee35788..57014439e64 100644--- a/apps/reference/nav/supabase_js_sidebars.js+++ b/apps/reference/nav/supabase_js_sidebars.js@@ -58,7 +58,7 @@ const sidebars = {'generated/auth-api-deleteuser','generated/auth-api-generatelink','generated/auth-api-inviteuserbyemail',- 'generated/auth-api-sendmobileotp',+ // 'generated/auth-api-sendmobileotp','generated/auth-api-updateuserbyid',],collapsed: true,diff --git a/packages/generator/LegacyReferenceGenerator.ts b/packages/generator/LegacyReferenceGenerator.tsindex 3a28adbe295..23cf1c460d7 100644--- a/packages/generator/LegacyReferenceGenerator.ts+++ b/packages/generator/LegacyReferenceGenerator.ts@@ -176,11 +176,10 @@ const isUnion = (paramDefinition: TsDoc.TypeDefinition) => {const mergeUnion = (paramDefinition: TsDoc.TypeDefinition) => {const joined = paramDefinition.type.types.reduce((acc, x) => {- acc.push(...x.declaration.children)+ acc.push(...(x.declaration?.children || []))return acc}, [])- console.log('joined', joined)return uniqBy(joined, 'name')}diff --git a/spec/supabase_js_v2_legacy.yml b/spec/supabase_js_v2_legacy.ymlindex faa43cc4faf..9cd50744bc4 100644--- a/spec/supabase_js_v2_legacy.yml+++ b/spec/supabase_js_v2_legacy.yml@@ -375,7 +375,7 @@ pages:```auth.getUser():- title: 'getUser()'+ title: 'getUserById()'$ref: '@supabase/gotrue-js.GoTrueClient.getUser'notes: |This method gets the user object from memory.@@ -384,12 +384,12 @@ pages:isSpotlight: truejs: |```js- const user = supabase.auth.user()+ const user = await supabase.auth.getUser()```- auth.update():- title: 'update()'- $ref: '@supabase/gotrue-js.GoTrueClient.update'+ auth.updateUser():+ title: 'updateUser()'+ $ref: '@supabase/gotrue-js.GoTrueClient.updateUser'notes: |User email: Email updates will send an email to both the user's current and new email with a confirmation link by default.To toggle this behavior off and only send a single confirmation link to the new email, toggle "Double confirm email changes" under "Authentication" -> "Settings" off.@@ -403,19 +403,19 @@ pages:isSpotlight: truejs: |```js- const { user, error } = await supabase.auth.update({email: '[email protected]'})+ const { user, error } = await supabase.auth.updateUser({email: '[email protected]'})```- name: Update password for authenticated user.isSpotlight: truejs: |```js- const { user, error } = await supabase.auth.update({password: 'new password'})+ const { user, error } = await supabase.auth.updateUser({password: 'new password'})```- name: Update a user's metadata.isSpotlight: truejs: |```js- const { user, error } = await supabase.auth.update({+ const { user, error } = await supabase.auth.updateUser({data: { hello: 'world' }})```@@ -533,9 +533,9 @@ pages:if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session)})```- auth.api.getUser():+ auth.api.getUserById():title: 'getUser()'- $ref: '@supabase/gotrue-js.GoTrueApi.getUser'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.getUserById'notes: |- Fetches the user object from the database instead of local storage.- Note that user() fetches the user object from local storage which might not be the most updated.@@ -545,14 +545,12 @@ pages:isSpotlight: truejs: |```js- const { user, error } = await supabase.auth.api.getUser(- 'ACCESS_TOKEN_JWT',- )+ const { user, error } = await supabase.auth.api.getUserById(1)```auth.api.listUsers():title: 'listUsers()'- $ref: '@supabase/gotrue-js.GoTrueApi.listUsers'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.listUsers'notes: |- Requires a `service_role` key.- This function should be called on a server. Never expose your `service_role` key in the browser.@@ -566,7 +564,7 @@ pages:auth.api.createUser():title: 'createUser()'- $ref: '@supabase/gotrue-js.GoTrueApi.createUser'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.createUser'notes: |- Requires a `service_role` key.- This function should be called on a server. Never expose your `service_role` key in the browser.@@ -603,7 +601,7 @@ pages:auth.api.deleteUser():title: 'deleteUser()'- $ref: '@supabase/gotrue-js.GoTrueApi.deleteUser'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.deleteUser'notes: |- Requires a `service_role` key.- This function should be called on a server. Never expose your `service_role` key in the browser.@@ -619,7 +617,7 @@ pages:auth.api.inviteUserByEmail():title: 'inviteUserByEmail()'- $ref: '@supabase/gotrue-js.GoTrueApi.inviteUserByEmail'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.inviteUserByEmail'notes: |- Requires a `service_role` key.- This function should only be called on a server. Never expose your `service_role` key in the browser.@@ -633,25 +631,25 @@ pages:.inviteUserByEmail('[email protected]')```- auth.api.sendMobileOTP():- title: 'sendMobileOTP()'- $ref: '@supabase/gotrue-js.GoTrueApi.sendMobileOTP'- notes: |- - Requires a `service_role` key.- - This function should only be called on a server. Never expose your `service_role` key in the browser.- examples:- - name: Basic example.- isSpotlight: false- js: |- ```js- const { data: user, error } = await supabase.auth- .api- .sendMobileOTP('12345879')- ```+ # auth.api.sendMobileOTP():+ # title: 'sendMobileOTP()'+ # $ref: '@supabase/gotrue-js.GoTrueAdminApi.sendMobileOTP'+ # notes: |+ # - Requires a `service_role` key.+ # - This function should only be called on a server. Never expose your `service_role` key in the browser.+ # examples:+ # - name: Basic example.+ # isSpotlight: false+ # js: |+ # ```js+ # const { data: user, error } = await supabase.auth+ # .api+ # .sendMobileOTP('12345879')+ # ```auth.api.resetPasswordForEmail():title: 'resetPasswordForEmail()'- $ref: '@supabase/gotrue-js.GoTrueApi.resetPasswordForEmail'+ $ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail'notes: |Sends a reset request to an email address.@@ -678,7 +676,7 @@ pages:auth.api.generateLink():title: 'generateLink()'- $ref: '@supabase/gotrue-js.GoTrueApi.generateLink'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.generateLink'notes: |- Requires a `service_role` key.- This function should only be called on a server. Never expose your `service_role` key in the browser.@@ -695,7 +693,7 @@ pages:auth.api.updateUserById():title: 'updateUserById()'- $ref: '@supabase/gotrue-js.GoTrueApi.updateUserById'+ $ref: '@supabase/gotrue-js.GoTrueAdminApi.updateUserById'notes: |- Requires a `service_role` key.- This function should only be called on a server. Never expose your `service_role` key in the browser.