Compare commits
101 Commits
@nhost/rea
...
@nhost/rea
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20005986a9 | ||
|
|
c1d722390f | ||
|
|
111d6d99a1 | ||
|
|
dabbb6ec0d | ||
|
|
7174aa1384 | ||
|
|
82ac9b9684 | ||
|
|
bd494434d9 | ||
|
|
0ee47821cd | ||
|
|
3a04c272ee | ||
|
|
dd38973515 | ||
|
|
9ab5b7a927 | ||
|
|
406132902d | ||
|
|
7503b0d840 | ||
|
|
d42cb698c1 | ||
|
|
c944ef11e4 | ||
|
|
d9e2e41efd | ||
|
|
1219356c8f | ||
|
|
2eb7467afa | ||
|
|
12f42319f9 | ||
|
|
bbc9c6131b | ||
|
|
c16be7fb05 | ||
|
|
872e44ebe0 | ||
|
|
a898a19ffa | ||
|
|
dbc10e6205 | ||
|
|
b04d01f022 | ||
|
|
29d0c7250f | ||
|
|
b59f571048 | ||
|
|
64cc648d19 | ||
|
|
5f05d46c3d | ||
|
|
bfcabe8e73 | ||
|
|
233a6e4bd6 | ||
|
|
577792b3d5 | ||
|
|
3ba026e7d7 | ||
|
|
fa740867c5 | ||
|
|
30f4e53181 | ||
|
|
a417c8468a | ||
|
|
2dc020a676 | ||
|
|
f49d14cc1b | ||
|
|
5a141453f0 | ||
|
|
788bb9c90d | ||
|
|
09fa429125 | ||
|
|
c505281250 | ||
|
|
7ea5523375 | ||
|
|
c5cd6b1d7b | ||
|
|
4107287c8e | ||
|
|
651c481874 | ||
|
|
90a7999346 | ||
|
|
b54b0c0743 | ||
|
|
d07373d255 | ||
|
|
73c8fa1fb2 | ||
|
|
67f2622642 | ||
|
|
780f95d950 | ||
|
|
cb84db7688 | ||
|
|
67d76ebbb6 | ||
|
|
48af3fb4d1 | ||
|
|
e5adc515d4 | ||
|
|
5f4b16f2f9 | ||
|
|
be50d4ad1d | ||
|
|
d40afbb744 | ||
|
|
7e0035a856 | ||
|
|
5826baa57e | ||
|
|
3c789629a4 | ||
|
|
59a5fe97b1 | ||
|
|
7f1b8a5881 | ||
|
|
7fd5f0fedf | ||
|
|
bf551fe705 | ||
|
|
d20bfe3431 | ||
|
|
dcf5e28e06 | ||
|
|
5c10169972 | ||
|
|
abdbbe6fcc | ||
|
|
479a2ed08d | ||
|
|
3db941eb46 | ||
|
|
42a7aaf916 | ||
|
|
2443399cdc | ||
|
|
b8f4b75b0c | ||
|
|
5227c84820 | ||
|
|
de81942fb2 | ||
|
|
5a60c5cb29 | ||
|
|
752812a321 | ||
|
|
0af2337499 | ||
|
|
b238bd7b6b | ||
|
|
f87403108f | ||
|
|
20f8fe9eb4 | ||
|
|
6f6044c49c | ||
|
|
4ffb14b240 | ||
|
|
f9854b15c4 | ||
|
|
cf206a4d1c | ||
|
|
eae285bfc9 | ||
|
|
51a115eaf7 | ||
|
|
da9c043fb5 | ||
|
|
e821af279a | ||
|
|
1d3469a455 | ||
|
|
9ff668d26c | ||
|
|
8f100e6e56 | ||
|
|
42dc93100c | ||
|
|
04aadb6fa4 | ||
|
|
e08a08973d | ||
|
|
3b11caf3bc | ||
|
|
049f67e54a | ||
|
|
6da1f90bc3 | ||
|
|
59fd68dee3 |
53
README.md
53
README.md
@@ -12,7 +12,7 @@
|
||||
<span> • </span>
|
||||
<a href="https://nhost.io/blog">Blog</a>
|
||||
<span> • </span>
|
||||
<a href="https://twitter.com/nhostio">Twitter</a>
|
||||
<a href="https://twitter.com/nhost">Twitter</a>
|
||||
<span> • </span>
|
||||
<a href="https://nhost.io/discord">Discord</a>
|
||||
<br />
|
||||
@@ -32,7 +32,7 @@ Nhost consists of open source software:
|
||||
- Database: [PostgreSQL](https://www.postgresql.org/)
|
||||
- Instant GraphQL API: [Hasura](https://hasura.io/)
|
||||
- Authentication: [Hasura Auth](https://github.com/nhost/hasura-auth/)
|
||||
- Storage: [Hasura Storage](https://hub.docker.com/r/nhost/hasura-storage)
|
||||
- Storage: [Hasura Storage](https://github.com/nhost/hasura-storage)
|
||||
- Serverless Functions: Node.js (JavaScript and TypeScript)
|
||||
- [Nhost CLI](https://docs.nhost.io/reference/cli) for local development
|
||||
|
||||
@@ -67,7 +67,8 @@ Install the `@nhost/nhost-js` package and start build your app:
|
||||
import { NhostClient } from '@nhost/nhost-js'
|
||||
|
||||
const nhost = new NhostClient({
|
||||
backendUrl: 'https://awesome-app.nhost.run'
|
||||
subdomain: '<your-subdomain>',
|
||||
region: '<your-region>'
|
||||
})
|
||||
|
||||
await nhost.auth.signIn({ email: 'elon@musk.com', password: 'spaceX' })
|
||||
@@ -115,6 +116,10 @@ Also, follow Nhost on [GitHub Discussions](https://github.com/nhost/nhost/discus
|
||||
|
||||
This repository, and most of our other open source projects, are licensed under the MIT license.
|
||||
|
||||
<a href="https://runacap.com/ross-index/q1-2022/" target="_blank" rel="noopener">
|
||||
<img style="width: 260px; height: 56px" src="https://runacap.com/wp-content/uploads/2022/06/ROSS_badge_black_Q1_2022.svg" alt="ROSS Index - Fastest Growing Open-Source Startups in Q1 2022 | Runa Capital" width="260" height="56" />
|
||||
</a>
|
||||
|
||||
### How to contribute
|
||||
|
||||
Here are some ways of contributing to making Nhost better:
|
||||
@@ -163,20 +168,20 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Nuno Pato</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/subatuba21">
|
||||
<img src="https://avatars.githubusercontent.com/u/34824571?v=4" width="100;" alt="subatuba21"/>
|
||||
<br />
|
||||
<sub><b>Subha Das</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/guicurcio">
|
||||
<img src="https://avatars.githubusercontent.com/u/20285232?v=4" width="100;" alt="guicurcio"/>
|
||||
<br />
|
||||
<sub><b>Guido Curcio</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/subatuba21">
|
||||
<img src="https://avatars.githubusercontent.com/u/34824571?v=4" width="100;" alt="subatuba21"/>
|
||||
<br />
|
||||
<sub><b>Subha Das</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/sebagudelo">
|
||||
@@ -257,6 +262,13 @@ Here are some ways of contributing to making Nhost better:
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/MelodicCrypter">
|
||||
<img src="https://avatars.githubusercontent.com/u/18341500?v=4" width="100;" alt="MelodicCrypter"/>
|
||||
<br />
|
||||
<sub><b>Hugh Caluscusin</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/jerryjappinen">
|
||||
<img src="https://avatars.githubusercontent.com/u/1101002?v=4" width="100;" alt="jerryjappinen"/>
|
||||
@@ -291,15 +303,15 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Muttenzer</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ahmic">
|
||||
<img src="https://avatars.githubusercontent.com/u/13452362?v=4" width="100;" alt="ahmic"/>
|
||||
<br />
|
||||
<sub><b>Amir Ahmic</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/akd-io">
|
||||
<img src="https://avatars.githubusercontent.com/u/30059155?v=4" width="100;" alt="akd-io"/>
|
||||
@@ -334,15 +346,15 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Gaurav Agrawal</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/alveshelio">
|
||||
<img src="https://avatars.githubusercontent.com/u/8176422?v=4" width="100;" alt="alveshelio"/>
|
||||
<br />
|
||||
<sub><b>Helio Alves</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/nkhdo">
|
||||
<img src="https://avatars.githubusercontent.com/u/26102306?v=4" width="100;" alt="nkhdo"/>
|
||||
@@ -350,13 +362,6 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Hoang Do</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/MelodicCrypter">
|
||||
<img src="https://avatars.githubusercontent.com/u/18341500?v=4" width="100;" alt="MelodicCrypter"/>
|
||||
<br />
|
||||
<sub><b>Hugh Caluscusin</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/jladuval">
|
||||
<img src="https://avatars.githubusercontent.com/u/1935359?v=4" width="100;" alt="jladuval"/>
|
||||
|
||||
@@ -4,7 +4,7 @@ title: signUp()
|
||||
sidebar_label: signUp()
|
||||
slug: /reference/javascript/auth/sign-up
|
||||
description: Use `nhost.auth.signUp` to sign up a user using email and password. If you want to sign up a user using passwordless email (Magic Link), SMS, or an OAuth provider, use the `signIn` function instead.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L102
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L103
|
||||
---
|
||||
|
||||
# `signUp()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: signIn()
|
||||
sidebar_label: signIn()
|
||||
slug: /reference/javascript/auth/sign-in
|
||||
description: Use `nhost.auth.signIn` to sign in a user using email and password, passwordless (email or sms) or an external provider. `signIn` can be used to sign in a user in various ways depending on the parameters.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L145
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L146
|
||||
---
|
||||
|
||||
# `signIn()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: signOut()
|
||||
sidebar_label: signOut()
|
||||
slug: /reference/javascript/auth/sign-out
|
||||
description: Use `nhost.auth.signOut` to sign out the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L230
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L231
|
||||
---
|
||||
|
||||
# `signOut()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: resetPassword()
|
||||
sidebar_label: resetPassword()
|
||||
slug: /reference/javascript/auth/reset-password
|
||||
description: Use `nhost.auth.resetPassword` to reset the password for a user. This will send a reset-password link in an email to the user. When the user clicks the reset-password link the user is automatically signed-in. Once signed-in, the user can change their password using `nhost.auth.changePassword()`.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L246
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L247
|
||||
---
|
||||
|
||||
# `resetPassword()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: changePassword()
|
||||
sidebar_label: changePassword()
|
||||
slug: /reference/javascript/auth/change-password
|
||||
description: Use `nhost.auth.changePassword` to change the password for the user. The old password is not needed.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L262
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L263
|
||||
---
|
||||
|
||||
# `changePassword()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: sendVerificationEmail()
|
||||
sidebar_label: sendVerificationEmail()
|
||||
slug: /reference/javascript/auth/send-verification-email
|
||||
description: Use `nhost.auth.sendVerificationEmail` to send a verification email to the specified email. The email contains a verification-email link. When the user clicks the verification-email link their email is verified.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L278
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L279
|
||||
---
|
||||
|
||||
# `sendVerificationEmail()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: changeEmail()
|
||||
sidebar_label: changeEmail()
|
||||
slug: /reference/javascript/auth/change-email
|
||||
description: Use `nhost.auth.changeEmail` to change a user's email. This will send a confirm-email-change link in an email to the new email. Once the user clicks on the confirm-email-change link the email will be change to the new email.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L297
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L298
|
||||
---
|
||||
|
||||
# `changeEmail()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: deanonymize()
|
||||
sidebar_label: deanonymize()
|
||||
slug: /reference/javascript/auth/deanonymize
|
||||
description: Use `nhost.auth.deanonymize` to deanonymize a user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L313
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L314
|
||||
---
|
||||
|
||||
# `deanonymize()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: onTokenChanged()
|
||||
sidebar_label: onTokenChanged()
|
||||
slug: /reference/javascript/auth/on-token-changed
|
||||
description: Use `nhost.auth.onTokenChanged` to add a custom function that runs every time the access or refresh token is changed.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L356
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L357
|
||||
---
|
||||
|
||||
# `onTokenChanged()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: onAuthStateChanged()
|
||||
sidebar_label: onAuthStateChanged()
|
||||
slug: /reference/javascript/auth/on-auth-state-changed
|
||||
description: Use `nhost.auth.onAuthStateChanged` to add a custom function that runs every time the authentication status of the user changes. E.g. add a custom function that runs every time the authentication status changes from signed-in to signed-out.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L391
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L392
|
||||
---
|
||||
|
||||
# `onAuthStateChanged()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: isAuthenticated()
|
||||
sidebar_label: isAuthenticated()
|
||||
slug: /reference/javascript/auth/is-authenticated
|
||||
description: Use `nhost.auth.isAuthenticated` to check if the user is authenticated or not.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L433
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L434
|
||||
---
|
||||
|
||||
# `isAuthenticated()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: isAuthenticatedAsync()
|
||||
sidebar_label: isAuthenticatedAsync()
|
||||
slug: /reference/javascript/auth/is-authenticated-async
|
||||
description: Use `nhost.auth.isAuthenticatedAsync` to wait (await) for any internal authentication network requests to finish and then return the authentication status.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L451
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L452
|
||||
---
|
||||
|
||||
# `isAuthenticatedAsync()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getAuthenticationStatus()
|
||||
sidebar_label: getAuthenticationStatus()
|
||||
slug: /reference/javascript/auth/get-authentication-status
|
||||
description: Use `nhost.auth.getAuthenticationStatus` to get the authentication status of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L477
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L478
|
||||
---
|
||||
|
||||
# `getAuthenticationStatus()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getAccessToken()
|
||||
sidebar_label: getAccessToken()
|
||||
slug: /reference/javascript/auth/get-access-token
|
||||
description: Use `nhost.auth.getAccessToken` to get the access token of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L507
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L508
|
||||
---
|
||||
|
||||
# `getAccessToken()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getDecodedAccessToken()
|
||||
sidebar_label: getDecodedAccessToken()
|
||||
slug: /reference/javascript/auth/get-decoded-access-token
|
||||
description: Use `nhost.auth.getDecodedAccessToken` to get the decoded access token of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L522
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L523
|
||||
---
|
||||
|
||||
# `getDecodedAccessToken()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getHasuraClaims()
|
||||
sidebar_label: getHasuraClaims()
|
||||
slug: /reference/javascript/auth/get-hasura-claims
|
||||
description: Use `nhost.auth.getHasuraClaims` to get the Hasura claims of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L539
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L540
|
||||
---
|
||||
|
||||
# `getHasuraClaims()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getHasuraClaim()
|
||||
sidebar_label: getHasuraClaim()
|
||||
slug: /reference/javascript/auth/get-hasura-claim
|
||||
description: Use `nhost.auth.getHasuraClaim` to get the value of a specific Hasura claim of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L557
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L558
|
||||
---
|
||||
|
||||
# `getHasuraClaim()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: refreshSession()
|
||||
sidebar_label: refreshSession()
|
||||
slug: /reference/javascript/auth/refresh-session
|
||||
description: Use `nhost.auth.refreshSession` to refresh the session with either the current internal refresh token or an external refresh token.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L580
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L581
|
||||
---
|
||||
|
||||
# `refreshSession()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getSession()
|
||||
sidebar_label: getSession()
|
||||
slug: /reference/javascript/auth/get-session
|
||||
description: Use `nhost.auth.getSession()` to get the session of the user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L624
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L625
|
||||
---
|
||||
|
||||
# `getSession()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getUser()
|
||||
sidebar_label: getUser()
|
||||
slug: /reference/javascript/auth/get-user
|
||||
description: Use `nhost.auth.getUser()` to get the signed-in user.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L639
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L640
|
||||
---
|
||||
|
||||
# `getUser()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: createClient()
|
||||
sidebar_label: createClient()
|
||||
slug: /reference/javascript/nhost-js/create-client
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/index.ts#L3
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/index.ts#L4
|
||||
---
|
||||
|
||||
# `createClient()`
|
||||
@@ -15,16 +15,18 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/
|
||||
|
||||
**<span className="parameter-name">config</span>** <span className="optional-status">required</span> [`NhostClientConstructorParams`](/reference/docgen/javascript/nhost-js/types/nhost-client-constructor-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :------------------ | :------: | :----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>backendUrl</span> | `string` | ✔️ | Nhost backend URL. |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>start</span> | `boolean` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>adminSecret</span> | `string` | | Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all GraphQL, Storage, and Serverless Functions requests. |
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :------------------ | :------: | :---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>start</span> | `boolean` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>backendUrl</span> | `string` | | Nhost backend URL Should only be used when self-hosting |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>adminSecret</span> | `string` | | When set, the admin secret is sent as a header, `x-hasura-admin-secret`, for all requests to GraphQL, Storage, and Functions. |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>subdomain</span> | `string` | | App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq) Should be used when using the Nhost platform Use "localhost" in development |
|
||||
| <span className="parameter-name"><span className="light-grey">config.</span>region</span> | `string` | | App region (e.g., eu-central-1) Not required in development (when `subdomain` is "localhost") |
|
||||
|
||||
---
|
||||
|
||||
@@ -4,29 +4,35 @@ title: NhostClient
|
||||
sidebar_label: NhostClient
|
||||
description: No description provided.
|
||||
slug: /reference/javascript/nhost-js/nhost-client
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/core/nhost-client.ts#L19
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/core/nhost-client.ts#L8
|
||||
---
|
||||
|
||||
# `NhostClient`
|
||||
|
||||
Nhost Client
|
||||
|
||||
```ts
|
||||
const nhost = new NhostClient({ subdomain, region })
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">\_\_namedParameters</span>** <span className="optional-status">required</span> [`NhostClientConstructorParams`](/reference/docgen/javascript/nhost-js/types/nhost-client-constructor-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------------------------------ | :------------------ | :------: | :----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>backendUrl</span> | `string` | ✔️ | Nhost backend URL. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>adminSecret</span> | `string` | | Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all GraphQL, Storage, and Serverless Functions requests. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>start</span> | `boolean` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------------------------------ | :------------------ | :------: | :---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>region</span> | `string` | | App region (e.g., eu-central-1) Not required in development (when `subdomain` is "localhost") |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>subdomain</span> | `string` | | App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq) Should be used when using the Nhost platform Use "localhost" in development |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>adminSecret</span> | `string` | | When set, the admin secret is sent as a header, `x-hasura-admin-secret`, for all requests to GraphQL, Storage, and Functions. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>backendUrl</span> | `string` | | Nhost backend URL Should only be used when self-hosting |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>start</span> | `boolean` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">\_\_namedParameters.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: BackendOrSubdomain
|
||||
sidebar_label: BackendOrSubdomain
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/utils/types.ts#L40
|
||||
---
|
||||
|
||||
# `BackendOrSubdomain`
|
||||
|
||||
```ts
|
||||
type BackendOrSubdomain = BackendUrl | Subdomain
|
||||
```
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: BackendUrl
|
||||
sidebar_label: BackendUrl
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/utils/types.ts#L7
|
||||
---
|
||||
|
||||
# `BackendUrl`
|
||||
|
||||
```ts
|
||||
type BackendUrl = () => { backendUrl: string; adminSecret: string }
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FunctionCallResponse
|
||||
sidebar_label: FunctionCallResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/utils/types.ts#L57
|
||||
---
|
||||
|
||||
# `FunctionCallResponse`
|
||||
|
||||
```ts
|
||||
type FunctionCallResponse =
|
||||
| { res: AxiosResponse<T>; error: null }
|
||||
| { res: null; error: Error }
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: GraphqlRequestResponse
|
||||
sidebar_label: GraphqlRequestResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/utils/types.ts#L47
|
||||
---
|
||||
|
||||
# `GraphqlRequestResponse`
|
||||
|
||||
```ts
|
||||
type GraphqlRequestResponse =
|
||||
| { data: null; error: Error | object | Array<object> }
|
||||
| { data: T; error: null }
|
||||
```
|
||||
@@ -0,0 +1,22 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: GraphqlResponse
|
||||
sidebar_label: GraphqlResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/utils/types.ts#L67
|
||||
---
|
||||
|
||||
# `GraphqlResponse`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">optional</span> `Array<object>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">data</span>** <span className="optional-status">optional</span> `T`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,74 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: NhostAuthConstructorParams
|
||||
sidebar_label: NhostAuthConstructorParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L15
|
||||
---
|
||||
|
||||
# `NhostAuthConstructorParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshIntervalTime</span>** <span className="optional-status">optional</span> `number`
|
||||
|
||||
Time interval until token refreshes, in seconds
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clientStorageType</span>** <span className="optional-status">optional</span> `ClientStorageType`
|
||||
|
||||
Define a way to get information about the refresh token and its exipration date.
|
||||
|
||||
**`@default`**
|
||||
|
||||
`web`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clientStorage</span>** <span className="optional-status">optional</span> `ClientStorage`
|
||||
|
||||
Object where the refresh token will be persisted and read locally.
|
||||
|
||||
Recommended values:
|
||||
|
||||
- `'web'` and `'cookies'`: no value is required
|
||||
- `'react-native'`: `import Storage from @react-native-async-storage/async-storage`
|
||||
- `'cookies'`: `localStorage`
|
||||
- `'custom'`: an object that defines the following methods:
|
||||
- `setItem` or `setItemAsync`
|
||||
- `getItem` or `getItemAsync`
|
||||
- `removeItem`
|
||||
- `'capacitor'`: `import { Storage } from @capacitor/storage`
|
||||
- `'expo-secure-store'`: `import * as SecureStore from 'expo-secure-store'`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">autoRefreshToken</span>** <span className="optional-status">optional</span> `boolean`
|
||||
|
||||
When set to true, will automatically refresh token before it expires
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">autoSignIn</span>** <span className="optional-status">optional</span> `boolean`
|
||||
|
||||
When set to true, will parse the url on startup to check if it contains a refresh token to start the session with
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">devTools</span>** <span className="optional-status">optional</span> `boolean`
|
||||
|
||||
Activate devTools e.g. the ability to connect to the xstate inspector
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">url</span>** <span className="optional-status">required</span> `string`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">start</span>** <span className="optional-status">optional</span> `boolean`
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: NhostClientConstructorParams
|
||||
sidebar_label: NhostClientConstructorParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/core/nhost-client.ts#L7
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/utils/types.ts#L42
|
||||
---
|
||||
|
||||
# `NhostClientConstructorParams`
|
||||
@@ -13,12 +13,6 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">required</span> `string`
|
||||
|
||||
Nhost backend URL.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">refreshIntervalTime</span>** <span className="optional-status">optional</span> `number`
|
||||
|
||||
Time interval until token refreshes, in seconds
|
||||
@@ -75,9 +69,31 @@ Activate devTools e.g. the ability to connect to the xstate inspector
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all
|
||||
GraphQL, Storage, and Serverless Functions requests.
|
||||
Nhost backend URL
|
||||
Should only be used when self-hosting
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
When set, the admin secret is sent as a header, `x-hasura-admin-secret`,
|
||||
for all requests to GraphQL, Storage, and Functions.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">subdomain</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq)
|
||||
Should be used when using the Nhost platform
|
||||
Use "localhost" in development
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">region</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
App region (e.g., eu-central-1)
|
||||
Not required in development (when `subdomain` is "localhost")
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: Subdomain
|
||||
sidebar_label: Subdomain
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nhost-js/src/utils/types.ts#L20
|
||||
---
|
||||
|
||||
# `Subdomain`
|
||||
|
||||
```ts
|
||||
type Subdomain = () => {
|
||||
subdomain: string
|
||||
region: string
|
||||
adminSecret: string
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: createFileUploadMachine()
|
||||
sidebar_label: createFileUploadMachine()
|
||||
slug: /reference/javascript/storage/create-file-upload-machine
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L36
|
||||
---
|
||||
|
||||
# `createFileUploadMachine()`
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: createMultipleFilesUploadMachine()
|
||||
sidebar_label: createMultipleFilesUploadMachine()
|
||||
slug: /reference/javascript/storage/create-multiple-files-upload-machine
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L28
|
||||
---
|
||||
|
||||
# `createMultipleFilesUploadMachine()`
|
||||
@@ -4,7 +4,7 @@ title: upload()
|
||||
sidebar_label: upload()
|
||||
slug: /reference/javascript/storage/upload
|
||||
description: Use `nhost.storage.upload` to upload a file. The `file` must be of type [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File).
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L52
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L52
|
||||
---
|
||||
|
||||
# `upload()`
|
||||
|
||||
@@ -5,7 +5,7 @@ sidebar_label: getUrl()
|
||||
slug: /reference/javascript/storage/get-url
|
||||
sidebar_class_name: deprecated
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L74
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L74
|
||||
---
|
||||
|
||||
# `getUrl()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getPublicUrl()
|
||||
sidebar_label: getPublicUrl()
|
||||
slug: /reference/javascript/storage/get-public-url
|
||||
description: Use `nhost.storage.getPublicUrl` to get the public URL of a file. The public URL can be used for un-authenticated users to access files. To access public files the `public` role must have permissions to select the file in the `storage.files` table.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L88
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L88
|
||||
---
|
||||
|
||||
# `getPublicUrl()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: getPresignedUrl()
|
||||
sidebar_label: getPresignedUrl()
|
||||
slug: /reference/javascript/storage/get-presigned-url
|
||||
description: Use `nhost.storage.getPresignedUrl` to get a presigned URL of a file. To get a presigned URL the user must have permission to select the file in the `storage.files` table.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L110
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L110
|
||||
---
|
||||
|
||||
# `getPresignedUrl()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: delete()
|
||||
sidebar_label: delete()
|
||||
slug: /reference/javascript/storage/delete
|
||||
description: Use `nhost.storage.delete` to delete a file. To delete a file the user must have permissions to delete the file in the `storage.files` table. Deleting the file using `nhost.storage.delete()` will delete both the file and its metadata.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L135
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L135
|
||||
---
|
||||
|
||||
# `delete()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: setAccessToken()
|
||||
sidebar_label: setAccessToken()
|
||||
slug: /reference/javascript/storage/set-access-token
|
||||
description: Use `nhost.storage.setAccessToken` to a set an access token to be used in subsequent storage requests. Note that if you're signin in users with `nhost.auth.signIn()` the access token will be set automatically.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L156
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L156
|
||||
---
|
||||
|
||||
# `setAccessToken()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: setAdminSecret()
|
||||
sidebar_label: setAdminSecret()
|
||||
slug: /reference/javascript/storage/set-admin-secret
|
||||
description: Use `nhost.storage.adminSecret` to set the admin secret to be used for subsequent storage requests. This is useful if you want to run storage in "admin mode".
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L174
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L174
|
||||
---
|
||||
|
||||
# `setAdminSecret()`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: HasuraStorageClient
|
||||
sidebar_label: Storage
|
||||
description: No description provided.
|
||||
slug: /reference/javascript/storage
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/hasura-storage-client.ts#L25
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/hasura-storage-client.ts#L25
|
||||
---
|
||||
|
||||
# `HasuraStorageClient`
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: uploadFilePromise()
|
||||
sidebar_label: uploadFilePromise()
|
||||
slug: /reference/javascript/storage/upload-file-promise
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L40
|
||||
---
|
||||
|
||||
# `uploadFilePromise()`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nhost</span>** <span className="optional-status">required</span> [`NhostClientReturnType`](/reference/docgen/javascript/storage/types/nhost-client-return-type)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :-------------------------------------------------------------------------------------------- | :----------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>storage</span> | `{ url: string }` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>auth</span> | `HasuraAuthClient` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>adminSecret</span> | `string` | | |
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">interpreter</span>** <span className="optional-status">required</span> `ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>` | `Interpreter<FileUploadContext, any, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">\_\_namedParameters</span>** <span className="optional-status">required</span> `Partial<StorageUploadParams>`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,36 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: uploadMultipleFilesPromise()
|
||||
sidebar_label: uploadMultipleFilesPromise()
|
||||
slug: /reference/javascript/storage/upload-multiple-files-promise
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L45
|
||||
---
|
||||
|
||||
# `uploadMultipleFilesPromise()`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">nhost</span>** <span className="optional-status">required</span> [`NhostClientReturnType`](/reference/docgen/javascript/storage/types/nhost-client-return-type)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :-------------------------------------------------------------------------------------------- | :----------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>auth</span> | `HasuraAuthClient` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>storage</span> | `{ url: string }` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">nhost.</span>adminSecret</span> | `string` | | |
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">service</span>** <span className="optional-status">required</span> `Interpreter<MultipleFilesUploadContext, any, { type: "ADD", files: File | Array<File> } | { type: "UPLOAD", url: string, bucketId: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", additions: number } | { type: "UPLOAD_DONE" } | { type: "UPLOAD_ERROR" } | { type: "CANCEL" } | { type: "REMOVE" } | { type: "CLEAR" }, { value: any, context: MultipleFilesUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", files: File | Array<File> } | { type: "UPLOAD", url: string, bucketId: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", additions: number } | { type: "UPLOAD_DONE" } | { type: "UPLOAD_ERROR" } | { type: "CANCEL" } | { type: "REMOVE" } | { type: "CLEAR" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">options</span>** <span className="optional-status">required</span> [`UploadMultipleFilesActionParams`](/reference/docgen/javascript/storage/types/upload-multiple-files-action-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :------------------------------------------------------------------------------------------- | :------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">options.</span>bucketId</span> | `string` | | |
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: ApiDeleteParams
|
||||
sidebar_label: ApiDeleteParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L61
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L69
|
||||
---
|
||||
|
||||
# `ApiDeleteParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiDeleteResponse
|
||||
sidebar_label: ApiDeleteResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L65
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L73
|
||||
---
|
||||
|
||||
# `ApiDeleteResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiGetPresignedUrlParams
|
||||
sidebar_label: ApiGetPresignedUrlParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L53
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L61
|
||||
---
|
||||
|
||||
# `ApiGetPresignedUrlParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiGetPresignedUrlResponse
|
||||
sidebar_label: ApiGetPresignedUrlResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L57
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L65
|
||||
---
|
||||
|
||||
# `ApiGetPresignedUrlResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiUploadParams
|
||||
sidebar_label: ApiUploadParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L42
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L50
|
||||
---
|
||||
|
||||
# `ApiUploadParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiUploadResponse
|
||||
sidebar_label: ApiUploadResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L49
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L57
|
||||
---
|
||||
|
||||
# `ApiUploadResponse`
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileItemRef
|
||||
sidebar_label: FileItemRef
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L7
|
||||
---
|
||||
|
||||
# `FileItemRef`
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadContext
|
||||
sidebar_label: FileUploadContext
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L6
|
||||
---
|
||||
|
||||
# `FileUploadContext`
|
||||
|
||||
```ts
|
||||
type FileUploadContext = () => {
|
||||
progress: number | null
|
||||
loaded: number
|
||||
error: ErrorPayload | null
|
||||
id: string
|
||||
bucketId: string
|
||||
file: File
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,35 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadEvents
|
||||
sidebar_label: FileUploadEvents
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L15
|
||||
---
|
||||
|
||||
# `FileUploadEvents`
|
||||
|
||||
```ts
|
||||
type FileUploadEvents =
|
||||
| { type: 'ADD'; file: File; id: string; bucketId: string; name: string }
|
||||
| {
|
||||
type: 'UPLOAD'
|
||||
url: string
|
||||
file: File
|
||||
id: string
|
||||
bucketId: string
|
||||
name: string
|
||||
accessToken: string
|
||||
adminSecret: string
|
||||
}
|
||||
| {
|
||||
type: 'UPLOAD_PROGRESS'
|
||||
progress: number
|
||||
loaded: number
|
||||
additions: number
|
||||
}
|
||||
| { type: 'UPLOAD_DONE'; id: string; bucketId: string }
|
||||
| { type: 'UPLOAD_ERROR'; error: ErrorPayload }
|
||||
| { type: 'CANCEL' }
|
||||
| { type: 'DESTROY' }
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadMachine
|
||||
sidebar_label: FileUploadMachine
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/file-upload.ts#L35
|
||||
---
|
||||
|
||||
# `FileUploadMachine`
|
||||
@@ -0,0 +1,68 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadState
|
||||
sidebar_label: FileUploadState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L38
|
||||
---
|
||||
|
||||
# `FileUploadState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,32 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesHandlerResult
|
||||
sidebar_label: MultipleFilesHandlerResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L17
|
||||
---
|
||||
|
||||
# `MultipleFilesHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadContext
|
||||
sidebar_label: MultipleFilesUploadContext
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L9
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadContext`
|
||||
|
||||
```ts
|
||||
type MultipleFilesUploadContext = () => { progress: number | null, files: Array<[FileItemRef](/reference/docgen/javascript/storage/types/file-item-ref)>, loaded: number, total: number }
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadEvents
|
||||
sidebar_label: MultipleFilesUploadEvents
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L16
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadEvents`
|
||||
|
||||
```ts
|
||||
type MultipleFilesUploadEvents =
|
||||
| { type: 'ADD'; files: File | Array<File> }
|
||||
| {
|
||||
type: 'UPLOAD'
|
||||
url: string
|
||||
bucketId: string
|
||||
accessToken: string
|
||||
adminSecret: string
|
||||
}
|
||||
| { type: 'UPLOAD_PROGRESS'; additions: number }
|
||||
| { type: 'UPLOAD_DONE' }
|
||||
| { type: 'UPLOAD_ERROR' }
|
||||
| { type: 'CANCEL' }
|
||||
| { type: 'REMOVE' }
|
||||
| { type: 'CLEAR' }
|
||||
```
|
||||
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadMachine
|
||||
sidebar_label: MultipleFilesUploadMachine
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L26
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadMachine`
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesUploadState
|
||||
sidebar_label: MultipleFilesUploadState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L32
|
||||
---
|
||||
|
||||
# `MultipleFilesUploadState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all the files have been successfully uploaded.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleUploadProgressState
|
||||
sidebar_label: MultipleUploadProgressState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L6
|
||||
---
|
||||
|
||||
# `MultipleUploadProgressState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: NhostClientReturnType
|
||||
sidebar_label: NhostClientReturnType
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L4
|
||||
---
|
||||
|
||||
# `NhostClientReturnType`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">auth</span>** <span className="optional-status">required</span> `HasuraAuthClient`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">storage</span>** <span className="optional-status">required</span> `{ url: string }`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: StorageDeleteParams
|
||||
sidebar_label: StorageDeleteParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L24
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L32
|
||||
---
|
||||
|
||||
# `StorageDeleteParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageDeleteResponse
|
||||
sidebar_label: StorageDeleteResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L28
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L36
|
||||
---
|
||||
|
||||
# `StorageDeleteResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageGetPresignedUrlParams
|
||||
sidebar_label: StorageGetPresignedUrlParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L16
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L24
|
||||
---
|
||||
|
||||
# `StorageGetPresignedUrlParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageGetPresignedUrlResponse
|
||||
sidebar_label: StorageGetPresignedUrlResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L20
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L28
|
||||
---
|
||||
|
||||
# `StorageGetPresignedUrlResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageGetUrlParams
|
||||
sidebar_label: StorageGetUrlParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L12
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L20
|
||||
---
|
||||
|
||||
# `StorageGetUrlParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageUploadParams
|
||||
sidebar_label: StorageUploadParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L1
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L9
|
||||
---
|
||||
|
||||
# `StorageUploadParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: StorageUploadResponse
|
||||
sidebar_label: StorageUploadResponse
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L8
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L16
|
||||
---
|
||||
|
||||
# `StorageUploadResponse`
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: UploadFileHandlerResult
|
||||
sidebar_label: UploadFileHandlerResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L19
|
||||
---
|
||||
|
||||
# `UploadFileHandlerResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: UploadHeaders
|
||||
sidebar_label: UploadHeaders
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/utils/types.ts#L69
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/utils/types.ts#L77
|
||||
---
|
||||
|
||||
# `UploadHeaders`
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: UploadMultipleFilesActionParams
|
||||
sidebar_label: UploadMultipleFilesActionParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/multiple-files-upload.ts#L41
|
||||
---
|
||||
|
||||
# `UploadMultipleFilesActionParams`
|
||||
|
||||
```ts
|
||||
type UploadMultipleFilesActionParams = () => { bucketId: string }
|
||||
```
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: UploadProgressState
|
||||
sidebar_label: UploadProgressState
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/packages/hasura-storage-js/src/promises/file-upload.ts#L8
|
||||
---
|
||||
|
||||
# `UploadProgressState`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: NhostClient
|
||||
sidebar_label: NhostClient
|
||||
description: No description provided.
|
||||
slug: /reference/nextjs/nhost-client
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nextjs/src/index.ts#L17
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nextjs/src/index.ts#L30
|
||||
---
|
||||
|
||||
# `NhostClient`
|
||||
@@ -15,13 +15,15 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nextjs/src/in
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`NhostNextClientConstructorParams`](/reference/docgen/nextjs/types/nhost-next-client-constructor-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :-------- | :------: | :----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>backendUrl</span> | `string` | ✔️ | Nhost backend URL. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>adminSecret</span> | `string` | | Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all GraphQL, Storage, and Serverless Functions requests. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :-------- | :------: | :---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>region</span> | `string` | | App region (e.g., eu-central-1) Not required in development (when `subdomain` is "localhost") |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>subdomain</span> | `string` | | App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq) Should be used when using the Nhost platform Use "localhost" in development |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>adminSecret</span> | `string` | | When set, the admin secret is sent as a header, `x-hasura-admin-secret`, for all requests to GraphQL, Storage, and Functions. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>backendUrl</span> | `string` | | Nhost backend URL Should only be used when self-hosting |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUploadItem()
|
||||
sidebar_label: useFileUploadItem()
|
||||
slug: /reference/nextjs/use-file-upload-item
|
||||
description: Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L59
|
||||
---
|
||||
|
||||
# `useFileUploadItem()`
|
||||
|
||||
Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
|
||||
It has the same signature as `useFileUpload`.
|
||||
|
||||
```tsx
|
||||
const Item = ({ itemRef }) => {
|
||||
const { name, progress } = useFileUploadItem(itemRef)
|
||||
return (
|
||||
<li>
|
||||
{name} {progress}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
const List = () => {
|
||||
const { list } = useMultipleFilesUpload()
|
||||
return (
|
||||
<ul>
|
||||
{list.map((itemRef) => (
|
||||
<Item key={item.id} itemRef={item} />
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">ref</span>** <span className="optional-status">required</span> `ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>` | `Interpreter<FileUploadContext, any, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUpload()
|
||||
sidebar_label: useFileUpload()
|
||||
slug: /reference/nextjs/use-file-upload
|
||||
description: Use the hook `useFileUpload` to upload a file.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L129
|
||||
---
|
||||
|
||||
# `useFileUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload a file.
|
||||
|
||||
```tsx
|
||||
const {
|
||||
add,
|
||||
upload,
|
||||
cancel,
|
||||
isUploaded,
|
||||
isUploading,
|
||||
isError,
|
||||
progress,
|
||||
id,
|
||||
bucketId,
|
||||
name
|
||||
} = useFileUpload()
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await upload({ file })
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useMultipleFilesUpload()
|
||||
sidebar_label: useMultipleFilesUpload()
|
||||
slug: /reference/nextjs/use-multiple-files-upload
|
||||
description: Use the hook `useFileUpload` to upload multiple files.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L52
|
||||
---
|
||||
|
||||
# `useMultipleFilesUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload multiple files.
|
||||
@@ -3,13 +3,17 @@
|
||||
title: useNhostBackendUrl()
|
||||
sidebar_label: useNhostBackendUrl()
|
||||
slug: /reference/nextjs/use-nhost-backend-url
|
||||
description: Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L15
|
||||
sidebar_class_name: deprecated
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L16
|
||||
---
|
||||
|
||||
# `useNhostBackendUrl()`
|
||||
|
||||
:::caution Deprecated
|
||||
Nhost services can now be split to subdomains to improve performance with CDN. Use `nhost.auth.url` or `nhost.storage.url` instead.
|
||||
Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
:::
|
||||
|
||||
```tsx
|
||||
const nhostBackendUrl = useNhostBackendUrl()
|
||||
|
||||
10
docs/docs/reference/docgen/nextjs/types/file-item-ref.mdx
Normal file
10
docs/docs/reference/docgen/nextjs/types/file-item-ref.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileItemRef
|
||||
sidebar_label: FileItemRef
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L7
|
||||
---
|
||||
|
||||
# `FileItemRef`
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadHookResult
|
||||
sidebar_label: FileUploadHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L14
|
||||
---
|
||||
|
||||
# `FileUploadHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(file: File) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(file: File) => Promise<UploadFileHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesHookResult
|
||||
sidebar_label: MultipleFilesHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L15
|
||||
---
|
||||
|
||||
# `MultipleFilesHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all the files have been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(files: Array<File>) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(options: UploadMultipleFilesActionParams) => Promise<MultipleFilesHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clear</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: NhostNextClientConstructorParams
|
||||
sidebar_label: NhostNextClientConstructorParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nextjs/src/index.ts#L11
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nextjs/src/index.ts#L16
|
||||
---
|
||||
|
||||
# `NhostNextClientConstructorParams`
|
||||
@@ -13,16 +13,32 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/nextjs/src/in
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">required</span> `string`
|
||||
**<span className="parameter-name">region</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Nhost backend URL.
|
||||
App region (e.g., eu-central-1)
|
||||
Not required in development (when `subdomain` is "localhost")
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">subdomain</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq)
|
||||
Should be used when using the Nhost platform
|
||||
Use "localhost" in development
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all
|
||||
GraphQL, Storage, and Serverless Functions requests.
|
||||
When set, the admin secret is sent as a header, `x-hasura-admin-secret`,
|
||||
for all requests to GraphQL, Storage, and Functions.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Nhost backend URL
|
||||
Should only be used when self-hosting
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ title: NhostReactClientConstructorParams
|
||||
sidebar_label: NhostReactClientConstructorParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/client.ts#L3
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/client.ts#L5
|
||||
---
|
||||
|
||||
# `NhostReactClientConstructorParams`
|
||||
@@ -65,15 +65,31 @@ Activate devTools e.g. the ability to connect to the xstate inspector
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">required</span> `string`
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Nhost backend URL.
|
||||
Nhost backend URL
|
||||
Should only be used when self-hosting
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all
|
||||
GraphQL, Storage, and Serverless Functions requests.
|
||||
When set, the admin secret is sent as a header, `x-hasura-admin-secret`,
|
||||
for all requests to GraphQL, Storage, and Functions.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">subdomain</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq)
|
||||
Should be used when using the Nhost platform
|
||||
Use "localhost" in development
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">region</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
App region (e.g., eu-central-1)
|
||||
Not required in development (when `subdomain` is "localhost")
|
||||
|
||||
---
|
||||
|
||||
@@ -4,7 +4,7 @@ title: NhostClient
|
||||
sidebar_label: NhostClient
|
||||
description: No description provided.
|
||||
slug: /reference/react/nhost-client
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/client.ts#L6
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/client.ts#L10
|
||||
---
|
||||
|
||||
# `NhostClient`
|
||||
@@ -15,15 +15,17 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/cli
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`NhostReactClientConstructorParams`](/reference/docgen/react/types/nhost-react-client-constructor-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :------------------ | :------: | :----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>backendUrl</span> | `string` | ✔️ | Nhost backend URL. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>adminSecret</span> | `string` | | Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all GraphQL, Storage, and Serverless Functions requests. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :------------------ | :------: | :---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>region</span> | `string` | | App region (e.g., eu-central-1) Not required in development (when `subdomain` is "localhost") |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>subdomain</span> | `string` | | App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq) Should be used when using the Nhost platform Use "localhost" in development |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>adminSecret</span> | `string` | | When set, the admin secret is sent as a header, `x-hasura-admin-secret`, for all requests to GraphQL, Storage, and Functions. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>backendUrl</span> | `string` | | Nhost backend URL Should only be used when self-hosting |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
|
||||
---
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUploadItem()
|
||||
sidebar_label: useFileUploadItem()
|
||||
slug: /reference/react/use-file-upload-item
|
||||
description: Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L59
|
||||
---
|
||||
|
||||
# `useFileUploadItem()`
|
||||
|
||||
Use the hook `useFileUploadItem` to control the file upload of a file in a multiple file upload.
|
||||
|
||||
It has the same signature as `useFileUpload`.
|
||||
|
||||
```tsx
|
||||
const Item = ({ itemRef }) => {
|
||||
const { name, progress } = useFileUploadItem(itemRef)
|
||||
return (
|
||||
<li>
|
||||
{name} {progress}
|
||||
</li>
|
||||
)
|
||||
}
|
||||
|
||||
const List = () => {
|
||||
const { list } = useMultipleFilesUpload()
|
||||
return (
|
||||
<ul>
|
||||
{list.map((itemRef) => (
|
||||
<Item key={item.id} itemRef={item} />
|
||||
))}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">ref</span>** <span className="optional-status">required</span> `ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>` | `Interpreter<FileUploadContext, any, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>`
|
||||
|
||||
---
|
||||
33
docs/docs/reference/docgen/react/content/use-file-upload.mdx
Normal file
33
docs/docs/reference/docgen/react/content/use-file-upload.mdx
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useFileUpload()
|
||||
sidebar_label: useFileUpload()
|
||||
slug: /reference/react/use-file-upload
|
||||
description: Use the hook `useFileUpload` to upload a file.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L129
|
||||
---
|
||||
|
||||
# `useFileUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload a file.
|
||||
|
||||
```tsx
|
||||
const {
|
||||
add,
|
||||
upload,
|
||||
cancel,
|
||||
isUploaded,
|
||||
isUploading,
|
||||
isError,
|
||||
progress,
|
||||
id,
|
||||
bucketId,
|
||||
name
|
||||
} = useFileUpload()
|
||||
|
||||
const handleFormSubmit = async (e) => {
|
||||
e.preventDefault()
|
||||
|
||||
await upload({ file })
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: useMultipleFilesUpload()
|
||||
sidebar_label: useMultipleFilesUpload()
|
||||
slug: /reference/react/use-multiple-files-upload
|
||||
description: Use the hook `useFileUpload` to upload multiple files.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L52
|
||||
---
|
||||
|
||||
# `useMultipleFilesUpload()`
|
||||
|
||||
Use the hook `useFileUpload` to upload multiple files.
|
||||
@@ -3,13 +3,17 @@
|
||||
title: useNhostBackendUrl()
|
||||
sidebar_label: useNhostBackendUrl()
|
||||
slug: /reference/react/use-nhost-backend-url
|
||||
description: Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L15
|
||||
sidebar_class_name: deprecated
|
||||
description: No description provided.
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useNhostBackendUrl.ts#L16
|
||||
---
|
||||
|
||||
# `useNhostBackendUrl()`
|
||||
|
||||
:::caution Deprecated
|
||||
Nhost services can now be split to subdomains to improve performance with CDN. Use `nhost.auth.url` or `nhost.storage.url` instead.
|
||||
Use the hook `useNhostBackendUrl` to get the Nhost backend URL.
|
||||
:::
|
||||
|
||||
```tsx
|
||||
const nhostBackendUrl = useNhostBackendUrl()
|
||||
|
||||
10
docs/docs/reference/docgen/react/types/file-item-ref.mdx
Normal file
10
docs/docs/reference/docgen/react/types/file-item-ref.mdx
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileItemRef
|
||||
sidebar_label: FileItemRef
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-storage-js/src/machines/multiple-files-upload.ts#L7
|
||||
---
|
||||
|
||||
# `FileItemRef`
|
||||
@@ -0,0 +1,80 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: FileUploadHookResult
|
||||
sidebar_label: FileUploadHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useFileUpload.ts#L14
|
||||
---
|
||||
|
||||
# `FileUploadHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
**`@returns`**
|
||||
|
||||
`true` if an error occurred
|
||||
|
||||
**`@depreacted`**
|
||||
|
||||
use `!isSuccess` or `!!error` instead
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">error</span>** <span className="optional-status">required</span> `null` | `ErrorPayload`
|
||||
|
||||
Provides details about the error
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file is being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the file has been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">id</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the id of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">bucketId</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the bucket id.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">name</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Returns the name of the file.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(file: File) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(file: File) => Promise<UploadFileHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -0,0 +1,66 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: MultipleFilesHookResult
|
||||
sidebar_label: MultipleFilesHookResult
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/useMultipleFilesUpload.ts#L15
|
||||
---
|
||||
|
||||
# `MultipleFilesHookResult`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploading</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when the files are being uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">progress</span>** <span className="optional-status">required</span> `null` | `number`
|
||||
|
||||
Returns the overall progress of the upload, from 0 to 100. Returns null if the upload has not started yet.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">files</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
The list of file uploads. The properties can be accessed through `item.getSnapshot()` of with the `useFileUploadItem` hook.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isError</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all upload request are processed, but at least one of them has failed.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">errors</span>** <span className="optional-status">required</span> `Array<ActorRefWithDeprecatedState<FileUploadContext, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, { value: any, context: FileUploadContext }, ResolveTypegenMeta<Typegen0, { type: "ADD", file: File, id: string, bucketId: string, name: string } | { type: "UPLOAD", url: string, file: File, id: string, bucketId: string, name: string, accessToken: string, adminSecret: string } | { type: "UPLOAD_PROGRESS", progress: number, loaded: number, additions: number } | { type: "UPLOAD_DONE", id: string, bucketId: string } | { type: "UPLOAD_ERROR", error: ErrorPayload } | { type: "CANCEL" } | { type: "DESTROY" }, BaseActionObject, ServiceMap>>>`
|
||||
|
||||
Returns the list of file uploads that have failed
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">isUploaded</span>** <span className="optional-status">required</span> `boolean`
|
||||
|
||||
Returns `true` when all the files have been successfully uploaded.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">add</span>** <span className="optional-status">required</span> `(files: Array<File>) => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">upload</span>** <span className="optional-status">required</span> `(options: UploadMultipleFilesActionParams) => Promise<MultipleFilesHandlerResult>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">cancel</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">clear</span>** <span className="optional-status">required</span> `() => void`
|
||||
|
||||
---
|
||||
@@ -4,7 +4,7 @@ title: NhostReactClientConstructorParams
|
||||
sidebar_label: NhostReactClientConstructorParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/client.ts#L3
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/client.ts#L5
|
||||
---
|
||||
|
||||
# `NhostReactClientConstructorParams`
|
||||
@@ -13,16 +13,32 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/react/src/cli
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">required</span> `string`
|
||||
**<span className="parameter-name">region</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Nhost backend URL.
|
||||
App region (e.g., eu-central-1)
|
||||
Not required in development (when `subdomain` is "localhost")
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">subdomain</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq)
|
||||
Should be used when using the Nhost platform
|
||||
Use "localhost" in development
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all
|
||||
GraphQL, Storage, and Serverless Functions requests.
|
||||
When set, the admin secret is sent as a header, `x-hasura-admin-secret`,
|
||||
for all requests to GraphQL, Storage, and Functions.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Nhost backend URL
|
||||
Should only be used when self-hosting
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ title: NhostClient
|
||||
sidebar_label: NhostClient
|
||||
description: No description provided.
|
||||
slug: /reference/vue/nhost-client
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/client.ts#L10
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/client.ts#L18
|
||||
---
|
||||
|
||||
# `NhostClient`
|
||||
@@ -15,15 +15,17 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/clien
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`NhostVueClientConstructorParams`](/reference/docgen/vue/types/nhost-vue-client-constructor-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :------------------ | :------: | :----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>backendUrl</span> | `string` | ✔️ | Nhost backend URL. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>adminSecret</span> | `string` | | Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all GraphQL, Storage, and Serverless Functions requests. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
| Property | Type | Required | Notes |
|
||||
| :----------------------------------------------------------------------------------------------------- | :------------------ | :------: | :---------------------------------------------------------------------------------------------------------------------------- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>region</span> | `string` | | App region (e.g., eu-central-1) Not required in development (when `subdomain` is "localhost") |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>subdomain</span> | `string` | | App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq) Should be used when using the Nhost platform Use "localhost" in development |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>adminSecret</span> | `string` | | When set, the admin secret is sent as a header, `x-hasura-admin-secret`, for all requests to GraphQL, Storage, and Functions. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>backendUrl</span> | `string` | | Nhost backend URL Should only be used when self-hosting |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>devTools</span> | `boolean` | | Activate devTools e.g. the ability to connect to the xstate inspector |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoSignIn</span> | `boolean` | | When set to true, will parse the url on startup to check if it contains a refresh token to start the session with |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>autoRefreshToken</span> | `boolean` | | When set to true, will automatically refresh token before it expires |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorage</span> | `ClientStorage` | | Object where the refresh token will be persisted and read locally. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>clientStorageType</span> | `ClientStorageType` | | Define a way to get information about the refresh token and its exipration date. |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>refreshIntervalTime</span> | `number` | | Time interval until token refreshes, in seconds |
|
||||
|
||||
---
|
||||
|
||||
@@ -4,7 +4,7 @@ title: NhostVueClientConstructorParams
|
||||
sidebar_label: NhostVueClientConstructorParams
|
||||
description: No description provided.
|
||||
displayed_sidebar: referenceSidebar
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/client.ts#L7
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/client.ts#L13
|
||||
---
|
||||
|
||||
# `NhostVueClientConstructorParams`
|
||||
@@ -13,16 +13,32 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/vue/src/clien
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">required</span> `string`
|
||||
**<span className="parameter-name">region</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Nhost backend URL.
|
||||
App region (e.g., eu-central-1)
|
||||
Not required in development (when `subdomain` is "localhost")
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">subdomain</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
App subdomain (e.g, ieingiwnginwnfnegqwvdqwdwq)
|
||||
Should be used when using the Nhost platform
|
||||
Use "localhost" in development
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">adminSecret</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Admin secret. When set, it is sent as an `x-hasura-admin-secret` header for all
|
||||
GraphQL, Storage, and Serverless Functions requests.
|
||||
When set, the admin secret is sent as a header, `x-hasura-admin-secret`,
|
||||
for all requests to GraphQL, Storage, and Functions.
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">backendUrl</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
Nhost backend URL
|
||||
Should only be used when self-hosting
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"label": "Hasura Auth",
|
||||
"position": 5
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
title: 'API Reference'
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
import { Swagger } from '@site/src/components/Swagger';
|
||||
|
||||
<Swagger spec="hasura-auth.json" />
|
||||
@@ -1,222 +0,0 @@
|
||||
---
|
||||
title: Configuration
|
||||
sidebar_position: 2
|
||||
---
|
||||
|
||||
## Email configuration
|
||||
|
||||
Hasura Auth automatically sends transactional emails to manage the following operations:
|
||||
|
||||
- Sign up
|
||||
- Password reset
|
||||
- Email change
|
||||
- Passwordless with emails
|
||||
|
||||
### SMTP settings
|
||||
|
||||
```bash
|
||||
AUTH_SMTP_HOST=smtp.example.com
|
||||
AUTH_SMTP_PORT=1025
|
||||
AUTH_SMTP_USER=user
|
||||
AUTH_SMTP_PASS=password
|
||||
AUTH_SMTP_SENDER=hasura-auth@example.com
|
||||
```
|
||||
|
||||
See the [environment variables](/reference/hasura-auth/environment-variables) for additional information about how to connnect to an SMTP server.
|
||||
|
||||
### Email templates
|
||||
|
||||
You can create your own templates to customize the emails that will be sent to the users. You can have a look at the [official email templates](https://github.com/nhost/hasura-auth/tree/main/email-templates) to understand how they are structured.
|
||||
|
||||
#### With Docker
|
||||
|
||||
When using Docker, you can mount your own email templates from the local file system. You can have a look at this [docker-compose example](https://github.com/nhost/hasura-auth/blob/16df3e84b6c9a4f888b2ff07bd85afc34f8ed051/docker-compose-example.yaml#L41) to see how to set it up.
|
||||
|
||||
#### Remote email templates
|
||||
|
||||
When running Hasura Auth in its own infrastructure, it is possible to mount a volume with custom `email-templates` directory. However, in some cases, we may want to fetch templates from an external HTTP endpoint. Hence the introduction of a new `AUTH_EMAIL_TEMPLATE_FETCH_URL` environment variable:
|
||||
|
||||
```bash
|
||||
AUTH_EMAIL_TEMPLATE_FETCH_URL=https://github.com/nhost/nhost/tree/custom-email-templates-example/examples/custom-email-templates
|
||||
```
|
||||
|
||||
In the above example, on every email creation, the server will use this URL to fetch its templates, depending on the locale, email type and field.
|
||||
|
||||
For instance, the template for english verification email body will the fetched in [https://raw.githubusercontent.com/nhost/nhost/main/examples/custom-email-templates/en/email-verify/body.html](https://raw.githubusercontent.com/nhost/nhost/main/examples/custom-email-templates/en/email-verify/body.html).
|
||||
|
||||
See the [example in the main nhost/nhost repository](https://github.com/nhost/nhost/tree/main/examples/custom-email-templates).
|
||||
|
||||
The context variables in email templates have been simplified: the `${link}` variable contains the entire redirection url the recipient needs to follow.
|
||||
|
||||
---
|
||||
|
||||
## Redirections
|
||||
|
||||
Some authentication operations redirects the users to the frontend application:
|
||||
|
||||
- After an OAuth provider completes or fails authentication, the user is redirected to the frontend
|
||||
- Every email sent to the user (passwordless with email, password/email change, password reset) contains a link, that redirects the user to the frontend
|
||||
|
||||
In order to achieve that, you need to set the `AUTH_CLIENT_URL` environment variable, for instance:
|
||||
|
||||
```bash
|
||||
AUTH_CLIENT_URL=https://my-app.vercel.com
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Email + password authentication
|
||||
|
||||
### Email checks
|
||||
|
||||
You can specify a list of allowed emails or domains with `AUTH_ACCESS_CONTROL_ALLOWED_EMAILS` and `AUTH_ACCESS_CONTROL_ALLOWED_EMAIL_DOMAINS`.
|
||||
|
||||
As an example, the following environment variables will only allow `@nhost.io`, `@example.com` and `bob@smith.com` to register to the application:
|
||||
|
||||
```bash
|
||||
AUTH_ACCESS_CONTROL_ALLOWED_EMAILS=bob@smith.com
|
||||
AUTH_ACCESS_CONTROL_ALLOWED_EMAIL_DOMAINS=nhost.io,example.com
|
||||
```
|
||||
|
||||
In the above example, users with the following emails would be able to register `bob@smith.com`, `emma@example.com`, `john@nhost.io`, whereas `mary@firebase.com` won't.
|
||||
|
||||
Similarly, it is possible to provide a list of forbidden emails or domains with `AUTH_ACCESS_CONTROL_BLOCKED_EMAILS` and `AUTH_ACCESS_CONTROL_BLOCKED_EMAIL_DOMAINS`.
|
||||
|
||||
### Password checks
|
||||
|
||||
Hasura auth does not accepts passwords with less than three characters. This limit can be changed in changing the `AUTH_PASSWORD_MIN_LENGTH` environment variable.
|
||||
|
||||
It is also possible to only allow [passwords that have not been pwned](https://haveibeenpwned.com/) in setting `AUTH_PASSWORD_HIBP_ENABLED` to `true`.
|
||||
|
||||
<!-- TODO ### Change -->
|
||||
<!-- TODO ### Reset email -->
|
||||
|
||||
<!-- TODO ### Reset password -->
|
||||
|
||||
<!-- ---
|
||||
TODO ## Anonymous users -->
|
||||
|
||||
---
|
||||
|
||||
## Multi-factor authentication
|
||||
|
||||
Hasura Auth supports different types of Multi-Factor Authentication (MFA): passwordless with emails (magic links), passwordless with SMS, and Time-based one-time passwords.
|
||||
|
||||
### Passwordless with emails (magic links)
|
||||
|
||||
Hasura Auth supports email [passwordless authentication](https://en.wikipedia.org/wiki/Passwordless_authentication). It requires [SMTP](#email-configuration) to be configured properly.
|
||||
|
||||
Set `AUTH_EMAIL_PASSWORDLESS_ENABLED` to `true` to enable passwordless authentication.
|
||||
|
||||
<!-- TODO ### Passwordless with SMS -->
|
||||
|
||||
### Time-based one-time password (TOTP)
|
||||
|
||||
It is possible to add a step to authentication with email and password authentication. Once users registered, they can activate MFA TOTP:
|
||||
|
||||
1. Users generate a QR Code, that is then scanned in an authentication app such as [Authy](https://authy.com/) or [Google Authenticator](https://en.wikipedia.org/wiki/Google_Authenticator).
|
||||
2. They then send the TOTP code to Hasura Auth. MFA is now activated
|
||||
3. Next time they authenticate, Hasura Auth will first expect their email and password, but then, instead of completing authentication, Hasura Auth will expect the TOTP in order to return the refresh and the access tokens.
|
||||
|
||||
In order for users to be able to activate MFA TOTP, `AUTH_MFA_ENABLED` must be set to `true`.
|
||||
|
||||
<!-- ---
|
||||
|
||||
TODO ## OAuth authentication -->
|
||||
|
||||
---
|
||||
|
||||
## Gravatar
|
||||
|
||||
Hasura Auth stores the avatar URL of users in `auth.users.avatar_url`. By default, it will look for the Gravatar linked to the email, and store it into this field.
|
||||
It is possible to deactivate the use of Gravatar in setting the `AUTH_GRAVATAR_ENABLED` environment variable to `false`.
|
||||
|
||||
---
|
||||
|
||||
## Extending user schema
|
||||
|
||||
Adding columns to the user tables may be tempting. However, all the tables and columns have a specific purpose, and changing the structure of the `auth` schema will very likely end in breaking the functionning of Hasura Auth. It's, therefore, **highly recommended** not to modify the database schema for any tables in the `auth` schema.
|
||||
|
||||
Instead, we recommend adding extra user information in the following ways:
|
||||
|
||||
- to store information in the `auth.users.metadata` column
|
||||
- to store information in a separate table located in the `public` PostgreSQL schema, and to point to `auth.users.id` through a foreign key.
|
||||
|
||||
### `metadata` user field
|
||||
|
||||
The `auth.users.metadata` field is a JSON column, that can be used as an option on registration:
|
||||
|
||||
```json
|
||||
{
|
||||
"email": "bob@bob.com",
|
||||
"passord": "12345678",
|
||||
"options": {
|
||||
"metadata": {
|
||||
"first_name": "Bob"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Additional user information in the `public` schema
|
||||
|
||||
As previously explained, the alteration of the `auth` schema may seriously hamper the functionning of Hasura Auth. The `metadata` field in the `auth.users` table may tackle some use cases, but in some other cases, we want to keep a certain level of structure in the way data is structured.
|
||||
|
||||
In that case, it is possible to create a dedicated table in the `public` schema, with a `user_id` foreign key column that would point to the `auth.users.id` column. It is then possible to add an Hasura object relationship that would join the two tables together.
|
||||
|
||||
<!-- TODO hooks on the metadata field -->
|
||||
|
||||
---
|
||||
|
||||
## Custom Hasura JWT claims
|
||||
|
||||
Hasura comes with a [powerful authorisation system](https://hasura.io/docs/latest/graphql/core/auth/authorization/index.html). Hasura Auth is already configured to add `x-hasura-user-id`, `x-hasura-allowed-roles`, and `x-hasura-user-isAnonymous` to the JSON Web Tokens it generates.
|
||||
|
||||
In Hasura Auth, it is possible to define custom claims to add to the JWT, so they can be used by Hasura to determine the permissions of the received GraphQL operation.
|
||||
|
||||
Each custom claim is defined by a pair of a key and a value:
|
||||
|
||||
- The key determines the name of the claim, prefixed by `x-hasura`. For instance, `organisation-id` will become `x-hasura-organisation-id`.
|
||||
- The value is a representation of the path to look at to determine the value of the claim. For instance `profile.organisation.id` will look for the `user.profile` Hasura relationship, and the `profile.organisation` Hasura relationship. Array values are transformed into Postgres syntax so Hasura can interpret them. See the official Hasura documentation to understand the [session variables format](https://hasura.io/docs/latest/graphql/core/auth/authorization/roles-variables.html#format-of-session-variables).
|
||||
|
||||
```bash
|
||||
AUTH_JWT_CUSTOM_CLAIMS={"organisation-id":"profile.organisation.id", "project-ids":"profile.contributesTo.project.id"}
|
||||
```
|
||||
|
||||
Will automatically generate and fetch the following GraphQL query:
|
||||
|
||||
```graphql
|
||||
{
|
||||
user(id: "<user-id>") {
|
||||
profile {
|
||||
organisation {
|
||||
id
|
||||
}
|
||||
contributesTo {
|
||||
project {
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
It will then use the same expressions e.g. `profile.contributesTo.project.id` to evaluate the result with [JSONata](https://jsonata.org/), and possibly transform arrays into Hasura-readable, PostgreSQL arrays.Finally, it adds the custom claims to the JWT in the `https://hasura.io/jwt/claims` namespace:
|
||||
|
||||
```json
|
||||
{
|
||||
"https://hasura.io/jwt/claims": {
|
||||
"x-hasura-organisation-id": "8bdc4f57-7d64-4146-a663-6bcb05ea2ac1",
|
||||
"x-hasura-project-ids": "{\"3af1b33f-fd0f-425e-92e2-0db09c8b2e29\",\"979cb94c-d873-4d5b-8ee0-74527428f58f\"}",
|
||||
"x-hasura-allowed-roles": [ "me", "user" ],
|
||||
"x-hasura-default-role": "user",
|
||||
"x-hasura-user-id": "121bbea4-908e-4540-ac5d-52c7f6f93bec",
|
||||
"x-hasura-user-isAnonymous": "false"
|
||||
}
|
||||
"sub": "f8776768-4bbd-46f8-bae1-3c40da4a89ff",
|
||||
"iss": "hasura-auth",
|
||||
"iat": 1643040189,
|
||||
"exp": 1643041089
|
||||
}
|
||||
```
|
||||
@@ -1,107 +0,0 @@
|
||||
---
|
||||
title: Environment variables
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
## General environment variables
|
||||
|
||||
| Name (a star**\*** means the variable is required) | Description | Default value |
|
||||
| -------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------- |
|
||||
| HASURA_GRAPHQL_JWT_SECRET**\*** | Key used for generating JWTs. Must be `HMAC-SHA`-based and the same as configured in Hasura. [More info](https://hasura.io/docs/latest/graphql/core/auth/authentication/jwt.html#running-with-jwt) | |
|
||||
| HASURA_GRAPHQL_DATABASE_URL**\*** | [PostgreSQL connection URI](https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING). Required to inject the `auth` schema into the database. | |
|
||||
| HASURA_GRAPHQL_GRAPHQL_URL**\*** | Hasura GraphQL endpoint. Required to manipulate account data. For instance: `https://graphql-engine:8080/v1/graphql` | |
|
||||
| HASURA_GRAPHQL_ADMIN_SECRET**\*** | Hasura GraphQL Admin Secret. Required to manipulate account data. | |
|
||||
| AUTH_HOST | Server host. This option is available until Hasura-auth `v0.6.0`. [Docs](http://expressjs.com/en/5x/api.html#app.listen) | `0.0.0.0` |
|
||||
| AUTH_PORT | Server port. [Docs](http://expressjs.com/en/5x/api.html#app.listen) | `4000` |
|
||||
| AUTH_SERVER_URL | Server URL of where Hasura Backend Plus is running. This value is to used as a callback in email templates and for the OAuth authentication process. | |
|
||||
| AUTH_CLIENT_URL | URL of your frontend application. Used to redirect users to the right page once actions based on emails or OAuth succeed. | |
|
||||
| AUTH_SMTP_HOST | SMTP server hostname used for sending emails | |
|
||||
| AUTH_SMTP_PORT | SMTP port | `587` |
|
||||
| AUTH_SMTP_USER | Username to use to authenticate on the SMTP server | |
|
||||
| AUTH_SMTP_PASS | Password to use to authenticate on the SMTP server | |
|
||||
| AUTH_SMTP_SENDER | Email to use in the `From` field of the email | |
|
||||
| AUTH_SMTP_AUTH_METHOD | SMTP authentication method | `PLAIN` |
|
||||
| AUTH_SMTP_SECURE | Enables SSL. [More info](https://nodemailer.com/smtp/#tls-options). | `false` |
|
||||
| AUTH_GRAVATAR_ENABLED | | `true` |
|
||||
| AUTH_GRAVATAR_DEFAULT | | `blank` |
|
||||
| AUTH_GRAVATAR_RATING | | `g` |
|
||||
| AUTH_ANONYMOUS_USERS_ENABLED | Enables users to register as an anonymous user. | `false` |
|
||||
| AUTH_DISABLE_NEW_USERS | If set, new users will be disabled after finishing registration and won't be able to connect. | `false` |
|
||||
| AUTH_ACCESS_CONTROL_ALLOWED_EMAILS | Comma-separated list of emails that are allowed to register. | |
|
||||
| AUTH_ACCESS_CONTROL_ALLOWED_EMAIL_DOMAINS | Comma-separated list of email domains that are allowed to register. If `ALLOWED_EMAIL_DOMAINS` is `tesla.com,ikea.se`, only emails from tesla.com and ikea.se would be allowed to register an account. | `` (allow all email domains) |
|
||||
| AUTH_ACCESS_CONTROL_BLOCKED_EMAILS | Comma-separated list of emails that cannot register. | |
|
||||
| AUTH_ACCESS_CONTROL_BLOCKED_EMAIL_DOMAINS | Comma-separated list of email domains that cannot register. | |
|
||||
| AUTH_PASSWORD_MIN_LENGTH | Minimum password length. | `3` |
|
||||
| AUTH_PASSWORD_HIBP_ENABLED | User's password is checked against [Pwned Passwords](https://haveibeenpwned.com/Passwords). | `false` |
|
||||
| AUTH_USER_DEFAULT_ROLE | Default user role for registered users. | `user` |
|
||||
| AUTH_USER_DEFAULT_ALLOWED_ROLES | Comma-separated list of default allowed user roles. | `me,$AUTH_USER_DEFAULT_ROLE` |
|
||||
| AUTH_LOCALE_DEFAULT | | `en` |
|
||||
| AUTH_LOCALE_ALLOWED_LOCALES | | `en` |
|
||||
| AUTH_EMAIL_PASSWORDLESS_ENABLED | Enables passwordless authentication by email. The SMTP server must then be configured. | `false` |
|
||||
| AUTH_SMS_PASSWORDLESS_ENABLED | Enables passwordless authentication by SMS. An SMS provider must then be configured. | `false` |
|
||||
| AUTH_SMS_PROVIDER | SMS provider name. Only `twilio` is possible as an option for now. | |
|
||||
| AUTH_SMS_TWILIO_ACCOUNT_SID | | |
|
||||
| AUTH_SMS_TWILIO_AUTH_TOKEN | | |
|
||||
| AUTH_SMS_TWILIO_MESSAGING_SERVICE_ID | | |
|
||||
| AUTH_EMAIL_SIGNIN_EMAIL_VERIFIED_REQUIRED | When enabled, any email-based authentication requires emails to be verified by a link sent to this email. | `true` |
|
||||
| AUTH_ACCESS_CONTROL_ALLOWED_REDIRECT_URLS | | |
|
||||
| AUTH_MFA_ENABLED | Enables users to use Multi Factor Authentication. | `false` |
|
||||
| AUTH_MFA_TOTP_ISSUER | The name of the One Time Password (OTP) issuer. Probably your app's name. | `hasura-auth` |
|
||||
| AUTH_ACCESS_TOKEN_EXPIRES_IN | Number of seconds before the access token (JWT) expires. | `900`(15 minutes) |
|
||||
| AUTH_REFRESH_TOKEN_EXPIRES_IN | Number of seconds before the refresh token expires. | `2592000` (30 days) |
|
||||
| AUTH_EMAIL_TEMPLATE_FETCH_URL | | |
|
||||
| AUTH_JWT_CUSTOM_CLAIMS | | |
|
||||
|
||||
## OAuth environment variables
|
||||
|
||||
| Name (a star**\*** means the variable is required when the provider is enabled) | Default value |
|
||||
| ------------------------------------------------------------------------------- | ----------------------------------- |
|
||||
| AUTH_PROVIDER_GITHUB_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_GITHUB_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_GITHUB_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_GITHUB_AUTHORIZATION_URL | |
|
||||
| AUTH_PROVIDER_GITHUB_TOKEN_URL | |
|
||||
| AUTH_PROVIDER_GITHUB_USER_PROFILE_URL | |
|
||||
| AUTH_PROVIDER_GITHUB_SCOPE | `user:email ` |
|
||||
| AUTH_PROVIDER_GOOGLE_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_GOOGLE_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_GOOGLE_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_GOOGLE_SCOPE | `email,profile` |
|
||||
| AUTH_PROVIDER_FACEBOOK_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_FACEBOOK_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_FACEBOOK_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_FACEBOOK_PROFILE_FIELDS | `email,photos,displayName` |
|
||||
| AUTH_PROVIDER_FACEBOOK_SCOPE | `email` |
|
||||
| AUTH_PROVIDER_TWITTER_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_TWITTER_CONSUMER_KEY**\*** | |
|
||||
| AUTH_PROVIDER_TWITTER_CONSUMER_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_LINKEDIN_ENABLED | |
|
||||
| AUTH_PROVIDER_LINKEDIN_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_LINKEDIN_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_LINKEDIN_SCOPE | `r_emailaddress,r_liteprofile` |
|
||||
| AUTH_PROVIDER_APPLE_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_APPLE_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_APPLE_TEAM_ID**\*** | |
|
||||
| AUTH_PROVIDER_APPLE_KEY_ID**\*** | |
|
||||
| AUTH_PROVIDER_APPLE_PRIVATE_KEY**\*** | Base64 format |
|
||||
| AUTH_PROVIDER_APPLE_SCOPE | `name,email` |
|
||||
| AUTH_PROVIDER_WINDOWS_LIVE_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_WINDOWS_LIVE_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_WINDOWS_LIVE_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_WINDOWS_LIVE_SCOPE | `wl.basic,wl.emails` |
|
||||
| AUTH_PROVIDER_SPOTIFY_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_SPOTIFY_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_SPOTIFY_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_SPOTIFY_SCOPE | `user-read-email,user-read-private` |
|
||||
| AUTH_PROVIDER_GITLAB_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_GITLAB_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_GITLAB_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_GITLAB_BASE_URL | |
|
||||
| AUTH_PROVIDER_GITLAB_SCOPE | `read_user` |
|
||||
| AUTH_PROVIDER_BITBUCKET_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_BITBUCKET_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_BITBUCKET_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_STRAVA_ENABLED | `false` |
|
||||
| AUTH_PROVIDER_STRAVA_CLIENT_ID**\*** | |
|
||||
| AUTH_PROVIDER_STRAVA_CLIENT_SECRET**\*** | |
|
||||
| AUTH_PROVIDER_STRAVA_SCOPE | `profile:read_all` |
|
||||
@@ -1,41 +0,0 @@
|
||||
---
|
||||
title: 'Overview'
|
||||
---
|
||||
|
||||
Hasura Auth handles **authentication** for [Hasura](https://github.com/hasura/graphql-engine).
|
||||
|
||||
Hasura Auth runs in a separate Docker container alongside Postgres and Hasura.
|
||||
|
||||
## Features
|
||||
|
||||
- 🧑🤝🧑 Users are stored in Postgres and accessed via GraphQL
|
||||
- 🔑 Multiple sign-in methods
|
||||
- ✨ Integrates with GraphQL and Hasura Permissions
|
||||
- 🔐 JWT tokens and Refresh Tokens.
|
||||
- 📧 Emails sent on various operations
|
||||
<!-- - ✅ Optional checking for Pwned Passwords. -->
|
||||
- 🛡️ Two-factor authentication support.
|
||||
- 👨💻 Written 100% in TypeScript.
|
||||
|
||||
### Authentication methods
|
||||
|
||||
- **Email and Password**: simple email and password method.
|
||||
- **Email**, also called **passwordless email** or **magic link**.
|
||||
- **SMS**, also called **passwordless sms**.
|
||||
- **Anonymous**: sign in users without any method. Anonymous users can be
|
||||
converted to _regular_ users at a later stage.
|
||||
- **OAuth providers**: Facebook, Google, GitHub, Twitter, Apple, LinkedIn, Windows Live, Spotify, Strave, GitLab, BitBucket
|
||||
|
||||
## Integration with Hasura
|
||||
|
||||
Hasura Auth's final purpose is to securely provide a JSON Web Token that can be added as an authorization header to GraphQL operation sent to Hasura.
|
||||
Hasura auth automatically generates and manages two kinds of tokens:
|
||||
|
||||
- An access token (JWT), that will be used to authenticate the GraphQL operations in Hasura, and that has a limited expiration limit (15 minutes by default)
|
||||
- A refresh token, that is used to ask Hasura Auth for a new access token, and that can be consummed only once.
|
||||
|
||||
Access tokens generated by Hasura Auth contains information and user id, its default role, and the roles they actually have. In addition, it is possible since version `0.2.0` to extend JWT claims with custom information such as organisation or project ownership, so your application can leverage the capabilities of the [Hasura permissions layer](https://hasura.io/docs/latest/graphql/core/auth/authorization/index.html).
|
||||
|
||||
<!-- - Users and accounts are saved in the database. -->
|
||||
|
||||
You can read further information about JWT and Hasura in the [official Hasura documentation](https://hasura.io/docs/latest/graphql/core/auth/authentication/jwt.html).
|
||||
@@ -1,25 +0,0 @@
|
||||
---
|
||||
title: Installation
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
Hasura Auth runs in a container alongside Postgres and Hasura.
|
||||
|
||||
## Nhost (recommended)
|
||||
|
||||
The recommended way to start using Hasura Auth is by using Nhost. With Nhost, you will get a complete backend ready in seconds with Hasura, authentication, storage and serverless functions.
|
||||
|
||||
Go to [Nhost](https://nhost.io) and start building your app now.
|
||||
|
||||
## Docker-compose
|
||||
|
||||
```sh
|
||||
git clone https://github.com/nhost/hasura-auth.git
|
||||
cd hasura-auth
|
||||
cp .env.example .env
|
||||
docker-compose -f docker-compose-example.yaml up
|
||||
```
|
||||
|
||||
Hasura Auth comes with plenty of options. They are explained in the [configuration section](/reference/hasura-auth/configuration).
|
||||
|
||||
If you are already familiar with the application, you can also have a look at the [environment variables](/reference/hasura-auth/environment-variables) that can be passed on to your docker container.
|
||||
@@ -1,86 +0,0 @@
|
||||
---
|
||||
title: 'Schema'
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
Hasura Auth stores all its data in a dedicated `auth` PostgreSQL schema. When Hasura Auth starts, it checks if the `auth` schema exists, then automatically syncs the following tables and their corresponding Hasura metadata:
|
||||
|
||||
```mermaid
|
||||
erDiagram
|
||||
migrations {
|
||||
integer id PK
|
||||
varchar name
|
||||
varchar hash
|
||||
timestamp executed_at "CURRENT_TIMESTAMP"
|
||||
}
|
||||
|
||||
users ||--o{ user_roles : roles
|
||||
user_roles }o--|| roles: role
|
||||
users }o--|| roles: role
|
||||
users ||--o{ refresh_tokens: refreshTokens
|
||||
users ||--o{ user_providers: provider
|
||||
providers ||--o{ user_providers: user
|
||||
|
||||
provider_requests {
|
||||
uuid id PK "gen_random_uuid()"
|
||||
test redirect_url
|
||||
}
|
||||
|
||||
|
||||
refresh_tokens {
|
||||
uuid refresh_token PK
|
||||
uuid user_id FK
|
||||
timestamptz created_at "now()"
|
||||
timestamptz expires_at
|
||||
}
|
||||
|
||||
providers {
|
||||
text id PK
|
||||
}
|
||||
user_providers {
|
||||
uuid id PK "gen_random_uuid()"
|
||||
timestamptz created_at "now()"
|
||||
timestamptz updated_at "now()"
|
||||
uuid user_id FK
|
||||
text access_token
|
||||
text refresh_token
|
||||
text provider_id FK
|
||||
text provider_user_id
|
||||
}
|
||||
user_roles {
|
||||
uuid id PK "gen_random_uuid()"
|
||||
timestamptz created_at "now()"
|
||||
uuid user_id FK
|
||||
text role FK
|
||||
}
|
||||
users {
|
||||
uuid id PK "gen_random_uuid()"
|
||||
timestamptz created_at "now()"
|
||||
timestamptz updated_at "now()"
|
||||
timestamptz last_seen "nullable"
|
||||
boolean disabled "false"
|
||||
text display_name "''"
|
||||
text avatar_url "''"
|
||||
varchar locale
|
||||
email email "nullable"
|
||||
text phone_number "nullable"
|
||||
text password_hash "nullable"
|
||||
boolean email_verified "false"
|
||||
boolean phone_number_verified "false"
|
||||
email new_email "nullable"
|
||||
text otp_method_last_used "nullable"
|
||||
text otp_hash "nullable"
|
||||
timestamptz opt_hash_expires_at "now()"
|
||||
text default_role FK "user"
|
||||
boolean is_anonymous "false"
|
||||
text totp_secret "nullable"
|
||||
text active_mfa_type "nullable"
|
||||
text ticket "nullable"
|
||||
timestamptz ticket_expires_at "now()"
|
||||
jsonb metadata "nullable"
|
||||
}
|
||||
|
||||
roles {
|
||||
text roles PK
|
||||
}
|
||||
```
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user