Compare commits

..

41 Commits

Author SHA1 Message Date
Pilou
7692abf98c Merge pull request #988 from nhost/changeset-release/main
chore: update versions
2022-10-05 16:31:01 +02:00
Pilou
4e0aafbf08 Merge pull request #994 from nhost/contributors-readme-action-Q45QQ-Yjc2
contributors readme action update
2022-10-05 16:30:10 +02:00
github-actions[bot]
5f18361d4a chore: update versions 2022-10-05 14:29:49 +00:00
github-actions[bot]
09fe573bff contrib-readme-action has updated readme 2022-10-05 14:28:51 +00:00
Pilou
b7396c3b02 Merge pull request #985 from ejkkan/feat/add-async-support-for-stripe-server-isAllowed-function
feat/added async support for isAllowed prop for createStripeGraphQLServer
2022-10-05 16:28:32 +02:00
Pilou
aa177677b5 Merge pull request #993 from nhost/update-code-owners
Update code owners
2022-10-05 12:06:38 +02:00
Pilou
c922de7b0c Create orange-geckos-pull.md 2022-10-05 10:19:51 +02:00
Pierre-Louis Mercereau
38526d7ef2 chore: update code owners 2022-10-05 10:17:32 +02:00
Erik Magnusson
057c8be55a Update packages/stripe-graphql-js/src/schema/stripe.ts
apply working async iteration of customer data

Co-authored-by: Pilou <24897252+plmercereau@users.noreply.github.com>
2022-10-05 10:06:07 +02:00
Pierre-Louis Mercereau
4783657986 chore: update code owners 2022-10-05 09:15:31 +02:00
Erik Magnusson
e3606c091f fix missig type update 2022-10-05 07:36:20 +02:00
Pilou
d5489b71ec Merge pull request #989 from nhost/chore/next-tsconfig-paths
chore: 🤖 remove empty paths in nextjs tsconfig
2022-10-03 17:01:53 +02:00
Pierre-Louis Mercereau
a6bc3091a2 chore: 🤖 remove empty paths in nextjs tsconfig 2022-10-03 16:09:33 +02:00
Pilou
01a086cd05 Merge pull request #987 from nhost/contributors-readme-action-YDPxAfJmCW
contributors readme action update
2022-10-03 13:37:35 +02:00
github-actions[bot]
a8cc2e0c9b contrib-readme-action has updated readme 2022-10-03 11:36:32 +00:00
Pilou
11f0a1493d Merge pull request #986 from altschuler/main
fix: read nextjs context cookie in clientStorage
2022-10-03 13:36:13 +02:00
Pilou
8eafa19810 Create unlucky-months-work.md 2022-10-03 13:35:07 +02:00
Simon Altschuler
1e31a9567d fix: read nextjs context cookie in clientStorage 2022-10-03 12:53:42 +02:00
Erik Magnusson
c6120bfca1 added async handling for isAllowed usages 2022-10-03 10:55:12 +02:00
Erik Magnusson
4c37cc5bc2 added async support for isAllowed prop for createStripeGraphQLServer 2022-10-03 08:47:17 +02:00
Johan Eliasson
66ef8f91a3 Merge pull request #972 from nhost/webauthn-documentation
Webauthn documentation
2022-09-29 17:43:13 +02:00
Pierre-Louis Mercereau
3f135abed9 Revert "fix: 🐛 Return a network error code"
This reverts commit 94d7703f9b.
2022-09-29 12:08:17 +02:00
Pierre-Louis Mercereau
9f127f3333 Merge branch 'webauthn-documentation' of https://github.com/nhost/nhost into webauthn-documentation 2022-09-29 12:07:11 +02:00
Pierre-Louis Mercereau
f9b164baa3 docs: ✏️ Security Keys 2022-09-29 12:07:00 +02:00
Pilou
73804c8450 Merge pull request #968 from nhost/react-apollo-example/other-sign-in-up-options
Improve navigation in the react-apollo example
2022-09-28 21:13:17 +02:00
Johan Eliasson
537259e00b Merge pull request #964 from nhost/fix-stripe-asd91h23
Stripe GraphQL API updates
2022-09-28 17:28:34 +02:00
Pierre-Louis Mercereau
94d7703f9b fix: 🐛 Return a network error code 2022-09-28 17:13:45 +02:00
Pierre-Louis Mercereau
c24207eeea feat: improve navigation 2022-09-28 17:06:13 +02:00
Johan Eliasson
54057ffe8a typo 2022-09-28 16:33:41 +02:00
Johan Eliasson
0e9052e810 added info about stripe secret key 2022-09-28 16:24:38 +02:00
Pilou
3a209a8ee3 Merge pull request #967 from nhost/bump-hasura-auth-0.13.2
chore: 🤖 bump hasura-auth version to 0.13.2
2022-09-28 15:44:25 +02:00
Pierre-Louis Mercereau
f26d38a0f1 chore: 🤖 bump hasura-auth version to 0.13.2 2022-09-28 15:08:38 +02:00
Johan Eliasson
0e06259e24 update 2022-09-27 15:10:30 +02:00
Johan Eliasson
ce7d81c6d3 correct package names 2022-09-27 15:02:44 +02:00
Johan Eliasson
3779772c99 Merge pull request #963 from nhost/docs-database
doc (database): UI updates and direct access
2022-09-27 15:01:28 +02:00
Johan Eliasson
c657cb85cf identity explination 2022-09-27 12:11:45 +02:00
Johan Eliasson
46dfa9634c wording 2022-09-27 12:07:47 +02:00
Johan Eliasson
13f5531b7e update 2022-09-27 12:03:53 +02:00
Johan Eliasson
0ecff620fb Update docs/docs/platform/database/index.mdx
Co-authored-by: Szilárd Dóró <doroszilard@icloud.com>
2022-09-27 11:56:23 +02:00
Johan Eliasson
0470e65a38 Update docs/docs/platform/database/index.mdx
Co-authored-by: Szilárd Dóró <doroszilard@icloud.com>
2022-09-27 11:56:01 +02:00
Johan Eliasson
f031cf9463 update 2022-09-27 10:39:01 +02:00
43 changed files with 367 additions and 161 deletions

13
.github/CODEOWNERS vendored
View File

@@ -1,8 +1,13 @@
# Documentation
# https://help.github.com/en/articles/about-code-owners
/packages @plmercereau
/packages @plmercereau @szilarddoro
/packages/docgen @szilarddoro
/.github/workflows @plmercereau
/docs/ @guicurcio
/examples/ @plmercereau @guicurcio @FuzzyReason
/packages/stripe-graphql-js @elitan
/.github @plmercereau
/docs/ @guicurcio @elitan
/config/ @plmercereau @szilarddoro
/examples/ @plmercereau
/examples/codegen-react-apollo @elitan @plmercereau
/examples/codegen-react-query @elitan @plmercereau
/examples/react-apollo-crm @elitan @plmercereau

View File

@@ -219,6 +219,13 @@ Here are some ways of contributing to making Nhost better:
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/ejkkan">
<img src="https://avatars.githubusercontent.com/u/32518962?v=4" width="100;" alt="ejkkan"/>
<br />
<sub><b>Erik Magnusson</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/macmac49">
<img src="https://avatars.githubusercontent.com/u/831190?v=4" width="100;" alt="macmac49"/>
@@ -253,15 +260,15 @@ Here are some ways of contributing to making Nhost better:
<br />
<sub><b>David Barroso</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/hajek-raven">
<img src="https://avatars.githubusercontent.com/u/7288737?v=4" width="100;" alt="hajek-raven"/>
<br />
<sub><b>Filip Hájek</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/MelodicCrypter">
<img src="https://avatars.githubusercontent.com/u/18341500?v=4" width="100;" alt="MelodicCrypter"/>
@@ -296,15 +303,15 @@ Here are some ways of contributing to making Nhost better:
<br />
<sub><b>Nicolas Bourdin</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/Savinvadim1312">
<img src="https://avatars.githubusercontent.com/u/16936043?v=4" width="100;" alt="Savinvadim1312"/>
<br />
<sub><b>Savin Vadim</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/Svarto">
<img src="https://avatars.githubusercontent.com/u/24279217?v=4" width="100;" alt="Svarto"/>
@@ -339,15 +346,15 @@ Here are some ways of contributing to making Nhost better:
<br />
<sub><b>Animesh Pathak</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/rustyb">
<img src="https://avatars.githubusercontent.com/u/53086?v=4" width="100;" alt="rustyb"/>
<br />
<sub><b>Colin Broderick</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/dminkovsky">
<img src="https://avatars.githubusercontent.com/u/218725?v=4" width="100;" alt="dminkovsky"/>
@@ -382,15 +389,15 @@ Here are some ways of contributing to making Nhost better:
<br />
<sub><b>Hoang Do</b></sub>
</a>
</td>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/eltociear">
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="100;" alt="eltociear"/>
<br />
<sub><b>Ikko Ashimine</b></sub>
</a>
</td></tr>
<tr>
</td>
<td align="center">
<a href="https://github.com/jladuval">
<img src="https://avatars.githubusercontent.com/u/1935359?v=4" width="100;" alt="jladuval"/>
@@ -398,13 +405,6 @@ Here are some ways of contributing to making Nhost better:
<sub><b>Jacob Duval</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/kylehayes">
<img src="https://avatars.githubusercontent.com/u/509932?v=4" width="100;" alt="kylehayes"/>
<br />
<sub><b>Kyle Hayes</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/leothorp">
<img src="https://avatars.githubusercontent.com/u/12928449?v=4" width="100;" alt="leothorp"/>
@@ -448,6 +448,13 @@ Here are some ways of contributing to making Nhost better:
<sub><b>Quentin Decré</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/altschuler">
<img src="https://avatars.githubusercontent.com/u/956928?v=4" width="100;" alt="altschuler"/>
<br />
<sub><b>Simon Altschuler</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/atapas">
<img src="https://avatars.githubusercontent.com/u/3633137?v=4" width="100;" alt="atapas"/>

View File

@@ -12,11 +12,15 @@ Nhost Authentication lets you authenticate users using different sign-in methods
- [Email and Password](/platform/authentication/sign-in-with-email-and-password)
- [Magic Link](/platform/authentication/sign-in-with-magic-link)
- [Phone Number (SMS)](/platform/authentication/sign-in-with-phone-number-sms)
- [Google](/platform/authentication/sign-in-with-google)
- [Security Keys (WebAuthn)](/platform/authentication/sign-in-with-phone-number-sms)
- [Apple](/platform/authentication/sign-in-with-apple)
- [Discord](/platform/authentication/sign-in-with-discord)
- [Facebook](/platform/authentication/sign-in-with-facebook)
- [GitHub](/platform/authentication/sign-in-with-github)
- [Google](/platform/authentication/sign-in-with-google)
- [LinkedIn](/platform/authentication/sign-in-with-linkedin)
- [Spotify](/platform/authentication/sign-in-with-spotify)
- [Twitch](/platform/authentication/sign-in-with-twitch)
## How it works

View File

@@ -0,0 +1,107 @@
---
title: Sign In with Security Keys
sidebar_label: Security Keys
slug: /platform/authentication/sign-in-with-security-keys
---
Follow this guide to sign in users with security keys and the WebAuthn API.
Examples of security keys:
- [Windows Hello](https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0)
- [Apple Touch ID](https://support.apple.com/en-us/HT201371)
- [Apple Face ID](https://support.apple.com/en-us/HT208109)
- [Yubico security keys](https://www.yubico.com/)
- Android Fingerprint sensors
You can read more about this feature in our [blog post](https://nhost.io/blog/webauthn-sign-in-method)
## Setup
Enable the Security Key sign-in method in the Nhost dashboard under **Users** -> **Authentication Settings** -> **Security Keys**.
You need to make sure you also set a valid client URL under **Users** -> **Authentication Settings** -> **Client URL**.
<video width="99%" autoPlay muted loop controls="true" style={{ marginBottom: '15px' }}>
<source src="/videos/enable-security-keys-sign-in.mp4" type="video/mp4" />
</video>
## Sign Up
Signing up with a security key uses the same method as signing up with an email and a password. Instead of a `password` parameter, you need to set the `securityKey` parameter to `true`:
```tsx
const { error, session } = await nhost.auth.signUp({
email: 'joe@example.com',
securityKey: true
})
if (error) {
// Something unexpected happened, for instance, the user canceled their registration
console.log(error)
} else if (session) {
// Sign up is complete!
console.log(session.user)
} else {
console.log(
'You need to verify your email address by clicking the link in the email we sent you.'
)
}
```
## Sign In
Once a user added a security key, they can use it to sign in:
```tsx
const { error, session } = await nhost.auth.signIn({
email,
securityKey: true
})
if (session) {
// User is signed in
} else {
// Something unexpected happened
console.log(error)
}
```
## Add a Security Key
Any signed-in user with a valid email can add a security key when the feature is enabled. For instance, someone who signed up with an email and a password can add a security key and thus use it for their later sign-in!
Users can use multiple devices to sign in to their account. They can add as many security keys as they like.
```tsx
const { key, error } = await nhost.auth.addSecurityKey()
if (key) {
// Successfully added a new security key
console.log(key.id)
} else {
// Somethine unexpected happened
console.log(error)
}
```
A nickname can be added for each security key to make them easy to identify:
```tsx
await nhost.auth.addSecurityKey('my macbook')
```
## List or Remove Security Keys
To list and to remove security keys can be achieved over GraphQL after setting the correct Hasura permissions to the `auth.security_keys` table:
```graphql
query securityKeys($userId: uuid!) {
authUserSecurityKeys(where: { userId: { _eq: $userId } }) {
id
nickname
}
}
mutation removeSecurityKey($id: uuid!) {
deleteAuthUserSecurityKey(id: $id) {
id
}
}
```

View File

@@ -9,49 +9,12 @@ Nhost Authentication support the following sign-in methods:
- [Email and Password](/platform/authentication/sign-in-with-email-and-password)
- [Magic Link](/platform/authentication/sign-in-with-magic-link)
- [Phone Number (SMS)](/platform/authentication/sign-in-with-phone-number-sms)
- [Google](/platform/authentication/sign-in-with-google)
- [Security Keys (WebAuthn)](/platform/authentication/sign-in-with-phone-number-sms)
- [Apple](/platform/authentication/sign-in-with-apple)
- [Discord](/platform/authentication/sign-in-with-discord)
- [Facebook](/platform/authentication/sign-in-with-facebook)
- [GitHub](/platform/authentication/sign-in-with-github)
- [Google](/platform/authentication/sign-in-with-google)
- [LinkedIn](/platform/authentication/sign-in-with-linkedin)
- [Spotify](/platform/authentication/sign-in-with-spotify)
## Enabling Social Sign-In Provider
To start with social sign-in, select your project in Nhost Dashboard and go to **Users****Authentication Settings**.
You need to set the Client ID and Client Secret for each provider that you want to enable.
## Implementing sign-in experience
Use the [Nhost JavaScript SDK](/reference/javascript) and the `signIn()` method to implement social sign-in for your project.
Here's an example of how to implement sign-in with GitHub:
```js
nhost.auth.signIn({
provider: 'github'
})
```
Users are redirected to your Nhost project's **client URL** by default. By default, your Nhost project's client URL is set to `http://localhost:3000`. You can change the value of your client URL in the Nhost console by going to **Users****Authentication Settings****Client URL**.
Here is an example of how to redirect to another host or path:
```js
nhost.auth.signIn({
provider: '<provider>'
options: {
redirectTo: "<host>/<slug>" // Example: "https://example.com/dashboard"
},
})
```
## Provider OAuth scopes
Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.
By default, Nhost sets the scope to get the name, email, and avatar URL for each user. Editing scope is not currently supported.
## Provider OAuth Tokens
Nhost saves both access and refresh tokens for each user and provider in the `auth.user_providers` table. These tokens can be used to interact with the provider if needed.
- [Twitch](/platform/authentication/sign-in-with-twitch)

View File

@@ -0,0 +1,46 @@
---
title: Social Providers Configuration
sidebar_label: Social Providers Configuration
sidebar_position: 10
---
## Enabling Social Sign-In Provider
To start with social sign-in, select your project in Nhost Dashboard and go to **Users** → **Authentication Settings**.
You need to set the Client ID and Client Secret for each provider that you want to enable.
## Implementing sign-in experience
Use the [Nhost JavaScript SDK](/reference/javascript) and the `signIn()` method to implement social sign-in for your project.
Here's an example of how to implement sign-in with GitHub:
```js
nhost.auth.signIn({
provider: 'github'
})
```
Users are redirected to your Nhost project's **client URL** by default. By default, your Nhost project's client URL is set to `http://localhost:3000`. You can change the value of your client URL in the Nhost console by going to **Users** → **Authentication Settings** → **Client URL**.
Here is an example of how to redirect to another host or path:
```js
nhost.auth.signIn({
provider: '<provider>'
options: {
redirectTo: "<host>/<slug>" // Example: "https://example.com/dashboard"
},
})
```
## Provider OAuth scopes
Scopes are a mechanism in OAuth to allow or limit an application's access to a user's account.
By default, Nhost sets the scope to get the name, email, and avatar URL for each user. Editing scope is not currently supported.
## Provider OAuth Tokens
Nhost saves both access and refresh tokens for each user and provider in the `auth.user_providers` table. These tokens can be used to interact with the provider if needed.

View File

@@ -6,13 +6,17 @@ image: /img/og/platform/event-triggers.png
Event Triggers enable you to invoke webhooks when a database event happens. Event Triggers are typically used to do post-processing tasks, using custom backend code, based on database events.
Event Triggers are associated with a specific table in the database the following event types are available:
Event Triggers are associated with a specific table in the database and the following event types are available:
- **INSERT** - A row is inserted into a table
- **UPDATE** - A row is updated in a table
- **DELETE** - A row is deleted from a table
- **INSERT** - A row is inserted into a table.
- **UPDATE** - A row is updated in a table.
- **DELETE** - A row is deleted from a table.
Event Triggers can also be triggered manually in the Hasura Console.
:::info
It's currently only possible to create Event Triggers in the Hasura Console. We're working on adding support for creating Event Triggers in the Nhost Dashboard.
:::
### Example Use Case
@@ -30,7 +34,7 @@ Event Triggers are managed in the Hasura Console. Select **Events** in the main
## Event Triggers and Serverless Functions
Event Triggers and [Serverless Functions](/platform/serverless-functions) is a perfect combination to build powerful database-backend logic. Every Serverless Function is exposed as an HTTP endpoint that can be used as a webhook for your Event Triggers.
Event Triggers and [Serverless Functions](/platform/serverless-functions) is a perfect combination to build powerful database-backend logic. Every Serverless Function is exposed as an HTTP endpoint and can be used as a webhook for Event Triggers.
### Format
@@ -40,7 +44,7 @@ When using Serverless Functions as webhooks you should configure the webhook usi
{{NHOST_BACKEND_URL}}/v1/functions/orders-insert-send-email
```
![as](/img/database/event-triggers/webhook-url-format.png)
![Webhook URL Format](/img/database/event-triggers/webhook-url-format.png)
The `NHOST_BACKEND_URL` is a [system environment variable](/platform/environment-variables#system-environment-variables) and available in production and in development environments using the [CLI](/platform/cli).
@@ -54,7 +58,7 @@ To set this up is a two-step process:
- Step 1: Add the header `nhost-webhook-secret` with the value `NHOST_WEBHOOK_SECRET` (From env var) when creating the Event Trigger in the Hasura Console.
![as](/img/database/event-triggers/webhook-secret-header.png)
![Webhook Secret Header](/img/database/event-triggers/webhook-secret-header.png)
- Step 2: Check the header `nhost-webhook-secret` for incoming requests and make sure the header is the same as the environment variable `NHOST_WEBHOOK_SECRET`.

View File

@@ -9,52 +9,40 @@ import TabItem from '@theme/TabItem'
Every Nhost project comes with its own [Postgres database](https://postgres.org/). Postgres is the world's most advanced open-source relational database and it's the most [popular SQL database for developers](https://insights.stackoverflow.com/survey/2021#section-most-loved-dreaded-and-wanted-databases).
:::info
There are three ways of managing your database:
It's currently not possible to connect directly to the Postgres database via a connection string. We're working on making the database available soon. You can follow [this issue on GitHub](https://github.com/nhost/nhost/issues/113).
:::
The database is managed via the Hasura Console where you can manage the database via an intuitive UI. You can also use SQL to directly interact with the database via the Hasura Console.
## Hasura Console
Hasura Console is where you manage your database. This is where you create and manage tables, schemas, and data.
1. Open the Hasura Console by clicking on **GraphQL** in the top menu in the Nhost Dashboard.
2. Click **Open Hasura Console** at the top right of the page.
3. Copy the **admin secret**, and click **Open Hasura**.
4. Use the **admin secret** to sign in.
<video width="99%" autoPlay muted loop controls="true">
<source src="/videos/open-hasura-console.mp4" type="video/mp4" />
</video>
1. Nhost Database UI (recommended).
2. Hasura Console.
3. [Connect directly to the database.](#postgres-access)
## Schemas
The two schemas `auth` and `storage` are reserved for Nhost Auth and Nhost Storage to work. You're allowed to modify **permissions** and **add relationships**. However, never modify any tables or remove relationships that were added by Nhost inside the `auth` and `storage` schemas.
Generally, you should use the `public` schema for your project. It's also ok to add custom schemas for more advanced usage.
Generally, you should use the `public` schema when creating and managing your tables for your project. It's also ok to add custom schemas for more advanced usage.
The two schemas `auth` and `storage` are reserved for [Nhost Auth](/platform/authentication) and [Nhost Storage](/platform/storage). You're allowed to modify **permissions** and **add relationships**. However, never modify any tables or remove relationships that were added by Nhost inside the `auth` and `storage` schemas.
## Create Table
## Manage Tables
1. In Hasura Console, go to the **Data** tab, select the **public** schema in the left menu and click **Create Table**.
2. Enter a table name.
3. Add table columns.
4. Add a primary key (usually the ID column).
5. (Optional) Add foreign keys.
6. (Optional) Add unique keys.
7. Click **Add Table**.
### Create Table
When a table is created the table is instantly available through the [GraphQL API](/platform/graphql).
1. Go to **Database** in the left menu.
2. Click **New table**.
3. Enter a **name** for the table.
4. Add **columns**.
5. Select a **Primary Key** (usually the `id` column).
6. (Optional) Select an **Identity** column. Identity is for integer columns only and is usually selected for the `id` column so the `id` is automatically incremented (1,2,3...) on new rows.
7. (Optional) Add **Foreign Keys**.
8. Click **Create**.
When a table is created it is instantly available through the [GraphQL API](/platform/graphql).
Here's an example of how to create a `customers` table:
<Tabs groupId="hasura-console-vs-sql">
<TabItem value="hasura-cosnole" label="Hasura Console" default>
<Tabs groupId="nhost-vs-sql">
<TabItem value="nhost" label="Nhost" default>
<video width="99%" autoPlay muted loop controls="true">
<source src="/videos/hasura-create-table.mp4" type="video/mp4" />
<source src="/videos/nhost-table-create.mp4" type="video/mp4" />
</video>
</TabItem>
@@ -62,7 +50,7 @@ Here's an example of how to create a `customers` table:
```sql
CREATE TABLE "public"."customers" (
"id" serial NOT NULL PRIMARY KEY,
"id" bigint PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
"name" text NOT NULL
);
```
@@ -70,19 +58,20 @@ CREATE TABLE "public"."customers" (
</TabItem>
</Tabs>
## Modify Table
### Edit Table
1. In Hasura Console, go to the **Data** tab and click on the table you want to edit in the left menu.
2. Click **Modify**.
3. Modify or add table columns.
1. Go to the **Database** in the left menu
2. Click on the **context menu** of the table you want to change and click **Edit table**.
3. **Edit** (add, change, delete) the table's columns.
4. Click **Save**.
Here's an example of how to modify a `customers` table by adding an `address` column:
Here's an example of how to edit a `customers` table by adding an `address` column:
<Tabs groupId="hasura-console-vs-sql">
<TabItem value="hasura-cosnole" label="Hasura Console" default>
<Tabs groupId="nhost-vs-sql">
<TabItem value="nhost" label="Nhost" default>
<video width="99%" autoPlay muted loop controls="true">
<source src="/videos/hasura-modify-table.mp4" type="video/mp4" />
<source src="/videos/nhost-table-edit.mp4" type="video/mp4" />
</video>
</TabItem>
@@ -95,20 +84,19 @@ ALTER TABLE "public"."customers" ADD COLUMN "address" text;
</TabItem>
</Tabs>
## Delete Table
### Delete Table
1. In Hasura Console, go to the **Data** tab and select the table you want to delete in the left menu.
2. Click **Modify**.
3. Scroll to the bottom of the page and click **Delete table** to open the confirmation dialog.
4. Type the **name of the table** and click OK.
1. Go to the **Database** in the left menu
2. Click on the **context menu** of the table you want to delete and click **Delete table**.
3. Click **Delete** to confirm deleting the table.
Here's an example of how to delete a `customers` table:
**Example:** Delete a `customers` table:
<Tabs groupId="hasura-console-vs-sql">
<TabItem value="hasura-cosnole" label="Hasura Console" default>
<Tabs groupId="nhost-vs-sql">
<TabItem value="nhost" label="Nhost" default>
<video width="99%" autoPlay muted loop controls="true">
<source src="/videos/hasura-delete-table.mp4" type="video/mp4" />
<source src="/videos/nhost-table-delete.mp4" type="video/mp4" />
</video>
</TabItem>
@@ -121,6 +109,34 @@ DROP TABLE "public"."customers";
</TabItem>
</Tabs>
## Postgres Access
It's possible to access your Postgres database directly with your favorite Postgres client.
:::info
For projects older than September 2022, it's not possible to connect directly to the database via a connection string. We're working on a one-click fix that can be expected to be available in October 2022.
:::
Go to **Settings** in the left menu and click on **Database**. You'll find the connection string and credentials to connect to your database.
![Database Connection Info](/img/database/connection-info.png)
### Reset Postgres Password
It's possible to reset the database password that was provided when the project was created.
1. Go to the **Overview** page of your project.
2. Click on **Project Settings**.
3. Click on **Reset Database Password**.
4. Either **copy** the newly automatically generated password, or **type** your own new database password.
5. Click **Reset Database Password**.
<video width="99%" autoPlay muted loop controls="true">
<source src="/videos/nhost-database-reset-password.mp4" type="video/mp4" />
</video>
## Migrations
To track database changes, use the [Nhost CLI](/platform/cli) to develop locally and use our [GitHub integration](/platform/github-integration) to automatically deploy database migrations live.
@@ -148,12 +164,14 @@ nhost/seeds/default/002-products.sql
## Backups
Databases on [Pro and Enterprise plans](https://nhost.io/pricing) are backed up automatically.
Databases on the [Pro and Enterprise plans](https://nhost.io/pricing) are automatically backed up daily.
## Best Practices
- Use lower-case names for tables. E.g. `customers` instead of `Customers`.
- Use plural names for tables. E.g. `customers` instead of `customer`.
- use underscore (`_`) instead of camelCase for table names. E.g. `customer_invoices` instead of `customerInvoices`.
- use underscore (`_`) instead of camelCase for column names. E.g. `first_name` instead of `firstName`.
## Next Steps

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
docs/static/videos/nhost-table-edit.mp4 vendored Normal file

Binary file not shown.

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -1,7 +1,7 @@
import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Button, Modal, TextInput } from '@mantine/core'
import { Button, Divider, Modal, TextInput } from '@mantine/core'
import { showNotification } from '@mantine/notifications'
import { useSignInEmailPassword } from '@nhost/react'
@@ -78,7 +78,6 @@ export const EmailPassword: React.FC = () => {
value={email}
onChange={(e) => setEmail(e.target.value)}
placeholder="Email Address"
size="lg"
autoFocus
style={{ marginBottom: '0.5em' }}
/>
@@ -87,7 +86,6 @@ export const EmailPassword: React.FC = () => {
onChange={(e) => setPassword(e.target.value)}
placeholder="Password"
type="password"
size="lg"
style={{ marginBottom: '0.5em' }}
/>
<Button fullWidth onClick={signIn}>
@@ -96,6 +94,10 @@ export const EmailPassword: React.FC = () => {
<AuthLink link="/sign-in/forgot-password" variant="white">
Forgot password?
</AuthLink>
<Divider />
<AuthLink link="/sign-in" variant="white">
&#8592; Other Sign-in Options
</AuthLink>
</>
)
}

View File

@@ -8,8 +8,8 @@ export const EmailPasswordless: React.FC = () => {
<>
<PasswordlessForm />
<Divider />
<AuthLink link="/sign-up" variant="white">
&#8592; Other Login Options
<AuthLink link="/sign-in" variant="white">
&#8592; Other Sign-in Options
</AuthLink>
</>
)

View File

@@ -1,10 +1,12 @@
import { FormEvent, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Button, Modal, SimpleGrid, TextInput } from '@mantine/core'
import { Button, Divider, Modal, SimpleGrid, TextInput } from '@mantine/core'
import { showNotification } from '@mantine/notifications'
import { useSignInEmailSecurityKey } from '@nhost/react'
import AuthLink from '../components/AuthLink'
export const SecurityKeySignIn: React.FC = () => {
const { signInEmailSecurityKey } = useSignInEmailSecurityKey()
const [email, setEmail] = useState('')
@@ -56,6 +58,10 @@ export const SecurityKeySignIn: React.FC = () => {
Sign in with a security key
</Button>
</form>
<Divider />
<AuthLink link="/sign-in" variant="white">
&#8592; Other Sign-in Options
</AuthLink>
</SimpleGrid>
)
}

View File

@@ -87,7 +87,7 @@ export const EmailPassword: React.FC = () => {
</SimpleGrid>
<Divider />
<AuthLink link="/sign-up" variant="white">
&#8592; Other Registration Options
&#8592; Other Sign-up Options
</AuthLink>
</>
)

View File

@@ -9,7 +9,7 @@ export const EmailPasswordless: React.FC = () => {
<EmailPasswordlessForm />
<Divider />
<AuthLink link="/sign-up" variant="white">
&#8592; Other Registration Options
&#8592; Other Sign-up Options
</AuthLink>
</>
)

View File

@@ -1,10 +1,12 @@
import { FormEvent, useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Button, Modal, SimpleGrid, TextInput } from '@mantine/core'
import { Button, Divider, Modal, SimpleGrid, TextInput } from '@mantine/core'
import { showNotification } from '@mantine/notifications'
import { useSignUpEmailSecurityKeyEmail } from '@nhost/react'
import AuthLink from '../components/AuthLink'
export const SecurityKeySignUp: React.FC = () => {
const { signUpEmailSecurityKey } = useSignUpEmailSecurityKeyEmail()
const [email, setEmail] = useState('')
@@ -56,6 +58,10 @@ export const SecurityKeySignUp: React.FC = () => {
Sign up with a security key
</Button>
</form>
<Divider />
<AuthLink link="/sign-up" variant="white">
&#8592; Other Sign-up Options
</AuthLink>
</SimpleGrid>
)
}

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -1,4 +1,4 @@
# Docker image versions used in the cloud
hasura: v2.10.1
auth: 0.13.0
auth: 0.13.2
storage: 0.2.4

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -1,5 +1,15 @@
# @nhost/nextjs
## 1.7.7
### Patch Changes
- 1e31a956: read nextjs context cookies in `createServerSideClient`
- 8eafa198: Fix `createServerSideClient`
The refresh token was not fetched from the cookie when using `createServerSideClient` since [this PR](https://github.com/nhost/nhost/pull/823).
It is now fixed.
## 1.7.6
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nextjs",
"version": "1.7.6",
"version": "1.7.7",
"description": "Nhost NextJS library",
"license": "MIT",
"keywords": [

View File

@@ -31,7 +31,9 @@ export const createServerSideClient = async (
const urlKey = key === NHOST_REFRESH_TOKEN_KEY ? 'refreshToken' : key
const urlValue = context.query[urlKey]
const cookieValue = Cookies.get(key) ?? null
return typeof urlValue === 'string' ? urlValue : cookieValue
const nextCtxValue = context.req.cookies[key]
return typeof urlValue === 'string' ? urlValue : cookieValue ?? nextCtxValue
},
setItem: (key, value) => {
// TODO: Set expires based on the actual refresh token expire time

View File

@@ -1,7 +1,4 @@
{
"extends": "../../config/react-library.tsconfig.json",
"compilerOptions": {
"paths": {}
},
"include": ["src"]
}

View File

@@ -5,7 +5,7 @@ services:
environment:
hasura_graphql_enable_remote_schema_permissions: false
auth:
image: nhost/hasura-auth:0.13.0
image: nhost/hasura-auth:0.13.2
storage:
image: nhost/hasura-storage:0.2.4
auth:

View File

@@ -1,5 +1,11 @@
# @nhost/stripe-graphql-js
## 0.0.4
### Patch Changes
- c922de7b: feat/added async support for isAllowed prop for createStripeGraphQLServer
## 0.0.3
### Patch Changes

View File

@@ -2,8 +2,8 @@
<h2 align="center">Stripe GraphQL API</h2>
<p align="center">
<img alt="npm" src="https://img.shields.io/npm/v/@nhost/stripe-graphql">
<img alt="npm" src="https://img.shields.io/npm/dm/@nhost/stripe-graphql">
<img alt="npm" src="https://img.shields.io/npm/v/@nhost/stripe-graphql-js">
<img alt="npm" src="https://img.shields.io/npm/dm/@nhost/stripe-graphql-js">
<a href="LICENSE">
<img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="license: MIT" />
</a>
@@ -14,7 +14,7 @@ This package creates a Stripe GraphQL API.
```graphql
query {
stripe {
customer(id: "cus_MVBRpmnBis9v5x") {
customer(id: "cus_xxx" {
id
name
invoices {
@@ -79,6 +79,24 @@ export default server
> You can run the Stripe GraphQL API in any JS environment because it's built using [GraphQL Yoga](https://github.com/dotansimha/graphql-yoga).
### Stripe Secret Key
Add `STRIPE_SECRET_KEY` as an environment variable. If you're using Nhost, add `STRIPE_SECRET_KEY` to `.env.development` like this:
```
STRIPE_SECRET_KEY=sk_test_xxx
```
Learn more about [Stripe API keys](https://stripe.com/docs/keys#obtain-api-keys).
### Start Nhost
```
nhost up
```
Learn more about the [Nhost CLI](https://docs.nhost.io/platform/cli).
### Test
Test the Stripe GraphQL API in the browser:
@@ -92,7 +110,7 @@ Add the Stripe GraphQL API as a Remote Schema in Hasura.
**URL**
```
{{NHOST_BACKEND_URL}}/v1/functions/graphql/stripe`
{{NHOST_BACKEND_URL}}/v1/functions/graphql/stripe
```
**Headers**

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/stripe-graphql-js",
"version": "0.0.3",
"version": "0.0.4",
"description": "Stripe GraphQL API",
"license": "MIT",
"keywords": [

View File

@@ -17,7 +17,7 @@ builder.objectType('Stripe', {
resolve: async (_parent, { id }, context) => {
const { isAllowed } = context
if (!isAllowed(id, context)) {
if (!await isAllowed(id, context)) {
throw new GraphQLYogaError('Not allowed')
}
@@ -64,7 +64,12 @@ builder.objectType('Stripe', {
starting_after: startingAfter || undefined
})
const customerData = customers.data.filter((customer) => isAllowed(customer.id, context))
const customerData: Stripe.Customer[] = []
for (const customer of customers.data) {
if (await isAllowed(customer.id, context)) {
customerData.push(customer)
}
}
customers.data = customerData
@@ -95,7 +100,7 @@ builder.objectType('StripeMutations', {
resolve: async (_, { customer, configuration, locale, returnUrl }, context) => {
const { isAllowed } = context
if (!isAllowed(customer, context)) {
if (!await isAllowed(customer, context)) {
throw new GraphQLYogaError('Not allowed')
}

View File

@@ -3,7 +3,7 @@ import type Stripe from 'stripe'
import type { CORSOptions, YogaInitialContext } from '@graphql-yoga/node'
export type StripeGraphQLContext = {
isAllowed: (stripeCustomerId: string, context: Context) => boolean
isAllowed: (stripeCustomerId: string, context: Context) => boolean | Promise<boolean>
userClaims?: UserHasuraClaims
isAdmin: boolean
}
@@ -12,7 +12,7 @@ export type Context = YogaInitialContext & StripeGraphQLContext
export type CreateServerProps = {
cors?: CORSOptions
isAllowed?: (stripeCustomerId: string, context: Context) => boolean
isAllowed?: (stripeCustomerId: string, context: Context) => boolean | Promise<boolean>
graphiql?: boolean
}