Compare commits

..

516 Commits

Author SHA1 Message Date
Pilou
dee93bb873 Merge pull request #526 from nhost/changeset-release/main
chore: update versions
2022-05-06 22:29:55 +02:00
github-actions[bot]
173b587802 chore: update versions 2022-05-06 20:24:16 +00:00
Pilou
30ef1660b4 Merge pull request #525 from nhost/fix/cookie-mode
fix: correct cookie storage type
2022-05-06 22:23:12 +02:00
Pierre-Louis Mercereau
a613aa9f0c refactor: unnest if block 2022-05-06 22:12:50 +02:00
Pierre-Louis Mercereau
3c03b9b46f refactor: remove dead code 2022-05-06 22:09:51 +02:00
Pierre-Louis Mercereau
65a3061146 fix: correct cookie storage type 2022-05-06 22:01:38 +02:00
Pilou
55864eac30 Merge pull request #522 from nhost/event-triggers-syntax-error
fixed syntax error in Event Triggers docs
2022-05-06 19:59:46 +02:00
Szilárd Dóró
28494d6c1f fixed syntax error in Event Triggers docs 2022-05-06 19:09:51 +02:00
Pilou
6777738c53 Merge pull request #519 from nhost/changeset-release/main
chore: update versions
2022-05-06 15:24:04 +02:00
github-actions[bot]
0d60693c27 chore: update versions 2022-05-06 11:43:21 +00:00
Pilou
c159c9c98c Merge pull request #518 from nhost/fix/refresh-token-load
fix: corrections and reshape the react-apollo example
2022-05-06 13:42:05 +02:00
Pierre-Louis Mercereau
58fa2a201c fix: corrections and reshape the react-apollo example 2022-05-06 12:55:17 +02:00
Johan Eliasson
db4607ccac Merge pull request #516 from nhost/docs-guides
Docs intro of Nhost
2022-05-06 11:50:05 +02:00
Johan Eliasson
95b14557a0 intro 2022-05-06 11:47:29 +02:00
Johan Eliasson
8b527d0fcb Merge pull request #445 from nhost/docs-guides
docs: intro, architecture and quickstarts
2022-05-06 11:43:41 +02:00
Pilou
fc50beec5e Merge pull request #513 from nhost/docs/clean-nextjs-intro
remove reference to useless component
2022-05-06 10:42:24 +02:00
Pierre-Louis Mercereau
ed0de2d930 remove reference to useless component 2022-05-05 21:53:37 +02:00
Pilou
f26e8c3614 Merge pull request #491 from nhost/changeset-release/main
chore: update versions
2022-05-05 16:11:42 +02:00
Pierre-Louis Mercereau
a05a484426 chore: correct changelog 2022-05-05 16:04:33 +02:00
Pierre-Louis Mercereau
4f0d5aa9c0 chore: downgrade major to minor bump 2022-05-05 16:02:23 +02:00
github-actions[bot]
254e362e95 chore: update versions 2022-05-05 13:58:01 +00:00
Pilou
a2a8839694 Merge pull request #507 from nhost/refactor/simplify-and-correct-options
Make code more consistent, implement the 'custom and 'cookie' storage types
2022-05-05 15:56:41 +02:00
Pierre-Louis Mercereau
d12667ccc5 refactor: post-review 2022-05-05 15:22:35 +02:00
Pierre-Louis Mercereau
feb55fe0ad chore: update lockfile 2022-05-05 14:43:12 +02:00
Pilou
b97c0a9c9d Merge branch 'main' into refactor/simplify-and-correct-options 2022-05-05 14:35:08 +02:00
Pierre-Louis Mercereau
2e98934f75 refactor: expose the interface of NhostReactProvider and use PropsWithChildren type 2022-05-05 13:35:30 +02:00
Pilou
8cedafc807 Merge pull request #503 from nhost/patch/react-18
Patch/react 18
2022-05-05 13:27:24 +02:00
Pierre-Louis Mercereau
322b433994 docs(example): correct nextjs example 2022-05-05 12:07:20 +02:00
Pierre-Louis Mercereau
6082ba6943 docs: remove part of the doc already automatically generated 2022-05-05 10:54:24 +02:00
Pierre-Louis Mercereau
1fb1d25a72 chore: remove testing credentials 2022-05-05 10:39:07 +02:00
Pierre-Louis Mercereau
ae4e4e50f6 chore: update changeset 2022-05-05 10:37:22 +02:00
Pierre-Louis Mercereau
185f39e23f fix: don't take previous errors into account when using SMS and deanonymisation 2022-05-05 10:35:49 +02:00
Pierre-Louis Mercereau
0dd7cab3bf fix: remove async import 2022-05-04 22:35:18 +02:00
Pierre-Louis Mercereau
47c7380d89 refactor: cooooooooookies
(miom miom miom)
2022-05-04 22:28:13 +02:00
Pierre-Louis Mercereau
b56162a74b refactor: make code more consistent, and implement the 'custom and 'cookie' client storage types 2022-05-04 22:25:17 +02:00
Pierre-Louis Mercereau
aeb8b8afda chore: lint, and update changesets 2022-05-04 14:23:58 +02:00
Pierre-Louis Mercereau
f9e107b008 docs: return errors to the UI 2022-05-04 13:42:30 +02:00
Pierre-Louis Mercereau
d748d82483 docs: flesh up the nextjs example 2022-05-04 13:11:00 +02:00
Johan Eliasson
2192fdc92e change cta 2022-05-04 09:04:53 +02:00
Johan Eliasson
eec2601a3a architecture 2022-05-04 08:55:17 +02:00
Johan Eliasson
93eaa85b47 Merge branch 'main' into docs-guides 2022-05-04 07:40:53 +02:00
Pierre-Louis Mercereau
4c8a168c02 refactor: update lockfile 2022-05-03 22:12:57 +02:00
Pierre-Louis Mercereau
eb166cf5ee refactor: remove debug code 2022-05-03 22:07:07 +02:00
Pierre-Louis Mercereau
54e1873461 refactor: wrap again the apollo client creation into useEffect to avoid SSR when CSR 2022-05-03 22:02:15 +02:00
Pierre-Louis Mercereau
e5bc3b356c refactor(nextjs): bump to React 18 and Apollo client 3.6.2 2022-05-03 21:43:39 +02:00
Pierre-Louis Mercereau
42edb74057 refactor: upgrade to React 18 2022-05-03 21:20:10 +02:00
Pierre-Louis Mercereau
3ebeae9294 refactor: upgrade react-apollo to React 18 to reproduce the missing attached headers bug 2022-05-03 19:51:50 +02:00
Pilou
24189bd155 Merge pull request #501 from nhost/contributors-readme-action-tjRSlp2hVR
contributors readme action update
2022-05-03 16:47:01 +02:00
github-actions[bot]
5985b18764 contrib-readme-action has updated readme 2022-05-03 14:43:47 +00:00
Pilou
95efcb4de6 Merge pull request #500 from heygambo/patch-1
Adds environment variables to auth service
2022-05-03 16:43:30 +02:00
Christian Gambardella
609d9001f5 Adds environment variables to auth service
I ran into an issue where I couldn't sign up users because the auth service wasn't able to connect to mailhog.
That caused the auth service to not send an email and not respond to the HTTP request.

fixes #499 

I'm wondering if anyone else had this issue. If I'm the only one then maybe this PR is obsolete.
2022-05-03 16:18:36 +02:00
Pilou
1e44a14b8a Merge pull request #497 from nhost/docs/generate-hasura-auth-openapi
Generate the latest hasura-auth openapi specs
2022-05-02 17:05:26 +02:00
Pierre-Louis Mercereau
5917eff5a6 chore: newline 2022-05-02 09:44:38 +02:00
Pierre-Louis Mercereau
f8ee87ad01 feat: smalls script that generates the latest hasura-auth openapi specs 2022-05-02 09:42:24 +02:00
Szilárd Dóró
a7990b363f Merge pull request #496 from nhost/contributors-readme-action-Vits42iSrd
contributors readme action update
2022-05-02 08:59:28 +02:00
github-actions[bot]
ca8ecb4b5c contrib-readme-action has updated readme 2022-05-02 06:48:04 +00:00
Szilárd Dóró
dfe080b8f6 Merge pull request #495 from GavanWilhite/patch-2
Fixed npm <> yarn instructions
2022-05-02 08:47:50 +02:00
Gavan Wilhite
069a5d4d9a Fixed npm <> yarn instructions 2022-05-01 19:42:53 -06:00
Pilou
efccd54641 Merge pull request #492 from nhost/docs/autogen-edit-page
feat: link the 'Edit Page' button to the source code instead of the generated file
2022-04-29 17:02:18 +02:00
Pilou
a3357265ec Merge pull request #480 from nhost/docs/algolia
docs: enable algolia search
2022-04-29 12:33:20 +02:00
Pierre-Louis Mercereau
494d8127dc refactor: simplify 2022-04-29 12:31:15 +02:00
Pierre-Louis Mercereau
57b628a255 refactor: remove useless condition 2022-04-29 12:28:31 +02:00
Pierre-Louis Mercereau
98b30a5c5e Merge branch 'main' into docs/autogen-edit-page 2022-04-29 12:26:02 +02:00
Pierre-Louis Mercereau
48afcf415d feat: link the 'Edit Page' button to the source code instead of the generated file 2022-04-29 12:24:33 +02:00
Johan Eliasson
58b9488af8 update setting 2022-04-29 11:48:42 +02:00
Pilou
e49528d43e Merge pull request #488 from nhost/chore/rename-user-hooks
fix: rename user data hooks to make them all start with `userUser...`
2022-04-29 11:47:33 +02:00
Pilou
ab0f5582e5 Merge pull request #489 from nhost/docs/developers-guide
Basic developer guide
2022-04-29 11:47:17 +02:00
Pierre-Louis Mercereau
b499548503 post review 2022-04-29 10:30:29 +02:00
Pilou
fbc15cfee1 Merge pull request #452 from nhost/441-user_id-not-seen-in-the-screenshots-before-the-permissions-section-of-todoapp
docs: correct docs for `user_id` column
2022-04-29 09:43:03 +02:00
Pierre-Louis Mercereau
8788de83e8 docs: basic developer guide 2022-04-29 09:14:41 +02:00
Pierre-Louis Mercereau
1fb51a7bed fix: rename user data hooks to make them all start with userUser... 2022-04-29 08:31:32 +02:00
Pilou
365b806755 Merge pull request #487 from nhost/changeset-release/main
chore: update versions
2022-04-28 23:55:00 +02:00
github-actions[bot]
74025a2d90 chore: update versions 2022-04-28 21:51:11 +00:00
Pilou
ebd6f86ea3 Merge pull request #486 from nhost/fix/fine-tune-nextjs
fix: get the refresh token in the right place in the url
2022-04-28 23:50:19 +02:00
Pierre-Louis Mercereau
7b23d33d9b fix: get the refresh token in the right place in the url 2022-04-28 22:18:48 +02:00
Pierre-Louis Mercereau
de177710f7 chore: bump correct version number, and trigger release 2022-04-28 18:39:58 +02:00
Pierre-Louis Mercereau
eebfddb48e build: bump nextjs to correct version 2022-04-28 16:52:17 +02:00
Pilou
f5df7eaa2d Merge pull request #457 from nhost/changeset-release/main
chore: update versions
2022-04-28 16:31:09 +02:00
Pierre-Louis Mercereau
0b4028b1d6 chore: remove duplicate lines in changelog 2022-04-28 15:57:20 +02:00
github-actions[bot]
f2da21026b chore: update versions 2022-04-28 13:48:50 +00:00
Pilou
a8233ea621 Merge pull request #461 from nhost/feat/get-claim
feat: add accessors for decoded access token and Hasura claims
2022-04-28 15:47:30 +02:00
Pierre-Louis Mercereau
f300d8b9f1 build: update lintstagedrc 2022-04-28 15:26:29 +02:00
Pierre-Louis Mercereau
3b625acd96 Merge branch 'main' into feat/get-claim 2022-04-28 15:24:46 +02:00
Pilou
116e23cb13 Merge pull request #459 from nhost/feat/capture-url-errors
feat: capture url errors & improved SSR / NextJs startup
2022-04-28 15:22:54 +02:00
Pierre-Louis Mercereau
954aa43e49 refactor: adjustments from review 2022-04-28 14:01:18 +02:00
Pierre-Louis Mercereau
de6f862c4c style: remove dead code and add minor piece of doc 2022-04-28 13:54:29 +02:00
Pierre-Louis Mercereau
5025333fb4 Merge branch 'main' into feat/capture-url-errors 2022-04-28 13:44:14 +02:00
Pilou
b3991ea9d9 Merge pull request #482 from nhost/docs/404
docs: custom 404 page
2022-04-28 13:42:54 +02:00
Pierre-Louis Mercereau
239db617f3 docs: clean file 2022-04-28 12:48:07 +02:00
Szilárd Dóró
6d6c8b3e2e Merge pull request #481 from nhost/fix/docgen-tags 2022-04-28 12:24:03 +02:00
Pierre-Louis Mercereau
169f163c99 docs: custom 404 page 2022-04-28 10:53:35 +02:00
Szilárd Dóró
5ddd7eda22 fixed some errors caused by undefined values 2022-04-28 10:49:03 +02:00
Szilárd Dóró
00d50f404a temporary support for link removal from TSDoc comments, renamed __tsdoc__ folder to .docgen 2022-04-28 10:21:06 +02:00
Pierre-Louis Mercereau
b52b4fca2d feat: complete NextJs 2022-04-27 22:18:03 +02:00
Pierre-Louis Mercereau
56b1adfa81 docs: enable algolia search 2022-04-27 17:25:34 +02:00
Pierre-Louis Mercereau
9f55f4890e chore: merge main 2022-04-27 16:44:19 +02:00
Szilárd Dóró
284890b437 Merge pull request #477 from nhost/docgen-improvements
DocGen improvements
2022-04-27 16:22:05 +02:00
Szilárd Dóró
1e3cb855f0 improved function overloads in auto-generated docs 2022-04-27 16:12:41 +02:00
Pierre-Louis Mercereau
aaf575f0af chore: remove dev code 2022-04-27 16:09:30 +02:00
Pierre-Louis Mercereau
ff3427ccdb chore: update changeset title 2022-04-27 16:08:40 +02:00
Szilárd Dóró
3834d80a0a improved the way function overloads are displayed
fixed an issue where line breaks broke the layout of parameter table fragments
2022-04-27 15:57:34 +02:00
Pierre-Louis Mercereau
8fcc3fd560 Merge branch 'main' into feat/capture-url-errors 2022-04-27 15:56:04 +02:00
Pierre-Louis Mercereau
616e320421 refactor: simplify startup 2022-04-27 15:55:04 +02:00
Pilou
ff8fdc4db4 Merge pull request #476 from nhost/contributors-readme-action-84g__a20xD
contributors readme action update
2022-04-27 15:43:27 +02:00
Szilárd Dóró
b732bc51e8 fixed an issue where multiple function signatures were not rendered properly in generated docs 2022-04-27 14:42:01 +02:00
Pierre-Louis Mercereau
8b88d6c553 refactor: augment useAuthenticationState instead of creating useAuthenticationError 2022-04-27 14:26:14 +02:00
Szilárd Dóró
af192fbb66 updated lint-staged config 2022-04-27 14:23:27 +02:00
Szilárd Dóró
b7c031d7e0 added deprecation indicator to sidebar items if applicable 2022-04-27 14:21:31 +02:00
Pierre-Louis Mercereau
05e91d93a8 fix: check if window existd 2022-04-27 14:20:52 +02:00
Pierre-Louis Mercereau
261f001a99 fix(nextjs): correct refresh method 2022-04-27 14:14:46 +02:00
Szilárd Dóró
ddb965c7cf added warning message to auto-generated markdown files 2022-04-27 14:10:17 +02:00
github-actions[bot]
ff8af4912b contrib-readme-action has updated readme 2022-04-27 11:42:13 +00:00
Pilou
948aebcf42 Merge pull request #472 from jladuval/patch-1
Docs: Update event-triggers.md with environment variable example
2022-04-27 13:41:57 +02:00
Szilárd Dóró
51a4d7a343 Merge pull request #474 from nhost/fix/docs-redirects
fix: Docs redirects
2022-04-27 13:17:41 +02:00
Johan Eliasson
d521218146 Merge pull request #475 from nhost/typo-hbuyg87y9
Typo
2022-04-27 13:08:06 +02:00
Johan Eliasson
9a1685c2eb typo 2022-04-27 12:55:43 +02:00
Szilárd Dóró
fb8f58503f updated CODEOWNERS 2022-04-27 12:31:02 +02:00
Szilárd Dóró
86409c2f18 changed React Hooks redirect 2022-04-27 12:26:36 +02:00
Szilárd Dóró
f7d8c061a0 added redirects from previously removed docs 2022-04-27 12:23:57 +02:00
Szilárd Dóró
eb59a07c3f Merge pull request #453 from nhost/feat/docgen
feat: Auto-generate documentation from TSDoc
2022-04-27 12:07:58 +02:00
Szilárd Dóró
27add80f95 added index page to JavaScript docs 2022-04-27 11:59:04 +02:00
Szilárd Dóró
cc60a845f3 fixes HasuraStorageClient examples to use code block 2022-04-27 10:53:02 +02:00
Szilárd Dóró
aeea44e4e8 fixed HasuraAuthClient examples to use code block 2022-04-27 10:51:35 +02:00
Jacob Duval
d273825cee Update event-triggers.md with environment variable example
Show how environment variables are used with the correct formatting. I had to search around a while to find the correct {{}} format.
2022-04-27 10:44:57 +02:00
Szilárd Dóró
177733f4b1 added deprecation note to parameters and parameter tables 2022-04-27 10:40:50 +02:00
Szilárd Dóró
efd33a7115 updated docs according to code changes 2022-04-27 10:04:08 +02:00
Szilárd Dóró
e4fe166992 Merge branch 'main' into feat/docgen 2022-04-27 10:02:34 +02:00
Pierre-Louis Mercereau
d9f221b625 feat: get refresh token from url in Next, and remove the refresh token from the url when possible 2022-04-27 09:55:42 +02:00
Szilárd Dóró
e0f5bf3396 fixed example in hasura-auth-client 2022-04-27 09:50:23 +02:00
Szilárd Dóró
17bd23460f added lint-staged configuration 2022-04-27 09:16:12 +02:00
Szilárd Dóró
52c30c25a9 expand Reference > JavaScript menu by default 2022-04-26 17:11:00 +02:00
Szilárd Dóró
989bc54544 added support for DocGen parallelization, improved DocGen configuration 2022-04-26 17:05:07 +02:00
Szilárd Dóró
5781cb0f9c restored accidentally removed docs pages 2022-04-26 15:51:26 +02:00
Szilárd Dóró
24f9ed4c4d fixed slugs, re-generated docs 2022-04-26 15:25:31 +02:00
Szilárd Dóró
2b447af8a7 Merge branch 'feat/docgen' of https://github.com/nhost/nhost into feat/docgen 2022-04-26 14:57:06 +02:00
Szilárd Dóró
2485c83de3 updated documentation URLs, fixed auto-generated documentation slugs 2022-04-26 14:53:26 +02:00
Pilou
707877477f Merge pull request #465 from nhost/chore/inline-react-doc
docs(react): add inline documentation
2022-04-26 14:32:15 +02:00
Pierre-Louis Mercereau
756e1af52d chore: merge 2022-04-26 14:31:35 +02:00
Pierre-Louis Mercereau
7f771e2e8f pre-merge 2022-04-26 14:29:25 +02:00
Szilárd Dóró
a737863c2b added support for flattened navigation structure on References page 2022-04-26 13:32:24 +02:00
Pierre-Louis Mercereau
ca2a61089a docs: add missing backticks 2022-04-26 12:19:53 +02:00
Szilárd Dóró
7432db0fe8 created custom sidebar mapping to support appropriate structure 2022-04-26 12:10:38 +02:00
Pierre-Louis Mercereau
9c25e65df6 docs(react): add inline documentation 2022-04-26 12:06:51 +02:00
Szilárd Dóró
e345895fd8 generated React, Next.js, Nhost JS documentation, fixed issues 2022-04-26 11:55:53 +02:00
Szilárd Dóró
cba7996dcf generated React, Next.js, Nhost JS documentation, fixed issues 2022-04-26 10:58:03 +02:00
Johan Eliasson
d7ceda6ae6 Merge pull request #464 from nhost/contributors-readme-action-yLZgG3Dxtk
contributors readme action update
2022-04-26 08:36:39 +02:00
github-actions[bot]
4e19b7309d contrib-readme-action has updated readme 2022-04-25 18:21:46 +00:00
David Barroso
de8a7d5512 Merge pull request #449 from nhost/dbarroso/update-docker-compose
update hasura-storage example
2022-04-25 20:21:32 +02:00
Pierre-Louis Mercereau
7e7aa5adc4 refactor: explain 2022-04-25 14:11:22 +02:00
Pierre-Louis Mercereau
1ed948952a refactor: remove mock credentials 2022-04-25 14:07:47 +02:00
Pilou
55b0a8f4b9 Merge pull request #458 from nhost/examples/xstate-inspector
react-apollo example: activate xstate inspector with an environment variable
2022-04-25 13:37:43 +02:00
Pierre-Louis Mercereau
1ce55c5568 feat: add aceessors for decoded access token and Hasura claims 2022-04-25 13:24:07 +02:00
Pierre-Louis Mercereau
fabd1da04c feat: new useAuthenticationError hook 2022-04-25 11:19:59 +02:00
Pierre-Louis Mercereau
53f5226d0c feat: capture hasura-auth errors from the url 2022-04-25 11:16:48 +02:00
Pilou
e339cba384 Merge pull request #450 from nhost/fix/filter-logs
Remove filtering of `useLayoutEffect` from logs
2022-04-25 11:14:05 +02:00
Pierre-Louis Mercereau
c14d12e04d docs: activate xstate inspector with an environment variable 2022-04-25 10:57:42 +02:00
Szilárd Dóró
03370da2f4 added DocGen support for React package, generated default React SDK references 2022-04-25 10:46:06 +02:00
Pilou
87d32b2639 Merge pull request #451 from nhost/chore/reprecate-bad-naming
Rename `autoLogin` to `autoSignIn`, and deprecate `autoLogin`
2022-04-25 10:13:08 +02:00
Pilou
61b5fb549c Merge pull request #456 from nhost/docs/use-display-name
docs: `useDisplayName` instead of `displayName`
2022-04-25 10:12:52 +02:00
Szilárd Dóró
28cd8dc5c5 resolved conflicts with main branch 2022-04-25 10:06:33 +02:00
Szilárd Dóró
fb93d8c1af Merge branch 'main' into feat/docgen 2022-04-25 10:05:41 +02:00
Pierre-Louis Mercereau
f4e6aea9c1 docs: fix incorrect example 2022-04-25 09:45:40 +02:00
Johan Eliasson
65d61cf4b8 update 2022-04-25 09:40:23 +02:00
Johan Eliasson
a8d5214b2f grammerly updates 2022-04-25 09:39:14 +02:00
Johan Eliasson
f9e5283fc3 correct docs for column 2022-04-25 09:35:18 +02:00
Pierre-Louis Mercereau
d49b837abb fix: rename autoLogin to autoSignIn, and deprecate autoLogin 2022-04-25 09:09:19 +02:00
Pierre-Louis Mercereau
49545c058b fix: remove filtering of useLayoutEffect from logs 2022-04-25 08:40:34 +02:00
David Barroso
765340f7b2 update hasura-storage example 2022-04-25 08:30:39 +02:00
Johan Eliasson
5a212aaa12 link fix 2022-04-22 22:34:45 +02:00
Pilou
2c3d9b11a6 Merge pull request #446 from nhost/changeset-release/main
chore: update versions
2022-04-22 22:33:18 +02:00
Johan Eliasson
79056d8b48 update 2022-04-22 22:30:02 +02:00
github-actions[bot]
b1678eaad3 chore: update versions 2022-04-22 20:29:10 +00:00
Pilou
f1c16dba6e Merge pull request #444 from nhost/fix/refresh-session-start
fix: fix `refreshSession`
2022-04-22 22:28:23 +02:00
Johan Eliasson
f86883df88 new menu strucutre 2022-04-22 22:20:42 +02:00
Pierre-Louis Mercereau
aa1fdf6c2c fix: fix refreshSession 2022-04-22 22:18:17 +02:00
Pilou
bebf9e1f2b Merge pull request #443 from nhost/changeset-release/main
chore: update versions
2022-04-22 17:35:44 +02:00
github-actions[bot]
2413c10283 chore: update versions 2022-04-22 15:32:40 +00:00
Pilou
0f7fbdab97 Merge pull request #440 from nhost/fix/token-refresher
fix: improve reliability of the token refresher
2022-04-22 17:31:47 +02:00
Pilou
14e5fd63a6 Merge branch 'main' into fix/token-refresher 2022-04-22 17:27:11 +02:00
Pilou
2446913836 Merge pull request #439 from nhost/fix/refresh-session
fix: fix and improve `nhost.auth.refreshSession`
2022-04-22 17:22:47 +02:00
Pierre-Louis Mercereau
1f88a9f47a style: improve readability 2022-04-22 17:20:05 +02:00
Pierre-Louis Mercereau
261e37cda4 fix: fix nullable value miss 2022-04-22 16:50:30 +02:00
Pierre-Louis Mercereau
5ee395ea8e fix: ensure the session is destroyed when signout is done 2022-04-22 16:44:52 +02:00
Szilárd Dóró
e5f00394ae added tests for getNestedParametersFromParameter 2022-04-22 16:41:04 +02:00
Szilárd Dóró
dd08aef4cc added tests for helper functions, improved verbose logging 2022-04-22 15:55:08 +02:00
Szilárd Dóró
4ab85815a0 introduced support for "alias" tag, added tests for DeprecationNoteFragment and CommentTagFragment 2022-04-22 15:18:53 +02:00
Pilou
828633ffc9 Merge pull request #435 from nhost/chore/include-examples-in-monorepo
Chore/include examples in monorepo
2022-04-22 13:28:02 +02:00
Szilárd Dóró
1b0902079b changed reference paths to use root path, improved some examples of HasuraAuthClient 2022-04-22 12:55:07 +02:00
Pierre-Louis Mercereau
7b7527a5e6 fix: improve reliability of the token refresher 2022-04-22 11:32:25 +02:00
Szilárd Dóró
f719d47ed3 created command for Storage docs generation, added initial docs generated with the tool 2022-04-22 11:23:54 +02:00
Szilárd Dóró
8cc88533b1 fixed class references 2022-04-22 10:57:41 +02:00
Szilárd Dóró
71de2bd0c5 added custom styling for optional / required labels of parameters
improved prettier formatter of classes, functions and types
2022-04-21 22:50:40 +02:00
Szilárd Dóró
66d204331b improved function signature formatting, union and intersection types 2022-04-21 22:31:17 +02:00
Szilárd Dóró
ee288fbc5f added tests for ClassTemplate, improved typings of signatures 2022-04-21 21:59:26 +02:00
Pilou
620566fa4d Merge pull request #438 from nhost/changeset-release/main
chore: update versions
2022-04-21 21:58:07 +02:00
Szilárd Dóró
1a38b5dca3 fixed parameter reference generator issues, added option to wrap or unwrap values to label generator 2022-04-21 19:39:38 +02:00
Szilárd Dóró
e0bd8cf14b moved docgen to packages, created temporary scripts to execute docgen procedure 2022-04-21 18:21:36 +02:00
github-actions[bot]
4ce8b88d27 chore: update versions 2022-04-21 15:45:25 +00:00
Pilou
28d25e46de Merge pull request #436 from nhost/fix/mixed-email-password-errors
fix: invalid password and email errors on sign up
2022-04-21 17:44:35 +02:00
Pierre-Louis Mercereau
e0cfcafead fix: fix and improve nhost.auth.refreshSession 2022-04-21 16:57:55 +02:00
Pilou
12bc30daa3 Merge pull request #437 from nhost/fix/broadcast-channel-react-native
fix: avoid error when BroadcastChannell is not available
2022-04-21 16:10:49 +02:00
Pierre-Louis Mercereau
7b5f00d10e fix: avoid error when BroadcastChannell is not available 2022-04-21 16:00:12 +02:00
Pierre-Louis Mercereau
58e1485c13 fix: invalid password and email errors on sign up 2022-04-21 14:46:30 +02:00
Szilárd Dóró
1da0ff9109 fixed ESLint issues, improved error handling, improved DocGen state management 2022-04-21 14:09:44 +02:00
Johan Eliasson
a64f1c4396 typo 2022-04-21 13:54:09 +02:00
Pierre-Louis Mercereau
75a1428114 chore(examples): fix resolution error with nextjs 2022-04-21 13:42:23 +02:00
Pierre-Louis Mercereau
d82d830849 chore: update pnpm lock file 2022-04-21 13:23:13 +02:00
Pierre-Louis Mercereau
2def59fc6c chore: merge main 2022-04-21 13:21:36 +02:00
Pierre-Louis Mercereau
64ceb2c6bf docs: update examples readme 2022-04-21 12:46:05 +02:00
Pierre-Louis Mercereau
3ee007620c chore: use vite to build react-apollo-crm, and prettier examples 2022-04-21 12:40:19 +02:00
Szilárd Dóró
c08230ae95 disabled import sort command in DocGen because of the Prettier plugin 2022-04-21 12:04:43 +02:00
Szilárd Dóró
18df8921fd initial DocGen code 2022-04-21 11:44:31 +02:00
Pierre-Louis Mercereau
b9cf8172a0 chore(examples): include react-apollo and nextjs examples back in the monorepo workspace 2022-04-21 11:24:32 +02:00
Pilou
32edfb4a9f Merge pull request #432 from nhost/contributors-readme-action-GEao4TGXIq
contributors readme action update
2022-04-21 11:20:17 +02:00
Pilou
848db9b672 Merge pull request #433 from nhost/contributors-readme-action--71qTzGJKI
contributors readme action update
2022-04-21 11:19:43 +02:00
github-actions[bot]
3766921bcc contrib-readme-action has updated readme 2022-04-21 09:19:09 +00:00
Pilou
5546052b2c Merge pull request #430 from nhost/docs/update-example
Docs/update example
2022-04-21 11:18:54 +02:00
github-actions[bot]
c569b56d3d contrib-readme-action has updated readme 2022-04-21 09:18:43 +00:00
Pilou
52ffa84adb Merge pull request #431 from timpratim/patch-3
Changed the wording for better understanding
2022-04-21 11:18:26 +02:00
Pratim
b5ae438a8e Changed the wording for better understanding
Changed the wording for a better understanding of the permissions doc
2022-04-21 14:17:13 +05:30
Pierre-Louis Mercereau
fae05f7af2 docs: bump to latest version of hasura-auth 2022-04-21 10:38:15 +02:00
Pierre-Louis Mercereau
380d7fc8ce docs: bump versions 2022-04-21 10:36:53 +02:00
Pierre-Louis Mercereau
94132bbc7f docs: move allowed_redirect_urls option to the right place, and prettier files 2022-04-21 10:36:28 +02:00
Szilárd Dóró
d87a9d7c79 Merge pull request #429 from nhost/changeset-release/main
chore: update versions
2022-04-21 10:00:00 +02:00
github-actions[bot]
be7756d4a2 chore: update versions 2022-04-21 07:54:52 +00:00
Szilárd Dóró
ca5e335bff Merge pull request #425 from nhost/fix/broadcast-channel
fix: remove broadcast-channel
2022-04-21 09:53:45 +02:00
Pilou
b9ed794f2b Merge pull request #424 from nhost/docs/graphql-dependency
docs: use docusaurus tabs for npm/yarn commands, and add `graphql` dependency
2022-04-20 16:39:24 +02:00
Pierre-Louis Mercereau
042dc7d27c docs: remove duplicate text 2022-04-20 15:12:22 +02:00
Pierre-Louis Mercereau
db2df3d5b2 docs: remove useless lines 2022-04-20 15:10:57 +02:00
Pierre-Louis Mercereau
0b1cb628f2 fix: remove broadcast-channel 2022-04-20 15:08:30 +02:00
Pierre-Louis Mercereau
912d95d153 docs: add admonitions 2022-04-20 12:14:01 +02:00
Pierre-Louis Mercereau
76059f4738 docs: use docusaurus tabs for npm/yarn commands, and add graphql dependency 2022-04-20 12:06:21 +02:00
Pilou
011572f3ef Merge pull request #423 from nhost/docs/auth-host
docs: notify AUTH_HOST won't be available after hasura-auth `v0.6.0`
2022-04-20 09:22:44 +02:00
Pierre-Louis Mercereau
b727b354dd docs: notify AUTH_HOST won't be available after hasura-auth v0.6.0 2022-04-20 08:37:32 +02:00
Pilou
a0682ed22e Merge pull request #406 from nhost/changeset-release/main
chore: update versions
2022-04-19 08:39:05 +01:00
Szilárd Dóró
4d16306e56 Merge pull request #421 from nhost/contributors-readme-action-C0LArrqIaO
contributors readme action update
2022-04-19 09:25:07 +02:00
github-actions[bot]
b7861bbd36 chore: update versions 2022-04-19 07:23:44 +00:00
github-actions[bot]
e279805896 contrib-readme-action has updated readme 2022-04-19 07:23:03 +00:00
Szilárd Dóró
e3ebd9cb1b Merge pull request #407 from hajek-raven/feat/graphql-ts-generic-types
feat: Add generic types for NhostFunctionsClient and NhostGraphqlClient request method return type and variables
2022-04-19 09:22:46 +02:00
Filip Hájek
5bb928da2c feat: Refactor NhostGraphqlClient request method 2022-04-18 18:31:26 +02:00
Filip Hájek
ab06e96eac feat: Add generic types for NhostFunctionsClient and NhostGraphqlClient request method return type and variables 2022-04-18 18:12:30 +02:00
Johan Eliasson
6e2aabbda0 Merge pull request #417 from nhost/contributors-readme-action-cvcdbRwZtm
contributors readme action update
2022-04-15 16:40:41 +02:00
github-actions[bot]
e4ce235f38 contrib-readme-action has updated readme 2022-04-15 14:40:11 +00:00
Johan Eliasson
e783b7478b Merge pull request #413 from GavanWilhite/patch-1
Fixed typos in migration doc
2022-04-15 16:39:58 +02:00
Johan Eliasson
06d2d2b0c7 Merge branch 'main' into patch-1 2022-04-15 16:37:42 +02:00
Johan Eliasson
656379e78b Merge pull request #415 from nhost/docs/u898ashda
docs: updated migrations
2022-04-15 16:36:30 +02:00
Pilou
4156a9a61e Merge pull request #414 from nhost/402-add-gql-support-for-graphql-client
feat: add `gql` support for GraphQL client
2022-04-15 07:02:54 +01:00
Johan Eliasson
0b72829274 typo fixes 2022-04-15 00:21:14 +02:00
Pierre-Louis Mercereau
6b0baab151 refactor: graphql becomes a peer dependency, and no dynamic import 2022-04-14 22:59:16 +01:00
Johan Eliasson
93f9d2d01d migration updates 2022-04-14 23:47:41 +02:00
Pierre-Louis Mercereau
3fb3d4c282 refactor: rename gql to graphql-tag 2022-04-14 22:40:12 +01:00
Pierre-Louis Mercereau
ccba0b5015 feat: add gql support for GraphQL client 2022-04-14 22:36:24 +01:00
Gavan Wilhite
62e331500d Update index.md
Fixed typos
2022-04-14 13:10:38 -07:00
Szilárd Dóró
4104ddbcb6 Merge pull request #412 from nhost/szilarddoro-readme-patch 2022-04-14 18:57:52 +02:00
Szilárd Dóró
43fc040a29 Update Docs README.md
Mac put this weird whitespace-like character here, therefore the README was rendered incorrectly.
2022-04-14 17:26:25 +02:00
Johan Eliasson
e472b2cb19 Merge pull request #411 from nhost/docs/edit-link
Docs: edit link instead of blob
2022-04-14 15:21:28 +02:00
Johan Eliasson
6570a940ee Merge pull request #408 from nhost/docs/new-structure-jhbuas79yasd
Docs update
2022-04-14 15:20:38 +02:00
Johan Eliasson
d3e97c87d6 typo update 2022-04-14 13:29:45 +02:00
Johan Eliasson
36508c7930 edit link instead of blob 2022-04-14 10:08:33 +02:00
Johan Eliasson
709d364749 fixed broken link 2022-04-14 09:34:47 +02:00
Johan Eliasson
73eb2db159 more updates 2022-04-13 21:29:47 +02:00
Johan Eliasson
86eb8903dc fixed next page issues 2022-04-13 21:13:32 +02:00
Johan Eliasson
d665473074 updated gql 2022-04-13 21:09:37 +02:00
Johan Eliasson
58534c24f0 fixed platform structure 2022-04-13 20:20:50 +02:00
Pilou
90a1c3b9e1 Merge pull request #388 from nhost/feat/graphql-ws
feat: graphql-ws and useAuthSubscription
2022-04-13 11:47:14 +01:00
Johan Eliasson
bdfa2b3053 Merge pull request #403 from nhost/fix/docs-opengraph-image
fix: Docs - OpenGraph image
2022-04-13 11:46:56 +02:00
Szilárd Dóró
2c5b31f27a added previous OpenGraph image 2022-04-13 11:15:32 +02:00
Pierre-Louis Mercereau
d75fd747e0 refactor: type websocket 2022-04-13 10:10:18 +01:00
Pierre-Louis Mercereau
a71b3aff59 chore: merge main 2022-04-13 10:01:12 +01:00
Szilárd Dóró
8a8c67db92 Merge pull request #399 from nhost/changeset-release/main
chore: update versions
2022-04-13 10:49:05 +02:00
Szilárd Dóró
13935ebdc4 added OpenGraph image to Docs page 2022-04-13 10:23:16 +02:00
github-actions[bot]
357ba89d53 chore: update versions 2022-04-13 08:11:16 +00:00
Szilárd Dóró
7e34805eb4 Merge pull request #392 from nhost/feat/docusaurus
Migration to Docusaurus
2022-04-13 10:10:08 +02:00
Szilárd Dóró
52782ee550 fixed Hooks documentation 2022-04-13 10:04:08 +02:00
Szilárd Dóró
089d7fb0a2 replaced old docs with the docusaurus version 2022-04-13 10:00:11 +02:00
Szilárd Dóró
9df131201e README update 2022-04-12 16:49:37 +02:00
Szilárd Dóró
067d8a692c lock file update 2022-04-12 16:09:49 +02:00
Szilárd Dóró
824060e7f6 Merge branch 'main' into feat/docusaurus 2022-04-12 16:08:31 +02:00
Szilárd Dóró
0fe7b8f0fb fixed category slugs 2022-04-12 16:00:12 +02:00
Szilárd Dóró
78f096a738 Merge pull request #398 from nhost/fix/get-nhost-session-typing-improvements
fix: getNhostSession typing improvements, missing TSDoc
2022-04-12 15:39:54 +02:00
Szilárd Dóró
4635a145c1 improved getNhostSession function's typing, added missing tsdoc
added @types/cookies package
2022-04-12 15:33:17 +02:00
Szilárd Dóró
1446a8f13b Merge pull request #395 from nhost/changeset-release/main
chore: update versions
2022-04-12 14:54:23 +02:00
Johan Eliasson
ff75998e93 Merge pull request #397 from nhost/contributors-readme-action-v-3ccBloq6
contributors readme action update
2022-04-12 14:36:51 +02:00
github-actions[bot]
9cc044ca9f contrib-readme-action has updated readme 2022-04-12 12:28:41 +00:00
Johan Eliasson
c65e44b8d6 Merge pull request #396 from nhost/test/messaging-gql-be
Messaging test
2022-04-12 14:28:24 +02:00
Johan Eliasson
9ec73b4c22 edit readme 2022-04-12 14:25:47 +02:00
Szilárd Dóró
e4eda9e967 migrated changes from https://github.com/nhost/nhost/pull/385
added CTA to header
2022-04-12 14:07:37 +02:00
github-actions[bot]
94b70e0ce9 chore: update versions 2022-04-12 12:04:21 +00:00
Pilou
d108dff4f4 Merge pull request #387 from nhost/fix/sync-auth-state
fix onTokenChanged
2022-04-12 13:03:38 +01:00
Szilárd Dóró
7a8e771a72 Merge pull request #385 from gdangelo/patch-1
Add a table to detail the data returned by `useUserData`
2022-04-12 13:48:31 +02:00
Szilárd Dóró
f8fb4bbedd Merge pull request #393 from nhost/contributors-readme-action-L56J6ymmkI
contributors readme action update
2022-04-12 13:06:10 +02:00
Szilárd Dóró
90e38b1cc5 fixed build warnings, added missing videos 2022-04-12 13:04:31 +02:00
Szilárd Dóró
9c04dad57c Merge branch 'main' into feat/docusaurus 2022-04-12 12:51:45 +02:00
github-actions[bot]
c6b1c33a8e contrib-readme-action has updated readme 2022-04-12 10:51:37 +00:00
Szilárd Dóró
65b36eff13 Merge pull request #391 from gdangelo/patch-2
Update example with the latest version of React Router, v6
2022-04-12 12:51:21 +02:00
Szilárd Dóró
cac6088016 fixed broken links, fixed typo in authentication hooks 2022-04-12 11:47:47 +02:00
Grégory D'Angelo
c192cb9503 refact: Remove additional props to simplify example 2022-04-12 11:44:36 +02:00
Grégory D'Angelo
94ff290264 fix: Return Outlet in ProtectedRoute component + add missing closing tag + add explanation 2022-04-12 11:40:03 +02:00
Szilárd Dóró
aff80db515 updated slugs in new documentation to match old docs 2022-04-12 11:02:52 +02:00
Szilárd Dóró
6e2c991b2e added sitemap support to new docs page 2022-04-12 10:32:11 +02:00
Grégory D'Angelo
78781ebfec Update example with the latest version of React Router, v6 2022-04-12 09:04:28 +02:00
Pierre-Louis Mercereau
f6093a619f feat: graphql-ws and useAuthSubscription 2022-04-11 22:54:28 +01:00
Pierre-Louis Mercereau
63d6059981 fix: fix onTokenChanged bugs 2022-04-11 20:55:02 +01:00
Grégory D'Angelo
022d49fb25 Add a table to detail the data returned by useUserData 2022-04-11 19:06:30 +02:00
Szilárd Dóró
a8e6187360 fixed a 404 error on deployed page 2022-04-11 17:49:55 +02:00
Szilárd Dóró
276d6b10dd fixed a 404 error on deployed page 2022-04-11 17:42:55 +02:00
Szilárd Dóró
62461a2f20 moved get-started/cli documentation to get-started/cli-workflow to better mirror old structure 2022-04-11 17:33:41 +02:00
Szilárd Dóró
81ec16d77b moved documentation from root folder to get-started to better mirror old documentation structure 2022-04-11 17:31:10 +02:00
Szilárd Dóró
5a059c1e9e fixed broken documentation links, reverted broken link severity to error 2022-04-11 17:13:21 +02:00
Szilárd Dóró
28bbde6142 finalized old documentation migration 2022-04-11 17:06:13 +02:00
Szilárd Dóró
05f01e45ec finalized Reference page in new docs 2022-04-11 16:04:58 +02:00
Szilárd Dóró
b1bd405a5e Merge branch 'main' into feat/docusaurus 2022-04-11 15:34:05 +02:00
Szilárd Dóró
a295b5b1e6 finalized platform page migration 2022-04-11 15:21:39 +02:00
Szilárd Dóró
eece559771 changed broken link severity from error to warning temporarily 2022-04-11 13:37:17 +02:00
Szilárd Dóró
cd0e4d1908 added remaining social providers to the new docs, optimized preview SVGs 2022-04-11 11:14:02 +02:00
Johan Eliasson
7bf678df9f docs update 2022-04-11 06:54:42 +02:00
Pilou
3bd1aa4d53 Merge pull request #357 from nhost/changeset-release/main
chore: update versions
2022-04-10 08:51:47 +01:00
github-actions[bot]
f3cca4997b chore: update versions 2022-04-10 07:44:55 +00:00
Pilou
0fd7a487d6 Merge pull request #382 from nhost/fix/sync-auth-state
Keep authentication status and access token in sync
2022-04-10 08:44:15 +01:00
Pierre-Louis Mercereau
1bb032c1e7 chore: remove console.log and add explaination 2022-04-09 20:48:00 +01:00
Pierre-Louis Mercereau
2c97db68b5 fix: sync auth state with all the nhost sub-clients 2022-04-09 20:44:38 +01:00
Johan Eliasson
714f2872ee Merge pull request #380 from nhost/contributors-readme-action-nMk7JwQ8hY
contributors readme action update
2022-04-09 16:19:05 +02:00
github-actions[bot]
65fc26a0e8 contrib-readme-action has updated readme 2022-04-09 14:11:13 +00:00
Johan Eliasson
86a56f28c1 Merge pull request #379 from Savinvadim1312/patch-1
Fix a type in react documentation
2022-04-09 16:10:55 +02:00
Savin Vadim
6e8abe28d6 Fix a type in react documentation
Fix a typo in the `nhsot/react` documentation in the code example. 

The imported hook had a wrong name
2022-04-09 13:41:56 +01:00
Szilárd Dóró
39925ff5ca Merge pull request #376 from nhost/fix/documentation-react-router
React Router example upgraded to v6
2022-04-08 16:03:09 +02:00
Szilárd Dóró
583a77ed0d build fix and sitemap updates 2022-04-08 15:12:34 +02:00
Szilárd Dóró
e704831500 upgraded AuthGate example documentation to use react-router v6 2022-04-08 15:03:31 +02:00
Szilárd Dóró
a8f82e8133 improved navigation structure on Reference page 2022-04-08 09:10:25 +02:00
Johan Eliasson
95948dd5b9 Merge pull request #372 from nhost/contributors-readme-action-9bzNZt6pM9
contributors readme action update
2022-04-08 07:24:40 +02:00
github-actions[bot]
247b69c952 contrib-readme-action has updated readme 2022-04-08 05:24:23 +00:00
Johan Eliasson
7d15b76402 Merge pull request #359 from nhost/contributors-readme-action-txEVhnQt0i
contributors readme action update
2022-04-08 07:24:11 +02:00
github-actions[bot]
b1ae65fd72 contrib-readme-action has updated readme 2022-04-07 18:55:02 +00:00
Pilou
0063fd1840 Merge pull request #358 from Savinvadim1312/patch-1
Fix a typo in the React docs
2022-04-07 19:54:48 +01:00
Savin Vadim
743a7e6507 Fix a typo in the React docs
Changed from `clientStorageGetter` to `clientStorageSetter` on the line referencing the setter function
2022-04-07 19:43:30 +01:00
Szilárd Dóró
1687f7af04 improved sidebar structure of docs, added reference page 2022-04-07 20:35:54 +02:00
Pilou
078652861f Merge pull request #345 from nhost/fix/dont-remove-ts-comments
fix: don't remove comments so they are present in the built .d.ts
2022-04-07 19:27:39 +01:00
Pilou
39840cfd95 Merge pull request #347 from nhost/docs/update-examples
Update examples to bump versions & hooks syntax, and fix dead link in react-apollo readme
2022-04-07 19:26:49 +01:00
Szilárd Dóró
102c99e491 asset cleanup, redirect and docs route fixes 2022-04-07 17:49:31 +02:00
Szilárd Dóró
a3702a644e removed unnecessary files related to the default placeholder page 2022-04-07 16:51:24 +02:00
Szilárd Dóró
db65fea706 more branding related changes, redirect support 2022-04-07 16:48:40 +02:00
Szilárd Dóró
ffe9123b48 fixed build issues caused by broken links 2022-04-07 15:29:07 +02:00
Szilárd Dóró
f112ea2115 fixed text color in dark mode 2022-04-07 15:17:26 +02:00
Szilárd Dóró
4963153def basic docusaurus stylign improvements 2022-04-07 15:02:44 +02:00
Johan Eliasson
940a36a68f Merge pull request #352 from nhost/contributors-readme-action-YMeH8uC8qa
contributors readme action update
2022-04-07 13:23:41 +02:00
github-actions[bot]
77b109b3df contrib-readme-action has updated readme 2022-04-07 11:22:27 +00:00
Johan Eliasson
15907d65e6 Merge pull request #351 from nhost/contr-test-1
readme update
2022-04-07 13:22:12 +02:00
Johan Eliasson
7d7d16fa71 readme update 2022-04-07 13:21:56 +02:00
Johan Eliasson
3f39e48cbd Merge pull request #349 from nhost/contributors
contr init
2022-04-07 13:18:57 +02:00
Johan Eliasson
97ade32869 contr init 2022-04-07 13:18:22 +02:00
Pierre-Louis Mercereau
8583af8290 chore: changeset 2022-04-07 09:34:46 +02:00
Pierre-Louis Mercereau
a28193a6ba docs: correct link to documentation 2022-04-07 09:30:15 +02:00
Johan Eliasson
60d85e5a69 init structure updates 2022-04-06 15:46:12 +02:00
Pierre-Louis Mercereau
9d6c64430a chore: remove rsuite toaster workaround 2022-04-06 15:44:57 +02:00
Pierre-Louis Mercereau
519d1bf5cb chore: prettier and lint fix 2022-04-06 15:39:29 +02:00
Pierre-Louis Mercereau
5ffb0320b5 docs: update examples to bump versions and to match the recommended hooks syntax 2022-04-06 15:31:58 +02:00
Johan Eliasson
50d2413554 Update README.md 2022-04-06 15:19:50 +02:00
Szilárd Dóró
7d275aad90 initialized Docusaurus project 2022-04-06 15:12:08 +02:00
Pierre-Louis Mercereau
6607e73cc2 fix: don't remove comments so they are present in the built .d.ts 2022-04-06 15:07:37 +02:00
Pilou
b4bac161a5 Merge pull request #344 from timpratim/patch-2
Separated the commands for installation
2022-04-06 12:56:28 +02:00
Pratim
37d15377c8 Separated the commands for installation
Separated the commands for installation according to the package managers.
2022-04-06 15:33:45 +05:30
Pilou
8ee1df3be4 Merge pull request #343 from nhost/changeset-release/main
chore: update versions
2022-04-06 10:50:29 +02:00
Pilou
47ffca945e Update package.json 2022-04-06 10:46:11 +02:00
Pilou
d60f5e623c Update CHANGELOG.md 2022-04-06 10:45:41 +02:00
Pilou
6f80643ee0 Update package.json 2022-04-06 10:45:10 +02:00
Pilou
8d5084725d Update CHANGELOG.md 2022-04-06 10:44:56 +02:00
Pilou
693498dd09 Update CHANGELOG.md 2022-04-06 10:37:39 +02:00
Pilou
4d36a966ea Update CHANGELOG.md 2022-04-06 10:37:02 +02:00
Pilou
239a075f1d Update CHANGELOG.md 2022-04-06 10:36:37 +02:00
github-actions[bot]
931194812e chore: update versions 2022-04-06 08:33:17 +00:00
Pilou
c8f80c58f3 Merge pull request #335 from nhost/refactor/correct-react-hook-signature
React hook signature & add promises to hook action results
2022-04-06 10:32:33 +02:00
Pilou
7fdb5aee0a Merge pull request #334 from nhost/docs/bump-version-examples
docs: bump dependencies of react-apollo and nextjs examples
2022-04-05 20:52:12 +02:00
Pilou
1710808fef Merge pull request #321 from nhost/docs/correct-hljs
docs: pass language to react-syntax-highlighter
2022-04-05 20:52:00 +02:00
Pilou
696815d4a8 Merge pull request #311 from nhost/306-the-useuserdata-hook-does-not-return-the-emailverified-or-phonenumberverified-user-properties
Add `emailVerified`, `phoneNumber`, `phoneNumberVerified`, and `activeMfaType` to User type, and add missing providers types
2022-04-05 20:51:42 +02:00
Pilou
5cc9be00b6 Merge pull request #341 from nhost/changeset-release/main
chore: update versions
2022-04-05 16:14:26 +02:00
github-actions[bot]
28dae23a91 chore: update versions 2022-04-05 14:02:46 +00:00
Pilou
7819e20cf4 Merge pull request #340 from nhost/elitan-patch-1
Correct OAuth provider link
2022-04-05 16:01:42 +02:00
Johan Eliasson
6be3758668 Create ninety-eels-lick.md 2022-04-05 15:56:18 +02:00
Johan Eliasson
658c67faf4 Update hasura-auth-client.ts 2022-04-05 15:54:39 +02:00
Pierre-Louis Mercereau
e7f3a5f6e0 chore: ellaborate changesets 2022-04-05 10:50:55 +02:00
Pierre-Louis Mercereau
7135aee78b chore: add changeset 2022-04-05 10:42:44 +02:00
Pierre-Louis Mercereau
587eaff734 feat: add promise with the current context to hooks actions 2022-04-04 20:45:12 +02:00
Pierre-Louis Mercereau
7cf875f4b8 refactor: deprecate the use of values end as hook parameters 2022-04-04 16:56:46 +02:00
Pierre-Louis Mercereau
657cfb91c5 docs: update corresponding swagger api 2022-04-04 10:42:09 +02:00
Pierre-Louis Mercereau
103dd6e98e Merge branch 'main' into 306-the-useuserdata-hook-does-not-return-the-emailverified-or-phonenumberverified-user-properties 2022-04-04 10:40:05 +02:00
Pierre-Louis Mercereau
3c8caa680b docs: bump dependencies of react-apollo and nextjs examples
and remove workaround related to https://github.com/rsuite/rsuite/issues/2336
2022-04-03 23:45:06 +02:00
Pilou
1bcee357fe Merge pull request #325 from nhost/docs/auth-refresh-expiration
docs: change default refresh token expiration to 30 days
2022-04-03 22:32:21 +02:00
Pierre-Louis Mercereau
b729aa9290 ci: fix pnpm/npm/changeset 2022-04-03 22:26:58 +02:00
Pilou
57780ee645 Merge pull request #333 from nhost/changeset-release/main
chore: update versions
2022-04-03 15:35:58 +02:00
github-actions[bot]
aad8d22380 chore: update versions 2022-04-03 13:28:59 +00:00
Pilou
85d33c4de0 Merge pull request #332 from nhost/fix/auto-signin
fix: correct auto-signin bug introducted in previous version
2022-04-03 15:28:16 +02:00
Pierre-Louis Mercereau
ab3e2dcee9 refactor: remove log 2022-04-03 15:22:11 +02:00
Pierre-Louis Mercereau
12f4504b61 refactor: remove incorrect and unused snapshot script 2022-04-03 15:19:00 +02:00
Pierre-Louis Mercereau
71d7a11c96 refactor: correct script 2022-04-03 15:11:48 +02:00
Pierre-Louis Mercereau
16a6c5073e fix: correct auto-signin bug introducted in previous version 2022-04-03 15:05:13 +02:00
Pilou
3fcc86792a Merge branch 'main' into main 2022-04-03 13:40:31 +02:00
Pierre-Louis Mercereau
27909128e4 chore: bump versions to fix the workspace/package link bug 2022-04-02 11:25:38 +02:00
Pierre-Louis Mercereau
72371c72a1 chore: bump versions 2022-04-02 10:58:56 +02:00
Pierre-Louis Mercereau
d878414b10 ci: freeze node version 2022-04-02 10:52:27 +02:00
Pierre-Louis Mercereau
9b840f7c4a docs: change default refresh token expiration to 30 days 2022-04-01 21:15:40 +02:00
Pilou
4fd09b4080 Merge pull request #316 from nhost/changeset-release/main
chore: update versions
2022-04-01 16:18:58 +02:00
Pilou
bdb786fa83 Merge pull request #313 from chrtze/patch-2
Update hooks.mdx
2022-04-01 13:35:56 +02:00
Pierre-Louis Mercereau
d42be972b4 Merge branch 'main' into patch-2 2022-04-01 13:31:25 +02:00
Pierre-Louis Mercereau
5920c830b3 docs: minor adjustments 2022-04-01 13:25:32 +02:00
Pilou
5fc16653c0 Update index.mdx 2022-04-01 08:50:49 +02:00
Pilou
900ec48889 Update index.mdx 2022-04-01 08:45:55 +02:00
Pierre-Louis Mercereau
83d3c90f43 docs: pass language to react-syntax-highlighter 2022-03-31 21:57:40 +02:00
github-actions[bot]
cf20ee5a8f chore: update versions 2022-03-31 14:45:03 +00:00
Pilou
9180154325 Merge pull request #231 from nhost/hasura-auth-documentation
Hasura auth documentation
2022-03-31 16:44:19 +02:00
Pilou
1ae025b745 Merge pull request #310 from nhost/309-nhostclient-constructor-error-using-expo
fix: check if `window.location` exists
2022-03-31 16:16:55 +02:00
Pilou
ba538a4ad9 Merge pull request #315 from nhost/fix/wait-authentication-loaded
fix(sdk): wait for the authentication status to be known before executing auth actions
2022-03-31 16:15:07 +02:00
Szilárd Dóró
0e5e47b8f8 Merge pull request #314 from nhost/fix/token-refresh-usequery
fix: Query refetch and leaking GraphQL subscription
2022-03-31 15:06:05 +02:00
Szilárd Dóró
113beed447 added changeset 2022-03-31 14:53:10 +02:00
Pierre-Louis Mercereau
6eeb9d2e65 fix(sdk): wait for the authentication status to be known before executing auth actions 2022-03-31 14:47:31 +02:00
Szilárd Dóró
3db2959bc2 fixed query refetch and leaking GraphQL subscriptions when issuing new JWT token 2022-03-31 14:23:33 +02:00
Pierre-Louis Mercereau
16fcc08b0a refactor: simplify code 2022-03-31 13:53:08 +02:00
Christopher Möller
5b098c8ef4 Update hooks.mdx 2022-03-31 12:51:37 +02:00
Pierre-Louis Mercereau
058956bdcb feat: update types 2022-03-31 12:27:47 +02:00
Pierre-Louis Mercereau
d3384614b4 fix: typeof window still needs to be used 2022-03-31 11:28:16 +02:00
Pierre-Louis Mercereau
0064fccb12 docs: last missing suggestions 2022-03-31 11:25:16 +02:00
Pierre-Louis Mercereau
6efd45fcb7 docs: take suggestions into account - missing pieces 2022-03-31 11:23:22 +02:00
Pierre-Louis Mercereau
4420c0e070 fix: check if window.location exists 2022-03-31 11:18:05 +02:00
Pierre-Louis Mercereau
354b07947a docs(hasura-auth): update swagger to hasura-auth 0.5.0 2022-03-31 11:01:16 +02:00
Pierre-Louis Mercereau
2fa5c10e14 chore: merge main 2022-03-31 08:57:07 +02:00
Pierre-Louis Mercereau
94124c7754 docs: improve explainations 2022-03-31 08:54:49 +02:00
Johan Eliasson
e405b738a6 Update README.md (#307) 2022-03-30 16:19:30 +02:00
Pierre-Louis Mercereau
947b7e037f fix: correct dependency bump 2022-03-29 16:33:40 +02:00
github-actions[bot]
cd6f37f2a6 chore: update versions (#304)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-03-29 16:11:46 +02:00
Pilou
39df4d5b9c Deprecate useAuthLoading and introduce useAuthenticationStatus (#303)
* fix(react): keep authentication and loading status in sync

fix #302

* style: typo
2022-03-29 13:21:50 +02:00
Pierre-Louis Mercereau
63ee1d7659 docs: correct typo and code blocks 2022-03-28 17:18:58 +02:00
Pierre-Louis Mercereau
eb33952760 docs: take Szilard's comments into account 2022-03-28 14:18:59 +02:00
Pilou
e91215bbac Docs/nextjs (#299)
* fix: correct access to user/session information through getUser/getSession/isReady

* chore: use carret instead of star

* docs: explain all react hooks are available from @nhost/nextjs

* docs: correct imports in nextjs example

* chore: remove orphan changeset

* docs: next.js instead of NextJs
2022-03-28 14:16:41 +02:00
github-actions[bot]
ccaa4c4bba chore: update versions (#300)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-03-28 10:11:31 +02:00
Pilou
ab36f90cec fix: correct access to user/session information through getUser/getSession/isReady (#298)
* fix: correct access to user/session information through getUser/getSession/isReady

* chore: use carret instead of star
2022-03-28 10:09:38 +02:00
Johan Eliasson
cfbe2db430 fix: make it clear the @nhost/react-auth package is depricated (#297)
* fix: make it clear this package is depricated

* Update README.md

Co-authored-by: Pilou <24897252+plmercereau@users.noreply.github.com>
2022-03-28 09:57:55 +02:00
Pilou
6838ac6201 docs: fix deadlinks in README (#256) 2022-03-25 15:38:19 +00:00
Johan Eliasson
0caf43037d fix: updated react apollo crm package versions (#296)
* update

* update
2022-03-25 16:33:30 +01:00
Pilou
4ed626d5b5 chore: bump fixed versions in examples (#257)
* chore: bump fixed versions in examples

* chore: bump to latest sdk version

* chore: bump to latest version

* chore: bump example version
2022-03-25 14:49:35 +00:00
github-actions[bot]
9ff9abee6a chore: update versions (#293)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-03-25 11:50:45 +00:00
Pilou
9d3f0521a5 fix: keep location.hash in email redirections (#294)
In the next cycle, hasura-auth will only send the refresh token in the hash, and will add the
redirection type as a query parameter. We will then be able to remove/hide the hash from the url as
soon as the refresh token has been used
2022-03-25 11:34:41 +00:00
Pilou
744fd6929f Unify @nhost/react and @nhost/nhost-js (#273)
* chore: rename `@nhost/client` to `@nhost/core`

* chore: refactor hasura-auth-js to use @nhost/core

all existing tests pass

* refactor: adapt syntax to react, and rename machine to authMachine

* refactor: rename to authmachine and remove useless license files

pnpm uses the root license file when publishing packages

* feat: totp login+password

* refactor: passwordless sms, mfa, deanonymize

* refactor: state/value mfa code

* refactor: rename

* refactor: auth status and token change events

* refactor: adjust apollo to original syntax, and sync auth session accross all nhost-js sub-clients

* refactor: revert changelog and adjust documentation

* refactor: adjust to the shape-up signatures

* refactor: make nextjs work with the new system

* refactor: allow async storage getters and setters

* refactor: implement refreshSession

* chore: fix pnpm lock file

* docs: change NhostReactProvider to NhostNextProvider

* chore: changesets

* refactor: change signup/signin hooks signatures as per Johan's request

* refactor: remove `nhost.auth.verifyEmail`

* chore: add changeset

* docs: add mfa to the react example, and adjust examples to the new conventions

* feat: allow oauth providers to get options

* fix: sync sdk client with the machine state

* fix: don't use state.matches and state.hasTag in useSelector, and improve useSelectors

* refactor: set oauth options everywhere, document, and rewrite relative redirectTo

* chore: update pnpm lock file

* fix: correct paths to cjs dist file, and reactivate warning suppression about useLayoutEffect

* chore: keep the same parameters in the React Apollo providers

* refactor: use the new system in @nhost/react-auth, and mark it as deprecated

* chore: @nhost/react-auth changeset

* chore: update pnpm lock file

* docs: remove todos and point to the documenation when it exists

* docs: name files `.tsx` instead of `.jsx`

* refactor: retro-compatible clientStorageType and clientStorage options

* refactor: improve hooks names consistency

See https://github.com/nhost/nhost/pull/273#discussion_r829058348

* chore: don't override changelog

* refactor: bump hasura-auth to version 0.4.2

* refactor: move @apollo/client to a peer dependency

This was the case in the origination @nhost/react-apollo package

* refactor: prettier

* refactor: rename useConfigMfa properties

* chore: ellaborate changesets

* refactor: rename `anonymousSignIn` to `signInAnonymous`

* docs: correct typo

* refactor: rename anonymous signin hook

* refactor: use @nhost/nextjs instead of @nhost/react in Nextjs documentation

* chore: explain renaming from @nhost/client to @nhost/core

* chore: changeset

* chore: complete sentence in changeset
2022-03-24 20:37:56 +00:00
Szilárd Dóró
f43f52e766 updated react-apollo changelog (#292) 2022-03-24 12:33:31 +00:00
github-actions[bot]
fd4c54ee91 chore: update versions (#290)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-03-24 09:58:40 +00:00
Szilárd Dóró
b30ff6f507 fix: Auth header condition check (#291)
* fixed auth header conditions in storage functions

* fixed lint errors in hasura-storage-js package

* removed patch changeset file
2022-03-24 09:56:25 +00:00
Pilou
ff7ae21a87 feat: admin secret for storage (#289)
* added Hasura Admin Secret support to storage functions

* @nhost/hasura-storage-js changelog

Co-authored-by: Szilárd Dóró <szilard.doro@bishop.hu>
2022-03-23 16:55:30 +00:00
Pierre-Louis Mercereau
b2c398df22 docs: redirections 2022-03-23 14:35:05 +00:00
Pierre-Louis Mercereau
888192282f docs: hide missing chapters, and add todos 2022-03-23 14:23:07 +00:00
Pierre-Louis Mercereau
945b557dea docs: totp 2022-03-23 14:17:16 +00:00
Pierre-Louis Mercereau
4031d8a9e1 docs: smtp settings 2022-03-23 13:21:49 +00:00
Pierre-Louis Mercereau
c77aa16181 docs: email templates 2022-03-23 13:04:36 +00:00
Pierre-Louis Mercereau
ea2fb2e9a4 docs: extending user schema 2022-03-23 12:50:47 +00:00
Pierre-Louis Mercereau
e147487e27 docs: fix bullet points 2022-03-23 12:39:57 +00:00
Pierre-Louis Mercereau
6f52652e10 docs: hasura integration 2022-03-23 11:49:43 +00:00
Pierre-Louis Mercereau
1a8d9b5c28 docs: overview 2022-03-23 11:39:37 +00:00
Pierre-Louis Mercereau
9111299ddd docs: email passwordless 2022-03-23 11:27:31 +00:00
Pierre-Louis Mercereau
1c7f520073 docs: minor reshape 2022-03-23 11:09:26 +00:00
Pierre-Louis Mercereau
dff37a4cd0 docs: email and password checks 2022-03-23 11:04:53 +00:00
Pierre-Louis Mercereau
96a572379e docs: gravatar 2022-03-23 10:46:17 +00:00
Pierre-Louis Mercereau
da3bbf2e10 chore: update pnpm lockfile 2022-03-23 10:09:13 +00:00
Pierre-Louis Mercereau
a11fa372ff chore: merge main 2022-03-22 12:59:49 +00:00
Jerry Jäppinen
6d2c7b26c0 Formatting and paths (#285) 2022-03-21 15:23:09 +00:00
Pierre-Louis Mercereau
47c57ff665 ci: scope ci script 2022-03-10 13:12:08 +01:00
Pierre-Louis Mercereau
1cb330016b ci: wrap up 2022-03-10 13:06:17 +01:00
Pierre-Louis Mercereau
497652d1b4 ci: cd, not cp 2022-03-10 13:00:22 +01:00
Pierre-Louis Mercereau
20eb7aa381 ci: correct cp 2022-03-10 12:58:54 +01:00
Pierre-Louis Mercereau
4a3c2f92b1 ci: correct cp arg 2022-03-10 12:57:38 +01:00
Pierre-Louis Mercereau
5647e64265 ci: copy existing nhost project 2022-03-10 12:55:43 +01:00
Pierre-Louis Mercereau
c113debf46 ci: again 2022-03-10 12:52:49 +01:00
Pierre-Louis Mercereau
3f0ae4a58c ci: manually create nhost project 2022-03-10 12:50:36 +01:00
Pierre-Louis Mercereau
3d5b8183e8 ci: deactivate nhost 2022-03-10 12:47:38 +01:00
Pierre-Louis Mercereau
789ef8f783 ci: exec nhost in tmp 2022-03-10 12:44:45 +01:00
Pierre-Louis Mercereau
94df175ca3 ci: remove testing project 2022-03-10 12:41:24 +01:00
Pierre-Louis Mercereau
c8bcefb0e5 ci: remove testing project 2022-03-10 12:40:20 +01:00
Pierre-Louis Mercereau
fc52f59eb8 ci: again 2022-03-10 12:37:39 +01:00
Pierre-Louis Mercereau
a80389e5c7 ci: again 2022-03-10 12:30:57 +01:00
Pierre-Louis Mercereau
923276422b ci: desesperant 2022-03-10 12:28:43 +01:00
Pierre-Louis Mercereau
7c9192f3a0 ci: correct 2022-03-10 12:24:33 +01:00
Pierre-Louis Mercereau
51d139b7aa ci: single ci command 2022-03-10 12:21:58 +01:00
Pierre-Louis Mercereau
8fe1bdb6f7 ci: deactivate cache 2022-03-10 12:19:01 +01:00
Pierre-Louis Mercereau
5b288bc0d1 ci: add options 2022-03-10 12:18:38 +01:00
Pierre-Louis Mercereau
27cd769c76 ci: frozen lockfile 2022-03-10 12:16:08 +01:00
Pierre-Louis Mercereau
5bb370869d ci: clean 2022-03-10 12:13:57 +01:00
Pierre-Louis Mercereau
ec68f64db4 ci: 1.1.5 2022-03-10 12:11:48 +01:00
Pierre-Louis Mercereau
4cf8f146c9 ci: another turbo version 2022-03-10 12:08:16 +01:00
Pierre-Louis Mercereau
61cf317541 ci: decrease pnpm version 2022-03-10 12:04:03 +01:00
Pierre-Louis Mercereau
a2066c9b41 ci: increase depth 2022-03-10 12:02:25 +01:00
Pierre-Louis Mercereau
817b152704 ci: pwd 2022-03-10 12:00:40 +01:00
Pierre-Louis Mercereau
cc73494c91 ci: installl again 2022-03-10 11:58:05 +01:00
Pierre-Louis Mercereau
64ed4083b9 ci: reverse version 2022-03-10 11:54:12 +01:00
Pierre-Louis Mercereau
77e8c58cc6 ci: downgrade turborepo 2022-03-10 11:48:33 +01:00
Pierre-Louis Mercereau
0cd2eab309 ci: debug 2022-03-10 11:43:58 +01:00
Pierre-Louis Mercereau
7d8c843c74 ci: deactivate turbo cache 2022-03-10 11:41:34 +01:00
Pierre-Louis Mercereau
da1c2d6914 ci: add src to files 2022-03-10 11:38:58 +01:00
Pierre-Louis Mercereau
3a949301f9 ci: remove scope 2022-03-10 11:34:43 +01:00
Pierre-Louis Mercereau
585eebab49 ci: updated packages 2022-03-10 11:30:05 +01:00
Pierre-Louis Mercereau
45c3e4686e ci: debug 2022-03-10 11:26:04 +01:00
Pierre-Louis Mercereau
52f2e67952 ci: install dependencies 2022-03-10 11:22:24 +01:00
Pierre-Louis Mercereau
929774aa5b ci: matrix 2022-03-10 11:21:04 +01:00
Pierre-Louis Mercereau
e711e338e7 ci: clean ci 2022-03-10 11:18:56 +01:00
Pierre-Louis Mercereau
4235eb812e Merge branch 'main' into hasura-auth-documentation 2022-03-04 09:59:48 +01:00
Pierre-Louis Mercereau
ed145234b2 Merge branch 'main' into hasura-auth-documentation 2022-03-04 09:52:42 +01:00
Pierre-Louis Mercereau
7c2597ddc7 chore: merge main 2022-03-04 09:52:11 +01:00
Pierre-Louis Mercereau
2b1f8182f2 docs: add hasura auth schema 2022-03-03 11:09:15 +01:00
Pierre-Louis Mercereau
ded9e7637a chore: fix lockfile 2022-02-24 22:31:07 +01:00
Pilou
c42fb85bae Merge branch 'main' into hasura-auth-documentation 2022-02-24 22:26:44 +01:00
Pierre-Louis Mercereau
33edc4291b docs(hasura-auth): structure documentation 2022-02-24 22:25:17 +01:00
Pierre-Louis Mercereau
df89d804c5 docs(hasura-auth): complete openapi documentation 2022-02-24 21:55:08 +01:00
Pierre-Louis Mercereau
89da44d715 docs: update hasura-auth swagger 2022-02-24 17:32:01 +01:00
Pierre-Louis Mercereau
789faad645 docs: add hasura-auth swagger documentation 2022-02-24 15:59:20 +01:00
Pierre-Louis Mercereau
8c7267cbee chore: merge main 2022-02-24 14:21:27 +01:00
Pilou
96c12ffff1 Correct typo 2022-02-19 13:01:15 +01:00
Pierre-Louis Mercereau
783729a6f6 docs(hasura-auth): move docs to the right directory and adjust the menu 2022-02-10 23:09:30 +01:00
Pierre-Louis Mercereau
60d4dbabdf Merge branch 'main' into hasura-auth-documentation 2022-02-10 22:47:07 +01:00
Pierre-Louis Mercereau
a77ddcdbc2 docs: document hasura-auth v0.2 features 2022-02-03 12:11:16 +01:00
Pierre-Louis Mercereau
f4c8a776a4 docs(wip): basic installation information 2022-02-01 10:37:11 +01:00
Pierre-Louis Mercereau
efbaf08483 docs(wip): add hasura-auth documentation 2022-02-01 10:02:38 +01:00
803 changed files with 40706 additions and 66528 deletions

View File

@@ -18,5 +18,7 @@ module.exports = {
useTabs: false
}
}
]
],
importOrderSeparation: true,
importOrderSortSpecifiers: true
}

1
.github/CODEOWNERS vendored
View File

@@ -2,6 +2,7 @@
# https://help.github.com/en/articles/about-code-owners
/packages @plmercereau
/packages/docgen @szilarddoro
/.github/workflows @plmercereau
/docs/ @guicurcio
/examples/ @plmercereau @guicurcio @FuzzyReason

View File

@@ -16,29 +16,33 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache pnpm modules
uses: actions/cache@v2
- name: Checkout repository
uses: actions/checkout@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
fetch-depth: 0
- uses: pnpm/action-setup@v2.1.0
with:
version: 6.32.3
run_install: true
# run_install: true
- name: Use Node.js 17
uses: actions/setup-node@v2
with:
node-version: '17.8.0'
cache: 'pnpm'
- name: Pick the right npm version
# * See: https://github.com/pnpm/pnpm/issues/4348
run: npm install --global npm@8.4
- name: Install dependencies
run: pnpm install
- name: Create PR or Publish release
id: changesets
uses: changesets/action@v1
with:
version: pnpm ci:version
version: pnpm run ci:version
commit: 'chore: update versions'
title: 'chore: update versions'
publish: pnpm release
publish: pnpm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

15
.github/workflows/contributors.yaml vendored Normal file
View File

@@ -0,0 +1,15 @@
name: Add contributors
on:
push:
branches:
- main
jobs:
contrib-readme-job:
runs-on: ubuntu-latest
name: A job to automate contrib in readme
steps:
- name: Contribute List
uses: akhilmhdh/contributors-readme-action@v2.3.4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

7
.gitignore vendored
View File

@@ -15,7 +15,6 @@ logs/
/.vscode/
.eslintcache
.yarnclean
.husky
# Directories
coverage/
@@ -50,4 +49,8 @@ todo.md
.netlify
.monorepo-example
.next
.next
# TypeDoc output
.docgen

1
.husky/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
_

4
.husky/pre-commit Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged

6
.lintstagedrc.json Normal file
View File

@@ -0,0 +1,6 @@
{
"packages/(docgen|hasura-auth-js|hasura-storage-js|nextjs|nhost-js|react|core)/src/**/*.{js,ts,jsx,tsx}": [
"pnpm docgen",
"git add docs"
]
}

View File

@@ -24,6 +24,8 @@ If you find an Issue that addresses the problem you're having, please add your r
### Pull Requests
Please have a look at our [developers guide](https://github.com/nhost/nhost/blob/main/DEVELOPERS.md) to start coding!
PRs to our libraries are always welcome and can be a quick way to get your fix or improvement slated for the next release. In general, PRs should:
- Only fix/add the functionality in question **OR** address wide-spread whitespace/style issues, not both.

79
DEVELOPERS.md Normal file
View File

@@ -0,0 +1,79 @@
# Developer guide
## Requirements
- We use [pnpm](https://pnpm.io/) as a package manager to fasten development and builds, and as a backbone to our monorepo. You have to make sure it is installed in your machine. There are [multiple ways to install it](https://pnpm.io/installation), but the easiest way is with `npm`:
```sh
npm install -g pnpm
```
- Our tests and examples are using the Nhost CLI to run the backend services locally. You can follow the instructions to install it in [our documentation](https://docs.nhost.io/get-started/cli-workflow/install-cli)
## Getting things ready
First, clone this repository:
```sh
git clone https://github.com/nhost/nhost
```
Then, install the dependencies with `pnpm`:
```sh
cd nhost
pnpm install
```
## Starting development from an example
Let's follow the instructions to start [react-apollo example](https://github.com/nhost/nhost/blob/main/examples/react-apollo/README.md).
## Running the documentation website locally
The easier way to contribute to our documentation is to move to the `docs` folder and follow the [instructions to start local development](https://github.com/nhost/nhost/blob/main/docs/README.md):
```sh
cd docs
# not necessary step if you've done this step already anywhere in the repository
pnpm install
pnpm start
```
## Testing
In order to run tests, the Nhost testing backend should run locally. You can start it in from a separate terminal:
```sh
cd examples/testing-project
nhost -d
```
Once Nhost started locally, you can run the tests from the root folder of the repository with the following command:
```sh
pnpm test
```
## Changesets
If you made some changes in the packages, you will have to describe these changes so they will be taken into account in the next release.
We are using [changesets](https://github.com/changesets/changesets) to support our version/publish workflows. When submitting a pull request, a bot will check if some changesets are present, and if not, will guide you to add them.
The most comprehensive way to add a changeset is to run the following command from the root directory of the repository:
```sh
pnpm changeset
```
This will generate a file in the `.changeset` directory. You can edit it to give further details about the change you just made.
You can have a look at the changesets documentation on [how to add a changeset](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md)
## Commiting changes
You may notice `git commit` takes a few seconds to run. We set a commit hook that scan the changes in the code, automatically generates the documentation from the inline [TSDoc](https://tsdoc.org/) annotations, and add these generated documentation files to the commit. They will automatically update the [reference documentation](https://docs.nhost.io/reference).
<!-- ## Good practices
- lint
- prettier
- documentation -->

246
README.md
View File

@@ -1,8 +1,8 @@
<div align="center">
<img width="237" src="https://raw.githubusercontent.com/nhost/nhost/main/assets/logo.png"/>
![Nhost](https://imgur.com/fGo6E4d.png)
<br />
<br />
<div align="center">
# Nhost
<a href="https://docs.nhost.io/get-started">Quickstart</a>
<span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
@@ -20,9 +20,9 @@
<hr />
</div>
**Nhost is a serverless backend for web and mobile apps** built with the following things in mind:
**Nhost is an open-source GraphQL backend,** built with the following things in mind:
- Open Source
- Open-Source
- Developer Productivity
- SQL
- GraphQL
@@ -36,6 +36,8 @@ Nhost consists of open source software:
- Serverless Functions: Node.js (JavaScript and TypeScript)
- [Nhost CLI](https://docs.nhost.io/reference/cli) for local development
## Architecture of Nhost
<div align="center">
<br />
<img src="assets/nhost-diagram.png"/>
@@ -96,11 +98,11 @@ Nhost is frontend agnostic, which means Nhost works with all frontend frameworks
Nhost libraries and tools
- [JavaScript/TypeScript SDK](https://docs.nhost.io/reference/sdk)
- [JavaScript/TypeScript SDK](https://docs.nhost.io/reference/javascript)
- [Dart and Flutter SDK](https://github.com/nhost/nhost-dart)
- [Nhost CLI](https://docs.nhost.io/reference/cli)
- [Nhost React Auth](https://docs.nhost.io/reference/supporting-libraries/react-auth)
- [Nhost React Apollo](https://docs.nhost.io/reference/supporting-libraries/react-apollo)
- [Nhost React](https://docs.nhost.io/reference/react)
- [Nhost Next.js](https://docs.nhost.io/reference/nextjs)
## Community ❤️
@@ -108,7 +110,7 @@ First and foremost: **Star and watch this repository** to stay up-to-date.
Also, follow Nhost on [GitHub Discussions](https://github.com/nhost/nhost/discussions), our [Blog](https://nhost.io/blog), and on [Twitter](https://twitter.com/nhostio). You can chat with the team and other members on [Discord](https://discord.com/invite/9V7Qb2U) and follow our tutorials and other video material at [YouTube](https://www.youtube.com/channel/UCJ7irtvV9Y0EQMxpabb6ntg?view_as=subscriber).
## Nhost is Open Source
### Nhost is Open Source
This repository, and most of our other open source projects, are licensed under the MIT license.
@@ -118,8 +120,226 @@ Here are some ways of contributing to making Nhost better:
- **[Try out Nhost](https://docs.nhost.io/get-started/quick-start)**, and think of ways to make the service better. Let us know here on GitHub.
- Join our [Discord](https://discord.com/invite/9V7Qb2U) and connect with other members to share and learn from.
- Send a pull request to any of our [open source repositories](https://github.com/nhost) on Github. Check our [contribution guide](https://github.com/nhost/nhost/blob/main/CONTRIBUTING.md) for more details about how to contribute. We're looking forward to your contribution!
- Send a pull request to any of our [open source repositories](https://github.com/nhost) on Github. Check our [contribution guide](https://github.com/nhost/nhost/blob/main/CONTRIBUTING.md) and our [developers guide](https://github.com/nhost/nhost/blob/main/DEVELOPERS.md) for more details about how to contribute. We're looking forward to your contribution!
## Security
### Contributors
If you discover a security vulnerability within Nhost, please e-mail [security@nhost.io](mailto:security@nhost.io). All security vulnerabilities will be promptly addressed.
<!-- readme: contributors -start -->
<table>
<tr>
<td align="center">
<a href="https://github.com/plmercereau">
<img src="https://avatars.githubusercontent.com/u/24897252?v=4" width="100;" alt="plmercereau"/>
<br />
<sub><b>Pilou</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/elitan">
<img src="https://avatars.githubusercontent.com/u/331818?v=4" width="100;" alt="elitan"/>
<br />
<sub><b>Johan Eliasson</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/szilarddoro">
<img src="https://avatars.githubusercontent.com/u/310881?v=4" width="100;" alt="szilarddoro"/>
<br />
<sub><b>Szilárd Dóró</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/nunopato">
<img src="https://avatars.githubusercontent.com/u/1523504?v=4" width="100;" alt="nunopato"/>
<br />
<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>
<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/sebagudelo">
<img src="https://avatars.githubusercontent.com/u/43288271?v=4" width="100;" alt="sebagudelo"/>
<br />
<sub><b>Sebagudelo</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/mrinalwahal">
<img src="https://avatars.githubusercontent.com/u/9859731?v=4" width="100;" alt="mrinalwahal"/>
<br />
<sub><b>Mrinal Wahal</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/gdangelo">
<img src="https://avatars.githubusercontent.com/u/4352286?v=4" width="100;" alt="gdangelo"/>
<br />
<sub><b>Grégory D'Angelo</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"/>
<br />
<sub><b>Vadim Smirnov</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/subhendukundu">
<img src="https://avatars.githubusercontent.com/u/20059141?v=4" width="100;" alt="subhendukundu"/>
<br />
<sub><b>Subhendu Kundu</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/chrtze">
<img src="https://avatars.githubusercontent.com/u/3797215?v=4" width="100;" alt="chrtze"/>
<br />
<sub><b>Christopher Möller</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/dbarrosop">
<img src="https://avatars.githubusercontent.com/u/6246622?v=4" width="100;" alt="dbarrosop"/>
<br />
<sub><b>David Barroso</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/hajek-raven">
<img src="https://avatars.githubusercontent.com/u/7288737?v=4" width="100;" alt="hajek-raven"/>
<br />
<sub><b>Filip Hájek</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/GavanWilhite">
<img src="https://avatars.githubusercontent.com/u/2085119?v=4" width="100;" alt="GavanWilhite"/>
<br />
<sub><b>Gavan Wilhite</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/jerryjappinen">
<img src="https://avatars.githubusercontent.com/u/1101002?v=4" width="100;" alt="jerryjappinen"/>
<br />
<sub><b>Jerry Jäppinen</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/mustafa-hanif">
<img src="https://avatars.githubusercontent.com/u/30019262?v=4" width="100;" alt="mustafa-hanif"/>
<br />
<sub><b>Mustafa Hanif</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></tr>
<tr>
<td align="center">
<a href="https://github.com/Savinvadim1312">
<img src="https://avatars.githubusercontent.com/u/16936043?v=4" width="100;" alt="Savinvadim1312"/>
<br />
<sub><b>Savin Vadim</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/ahmic">
<img src="https://avatars.githubusercontent.com/u/13452362?v=4" width="100;" alt="ahmic"/>
<br />
<sub><b>Amir Ahmic</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/akd-io">
<img src="https://avatars.githubusercontent.com/u/30059155?v=4" width="100;" alt="akd-io"/>
<br />
<sub><b>Anders Kjær Damgaard</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/heygambo">
<img src="https://avatars.githubusercontent.com/u/449438?v=4" width="100;" alt="heygambo"/>
<br />
<sub><b>Christian Gambardella</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/rustyb">
<img src="https://avatars.githubusercontent.com/u/53086?v=4" width="100;" alt="rustyb"/>
<br />
<sub><b>Colin Broderick</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/dohomi">
<img src="https://avatars.githubusercontent.com/u/489221?v=4" width="100;" alt="dohomi"/>
<br />
<sub><b>Dominic Garms</b></sub>
</a>
</td></tr>
<tr>
<td align="center">
<a href="https://github.com/alveshelio">
<img src="https://avatars.githubusercontent.com/u/8176422?v=4" width="100;" alt="alveshelio"/>
<br />
<sub><b>Helio Alves</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/nkhdo">
<img src="https://avatars.githubusercontent.com/u/26102306?v=4" width="100;" alt="nkhdo"/>
<br />
<sub><b>Hoang Do</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>
<td align="center">
<a href="https://github.com/ghoshnirmalya">
<img src="https://avatars.githubusercontent.com/u/6391763?v=4" width="100;" alt="ghoshnirmalya"/>
<br />
<sub><b>Nirmalya Ghosh</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/quentin-decre">
<img src="https://avatars.githubusercontent.com/u/1137511?v=4" width="100;" alt="quentin-decre"/>
<br />
<sub><b>Quentin Decré</b></sub>
</a>
</td>
<td align="center">
<a href="https://github.com/komninoschat">
<img src="https://avatars.githubusercontent.com/u/29049104?v=4" width="100;" alt="komninoschat"/>
<br />
<sub><b>Komninos</b></sub>
</a>
</td></tr>
</table>
<!-- readme: contributors -end -->

View File

@@ -1,17 +0,0 @@
{
"root": true,
"extends": ["next", "prettier"],
"rules": {
"@next/next/no-img-element": "off",
"import/no-default-export": "off",
"react/self-closing-comp": "warn",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/no-unescaped-entities": "off",
"react/prop-types": "off",
"jsx-a11y/anchor-is-valid": "off",
"no-console": "warn"
},
"parser": "@typescript-eslint/parser",
"settings": { "react": { "version": "detect" } }
}

22
docs/.gitignore vendored
View File

@@ -1,2 +1,20 @@
!lib
!.prettierignore
# Dependencies
/node_modules
# Production
/build
# Generated files
.docusaurus
.cache-loader
# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*

View File

@@ -1,2 +0,0 @@
node_modules/
.next/

11
docs/.prettierrc.json Normal file
View File

@@ -0,0 +1,11 @@
{
"singleQuote": true,
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": false,
"endOfLine": "auto",
"semi": true
}

View File

@@ -1,6 +0,0 @@
# nhost-documentation
## null
### Patch Changes
- 03562af: Build in CommonJS and ESM instead of UMD and ESM as the UMD bundle generated by the default Vite lib build mode doesn't work with NodeJS

View File

@@ -1,46 +1,37 @@
# Nhost Documentation
# Nhost Docs
## Get started
This documentation describes how to build, start and test the documentation locally.
From the **root** of the `nhost/nhost` repository:
### Installation
```bash
pnpm run clean:all
pnpm i
cd docs
pnpm run dev
$ pnpm i
```
### Local Development
## Structure
The `order.ts` file contains the main order for the entire structure of `posts`. The keys are `categories` and the values are `subcategories` in which contains the order the posts.
```
export const orderTwo = {
'get-started': {
'quick-start': ['index', 'schema', 'javascript-client', 'permissions'],
authentication: ['index'],
'cli-workflow': ['index', 'workflow-setup', 'install-cli', 'local-changes', 'metadata-and-serverless-functions'],
upgrade: ['index']
},
platform: {
database: ['index', 'permissions', 'graphql'],
authentication: ['index', 'user-management', 'sign-in-methods', 'social-login', 'email-templates'],
storage: ['index'],
'serverless-functions': ['index', 'event-triggers'],
nhost: ['index', 'environment-variables', 'github-integration', 'local-development']
},
reference: {
sdk: ['index', 'graphql', 'authentication', 'storage', 'functions'],
cli: ['index'],
'supporting-libraries': ['react-apollo', 'react-auth']
}
};
```bash
$ pnpm start
```
Metadata such as the `title` of the file that appears on the nav is on the frontmatter of each markdown file. The file name becomes the final url. Each top-level folder appears on the header as main navigation, each subfolder becomes a main subcategory of the nav and posts are included under each subcategory.
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
In order to create a new file you place it its proper subcategory and modify the category on the `order.ts` file such as `sdk: ["javascript-sdk", "react-auth", "react-apollo"],` -> `sdk: ["javascript-sdk", "react-auth", "vue"]`
### Build
Each subCategory e.g. `reference` or `tutorials` has an `index.mdx` file. If a new subcategory is added, a file has to be created for it.
```bash
$ pnpm build
```
This command generates static content into the `build` directory and can be served using any static contents hosting service.
### Serve
```bash
$ pnpm serve
```
This command serves the static content from the `build` directory.
### Contributing
All pull requests are greatly appreciated! See our [contributing guide](https://github.com/nhost/nhost/blob/main/CONTRIBUTING.md) to get started.

3
docs/babel.config.js Normal file
View File

@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};

View File

@@ -1,81 +0,0 @@
import Text from '@/components/ui/Text'
import { motion } from 'framer-motion'
import { useRouter } from 'next/dist/client/router'
import React, { useState } from 'react'
import createKebabCase from '../utils/createKebabCase'
import Permalink from './icons/Permalink'
export interface AnchorLinkProps {
children?: any
id?: string
size?: 'tiny' | 'small' | 'normal' | 'large' | 'big' | 'heading'
className?: string
}
export default function AnchorLink({ children, id, size, className }: AnchorLinkProps) {
const {
query: { category, subcategory, post }
} = useRouter()
const [showPermaLink, setShowPermalink] = useState(false)
const isQuoted = typeof children !== 'string'
return (
<div
id={
id
? children.split('/')[1]
: createKebabCase(
`#${isQuoted ? (children.props ? children.props.children : children) : children}`
)
}
className={className}
onMouseOver={() => setShowPermalink(true)}
onMouseLeave={() => setShowPermalink(false)}
>
<span id={createKebabCase(`${children}`)} className={'flex flex-row relative'}>
{showPermaLink ? (
<motion.span
className="absolute self-center w-4 h-4 align-middle -left-5"
onClick={() => {
navigator.clipboard
.writeText(
`https://docs.nhost.io/${category}/${subcategory}/${post}/${
id
? id
: createKebabCase(
`#${
isQuoted
? children.props
? children.props.children
: children
: children
}`
)
}`
)
.catch((e) => {
// eslint-disable-next-line no-console
console.log(e)
})
}}
>
<Permalink className="w-4 h-4" />
</motion.span>
) : (
<></>
)}
<Text
variant="a"
href={createKebabCase(
`#${isQuoted ? (children.props ? children.props.children : children) : children}`
)}
color="greyscaleDark"
className="font-medium break-all"
>
{children}
</Text>
</span>
</div>
)
}

View File

@@ -1,36 +0,0 @@
import React from 'react'
import { useState } from 'react'
import Check from './icons/Check'
import Copy from './icons/Copy'
export default function Command({ children }) {
const [copied, setCopied] = useState(false)
return (
<div className="my-1 flex-row inline-flex self-center text-xs bg-gray-50 pl-2 pr-1.5 text-gray-900 font-mono leading-6 py-0.25 border border-gray-200 rounded-md">
<span className="text-verydark mr-1.5 self-center">$</span>
{children}
<button
className="ml-1.5 self-center inline-block cursor-pointer"
onClick={() => {
navigator.clipboard.writeText(children).catch((e) => {
// eslint-disable-next-line no-console
console.log(e)
})
setCopied(true)
setTimeout(() => {
setCopied(false)
}, 1000)
}}
>
{/* <Tooltip text={"Copied!"}> */}
{copied ? (
<Check className="w-3.5 h-3.5 mr-0.5 text-greenDark transition-colors self-center" />
) : (
<Copy className="w-4 h-4 text-gray-500 transition-colors hover:text-gray-900" />
)}
{/* </Tooltip> */}
</button>
</div>
)
}

View File

@@ -1,7 +0,0 @@
export function Container({ children }) {
return (
<div className="mx-10 px-2 sm:px-10 md:px-20 lg:px-0 flex flex-row md:max-w-container pb-20 md:mx-auto mt-8 lg:space-x-20">
{children}
</div>
)
}

View File

@@ -1,47 +0,0 @@
import markdownStyles from '@/styles/markdown-styles.module.css'
import { DOCS_GITHUB_ENDPOINT } from '@/utils/constants'
import { MDXRemote } from 'next-mdx-remote'
import { useRouter } from 'next/dist/client/router'
import React from 'react'
import GithubIcon from './icons/GithubIcon'
import Button from './ui/Button/Button'
import Text from './ui/Text/Text'
function getGithubLink(category, subcategory, post) {
if (post) return `${DOCS_GITHUB_ENDPOINT}${category}/${subcategory}/${post}.mdx`
else if (subcategory) return `${DOCS_GITHUB_ENDPOINT}${category}/${subcategory}/index.mdx`
else {
return `${DOCS_GITHUB_ENDPOINT}${category}/index.mdx`
}
}
export function Content({ mdxSource, components, frontmatter }) {
const router = useRouter()
return (
<div className="flex flex-col w-full h-full mt-2">
<div className="flex flex-row mb-4 place-content-between">
<Text color="greyscaleDark" className="font-medium cursor-pointer" size="heading">
{frontmatter.title}
</Text>
<div className="self-center hidden md:block">
<Button
Component="a"
variant="secondary"
className="invisible md:visible"
href={getGithubLink(router.query.category, router.query.subcategory, router.query.post)}
target="_blank"
rel="noreferrer"
type={null}
>
Edit This Page
<GithubIcon className="w-3.5 h-3.5 ml-1.5 text-greyscaleDark self-center" />
</Button>
</div>
</div>
<div className={markdownStyles['markdown']}>
<MDXRemote {...mdxSource} components={components} lazy />
</div>
</div>
)
}

View File

@@ -1,21 +0,0 @@
import { withRouter } from 'next/router'
import Link from 'next/link'
import React, { Children } from 'react'
const CustomLink = ({ router, children, ...props }) => {
const child = Children.only(children)
let className = child.props.className || ''
const pathname = `/${router.query.category}/${router.query.post}`
if (pathname === props.href && props.activeClassName) {
className = `${className} ${props.activeClassName}`.trim()
}
delete props.activeClassName
// @ts-ignore
return <Link {...props}>{React.cloneElement(child, { className })}</Link>
}
export default withRouter(CustomLink)

View File

@@ -1,5 +0,0 @@
import React from 'react'
export default function Divider() {
return <div className="divider mt-6 mb-4 order-2" />
}

View File

@@ -1,162 +0,0 @@
import Button from '@/components/ui/Button'
import siteLinks from '@/data/siteLinks.json'
import Link from 'next/link'
import React from 'react'
import { useState } from 'react'
import { Newsletter } from './Newsletter'
// import Input from './ui/Input/Input';
export default function Footer() {
const [email, setEmail] = useState('')
return (
<div className="bg-verydark">
<div className="max-w-mxcontainer px-5 mx-auto">
<div className="flex flex-col pt-20">
{/* Logo and CTA */}
<div className="place-content-between flex flex-row">
<div className="">
<img
src="/logos/nhost-footer-logo.svg"
width={141.57}
height={48}
alt="Nhost white logo"
/>
</div>
<div className="flex flex-row self-center">
<Button
Component="a"
variant="secondary"
className="md:visible invisible mr-2 text-white cursor-pointer"
href="mailto:hello@nhost.io"
type={null}
>
Contact Us
</Button>
<Button
Component="a"
variant="primary"
href="https://app.nhost.io"
target="_blank"
rel="noreferrer"
className="cursor-pointer"
type={null}
>
<span className="md:block hidden">Sign up or Log in</span>
<span className="md:hidden">Sign up</span>
</Button>
</div>
</div>
{/* All links */}
{/* @FIX: space-x on the firSubscribest one. */}
<div className="font-display md:flex-row flex flex-col mt-12">
<div className="gap-14 md:grid-flow-col md:grid-cols-5 grid grid-flow-row grid-cols-1">
{siteLinks.siteLinks.map((siteLink, i) => {
return (
<FooterLinks
key={siteLink.text + i}
title={siteLink.text}
links={siteLink.links}
/>
)
})}
</div>
</div>
<Newsletter />
{/* <Newsletter email={email} setEmail={setEmail} /> */}
{/* Socials */}
{/* @FIX: mt is 103px */}
<div className="md:mx-0 place-content-between font-display md:flex-row flex flex-col pb-2 mx-auto mt-24">
<div className="pb-2">
<ul className="flex flex-row space-x-6">
<li className="items-center self-center align-middle">
<a href="https://github.com/nhost" target="_blank" rel="noreferrer">
<img src="/logos/Github.svg" width={25} height={25} alt="Nhost on GitHub" />
</a>
</li>
<li className="items-center self-center align-middle">
<a href="https://twitter.com/nhostio" target="_blank" rel="noreferrer">
<img src="/logos/Twitter.svg" width={25} height={25} alt="Nhost on Twitter" />
</a>
</li>
<li className="items-center self-center align-middle">
<a
href="https://www.linkedin.com/company/nhost/"
target="_blank"
rel="noreferrer"
>
<img src="/logos/Linkedin.svg" width={25} height={25} alt="Nhost in LinkedIn" />
</a>
</li>
<li className="items-center self-center align-middle">
<a href="https://discord.com/invite/9V7Qb2U" target="_blank" rel="noreferrer">
<img
src="/logos/Discord.svg"
width={25}
height={25}
alt="Nhost community on Discord"
/>
</a>
</li>
</ul>
</div>
<div className="md:pt-0 md:space-y-0 md:flex-row flex flex-col pt-2 space-y-4 text-xs font-medium text-white">
<a
className="translucent self-center"
href="https://nhost.io/privacy-policy"
target="_blank"
rel="noreferrer"
>
Privacy Policy
</a>
<a
className="md:pl-6 translucent self-center"
href="https://nhost.io/terms-of-service"
target="_blank"
rel="noreferrer"
>
Terms of Service
</a>
<a
className="md:pl-6 translucent self-center"
href="https://nhost.io"
target="_blank"
rel="noreferrer"
>
nhost.io 2022
</a>
</div>
</div>
</div>
</div>
</div>
)
}
interface FooterLinkProps {
title: string
links: Links[]
}
interface Links {
name: string
href: string
}
function FooterLinks({ title, links }: FooterLinkProps) {
return (
<div>
{/* color */}
<h1 className="font-medium text-gray-700 uppercase">{title}</h1>
<ul className="mt-4 space-y-4">
{links.map((link) => {
return (
<li key={link.name} className="text-white font-normal text-sm+ cursor-pointer">
<Link href={link.href}>{link.name}</Link>
</li>
)
})}
</ul>
</div>
)
}

View File

@@ -1,277 +0,0 @@
import { useNavData } from '@/components/NavDataContext'
import { ArrowLeftIcon, MenuIcon } from '@heroicons/react/outline'
import clsx from 'clsx'
import { useRouter } from 'next/dist/client/router'
import Link from 'next/link'
import React, { MouseEvent, useEffect, useState } from 'react'
import Button from '../components/ui/Button'
import { Nav } from './Nav'
export default function Header() {
const [mobileMenu, setMobileMenu] = useState(false)
const router = useRouter()
const GithubStarsCounter = () => {
const repoUrl = `https://api.github.com/repos/nhost/nhost`
const [count, setCount] = useState(null)
const format = (n: number) => (n > 1000 ? `${(n / 1000).toFixed(1)}k` : n)
useEffect(() => {
;(async () => {
const data = await fetch(repoUrl).then((res) => res.json())
setCount(data.stargazers_count)
})()
}, [repoUrl])
return (
<a
className="text-base font-medium leading-snug flex flex-row items-center justify-center px-2.5 py-1.5 rounded opacity-50 hover:opacity-100 mr-8"
href="https://github.com/nhost/nhost"
target="_blank"
rel="noreferrer"
>
<img
className="mr-2"
src="/logos/Github2.svg"
width={20}
height={20}
alt="Nhost on GitHub"
/>
{count === null ? 0 : format(count)}
</a>
)
}
function handleMobileMenuOpen() {
setMobileMenu(true)
}
function handleMobileMenuClose() {
setMobileMenu(false)
}
if (mobileMenu) {
return <MobileNav onClose={handleMobileMenuClose} />
}
return (
<header className="bg-white md:max-w-full menu-card rounded-md px-4 py-0.5 mx-2">
<div className="md:max-w-header2 mx-auto font-display flex flex-row antialiased">
<div className="flex flex-row w-full mx-auto place-content-between py-2">
<div className="flex flex-row">
<button
className="md:hidden w-8 h-8 flex items-center justify-center cursor-pointer text-greyscaleDark"
aria-label="Open menu"
onClick={handleMobileMenuOpen}
>
<MenuIcon className="h-6 w-6" />
</button>
<Link href="/get-started" passHref>
<a className="hidden ml-3 sm:ml-0 self-center md:flex flex-row cursor-pointer">
<img src="/images/nhost-docs.svg" width={110} height={35} alt="Nhost white logo" />
<h1 className="self-center ml-6 font-medium text-greyscaleDark">DOCS</h1>
</a>
</Link>
<div className="ml-20 hidden md:flex flex-row self-center ">
<ul className="flex flex-row items-center self-center antialiased font-medium text-greyscaleGrey font-display">
<Link href="/get-started" passHref={true}>
<a
className={clsx(
'cursor-pointer text-base- self-center hover:text-greyscaleDark transition-colors duration-200 py-3',
router.query.category === 'get-started' && 'text-greyscaleDark'
)}
>
Get Started
</a>
</Link>
<Link href="/platform" passHref={true}>
<a
className={clsx(
'ml-12 cursor-pointer text-base- self-center hover:text-greyscaleDark transition-colors duration-200 py-3',
router.query.category === 'platform' && 'text-greyscaleDark'
)}
>
Platform
</a>
</Link>
<Link href="/reference" passHref={true}>
<a
className={clsx(
'ml-12 cursor-pointer text-base- self-center hover:text-greyscaleDark transition-colors duration-200 py-3',
router.query.category === 'reference' && 'text-greyscaleDark'
)}
>
Reference
</a>
</Link>
</ul>
</div>
</div>
<div className="hidden sm:flex self-center">
<GithubStarsCounter />
<Button
className="self-center"
variant="primary"
href={'https://app.nhost.io'}
Component="a"
target="_blank"
rel="noreferrer"
type={null}
>
Go to Nhost
</Button>
</div>
</div>
</div>
</header>
)
}
export type MobileNavProps = {
onClose?: VoidFunction
}
export function MobileNav({ onClose }: MobileNavProps) {
const { getConvolutedNavByCategory } = useNavData()
const router = useRouter()
const [selectedMenuSlug, setSelectedMenuSlug] = useState<string | null>(null)
const [selectedMenuName, setSelectedMenuName] = useState<string | null>(null)
function handleMenuSelect(event: MouseEvent<HTMLAnchorElement>, slug: string, name: string) {
event.preventDefault()
setSelectedMenuSlug(slug)
setSelectedMenuName(name)
}
function clearMenuSelection() {
setSelectedMenuSlug(null)
setSelectedMenuName(null)
}
return (
<div className="bg-white menu-card rounded-lg px-4 pb-6 max-w-full mx-2">
<div className="flex flex-col w-full py-3 mx-auto">
<div className="grid grid-flow-col justify-between items-center">
{!selectedMenuSlug && (
<>
<button
className="w-8 h-8 flex items-center justify-center cursor-pointer text-greyscaleDark"
aria-label="Close menu"
onClick={onClose}
>
<MenuIcon className="h-6 w-6" aria-hidden="true" />
</button>
<Link href="/get-started" passHref>
<a
className="ml-3 sm:ml-0 self-center flex flex-row cursor-pointer"
onClick={onClose}
>
<img
src="/images/nhost-docs.svg"
width={110}
height={35}
alt="Nhost white logo"
/>
<h1 className="self-center ml-5 font-medium text-greyscaleDark">DOCS</h1>
</a>
</Link>
</>
)}
{selectedMenuSlug && (
<button
className="ml-2 h-8 grid grid-flow-col gap-2 items-center justify-center cursor-pointer text-greyscaleDark"
aria-label="Go back to main menu"
onClick={clearMenuSelection}
>
<ArrowLeftIcon className="h-4 w-4" aria-hidden="true" />{' '}
<span className="font-medium text-base-">{selectedMenuName}</span>
</button>
)}
{/* Placeholder for making logo appear correctly in the middle */}
<div className="w-8 h-8" />
</div>
<div className="flex flex-col py-6 mt-4 border-divide border-t border-b">
{!selectedMenuSlug && (
<ul className="flex flex-col font-medium text-greyscaleDark text-base- font-display space-y-4 text-left px-4">
<li
className={clsx(
'cursor-pointer text-base- hover:text-greyscaleDark transition-colors duration-200 text-left ',
router.query.category === 'get-started' && 'text-greyscaleDark'
)}
>
<Link href="/get-started" passHref>
<a
className="block"
onClick={(event) => handleMenuSelect(event, 'get-started', 'Get Started')}
>
Get Started
</a>
</Link>
</li>
<li
className={clsx(
'cursor-pointer text-base- hover:text-greyscaleDark transition-colors duration-200 text-left',
router.query.category === 'platform' && 'text-greyscaleDark'
)}
>
<Link href="/platform">
<a
className="block"
onClick={(event) => handleMenuSelect(event, 'platform', 'Platform')}
>
Platform
</a>
</Link>
</li>
<li
className={clsx(
'cursor-pointer text-base- hover:text-greyscaleDark transition-colors duration-200',
router.query.category === 'reference' && 'text-greyscaleDark'
)}
>
<Link href="/reference">
<a
className="block"
onClick={(event) => handleMenuSelect(event, 'reference', 'Reference')}
>
Reference
</a>
</Link>
</li>
</ul>
)}
{selectedMenuSlug && (
<Nav
category={selectedMenuSlug}
categoryTitle={selectedMenuName}
convolutedNav={getConvolutedNavByCategory(selectedMenuSlug)}
onMenuSelected={onClose}
/>
)}
</div>
</div>
<div className="sm:flex self-center py-2">
<Button
className="self-center"
variant="primary"
href="https://app.nhost.io"
Component="a"
target="_blank"
rel="noreferrer"
type={null}
>
Go to Nhost
</Button>
</div>
</div>
)
}

View File

@@ -1,42 +0,0 @@
import Text from '@/components/ui/Text/Text'
import createKebabCase from '@/utils/createKebabCase'
import clsx from 'clsx'
import { useRouter } from 'next/dist/client/router'
import Link from 'next/link'
import React from 'react'
export function HeadingsNavigation(props) {
const {
query: { category, subcategory, post }
} = useRouter()
return (
<div className="hidden xl:flex flex-col mt-10 sticky top-20 w-full h-full pb-12 pl-4">
<Text className="font-medium" color="greyscaleDark" size="normal">
On this page
</Text>
<ul className="space-y-2 mt-2 pl-1">
{props.headings.map((heading) => {
return (
<Link
passHref
key={heading.name}
href={`/${category}/${subcategory}/${post}#${createKebabCase(heading.name)}`}
>
<li
className={clsx(
'text-blue hover:text-darkBlue transition-all duration-300 cursor-pointer hover:translate-x-0.5 transform',
heading.depth === 1 && 'text-sm font-medium',
heading.depth === 2 && 'pl-3 text-sm font-normal',
heading.depth === 3 && 'pl-7 text-xs font-normal'
)}
>
{heading.name}
</li>
</Link>
)
})}
</ul>
</div>
)
}

View File

@@ -1,75 +0,0 @@
import { lightNhostTheme } from '@/data/lightTheme'
import { useState } from 'react'
import { Light as SyntaxHighlighter } from 'react-syntax-highlighter'
import js from 'react-syntax-highlighter/dist/cjs/languages/hljs/javascript'
import Check from '../icons/Check'
import Copy from '../icons/Copy'
// @ts-ignore -> add to types
// @ts-ignore -> add to types
SyntaxHighlighter.registerLanguage('js', js)
// TODO highlight JSX
SyntaxHighlighter.registerLanguage('jsx', js)
export interface CodeEditorProps {
code: string
fileName: string
className: string
fixed: boolean
gradient: boolean
deploy: boolean
url?: string
children: any
}
const CodeEditor = (props: CodeEditorProps) => {
const { children, url } = props
const [copied, setCopied] = useState(false)
return (
<div className="relative min-w-full pb-0 my-4 rounded-md">
<div className="absolute right-0">
<button
className="ml-1.5 self-center inline-block cursor-pointer rounded-md mt-2 mr-2"
onClick={() => {
navigator.clipboard.writeText(children).catch((e) => {
// eslint-disable-next-line no-console
console.log(e)
})
setCopied(true)
setTimeout(() => {
setCopied(false)
}, 1000)
}}
>
{/* <Tooltip text={"Copied!"}> */}
{copied ? (
<Check className="w-3.5 h-3.5 mr-0.5 text-greenDark transition-colors self-center" />
) : (
<Copy className="w-4 h-4 text-gray-500 transition-colors hover:text-gray-900" />
)}
{/* </Tooltip> */}
</button>
</div>
<SyntaxHighlighter
style={lightNhostTheme}
wrapLongLines={true}
wrapLines={true}
lineProps={{
style: { wordBreak: 'break-all', whiteSpace: 'pre-wrap' }
}}
customStyle={{
paddingLeft: '12px',
fontSize: '13px'
}}
className="pt-2 rounded-md"
showLineNumbers={false}
>
{children}
</SyntaxHighlighter>
</div>
)
}
export default CodeEditor

View File

@@ -1,154 +0,0 @@
import AnchorLink, { AnchorLinkProps } from '@/components/AnchorLink'
import CodeComponent, { CodeEditorProps } from '@/components/MDX/CodeComponent'
import Text, { TextProps } from '@/components/ui/Text'
import clsx from 'clsx'
import Image from 'next/image'
import Link from 'next/link'
import React, { DetailedHTMLProps, HTMLProps, PropsWithChildren } from 'react'
import Command from '../Command'
import Divider from '../Divider'
function Note({ children }: PropsWithChildren<unknown>) {
return (
<div className="px-5 py-5 my-5 space-y-2 text-white rounded-md bg-verydark">
<Text className="text-white">Note</Text>
<Text className="text-white">{children}</Text>
</div>
)
}
function Video({
src,
...props
}: DetailedHTMLProps<HTMLProps<HTMLSourceElement>, HTMLSourceElement>) {
return (
<div className="flex justify-center mx-10 my-8">
<video width="800" controls>
<source src={src} type="video/mp4" {...props} />
</video>
</div>
)
}
const CustomLink = ({
className,
children,
href,
...props
}: DetailedHTMLProps<HTMLProps<HTMLAnchorElement>, HTMLAnchorElement>) => {
const isInternalLink = href && ['./', '../', '/', '#'].some((symbol) => href.startsWith(symbol))
if (isInternalLink) {
return (
<Link href={href} passHref>
<a className={clsx('font-medium text-blue', className)} {...props}>
{children}
</a>
</Link>
)
}
return (
<a
target="_blank"
className={clsx('font-medium text-blue', className)}
rel="noopener noreferrer"
href={href}
{...props}
>
{children}
</a>
)
}
const components = {
img: (props: DetailedHTMLProps<HTMLProps<HTMLImageElement>, HTMLImageElement>) => {
return (
<span className="block mx-10 my-10 ">
<img src={props.src} alt={props.alt} className="mx-auto mt-2" />
</span>
)
},
Video,
Image,
Text,
Note,
code: (props: CodeEditorProps) => {
if (props.className && props.className.includes('language')) {
return <CodeComponent {...props} />
} else {
return <Command>{props.children}</Command>
}
},
Divider,
a: CustomLink,
h1: (props: AnchorLinkProps) => {
return (
<>
<Divider />
<AnchorLink {...props} className="text-3xl cursor-pointer md:text-4xl" />
</>
)
},
h2: (props: AnchorLinkProps) => {
return (
<div className="mt-10">
<AnchorLink {...props} className="cursor-pointer text-lg sm:text-xl md:text-2.5xl" />
</div>
)
},
h3: (props: AnchorLinkProps) => {
return (
<div className="mt-8">
<AnchorLink {...props} className="text-lg cursor-pointer" />
</div>
)
},
h4: (props: AnchorLinkProps) => {
return (
<div className="mt-4">
<AnchorLink {...props} className="font-bold cursor-pointer text-base-" />
</div>
)
},
p: (props: TextProps) => {
return (
<Text
variant="body"
size="small"
color="dark"
className="my-2 antialiased leading-6"
{...props}
/>
)
},
th: ({
className,
...props
}: DetailedHTMLProps<HTMLProps<HTMLTableCellElement>, HTMLTableCellElement>) => {
return <th className={clsx('font-display', className)} {...props} />
},
td: ({
className,
...props
}: DetailedHTMLProps<HTMLProps<HTMLTableCellElement>, HTMLTableCellElement>) => {
return <td className={clsx('font-display', className)} {...props} />
},
Mermaid: ({ chart }) => {
const [html, setHtml] = React.useState('')
React.useEffect(() => {
const start = async () => {
const mermaid = (await import('mermaid')).default
mermaid.mermaidAPI.render(uuid(), chart, (svgCode) => setHtml(svgCode))
}
start()
}, [chart])
return chart ? <div dangerouslySetInnerHTML={{ __html: html }} /> : null
}
}
let currentId = 0
const uuid = () => `mermaid-${(currentId++).toString()}`
export default components

View File

@@ -1,3 +0,0 @@
export function Main({ children }) {
return <div className="flex flex-col w-full lg:min-w-body lg:w-body">{children}</div>
}

View File

@@ -1,130 +0,0 @@
import Text from '@/components/ui/Text'
import clsx from 'clsx'
import Link from 'next/link'
import { useRouter } from 'next/router'
import { ParsedUrlQuery } from 'querystring'
import React, { MouseEvent } from 'react'
import { fixTitle } from '../utils/fixTitle'
import { NavItem } from './NavDataContext'
export type NavProps = {
/**
* Class name to apply to the wrapper element.
*/
className?: string
/**
* Category slug.
*/
category: string
/**
* The category title.
*/
categoryTitle: string
/**
* Convoluted navigation.
*/
convolutedNav: NavItem[]
/**
* Function to be called when a menu item is selected.
*/
onMenuSelected?: (event?: MouseEvent<HTMLAnchorElement, MouseEvent>) => void
}
export function Nav({ className, onMenuSelected, ...props }: NavProps) {
const router = useRouter()
return (
<div className={clsx('lg:min-w-nav lg:w-nav flex-col space-y-5 antialiased mt-1', className)}>
<div>
<ul>
<li
className={clsx(
'transition duration-300 ease-in-out rounded-md hover:text-black hover:bg-veryLightGray',
router.query.category === props.category &&
!router.query.subcategory &&
!router.query.post &&
'bg-veryLightGray'
)}
>
<Link href={`/${props.category}`} passHref>
<Text
variant="a"
color="greyscaleDark"
size="normal"
className={clsx(
'block py-1.5 px-3 transition-colors duration-300 ease-in-out text-greyscaleDark hover:text-dark subpixel-antialiased',
'font-medium'
)}
onClick={onMenuSelected}
>
{props.categoryTitle}
</Text>
</Link>
</li>
</ul>
</div>
{props.convolutedNav.map((elem) => {
const parentCategory = props.category.replace(' ', '-')
return (
<div key={elem.category}>
<Link href={`/${parentCategory}/${elem.category}/`} passHref>
<Text
variant="a"
color="greyscaleGrey"
size="normal"
className="block px-3 py-px font-medium capitalize"
onClick={onMenuSelected}
>
{/* Split */}
{fixTitle(elem)}
</Text>
</Link>
<ul className="mt-1 space-y-1 ">
{elem.posts.map((post) => {
const pathToLink =
post.fileName != 'index'
? `/${parentCategory}/${elem.category}/${post.fileName}`
: `/${parentCategory}/${elem.category}`
const shouldHighlight =
router.query.subcategory === elem.category && router.query.post === post.fileName
const shouldHighlightSubcategories =
!router.query.post &&
post.fileName === 'index' &&
elem.category === router.query.subcategory
return (
<li
className={clsx(
'transition duration-300 ease-in-out rounded-md hover:text-black hover:bg-veryLightGray',
(shouldHighlight || shouldHighlightSubcategories) && 'bg-veryLightGray'
)}
key={pathToLink}
>
<Link href={pathToLink} passHref>
<Text
variant="a"
color="greyscaleDark"
size="normal"
className={clsx(
'py-1.5 px-3 block transition-colors duration-300 ease-in-out text-greyscaleDark hover:text-dark subpixel-antialiased block',
(shouldHighlight || shouldHighlightSubcategories) && 'font-medium'
)}
onClick={onMenuSelected}
>
{post.title}
</Text>
</Link>
</li>
)
})}
</ul>
</div>
)
})}
</div>
)
}

View File

@@ -1,85 +0,0 @@
import { ParsedUrlQuery } from 'querystring'
import { createContext, PropsWithChildren, useContext } from 'react'
export type Post = {
/**
* Title of the post.
*/
title: string
/**
* File name where the post is located.
*/
fileName: string
/**
* Order of posts.
*/
order: string[]
}
export type NavItem = {
/**
* Slug of the category.
*/
category: string
/**
* List of posts in the category.
*/
posts: Post[]
}
export type NavDataContextProps = {
/**
* Category slug.
*/
category: string
/**
* The category title.
*/
categoryTitle: string
/**
* Convoluted navigation.
*/
convolutedNav: NavItem[]
/**
* Available menu items for all categories.
*/
availableCategoryMenus: {
/**
* Slug of the category.
*/
slug: string
/**
* Menu items of the category.
*/
items: NavItem[]
}[]
}
export const NavDataContext = createContext<NavDataContextProps>(null)
export function NavDataProvider({ children, ...props }: PropsWithChildren<NavDataContextProps>) {
return <NavDataContext.Provider value={props}>{children}</NavDataContext.Provider>
}
export function useNavData() {
const context = useContext(NavDataContext)
if (!context) {
throw new Error(`"useNavData" must be used within a "NavDataProvider"`)
}
/**
* Returns all of the navigation items for the specified category.
*
* @param slug Slug of the category.
* @returns All of the navigation items for the specified category.
*/
function getConvolutedNavByCategory(slug: string) {
return (
context.availableCategoryMenus.find(({ slug: category }) => category === slug)?.items ||
context.convolutedNav
)
}
return { getConvolutedNavByCategory, ...context }
}

View File

@@ -1,47 +0,0 @@
import React from 'react'
import AnchorLink from './AnchorLink'
import CustomLink from './CustomLink'
import createKebabCase from '../utils/createKebabCase'
import Text from '@/components/ui/Text'
export default function Nav({ headings }: { headings: any }) {
return (
<div className="flex flex-col space-y-5 mt-9">
{headings.map((heading, index) => {
return (
<NavLink
category={heading.category}
post={heading.post}
headings={heading.content}
key={heading.category + index}
/>
)
})}
</div>
)
}
function NavLink({ category, headings, post }) {
const href = `/${category}/${post.toLowerCase()}`
return (
<div className="mt-10 font-display" key={category}>
<CustomLink href={href} activeClassName="active" key={category}>
<Text variant="body" size="small" className="capitalize cursor-pointer text-grayscale">
{post.split('-').join(' ')}
</Text>
</CustomLink>
<ul className="space-y-1">
{headings.map((heading: { value: string }) => {
return (
<li className="py-1 capitalize rounded-sm" key={heading.value}>
<AnchorLink
id={`/${category}/${post.toLowerCase()}#${createKebabCase(heading.value)}`}
>{`/${heading.value}`}</AnchorLink>
</li>
)
})}
</ul>
</div>
)
}

View File

@@ -1,121 +0,0 @@
import axios from 'axios'
import React, { useEffect } from 'react'
import { useState } from 'react'
import Input from './ui/Input/Input'
import Loading from './ui/Loading'
function NewsletterForm(props) {
return (
<div className="flex flex-row w-64 mt-5">
<form
className="grid grid-flow-row sm:grid-flow-col gap-4"
onSubmit={(e) => props.subscribe(e)}
>
<Input
color="dark"
placeholder="Email address"
value={props.email}
onChange={props.setEmail}
type="email"
/>
<button
className="btn-subscribe font-display text-greyscaleDark font-medium cursor-pointer"
disabled={!props.email}
>
{!props.loading ? 'Subscribe' : <Loading />}
</button>
</form>
</div>
)
}
function NewsletterError({ errorMessage, retry }) {
const formattedError = errorMessage.includes('already a list member')
? errorMessage.split('.').slice(0, 2).join('.')
: errorMessage
return (
<div className="grid grid-flow-row md:grid-flow-col gap-4 mt-5">
<p className="text-white font-normal text-sm mt-2.5">{formattedError}.</p>
<button
className="btn-subscribe font-display text-greyscaleDark font-medium cursor-pointer"
onClick={() => {
retry()
}}
>
Try again
</button>
</div>
)
}
export function Newsletter() {
const [email, setEmail] = useState('')
const [error, setError] = useState('')
const [success, setSuccess] = useState('')
const [loading, setLoading] = useState(false)
const handleSubmit = async function (e) {
e.preventDefault()
setLoading(true)
try {
const res = await axios.post('/api/add-email-to-newsletter', {
email
})
if (!res.data.success) {
setError(res.data.message)
return
}
setSuccess(res.data.message)
} catch (error) {
setError(
error.message ||
"We've encountered an error while subscribing you. Try again in a few seconds"
)
} finally {
setEmail('')
setLoading(false)
}
}
useEffect(() => {
if (success) {
let id = setInterval(() => {
setSuccess('')
}, 5000)
return () => clearInterval(id)
}
}, [success])
return (
<div className="font-display flex flex-col mt-16">
<div className="md:px-0 w-full mx-auto">
<h1 className="font-medium text-gray-700 uppercase">newsletter</h1>
<p className="text-white font-normal text-sm+ mt-2.5">
Platform updates and news on web and mobile development.
</p>
{error ? (
<NewsletterError errorMessage={error} retry={() => setError('')} />
) : !success ? (
<NewsletterForm
email={email}
setEmail={setEmail}
subscribe={handleSubmit}
loading={loading}
/>
) : (
<NewsletterSuccess success={success} />
)}
</div>
</div>
)
}
function NewsletterSuccess({ success }) {
return (
<div className="flex flex-row mt-5">
<p className="text-white font-normal text-sm mt-2.5">{success}</p>
</div>
)
}

View File

@@ -1,32 +0,0 @@
import Text from '@/components/ui/Text'
import React from 'react'
import Github from '@/components/icons/Github'
import { DOCS_GITHUB_ENDPOINT } from '@/utils/constants'
export function PostMetadata(props) {
return (
<div className="mt-3 flex flex-row border-t pt-6 place-content-between px-3">
<div className="flex flex-row">
<Github className="text-blue" />
<a
className="text-blue text-xs ml-2 self-center"
href={`${DOCS_GITHUB_ENDPOINT}${props.category}/${props.subcategory}/${props.post}.mdx`}
target="_blank"
rel="noreferrer"
>
Edit this page on GitHub
</a>
</div>
<div>
{props.frontmatter.updatedAt ? (
<div className="flex">
<Text size="tiny">Last updated on {props.frontmatter.updatedAt}</Text>
</div>
) : (
''
)}
</div>
</div>
)
}

View File

@@ -1,52 +0,0 @@
import ArrowLeft from '@/components/icons/ArrowLeft'
import ArrowRight from '@/components/icons/ArrowRight'
import Text from '@/components/ui/Text/Text'
import { orderTwo } from '@/lib/order'
import { useRouter } from 'next/dist/client/router'
import Link from 'next/link'
import React from 'react'
export function SubNavigation({ category, subcategory, post, convolutedNav }) {
const router = useRouter()
const indexOfSubcategory = Object.keys(orderTwo[category]).indexOf(subcategory)
const indexOfPreviousPost = orderTwo[category][subcategory].indexOf(post) - 1
let indexOfCurrentPost = orderTwo[category][subcategory].indexOf(post)
const previousPost = orderTwo[category][subcategory][indexOfCurrentPost - 1]
let indexOfNextPost = orderTwo[category][subcategory].indexOf(post) + 1
if (!router.query.post) indexOfCurrentPost++ && indexOfNextPost++
const nextPost = orderTwo[category][subcategory][indexOfCurrentPost + 1]
const pathLink = `/${category}/${subcategory}/${previousPost === 'index' ? '' : previousPost}`
return (
<div className="flex flex-row mt-10 place-content-between px-2 antialiased">
<Link href={pathLink} passHref>
<Text variant="a" color="blue" className="font-medium cursor-pointer" size="small">
{indexOfCurrentPost === 0 || !router.query.post ? (
<></>
) : (
<div className="flex flex-row self-center hover:-translate-x-1 transform transition-transform duration-500">
<ArrowLeft className="self-center mr-1" />
{convolutedNav[indexOfSubcategory].posts[indexOfPreviousPost].title}
</div>
)}
</Text>
</Link>
<Link href={`/${category}/${subcategory}/${nextPost}`} passHref>
<Text variant="a" size="small" color="blue" className="font-medium cursor-pointer">
{nextPost ? (
<div className="flex flex-row self-center hover:translate-x-1 transform transition-transform duration-500">
{convolutedNav[indexOfSubcategory].posts[indexOfNextPost].title}
<ArrowRight className="self-center ml-1" />
</div>
) : (
<></>
)}
</Text>
</Link>
</div>
)
}

View File

@@ -1,25 +0,0 @@
export function Tooltip({ text, children, position = '-mx-20', color = '' }) {
return (
<div className="relative has-tooltip">
{children}
<span
className={`z-50 px-1.5 py-0.5 text-sm bg-verydark -my-12 -mx-9 text-white rounded-sm shadow-2xl border tooltip font-medium`}
>
{text}
</span>
<svg
className="absolute z-50 w-3 h-2 text-verydark transform tooltip -top-2 right-0.5"
x="0px"
y="0px"
viewBox="0 0 255 255"
xmlSpace="preserve"
>
<polygon
className="border border-white fill-current text-lightbrand"
points="0,0 127.5,127.5 255,0"
/>
</svg>
</div>
)
}

View File

@@ -1,46 +0,0 @@
import CaretRight from '@/components/icons/CaretRight'
import Text from '@/components/ui/Text/Text'
import Link from 'next/link'
import React from 'react'
export function TopNavigation(props) {
const category = props.category.split('-').join(' ')
function uppercaseEdgeCases(subcategory) {
switch (subcategory) {
case 'sdk':
return 'SDK'
case 'cli':
return 'CLI'
default:
return subcategory
}
}
const subcategory = props.subcategory.split('-').join(' ')
return (
<div className="flex flex-row w-full">
<Link href={`/${props.category}`} passHref>
<Text
variant="a"
color="grey"
className="self-center font-medium capitalize transition-colors duration-200 cursor-pointer hover:text-greyscaleDark"
size="normal"
>
{category}
</Text>
</Link>
<CaretRight className="self-center text-greyscaleGrey mx-1" />
<Link href={`/${props.category}/${props.subcategory}`} passHref>
<Text
color="grey"
className="self-center font-medium capitalize transition-colors duration-200 cursor-pointer hover:text-greyscaleDark"
size="normal"
>
{uppercaseEdgeCases(subcategory)}
</Text>
</Link>
</div>
)
}

View File

@@ -1,16 +0,0 @@
import * as React from 'react'
function ArrowLeft(props: JSX.IntrinsicAttributes & React.SVGProps<SVGSVGElement>) {
return (
<svg width={16} height={16} fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<path
d="M13.5 8h-11M7 3.5L2.5 8 7 12.5"
stroke="#0052CD"
strokeWidth={1.5}
strokeLinejoin="round"
/>
</svg>
)
}
export default ArrowLeft

View File

@@ -1,16 +0,0 @@
import * as React from 'react'
function ArrowRight(props: JSX.IntrinsicAttributes & React.SVGProps<SVGSVGElement>) {
return (
<svg width={16} height={16} fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<path
d="M2.5 8h11M9 3.5L13.5 8 9 12.5"
stroke="#0052CD"
strokeWidth={1.5}
strokeLinejoin="round"
/>
</svg>
)
}
export default ArrowRight

View File

@@ -1,11 +0,0 @@
import * as React from 'react'
function CaretRight(props: JSX.IntrinsicAttributes & React.SVGProps<SVGSVGElement>) {
return (
<svg width={16} height={16} fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<path d="M6 3l5 5-5 5" stroke="currentColor" strokeWidth={1.5} strokeLinejoin="round" />
</svg>
)
}
export default CaretRight

View File

@@ -1,11 +0,0 @@
import * as React from 'react'
function Check(props: any) {
return (
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<path d="M13.5 4.5l-7 7L3 8" stroke="currentColor" strokeWidth={2} strokeLinejoin="round" />
</svg>
)
}
export default Check

View File

@@ -1,11 +0,0 @@
import * as React from 'react'
function Check2(props: any) {
return (
<svg viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<path d="M27 9L13 23l-7-7" stroke="#0D3777" strokeWidth={2} strokeLinejoin="round" />
</svg>
)
}
export default Check2

View File

@@ -1,20 +0,0 @@
const Copy = ({ ...props }) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
{...props}
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"
/>
</svg>
)
}
export default Copy

View File

@@ -1,22 +0,0 @@
const Github = ({ ...props }) => {
return (
<div className="cursor-pointer">
<svg
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
{...props}
>
<path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22" />
</svg>
</div>
)
}
export default Github

View File

@@ -1,23 +0,0 @@
import * as React from 'react'
function GithubIcon(props: React.SVGProps<SVGSVGElement>) {
return (
<svg
width={14}
height={14}
viewBox="0 0 14 14"
fill="currentColor"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
fillRule="evenodd"
clipRule="evenodd"
d="M7 0a7 7 0 00-2.213 13.642c.35.065.478-.152.478-.337 0-.166-.006-.607-.01-1.19-1.947.422-2.357-.94-2.357-.94-.319-.808-.778-1.023-.778-1.023-.635-.434.048-.426.048-.426.703.05 1.073.722 1.073.722.624 1.07 1.638.76 2.037.581.063-.452.244-.76.444-.935-1.554-.177-3.188-.778-3.188-3.46 0-.764.273-1.39.72-1.878-.072-.177-.312-.89.07-1.853 0 0 .586-.188 1.924.718A6.705 6.705 0 017 3.385c.595.003 1.194.08 1.753.236 1.336-.906 1.923-.718 1.923-.718.382.964.142 1.676.07 1.853a2.7 2.7 0 01.72 1.878c0 2.69-1.638 3.281-3.197 3.454.251.216.475.644.475 1.297 0 .935-.009 1.69-.009 1.92 0 .187.127.405.482.337A7 7 0 007 0z"
fill="currentColor"
/>
</svg>
)
}
export default GithubIcon

View File

@@ -1,20 +0,0 @@
const Help = ({ ...props }) => {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
{...props}
>
<path
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="2"
d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"
/>
</svg>
)
}
export default Help

View File

@@ -1,36 +0,0 @@
import * as React from 'react'
function Logo(props: JSX.IntrinsicAttributes & React.SVGProps<SVGSVGElement>) {
return (
<svg viewBox="0 0 95 32" fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<g clipPath="url(#prefix__clip0)">
<path
fillRule="evenodd"
clipRule="evenodd"
d="M50.657 15.218h4.792v-3.801h2.535v9.752h-2.535v-3.802h-4.792v3.802H48.21v-9.752h2.446v3.801zm16.996-3.801H63.74c-1.084 0-1.744.204-2.243.703-.497.496-.688 1.126-.688 2.238v3.874c0 1.112.19 1.74.688 2.238.497.498 1.157.703 2.243.703h3.913c1.084 0 1.744-.205 2.243-.703.5-.496.688-1.126.688-2.238v-3.874c0-1.112-.19-1.74-.688-2.239-.5-.498-1.159-.702-2.243-.702zm.483 6.872c0 .57-.19.73-.879.73h-3.121c-.688 0-.88-.16-.88-.73v-3.992c0-.571.192-.731.88-.731h3.121c.705 0 .88.145.88.73v3.993zm8.512-2.97h3.501c1.084 0 1.758.205 2.243.703.439.44.688 1.155.688 1.93v.586c0 .776-.25 1.476-.688 1.93-.485.498-1.145.703-2.243.703h-6.681v-2.15h6.271c.688 0 .88-.16.88-.73v-.292c0-.571-.192-.731-.88-.731h-3.5c-1.087 0-1.76-.207-2.243-.703-.439-.44-.689-1.154-.689-1.93v-.585c0-.776.248-1.477.689-1.93.485-.499 1.142-.703 2.242-.703h6.333v2.149h-5.923c-.688 0-.879.16-.879.73v.292c0 .572.191.732.88.732zm7.983-1.753v-2.15h9.963v2.15h-3.75v7.603h-2.448v-7.603H84.63z"
fill="#21324B"
/>
<path
d="M42.355 11.34h-3.913c-1.084 0-1.744.204-2.243.703-.497.496-.688 1.126-.688 2.236v6.888h2.447V14.22c0-.57.191-.73.88-.73h3.121c.704 0 .879.146.879.73v6.948h2.448V14.28c0-1.112-.191-1.74-.689-2.236-.497-.5-1.156-.705-2.242-.705z"
fill="#0052CD"
/>
<g clipPath="url(#prefix__clip1)">
<path
d="M27.208 6.858L16.055.43a3.268 3.268 0 00-3.246 0 3.245 3.245 0 00-1.621 2.803v.839l-.727-.42a3.268 3.268 0 00-3.246 0A3.246 3.246 0 005.594 6.46v.838l-.727-.419a3.268 3.268 0 00-3.245 0A3.246 3.246 0 000 9.683v20.136a1.526 1.526 0 002.47 1.195L8 26.66l8.53 4.914a1.548 1.548 0 001.526 0c.47-.272.763-.776.763-1.319V18.14a5.595 5.595 0 00-2.797-4.835l-2.797-1.612V3.236a1.21 1.21 0 011.815-1.045l11.153 6.425a3.562 3.562 0 011.78 3.076v15.089c0 .43-.232.83-.605 1.045l-2.955 1.703V14.914a5.595 5.595 0 00-2.797-4.834L14.75 6.125v2.343l5.849 3.37a3.559 3.559 0 011.78 3.076v15.492c0 .54.292 1.047.763 1.319a1.549 1.549 0 001.526 0l3.719-2.143c1-.577 1.622-1.65 1.622-2.805V11.688a5.609 5.609 0 00-2.801-4.83zM15 15.062a3.559 3.559 0 011.78 3.077v11.24L9.718 25.31l2.267-1.782a3.214 3.214 0 001.236-2.542V14.04l1.78 1.023zm-3.813-2.197v8.117c0 .373-.169.72-.461.948l-8.693 6.84V9.68a1.209 1.209 0 011.814-1.045L5.594 9.64v14.39l2.033-1.6V6.458a1.209 1.209 0 011.815-1.045l1.745 1.004v4.102L9.155 9.347v2.345l2.034 1.173z"
fill="#0052CD"
/>
</g>
</g>
<defs>
<clipPath id="prefix__clip0">
<path fill="#fff" d="M0 0h94.582v32H0z" />
</clipPath>
<clipPath id="prefix__clip1">
<path fill="#fff" d="M0 0h30.009v31.927H0z" />
</clipPath>
</defs>
</svg>
)
}
export default Logo

View File

@@ -1,15 +0,0 @@
const Permalink = ({ ...props }) => {
return (
<svg fill="none" xmlns="http://www.w3.org/2000/svg" {...props}>
<path
d="M5.878 10.12l4.243-4.242M9.06 11.182L7.293 12.95A3 3 0 013.05 8.707l1.768-1.768M11.182 9.06l1.768-1.768A3 3 0 008.707 3.05L6.939 4.818"
stroke="#21324B"
strokeWidth={1.5}
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
)
}
export default Permalink

View File

@@ -1,21 +0,0 @@
import * as React from 'react'
function Vector(props: JSX.IntrinsicAttributes & React.SVGProps<SVGSVGElement>) {
return (
<svg
width={260}
height={117}
viewBox="0 0 260 117"
fill="none"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M35.5 1h1V0h-1v1zM254 87l-5.773 10h11.546L254 87zM.5 2h2.188V0H.5v2zm6.563 0h4.375V0H7.061v2zm8.75 0h4.374V0h-4.375v2zm8.75 0h4.375V0h-4.375v2zm8.75 0H35.5V0h-2.188v2zM34.5 1v1.982h2V1h-2zm0 5.946v3.965h2V6.946h-2zm0 7.929v3.964h2v-3.964h-2zm0 7.929v3.964h2v-3.964h-2zm0 7.928v3.964h2v-3.964h-2zm0 7.929v3.964h2v-3.964h-2zm0 7.928v3.965h2v-3.965h-2zm0 7.929v3.964h2v-3.964h-2zm0 7.928v3.965h2v-3.965h-2zm0 7.929v3.964h2v-3.964h-2zm0 7.929v3.964h2v-3.964h-2zm0 7.928v3.964h2v-3.964h-2zm0 7.929v3.964h2v-3.964h-2zm0 7.928v3.965h2v-3.965h-2zm0 7.929V112h2v-1.982h-2zm0 1.982c0 .676.135 1.323.38 1.914l1.847-.766A2.985 2.985 0 0136.5 112h-2zm3.086 4.62c.59.245 1.238.38 1.914.38v-2a2.99 2.99 0 01-1.148-.227l-.766 1.847zm1.914.38h2.024v-2H39.5v2zm6.072 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.097 0h4.048v-2H69.86v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0H90.1v-2h-4.048v2zm8.096 0h4.048v-2H94.15v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.097 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.049v-2h-4.049v2zm8.097 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.049v-2h-4.049v2zm8.097 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0h4.048v-2h-4.048v2zm8.096 0H250v-2h-2.024v2zm2.024 0c.676 0 1.323-.135 1.914-.38l-.766-1.847A2.987 2.987 0 01250 115v2zm4.62-3.086c.245-.591.38-1.238.38-1.914h-2c0 .409-.081.796-.227 1.148l1.847.766zM255 112v-2.083h-2V112h2zm0-6.25v-4.167h-2v4.167h2zm0-8.333V93.25h-2v4.167h2z"
fill="#C2CAD6"
/>
</svg>
)
}
export default Vector

View File

@@ -1,97 +0,0 @@
.root {
@apply font-display flex px-2 py-1.6;
justify-content: center;
align-items: center;
line-height: 22px;
font-size: 15px;
}
.primary {
@apply bg-blue font-display flex font-medium text-white;
font-size: 15px;
border-radius: 4px;
line-height: 22px;
}
.danger {
@apply py-2.5 px-2.5 text-red font-display font-medium;
height: 36px;
border-radius: 4px;
justify-content: center;
align-items: center;
display: flex;
flex-direction: row;
border: 1px solid #c2cad6;
}
.blue {
@apply text-blue;
}
.red {
@apply text-red;
}
.root:focus {
@apply outline-none;
}
.root[data-active] {
@apply bg-accent-6;
}
.loading {
@apply bg-accent-1 text-accent-3 border-accent-2 cursor-not-allowed;
}
.secondary {
@apply font-display text-greyscaleDark bg-white;
font-weight: 500;
font-size: 15px;
border: 1px solid #c2cad6;
box-sizing: border-box;
border-radius: 4px;
}
.menu {
@apply font-display text-greyscaleDark cursor-pointer;
font-family: Inter;
font-style: normal;
font-weight: 500;
font-size: 15px;
}
.dark {
@apply font-medium text-white;
background: #21324b;
border-radius: 4px;
}
.dark .disabled {
@apply font-medium text-white;
background: #21324b;
border-radius: 4px;
}
.secondary .disabled {
@apply font-medium;
color: rgba(9, 34, 72, 0.4);
}
.disabled,
.disabled:hover {
@apply text-gray-400 cursor-not-allowed;
border-radius: 4px;
}
.small {
width: 51px;
height: 24px;
font-family: Inter;
font-style: normal;
font-weight: 500;
font-size: 12px;
line-height: 16px;
}
.transparent {
@apply px-0 py-1 bg-transparent border-0;
}
.border {
@apply px-2 py-1.5;
border: 1px solid #c2cad6;
border-radius: 4px;
}

View File

@@ -1,88 +0,0 @@
import cn from 'classnames'
import React, { ButtonHTMLAttributes, forwardRef, JSXElementConstructor, useRef } from 'react'
import mergeRefs from 'react-merge-refs'
import s from './Button.module.css'
// import Loading from "../components/ui/Loading";
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
href?: string
className?: string
variant?: 'primary' | 'dark' | 'secondary' | 'menu' | 'danger'
color?: 'blue' | 'red'
active?: boolean
type?: 'submit' | 'reset' | 'button'
Component?: string | JSXElementConstructor<any>
width?: string | number
loading?: boolean
disabled?: boolean
small?: boolean
transparent?: boolean
target?: string
rel?: string
onClick?: any
border?: boolean
}
// eslint-disable-next-line react/display-name
export const Button: React.FC<ButtonProps> = forwardRef((props, buttonRef) => {
const {
className,
variant,
children,
active,
width,
small,
href,
color,
border,
loading = false,
disabled = false,
transparent = false,
style = {},
type = 'button',
Component = 'button',
...rest
} = props
const ref = useRef<typeof Component>(null)
const rootClassName = cn(
s.root,
{
[s.primary]: variant === 'primary',
[s.secondary]: variant === 'secondary',
[s.menu]: variant === 'menu',
[s.dark]: variant === 'dark',
[s.danger]: variant === 'danger',
[s.loading]: loading,
[s.disabled]: disabled,
[s.small]: small,
[s.transparent]: transparent,
[s.blue]: color === 'blue',
[s.red]: color === 'red',
[s.border]: border
},
className
)
return (
<Component
aria-pressed={active}
data-variant={variant}
ref={mergeRefs([ref, buttonRef])}
className={rootClassName}
disabled={disabled}
type={type}
href={href}
style={{
width,
...style
}}
{...rest}
>
{children}
</Component>
)
})
export default Button

View File

@@ -1 +0,0 @@
export { default } from './Button'

View File

@@ -1,31 +0,0 @@
.root {
@apply border-input text-dark focus:ring-dark focus:border-dark flex px-2 py-2 text-xs rounded-md shadow-sm;
border: 1px solid #c2cad6;
}
.root:focus {
@apply outline-none;
}
.dark {
flex: none;
width: 247px;
height: 36px;
left: 0px;
top: 0px;
color: white;
/* Translucent white/White light (20) */
background: rgba(255, 255, 255, 0.2);
border-radius: 4px;
border: none;
/* Inside Auto Layout */
order: 0;
flex-grow: 1;
}
.disabled,
.disabled:hover {
@apply text-accent-3 cursor-not-allowed;
}

View File

@@ -1,44 +0,0 @@
import cn from 'classnames'
import s from './Input.module.css'
import React, { InputHTMLAttributes } from 'react'
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
className?: string
onChange?: (...args: any[]) => any
disabled?: boolean
}
type Color = 'dark' | 'light'
const Input: React.FC<InputProps> = (props) => {
const { className, children, onChange, color, disabled, placeholder = '', ...rest } = props
const rootClassName = cn(
s.root,
{ [s.disabled]: disabled, [s.dark]: color === 'dark' },
className
)
const handleOnChange = (e: any) => {
if (onChange) {
onChange(e.target.value)
}
return null
}
return (
<input
className={rootClassName}
onChange={handleOnChange}
disabled={disabled}
autoComplete="off"
autoCorrect="off"
autoCapitalize="off"
spellCheck="false"
placeholder={placeholder}
{...rest}
/>
)
}
export default Input

View File

@@ -1 +0,0 @@
export { default } from './Input'

View File

@@ -1,19 +0,0 @@
import React from 'react'
export default function Loading() {
return (
<svg
className="w-5 h-5 text-dark animate-spin"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4" />
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
/>
</svg>
)
}

View File

@@ -1,90 +0,0 @@
.body {
font-family: Inter;
font-style: normal;
}
.dark {
@apply text-dark;
}
.greyscaleDark {
@apply text-greyscaleDark;
}
.white {
@apply text-white;
}
.greyscaleGrey {
@apply text-greyscaleGrey;
}
.grey {
@apply text-grayscale;
}
.red {
@apply text-red;
}
.blue {
@apply text-blue;
}
.heading {
@apply font-display;
}
.pageHeading {
@apply pt-1 pb-4 text-2xl font-bold leading-7 tracking-wide;
}
.a {
font-family: Inter;
font-style: normal;
}
.tiny {
font-size: 12px;
line-height: 16px;
}
.small {
font-size: 15px;
}
.normal {
font-size: 15px;
line-height: 22px;
}
.large {
font-size: 18px;
line-height: 26px;
}
.big {
font-size: 26px;
line-height: 36px;
}
.heading {
font-size: 36px;
line-height: 48px;
}
.subHeading {
font-family: Inter;
font-style: normal;
font-weight: 500;
}
.sectionHeading {
@apply text-lg font-medium font-display;
color: gray;
}
.item {
font-family: Inter;
font-style: normal;
}

View File

@@ -1,123 +0,0 @@
import cn from 'classnames'
import React, {
CSSProperties,
ForwardedRef,
forwardRef,
FunctionComponent,
JSXElementConstructor
} from 'react'
import mergeRefs from 'react-merge-refs'
import s from './Text.module.css'
export interface TextProps {
variant?: Variant
className?: string
style?: CSSProperties
children?: React.ReactNode | any
color?: Color
html?: string
size?: Size
target?: any
rel?: any
href?: string
onClick?: () => any
name?: any
}
type Variant = 'heading' | 'body' | 'pageHeading' | 'sectionHeading' | 'item' | 'subHeading' | 'a'
type Size = 'tiny' | 'small' | 'normal' | 'large' | 'big' | 'heading'
type Color = 'dark' | 'grey' | 'blue' | 'greyscaleDark' | 'greyscaleGrey' | 'red' | 'white'
export const Text: FunctionComponent<TextProps> = forwardRef(function DefaultText(
{
style,
className = '',
variant = 'body',
color,
children,
html,
onClick,
size,
rel,
href,
target,
name
},
ref: ForwardedRef<HTMLElement>
) {
const componentsMap: {
[P in Variant]: React.ComponentType<any> | string
} = {
body: 'div',
heading: 'h1',
pageHeading: 'h1',
sectionHeading: 'h2',
subHeading: 'h3',
item: 'p',
a: 'a'
}
const Component:
| JSXElementConstructor<any>
| React.ReactElement<any>
| React.ComponentType<any>
| string = componentsMap![variant!]
const htmlContentProps = html
? {
dangerouslySetInnerHTML: { __html: html }
}
: {}
const aProps =
variant === 'a'
? {
rel,
href,
target
}
: {}
return (
<Component
ref={ref}
className={cn(
s.root,
{
[s.body]: variant === 'body',
[s.a]: variant === 'a',
[s.heading]: variant === 'heading',
[s.pageHeading]: variant === 'pageHeading',
[s.sectionHeading]: variant === 'sectionHeading',
[s.subHeading]: variant === 'subHeading',
[s.item]: variant === 'item',
[s.dark]: color === 'dark',
[s.greyscaleDark]: color === 'greyscaleDark',
[s.grey]: color === 'grey',
[s.blue]: color === 'blue',
[s.tiny]: size === 'tiny',
[s.small]: size === 'small',
[s.normal]: size === 'normal',
[s.large]: size === 'large',
[s.big]: size === 'big',
[s.heading]: size === 'heading',
[s.greyscaleGrey]: color === 'greyscaleGrey',
[s.red]: color === 'red',
[s.white]: color === 'white'
},
className
)}
onClick={onClick}
style={style}
{...htmlContentProps}
{...aProps}
name={name}
>
{children}
</Component>
)
})
export default Text

View File

@@ -1,2 +0,0 @@
export * from './Text'
export { default } from './Text'

View File

@@ -1,2 +0,0 @@
export * from './Button/Button'
export * from './Text/Text'

View File

@@ -1,90 +0,0 @@
---
title: 'Authenticate users'
---
You defined `select` permissions for the `public` role in the previous section. You will now add `insert` and `create` permissions for authenticated users to secure your app's GraphQL API with authentication.
> Nhost's authentication service lets you deliver frictionless registration and login experiences to your users. We support most social providers and different methods such as email & password and passwordless (magic link).
---
## Insert a test user
Manually create a user by going to your app's **Users** tab (top menu) and clicking on **Add User**.
![Add user](/images/quick-start/add-user.gif)
You will now use that newly created user to make authenticated requests to the API.
---
## Authenticate and query data
Add the following code to sign in the new user and request the list of todos again:
```js
import { NhostClient } from '@nhost/nhost-js'
const nhost = new NhostClient({
backendUrl: 'https://[app-subdomain].nhost.run'
})(async () => {
// Sign in user
const signInResponse = await nhost.auth.signIn({
email: 'joe@example.com',
password: 'securepassword'
})
// Handle sign-in error
if (signInResponse.error) {
throw signInResponse.error
}
// Get todos
const todos = await nhost.graphql.request(`
query {
todos {
id
created_at
name
is_completed
}
}
`)
console.log(JSON.stringify(todos.data, null, 2))
})()
```
Why is the return value `null`? Because when making GraphQL requests as an authenticated user, the `user` role is assumed.
> For authenticated requests, there is always the option to override the default `user` role with any other valid role.
---
## Permissions for users
### Remove permissions for the public role
We won't use the `public` role anymore, so let's remove all permission for that role.
![Remove public permissions from Hasura](/images/quick-start/remove-public-permissions.png)
Now we'll add permissions for the `user` role.
> All logged-in users have the `user` role.
### Insert permission
First, we'll set the **Insert permission**.
A user can only insert `name` because all other columns will be set automatically. More specifically, `user_id` is set to the user's id making the request (`x-hasura-user-id`) and is configured in the `Column presets` section. See the image below.
![User insert permission](/images/quick-start/user-insert-permission.png)
### Select permission
For **Select permission**, set a **custom check** so users can only select todos where `user_id` is the same as their user id. In other words: users are only allowed to select their own todos. See the image below.
![User select permission](/images/quick-start/user-select-permission.png)
Now rerun the app. New todos are inserted, and only todos for the user are fetched and displayed. Your backend is successfully secured!

View File

@@ -1,34 +0,0 @@
---
title: 'The Nhost platform'
---
This section:
### Database
- [Schema](/platform/database)
- [Permissions](/platform/database/permissions)
- [GraphQL](/platform/database/graphql)
### Authentication
- [Authentication overview](/platform/authentication)
- [User management](/platform/authentication/user-management)
- [Sign-in methods](/platform/authentication/sign-in-methods)
- [Social login](/platform/authentication/social-login)
- [Email templates](/platform/authentication/email-templates)
### Storage
- [File storage](/platform/storage)
### Serverless functions
- [Creating functions](/platform/serverless-functions)
- [Event triggers](/platform/serverless-functions/event-triggers)
### Nhost
- [Environment variables](/platform/nhost/environment-variables)
- [GitHub integration](/platform/nhost/github-integration)
- [Local development](/platform/nhost/local-development)

View File

@@ -1,9 +0,0 @@
---
title: 'Overview'
---
Documentation for other platform features:
- [Environment variables](/platform/nhost/environment-variables)
- [GitHub integration](/platform/nhost/github-integration)
- [Local development](/platform/nhost/local-development)

View File

@@ -1,30 +0,0 @@
---
title: 'Reference'
---
In this section:
### Nhost SDK
- [Overview](/reference/sdk)
- [GraphQL](/reference/sdk/graphql)
- [Authentication](/reference/sdk/authentication)
- [Storage](/reference/sdk/storage)
- [Functions](/reference/sdk/functions)
### React
- [Getting started](./reference/react)
- [Hooks](./reference/react/hooks)
- [Protecting routes](./reference/react/protecting-routes)
- [Apollo GraphQL](./reference/react/apollo)
### Next.js
- [Introduction](./reference/nextjs)
- [Configuration](./reference/nextjs/configuration)
- [Protecting routes](./reference/nextjs/protecting-routes)
### Nhost CLI
- [CLI overview](/reference/cli)

View File

@@ -1,121 +0,0 @@
---
title: 'Configuration'
---
## Installation
With yarn:
```sh
yarn add @nhost/react @nhost/nextjs
```
With Npm:
```sh
npm install @nhost/react @nhost/nextjs
```
---
## Configuration
Configuring Nhost with Next.js follows the same logic as React, except we are initializing with `NhostSSR` instead of `Nhost`.
Under the hood, `NhostSSR` uses cookies to store the refresh token, and disables auto-refresh and auto-login when running on the server-side.
```jsx
// {project-root}/pages/_app.tsx
import type { AppProps } from 'next/app'
import { NhostSSR, NhostProvider } from '@nhost/nextjs'
import Header from '../components/Header'
const nhost = new NhostSSR({ backendUrl: 'my-app.nhost.run' })
function MyApp({ Component, pageProps }: AppProps) {
return (
<NhostProvider nhost={nhost} initial={pageProps.nhostSession}>
<div>
<Header />
<Component {...pageProps} />
</div>
</NhostProvider>
)
}
export default MyApp
```
---
## Client-side rendering
The logic is the same as in a classic React application:
```jsx
// {project-root}/pages/csr-page.jsx
import { NextPageContext } from 'next'
import React from 'react'
import { useAccessToken, useAuthenticated, useUserData } from '@nhost/react'
const ClientSidePage: React.FC = () => {
const isAuthenticated = useAuthenticated()
const user = useUserData()
const accessToken = useAccessToken()
if (!isAuthenticated) return <div>User it not authenticated</div>
return (
<div>
<h1>{user?.displayName} is authenticated</h1>
<div>Access token: {accessToken}</div>
</div>
)
}
export default ClientSidePage
```
---
## Server-side rendering
You need to load the session from the server first from `getServerSideProps`. Once it is done, the `_app` component will make sure to load or update the session through `pageProps`.
```jsx
// {project-root}/pages/ssr-page.jsx
import { NextPageContext } from 'next'
import React from 'react'
import {
getNhostSession,
NhostSession,
useAccessToken,
useAuthenticated,
useUserData
} from '@nhost/react'
export async function getServerSideProps(context: NextPageContext) {
const nhostSession = await getNhostSession('my-app.nhost.run', context)
return {
props: {
nhostSession
}
}
}
const ServerSidePage: React.FC<{ initial: NhostSession }> = () => {
const authenticated = useAuthenticated()
const user = useUserData()
const accessToken = useAccessToken()
if (!authenticated) return <div>User it not authenticated</div>
return (
<div>
<h1>{user?.displayName} is authenticated</h1>
<div>Access token: {accessToken}</div>
</div>
)
}
export default ServerSidePage
```

View File

@@ -1,41 +0,0 @@
---
title: 'Protecting routes'
---
Create a `auth-protected.js` file:
```jsx
import { useRouter } from 'next/router'
import { useAuthLoading, useAuthenticated } from '@nhost/react'
export function authProtected(Comp) {
return function AuthProtected(props) {
const router = useRouter()
const isLoading = useAuthLoading()
const isAuthenticated = useAuthenticated()
if (isLoading) {
return <div>Loading...</div>
}
if (!isAuthenticated) {
router.push('/login')
return null
}
return <Comp {...props} />
}
}
```
Then wrap the Next.js page with `authProtected` to only allow signed in users to access the page.
```js
import { authProtected } from '<some-path>/auth-protected'
function Index() {
return <div>Only signed in users can access this page.</div>
}
export default authProtected(Index)
```

View File

@@ -1,96 +0,0 @@
---
title: 'Apollo GraphQL'
---
## Installation
With Yarn:
```sh
yarn add @nhost/react @nhost/react-apollo
```
With Npm:
```sh
npm install @nhost/react @nhost/react-apollo
```
## Configuration
Let's add a `NhostApolloProvider`. Make sure the Apollo Provider is nested into `NhostProvider`, as it will need the Nhost context to determine the authentication headers to be sent to the GraphQL endpoint.
```jsx
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
import { NhostApolloProvider } from '@nhost/react-apollo'
import { NhostProvider } from '@nhost/react'
import { Nhost } from '@nhost/client'
const nhost = new Nhost({
backendUrl: 'http://localhost:1337'
})
ReactDOM.render(
<React.StrictMode>
<NhostProvider nhost={nhost}>
<NhostApolloProvider>
<App />
</NhostApolloProvider>
</NhostProvider>
</React.StrictMode>,
document.getElementById('root')
)
```
## Usage
All the [Apollo hooks](https://www.apollographql.com/docs/react/api/react/hooks/) will work together with the right authentication status, for any operation - queries, mutations, and subscriptions over websockets.
As an example:
```jsx
import { gql, useQuery } from '@apollo/client'
import { useAuthenticated } from '@nhost/react'
const GET_BOOKS = gql`
query Books {
books {
id
name
}
}
`
export const BooksQuery = () => {
const isAuthenticated = useAuthenticated()
const { loading, data, error } = useQuery(GET_BOOKS)
if (!isAuthenticated) return <div>You must be authenticated to see this page</div>
if (loading) return <div>Loading...</div>
if (error) return <div>Error in the query {error.message}</div>
return (
<div>
<ul>
{data?.books.map((book) => (
<li key={book.id}>{book.name}</li>
))}
</ul>
</div>
)
}
```
## Hooks
### `useAuthQuery`
Works exactly as the original Apollo's [`useQuery`](https://www.apollographql.com/docs/react/api/react/hooks/#usequery) except the query will be skipped if the user is not authenticated.
---
## Read more
More information about the dependent packages:
- [`@apollo/client`](https://www.npmjs.com/package/@apollo/client)
- [`graphql`](https://www.npmjs.com/package/graphql)

View File

@@ -1,401 +0,0 @@
---
title: 'Hooks'
---
## Authentication Hooks
### Email and Password Sign-Un
```js
const { signUp, isLoading, isSuccess, needsVerification, isError, error } =
useEmailPasswordSignUp(email?: string, password?: string, options?: Options )
```
| Name | Type | Notes |
| ---------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `signUp` | (email?: string, password?: string) => void | Used for a new user to sign up. The email/password arguments will take precedence over the possible state values used when creating the hook. |
| `isLoading` | boolean | Returns `true` when the action is executing, `false` when it finished its execution. |
| `needsVerification` | boolean | Returns `true` if the sign-up has been accepted, but a verificaiton email has been sent and is awaiting. |
| `isSuccess` | boolean | Returns `true` if the sign-up suceeded. Returns `false` if the new email needs to be verified first, or if an error occurred. |
| `isError` | boolean | Returns `true` if an error occurred. |
| `error` | {status: number, error: string, message: string} \| undefined | Provides details about the error. |
| `options.locale` | string \| undefined | Locale of the user, in two digits, for instance `en`. |
| `options.allowedRoles` | string[] \| undefined | Allowed roles of the user. Must be a subset of the default allowed roles defined in Hasura Auth. |
| `options.defaultRole` | string \| undefined | Default role of the user. Must be part of the default allowed roles defined in Hasura Auth. |
| `options.displayName` | string \| undefined | |
| `options.metadata` | Record<string, unknown> \| undefined | Custom additional user information stored in the `metadata` column. Can be any JSON object. |
| `options.redirectTo` | string \| undefined | redirection path in the client application that will be used in the link in the verification email. For instance, if you want to redirect to `https://myapp.com/success`, the `redirectTo` value is `'/success'`. |
#### Usage
```jsx
import { useState } from 'react'
import { useEmailPasswordSignUp } from '@nhost/react'
const Component = () => {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const { signUp, isLoading, isSuccess, needsVerification, isError, error } =
useEmailPasswordSignUp(email, password)
return (
<div>
<input value={email} onChange={(event) => setEmail(event.target.value)} placeholder="Email" />
<input
value={password}
onChange={(event) => setPassword(event.target.value)}
placeholder="Password"
/>
<button onClick={signUp}>Register</button>
{isSuccess && <div>Your account have beed created! You are now authenticated</div>}
{needsVerification && (
<div>Please check your mailbox and follow the verification link to verify your email</div>
)}
</div>
)
}
```
### Email and Password Sign-In
```js
const { signIn, isLoading, needsVerification, isSuccess, isError, error } =
useEmailPasswordSignIn(email?: string, password?: string)
```
| Name | Type | Notes |
| ------------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `signIn` | (email?: string, password?: string) => void | Will try to authenticate. The email/password arguments will take precedence over the possible state values used when creating the hook. |
| `isLoading` | boolean | Returns `true` when the action is executing, `false` when it finished its execution. |
| `needsVerification` | boolean | Returns `true` if the user email is still pending verification. |
| `isSuccess` | boolean | Returns `true` if the user has successfully authenticated. Returns `false` in case or error or if the new email needs to be verified first. |
| `isError` | boolean | Returns `true` if an error occurred. |
| `error` | {status: number, error: string, message: string} \| undefined | Provides details about the error. |
#### Usage
```jsx
import { useState } from 'react'
import { useEmailPasswordSignIn } from '@nhost/react'
const Component = () => {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const { signIn, isLoading, isSuccess, needsVerification, isError, error } =
useEmailPasswordSignIn(email, password)
return (
<div>
<input value={email} onChange={(event) => setEmail(event.target.value)} placeholder="Email" />
<input
value={password}
onChange={(event) => setPassword(event.target.value)}
placeholder="Password"
/>
<button onClick={signUp}>Register</button>
{isSuccess && <div>Authentication suceeded</div>}
{needsVerification && (
<div>
You must verify your email to sign in. Check your mailbox and follow the instructions to
verify your email.
</div>
)}
</div>
)
}
```
### Oauth Providers
```js
import { useProviderLink } from '@nhost/react'
const Component = () => {
const { github } = useProviderLink()
return <a href={github}>Authenticate with GitHub</a>
}
```
### Passwordless email authentication
```js
const { signIn, isLoading, isSuccess, isError, error } =
useEmailPasswordlessSignIn(email?: string, options?: Options)
```
| Name | Type | Notes |
| ---------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `signIn` | (email?: string) => void | Sends a magic link to the given email The email argument will take precedence over the the possible state value used when creating the hook. |
| `isLoading` | boolean | Returns `true` when the action is executing, `false` when it finished its execution. |
| `isSuccess` | boolean | Returns `true` if the magic link email user has successfully send. |
| `isError` | boolean | Returns `true` if an error occurred. |
| `error` | {status: number, error: string, message: string} | Provides details about the error. |
| `options.locale` | string \| undefined | Locale of the user, in two digits, for instance `en`. |
| `options.allowedRoles` | string[] \| undefined | Allowed roles of the user. Must be a subset of the default allowed roles defined in Hasua Auth. |
| `options.defaultRole` | string \| undefined | Default role of the user. Must be part of the default allowed roles defined in Hasura Auth. |
| `options.displayName` | string \| undefined |
| `options.metadata` | Record<string, unknown> \| undefined | Custom additional user information stored in the `metadata` column. Can be any JSON object. |
| `options.redirectTo` | string \| undefined | Redirection path in the client application that will be used in the link in the verification email. For instance, if you want to redirect to `https://myapp.com/success`, the `redirectTo` value is `'/success'`. |
#### Usage
```jsx
import { useState } from 'react'
import { useEmailPasswordlessSignIn } from '@nhost/react'
const Component = () => {
const [email, setEmail] = useState('')
const { signIn, isLoading, isSuccess, isError, error } = useEmailPasswordlessSignIn(email)
return (
<div>
<input value={email} onChange={(event) => setEmail(event.target.value)} placeholder="Email" />
<button onClick={signUp}>Register</button>
{isSuccess && (
<div>
An email has been sent to {email}. Please check your mailbox and click on the
authentication link.
</div>
)}
</div>
)
}
```
### Sign Out
The `useSignOut` hook accepts an `all` argument that will be used when the `signOut` method will be called. This value can be overriden in calling `signOut(allValue)`.
```js
const { signOut, isSuccess } = useSignOut(all?: boolean)
```
| Name | Type | Notes |
| ----------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `signOut` | (all?: boolean) => void | Will log the current user out. If `all` is set to true, it will deactivate the active session from all other devices. The `all` argument will take precedence over the the possible state value used when creating the hook. |
| `isSuccess` | boolean | Returns `true` when the user has successfully signed out. |
#### Usage
```jsx
import { useState } from 'react'
import { useSignOut, useAuthenticated } from '@nhost/react'
const Component = () => {
const { signOut, isSuccess } = useSignOut()
const authenticated = useAuthenticated()
if (authenticated)
return (
<div>
<button onClick={signUp}>Sign Out</button>
{isSuccess && <div>You have successfully signed out!</div>}
</div>
)
else return <div>Not authenticated</div>
}
```
## Authentication status
### `useAuthLoading`
The Nhost client may need some initial steps to determine the authentication status during startup, like fetching a new JWT from an existing refresh token.
`useAuthLoading` will return `true` until the authentication status is known.
#### Usage
```jsx
import { useAuthLoading, useAuthenticated } from '@nhost/react'
const Component = () => {
const isLoading = useAuthLoading()
const isAuthenticated = useAuthenticated()
if (isLoading) return <div>Loading Nhost authentication status...</div>
else if (isAuthenticated) return <div>User is authenticated</div>
else return <div>Public section</div>
}
```
### Get the JWT access token
<!-- TODO better documentation -->
```js
const accessToken = useAccessToken()
```
## User management
### Change email
```js
const { changeEmail, isLoading, isSuccess, needsVerification, isError, error } =
useChangeEmail(email?: string, options?: { redirectTo?: string })
```
| Name | Type | Notes |
| ------------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `changeEmail` | (email?: string) => void | Rrequests the email change. The arguement password will take precedence over the the possible state value used when creating the hook. |
| `isLoading` | boolean | Returns `true` when the action is executing, `false` when it finished its execution. |
| `needsVerification` | boolean | Returns `true` if the email change has been requested, but that a email has been sent to the user to verify the new email. |
| `isError` | boolean | Returns `true` if an error occurred. |
| `error` | {status: number, error: string, message: string} \| undefined | Provides details about the error. |
| `redirectTo` | string \| undefined | Redirection path in the client application that will be used in the link in the verification email. For instance, if you want to redirect to `https://myapp.com/success`, the `redirectTo` value is `'/success'`. |
#### Usage
```jsx
import { useState } from 'react'
import { useChangeEmail } from '@nhost/react'
const Component = () => {
const [email, setEmail] = useState('')
const { changeEmail, isLoading, needsVerification, isError, error } = useChangeEmail(password)
return (
<div>
<input value={email} onChange={(event) => setEmail(event.target.value)} />
<button onClick={changeEmail}>Change password</button>
{needsVerification && (
<div>
Please check your mailbox and follow the verification link to confirm your new email
</div>
)}
</div>
)
}
```
### Change password
```js
const { changePassword, isLoading, isSuccess, isError, error } = useChangePassword(password?: string)
```
| Name | Type | Notes |
| ---------------- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `changePassword` | (password?: string) => void | Requests the password change. The arguement password will take precedence over the the possible state value used when creating the hook. |
| `isLoading` | boolean | Returns `true` when the action is executing, `false` when it finished its execution. |
| `isSuccess` | boolean | Returns `true` if the password has beed successfully changed. |
| `isError` | boolean | Returns `true` if an error occurred. |
| `error` | {status: number, error: string, message: string} \| undefined | Provides details about the error. |
#### Usage
```jsx
import { useState } from 'react'
import { useChangePassword } from '@nhost/react'
const Component = () => {
const [password, setPassword] = useState('')
const { changePassword, isLoading, isSuccess, isError, error } = useChangePassword(password)
return (
<div>
<input value={password} onChange={(event) => setPassword(event.target.value)} />
<button onClick={changePassword}>Change password</button>
</div>
)
}
```
### Reset password
If a user loses their password, we can resend them an email to authenticate so that they can change it to a new one:
```js
const { resetPassword, isLoading, isSent, isError, error } = useResetPassword(email?: string, options?: { redirectTo?: string })
```
| Name | Type | Notes |
| --------------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `resetPassword` | (email?: string) => void | Sends an email with a temporary connection link. The arguement email will take precedence over the the possible state value used when creating the hook. |
| `isLoading` | boolean | Returns `true` when the action is executing, `false` when it finished its execution. |
| `isSent` | boolean | Returns `true` when the email has been successfully sent. |
| `isError` | boolean | Returns `true` if an error occurred. |
| `error` | {status: number, error: string, message: string} \| undefined | Provides details about the error. |
| `redirectTo` | string \| undefined | Redirection path in the client application that will be used in the link in the verification email. For instance, if you want to redirect to `https://myapp.com/success`, the `redirectTo` value is `'/success'`. |
#### Usage
```jsx
import { useState } from 'react'
import { useResetPassword } from '@nhost/react'
const Component = () => {
const [email, setEamil] = useState('')
const { resetPassword, isLoading, isSent, isError, error } = useResetPassword(email?: string)
return (
<div>
<input value={email} onChange={(event) => setEmail(event.target.value)} />
<button onClick={resetPassword}>Send reset link</button>
</div>
)
}
```
## User data
<!-- TODO document -->
```js
const userData = useUserData()
```
### Avatar
```jsx
import { useAvatarUrl } from '@nhost/react'
const Avatar = () => {
const avatar = useAvatarUrl()
return <img src={avatar} alt="Avatar" />
}
```
### User roles
```jsx
import { useUserRoles, useDefaultRole } from '@nhost/react'
const Avatar = () => {
const roles = useUserRoles()
const defaultRole = useDefaultRole()
return (
<div>
Your default role is {defaultRole}. You have the following roles: {roles.join(', ')}
</div>
)
}
```
### Display name
```jsx
import { displayName } from '@nhost/react'
const Avatar = () => {
const displayName = useDisplayName()
return <div>Hello, {displayName}</div>
}
```
### Email
```js
const email = useEmail()
```
### User Id
```js
const userId = useUserId()
```
### Anonymous user
```js
const isAnonymous = useIsAnonymous()
```
### Locale
```js
const locale = useUserLocale()
```

View File

@@ -1,62 +0,0 @@
---
title: 'Getting started'
---
## Installation
With Yarn:
```sh
yarn add @nhost/react
```
With Npm:
```sh
npm install @nhost/react
```
---
## Configuration
`@nhost/react` exports a React provider `NhostProvider` that makes the authentication state and the several hooks available in your application. Wrap this component around your whole App.
```jsx
import React from 'react'
import ReactDOM from 'react-dom'
import { NhostProvider } from '@nhost/react'
import { Nhost } from '@nhost/client'
import App from './App'
const nhost = new Nhost({
backendUrl: 'http://localhost:1337'
})
ReactDOM.render(
<React.StrictMode>
<NhostProvider nhost={nhost}>
<App />
</NhostProvider>
</React.StrictMode>,
document.getElementById('root')
)
```
---
### Options
```js
const nhost = new Nhost({ backendUrl, autoSignIn, autoRefreshToken, storageGetter, storageSetter })
```
| Name | Type | Default | Notes |
| ------------------ | ----------------------------------- | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `backendUrl` | string | | The Nhost app url, for instance `https://my-app.nhost.run`. When using the CLI, its value is `http://localhost:1337` |
| `autoSignIn` | boolean | `true` | If set to `true`, the client will detect credentials in the current URL that could have been sent during an email verification or an Oauth authentication. It will also automatically authenticate all the active tabs in the current browser. |
| `autoRefreshToken` | boolean | `true` | If set to `true`, the JWT (access token) will be automatically refreshed before it expires. |
| `storageGetter` | (key:string) => string \| null | use localStorage | Nhost stores a refresh token in `localStorage` so the session can be restored when starting the browser. |
| `storageSetter` | (key: string, value: string \| null | use localStorage | |

View File

@@ -1,44 +0,0 @@
---
title: 'Protecting routes'
---
## React Router
You can protect routes by creating an `AuthGate` component when using `@nhost/react` with [React Router](https://reactrouter.com/web/guides/quick-start).
```jsx
import { Redirect } from 'react-router-dom'
import { useAuthLoading, useAuthenticated } from '@nhost/react'
export function AuthGate(children) {
const isLoading = useAuthLoading()
const isAuthenticated = useAuthenticated()
if (isLoading) {
return <div>Loading...</div>
}
if (!isAuthenticated) {
return <Redirect to="/login" />
}
return children
}
```
Then, in your React Router, wrap the `AuthGate` component around the routes you want to protect:
```jsx
<Router>
<Switch>
<Route path="/login">
<Login />
</Route>
<Route path="/" exact>
<AuthGate> // <--- Use AuthGate component like this
<div>My protected dashboard</div>
</AuthGate>
</Route>
</Switch>
</Router>
```

View File

@@ -1,134 +0,0 @@
---
title: 'Authentication'
---
## nhost.auth.signIn()
Sign in a user with one of the following methods:
- Email and Password
- Passwordless Email (Magic Link)
- Passwordless SMS
- OAuth Provider
If the user does not exist, the user is created. Only exception is when using Email and Password. To sign in a user with Email and password a user first must sign up.
### Examples
#### Sign in with Email and Password
```js
const { session, mfa, error } = await nhost.auth.signIn({
email: 'username@gmail.com',
password: 'my-secret-password'
})
```
### Sign in with Passwordless Email (Magic link)
An email will be sent to the user's email with a link. When the user clicks on the link the user will be automatically redirected and signed-in to your app.
```js
const { error } = await nhost.auth.signIn({
email: 'username@gmail.com'
})
```
### Sign in with Passwordless SMS
Start the sign-in process for a user using SMS. This will send a One-time Password (OTP) to the user:
```js
const { session, error } = await nhost.auth.signIn({
phoneNumber: '+46123456789'
})
```
To verify the phone number and to sign in the user, combine the phone number and the OTP for the user:
```js
const { session, error } = await nhost.auth.signIn({
phoneNumber: '+46123456789',
otp: '<otp-from-sms>'
})
```
### Sign in with OAuth Provider
The following providers are available:
- `google`
- `github`
- `facebook`
- `spotify`
```js
const { session, providerUrl, provider, error } = await nhost.auth.signIn({
provider: 'google'
})
```
---
## `nhost.auth.signUp()`
Sign up a new user using email and password.
```js
const { session, error } = await nhost.auth.signUp({
email: 'username@gmail.com',
password: 'my-secret-password',
options: {
displayName: 'John Doe'
}
})
```
## `nhost.auth.signOut()`
Sign Out the current user.
## `nhost.auth.getUser()`
Get information about the current user.
```js
const user = nhost.auth.getUser()
```
## `nhost.auth.changeEmail()`
Change the email of the current user. For the new email to be in effect, the user must verify the new email address by clicking on the link in the email that is sent out after executing this method.
```js
const { error } = await nhost.auth.changeEmail({ newEmail })
```
## `nhost.auth.changePassword()`
Change the password of the current user. The old password is not needed when changing the password.
```js
const { error } = await nhost.auth.changePassword({ newPassword })
```
## `nhost.auth.resetPassword()`
Reset password for a user. Calling this function sends an email to the user with a link to reset their password.
```js
const { error } = await nhost.auth.resetPassword({ email })
```
## `nhost.auth.onAuthStateChanged(event, session)`
Use `onAuthStateChanged` to add a custom function that is triggered
whenever the user's state changes. For example, from signed in to signed out or
vice versa.
```js
nhost.auth.onAuthStateChanged(({ event, session }) => {
// event = 'SIGNED_IN' | 'SIGNED_OUT'
console.log(`Auth state changed. State is now ${event} with the session: ${session}`)
})
```

View File

@@ -1,13 +0,0 @@
---
title: 'Functions'
---
## `nhost.functions.call()`
Send a request to a serverless function:
```js
const { res, error } = await nhost.functions.call('/test', { name: 'Johan' })
```
If the user is signed in, the user's access token is attached in the `Authorization` header.

View File

@@ -1,33 +0,0 @@
---
title: 'GraphQL'
---
## nhost.graphql.request()
Make GraphQL query or mutation request.
| Variable | Type | Notes |
| ---------------- | ------ | --------------------------------------------- |
| query (required) | String | A valid GraphQL query or mutation. |
| variables | Object | Key-value pairs to use in your GraphQL query. |
| httpOptions | Object | |
```js
const { data, error } = await nhost.graphql.request(`
query {
customers {
id
name
public
}
}
`)
```
## `nhost.graphql.getUrl()`
Returns the GraphQL API endpoint of the Nhost app.
```js
const graphqlEndpoint = nhost.graphql.getUrl()
```

View File

@@ -1,48 +0,0 @@
---
title: 'Storage'
---
## `nhost.storage.upload()`
Upload a file. Stores a new file or replaces an existing file.
| Parameter | Type | Notes |
| ----------------- | ------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| `file` (required) | [File](https://developer.mozilla.org/en-US/docs/Web/API/File) | The file to upload. |
| `bucketId` | String | The bucket to be used. If no `bucketId` is specified the default bucket is used. |
| `id` | String | Database ID of the file to override. If no `id` is specified, the server generates a unique ID for the file. |
| `name` | String | |
```js
const { fileMetadata, error } = await nhost.storage.upload({ file })
```
---
## `nhost.storage.getPublicUrl()`
Get the public URL of a file. To access the file via public URL, the file must have the `select` permission for the `public` role.
```js
const url = nhost.storage.getPublicUrl({ fileId })
```
---
## `nhost.storage.getPresignedUrl()`
Get a presigned URL for a file. To generate a presigned URL for the file, a user has to be logged in and have `select` permission to the file.
```js
const { presignedUrl, error } = await nhost.storage.getPresignedUrl({ fileId })
```
---
## `nhost.storage.delete()`
Delete a file.
```js
const { error } = await nhost.storage.delete({ fileId })
```

View File

@@ -1,112 +0,0 @@
export const nhostTheme = {
hljs: {
display: 'block',
background: '#F4F7F9',
color: '#21324B'
},
'hljs-tag': {
color: '#9C73DF'
},
'hljs-keyword': {
color: '#9C73DF',
fontWeight: 'bold'
},
'hljs-selector-tag': {
color: '#9C73DF',
fontWeight: 'bold'
},
'hljs-literal': {
color: '#9C73DF',
fontWeight: 'bold'
},
'hljs-strong': {
color: '#9C73DF'
},
'hljs-name': {
color: '#9C73DF'
},
'hljs-code': {
color: '#66d9ef'
},
'hljs-class .hljs-title': {
color: 'red'
},
'hljs-attribute': {
color: '#bf79db'
},
'hljs-symbol': {
color: '#bf79db'
},
'hljs-regexp': {
color: '#bf79db'
},
'hljs-link': {
color: '#bf79db'
},
'hljs-string': {
color: '#B7A590'
},
'hljs-bullet': {
color: '#B7A590'
},
'hljs-subst': {
color: '#B7A590'
},
'hljs-title': {
color: '#B7A590',
fontWeight: 'bold'
},
'hljs-section': {
color: '#B7A590',
fontWeight: 'bold'
},
'hljs-emphasis': {
color: '#3ECF8E'
},
'hljs-type': {
color: '#3ECF8E',
fontWeight: 'bold'
},
'hljs-built_in': {
color: '#3ECF8E'
},
'hljs-builtin-name': {
color: '#3ECF8E'
},
'hljs-selector-attr': {
color: '#3ECF8E'
},
'hljs-selector-pseudo': {
color: '#3ECF8E'
},
'hljs-addition': {
color: '#3ECF8E'
},
'hljs-variable': {
color: '#3ECF8E'
},
'hljs-template-tag': {
color: '#3ECF8E'
},
'hljs-template-variable': {
color: '#3ECF8E'
},
'hljs-comment': {
color: '#75715e'
},
'hljs-quote': {
color: '#75715e'
},
'hljs-deletion': {
color: '#75715e'
},
'hljs-meta': {
color: '#75715e'
},
'hljs-doctag': {
fontWeight: 'bold'
},
'hljs-selector-id': {
fontWeight: 'bold'
}
}

View File

@@ -1,112 +0,0 @@
export const lightNhostTheme = {
hljs: {
display: 'block',
background: '#F4F7F9',
color: '#21324B'
},
'hljs-tag': {
color: '#9C73DF'
},
'hljs-keyword': {
color: '#9C73DF',
fontWeight: 'bold'
},
'hljs-selector-tag': {
color: '#9C73DF',
fontWeight: 'bold'
},
'hljs-literal': {
color: '#9C73DF',
fontWeight: 'bold'
},
'hljs-strong': {
color: '#9C73DF'
},
'hljs-name': {
color: '#9C73DF'
},
'hljs-code': {
color: '#66d9ef'
},
'hljs-class .hljs-title': {
color: 'red'
},
'hljs-attribute': {
color: '#bf79db'
},
'hljs-symbol': {
color: '#bf79db'
},
'hljs-regexp': {
color: '#bf79db'
},
'hljs-link': {
color: '#bf79db'
},
'hljs-string': {
color: '#B7A590'
},
'hljs-bullet': {
color: '#B7A590'
},
'hljs-subst': {
color: '#B7A590'
},
'hljs-title': {
color: '#B7A590',
fontWeight: 'bold'
},
'hljs-section': {
color: '#B7A590',
fontWeight: 'bold'
},
'hljs-emphasis': {
color: '#3ECF8E'
},
'hljs-type': {
color: '#3ECF8E',
fontWeight: 'bold'
},
'hljs-built_in': {
color: '#3ECF8E'
},
'hljs-builtin-name': {
color: '#3ECF8E'
},
'hljs-selector-attr': {
color: '#3ECF8E'
},
'hljs-selector-pseudo': {
color: '#3ECF8E'
},
'hljs-addition': {
color: '#3ECF8E'
},
'hljs-variable': {
color: '#3ECF8E'
},
'hljs-template-tag': {
color: '#3ECF8E'
},
'hljs-template-variable': {
color: '#3ECF8E'
},
'hljs-comment': {
color: '#75715e'
},
'hljs-quote': {
color: '#75715e'
},
'hljs-deletion': {
color: '#75715e'
},
'hljs-meta': {
color: '#75715e'
},
'hljs-doctag': {
fontWeight: 'bold'
},
'hljs-selector-id': {
fontWeight: 'bold'
}
}

View File

@@ -1,23 +0,0 @@
{
"order": [
{
"id": "get-started",
"name": "get-started",
"description": "get-started",
"pages": [
{
"route": "quickstart",
"display": "Quick Start"
},
{
"route": "app-development",
"display": "App Development"
},
{
"route": "workflow",
"display": "Workflow"
}
]
}
]
}

View File

@@ -1,15 +0,0 @@
export interface Meta {
order: CategoryLink[]
}
export interface CategoryLink {
id: string
name: string
description: string
pages: Page[]
}
interface Page {
route: string
display: string
}

View File

@@ -1,64 +0,0 @@
{
"siteLinks": [
{
"text": "product",
"links": [
{
"name": "Product",
"href": "https://nhost.io/#product"
},
{
"name": "Features",
"href": "https://nhost.io/#features"
},
{
"name": "Pricing",
"href": "https://nhost.io/pricing"
}
]
},
{
"text": "docs",
"links": [
{
"name": "Get Started",
"href": "/get-started"
},
{
"name": "Platform",
"href": "/platform"
},
{
"name": "Reference",
"href": "/reference"
}
]
},
{
"text": "Frameworks",
"links": [
{
"name": "API Reference",
"href": "/reference"
},
{
"name": "JS SDK",
"href": "/reference/sdk"
}
]
},
{
"text": "community",
"links": [
{
"name": "GitHub",
"href": "https://github.com/nhost"
},
{
"name": "Discord",
"href": "https://discord.com/invite/9V7Qb2U"
}
]
}
]
}

View File

@@ -1,8 +0,0 @@
export interface SiteLinks {
siteLinks: SiteLink[]
}
interface SiteLink {
text: string
links: string[]
}

View File

@@ -0,0 +1,125 @@
---
title: 'Authenticate users'
slug: /get-started/authentication
---
In the previous section, you defined `select` permissions for the `public` role. You will now add `insert` and `select` permissions for authenticated users to secure your app's GraphQL API with authentication.
> Nhost's authentication service lets you deliver frictionless registration and login experiences to your users. We support most social providers and different methods such as email & password and passwordless (magic link).
---
## Insert a test user
Manually create a user by going to your app's **Users** tab (top menu) and clicking on **Add User**.
<video width="99%" loop="" muted="" playsInline="" controls="true">
<source src="/videos/add-user.mp4" type="video/mp4" />
</video>
You will now use that newly created user. We'll use this newly created user to make authenticated requests to the GraphQL API.
---
## Sign in and query data
Add the following code to sign in the new user and request the list of todos again:
```js
import { NhostClient } from '@nhost/nhost-js';
const nhost = new NhostClient({
backendUrl: 'https://[app-subdomain].nhost.run',
})(async () => {
// Sign in user
const signInResponse = await nhost.auth.signIn({
email: 'joe@example.com',
password: 'securepassword',
});
// Handle sign-in error
if (signInResponse.error) {
throw signInResponse.error;
}
// Get todos
const todos = await nhost.graphql.request(`
query {
todos {
id
created_at
name
is_completed
}
}
`);
console.log(JSON.stringify(todos.data, null, 2));
})();
```
Why is the return value `null`? Because when making GraphQL requests as an authenticated user, the `user` role is assumed.
> For authenticated requests, there is always the option to override the default `user` role with any other valid role.
To prepare our database and GraphQL API to work for signed-in users we need to do two things:
1. Add a `user_id` column to the `todos` table, so we know what todo belongs to which user.
2. Use the `user` role instead of the `public` role for permissions.
## Add `user_id` column
Before adding the `user_id` column, let's delete all existing todos.
Then add the `user_id` column as a `UUID` type. Make sure that `nullable` is **not** checked. This will ensure that all todos must have a `user_id` value.
At last, we'll create a connection between the `todos` table and the `users` table. For that, we need to do yet another two things:
1. Create a Foreign Key (FK) between `todos` and `auth.users.id`.
2. Let Hasura track the relationship between the two tables.
<video width="99%" loop="" muted="" playsInline="" controls="true">
<source src="/videos/user-id-column.mp4" type="video/mp4" />
</video>
### Create FK
Create a FK between the `auth.users.id` column and the `public.todos.user_id` column. See video above.
### Track relationship
Click on the `public` schema and track the untracked foreign key relationship. Then click on the `auth` schema and track the relationship again. See video above.
We track these relationships to create the GrpahQL relationships between the `todos` table to the `users` table and the `users` table to the `todos` table.
Ok, our `user_id` column is added and connected correctly. Let's continue with setting permissions for signed-in users.
## Permissions for signed-in users
Let us organize the permissions so it works for signed in users too.
### Remove permissions for the public role
We won't use the `public` role anymore, so let's remove all permission for that role.
![Remove public permissions from Hasura](/img/quick-start/remove-public-permissions.png)
Now we'll add permissions for the `user` role.
> Signed-in users use the `user` role by default
### Insert permission
First, we'll set the **Insert permission**.
A user can only insert `name` because all other columns will be set automatically. More specifically, `user_id` is set to the user's id making the request (`x-hasura-user-id`) and is configured in the `Column presets` section. See the image below.
![User insert permission](/img/quick-start/user-insert-permission.png)
### Select permission
For **Select permission**, set a **custom check** so users can only select todos where `user_id` is the same as their user id. In other words: users are only allowed to select their own todos. See the image below.
![User select permission](/img/quick-start/user-select-permission.png)
Now rerun the app. New todos are inserted, and only todos for the user are fetched and displayed. Your backend is successfully secured!

View File

@@ -0,0 +1,4 @@
{
"label": "CLI",
"position": 8
}

View File

@@ -12,9 +12,9 @@ In the previous tutorials, we tested various parts of Nhost, such as:
All changes we did to our database and API happened directly in production of our Nhost app.
Its not ideal for making changes in production because you might break things, which will affect all users of your app.
It's not ideal for making changes in production because you might break things, which will affect all users of your app.
Instead, its recommended to make changes and test your app locally before deploying those changes to production.
Instead, it's recommended to make changes and test your app locally before deploying those changes to production.
To do changes locally, we need to have a complete Nhost app running locally, which the Nhost CLI does.
@@ -26,8 +26,8 @@ The Nhost CLI matches your production application in a local environment, this w
2. Push changes to GitHub.
3. Nhost automatically applies changes to production.
## What youll learn in this guide:
## What you'll learn in this guide:
- Use the Nhost CLI to create a local environment
- Connect a GitHub repository with a Nhost app
- Deploy local changes to production
- Deploy local changes to production

View File

@@ -4,13 +4,13 @@ title: 'Install the CLI'
Install the Nhost CLI using the following command:
```sql
```bash
sudo curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
```
Initialize a new Nhost App locally:
```sql
```bash
nhost init -n "nhost-example-app" && cd nhost-example-app
```
@@ -28,10 +28,10 @@ git push -u origin main
Now go back to the **Nhost Console** and click **Deployments**. You just made a new deployment to your Nhost app!
![Deployments tab](/images/cli-workflow/deployments-tab.png)
![Deployments tab](/img/cli-workflow/deployments-tab.png)
If you click on the deployment you can see that nothing was really deployed. Thats because we just made a change to the README file.
![Deployments details](/images/cli-workflow/deployments-details.png)
![Deployments details](/img/cli-workflow/deployments-details.png)
Let's do some local backend changes!

View File

@@ -4,11 +4,13 @@ title: 'Local changes'
Start Nhost locally:
```sql
```bash
nhost dev
```
>💡 Make sure you have [Docker](https://www.docker.com/get-started) installed on your computer. Its required for Nhost to work.
:::tip
Make sure you have [Docker](https://www.docker.com/get-started) installed on your computer. Its required for Nhost to work.
:::
The `nhost dev` command will automatically start a complete Nhost environment locally on your computer using:
@@ -23,18 +25,22 @@ You use this local environment to do changes and testing before you deploy your
Running `nhost dev` also starts the Hasura Console.
:::tip
It's important that you use the Hasura Console that is started automatically when you do changes. This way, changes are automatically tracked for you.
:::
>💡 Its important that you use the Hasura Console that is started automatically when you do changes. This way, changes are automatically tracked for you.
![Hasura Console](/images/cli-workflow/hasura-console.png)
![Hasura Console](/img/cli-workflow/hasura-console.png)
In the Hasura Console, create a new table `customers` with two columns:
- id
- name
<Video src="/videos/cli-workflow/hasura-create-customers-table.mp4">
</Video>
<video
src="/videos/cli-workflow/hasura-create-customers-table.mp4"
width="100%"
controls
/>
When we created the `customers` table there was also a migration created automatically. The migration was created at under `nhost/migrations/default`.
@@ -50,12 +56,11 @@ This database migration has only been applied locally, meaning, you created the
To apply the local change to production we need to commit the changes and push it to GitHub. Nhost will then automatically pick up the change in the repository and apply the changes.
<aside>
💡 You can commit and push files in another terminal while still having `nhost dev` running.
:::tip
You can commit and push files in another terminal while still having `nhost dev` running.
:::
</aside>
```sql
```bash
git add -A
git commit -m "Initialized Nhost and added a customers table"
git push
@@ -63,14 +68,14 @@ git push
Head over to the **Deployments** tab in the **Nhost console** to see the deployment.
![Deployments tab after changes](/images/cli-workflow/deployments-tab-with-changes.png)
![Deployments tab after changes](/img/cli-workflow/deployments-tab-with-changes.png)
Once the deployment finishes the `customers` table is created in production.
![Customers table in Hasura Console](/images/cli-workflow/hasura-customers-table.png)
![Customers table in Hasura Console](/img/cli-workflow/hasura-customers-table.png)
Weve now completed the recommended workflow with Nhost:
We've now completed the recommended workflow with Nhost:
1. Develop locally using the Nhost CLI.
2. Push changes to GitHub.
3. Nhost deploys changes to production.
3. Nhost deploys changes to production.

View File

@@ -2,6 +2,9 @@
title: 'Metadata and Serverless Functions'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
In the previous section, we only created a new table; `customers`. Using the CLI you can also do changes to other parts of your backend.
There are three things the CLI and the GitHub integration track and applies to production:
@@ -10,18 +13,18 @@ There are three things the CLI and the GitHub integration track and applies to p
2. Hasura Metadata
3. Serverless Functions
For this section, lets do one change to the Hasura metadata and create one serverless function
For this section, let's do one change to the Hasura metadata and create one serverless function
### Hasura Metadata
Well add permissions to the `users` table, making sure users can only see their own data. For this, go to the `auth` schema and click on the `users` table. then click on **Permissions** and enter a new role **user** and create a new **select** permission for that role**.**
We'll add permissions to the `users` table, making sure users can only see their own data. For this, go to the `auth` schema and click on the `users` table. then click on **Permissions** and enter a new role **user** and create a new **select** permission for that role**.**
Create the permission **with custom check**:
```json
{
"id": {
"_eq" : "X-Hasura-User-Id"
"_eq": "X-Hasura-User-Id"
}
}
```
@@ -36,12 +39,15 @@ Select the following columns:
Then click **Save permissions**.
<Video src="/videos/cli-workflow/hasura-user-permissions.mp4">
</Video>
<video
src="/videos/cli-workflow/hasura-user-permissions.mp4"
width="100%"
controls
/>
Now, lets do a `git status` again to confirm the permission changes we did was tracked locally in your git repository.
Now, let's do a `git status` again to confirm the permission changes we did was tracked locally in your git repository.
![Git status](/images/cli-workflow/git-status.png)
![Git status](/img/cli-workflow/git-status.png)
We can now commit this change:
@@ -50,13 +56,13 @@ git add -A
git commit -m "added permission for uses"
```
Now lets create a serverless function before we push all changes to GitHub so Nhost can deploy our changes.
Now let's create a serverless function before we push all changes to GitHub so Nhost can deploy our changes.
### Serverless Function
A serverless function is a pieces of code written in JavaScript or TypeScript that take an HTTP request and returns a response.
Heres an example:
Here's an example:
```bash
import { Request, Response } from 'express'
@@ -68,25 +74,30 @@ export default (req: Request, res: Response) => {
Serverless functions are placed in the `functions/` folder of your repository. Every file will become its own endpoint.
Before we create our serverless function well install `express`, which is a requirement for serverless functions to work.
Before we create our serverless function we'll install `express`, which is a requirement for serverless functions to work.
<Tabs>
<TabItem value="npm" label="npm" default>
```bash
npm install express
# or with yarn
yarn add express
npm install -d @types/node @types/express
```
Well use TypeScript so well install two type definitions too:
</TabItem>
<TabItem value="yarn" label="Yarn">
```bash
npm install -d @types/node @types/express
# or with yarn
yarn add express
yarn add -D @types/node @types/express
```
Then well create a file `functions/time.ts`
</TabItem>
</Tabs>
In the file `time.ts` well add the following code to create our serverless function:
Then we'll create a file `functions/time.ts`
In the file `time.ts` we'll add the following code to create our serverless function:
```bash
import { Request, Response } from 'express';
@@ -98,11 +109,11 @@ export default (req: Request, res: Response) => {
};
```
We can now test the function locally. Locally, the backend URL is `http://localhost:1337`. Functions are under `/v1/functions`. And every functions path and filename becomes an API endpoint.
We can now test the function locally. Locally, the backend URL is `http://localhost:1337`. Functions are under `/v1/functions`. And every function's path and filename becomes an API endpoint.
This means our function `functions/time.ts` is at `http://localhost:1337/v1/functions/time`.
Lets use curl to test our new function:
Let's use curl to test our new function:
```bash
curl http://localhost:1337/v1/functions/time
@@ -116,9 +127,9 @@ curl http://localhost:1337/v1/functions/time\?name\=Johan
Hello Johan! It's now: Sun, 06 Feb 2022 17:44:48 GMT
```
Again, lets use `git status` to see the changes we did to create our serverless function.
Again, let's use `git status` to see the changes we did to create our serverless function.
Now lets commit the changes and push them to GitHub.
Now let's commit the changes and push them to GitHub.
```bash
git add -A
@@ -128,32 +139,32 @@ git push
In the Nhost Console, click on the new deployment to see details.
![Deployments details for function](/images/cli-workflow/details-for-function.png)
![Deployments details for function](/img/cli-workflow/details-for-function.png)
After Nhost has finished deploying your changes we can test them in production. First lets confirm that the user permissions are applied.
After Nhost has finished deploying your changes we can test them in production. First let's confirm that the user permissions are applied.
![Hasura Console permissions table](/images/cli-workflow/hasura-permissions-table.png)
![Hasura Console permissions table](/img/cli-workflow/hasura-permissions-table.png)
Then, lets confirm that the serverless function was deployed. Again, well use curl:
Then, let's confirm that the serverless function was deployed. Again, we'll use curl:
```bash
curl https://your-backend-url.nhost.run/v1/functions/time\?name\=Johan
```
![Serverless Function test](/images/cli-workflow/function-test.png)
![Serverless Function test](/img/cli-workflow/function-test.png)
## Conclusion
In this tutorial we have installed the Nhost CLI and created a local Nhost environment to do local development and testing.
In the local environment weve made changes to our database, to Hasuras metadata and created a serverless function.
In the local environment we've made changes to our database, to Hasura's metadata and created a serverless function.
Weve connected a GitHub repository and pushed our changes to GitHub.
We've connected a GitHub repository and pushed our changes to GitHub.
Weve seen Nhost automatically deploying our changes and weve verified that the changes were applied.
We've seen Nhost automatically deploying our changes and we've verified that the changes were applied.
In summary, weve set up a productive environment using the recommended Nhost workflow:
In summary, we've set up a productive environment using the recommended Nhost workflow:
1. Develop locally using the Nhost CLI.
2. Push changes to GitHub.
3. Nhost deploys changes to production.
3. Nhost deploys changes to production.

View File

@@ -8,19 +8,24 @@ What follows is a detailed tutorial on how you setup Nhost for this workflow
Create a **new Nhost app** for this tutorial.
> Its important that you create a **new** Nhost app for this guide instead of reusing an old Nhost app because we want to start with a clean Nhost app.
:::tip
It's important that you create a **new** Nhost app for this guide instead of reusing an old Nhost app because we want to start with a clean Nhost app.
:::
![Create new app](/images/cli-workflow/create-app.png)
![Create new app](/img/cli-workflow/create-app.png)
### Create new GitHub Repository
Create a new GitHub repository for your new Nhost app. The repo can be either private or public.
![Create new repo](/images/cli-workflow/create-repo.png)
![Create new repo](/img/cli-workflow/create-repo.png)
## Connect GitHub Repository to Nhost App
In the Nhost Console, go to the dashboard of your Nhost app and click **Connect to GitHub**.
<Video src="/videos/cli-workflow/connect-github-repo.mp4">
</Video>
<video
src="/videos/cli-workflow/connect-github-repo.mp4"
width="100%"
controls
/>

View File

@@ -0,0 +1,36 @@
---
title: 'Welcome to Nhost'
sidebar_position: 1
---
Nhost is an open-source, real-time, server-less backend platform for building reliable apps that scale with your business.
---
## Components
Nhost uses an opinionated set of open-source components.
#### Database
Your application gets its own PostgreSQL database, the world's most advanced relational database.
#### GraphQL API
Highly performant and real-time GraphQL API with Hasura.
#### Authentication and storage
User management & file storage seamlessly integrated with Hasura permissions.
#### Serverless functions
JavaScript and TypeScript functions run your custom code in the backend.
---
## Get started
Follow our [Quick start](/get-started/quick-start) guide to build your first app.
Check out [Nhost on GitHub](https://github.com/nhost/nhost). Give us a star, and feel free to open a discussion for any feature requests as well.

View File

@@ -1,5 +1,6 @@
---
title: 'Create your app'
sidebar_position: 1
---
Let's create a simple todo-app using Nhost. In a todo-app, a user should be able to create list items for their account (CRUD) and not have anyone else see them (permissions).
@@ -28,7 +29,7 @@ Press the **"New App"** button on the console's home page. Choose a name and pic
You'll be all set with the Default Workspace and the Free plan for now.
![New App](/images/quick-start/new-app.png)
![New App](/img/quick-start/new-app.png)
Creating a new app takes around 20 seconds or so. During this time, Nhost sets up your app's entire backend and infrastructure.

View File

@@ -2,6 +2,9 @@
title: 'JavaScript client'
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
In the previous section, you used the Hasura Console to fetch a list of todos. Now, you will write a small JavaScript client to interact and retrieve todos from your Nhost app.
### Frontend frameworks
@@ -14,25 +17,36 @@ In this guide, we'll keep the example simple. We're not using a frontend framewo
## Setup
> Make sure you have [Node.js](https://nodejs.org) and [npm](https://docs.npmjs.com/getting-started) installed.
:::info
Create a new folder called `nhost-todos`, and initialize a new JavaScript app there:
Make sure you have [Node.js](https://nodejs.org) and [npm](https://docs.npmjs.com/getting-started) or [Yarn](https://classic.yarnpkg.com/lang/en/docs/install) installed.
```sh
:::
Create a new folder called `nhost-todos`, initialize a new JavaScript app there, and install the Nhost JavaScript SDK:
<Tabs>
<TabItem value="npm" label="npm" default>
```bash
npm init -y
# or
npm install @nhost/nhost-js graphql
```
</TabItem>
<TabItem value="yarn" label="Yarn">
```bash
yarn init -y
yarn add @nhost/nhost-js graphql
```
> You might have to edit the `package.json` file and add/change the `type` object to `module` (`"type": "module"`).
</TabItem>
</Tabs>
Install Nhost JavaScript SDK:
```sh
npm install @nhost/nhost-js
# or
yarn add @nhost/nhost-js
```
:::caution attention
You might have to edit the `package.json` file and add/change the `type` object to `module` (`"type": "module"`).
:::
---
@@ -43,18 +57,18 @@ In the new directory, create a file called `index.js`.
Enter the following code into this file. It will initialize a new `NhostClient` that will interact with your backend:
```js
import { NhostClient } from '@nhost/nhost-js'
import { NhostClient } from '@nhost/nhost-js';
const nhost = new NhostClient({
backendUrl: 'https://[app-subdomain].nhost.run' // replace this with the backend URL of your app
})
backendUrl: 'https://[app-subdomain].nhost.run', // replace this with the backend URL of your app
});
console.log(nhost.graphql.getUrl())
console.log(nhost.graphql.getUrl());
```
Run the code in your terminal. You should see your app's GraphQL endpoint URL:
```sh
```bash
➜ node index.js
https://[app-subdomain].nhost.run/v1/graphql
@@ -65,10 +79,10 @@ https://[app-subdomain].nhost.run/v1/graphql
If you now add the following GraphQL query to the client, let's see what happens when you run the updated version:
```js
import { NhostClient } from '@nhost/nhost-js'
import { NhostClient } from '@nhost/nhost-js';
const nhost = new NhostClient({
backendUrl: 'https://[app-subdomain].nhost.run'
backendUrl: 'https://[app-subdomain].nhost.run',
})(async () => {
// nhost.graphql.request returns a promise, so we use await here
const todos = await nhost.graphql.request(`
@@ -80,14 +94,14 @@ const nhost = new NhostClient({
is_completed
}
}
`)
`);
// Print todos to console
console.log(JSON.stringify(todos.data, null, 2))
})()
console.log(JSON.stringify(todos.data, null, 2));
})();
```
```sh
```bash
➜ node index.js
null

View File

@@ -2,7 +2,7 @@
title: 'Set permissions'
---
In the previous section, you could fetch the todos because the **admin** role is enabled by default when using Hasura Console. When building your applications, you want to define permissions using **roles** that your users can assume when making requests.
While using the Hasura Console, you could fetch the todos because the **admin** role is enabled by default but when building your applications with a client, you want to define permissions using **roles** that your users can assume when making requests.
Hasura supports role-based access control. You create rules for each role, table, and operation (select, insert, update and delete) that can check dynamic session variables, like user ID.
@@ -18,11 +18,11 @@ In Hasura Console, go to the **Data** tab, click on the **todos** table, then cl
Add the following permissions:
![Public role](/images/quick-start/permissions-public-select.png)
![Public role](/img/quick-start/permissions-public-select.png)
Rerun the program. Now you see all todos.
```sh
```bash
➜ node index.js
{

View File

@@ -14,7 +14,7 @@ Go to the **Data** tab on your app's dashboard and select **Open Hasura**. Remem
The Hasura Console of your app's dedicated Hasura instance will open in a new tab. You can use Hasura Console to manage your app's schema, data, permissions, and event triggers.
![Data -> Open Hasura](/images/quick-start/data-tab.png)
![Data -> Open Hasura](/img/quick-start/data-tab.png)
---
@@ -27,7 +27,7 @@ You should see all your database tables on the left-hand side of the screen. You
If you open the `auth` schema, you'll see that your app already has a `users` table, so you don't have to create one.
![To store the users, we already have a users table from the auth schema](/images/quick-start/list-of-schemas.png)
![To store the users, we already have a users table from the auth schema](/img/quick-start/list-of-schemas.png)
---
@@ -44,7 +44,7 @@ In Hasura Console, go to the **data** tab, then click **Create Table**. Name thi
Using frequently used columns ensures the columns get the right name, type, and default value.
![Frequently used columns in the Hasura console](/images/quick-start/frequently-used-columns.png)
![Frequently used columns in the Hasura console](/img/quick-start/frequently-used-columns.png)
### Add custom columns
@@ -55,7 +55,7 @@ Add two more columns manually:
Make sure to set the default value of `is_completed` to `false`.
![Create a table in the Hasura console](/images/quick-start/create-table.png)
![Create a table in the Hasura console](/img/quick-start/create-table.png)
This is all we need! A new table will be created when you click **Add Table**.
@@ -65,7 +65,9 @@ This is all we need! A new table will be created when you click **Add Table**.
Go to the **Insert Row** tab to add some data to your database.
![Inserting todos](/images/quick-start/insert-todos.gif)
<video width="99%" loop="" muted="" playsInline="" controls="true">
<source src="/videos/insert-todos.mp4" type="video/mp4" />
</video>
---

View File

@@ -10,22 +10,24 @@ Upgrading from Nhost v1 to v2 requires database schema and Hasura metadata chang
### Create a new Nhost v2 app locally
> Make sure you have the [Nhost CLI](/reference/cli) installed
:::tip
Make sure you have the [Nhost CLI](/reference/cli) installed
:::
```sh
```bash
nhost init my-nhost-v2-app
cd my-nhost-v2-app
```
### Update config
Update `config: 3` to `config: 2` in `nhost/config.yaml`. This will update Hasura's configuration version, and we need to downgrade the version when we export migrations and metadata.
Update `version: 3` to `version: 2` in `nhost/config.yaml`. This will update Hasura's configuration version, and we need to downgrade the version when we export migrations and metadata.
### Export current migrations and metadata from Nhost v1
Inside the `nhost/` folder of your app, run:
```sh
```bash
hasura migrate create init --from-server --endpoint=[v1-endpoint] --admin-secret=[v1-admin-secret]
hasura metadata export --endpoint=[v1-endpoint] --admin-secret=[v1-admin-secret]
@@ -35,7 +37,9 @@ hasura metadata export --endpoint=[v1-endpoint] --admin-secret=[v1-admin-secret]
Make the following changes manually to your migrations.
> The migration file is located at `nhost/migrations/[timestamp]/up.sql`.
:::tip
The migration file is located at `nhost/migrations/[timestamp]/up.sql`.
:::
- Add `OR REPLACE` after `CREATE` for the `public.set_current_timestamp_updated_at` function
- Delete all `auth.*` tables and functions (if any).
@@ -46,7 +50,9 @@ Make the following changes manually to your migrations.
Make the following changes manually to your metadata.
> The metadata is located at `nhost/metadata/tables.yaml`.
:::tip
The metadata is located at `nhost/metadata/tables.yaml`.
:::
- Delete tracking all tables in the `auth` schema.
- Delete tracking the `public.users` table.
@@ -56,11 +62,13 @@ Make the following changes manually to your metadata.
Start Nhost locally using the [CLI](/reference/cli). From the root of your app, run:
```sh
```bash
nhost -d
```
> Running Nhost applies your local database migrations and Hasura metadata.
:::tip
Running Nhost applies your local database migrations and Hasura metadata.
:::
### Restart Auth and Storage containers
@@ -70,7 +78,7 @@ Open Docker UI and restart Hasura Auth and Hasura Storage. Restarting those cont
Delete the local migrations and metadata.
```
```bash
rm -rf nhost/migrations nhost/metadata
```
@@ -80,13 +88,17 @@ Update `config: 2` to `config: 3` in `nhost/config.yaml`.
### Pull migrations and metadata from our local instance
> You can not use port `1337` in these requests. You have to use the specific port Huasra uses. Go to the Hasura Console under API and look what port Hasura is using under GraphQL Endpoint.
In the `nhost/` folder, run the following command:
```
```bash
hasura migrate create init --from-server --endpoint=http://localhost:[hasura-port] --admin-secret=nhost-admin-secret
hasura metadata export --from-server --endpoint=http://localhost:[hasura-port] --admin-secret=nhost-admin-secret
hasura metadata export --endpoint=http://localhost:[hasura-port] --admin-secret=nhost-admin-secret
```
:::warning
You cannot use port `1337` in the commands above. You have to use the specific port Hasura uses. Go to the Hasura Console under API and look for the port Hasura is using under GraphQL Endpoint.
:::
### Done
You now have a Nhost v2 project locally with correct migrations and metadata. Happy hacking!

View File

@@ -0,0 +1,4 @@
{
"label": "Authentication",
"position": 6
}

View File

@@ -1,5 +1,6 @@
---
title: 'Email templates'
sidebar_position: 4
---
The following emails can be sent as part of the authentication flow:
@@ -17,7 +18,7 @@ If you have developed custom email templates, you must make them available over
Go to **Users -> Login settings** and scroll down to **Custom email templates**, and set the URL to where your templates are located:
![ ](/images/platform/email-templates.svg)
![Email templates](/img/platform/email-templates.svg)
You only need to define the base URL to point to your hosted templates. The UI will give you a hint about where Nhost will look for your actual template files.

View File

@@ -1,38 +1,37 @@
---
title: 'Overview'
title: Authentication
sidebar_position: 1
---
Nhost provides a ready-to-use authentication service, integrated with Nhost JavaScript SDK. This makes it easy to build login flows with multiple login methods.
# Authentication
---
Nhost provides a ready-to-use authentication service, integrated with Nhost JavaScript SDK. This makes it easy to build login flows with multiple sign-in methods.
## Getting started
## Getting Started
Using [Nhost JavaScript SDK](/reference/sdk), sign up a new user:
Sign up a user with the [Nhost JavaScript SDK](/reference/javascript):
```js
import { NhostClient } from '@nhost/nhost-js'
import { NhostClient } from '@nhost/nhost-js';
const nhost = new NhostClient({
backendUrl: 'https://[app-subdomain].nhost.run'
})
backendUrl: 'https://[app-subdomain].nhost.run',
});
await nhost.auth.signUp({
email: 'joe@nhost.io',
password: 'secret-password'
})
password: 'secret-password',
});
```
---
## How it works
1. A user signs up and the user information is added to the `auth.users` table
2. Nhost returns an access token (JWT token) with the user's information. The access token is cryptographically signed.
1. A user signs up and the user information is added to the `auth.users` table.
2. Nhost returns an [access token](#access-tokens) (JWT token) and the user's information.
3. The user sends a request to the GraphQL API together with the access token.
4. The GraphQL API reviews the access token to ensure the user is authorized to send the request.
Nhost's authentication service is integrated with your database. All users are saved in the app's database under the `auth` schema and can be accessed using GraphQL:
Nhost's authentication service is integrated with your database. All users are stored in the app's database under the `auth` schema and can be accessed using GraphQL:
```graphql
query {
@@ -45,13 +44,11 @@ query {
}
```
---
## Tokens
Nhost authentication uses two tokens: Access tokens and refresh tokens.
[Nhost JavaScript SDK](/sdk/) automatically handles access and refresh tokens.
[Nhost JavaScript SDK](/reference/javascript) automatically handles access and refresh tokens.
### Access tokens

View File

@@ -0,0 +1,4 @@
{
"label": "OAuth providers",
"position": 3
}

View File

@@ -1,14 +1,23 @@
---
title: Sign In with Facebook
title: Sign in with Facebook
sidebar_position: 2
slug: /platform/authentication/sign-in-with-facebook
---
Follow this guide to sign in users with Facebook with your Nhost App.
![Facebook Sign In Preview](/images/platform/social-providers/facebook-preview.png)
<p align="center">
<img
alt="Facebook Sign In Preview"
src="/img/social-providers/facebook-preview.svg"
width={480}
height={267}
/>
</p>
# Create Facebook account
## Create Facebook account
- Create a new [Facebook account](https://www.facebook.com/) if you dont have one already.
- Create a new [Facebook account](https://www.facebook.com/) if you don't have one already.
## Create Facebook App
@@ -24,7 +33,7 @@ Follow this guide to sign in users with Facebook with your Nhost App.
- Click on Add Product in the left menu.
- Click on Setup in the Facebook login card.
- **Dont** complete the quickstart. Instead, follow the next step.
- **Don't** complete the quickstart. Instead, follow the next step.
- Click on **Settings** under **Facebook Login** in the left menu.
- Make sure **Embedded Browser OAuth Login** is set to **Yes**.
- Fill in **Valid OAuth Redirect URIs** with your **OAuth Callback URL** from Nhost.
@@ -43,16 +52,16 @@ To make sure we can fetch all user data (email, profile picture and name). For t
## Configure Nhost
- Click **Settings** and then **Basic** in the left menu.
- Copy and paste the **App ID (Client ID)** and **App secret (Client Secret)** from Facebook to your Nhost OAuth settings for Facebook. Make sure the [OAuth provider is enabled in Nhost](/platform/authentication/social-sign-in#enabling-social-sign-in).
- Copy and paste the **App ID (Client ID)** and **App secret (Client Secret)** from Facebook to your Nhost OAuth settings for Facebook. Make sure the [OAuth provider is enabled in Nhost](/platform/authentication/social-sign-in#enabling-social-sign-in-provider).
- Click the checkbox “**I have pasted the redirect URI into Facebook”**.
- Click **Confirm settings**.
## Sign In users in your app
Use the [Nhost JavaScript client](/reference/sdk) to sign in users in your app:
Use the [Nhost JavaScript client](/reference/javascript) to sign in users in your app:
```js
nhost.auth.signIn({
provider: 'facebook'
})
provider: 'facebook',
});
```

Some files were not shown because too many files have changed in this diff Show More