Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

docs: update auth docs

Kang Minge252b48ea69e
diff --git a/apps/reference/_supabase_js/generated/auth-getsession.mdx b/apps/reference/_supabase_js/generated/auth-getsession.mdx
index 4e5654e02f9..5b4fcf0a18d 100644
--- a/apps/reference/_supabase_js/generated/auth-getsession.mdx
+++ b/apps/reference/_supabase_js/generated/auth-getsession.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Returns the session data, refreshing it if necessary.
```js
-const session = supabase.auth.session()
+const { data, error } = supabase.auth.getSession()
```
## Examples
@@ -19,5 +19,5 @@ const session = supabase.auth.session()
### Get the session data
```js
-const session = supabase.auth.session()
+const { data, error } = supabase.auth.getSession()
```
diff --git a/apps/reference/_supabase_js/generated/auth-getuser.mdx b/apps/reference/_supabase_js/generated/auth-getuser.mdx
index 1d5ad12b971..a7186032c96 100644
--- a/apps/reference/_supabase_js/generated/auth-getuser.mdx
+++ b/apps/reference/_supabase_js/generated/auth-getuser.mdx
@@ -11,17 +11,24 @@ import TabItem from '@theme/TabItem'
Returns the user data, refreshing the session if necessary.
```js
-const user = supabase.auth.user()
+const user = supabase.auth.getUser()
```
## Notes
-This method gets the user object from memory.
+- This method gets the user object using the current session.
+- Fetches the user object from the database instead of local storage.
## Examples
-### Get the logged in user
+### Get the logged in user with the current existing session
```js
-const user = supabase.auth.user()
+const user = supabase.auth.getUser()
+```
+
+### Get the logged in user with a custom access token jwt.
+
+```js
+const user = supabase.auth.getUser(jwt)
```
diff --git a/apps/reference/_supabase_js/generated/auth-setsession.mdx b/apps/reference/_supabase_js/generated/auth-setsession.mdx
index 20c7e7fda7a..644f46af9a9 100644
--- a/apps/reference/_supabase_js/generated/auth-setsession.mdx
+++ b/apps/reference/_supabase_js/generated/auth-setsession.mdx
@@ -11,16 +11,7 @@ import TabItem from '@theme/TabItem'
Sets the session data from refresh_token and returns current Session and Error
```js
-function apiFunction(req, res) {
- // Assuming the access token was sent as a header "X-Supabase-Auth"
- const { access_token } = req.get('X-Supabase-Auth')
-
- // You can now use it within a Supabase Client
- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key")
- const { user, error } = supabase.auth.setAuth(access_token)
-
- // This client will now send requests as this user
- const { data } = await supabase.from('your_table').select()
+ const { data, error } = supabase.auth.setSession(refresh_token)
}
```
@@ -54,57 +45,9 @@ a JWT token
### Basic example.
-This is most useful on server-side functions where you cannot log the user in, but have access to the user's access token.
-
-```js
-function apiFunction(req, res) {
- // Assuming the access token was sent as a header "X-Supabase-Auth"
- const { access_token } = req.get('X-Supabase-Auth')
-
- // You can now use it within a Supabase Client
- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key")
- const { user, error } = supabase.auth.setAuth(access_token)
-
- // This client will now send requests as this user
- const { data } = await supabase.from('your_table').select()
-}
-```
-
-### With Express.
+Sets the session data from refresh_token and returns current session or an error if the refresh_token is invalid.
```js
-/**
- * Make a request from the client to your server function
- */
-async function makeApiRequest() {
- const token = newClient.session()?.access_token
-
- await fetch('https://example.com/withAuth', {
- method: 'GET',
- withCredentials: true,
- credentials: 'include',
- headers: {
- 'Content-Type': 'application/json',
- Authorization: bearer, // Your own auth
- 'X-Supabase-Auth': token, // Set the Supabase user
- },
- })
-}
-
-/**
- * Use the Auth token in your server-side function.
- */
-async function apiFunction(req, res) {
- const { access_token } = req.get('X-Supabase-Auth')
-
- // You can now use it within a Supabase Client
- const supabase = createClient(
- 'https://xyzcompany.supabase.co',
- 'public-anon-key'
- )
- const { user, error } = supabase.auth.setAuth(access_token)
-
- // This client will now send requests as this user
- const { data } = await supabase.from('your_table').select()
+ const { data, error } = supabase.auth.setSession(refresh_token)
}
```
diff --git a/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx b/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx
index 2cb605ac432..6cf2cf38952 100644
--- a/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx
+++ b/apps/reference/_supabase_js/generated/auth-signinwithoauth.mdx
@@ -10,13 +10,6 @@ import TabItem from '@theme/TabItem'
Log in an existing user via a third-party provider.
-```js
-const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
- password: 'example-password',
-})
-```
-
## Parameters
<ul className="method-list-group">
@@ -45,71 +38,32 @@ No description provided.
## Notes
-- A user can sign up either via email or OAuth.
-- If you provide `email` without a `password`, the user will be sent a magic link.
-- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
-- Specifying a `provider` will open the browser to the relevant login page.
+- 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
-### Sign in with email.
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
- password: 'example-password',
-})
-```
-
-### Sign in with magic link.
-
-If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
-})
-```
-
-### Sign in using third-party providers.
-
-Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
+### Sign in using a third-party provider.
```js
-const { user, session, error } = await supabase.auth.signIn({
- // provider can be 'github', 'google', 'gitlab', and more
+const { data, error } = await supabase.auth.signInWithOAuth({
provider: 'github',
})
```
-### Sign in with Phone.
-
-Supabase supports Phone Auth.
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
- phone: '+13334445555',
- password: 'some-password',
-})
-```
-
-### Sign in with redirect.
-
-Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by
-the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template).
+### Sign in using a third-party provider with redirect.
-Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for
+The `redirectTo` param will only applied on the callback made from the third-party provider. It does not redirect the user immediately after invoking this method.
+In order for the `redirectTo` param to be allowed, one needs to include it in an allowlist. Supabase supports this for
any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
```js
-const { user, session, error } = await supabase.auth.signIn(
- {
- provider: 'github',
- },
- {
- redirectTo: 'https://example.com/welcome',
+const { user, session, error } = await supabase.auth.signInWithOAuth({
+ provider: 'github'
+ options: {
+ redirectTo: 'https://example.com/welcome'
}
-)
+}
```
### Sign in with scopes.
@@ -118,33 +72,11 @@ If you need additional data from an OAuth provider, you can include a space-sepa
You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider.
```js
-const { user, session, error } = await supabase.auth.signIn(
- {
- provider: 'github',
- },
- {
- scopes: 'repo gist notifications',
+const { data, error } = await supabase.auth.signInWithOAuth({
+ provider: 'github'
+ options: {
+ scopes: 'repo gist notifications'
}
-)
-const oAuthToken = session.provider_token // use to access provider API
-```
-
-### Sign in using a refresh token (e.g. in React Native).
-
-If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session.
-
-```js
-// An example using Expo's `AuthSession`
-const redirectUri = AuthSession.makeRedirectUri({ useProxy: false })
-const provider = 'google'
-
-AuthSession.startAsync({
- authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`,
- returnUrl: redirectUri,
-}).then(async (response: any) => {
- if (!response) return
- const { user, session, error } = await supabase.auth.signIn({
- refreshToken: response.params?.refresh_token,
- })
})
+const oAuthToken = data.session.provider_token // use to access provider API
```
diff --git a/apps/reference/_supabase_js/generated/auth-signinwithotp.mdx b/apps/reference/_supabase_js/generated/auth-signinwithotp.mdx
index e632049cfe9..02fb0743f62 100644
--- a/apps/reference/_supabase_js/generated/auth-signinwithotp.mdx
+++ b/apps/reference/_supabase_js/generated/auth-signinwithotp.mdx
@@ -11,9 +11,8 @@ import TabItem from '@theme/TabItem'
Passwordless method for logging in an existing user.
```js
-const { user, session, error } = await supabase.auth.signIn({
+const { data, error } = await supabase.auth.signInWithOtp({
- password: 'example-password',
})
```
@@ -45,106 +44,30 @@ No description provided.
## Notes
-- A user can sign up either via email or OAuth.
-- If you provide `email` without a `password`, the user will be sent a magic link.
+- This method is used for passwordless sign-ins where an otp is sent to the user's email or phone number.
+- Requires either an email or phone number.
+- If you're using an email, you can configure whether you want the user to receive a magiclink or an otp.
+- If you're using phone, you can configure whether you want the user to receive a magiclink or an otp.
- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
-- Specifying a `provider` will open the browser to the relevant login page.
## Examples
### Sign in with email.
-```js
-const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
- password: 'example-password',
-})
-```
-
-### Sign in with magic link.
-
-If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
+The user will be sent an otp to their email. By default, a given user can only request an otp once every 60 seconds.
```js
-const { user, session, error } = await supabase.auth.signIn({
+const { data, error } = await supabase.auth.signInWithOtp({
})
```
-### Sign in using third-party providers.
+### Sign in with sms otp.
-Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
+The user will be sent an otp to their phone number. By default, a given user can only request an otp once every 60 seconds.
```js
-const { user, session, error } = await supabase.auth.signIn({
- // provider can be 'github', 'google', 'gitlab', and more
- provider: 'github',
-})
-```
-
-### Sign in with Phone.
-
-Supabase supports Phone Auth.
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
+const { data, error } = await supabase.auth.signInWithPassword({
phone: '+13334445555',
- password: 'some-password',
-})
-```
-
-### Sign in with redirect.
-
-Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by
-the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template).
-
-Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for
-any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
-
-```js
-const { user, session, error } = await supabase.auth.signIn(
- {
- provider: 'github',
- },
- {
- redirectTo: 'https://example.com/welcome',
- }
-)
-```
-
-### Sign in with scopes.
-
-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.
-
-```js
-const { user, session, error } = await supabase.auth.signIn(
- {
- provider: 'github',
- },
- {
- scopes: 'repo gist notifications',
- }
-)
-const oAuthToken = session.provider_token // use to access provider API
-```
-
-### Sign in using a refresh token (e.g. in React Native).
-
-If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session.
-
-```js
-// An example using Expo's `AuthSession`
-const redirectUri = AuthSession.makeRedirectUri({ useProxy: false })
-const provider = 'google'
-
-AuthSession.startAsync({
- authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`,
- returnUrl: redirectUri,
-}).then(async (response: any) => {
- if (!response) return
- const { user, session, error } = await supabase.auth.signIn({
- refreshToken: response.params?.refresh_token,
- })
})
```
diff --git a/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx b/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx
index 8ac1276df9c..22a302f9100 100644
--- a/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx
+++ b/apps/reference/_supabase_js/generated/auth-signinwithpassword.mdx
@@ -10,13 +10,6 @@ import TabItem from '@theme/TabItem'
Log in an existing user, or login via a third-party provider.
-```js
-const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
- password: 'example-password',
-})
-```
-
## Parameters
<ul className="method-list-group">
@@ -45,106 +38,4 @@ No description provided.
## Notes
-- A user can sign up either via email or OAuth.
-- If you provide `email` without a `password`, the user will be sent a magic link.
-- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
-- Specifying a `provider` will open the browser to the relevant login page.
-
-## Examples
-
-### Sign in with email.
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
- password: 'example-password',
-})
-```
-
-### Sign in with magic link.
-
-If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
-})
-```
-
-### Sign in using third-party providers.
-
-Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
- // provider can be 'github', 'google', 'gitlab', and more
- provider: 'github',
-})
-```
-
-### Sign in with Phone.
-
-Supabase supports Phone Auth.
-
-```js
-const { user, session, error } = await supabase.auth.signIn({
- phone: '+13334445555',
- password: 'some-password',
-})
-```
-
-### Sign in with redirect.
-
-Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by
-the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template).
-
-Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for
-any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
-
-```js
-const { user, session, error } = await supabase.auth.signIn(
- {
- provider: 'github',
- },
- {
- redirectTo: 'https://example.com/welcome',
- }
-)
-```
-
-### Sign in with scopes.
-
-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.
-
-```js
-const { user, session, error } = await supabase.auth.signIn(
- {
- provider: 'github',
- },
- {
- scopes: 'repo gist notifications',
- }
-)
-const oAuthToken = session.provider_token // use to access provider API
-```
-
-### Sign in using a refresh token (e.g. in React Native).
-
-If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session.
-
-```js
-// An example using Expo's `AuthSession`
-const redirectUri = AuthSession.makeRedirectUri({ useProxy: false })
-const provider = 'google'
-
-AuthSession.startAsync({
- authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`,
- returnUrl: redirectUri,
-}).then(async (response: any) => {
- if (!response) return
- const { user, session, error } = await supabase.auth.signIn({
- refreshToken: response.params?.refresh_token,
- })
-})
-```
+- Requires either an email and password or a phone number and password.
diff --git a/apps/reference/_supabase_js/generated/auth-signup.mdx b/apps/reference/_supabase_js/generated/auth-signup.mdx
index b54baaf836d..3e47c0ab565 100644
--- a/apps/reference/_supabase_js/generated/auth-signup.mdx
+++ b/apps/reference/_supabase_js/generated/auth-signup.mdx
@@ -11,7 +11,7 @@ import TabItem from '@theme/TabItem'
Creates a new user.
```js
-const { user, session, error } = await supabase.auth.signUp({
+const { data, error } = await supabase.auth.signUp({
password: 'example-password',
})
@@ -144,7 +144,7 @@ The redirect URL attached to the signup confirmation link. Does not redirect the
### Sign up.
```js
-const { user, session, error } = await supabase.auth.signUp({
+const { data, error } = await supabase.auth.signUp({
password: 'example-password',
})
@@ -153,37 +153,14 @@ const { user, session, error } = await supabase.auth.signUp({
### Sign up with additional user meta data.
```js
-const { user, session, error } = await supabase.auth.signUp(
- {
- email: '[email protected]',
- password: 'example-password',
- },
- {
+const { data, error } = await supabase.auth.signUp({
+ email: '[email protected]',
+ password: 'example-password',
+ options: {
data: {
first_name: 'John',
age: 27,
},
- }
-)
-```
-
-### Sign up with third-party providers.
-
-You can sign up with OAuth providers using the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers) method.
-
-### Sign up with Phone.
-
-Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.
-
-```js
-const { user, session, error } = await supabase.auth.signUp({
- phone: '+13334445555',
- password: 'some-password',
-})
-
-// After receiving an SMS with One Time Password.
-let { session, error } = await supabase.auth.verifyOTP({
- phone: '+13334445555',
- token: '123456',
+ },
})
```
diff --git a/package-lock.json b/package-lock.json
index b5779a21969..48c2fca0e22 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3489,6 +3489,28 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
+ "node_modules/@cspotcode/source-map-support": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/trace-mapping": "0.3.9"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@cspotcode/source-map-support/node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+ "dev": true,
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.0.3",
+ "@jridgewell/sourcemap-codec": "^1.4.10"
+ }
+ },
"node_modules/@csstools/convert-colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz",
@@ -5007,7 +5029,7 @@
}
},
"node_modules/@supabase/generator": {
- "resolved": "packages/spec",
+ "resolved": "packages/generator",
"link": true
},
"node_modules/@supabase/gotrue-js": {
@@ -5122,6 +5144,30 @@
"node": ">= 6"
}
},
+ "node_modules/@tsconfig/node10": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
+ "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
+ "dev": true
+ },
+ "node_modules/@tsconfig/node12": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
+ "dev": true
+ },
+ "node_modules/@tsconfig/node14": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
+ "dev": true
+ },
+ "node_modules/@tsconfig/node16": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
+ "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
+ "dev": true
+ },
"node_modules/@types/babel__core": {
"version": "7.1.19",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
@@ -5268,6 +5314,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"devOptional": true
},
+ "node_modules/@types/json-stringify-safe": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/@types/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz",
+ "integrity": "sha512-UUA1sH0RSRROdInuDOA1yoRzbi5xVFD1RHCoOvNRPTNwR8zBkJ/84PZ6NhKVDtKp0FTeIccJCdQz1X2aJPr4uw==",
+ "dev": true
+ },
"node_modules/@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -9348,6 +9400,12 @@
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
"integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ=="
},
+ "node_modules/hosted-git-info": {
+ "version": "2.8.9",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
+ "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
+ "dev": true
+ },
"node_modules/html-encoding-sniffer": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz",
@@ -10957,6 +11015,12 @@
"node": ">=4"
}
},
+ "node_modules/json-parse-better-errors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+ "dev": true
+ },
"node_modules/json-parse-even-better-errors": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
@@ -10973,6 +11037,11 @@
"resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
"integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="
},
+ "node_modules/json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
+ },
"node_modules/json5": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
@@ -11086,6 +11155,52 @@
"node": ">=0.10.0"
}
},
+ "node_modules/load-json-file": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
+ "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==",
+ "dev": true,
+ "dependencies": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^4.0.0",
+ "pify": "^3.0.0",
+ "strip-bom": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/load-json-file/node_modules/parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==",
+ "dev": true,
+ "dependencies": {
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/load-json-file/node_modules/pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/load-json-file/node_modules/strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/loader-runner": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
@@ -11582,6 +11697,15 @@
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
+ "node_modules/memorystream": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
+ "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.10.0"
+ }
+ },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -12510,6 +12634,12 @@
"url": "https://opencollective.com/postcss/"
}
},
+ "node_modules/nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
"node_modules/node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
@@ -12577,6 +12707,27 @@
"node": ">=6.0.0"
}
},
+ "node_modules/normalize-package-data": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
+ "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "dev": true,
+ "dependencies": {
+ "hosted-git-info": "^2.1.4",
+ "resolve": "^1.10.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ }
+ },
+ "node_modules/normalize-package-data/node_modules/semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver"
+ }
+ },
"node_modules/normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
@@ -12593,6 +12744,125 @@
"node": ">=0.10.0"
}
},
+ "node_modules/npm-run-all": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz",
+ "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^3.2.1",
+ "chalk": "^2.4.1",
+ "cross-spawn": "^6.0.5",
+ "memorystream": "^0.3.1",
+ "minimatch": "^3.0.4",
+ "pidtree": "^0.3.0",
+ "read-pkg": "^3.0.0",
+ "shell-quote": "^1.6.1",
+ "string.prototype.padend": "^3.0.0"
+ },
+ "bin": {
+ "npm-run-all": "bin/npm-run-all/index.js",
+ "run-p": "bin/run-p/index.js",
+ "run-s": "bin/run-s/index.js"
+ },
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "dependencies": {
+ "color-convert": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "dependencies": {
+ "color-name": "1.1.3"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
+ "dev": true
+ },
+ "node_modules/npm-run-all/node_modules/cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "dependencies": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ },
+ "engines": {
+ "node": ">=4.8"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
+ "dev": true,
+ "dependencies": {
+ "shebang-regex": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/npm-run-all/node_modules/which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "which": "bin/which"
+ }
+ },
"node_modules/npm-run-path": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
@@ -12927,6 +13197,18 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/pidtree": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz",
+ "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==",
+ "dev": true,
+ "bin": {
+ "pidtree": "bin/pidtree.js"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
"node_modules/pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
@@ -14856,6 +15138,41 @@
"pify": "^2.3.0"
}
},
+ "node_modules/read-pkg": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
+ "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==",
+ "dev": true,
+ "dependencies": {
+ "load-json-file": "^4.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/read-pkg/node_modules/path-type": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
+ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
+ "dev": true,
+ "dependencies": {
+ "pify": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/read-pkg/node_modules/pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==",
+ "dev": true,
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
@@ -15832,6 +16149,12 @@
"node": ">=8"
}
},
+ "node_modules/shell-quote": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz",
+ "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==",
+ "dev": true
+ },
"node_modules/side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
@@ -15917,6 +16240,38 @@
"url": "https://github.com/sponsors/wooorm"
}
},
+ "node_modules/spdx-correct": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
+ "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "dev": true,
+ "dependencies": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "node_modules/spdx-exceptions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
+ "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
+ "dev": true
+ },
+ "node_modules/spdx-expression-parse": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
+ "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "dev": true,
+ "dependencies": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "node_modules/spdx-license-ids": {
+ "version": "3.0.11",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz",
+ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==",
+ "dev": true
+ },
"node_modules/sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -16023,6 +16378,23 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/string.prototype.padend": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.3.tgz",
+ "integrity": "sha512-jNIIeokznm8SD/TZISQsZKYu7RJyheFNt84DUPrh482GC8RVp2MKqm2O5oBRdGxbDQoXrhhWtPIWQOiy20svUg==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.19.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/string.prototype.trimend": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz",
@@ -17437,6 +17809,12 @@
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA=="
},
+ "node_modules/v8-compile-cache-lib": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
+ "dev": true
+ },
"node_modules/v8-to-istanbul": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",
@@ -17460,6 +17838,16 @@
"node": ">= 8"
}
},
+ "node_modules/validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "dependencies": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
"node_modules/vfile": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz",
@@ -17984,24 +18372,30 @@
"version": "2.2.0",
"license": "MIT"
},
- "packages/spec": {
- "name": "@supabase/generator",
+ "packages/generator": {
"version": "0.0.0",
"license": "MIT",
+ "dependencies": {
+ "json-stringify-safe": "^5.0.1"
+ },
"devDependencies": {
"@apidevtools/swagger-cli": "^4.0.4",
+ "@types/json-stringify-safe": "^5.0.0",
"@types/lodash": "^4.14.182",
"ejs": "^3.1.8",
"js-yaml": "^4.1.0",
"lodash": "^4.17.21",
+ "npm-run-all": "^4.1.5",
"openapi-types": "^12.0.0",
+ "prettier": "^2.7.1",
"ts-node": "^10.9.1"
}
},
- "packages/spec/node_modules/acorn": {
+ "packages/generator/node_modules/acorn": {
"version": "8.8.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz",
+ "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==",
"dev": true,
- "license": "MIT",
"bin": {
"acorn": "bin/acorn"
},
@@ -18009,28 +18403,32 @@
"node": ">=0.4.0"
}
},
- "packages/spec/node_modules/acorn-walk": {
+ "packages/generator/node_modules/acorn-walk": {
"version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
+ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
"dev": true,
- "license": "MIT",
"engines": {
"node": ">=0.4.0"
}
},
- "packages/spec/node_modules/arg": {
+ "packages/generator/node_modules/arg": {
"version": "4.1.3",
- "dev": true,
- "license": "MIT"
+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
+ "dev": true
},
- "packages/spec/node_modules/argparse": {
+ "packages/generator/node_modules/argparse": {
"version": "2.0.1",
- "dev": true,
- "license": "Python-2.0"
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true
},
- "packages/spec/node_modules/js-yaml": {
+ "packages/generator/node_modules/js-yaml": {
"version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
- "license": "MIT",
"dependencies": {
"argparse": "^2.0.1"
},
@@ -18038,10 +18436,11 @@
"js-yaml": "bin/js-yaml.js"
}
},
- "packages/spec/node_modules/ts-node": {
+ "packages/generator/node_modules/ts-node": {
"version": "10.9.1",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
+ "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
"dev": true,
- "license": "MIT",
"dependencies": {
"@cspotcode/source-map-support": "^0.8.0",
"@tsconfig/node10": "^1.0.7",
@@ -18080,6 +18479,21 @@
}
}
},
+ "packages/spec": {
+ "name": "@supabase/generator",
+ "version": "0.0.0",
+ "extraneous": true,
+ "license": "MIT",
+ "devDependencies": {
+ "@apidevtools/swagger-cli": "^4.0.4",
+ "@types/lodash": "^4.14.182",
+ "ejs": "^3.1.8",
+ "js-yaml": "^4.1.0",
+ "lodash": "^4.17.21",
+ "openapi-types": "^12.0.0",
+ "ts-node": "^10.9.1"
+ }
+ },
"packages/tsconfig": {
"version": "0.0.0"
}
@@ -19413,6 +19827,27 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
+ "@cspotcode/source-map-support": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+ "dev": true,
+ "requires": {
+ "@jridgewell/trace-mapping": "0.3.9"
+ },
+ "dependencies": {
+ "@jridgewell/trace-mapping": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+ "dev": true,
+ "requires": {
+ "@jridgewell/resolve-uri": "^3.0.3",
+ "@jridgewell/sourcemap-codec": "^1.4.10"
+ }
+ }
+ }
+ },
"@csstools/convert-colors": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/@csstools/convert-colors/-/convert-colors-1.4.0.tgz",
@@ -20559,35 +20994,49 @@
}
},
"@supabase/generator": {
- "version": "file:packages/spec",
+ "version": "file:packages/generator",
"requires": {
"@apidevtools/swagger-cli": "^4.0.4",
+ "@types/json-stringify-safe": "^5.0.0",
"@types/lodash": "^4.14.182",
"ejs": "^3.1.8",
"js-yaml": "^4.1.0",
+ "json-stringify-safe": "^5.0.1",
"lodash": "^4.17.21",
+ "npm-run-all": "^4.1.5",
"openapi-types": "^12.0.0",
+ "prettier": "^2.7.1",
"ts-node": "^10.9.1"
},
"dependencies": {
"acorn": {
"version": "8.8.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz",
+ "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==",
"dev": true
},
"acorn-walk": {
"version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
+ "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
"dev": true
},
"arg": {
"version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
+ "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==",
"dev": true
},
"argparse": {
"version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"js-yaml": {
"version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
+ "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
"dev": true,
"requires": {
"argparse": "^2.0.1"
@@ -20595,6 +21044,8 @@
},
"ts-node": {
"version": "10.9.1",
+ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz",
+ "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==",
"dev": true,
"requires": {
"@cspotcode/source-map-support": "^0.8.0",
@@ -20711,6 +21162,30 @@
"resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz",
"integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw=="
},
+ "@tsconfig/node10": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz",
+ "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==",
+ "dev": true
+ },
+ "@tsconfig/node12": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz",
+ "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==",
+ "dev": true
+ },
+ "@tsconfig/node14": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz",
+ "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==",
+ "dev": true
+ },
+ "@tsconfig/node16": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
+ "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
+ "dev": true
+ },
"@types/babel__core": {
"version": "7.1.19",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz",
@@ -20856,6 +21331,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"devOptional": true
},
+ "@types/json-stringify-safe": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/@types/json-stringify-safe/-/json-stringify-safe-5.0.0.tgz",
+ "integrity": "sha512-UUA1sH0RSRROdInuDOA1yoRzbi5xVFD1RHCoOvNRPTNwR8zBkJ/84PZ6NhKVDtKp0FTeIccJCdQz1X2aJPr4uw==",
+ "dev": true
+ },
"@types/json5": {
"version": "0.0.29",
"resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz",
@@ -24510,6 +24991,12 @@
}
}
},
+ "hosted-git-info": {
+ "version": "2.8.9",
+ "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz",
+ "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==",
+ "dev": true
+ },
"html-encoding-sniffer": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz",
@@ -25689,6 +26176,12 @@
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz",
"integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA=="
},
+ "json-parse-better-errors": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
+ "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
+ "dev": true
+ },
"json-parse-even-better-errors": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
@@ -25705,6 +26198,11 @@
"resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
"integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw=="
},
+ "json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA=="
+ },
"json5": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz",
@@ -25788,6 +26286,42 @@
"repeat-string": "^1.5.2"
}
},
+ "load-json-file": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz",
+ "integrity": "sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==",
+ "dev": true,
+ "requires": {
+ "graceful-fs": "^4.1.2",
+ "parse-json": "^4.0.0",
+ "pify": "^3.0.0",
+ "strip-bom": "^3.0.0"
+ },
+ "dependencies": {
+ "parse-json": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz",
+ "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==",
+ "dev": true,
+ "requires": {
+ "error-ex": "^1.3.1",
+ "json-parse-better-errors": "^1.0.1"
+ }
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==",
+ "dev": true
+ },
+ "strip-bom": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
+ "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==",
+ "dev": true
+ }
+ }
+ },
"loader-runner": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-4.3.0.tgz",
@@ -26167,6 +26701,12 @@
"resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
"integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g=="
},
+ "memorystream": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz",
+ "integrity": "sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==",
+ "dev": true
+ },
"merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -26678,6 +27218,12 @@
"escalade": "^3.1.1"
}
},
+ "nice-try": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz",
+ "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==",
+ "dev": true
+ },
"node-fetch": {
"version": "2.6.7",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
@@ -26728,6 +27274,26 @@
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.7.8.tgz",
"integrity": "sha512-2zaTFGqZixVmTxpJRCFC+Vk5eGRd/fYtvIR+dl5u9QXLTQWGIf48x/JXvo58g9sa0bU6To04XUv554Paykum3g=="
},
+ "normalize-package-data": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz",
+ "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==",
+ "dev": true,
+ "requires": {
+ "hosted-git-info": "^2.1.4",
+ "resolve": "^1.10.0",
+ "semver": "2 || 3 || 4 || 5",
+ "validate-npm-package-license": "^3.0.1"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ }
+ }
+ },
"normalize-path": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
@@ -26738,6 +27304,98 @@
"resolved": "https://registry.npmjs.org/normalize-range/-/normalize-range-0.1.2.tgz",
"integrity": "sha512-bdok/XvKII3nUpklnV6P2hxtMNrCboOjAcyBuQnWEhO665FwrSNRxU+AqpsyvO6LgGYPspN+lu5CLtw4jPRKNA=="
},
+ "npm-run-all": {
+ "version": "4.1.5",
+ "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz",
+ "integrity": "sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "chalk": "^2.4.1",
+ "cross-spawn": "^6.0.5",
+ "memorystream": "^0.3.1",
+ "minimatch": "^3.0.4",
+ "pidtree": "^0.3.0",
+ "read-pkg": "^3.0.0",
+ "shell-quote": "^1.6.1",
+ "string.prototype.padend": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==",
+ "dev": true
+ },
+ "cross-spawn": {
+ "version": "6.0.5",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz",
+ "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==",
+ "dev": true,
+ "requires": {
+ "nice-try": "^1.0.4",
+ "path-key": "^2.0.1",
+ "semver": "^5.5.0",
+ "shebang-command": "^1.2.0",
+ "which": "^1.2.9"
+ }
+ },
+ "path-key": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz",
+ "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==",
+ "dev": true
+ },
+ "semver": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
+ "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true
+ },
+ "shebang-command": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
+ "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==",
+ "dev": true,
+ "requires": {
+ "shebang-regex": "^1.0.0"
+ }
+ },
+ "shebang-regex": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
+ "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==",
+ "dev": true
+ },
+ "which": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
+ "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==",
+ "dev": true,
+ "requires": {
+ "isexe": "^2.0.0"
+ }
+ }
+ }
+ },
"npm-run-path": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz",
@@ -26978,6 +27636,12 @@
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="
},
+ "pidtree": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.1.tgz",
+ "integrity": "sha512-qQbW94hLHEqCg7nhby4yRC7G2+jYHY4Rguc2bjw7Uug4GIJuu1tvf2uHaZv5Q8zdt+WKJ6qK1FOI6amaWUo5FA==",
+ "dev": true
+ },
"pify": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
@@ -28392,6 +29056,34 @@
"pify": "^2.3.0"
}
},
+ "read-pkg": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-3.0.0.tgz",
+ "integrity": "sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==",
+ "dev": true,
+ "requires": {
+ "load-json-file": "^4.0.0",
+ "normalize-package-data": "^2.3.2",
+ "path-type": "^3.0.0"
+ },
+ "dependencies": {
+ "path-type": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz",
+ "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==",
+ "dev": true,
+ "requires": {
+ "pify": "^3.0.0"
+ }
+ },
+ "pify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz",
+ "integrity": "sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==",
+ "dev": true
+ }
+ }
+ },
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
@@ -29129,6 +29821,12 @@
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
"integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="
},
+ "shell-quote": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz",
+ "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==",
+ "dev": true
+ },
"side-channel": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
@@ -29192,6 +29890,38 @@
"resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.5.tgz",
"integrity": "sha512-q/JSVd1Lptzhf5bkYm4ob4iWPjx0KiRe3sRFBNrVqbJkFaBm5vbbowy1mymoPNLRa52+oadOhJ+K49wsSeSjTA=="
},
+ "spdx-correct": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
+ "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==",
+ "dev": true,
+ "requires": {
+ "spdx-expression-parse": "^3.0.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-exceptions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz",
+ "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==",
+ "dev": true
+ },
+ "spdx-expression-parse": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz",
+ "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==",
+ "dev": true,
+ "requires": {
+ "spdx-exceptions": "^2.1.0",
+ "spdx-license-ids": "^3.0.0"
+ }
+ },
+ "spdx-license-ids": {
+ "version": "3.0.11",
+ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz",
+ "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==",
+ "dev": true
+ },
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
@@ -29283,6 +30013,17 @@
"side-channel": "^1.0.4"
}
},
+ "string.prototype.padend": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/string.prototype.padend/-/string.prototype.padend-3.1.3.tgz",
+ "integrity": "sha512-jNIIeokznm8SD/TZISQsZKYu7RJyheFNt84DUPrh482GC8RVp2MKqm2O5oBRdGxbDQoXrhhWtPIWQOiy20svUg==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.1.3",
+ "es-abstract": "^1.19.1"
+ }
+ },
"string.prototype.trimend": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz",
@@ -30452,6 +31193,12 @@
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
"integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA=="
},
+ "v8-compile-cache-lib": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz",
+ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
+ "dev": true
+ },
"v8-to-istanbul": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",
@@ -30471,6 +31218,16 @@
}
}
},
+ "validate-npm-package-license": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz",
+ "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==",
+ "dev": true,
+ "requires": {
+ "spdx-correct": "^3.0.0",
+ "spdx-expression-parse": "^3.0.0"
+ }
+ },
"vfile": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/vfile/-/vfile-4.2.1.tgz",
diff --git a/spec/supabase_js_v2_legacy.yml b/spec/supabase_js_v2_legacy.yml
index 11bf41a8a7b..932d7d0b866 100644
--- a/spec/supabase_js_v2_legacy.yml
+++ b/spec/supabase_js_v2_legacy.yml
@@ -33,7 +33,7 @@ pages:
isSpotlight: true
js: |
```js
- const { user, session, error } = await supabase.auth.signUp({
+ const { data, error } = await supabase.auth.signUp({
password: 'example-password',
})
@@ -42,230 +42,106 @@ pages:
isSpotlight: true
js: |
```js
- const { user, session, error } = await supabase.auth.signUp(
+ const { data, error } = await supabase.auth.signUp(
{
password: 'example-password',
- },
- {
- data: {
- first_name: 'John',
- age: 27,
+ options: {
+ data: {
+ first_name: 'John',
+ age: 27,
+ }
}
}
)
```
- - name: Sign up with third-party providers.
- hideCodeBlock: true
- description: |
- You can sign up with OAuth providers using the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-third-party-providers) method.
- - name: Sign up with Phone.
- description: |
- Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signUp({
- phone: '+13334445555',
- password: 'some-password',
- })
-
- // After receiving an SMS with One Time Password.
- let { session, error } = await supabase.auth.verifyOTP({
- phone: '+13334445555',
- token: '123456',
- })
- ```
-
auth.signInWithPassword():
title: 'signInWithPassword()'
$ref: '@supabase/gotrue-js.GoTrueClient.signInWithPassword'
notes: |
- - A user can sign up either via email or phone.
- examples:
- - name: Sign in with email.
- isSpotlight: true
+ - Requires either an email and password or a phone number and password.
+ example:
+ - name: Sign in with Email.
+ description: |
+ Sign in with email and password. After a user has verified their email, they can use the [`signInWithPassword()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.
js: |
```js
- const { user, session, error } = await supabase.auth.signInWithPassword({
+ const { data, error } = await supabase.auth.signInWithPassword({
password: 'example-password',
})
```
- name: Sign in with Phone.
- description: Supabase supports Phone Auth.
+ description: |
+ Supabase supports Phone Auth. After a user has verified their number, they can use the [`signIn()`](/docs/reference/javascript/auth-signin#sign-in-using-phone) method.
js: |
```js
- const { user, session, error } = await supabase.auth.signInWithPassword({
+ const { data, error } = await supabase.auth.signInWithPassword({
phone: '+13334445555',
password: 'some-password',
})
- ```
- - name: Sign in with redirect.
- description: |
- Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by
- the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template).
-
- Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for
- any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signInWithPassword({
- provider: 'github'
- }, {
- redirectTo: 'https://example.com/welcome'
+
+ // After receiving an SMS with One Time Password.
+ let { data, error } = await supabase.auth.verifyOtp({
+ phone: '+13334445555',
+ token: '123456',
})
```
-
auth.signInWithOtp():
title: 'signInWithOtp()'
$ref: '@supabase/gotrue-js.GoTrueClient.signInWithOtp'
notes: |
- - A user can sign up either via email or OAuth.
- - If you provide `email` without a `password`, the user will be sent a magic link.
+ - This method is used for passwordless sign-ins where an otp is sent to the user's email or phone number.
+ - Requires either an email or phone number.
+ - If you're using an email, you can configure whether you want the user to receive a magiclink or an otp.
+ - If you're using phone, you can configure whether you want the user to receive a magiclink or an otp.
- The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
- - Specifying a `provider` will open the browser to the relevant login page.
examples:
- name: Sign in with email.
isSpotlight: true
+ description: The user will be sent an otp to their email. By default, a given user can only request an otp once every 60 seconds.
js: |
```js
- const { user, session, error } = await supabase.auth.signIn({
+ const { data, error } = await supabase.auth.signInWithOtp({
- password: 'example-password',
})
```
- - name: Sign in with magic link.
- description: If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- })
- ```
- - name: Sign in using third-party providers.
- description: Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- // provider can be 'github', 'google', 'gitlab', and more
- provider: 'github'
- })
- ```
- - name: Sign in with Phone.
- description: Supabase supports Phone Auth.
+ - name: Sign in with sms otp.
+ isSpotlight: true
+ description: The user will be sent an otp to their phone number. By default, a given user can only request an otp once every 60 seconds.
js: |
```js
- const { user, session, error } = await supabase.auth.signIn({
+ const { data, error } = await supabase.auth.signInWithPassword({
phone: '+13334445555',
- password: 'some-password',
- })
- ```
- - name: Sign in with redirect.
- description: |
- Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by
- the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template).
-
- Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for
- any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- provider: 'github'
- }, {
- redirectTo: 'https://example.com/welcome'
})
```
- - name: Sign in with scopes.
- 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.
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- provider: 'github'
- }, {
- scopes: 'repo gist notifications'
- })
- const oAuthToken = session.provider_token // use to access provider API
- ```
- - name: Sign in using a refresh token (e.g. in React Native).
- description: |
- If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session.
- js: |
- ```js
- // An example using Expo's `AuthSession`
- const redirectUri = AuthSession.makeRedirectUri({ useProxy: false });
- const provider = 'google';
-
- AuthSession.startAsync({
- authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`,
- returnUrl: redirectUri,
- }).then(async (response: any) => {
- if (!response) return;
- const { user, session, error } = await supabase.auth.signIn({
- refreshToken: response.params?.refresh_token,
- });
- });
- ```
-
auth.signInWithOAuth():
title: 'signInWithOAuth()'
$ref: '@supabase/gotrue-js.GoTrueClient.signInWithOAuth'
notes: |
- - A user can sign up either via email or OAuth.
- - If you provide `email` without a `password`, the user will be sent a magic link.
- - The magic link's destination URL is determined by the SITE_URL config variable. To change this, you can go to Authentication -> Settings on [app.supabase.com](https://app.supabase.com)
- - Specifying a `provider` will open the browser to the relevant login page.
+ - 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 with email.
- isSpotlight: true
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- email: '[email protected]',
- password: 'example-password',
- })
- ```
- - name: Sign in with magic link.
- description: If no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- })
- ```
- - name: Sign in using third-party providers.
- description: Supabase supports many different [third-party providers](https://supabase.com/docs/guides/auth#providers).
+ - name: Sign in using a third-party provider.
js: |
```js
- const { user, session, error } = await supabase.auth.signIn({
- // provider can be 'github', 'google', 'gitlab', and more
+ const { data, error } = await supabase.auth.signInWithOAuth({
provider: 'github'
})
```
- - name: Sign in with Phone.
- description: Supabase supports Phone Auth.
- js: |
- ```js
- const { user, session, error } = await supabase.auth.signIn({
- phone: '+13334445555',
- password: 'some-password',
- })
- ```
- - name: Sign in with redirect.
+ - name: Sign in using a third-party provider with redirect.
description: |
- Note that the `redirectTo` param is only relevant for OAuth logins, where the login flow is managed by
- the Auth server. If you are using email/phone logins you should set up your own redirects (within the email/sms template).
-
- Sometimes you want to control where the user is redirected to after they are logged in. Supabase supports this for
+ The `redirectTo` param will only applied on the callback made from the third-party provider. It does not redirect the user immediately after invoking this method.
+ In order for the `redirectTo` param to be allowed, one needs to include it in an allowlist. Supabase supports this for
any URL path on your website (the URL must either be on the same domain as your Site URL [see Auth>Settings in dashboard], or must match one of the Additional Redirect URLs [also in Auth>Settings]).
js: |
```js
- const { user, session, error } = await supabase.auth.signIn({
+ const { user, session, error } = await supabase.auth.signInWithOAuth({
provider: 'github'
- }, {
- redirectTo: 'https://example.com/welcome'
- })
+ options: {
+ redirectTo: 'https://example.com/welcome'
+ }
+ }
```
- name: Sign in with scopes.
description: |
@@ -273,33 +149,14 @@ pages:
You may also need to specify the scopes in the provider's OAuth app settings, depending on the provider.
js: |
```js
- const { user, session, error } = await supabase.auth.signIn({
+ const { data, error } = await supabase.auth.signInWithOAuth({
provider: 'github'
- }, {
- scopes: 'repo gist notifications'
+ options: {
+ scopes: 'repo gist notifications'
+ }
})
- const oAuthToken = session.provider_token // use to access provider API
- ```
- - name: Sign in using a refresh token (e.g. in React Native).
- description: |
- If you are completing a sign up or login in a React Native app you can pass the refresh token obtained from the provider to obtain a session.
- js: |
- ```js
- // An example using Expo's `AuthSession`
- const redirectUri = AuthSession.makeRedirectUri({ useProxy: false });
- const provider = 'google';
-
- AuthSession.startAsync({
- authUrl: `https://MYSUPABASEAPP.supabase.co/auth/v1/authorize?provider=${provider}&redirect_to=${redirectUri}`,
- returnUrl: redirectUri,
- }).then(async (response: any) => {
- if (!response) return;
- const { user, session, error } = await supabase.auth.signIn({
- refreshToken: response.params?.refresh_token,
- });
- });
+ const oAuthToken = data.session.provider_token // use to access provider API
```
-
auth.signOut():
title: 'signOut()'
$ref: '@supabase/gotrue-js.GoTrueClient.signOut'
@@ -310,7 +167,6 @@ pages:
```js
const { error } = await supabase.auth.signOut()
```
-
auth.getSession():
title: 'getSession()'
$ref: '@supabase/gotrue-js.GoTrueClient.getSession'
@@ -319,25 +175,30 @@ pages:
isSpotlight: true
js: |
```js
- const session = supabase.auth.session()
+ const { data, error } = supabase.auth.getSession()
```
-
auth.getUser():
title: 'getUser()'
$ref: '@supabase/gotrue-js.GoTrueClient.getUser'
notes: |
- This method gets the user object from memory.
+ - This method gets the user object using the current session.
+ - Fetches the user object from the database instead of local storage.
examples:
- - name: Get the logged in user
+ - name: Get the logged in user with the current existing session
isSpotlight: true
js: |
```js
- const user = supabase.auth.user()
+ const user = supabase.auth.getUser()
```
-
- auth.update():
- title: 'update()'
- $ref: '@supabase/gotrue-js.GoTrueClient.update'
+ - name: Get the logged in user with a custom access token jwt.
+ isSpotlight: true
+ js: |
+ ```js
+ const user = supabase.auth.getUser(jwt)
+ ```
+ 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.
@@ -351,13 +212,13 @@ pages:
isSpotlight: true
js: |
```js
- const { user, error } = await supabase.auth.update({email: '[email protected]'})
+ const { data, error } = await supabase.auth.updateUser({email: '[email protected]'})
```
- name: Update password for authenticated user.
isSpotlight: true
js: |
```js
- const { user, error } = await supabase.auth.update({password: 'new password'})
+ const { data, error } = await supabase.auth.updateUser({password: 'new password'})
```
- name: Update a user's metadata.
isSpotlight: true
@@ -367,66 +228,18 @@ pages:
data: { hello: 'world' }
})
```
-
auth.setSession():
title: 'setSession()'
$ref: '@supabase/gotrue-js.GoTrueClient.setSession'
examples:
- name: Basic example.
- description: This is most useful on server-side functions where you cannot log the user in, but have access to the user's access token.
+ description: Sets the session data from refresh_token and returns current session or an error if the refresh_token is invalid.
isSpotlight: true
js: |
```js
- function apiFunction(req, res) {
- // Assuming the access token was sent as a header "X-Supabase-Auth"
- const { access_token } = req.get('X-Supabase-Auth')
-
- // You can now use it within a Supabase Client
- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key")
- const { user, error } = supabase.auth.setAuth(access_token)
-
- // This client will now send requests as this user
- const { data } = await supabase.from('your_table').select()
+ const { data, error } = supabase.auth.setSession(refresh_token)
}
```
- - name: With Express.
- isSpotlight: true
- js: |
- ```js
-
- /**
- * Make a request from the client to your server function
- */
- async function makeApiRequest() {
- const token = newClient.session()?.access_token
-
- await fetch('https://example.com/withAuth', {
- method: 'GET',
- withCredentials: true,
- credentials: 'include',
- headers: {
- 'Content-Type': 'application/json',
- 'Authorization': bearer, // Your own auth
- 'X-Supabase-Auth': token, // Set the Supabase user
- }
- })
- }
-
- /**
- * Use the Auth token in your server-side function.
- */
- async function apiFunction(req, res) {
- const { access_token } = req.get('X-Supabase-Auth')
-
- // You can now use it within a Supabase Client
- const supabase = createClient("https://xyzcompany.supabase.co", "public-anon-key")
- const { user, error } = supabase.auth.setAuth(access_token)
-
- // This client will now send requests as this user
- const { data } = await supabase.from('your_table').select()
- }
- ```
-
auth.onAuthStateChange():
title: 'onAuthStateChange()'
$ref: '@supabase/gotrue-js.GoTrueClient.onAuthStateChange'
@@ -481,26 +294,9 @@ pages:
if (event == 'PASSWORD_RECOVERY') console.log('PASSWORD_RECOVERY', session)
})
```
- auth.api.getUser():
- title: 'getUser()'
- $ref: '@supabase/gotrue-js.GoTrueApi.getUser'
- 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:
- - name: Fetch the user object using the access_token jwt.
- isSpotlight: true
- js: |
- ```js
- const { user, error } = await supabase.auth.api.getUser(
- 'ACCESS_TOKEN_JWT',
- )
- ```
-
- auth.api.listUsers():
+ auth.admin.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.
@@ -509,12 +305,11 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.listUsers()
+ const { data: user, error } = await supabase.auth.admin.listUsers()
```
-
- auth.api.createUser():
+ auth.admin.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.
@@ -524,7 +319,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.createUser({
+ const { data, error } = await supabase.auth.admin.createUser({
password: 'password',
user_metadata: { name: 'Yoda' }
@@ -534,7 +329,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.createUser({
+ const { data, error } = await supabase.auth.admin.createUser({
email_confirm: true
})
@@ -543,15 +338,14 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.createUser({
+ const { data, error } = await supabase.auth.admin.createUser({
phone: '1234567890',
phone_confirm: true
})
```
-
- auth.api.deleteUser():
+ auth.admin.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.
@@ -560,14 +354,14 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.deleteUser(
+ const { data, error } = await supabase.auth.admin.deleteUser(
'715ed5db-f090-4b8c-a067-640ecee36aa0'
)
```
- auth.api.inviteUserByEmail():
+ auth.admin.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.
@@ -576,34 +370,16 @@ pages:
isSpotlight: false
js: |
```js
- const { data: user, error } = await supabase.auth
- .api
- .inviteUserByEmail('[email protected]')
+ const { data, error } = await supabase.auth.admin.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.resetPasswordForEmail():
+ auth.resetPasswordForEmail():
title: 'resetPasswordForEmail()'
- $ref: '@supabase/gotrue-js.GoTrueApi.resetPasswordForEmail'
+ $ref: '@supabase/gotrue-js.GoTrueClient.resetPasswordForEmail'
notes: |
Sends a reset request to an email address.
- When the user clicks the reset link in the email they will be forwarded to:
+ When the user clicks the reset link in the email they will be forwarded to the site url or the redirect url specified:
`<SITE_URL>#access_token=x&refresh_token=y&expires_in=z&token_type=bearer&type=recovery`
@@ -612,38 +388,50 @@ pages:
You should then use the access_token in the url and new password to update the user as follows:
```js
- const { error, data } = await supabase.auth.api
- .updateUser(access_token, { password : new_password })
+ const { error, data } = await supabase.auth.updateUser({ password : new_password })
```
examples:
- name: Reset password
isSpotlight: true
js: |
```js
- const { data, error } = await supabase.auth.api
- .resetPasswordForEmail('[email protected]')
+ const { error, data } = await supabase.auth.resetPasswordForEmail(email, options: {
+ redirectTo: 'https://example.com/update-password',
+ })
```
- auth.api.generateLink():
+ auth.admin.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.
examples:
- - name: Generate invite link.
- isSpotlight: false
+ - name: Generate a signup link.
+ isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.generateLink(
- 'invite',
+ const { data, error } = await supabase.auth.admin.generateLink(
+ 'signup',
+ {
+ 'password': 'secret'
+ }
+ )
+ ```
+ - name: Generate an invite link.
+ isSpotlight: true
+ js: |
+ ```js
+ const { data, error } = await supabase.auth.admin.generateLink(
+ 'invite',
)
```
- auth.api.updateUserById():
+ auth.admin.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.
@@ -652,7 +440,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.updateUserById(
+ const { data: user, error } = await supabase.auth.admin.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ email: '[email protected]' }
)
@@ -661,7 +449,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.updateUserById(
+ const { data: user, error } = await supabase.auth.admin.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ password: 'new_password' }
)
@@ -670,7 +458,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.updateUserById(
+ const { data: user, error } = await supabase.auth.admin.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ user_metadata: { hello: 'world' } }
)
@@ -679,7 +467,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.updateUserById(
+ const { data: user, error } = await supabase.auth.admin.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ app_metadata: { plan: 'trial' } }
)
@@ -688,7 +476,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.updateUserById(
+ const { data: user, error } = await supabase.auth.admin.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ email_confirm: true }
)
@@ -697,7 +485,7 @@ pages:
isSpotlight: true
js: |
```js
- const { data: user, error } = await supabase.auth.api.updateUserById(
+ const { data: user, error } = await supabase.auth.admin.updateUserById(
'6aa5d0d4-2a9f-4483-b6c8-0cf4c6c98ac4',
{ phone_confirm: true }
)