Compare commits
352 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 | ||
|
|
2fec74e501 | ||
|
|
e94b28b3bc | ||
|
|
f591f76256 | ||
|
|
58fb955dc6 | ||
|
|
5826baa57e | ||
|
|
3c789629a4 | ||
|
|
f472d42ae9 | ||
|
|
9993bea7ab | ||
|
|
6f33fc6ce6 | ||
|
|
b6858c5638 | ||
|
|
9b01c3ba93 | ||
|
|
fcfd6a9c13 | ||
|
|
e4daefe637 | ||
|
|
59a5fe97b1 | ||
|
|
a0bcbb6269 | ||
|
|
1ec1004507 | ||
|
|
756d996096 | ||
|
|
c0f1d03c3c | ||
|
|
af55789d07 | ||
|
|
cb28676895 | ||
|
|
939a3d1090 | ||
|
|
0163d0588b | ||
|
|
c4124f22b0 | ||
|
|
7188b0971c | ||
|
|
6ac969320c | ||
|
|
414bc2e75b | ||
|
|
6862e1e24d | ||
|
|
4b9deaa2f7 | ||
|
|
cf366cef35 | ||
|
|
00d041f6b4 | ||
|
|
da06fef64e | ||
|
|
09be9582f8 | ||
|
|
6b26fed8ae | ||
|
|
5a62c66fc4 | ||
|
|
17e0e6d116 | ||
|
|
938000e61b | ||
|
|
d700107222 | ||
|
|
7f1b8a5881 | ||
|
|
7fd5f0fedf | ||
|
|
bf551fe705 | ||
|
|
69d9e40187 | ||
|
|
fc5b18fdf0 | ||
|
|
fa3eb980a0 | ||
|
|
efad3a2b08 | ||
|
|
563fa4fe9b | ||
|
|
6f0a30059a | ||
|
|
47cda5d716 | ||
|
|
3f625ce9e1 | ||
|
|
38d2609249 | ||
|
|
030243cd45 | ||
|
|
c1905243d0 | ||
|
|
37627cc50e | ||
|
|
009f68d500 | ||
|
|
b752cc2be8 | ||
|
|
72fc7d4e44 | ||
|
|
d20bfe3431 | ||
|
|
80ef14e50a | ||
|
|
543ea2a0e7 | ||
|
|
6764d476fd | ||
|
|
7bed0eadc9 | ||
|
|
c7644ace34 | ||
|
|
49cdb2843e | ||
|
|
6f45856c46 | ||
|
|
dcf5e28e06 | ||
|
|
5c10169972 | ||
|
|
abdbbe6fcc | ||
|
|
61e719eea0 | ||
|
|
208bdbba2d | ||
|
|
cd62e1e833 | ||
|
|
1dfb11d7e8 | ||
|
|
8b5c4ed443 | ||
|
|
b60cd0411b | ||
|
|
6bd5c96ed5 | ||
|
|
6b8762a62e | ||
|
|
ddeff7cbd6 | ||
|
|
ed952c1251 | ||
|
|
34e73f18bd | ||
|
|
84262a24f1 | ||
|
|
ec2a88d69c | ||
|
|
fe1049df6b | ||
|
|
a924d21815 | ||
|
|
503339e5a8 | ||
|
|
4405535d4a | ||
|
|
6d031e7484 | ||
|
|
e80c7b629a | ||
|
|
479a2ed08d | ||
|
|
7a469e1e1e | ||
|
|
af15771517 | ||
|
|
9b28e1329a | ||
|
|
c066ea5b75 | ||
|
|
80e42b939b | ||
|
|
3ea6f685e2 | ||
|
|
ac77f427c3 | ||
|
|
0f95ee5bb4 | ||
|
|
4b572c4f58 | ||
|
|
47406d3617 | ||
|
|
125bc9a749 | ||
|
|
df29c8f98d | ||
|
|
a08c3ec2d1 | ||
|
|
fef034aa6e | ||
|
|
7037af8ae6 | ||
|
|
477b48f184 | ||
|
|
33ac09fa40 | ||
|
|
92d66b9413 | ||
|
|
9eb9b590f9 | ||
|
|
7edca99d48 | ||
|
|
964cc6ded3 | ||
|
|
a69e0032bf | ||
|
|
86fbf934d6 | ||
|
|
0d6ecd8397 | ||
|
|
56b57b2878 | ||
|
|
e79ee93fde | ||
|
|
7cec42b392 | ||
|
|
f254c329f5 | ||
|
|
2a84a025d5 | ||
|
|
c2b0625c31 | ||
|
|
e80384c7ee | ||
|
|
8fa4813b4e | ||
|
|
d4c2e9eb78 | ||
|
|
557d1a69b3 | ||
|
|
4b811d939e | ||
|
|
f2a25b688d | ||
|
|
e9c82d8609 | ||
|
|
853527a770 | ||
|
|
9e6e05c1b2 | ||
|
|
85b5d89dbd | ||
|
|
d22885f6b7 | ||
|
|
5944b25e7e | ||
|
|
52fc5d3123 | ||
|
|
7e0608f5ca | ||
|
|
8876819687 | ||
|
|
635d82b18f | ||
|
|
6a1def9b86 | ||
|
|
2cc075f4ef | ||
|
|
bbe6750632 | ||
|
|
19149261aa | ||
|
|
8b2d1b00a1 | ||
|
|
3231e31c3e | ||
|
|
be1ef6fe79 | ||
|
|
5a963832e2 | ||
|
|
aa3f5c243c | ||
|
|
5dce0f0fdc | ||
|
|
3c0e9fbb84 | ||
|
|
6c202304b2 | ||
|
|
50dcf41e6c | ||
|
|
d6b4f83e16 | ||
|
|
ba86ae229d | ||
|
|
96f41ad0de | ||
|
|
aba0c8b2da | ||
|
|
a27eeeab8e | ||
|
|
61a746e674 | ||
|
|
7f37c87929 | ||
|
|
3322c4b795 | ||
|
|
1e70c7e7a5 | ||
|
|
9fbbdca60d | ||
|
|
f7a3136086 | ||
|
|
b5642586a4 | ||
|
|
cadc8f8864 | ||
|
|
1dc2bce05a | ||
|
|
65588268f6 | ||
|
|
a6b15bb387 | ||
|
|
7b8f64ab25 | ||
|
|
451b62d641 | ||
|
|
d843f1a3ed | ||
|
|
08a37aae7c | ||
|
|
464a10fa06 | ||
|
|
2cb1c36c76 | ||
|
|
b4670024ca | ||
|
|
feb616ecc0 | ||
|
|
679c32cb5a | ||
|
|
25bc2bee67 | ||
|
|
ce1ea16981 | ||
|
|
7048eaf0bb | ||
|
|
9c382a3773 | ||
|
|
7f07c75dc4 | ||
|
|
ebad09364e | ||
|
|
cbec4dbab6 | ||
|
|
a05d7585a3 | ||
|
|
89f823fdce | ||
|
|
6f4d465f54 | ||
|
|
aafbaa8d25 | ||
|
|
0f7b31497f | ||
|
|
bcf2751625 | ||
|
|
1965fc85d6 | ||
|
|
a8a7c32ec1 | ||
|
|
e8232cdfbb | ||
|
|
066489e3d4 | ||
|
|
de10d84cc1 | ||
|
|
7bc6d231b8 | ||
|
|
f7ddafdf05 | ||
|
|
f86b707d34 | ||
|
|
d281665424 | ||
|
|
24659b2979 | ||
|
|
ef8c8f9cd4 | ||
|
|
84e72f1d8d | ||
|
|
bc526e70ef | ||
|
|
35068d213f | ||
|
|
e732ea9aa5 | ||
|
|
e8d5338aca | ||
|
|
ac84f4d0e9 | ||
|
|
12e9a572db | ||
|
|
c1c7ceb319 | ||
|
|
23a9f9f547 | ||
|
|
3db941eb46 | ||
|
|
42a7aaf916 | ||
|
|
1b37b9f62a | ||
|
|
764ea72d60 | ||
|
|
3efbbca136 | ||
|
|
93d8eec950 | ||
|
|
d4ea2fce6d | ||
|
|
2443399cdc | ||
|
|
b8f4b75b0c | ||
|
|
5227c84820 | ||
|
|
5096456f78 | ||
|
|
507d09861c | ||
|
|
050cb288fc | ||
|
|
cd120c61fb | ||
|
|
5ddb5a751b | ||
|
|
92209b6690 | ||
|
|
bdb11c0fa4 | ||
|
|
63c3e7cb2c | ||
|
|
78341491cd | ||
|
|
cd8560e6d3 | ||
|
|
fced43f55d | ||
|
|
47cc5d1562 | ||
|
|
9ab4d49421 | ||
|
|
4bdd29c2ea | ||
|
|
a43fa284b4 | ||
|
|
e68ca9b0c8 | ||
|
|
ad26b8392f | ||
|
|
09ffcb961a | ||
|
|
42879a26da | ||
|
|
cdba9aa5a0 | ||
|
|
b092e13ba0 | ||
|
|
a2343c8ef2 | ||
|
|
2cbe8a5045 | ||
|
|
a38ddeed5e | ||
|
|
1fbf990c79 | ||
|
|
c5a9fc568b | ||
|
|
de81942fb2 | ||
|
|
5a60c5cb29 | ||
|
|
752812a321 | ||
|
|
0af2337499 | ||
|
|
b238bd7b6b | ||
|
|
f87403108f | ||
|
|
20f8fe9eb4 | ||
|
|
6f6044c49c | ||
|
|
4ffb14b240 | ||
|
|
f9854b15c4 | ||
|
|
cf206a4d1c | ||
|
|
eae285bfc9 | ||
|
|
51a115eaf7 | ||
|
|
da9c043fb5 | ||
|
|
0b79b4f492 | ||
|
|
832702ff45 | ||
|
|
e821af279a | ||
|
|
1d3469a455 | ||
|
|
05ced50d74 | ||
|
|
4c916a94f0 | ||
|
|
a69a6d63e3 | ||
|
|
5abb2dda3f | ||
|
|
5630c07a8a | ||
|
|
5c6239589c | ||
|
|
1791452fc2 | ||
|
|
9ff668d26c | ||
|
|
8f100e6e56 | ||
|
|
42dc93100c | ||
|
|
04aadb6fa4 | ||
|
|
e08a08973d | ||
|
|
3b11caf3bc | ||
|
|
049f67e54a | ||
|
|
6da1f90bc3 | ||
|
|
9772a3b577 | ||
|
|
59fd68dee3 | ||
|
|
5b69e6eccb | ||
|
|
1ca5d34c80 | ||
|
|
c161339423 | ||
|
|
ab469fba84 | ||
|
|
b122a306a4 | ||
|
|
d3a2eae789 | ||
|
|
3ac1694d1e | ||
|
|
032743c750 | ||
|
|
5029c0b934 | ||
|
|
7eb927b549 | ||
|
|
dbb29ac4d6 | ||
|
|
0348114d26 | ||
|
|
e66c1689a4 | ||
|
|
80c1de6a55 | ||
|
|
52de584034 | ||
|
|
edfb04cd07 | ||
|
|
bb30d683ee | ||
|
|
3b16cfd295 |
17
.github/actions/install-dependencies/action.yaml
vendored
Normal file
17
.github/actions/install-dependencies/action.yaml
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
name: Install Node and package dependencies
|
||||
description: 'Install Node dependencies with pnpm'
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: pnpm/action-setup@v2.2.1
|
||||
with:
|
||||
version: 6.32.14
|
||||
- name: Use Node.js 16
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16
|
||||
cache: 'pnpm'
|
||||
# * Install package dependencies. As cache is enabled, it will cache/restore downloaded files
|
||||
- shell: bash
|
||||
name: Install packages
|
||||
run: pnpm install --frozen-lockfile
|
||||
133
.github/workflows/tests.yaml
vendored
133
.github/workflows/tests.yaml
vendored
@@ -1,8 +1,4 @@
|
||||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
|
||||
# Poached from https://github.com/hayes/pothos/tree/main/.github/workflows, thanks to the original author
|
||||
|
||||
name: Node.js CI
|
||||
name: Tests
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -10,61 +6,112 @@ on:
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'templates/**'
|
||||
- 'examples/**'
|
||||
- 'assets/**'
|
||||
- '**.md'
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
types: [opened, synchronize]
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
- 'templates/**'
|
||||
- 'examples/**'
|
||||
- 'assets/**'
|
||||
- '**.md'
|
||||
- 'LICENSE'
|
||||
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: nhost
|
||||
jobs:
|
||||
build:
|
||||
name: Build @nhost packages
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14, 16]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install nhost CLI
|
||||
run: curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
|
||||
|
||||
- name: Start Nhost Backend
|
||||
# * Install Node and dependencies. Package downloads will be cached for the next jobs.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
# * Build all Nhost packages as they are all supposed to be tested.
|
||||
# * They will be reused through the Turborepo cache
|
||||
- name: Build packages
|
||||
run: pnpm build
|
||||
# * List packagesthat has an `e2e` script, except the root, and return an array of their name and path
|
||||
- name: List examples with an e2e script
|
||||
id: set-matrix
|
||||
run: |
|
||||
cp -R examples/testing-project /tmp/
|
||||
cd /tmp/testing-project
|
||||
nhost dev &
|
||||
|
||||
- uses: pnpm/action-setup@v2.2.1
|
||||
PACKAGES=$(pnpm recursive list --depth -1 --parseable --filter=!nhost-root \
|
||||
| xargs -I@ jq "if (.scripts.e2e | length) != 0 then {name: .name, path: \"@\"} else null end" @/package.json \
|
||||
| awk "!/null/" \
|
||||
| jq -c --slurp)
|
||||
echo "::set-output name=matrix::$PACKAGES"
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
e2e:
|
||||
name: 'e2e: ${{ matrix.package.name }}'
|
||||
needs: build
|
||||
strategy:
|
||||
# * Don't cancel other matrices when one fails
|
||||
fail-fast: false
|
||||
matrix:
|
||||
package: ${{ fromJson(needs.build.outputs.matrix) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# * Install Nhost CLI if a `nhost/config.yaml` file is found
|
||||
- name: Install Nhost CLI
|
||||
if: hashFiles(format('{0}/nhost/config.yaml', matrix.package.path)) != ''
|
||||
run: curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
|
||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
# * Run the `ci` script of the current package of the matrix. Dependencies build is cached by Turborepo
|
||||
- name: Run e2e test
|
||||
run: pnpm run e2e -- --filter="${{ matrix.package.name }}"
|
||||
- id: file-name
|
||||
if: ${{ failure() }}
|
||||
name: Tranform package name into a valid file name
|
||||
run: |
|
||||
PACKAGE_FILE_NAME=$(echo "${{ matrix.package.name }}" | sed 's/@//g; s/\//-/g')
|
||||
echo "::set-output name=fileName::$PACKAGE_FILE_NAME"
|
||||
# * Run this step only if the previous step failed, and some Cypress screenshots/videos exist
|
||||
- name: Upload Cypress videos and screenshots
|
||||
if: ${{ failure() && hashFiles(format('{0}/cypress/screenshots/**', matrix.package.path), format('{0}/cypress/videos/**', matrix.package.path)) != ''}}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
version: 6.32.3
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
name: cypress-${{ steps.file-name.outputs.fileName }}
|
||||
path: |
|
||||
${{format('{0}/cypress/screenshots/**', matrix.package.path)}}
|
||||
${{format('{0}/cypress/videos/**', matrix.package.path)}}
|
||||
unit:
|
||||
name: Unit tests
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
# * Run every `test` script in the workspace . Dependencies build is cached by Turborepo
|
||||
- name: Run unit tests
|
||||
run: pnpm run test
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: 'pnpm'
|
||||
|
||||
- name: Cache turbo
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ./node_modules/.cache/turbo
|
||||
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
|
||||
restore-keys: |
|
||||
turbo-${{ github.job }}-${{ github.ref_name }}-
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Wait for Nhost
|
||||
run: pnpm run wait
|
||||
|
||||
- name: Build, tests and lint
|
||||
run: pnpm run ci
|
||||
files: '**/coverage/coverage-final.json'
|
||||
name: codecov-umbrella
|
||||
- name: Create summary
|
||||
run: |
|
||||
echo '### Code coverage' >> $GITHUB_STEP_SUMMARY
|
||||
echo 'Visit [codecov](https://app.codecov.io/gh/nhost/nhost/) to see the code coverage reports' >> $GITHUB_STEP_SUMMARY
|
||||
lint:
|
||||
name: Lint
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
# * Install Node and dependencies. Package dependencies won't be downloaded again as they have been cached by the `build` job.
|
||||
- name: Install Node and dependencies
|
||||
uses: ./.github/actions/install-dependencies
|
||||
# * Run every `lint` script in the workspace . Dependencies build is cached by Turborepo
|
||||
- name: Lint
|
||||
run: pnpm run lint
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -53,4 +53,7 @@ todo.md
|
||||
|
||||
# TypeDoc output
|
||||
|
||||
.docgen
|
||||
.docgen
|
||||
|
||||
# Nhost CLI data
|
||||
.nhost
|
||||
|
||||
@@ -60,19 +60,24 @@ $ pnpm start
|
||||
|
||||
## Run test suites
|
||||
|
||||
In order to run tests, the Nhost testing backend should be running locally. You can run it from a separate terminal:
|
||||
### Unit tests
|
||||
|
||||
```sh
|
||||
$ cd examples/testing-project
|
||||
$ nhost -d
|
||||
```
|
||||
|
||||
Once Nhost is started locally, you can run the tests with the following command from the repository root:
|
||||
You can run the unit tests with the following command from the repository root:
|
||||
|
||||
```sh
|
||||
$ pnpm test
|
||||
```
|
||||
|
||||
### End-to-end tests
|
||||
|
||||
Each package that defines end-to-end tests embeds their own Nhost configuration, that will be automatically when running the tests. As a result, you must make sure you are not running the Nhost CLI before running the tests.
|
||||
|
||||
You can run the e2e tests with the following command from the repository root:
|
||||
|
||||
```sh
|
||||
$ pnpm e2e
|
||||
```
|
||||
|
||||
## Changesets
|
||||
|
||||
If you've made changes to the packages, you must describe those changes so that they can be reflected in the next release.
|
||||
|
||||
108
README.md
108
README.md
@@ -1,4 +1,4 @@
|
||||

|
||||

|
||||
|
||||
<div align="center">
|
||||
|
||||
@@ -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">
|
||||
@@ -192,6 +197,13 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Mrinal Wahal</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/timpratim">
|
||||
<img src="https://avatars.githubusercontent.com/u/32492961?v=4" width="100;" alt="timpratim"/>
|
||||
<br />
|
||||
<sub><b>Pratim</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/FuzzyReason">
|
||||
<img src="https://avatars.githubusercontent.com/u/62517920?v=4" width="100;" alt="FuzzyReason"/>
|
||||
@@ -199,6 +211,14 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Vadim Smirnov</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"/>
|
||||
<br />
|
||||
<sub><b>Macmac49</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/subhendukundu">
|
||||
<img src="https://avatars.githubusercontent.com/u/20059141?v=4" width="100;" alt="subhendukundu"/>
|
||||
@@ -212,8 +232,7 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Christian Gambardella</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/chrtze">
|
||||
<img src="https://avatars.githubusercontent.com/u/3797215?v=4" width="100;" alt="chrtze"/>
|
||||
@@ -241,6 +260,14 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Gavan Wilhite</b></sub>
|
||||
</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">
|
||||
@@ -255,13 +282,12 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Mustafa Hanif</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/timpratim">
|
||||
<img src="https://avatars.githubusercontent.com/u/32492961?v=4" width="100;" alt="timpratim"/>
|
||||
<a href="https://github.com/nbourdin">
|
||||
<img src="https://avatars.githubusercontent.com/u/5602476?v=4" width="100;" alt="nbourdin"/>
|
||||
<br />
|
||||
<sub><b>Pratim</b></sub>
|
||||
<sub><b>Nicolas Bourdin</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
@@ -271,6 +297,14 @@ Here are some ways of contributing to making Nhost better:
|
||||
<sub><b>Savin Vadim</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/muttenzer">
|
||||
<img src="https://avatars.githubusercontent.com/u/49474412?v=4" width="100;" alt="muttenzer"/>
|
||||
<br />
|
||||
<sub><b>Muttenzer</b></sub>
|
||||
</a>
|
||||
</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"/>
|
||||
@@ -298,8 +332,7 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Colin Broderick</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/dohomi">
|
||||
<img src="https://avatars.githubusercontent.com/u/489221?v=4" width="100;" alt="dohomi"/>
|
||||
@@ -313,7 +346,8 @@ 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"/>
|
||||
@@ -328,21 +362,20 @@ 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"/>
|
||||
<br />
|
||||
<sub><b>Jacob Duval</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</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"/>
|
||||
@@ -356,14 +389,8 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Max Reynolds</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/nbourdin">
|
||||
<img src="https://avatars.githubusercontent.com/u/5602476?v=4" width="100;" alt="nbourdin"/>
|
||||
<br />
|
||||
<sub><b>Nicolas Bourdin</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/ghoshnirmalya">
|
||||
<img src="https://avatars.githubusercontent.com/u/6391763?v=4" width="100;" alt="ghoshnirmalya"/>
|
||||
@@ -384,8 +411,7 @@ Here are some ways of contributing to making Nhost better:
|
||||
<br />
|
||||
<sub><b>Tapas Adhikary</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/komninoschat">
|
||||
<img src="https://avatars.githubusercontent.com/u/29049104?v=4" width="100;" alt="komninoschat"/>
|
||||
|
||||
@@ -20,7 +20,8 @@ module.exports = {
|
||||
'tests/**/*.ts',
|
||||
'tests/**/*.d.ts'
|
||||
],
|
||||
plugins: ['@typescript-eslint', 'simple-import-sort'],
|
||||
plugins: ['@typescript-eslint', 'simple-import-sort', 'cypress'],
|
||||
extends: ['plugin:cypress/recommended'],
|
||||
parserOptions: {
|
||||
ecmaVersion: 2020,
|
||||
sourceType: 'module'
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
const base = require('./.eslint.base')
|
||||
module.exports = {
|
||||
...base,
|
||||
extends: ['react-app', 'plugin:react/recommended', 'plugin:react-hooks/recommended'],
|
||||
extends: [
|
||||
...base.extends,
|
||||
'react-app',
|
||||
'plugin:react/recommended',
|
||||
'plugin:react-hooks/recommended',
|
||||
'plugin:react/jsx-runtime'
|
||||
],
|
||||
plugins: [...base.plugins, 'react', 'react-hooks']
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
const base = require('./.eslint.base')
|
||||
module.exports = {
|
||||
...base,
|
||||
extends: ['plugin:import/recommended', 'plugin:import/typescript'],
|
||||
extends: [...base.extends, 'plugin:import/recommended', 'plugin:import/typescript'],
|
||||
parser: 'vue-eslint-parser',
|
||||
parserOptions: {
|
||||
...base.parserOptions,
|
||||
parser: '@typescript-eslint/parser'
|
||||
},
|
||||
rules: {
|
||||
'vue/html-self-closing': 'off'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,9 +14,6 @@ const entry = fs.existsSync(tsEntry) ? tsEntry : tsEntry.replace('.ts', '.tsx')
|
||||
const deps = [...Object.keys(Object.assign({}, pkg.peerDependencies, pkg.dependencies))]
|
||||
|
||||
export default defineConfig({
|
||||
optimizeDeps: {
|
||||
include: ['react/jsx-runtime']
|
||||
},
|
||||
plugins: [
|
||||
tsconfigPaths(),
|
||||
dts({
|
||||
@@ -37,14 +34,18 @@ export default defineConfig({
|
||||
include: [`${PWD}/src/**/*.{spec,test}.{ts,tsx}`, `${PWD}/tests/**/*.{spec,test}.{ts,tsx}`],
|
||||
// Note: temporarily disabled threads, because of a bug in vitest
|
||||
// https://github.com/vitest-dev/vitest/issues/1171
|
||||
threads: false
|
||||
threads: false,
|
||||
coverage: {
|
||||
enabled: process.env.CI === 'true',
|
||||
reporter: ['json']
|
||||
}
|
||||
},
|
||||
build: {
|
||||
sourcemap: true,
|
||||
lib: {
|
||||
entry,
|
||||
name: pkg.name,
|
||||
fileName: (format) => (format === 'cjs' ? `index.cjs.js` : `index.mjs`),
|
||||
fileName: (format) => (format === 'cjs' ? `index.cjs.js` : `index.esm.js`),
|
||||
formats: ['cjs', 'es']
|
||||
},
|
||||
rollupOptions: {
|
||||
@@ -55,6 +56,7 @@ export default defineConfig({
|
||||
'@apollo/client': '@apollo/client',
|
||||
'@apollo/client/core': '@apollo/client/core',
|
||||
'@apollo/client/link/context': '@apollo/client/link/context',
|
||||
'@apollo/client/react': '@apollo/client/react',
|
||||
'@apollo/client/link/subscriptions': '@apollo/client/link/subscriptions',
|
||||
'@apollo/client/utilities': '@apollo/client/utilities',
|
||||
'graphql-ws': 'graphql-ws',
|
||||
|
||||
@@ -6,5 +6,8 @@ import baseLibConfig from './vite.lib.config'
|
||||
|
||||
export default defineConfig({
|
||||
...baseLibConfig,
|
||||
plugins: [react(), ...baseLibConfig.plugins]
|
||||
optimizeDeps: {
|
||||
include: ['react/jsx-runtime']
|
||||
},
|
||||
plugins: [react({ jsxRuntime: 'classic' }), ...baseLibConfig.plugins]
|
||||
})
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: 'Introduction to Nhost'
|
||||
sidebar_label: Introduction
|
||||
sidebar_position: 1
|
||||
image: /img/og/platform/introduction-to-nhost.png
|
||||
---
|
||||
|
||||
Nhost is the open source GraphQL backend (Firebase Alternative) and a development platform. Nhost is doing for the backend, what [Netlify](https://netlify.com/) and [Vercel](https://vercel.com/) are doing for the frontend.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Nhost Authentication
|
||||
sidebar_label: Authentication
|
||||
sidebar_position: 1
|
||||
image: /img/og/platform/authentication.png
|
||||
---
|
||||
|
||||
Nhost Authentication is a ready-to-use authentication service that is integrated with the [GraphQL API](/platform/graphql) and its permission system from Hasura.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Sign In with Email and Password
|
||||
sidebar_label: Email and Password
|
||||
slug: /platform/authentication/sign-in-with-email-and-password
|
||||
image: /img/og/platform/sign-in-with-email-and-password.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with email and password.
|
||||
@@ -21,7 +22,7 @@ await nhost.auth.signUp({
|
||||
})
|
||||
```
|
||||
|
||||
If you've turned on email verification in your app's **login settings**, a user will be sent a verification email upon signup. The user must click the verification link in the email before they can sign in.
|
||||
If you've turned on email verification in your app's **Authentication Settings**, a user will be sent a verification email upon signup. The user must click the verification link in the email before they can sign in.
|
||||
|
||||
## Sign In
|
||||
|
||||
@@ -38,6 +39,6 @@ await nhost.auth.signIn({
|
||||
|
||||
## Verified Emails
|
||||
|
||||
You can decide if only verified emails should be able to sign in or not. Modify the **Only allow login for verified emails.** setting in the **Login Settings** section under **Users** in your Nhost app.
|
||||
You can decide if only verified emails should be able to sign in or not. Modify the **Only allow login for verified emails.** setting in the **Authentication Settings** section under **Users** in your Nhost app.
|
||||
|
||||
An email-verification email is automatically sent to the user during sign-up if your app only allows to sign in users with verified emails. You can also manually send the verification email to the user using [`nhost.auth.sendVerificationEmail()`](/reference/javascript/auth/send-verification-email).
|
||||
|
||||
@@ -2,12 +2,21 @@
|
||||
title: Sign In with Magic Link
|
||||
sidebar_label: Magic Link
|
||||
slug: /platform/authentication/sign-in-with-magic-link
|
||||
image: /img/og/platform/sign-in-with-magic-link.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with Magic Link, also called passwordless email.
|
||||
|
||||
The Magic Link sign-in method enables you to sign in users to your app using an email address, without requiring a password.
|
||||
|
||||
## Setup
|
||||
|
||||
Enable the Magic Link sign-in method in the Nhost dashboard under **Users** -> **Authentication Settings** -> **Magic Link**.
|
||||
|
||||

|
||||
|
||||
## Sign In
|
||||
|
||||
To sign in users with Magic Link is a two-step process:
|
||||
|
||||
1. Send a Magic Link to the user's email address.
|
||||
@@ -20,3 +29,5 @@ nhost.auth.signIn({
|
||||
email: 'joe@example.com'
|
||||
})
|
||||
```
|
||||
|
||||
If you want to change the email for your magic link emails, you can do so by changing the [email templates](/platform/authentication/email-templates).
|
||||
|
||||
@@ -2,26 +2,56 @@
|
||||
title: Sign In with Phone Number (SMS)
|
||||
sidebar_label: Phone Number (SMS)
|
||||
slug: /platform/authentication/sign-in-with-phone-number-sms
|
||||
image: /img/og/platform/sign-in-with-phone-number-sms.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with a phone number (SMS).
|
||||
|
||||
## Setup
|
||||
|
||||
You need a [Twilio account](https://www.twilio.com/try-twilio) to use this feature because all SMS are sent through Twilio.
|
||||
|
||||
Enable the Phone Number (SMS) sign-in method in the Nhost dashboard under **Users** -> **Authentication Settings** -> **Passwordless SMS**.
|
||||
|
||||
You need to insert the following settings in the Nhost dashboard from Twilio:
|
||||
|
||||
- Account SID
|
||||
- Auth Token
|
||||
- Messaging Service SID (or a Twilio phone number)
|
||||
|
||||
<video width="99%" autoPlay muted loop controls="true" style={{ marginBottom: '15px' }}>
|
||||
<source src="/videos/enable-sms-sign-in.mp4" type="video/mp4" />
|
||||
</video>
|
||||
|
||||
## Sign In
|
||||
|
||||
To sign in users with a phone number is a two-step process:
|
||||
|
||||
1. Send a one-time password (OTP) to the user's phone number.
|
||||
2. The user uses the OTP to sign in
|
||||
2. The user uses the OTP to sign in.
|
||||
|
||||
```js
|
||||
// Step 1: Send OTP to the user's phone number
|
||||
await nhost.auth.signIn({
|
||||
phoneNumber: '0011233213123'
|
||||
phoneNumber: '+11233213123'
|
||||
})
|
||||
|
||||
// Step 2: Sign in user using their phone number and OTP
|
||||
await nhost.auth.signIn({
|
||||
phoneNumber: '0011233213123'
|
||||
phoneNumber: '+11233213123'
|
||||
// highlight-next-line
|
||||
otp: '123456',
|
||||
})
|
||||
```
|
||||
|
||||
The first time a user signs in using a phone number, the user is created. That means you don't need to sign up the user before signin in the user.
|
||||
|
||||
:::info
|
||||
|
||||
Phone numbers should start with `+` (not `00`) to follow the [E.164 formatting standard](https://en.wikipedia.org/wiki/E.164).
|
||||
|
||||
:::
|
||||
|
||||
## Other SMS Providers
|
||||
|
||||
We only support Twilio for now. If you want support for another SMS provider, please create an issue on [GitHub](https://github.com/nhost/nhost).
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Sign In with Google
|
||||
sidebar_label: Google
|
||||
slug: /platform/authentication/sign-in-with-google
|
||||
image: /img/og/platform/sign-in-with-google.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with Google with your Nhost App.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Sign In with Facebook
|
||||
sidebar_label: Facebook
|
||||
slug: /platform/authentication/sign-in-with-facebook
|
||||
image: /img/og/platform/sign-in-with-facebook.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with Facebook with your Nhost App.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Sign In with GitHub
|
||||
sidebar_label: GitHub
|
||||
slug: /platform/authentication/sign-in-with-github
|
||||
image: /img/og/platform/sign-in-with-github.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with GitHub with your Nhost App.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Sign In with LinkedIn
|
||||
sidebar_label: LinkedIn
|
||||
slug: /platform/authentication/sign-in-with-linkedin
|
||||
image: /img/og/platform/sign-in-with-linkedin.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with LinkedIn with your Nhost App.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Sign In with Spotify
|
||||
sidebar_label: Spotify
|
||||
slug: /platform/authentication/sign-in-with-spotify
|
||||
image: /img/og/platform/sign-in-with-spotify.png
|
||||
---
|
||||
|
||||
Follow this guide to sign in users with Spotify with your Nhost App.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Sign-In Methods'
|
||||
slug: /platform/authentication/sign-in-methods
|
||||
image: /img/og/platform/sign-in-methods.png
|
||||
---
|
||||
|
||||
Nhost Authentication support the following sign-in methods:
|
||||
@@ -16,7 +17,7 @@ Nhost Authentication support the following sign-in methods:
|
||||
|
||||
## Enabling Social Sign-In Provider
|
||||
|
||||
To start with social sign-in, select your app in Nhost Console and go to **Users** → **Login settings**.
|
||||
To start with social sign-in, select your app in Nhost Console and go to **Users** → **Authentication Settings**.
|
||||
|
||||
You need to set the Client ID and Client Secret for each provider that you want to enable.
|
||||
|
||||
@@ -32,7 +33,7 @@ nhost.auth.signIn({
|
||||
})
|
||||
```
|
||||
|
||||
Users are redirected to your Nhost app's **client URL** by default. By default, your Nhost app'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** → **Login settings** → **Client URL**.
|
||||
Users are redirected to your Nhost app's **client URL** by default. By default, your Nhost app'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**.
|
||||
|
||||
## Provider OAuth scopes
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Tokens
|
||||
sidebar_label: Tokens
|
||||
sidebar_position: 10
|
||||
image: /img/og/platform/tokens.png
|
||||
---
|
||||
|
||||
Nhost Authentication makes use of two types of tokens:
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
title: Users
|
||||
sidebar_label: Users
|
||||
sidebar_position: 1
|
||||
image: /img/og/platform/users.png
|
||||
---
|
||||
|
||||
Users are stored in the database in the `users` table in the `auth` schema.
|
||||
@@ -59,11 +60,35 @@ The default role is used when no role is specified in the GraphQL request. By de
|
||||
|
||||
### Allowed Roles
|
||||
|
||||
Allowed roles are roles the user is allowed to use when making a GraphQL request. Usually you would change the role from `user` (the default role) to some other role because you want Hasura to use a different role to resolve permissions for a particular GraphQL request.
|
||||
|
||||
By default, users have two allowed roles:
|
||||
|
||||
- `user`
|
||||
- `me`
|
||||
|
||||
You can manage what allowed roles users should get when they sign up under **Users** -> **Roles & Permissions**.
|
||||
|
||||
:::info
|
||||
|
||||
You must also add the roles manually to the `auth.roles` table.
|
||||
|
||||
:::
|
||||
|
||||
It's also possible to give users a subset of allowed roles during signup.
|
||||
|
||||
**Example:** Only give the `user` role (without the `me` role) for the user's allowed roles:
|
||||
|
||||
```js
|
||||
await nhost.auth.signUp({
|
||||
email: 'joe@example.com',
|
||||
password: 'secret-password'
|
||||
options: {
|
||||
allowedRoles: ['user']
|
||||
}
|
||||
})
|
||||
```
|
||||
|
||||
### Public Role
|
||||
|
||||
The `public` role is used to resolve GraphQL permissions for unauthenticated users.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'CLI'
|
||||
sidebar_position: 11
|
||||
image: /img/og/platform/cli.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
@@ -40,6 +41,12 @@ The following dependencies are required:
|
||||
- [Git](https://git-scm.com/downloads)
|
||||
- [Docker](https://www.docker.com/get-started) (must be running while using the CLI)
|
||||
|
||||
:::info
|
||||
|
||||
Make sure you have the correct permissions for Docker so you don't have to run Docker with `sudo`. See ["Post-installation steps for Linux"](https://docs.docker.com/engine/install/linux-postinstall/) from Docker's documentation.
|
||||
|
||||
:::
|
||||
|
||||
## Get started
|
||||
|
||||
Start by authenticating yourself to Nhost Cloud:
|
||||
@@ -74,6 +81,18 @@ nhost up
|
||||
|
||||
Hasura Console starts automatically and your Nhost app is running locally with the backend URL: `http://localhost:1337`.
|
||||
|
||||
## Emails
|
||||
|
||||
During local development with the CLI, all transactional emails from Authentication are sent to a local Mailhog instance, instead of to the recipient's email address. You'll see an address where after starting [`nhost up`](/reference/cli/up) where all emails are sent to.
|
||||
|
||||
For the example below, all emails are accessable at `http://localhost:8839`.
|
||||
|
||||
```bash
|
||||
$ nhost up
|
||||
✔ Your app is running at http://localhost:1337 (Ctrl+C to stop)
|
||||
ℹ Emails will be sent to http://localhost:8839
|
||||
```
|
||||
|
||||
## What's next?
|
||||
|
||||
- Read our in-depth guide on [Get started with Nhost CLI](/platform/overview/get-started-with-nhost-cli)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Event triggers'
|
||||
sidebar_position: 2
|
||||
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.
|
||||
@@ -17,7 +18,7 @@ Event Triggers can also be triggered manually in the Hasura Console.
|
||||
|
||||
Let's say you're building an e-commerce application and you want to send an email to the customer when a new order is placed. Orders are stored in the `orders` table in your database.
|
||||
|
||||
To send out an email every time a new order is placed, you create an event trigger that listens for the `INSERT` event on the `orders` table. Now every time an order is placed, the even trigger invokes a webhook with the order information, and the webhook sends out the email.
|
||||
To send out an email every time a new order is placed, you create an event trigger that listens for the `INSERT` event on the `orders` table. Now every time an order is placed, the event trigger invokes a webhook with the order information, and the webhook sends out the email.
|
||||
|
||||
## Create Event Trigger
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Database'
|
||||
sidebar_position: 1
|
||||
image: /img/og/platform/database.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
@@ -14,13 +15,16 @@ It's currently not possible to connect directly to the Postgres database via a c
|
||||
|
||||
:::
|
||||
|
||||
The database is managed via the Hasura Console where you can manage the database via an intuative UI. You can also use SQL to directly interact with the database via the Hasura Console.
|
||||
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.
|
||||
|
||||
Open the Hasura Console by clicking on **Data** in the top menu in the Nhost Dashboard, copy the **admin secret**, and click **Open Hasura**. Use the **admin secret** to sign in.
|
||||
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" />
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Environment Variables'
|
||||
sidebar_position: 9
|
||||
image: /img/og/platform/environment-variables.png
|
||||
---
|
||||
|
||||
Environment Variables are key-value pairs configured outside your source code. They are used to store environment-specific values such as API keys.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'GitHub Integration'
|
||||
sidebar_position: 10
|
||||
image: /img/og/platform/github-integration.png
|
||||
---
|
||||
|
||||
The GitHub integration allows you to automatically deploy your Nhost app when on push and merge to a GitHub repository that is connected to your Nhost app.
|
||||
@@ -14,7 +15,7 @@ The following things are deployed:
|
||||
- Serverless Functions
|
||||
|
||||
:::info
|
||||
Settings in `nhost/config.yaml` are **not** deployed. That menas you need to manually sync settings between local and remote environments between the CLI and Nhost Cloud.
|
||||
Settings in `nhost/config.yaml` are **not** deployed. That means you need to manually sync settings between local and remote environments between the CLI and Nhost Cloud.
|
||||
:::
|
||||
|
||||
## Connecting a GitHub repository
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'GraphQL'
|
||||
sidebar_position: 1
|
||||
image: /img/og/platform/graphql.png
|
||||
---
|
||||
|
||||
A GraphQL API is automatically and instantly available based on the tables and columns in your [database](/platform/database).
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Permissions'
|
||||
sidebar_position: 1
|
||||
image: /img/og/platform/permissions.png
|
||||
---
|
||||
|
||||
The GraphQL API is protected by a role-based permission system.
|
||||
@@ -53,6 +54,18 @@ query {
|
||||
}
|
||||
```
|
||||
|
||||
### Local Custom Permission Variables
|
||||
|
||||
To use custom permission variables locally, add your claims to the `config.yml` as following:
|
||||
|
||||
```
|
||||
auth:
|
||||
jwt:
|
||||
custom_claims: '{"organisation-id":"profile.organisation.id"}'
|
||||
```
|
||||
|
||||
Your custom claim will be automatically prefixed with `x-hasura-`, therefore, the example above results in a custom permission variable named `x-hasura-organisation-id`.
|
||||
|
||||
## Roles
|
||||
|
||||
Every GraphQL request is resolved based on a **single role**. Roles are added in the Hasura Console when selecting a table and clicking **Permisisons**.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Architecture'
|
||||
sidebar_position: 2
|
||||
image: /img/og/platform/architecture.png
|
||||
---
|
||||
|
||||
Nhost is a backend as a service built with open source tools to provide developers the general building blocks required to build fantastic digital apps and products.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Get Started with Nhost CLI'
|
||||
sidebar_position: 2
|
||||
image: /img/og/platform/get-started-with-nhost-cli.png
|
||||
---
|
||||
|
||||
# Get started with Nhost CLI
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Quickstart: Next.js'
|
||||
sidebar_position: 2
|
||||
image: /img/og/platform/quickstart-nextjs.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
@@ -672,7 +673,8 @@ export function UserProvider({ children = null }) {
|
||||
const id = useUserId()
|
||||
// highlight-start
|
||||
const { loading, error, data } = useQuery(GET_USER_QUERY, {
|
||||
variables: { id }
|
||||
variables: { id },
|
||||
skip: !id
|
||||
})
|
||||
const user = data?.user
|
||||
// highlight-end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Quickstart: React'
|
||||
sidebar_position: 1
|
||||
image: /img/og/platform/quickstart-react.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
@@ -35,6 +36,7 @@ You'll need **Node.js** version 14 or later: [install it from here](https://node
|
||||
import CreateApp from '@site/src/components/create-nhost-app.mdx'
|
||||
|
||||
<CreateApp />
|
||||
|
||||
:::info
|
||||
You can also connect your Nhost app to a GitHub repository. When you do this, any updates you push to your code will automatically be deployed. [Learn more](https://docs.nhost.io/platform/github-integration).
|
||||
:::
|
||||
@@ -636,7 +638,8 @@ const Layout = () => {
|
||||
const id = useUserId()
|
||||
// highlight-start
|
||||
const { loading, error, data } = useQuery(GET_USER_QUERY, {
|
||||
variables: { id }
|
||||
variables: { id },
|
||||
skip: !id
|
||||
})
|
||||
const user = data?.user
|
||||
// highlight-end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Quickstart: RedwoodJS'
|
||||
sidebar_position: 3
|
||||
image: /img/og/platform/quickstart-redwoodjs.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
@@ -1089,7 +1090,8 @@ export function UserProvider({ children = null }) {
|
||||
const { userMetadata } = useAuth()
|
||||
|
||||
const { loading, error, data } = useQuery(GET_USER_QUERY, {
|
||||
variables: { id: userMetadata?.id }
|
||||
variables: { id: userMetadata?.id },
|
||||
skip: !userMetadata?.id
|
||||
})
|
||||
const user = data?.user
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Quickstart: Vue'
|
||||
sidebar_position: 3
|
||||
image: /img/og/platform/quickstart-vue.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: 'Serverless Functions'
|
||||
sidebar_position: 8
|
||||
image: /img/og/platform/serverless-functions.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
---
|
||||
title: 'Storage'
|
||||
sidebar_position: 7
|
||||
---
|
||||
|
||||
Nhost stores and serves files of any type in your backend.
|
||||
|
||||
The metadata for files hosted on Nhost is available in the `storage.files` table of your database, and thus is also accessible in the GraphQL API. This allows you to fetch a list of files to display in your frontend, for example.
|
||||
|
||||
---
|
||||
|
||||
## Buckets
|
||||
|
||||
Buckets are used to organize files and group permissions for files. Buckets are stored in the `storage.buckets` table in your database, and accessible via `buckets` in your GraphQL API.
|
||||
|
||||
Buckets are a way to segment permissions for file type, minimum and maximum file size, cache control, download expiration, and if pre-signed URLs are allowed.
|
||||
|
||||
---
|
||||
|
||||
## Permissions
|
||||
|
||||
Upload, read and delete permissions for files are managed through Hasura's permission system, just like other permissions.
|
||||
|
||||
### Upload
|
||||
|
||||
To upload a file, a user must have the `insert` permission to the `storage.files` table. The following columns must be checked:
|
||||
|
||||
- `id`
|
||||
- `bucket_id`
|
||||
- `name`
|
||||
- `mime_type`
|
||||
|
||||
### Select
|
||||
|
||||
To read and download a file, a user must have the `select` permission to the `storage.files` table. Only the `id` column is required, but as a best practice you should allow reading all columns.
|
||||
|
||||
### Delete
|
||||
|
||||
To delete a file, a user must have the `delete` permission to the `storage.files` table.
|
||||
|
||||
> Updating an existing file is not supported. Delete and upload a new file instead.
|
||||
|
||||
---
|
||||
|
||||
## Accessing files
|
||||
|
||||
To access a file, make an HTTP GET request to `/v1/storage/files/{id}` with the `Authorization` header set with the access token returned by Nhost Auth. Alternatively, you can create a pre-signed URL by making an HTTP GET request to `/v1/storage/files/{id}/presignedurl` with the `Authorization` header set with the access token returned by Nhost Auth.
|
||||
|
||||
If the file is publicly accessible, there is no need to set the `Authorization` header. The file is publicly accessible if the permission for the `public` role is set to allow reading the file metadata in Hasura for the `storage.files` table.
|
||||
|
||||
### Pre-signed URL
|
||||
|
||||
A pre-signed URL is a unique URL that is used to access the file. Anyone with the pre-signed URL can access the file without exceptions. The URL is generated by Nhost Storage API and is valid for a limited time. The time limit of the pre-signed URL is determined by the `download_expiration` column in the bucket where the file is.
|
||||
|
||||
Using pre-signed URL is a good way to share files to people who don't have access to the file directly, or to access the file without setting the `Authorization` headers, for example when displaying the file in an `img` tag.
|
||||
|
||||
## Example with GraphQL
|
||||
|
||||
Let's say we're building a CRM and we want to store files for each customer.
|
||||
|
||||
In our CRM, we have the following two tables:
|
||||
|
||||
- `customers`
|
||||
- `id`
|
||||
- `name`
|
||||
- `address`
|
||||
- `customer_files`
|
||||
- `id`
|
||||
- `customer_id` (foreign key to `customers.id`)
|
||||
- `file_id` (foreign key to `storage.files.id`)
|
||||
|
||||
We also have created relationships between `customers` and `customer_files` and between `customer_files` and `storage.files`.
|
||||
|
||||
We can now query the data with the following query:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
customer {
|
||||
# customer table
|
||||
id
|
||||
name
|
||||
customer_files {
|
||||
# customer_files table
|
||||
id
|
||||
file {
|
||||
# storage.files table
|
||||
id
|
||||
name
|
||||
size
|
||||
mime_type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
To upload a file, this is what we do;
|
||||
|
||||
1. Upload a file
|
||||
2. Get the `id` of the file. The server returns this.
|
||||
3. Insert the `id` of the file together with the customer's id into the `customer_files` table.
|
||||
244
docs/docs/platform/storage.mdx
Normal file
244
docs/docs/platform/storage.mdx
Normal file
@@ -0,0 +1,244 @@
|
||||
---
|
||||
title: 'Storage'
|
||||
sidebar_position: 7
|
||||
image: /img/og/platform/storage.png
|
||||
---
|
||||
|
||||
import Tabs from '@theme/Tabs'
|
||||
import TabItem from '@theme/TabItem'
|
||||
|
||||
Nhost Storage enables you to let your users upload and download files. Nhost Storage is integrated with the [GraphQL API](/platform/graphql) and its permission system from Hasura.
|
||||
|
||||
## Files
|
||||
|
||||
Files can be of any type, such as images, documents, videos, etc.
|
||||
|
||||
File metadata is stored in your database in the `files` table in the `storage` schema. This means that file metadata is available in your GraphQL API, which makes it easy to:
|
||||
|
||||
- Read file metadata via GraphQL.
|
||||
- Manage file permissions (in Hasura).
|
||||
- Create GraphQL relationships between files and your database tables.
|
||||
|
||||
:::warning
|
||||
Don't modify the database schema, nor GraphQL root fields in any of the tables in the `storage` schema.
|
||||
:::
|
||||
|
||||
:::tip
|
||||
You're allowed to add and modify the following:
|
||||
|
||||
- GraphQL Relationships
|
||||
- Permissions
|
||||
:::
|
||||
|
||||
|
||||
### Upload File
|
||||
|
||||
When a file is uploaded, the file metadata is inserted into the `storage.files` table and a file `id` is returned. The file's `id` is how you reference and access the file. It's recommended to create your own table to store the uploaded file `id`, to access the file in the future.
|
||||
|
||||
<Tabs groupId="http-sdk">
|
||||
<TabItem value="js" label="JavaScript">
|
||||
|
||||
```js
|
||||
await nhost.storage.upload({ file })
|
||||
```
|
||||
|
||||
Learn more about [`upload()`](/reference/javascript/storage/upload).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="http" label="HTTP" default>
|
||||
|
||||
```http
|
||||
POST /v1/storage/files HTTP/1.1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Download File
|
||||
|
||||
There are two ways to download a file:
|
||||
|
||||
- Public URL.
|
||||
- Pre-signed URL.
|
||||
|
||||
#### Public URL
|
||||
|
||||
Public URLs are available for both unauthenticated and authenticated users. Permissions are checked for every file request. To get a public URL for a file, you would normally use the `public` role to set **select** permissions.
|
||||
|
||||
<Tabs groupId="http-sdk">
|
||||
<TabItem value="js" label="JavaScript">
|
||||
|
||||
```js
|
||||
await nhost.storage.getPublicUrl({
|
||||
fileId: '<File-ID>'
|
||||
})
|
||||
```
|
||||
|
||||
Learn more about [`getPublicUrl()`](/reference/javascript/storage/get-public-url).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="http" label="HTTP" default>
|
||||
|
||||
```http
|
||||
GET /v1/storage/files/{file_id} HTTP/1.1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
#### Pre-signed URL
|
||||
|
||||
Pre-signed URLs work a bit differently from public URLs.
|
||||
|
||||
The permission check only happens when the user requests a pre-signed URL. Once a pre-signed URL is generated, anyone with the pre-signed URL can download the file.
|
||||
|
||||
Pre-signed URLs expire, and stop work, after a set amount of time. By default, for files in the `default` bucket, the expiration time is 30 seconds. You can change the expiration time for pre-signed URLs by changing the `download_expiration` (in seconds) field on the bucket where the file is located.
|
||||
|
||||
<Tabs groupId="http-sdk">
|
||||
<TabItem value="js" label="JavaScript">
|
||||
|
||||
```js
|
||||
await nhost.storage.getPresignedUrl({
|
||||
fileId: '<File-ID>'
|
||||
})
|
||||
```
|
||||
|
||||
Learn more about [`getPresignedUrl()`](/reference/javascript/storage/get-presigned-url).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="http" label="HTTP" default>
|
||||
|
||||
```http
|
||||
GET /v1/storage/files/{file_id}/presignedurl HTTP/1.1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
### Delete File
|
||||
|
||||
Delete a file and the file metadata in the database.
|
||||
|
||||
<Tabs groupId="http-sdk">
|
||||
<TabItem value="js" label="JavaScript">
|
||||
|
||||
```js
|
||||
const { error } = await nhost.storage.delete({ fileId: 'uuid' })
|
||||
```
|
||||
|
||||
Learn more about [`delete()`](/reference/javascript/storage/delete).
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="http" label="HTTP" default>
|
||||
|
||||
```http
|
||||
DELETE /v1/storage/files/{file_id} HTTP/1.1
|
||||
```
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
||||
## Buckets
|
||||
|
||||
Buckets are used to organize files and group permissions for files. Buckets are stored in the `storage.buckets` table in your database, and accessible via `buckets` in your GraphQL API.
|
||||
|
||||
For each bucket, you can specify file permissions for the following properties:
|
||||
|
||||
- MIME type.
|
||||
- Minimum size.
|
||||
- Maximum size.
|
||||
- Cache control.
|
||||
- Allow pre-signed URLs.
|
||||
- Download expiration (for pre-signed URLs).
|
||||
|
||||
There is a default bucket (`default`) that is used if no bucket is specified during file upload. It's not possible to delete the `default` bucket.
|
||||
|
||||
## Permissions
|
||||
|
||||
Permissions to upload, download, and delete files are managed through Hasura's permission system on the `storage.files` table.
|
||||
|
||||
### Upload
|
||||
|
||||
To upload a file, a user must have the **`insert` permission** to the `storage.files` table. The following columns must be allowed to insert:
|
||||
|
||||
- `id`
|
||||
- `bucket_id`
|
||||
- `name`
|
||||
- `mime_type`
|
||||
|
||||
### Download
|
||||
|
||||
To download a file, a user must have the **`select` permission** to the `storage.files` table. Only the `id` column is required, but we recommend allowing to select all columns.
|
||||
|
||||
### Delete
|
||||
|
||||
To delete a file, a user must have the **`delete` permission** to the `storage.files` table.
|
||||
|
||||
Updating an existing file is not supported. If you need to update a file, delete the file and upload a new file.
|
||||
|
||||
Just deleting the file metadata in the `storage.files` table does **not** delete the actual file. Always delete files via Nhost Storage. This way, both the file metadata and the actual file are deleted.
|
||||
|
||||
## Image Transformation
|
||||
|
||||
Images can be transformed, on the fly, by adding query parameters. The following query parameters are available:
|
||||
|
||||
- `w` - Width of the image in pixels.
|
||||
- `h` - Height of the image in pixels.
|
||||
|
||||
Image Transformation works on both public and pre-signed URLs.
|
||||
|
||||
**Example**: Transform an image to 500px width (`?w=500`):
|
||||
|
||||
```text
|
||||
https://[subdomain].nhost.run/v1/storage/files/08e6fa32-0880-4d0e-a832-278198acb363?w=500
|
||||
```
|
||||
|
||||
## Example: CRM System
|
||||
|
||||
Let's say you want to build a CRM system and you want to store files for customers. This is one way how you could do that.
|
||||
|
||||
Start with, you would have two tables:
|
||||
|
||||
1. `customers` - Customer data.
|
||||
2. `customer_files` - What file belongs to what customer.
|
||||
|
||||
```text
|
||||
- customers
|
||||
- id
|
||||
- name
|
||||
- address
|
||||
customer_files
|
||||
- id
|
||||
- customer_id (Foreign Key to `customers.id`)
|
||||
- file_id (Foreign Key to `storage.files.id`)
|
||||
```
|
||||
|
||||
You would also create [Hasura Relationships](https://hasura.io/docs/latest/graphql/core/databases/postgres/schema/table-relationships/index/) (GraphQL relationships) between between `customers` and `customer_files` and between `customer_files` and `storage.files`.
|
||||
|
||||
With the two tables and GraphQL relationships in place, you can query customers and the customer's files like this:
|
||||
|
||||
```graphql
|
||||
query {
|
||||
customers { # customers table
|
||||
id
|
||||
name
|
||||
customer_files { # customer_files tabel
|
||||
id
|
||||
file { # storage.files table
|
||||
id
|
||||
name
|
||||
size
|
||||
mimeType
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The file upload process would be as follows:
|
||||
|
||||
1. Upload a file.
|
||||
2. Get the returned file id.
|
||||
3. Insert the file `id` and the customer's `id` into the `customer_files` table.
|
||||
|
||||
This would allow you to upload and download files belonging to specific customers in your CRM system.
|
||||
@@ -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#L101
|
||||
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#L144
|
||||
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#L256
|
||||
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#L272
|
||||
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#L288
|
||||
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#L304
|
||||
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#L323
|
||||
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#L339
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L314
|
||||
---
|
||||
|
||||
# `deanonymize()`
|
||||
@@ -24,13 +24,4 @@ nhost.auth.deanonymize({
|
||||
|
||||
**<span className="parameter-name">params</span>** <span className="optional-status">required</span> [`DeanonymizeParams`](/reference/docgen/javascript/auth/types/deanonymize-params)
|
||||
|
||||
| Property | Type | Required | Notes |
|
||||
| :---------------------------------------------------------------------------------------------- | :------------------------------------- | :------: | :---- |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>email</span> | `string` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>signInMethod</span> | `"email-password"` \| `"passwordless"` | ✔️ | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>allowedRoles</span> | `Array<string>` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>defaultRole</span> | `string` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>connection</span> | `"email"` \| `"sms"` | | |
|
||||
| <span className="parameter-name"><span className="light-grey">params.</span>password</span> | `string` | | |
|
||||
|
||||
---
|
||||
|
||||
@@ -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#L373
|
||||
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#L408
|
||||
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#L450
|
||||
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#L468
|
||||
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#L494
|
||||
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#L524
|
||||
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#L539
|
||||
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#L556
|
||||
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#L574
|
||||
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#L597
|
||||
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#L641
|
||||
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#L656
|
||||
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: HasuraAuthClient
|
||||
sidebar_label: Auth
|
||||
description: No description provided.
|
||||
slug: /reference/javascript/auth
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L59
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/hasura-auth-client.ts#L60
|
||||
---
|
||||
|
||||
# `HasuraAuthClient`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiChangeEmailResponse
|
||||
sidebar_label: ApiChangeEmailResponse
|
||||
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#L178
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L181
|
||||
---
|
||||
|
||||
# `ApiChangeEmailResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiChangePasswordResponse
|
||||
sidebar_label: ApiChangePasswordResponse
|
||||
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#L170
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L173
|
||||
---
|
||||
|
||||
# `ApiChangePasswordResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiDeanonymizeResponse
|
||||
sidebar_label: ApiDeanonymizeResponse
|
||||
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#L182
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L185
|
||||
---
|
||||
|
||||
# `ApiDeanonymizeResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiRefreshTokenResponse
|
||||
sidebar_label: ApiRefreshTokenResponse
|
||||
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#L158
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L161
|
||||
---
|
||||
|
||||
# `ApiRefreshTokenResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiResetPasswordResponse
|
||||
sidebar_label: ApiResetPasswordResponse
|
||||
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#L166
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L169
|
||||
---
|
||||
|
||||
# `ApiResetPasswordResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiSendVerificationEmailResponse
|
||||
sidebar_label: ApiSendVerificationEmailResponse
|
||||
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#L174
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L177
|
||||
---
|
||||
|
||||
# `ApiSendVerificationEmailResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiSignInData
|
||||
sidebar_label: ApiSignInData
|
||||
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#L147
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L150
|
||||
---
|
||||
|
||||
# `ApiSignInData`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiSignInResponse
|
||||
sidebar_label: ApiSignInResponse
|
||||
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#L151
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L154
|
||||
---
|
||||
|
||||
# `ApiSignInResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiSignOutResponse
|
||||
sidebar_label: ApiSignOutResponse
|
||||
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#L162
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L165
|
||||
---
|
||||
|
||||
# `ApiSignOutResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ApiSignUpEmailPasswordResponse
|
||||
sidebar_label: ApiSignUpEmailPasswordResponse
|
||||
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#L143
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L146
|
||||
---
|
||||
|
||||
# `ApiSignUpEmailPasswordResponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: AuthChangeEvent
|
||||
sidebar_label: AuthChangeEvent
|
||||
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#L125
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L134
|
||||
---
|
||||
|
||||
# `AuthChangeEvent`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: AuthChangedFunction
|
||||
sidebar_label: AuthChangedFunction
|
||||
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#L127
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L136
|
||||
---
|
||||
|
||||
# `AuthChangedFunction`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ChangeEmailParams
|
||||
sidebar_label: ChangeEmailParams
|
||||
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#L99
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L105
|
||||
---
|
||||
|
||||
# `ChangeEmailParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ChangePasswordParams
|
||||
sidebar_label: ChangePasswordParams
|
||||
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#L90
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L96
|
||||
---
|
||||
|
||||
# `ChangePasswordParams`
|
||||
|
||||
@@ -4,35 +4,20 @@ title: DeanonymizeParams
|
||||
sidebar_label: DeanonymizeParams
|
||||
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#L105
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L110
|
||||
---
|
||||
|
||||
# `DeanonymizeParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">email</span>** <span className="optional-status">required</span> `string`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">signInMethod</span>** <span className="optional-status">required</span> `"email-password"` | `"passwordless"`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">allowedRoles</span>** <span className="optional-status">optional</span> `Array<string>`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">defaultRole</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">connection</span>** <span className="optional-status">optional</span> `"email"` | `"sms"`
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">password</span>** <span className="optional-status">optional</span> `string`
|
||||
|
||||
---
|
||||
```ts
|
||||
type DeanonymizeParams =
|
||||
| ({ signInMethod: 'email-password' } & SignUpParams)
|
||||
| ({
|
||||
signInMethod: 'passwordless'
|
||||
connection: 'email'
|
||||
} & SignInPasswordlessEmailParams)
|
||||
| ({
|
||||
signInMethod: 'passwordless'
|
||||
connection: 'sms'
|
||||
} & SignInPasswordlessSmsParams)
|
||||
```
|
||||
|
||||
@@ -4,7 +4,7 @@ title: Headers
|
||||
sidebar_label: Headers
|
||||
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#L136
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L139
|
||||
---
|
||||
|
||||
# `Headers`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: Mfa
|
||||
sidebar_label: Mfa
|
||||
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#L139
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L142
|
||||
---
|
||||
|
||||
# `Mfa`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: OnTokenChangedFunction
|
||||
sidebar_label: OnTokenChangedFunction
|
||||
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#L129
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L138
|
||||
---
|
||||
|
||||
# `OnTokenChangedFunction`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: ResetPasswordParams
|
||||
sidebar_label: ResetPasswordParams
|
||||
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#L85
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L91
|
||||
---
|
||||
|
||||
# `ResetPasswordParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: SendVerificationEmailParams
|
||||
sidebar_label: SendVerificationEmailParams
|
||||
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#L94
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L100
|
||||
---
|
||||
|
||||
# `SendVerificationEmailParams`
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
---
|
||||
# ⚠️ AUTO-GENERATED CONTENT. DO NOT EDIT THIS FILE DIRECTLY! ⚠️
|
||||
title: LoginData
|
||||
sidebar_label: LoginData
|
||||
title: SignInEmailPasswordOtpParams
|
||||
sidebar_label: SignInEmailPasswordOtpParams
|
||||
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#L131
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L59
|
||||
---
|
||||
|
||||
# `LoginData`
|
||||
# `SignInEmailPasswordOtpParams`
|
||||
|
||||
## Parameters
|
||||
|
||||
---
|
||||
|
||||
**<span className="parameter-name">mfa</span>** <span className="optional-status">optional</span> `boolean`
|
||||
**<span className="parameter-name">otp</span>** <span className="optional-status">required</span> `string`
|
||||
|
||||
---
|
||||
|
||||
@@ -4,7 +4,7 @@ title: SignInParams
|
||||
sidebar_label: SignInParams
|
||||
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#L78
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L83
|
||||
---
|
||||
|
||||
# `SignInParams`
|
||||
@@ -12,6 +12,7 @@ custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-j
|
||||
```ts
|
||||
type SignInParams =
|
||||
| SignInEmailPasswordParams
|
||||
| SignInEmailPasswordOtpParams
|
||||
| SignInPasswordlessEmailParams
|
||||
| SignInPasswordlessSmsOtpParams
|
||||
| SignInPasswordlessSmsParams
|
||||
|
||||
@@ -4,7 +4,7 @@ title: SignInPasswordlessEmailParams
|
||||
sidebar_label: SignInPasswordlessEmailParams
|
||||
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#L59
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L64
|
||||
---
|
||||
|
||||
# `SignInPasswordlessEmailParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: SignInPasswordlessSmsOtpParams
|
||||
sidebar_label: SignInPasswordlessSmsOtpParams
|
||||
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#L69
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L74
|
||||
---
|
||||
|
||||
# `SignInPasswordlessSmsOtpParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: SignInPasswordlessSmsParams
|
||||
sidebar_label: SignInPasswordlessSmsParams
|
||||
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#L64
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L69
|
||||
---
|
||||
|
||||
# `SignInPasswordlessSmsParams`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: SignInReponse
|
||||
sidebar_label: SignInReponse
|
||||
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#L114
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L123
|
||||
---
|
||||
|
||||
# `SignInReponse`
|
||||
|
||||
@@ -4,7 +4,7 @@ title: SignInWithProviderOptions
|
||||
sidebar_label: SignInWithProviderOptions
|
||||
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#L73
|
||||
custom_edit_url: https://github.com/nhost/nhost/edit/main/packages/hasura-auth-js/src/utils/types.ts#L78
|
||||
---
|
||||
|
||||
# `SignInWithProviderOptions`
|
||||
|
||||
@@ -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()`
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user