Compare commits

...

32 Commits

Author SHA1 Message Date
github-actions[bot]
d2d3ba6eb7 chore: update versions (#272)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2022-03-15 14:38:45 +01:00
Johan Eliasson
e688600ea2 fix: current options when sign in with a provider (#274)
* fix: current options when sign in with a provider

* Create eighty-pianos-try.md

* Create chilled-swans-repeat.md

* send sign-up options

* doesn't hurt to do encodeURIComponent everywhere

Co-authored-by: Pilou <24897252+plmercereau@users.noreply.github.com>
2022-03-15 14:32:09 +01:00
Hoang Do
d9aec711c4 Fix(nhost-js): Fix typo in README (#283) 2022-03-15 07:03:41 +01:00
Dominic Garms
9bd01e756f export refresh function (#281)
* export refresh utilitly function

For being able to receive a new accessToken on client side it would be ideal to expose the `refresh` function.

* Create loud-planets-impress.md

Co-authored-by: Pilou <24897252+plmercereau@users.noreply.github.com>
2022-03-14 18:33:52 +01:00
Pilou
8f7643a90e fix: change target ES module build target to es2019 (#282) 2022-03-14 18:32:27 +01:00
Johan Eliasson
50b9d763ae feat: correct available providers (Discord & Twitch added) (#266)
* feat: correct available providers (Discord & Twitch added)

* Create hip-eels-unite.md

* putting back proviers

Co-authored-by: Pierre-Louis Mercereau <24897252+plmercereau@users.noreply.github.com>
2022-03-11 08:11:57 +01:00
Quentin Decré
63cb1f0ce6 doc(hasura-auth-client): fixed onAuthStateChanged @example (#268) 2022-03-10 18:42:38 +01:00
Pilou
7c70b1823d fix broken ci pipeline (#267)
* ci: clean ci

* ci: matrix

* ci: install dependencies

* ci: debug

* ci: updated packages

* ci: remove scope

* ci: add src to files

* ci: deactivate turbo cache

* ci: debug

* ci: downgrade turborepo

* ci: reverse version

* ci: installl again

* ci: pwd

* ci: increase depth

* ci: decrease pnpm version

* ci: another turbo version

* ci: 1.1.5

* ci: clean

* ci: frozen lockfile

* ci: add options

* ci: deactivate cache

* ci: single ci command

* ci: correct

* ci: desesperant

* ci: again

* ci: again

* ci: remove testing project

* ci: remove testing project

* ci: exec nhost in tmp

* ci: deactivate nhost

* ci: manually create nhost project

* ci: again

* ci: copy existing nhost project

* ci: correct cp arg

* ci: correct cp

* ci: cd, not cp

* ci: wrap up

* ci: scope ci script
2022-03-10 13:16:48 +01:00
Pierre-Louis Mercereau
d2aae774a0 ci: wait-for at the end 2022-03-10 11:10:33 +01:00
Pierre-Louis Mercereau
322e8a1b07 ci: recreate pnpm lock 2022-03-10 11:07:24 +01:00
Pierre-Louis Mercereau
d154f8d71b ci: checkout twice 2022-03-10 11:00:53 +01:00
Pierre-Louis Mercereau
0931afd84c ci: nhost cli at the top 2022-03-10 10:48:17 +01:00
Pierre-Louis Mercereau
837548cfd5 ci: wrap wait-on in an action 2022-03-10 10:43:40 +01:00
Pierre-Louis Mercereau
a6cabbca79 ci: deactivate wait-on 2022-03-10 10:37:55 +01:00
Pierre-Louis Mercereau
82f19fe717 ci: internal wait-on script 2022-03-10 10:35:19 +01:00
Pierre-Louis Mercereau
82be281153 ci: use npx 2022-03-10 10:28:31 +01:00
Pierre-Louis Mercereau
0112ca775f ci: start nhost cli 2022-03-10 10:22:34 +01:00
Pierre-Louis Mercereau
b30b812b93 ci: install nhost cli 2022-03-10 10:20:52 +01:00
Pierre-Louis Mercereau
bace64c306 ci: without nhost 2022-03-10 10:19:40 +01:00
Pierre-Louis Mercereau
be49b641e3 ci: deactivate all cache 2022-03-10 10:16:56 +01:00
Pierre-Louis Mercereau
5ac8c2f516 ci: deactivate turborepo cache 2022-03-10 10:12:38 +01:00
Pierre-Louis Mercereau
168ae1d82b ci: reactivate all ci steps 2022-03-10 10:08:46 +01:00
Pierre-Louis Mercereau
b4a2e28fc3 ci: manually install node packages 2022-03-10 10:05:31 +01:00
Pierre-Louis Mercereau
ca3ae21286 ci: try explicit pnpm install params 2022-03-10 10:01:54 +01:00
Pierre-Louis Mercereau
9f30c1af09 ci: debug 2022-03-10 09:51:16 +01:00
Pierre-Louis Mercereau
e1f9f64910 ci: deactivate all cache 2022-03-10 09:48:36 +01:00
Pierre-Louis Mercereau
2634dd8335 ci: deactivate turborepo cache 2022-03-10 09:46:30 +01:00
Pierre-Louis Mercereau
42b4c78d4c ci: correct gh action 2022-03-10 09:44:01 +01:00
Pierre-Louis Mercereau
54174c1b0f ci: change gh action 2022-03-10 09:41:06 +01:00
Johan Eliasson
9fad359ae9 docs: Added docs for permission variables (#263)
* added docs for permissions

* update

* wording update

* typos
2022-03-09 14:15:10 +01:00
Johan Eliasson
1cbf460223 added Nhost diagram (#265) 2022-03-09 13:37:06 +01:00
Pilou
8a3aa007b8 Update README.md (#258) 2022-03-08 21:55:28 +01:00
27 changed files with 963 additions and 665 deletions

View File

@@ -25,6 +25,6 @@ esbuild
platform: 'browser',
format: 'esm',
sourcemap: true,
target: 'esnext'
target: 'es2019'
})
.catch(() => process.exit(1))

View File

@@ -28,7 +28,7 @@ jobs:
- uses: pnpm/action-setup@v2.1.0
with:
version: 6.30.1
version: 6.32.3
run_install: true
- name: Create PR or Publish release

View File

@@ -27,26 +27,30 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14, 16]
steps:
- uses: actions/checkout@v2
- name: Cache pnpm modules
uses: actions/cache@v2
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-
- name: Install nhost CLI
run: curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
- uses: pnpm/action-setup@v2.0.1
- name: Start Nhost Backend
run: |
cp -R examples/testing-project /tmp/
cd /tmp/testing-project
nhost dev &
- uses: pnpm/action-setup@v2.2.1
with:
version: 6.30.1
run_install: true
version: 6.32.3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Cache turbo
uses: actions/cache@v2
@@ -56,16 +60,11 @@ jobs:
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
- name: Install nhost CLI
run: curl -L https://raw.githubusercontent.com/nhost/cli/main/get.sh | bash
- name: Install dependencies
run: pnpm install
- name: Start Nhost Backend
run: |
cd examples/testing-project
- name: Wait for Nhost
run: pnpm run wait
nhost dev -d --no-browser &
- name: Wait for Nhost Backend to start
run: |
pnpm dlx wait-on http://localhost:1337/v1/auth/healthz -i 500 -t 120000
- run: pnpm run ci
- name: Build, tests and lint
run: pnpm run ci

View File

@@ -36,6 +36,13 @@ Nhost consists of open source software:
- Serverless Functions: Node.js (JavaScript and TypeScript)
- [Nhost CLI](https://docs.nhost.io/reference/cli) for local development
<div align="center">
<br />
<img src="assets/nhost-diagram.png"/>
<br />
<br />
</div>
Visit [https://docs.nhost.io](http://docs.nhost.io) for the complete documentation.
# How to get started

BIN
assets/nhost-diagram.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@@ -2,12 +2,15 @@
## Get started
1. Install dependencies: `yarn`
2. Start dev server: `yarn dev`
From the **root** of the `nhost/nhost` repository:
## NOTES;
```bash
pnpm run clean:all
pnpm i
cd docs
pnpm run dev
```
The content is copied from the main `nhost/nhost` repo. This repo is only to modify styles/react components.
## Structure

View File

@@ -65,7 +65,7 @@ const CustomLink = ({
const components = {
img: (props: DetailedHTMLProps<HTMLProps<HTMLImageElement>, HTMLImageElement>) => {
return (
<span className="block mx-10 mt-5 ">
<span className="block mx-10 my-10 ">
<img src={props.src} alt={props.alt} className="mx-auto mt-2" />
</span>
)

View File

@@ -20,6 +20,8 @@ Access token data is included as headers with every API request. By default, eve
The default role for users is `user`.
> You can also [add custom permission](#add-permission-variables) varaibles if you need to.
---
## Select permissions
@@ -60,3 +62,23 @@ In our example, we only select `name`, because we want all other other columns t
We also want every new record's `user_id` value to be set to the ID of the user making the request. We can tell Hasura to do this with **column presets**.
1. Under column presets, set `user_id` to `x-hasura-user-id`.
## Add Permission Variables
You can add extra permission variables in the Nhost console under **Users** and then **Roles and permissions**. These permission variables are then available when creating permissions for your GraphQL API in the Hasura console.
![Permission Variables](/images/platform/permission-variables-preview.svg)
As an example, let's say you add a new permission variable `x-hasura-organisation-id` with path `user.profile.organisation.id`. This means that Nhost Auth will get the value for `x-hasura-organisation-id` by internally generating the following GraphQL query:
```graphql
query {
user(id: "<user-id>") {
profile {
organisation {
id
}
}
}
}
```

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 227 KiB

View File

@@ -7,5 +7,5 @@ Once in the example's directory, run the two following commands in parallel:
nhost -d
# Start this project
pnpm run dev
yarn run dev
```

View File

@@ -1,11 +1,11 @@
{
"name": "@nhost-examples/testing-project",
"private": true,
"version": "1.0.1",
"description": "Wrapper to run the Nhost CLI for development and testing",
"scripts": {
"start": "nhost -d"
},
"author": "Pierre-Louis Mercereau",
"license": "MIT"
}
"name": "@nhost-examples/testing-project",
"private": true,
"version": "1.0.1",
"description": "Wrapper to run the Nhost CLI for development and testing",
"scripts": {
"start": "nhost -d"
},
"author": "Pierre-Louis Mercereau",
"license": "MIT"
}

View File

@@ -32,7 +32,8 @@
"prerelease": "pnpm clean && pnpm install && pnpm build",
"release": "pnpm run prerelease && changeset publish && git push --follow-tags && git status && pnpm -r publish",
"changeset": "changeset",
"snapshot": "pnpm prerelease && changeset version --snapshot preview && pnpm install && changeset publish --tag preview"
"snapshot": "pnpm prerelease && changeset version --snapshot preview && pnpm install && changeset publish --tag preview",
"wait": "wait-on http://localhost:1337/v1/auth/healthz -i 500 -t 120000"
},
"workspaces": [
"packages/*",
@@ -43,14 +44,14 @@
"@babel/eslint-parser": "^7.17.0",
"@babel/plugin-syntax-flow": "^7.16.7",
"@babel/plugin-transform-react-jsx": "^7.17.3",
"@changesets/cli": "^2.21.0",
"@faker-js/faker": "^6.0.0-alpha.7",
"@changesets/cli": "^2.21.1",
"@faker-js/faker": "^6.0.0-beta.0",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.21",
"@typescript-eslint/eslint-plugin": "^5.13.0",
"@typescript-eslint/parser": "^5.13.0",
"@typescript-eslint/eslint-plugin": "^5.14.0",
"@typescript-eslint/parser": "^5.14.0",
"@vitejs/plugin-react": "^1.2.0",
"esbuild": "^0.14.23",
"esbuild": "^0.14.25",
"esbuild-node-externals": "^1.4.1",
"eslint": "^8.10.0",
"eslint-config-react-app": "^7.0.0",
@@ -59,7 +60,7 @@
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-react": "^7.29.2",
"eslint-plugin-react": "^7.29.3",
"eslint-plugin-react-hooks": "^4.3.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"husky": "^7.0.4",
@@ -68,11 +69,12 @@
"prettier": "^2.5.1",
"ts-jest": "^27.1.3",
"tsconfig-paths-jest": "^0.0.1",
"turbo": "^1.1.4",
"turbo": "1.1.6",
"typescript": "4.5.5",
"vite": "^2.8.5",
"vite": "^2.8.6",
"vite-plugin-dts": "^0.9.9",
"vite-tsconfig-paths": "^3.4.1"
"vite-tsconfig-paths": "^3.4.1",
"wait-on": "^6.0.1"
},
"resolutions": {
"graphql": "15.7.2"

View File

@@ -1,5 +1,17 @@
# @nhost/hasura-auth-js
## 0.1.15
### Patch Changes
- e688600: fix: current options when sign in with a provider
We currently only support setting the redirectTo option for providers.
This patch removes the options that do not work and adds the redirectTo option correctly to the provider sign-in URL.
- 8f7643a: Change target ES module build target to es2019
Some systems based on older versions of Webpack or Babel don't support the current esbuild configuration e.g, [this issue](https://github.com/nhost/nhost/issues/275).
- e688600: fix: Correct available options for provider sign-in.
- 50b9d76: feat: correct available providers (Discord & Twitch added)
## 0.1.14
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-auth-js",
"version": "0.1.14",
"version": "0.1.15",
"description": "Hasura-auth client",
"license": "MIT",
"keywords": [
@@ -32,16 +32,16 @@
"verify:fix": "run-p prettier:fix lint:fix"
},
"main": "src/index.ts",
"exports": {
".": {
"import": {
"node": "./dist/index.cjs.js",
"default": "./dist/index.es.js"
},
"require": "./dist/index.cjs.js"
}
},
"publishConfig": {
"exports": {
".": {
"import": {
"node": "./dist/index.cjs.js",
"default": "./dist/index.es.js"
},
"require": "./dist/index.cjs.js"
}
},
"access": "public",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",

View File

@@ -222,8 +222,36 @@ export class HasuraAuthClient {
provider?: string
}> {
if ('provider' in params) {
const { provider } = params
const providerUrl = `${this.url}/signin/provider/${provider}`
const { provider, options } = params
let providerUrl = `${this.url}/signin/provider/${provider}`
// add options to URL
if (options) {
providerUrl += `?`
if (options.locale) {
providerUrl += `locale=${encodeURIComponent(options.locale)}&`
}
if (options.allowedRoles) {
providerUrl += `allowedRoles=${encodeURIComponent(options.allowedRoles.join(','))}&`
}
if (options.defaultRole) {
providerUrl += `defaultRole=${encodeURIComponent(options.defaultRole)}&`
}
if (options.displayName) {
providerUrl += `displayName=${encodeURIComponent(options.displayName)}&`
}
if (options.redirectTo) {
providerUrl += `redirectTo=${encodeURIComponent(options.redirectTo)}&`
}
if (options.metadata) {
providerUrl += `metadata=${encodeURIComponent(JSON.stringify(options.metadata))}&`
}
// remove last '&' in providerUrl
providerUrl = providerUrl.slice(0, -1)
}
if (isBrowser()) {
window.location.href = providerUrl
@@ -446,7 +474,7 @@ export class HasuraAuthClient {
* vice versa.
*
* @example
* auth.onAuthStateChanged(({event, session}) => {
* auth.onAuthStateChanged((event, session) => {
* console.log(`auth state changed. State is not ${event} with session: ${session}`)
* });
*

View File

@@ -78,12 +78,14 @@ export interface SignInPasswordlessSmsOtpParams {
}
export type Provider =
| 'apple'
| 'facebook'
| 'github'
| 'google'
| 'linkedin'
| 'spotify'
| 'discord'
| 'twitch'
| 'apple'
| 'twitter'
| 'windowslive'

View File

@@ -1,5 +1,12 @@
# @nhost/hasura-storage-js
## 0.0.12
### Patch Changes
- 8f7643a: Change target ES module build target to es2019
Some systems based on older versions of Webpack or Babel don't support the current esbuild configuration e.g, [this issue](https://github.com/nhost/nhost/issues/275).
## 0.0.11
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/hasura-storage-js",
"version": "0.0.11",
"version": "0.0.12",
"description": "Hasura-storage client",
"license": "MIT",
"keywords": [
@@ -30,16 +30,16 @@
"verify:fix": "run-p prettier:fix lint:fix"
},
"main": "src/index.ts",
"exports": {
".": {
"import": {
"node": "./dist/index.cjs.js",
"default": "./dist/index.es.js"
},
"require": "./dist/index.cjs.js"
}
},
"publishConfig": {
"exports": {
".": {
"import": {
"node": "./dist/index.cjs.js",
"default": "./dist/index.es.js"
},
"require": "./dist/index.cjs.js"
}
},
"access": "public",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",

View File

@@ -1,5 +1,11 @@
# @nhost/nextjs
## 0.3.1
### Patch Changes
- 9bd01e7: Export refresh function
## 0.3.0
### Minor Changes

View File

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

View File

@@ -1 +1,2 @@
export * from './get-session'
export * from './utils'

View File

@@ -1,5 +1,18 @@
# @nhost/nhost-js
## 0.3.12
### Patch Changes
- 8f7643a: Change target ES module build target to es2019
Some systems based on older versions of Webpack or Babel don't support the current esbuild configuration e.g, [this issue](https://github.com/nhost/nhost/issues/275).
- Updated dependencies [e688600]
- Updated dependencies [8f7643a]
- Updated dependencies [e688600]
- Updated dependencies [50b9d76]
- @nhost/hasura-auth-js@0.1.15
- @nhost/hasura-storage-js@0.0.12
## 0.3.11
### Patch Changes

View File

@@ -36,7 +36,7 @@ const nhost = new NhostClient({
### GraphQL
Access Nhost Auth methods using `nhost.graphql`.
Access Nhost GraphQL methods using `nhost.graphql`.
### Authentication

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/nhost-js",
"version": "0.3.11",
"version": "0.3.12",
"description": "Nhost JavaScript SDK",
"license": "MIT",
"keywords": [
@@ -21,16 +21,16 @@
"url": "git+https://github.com/nhost/nhost.git"
},
"main": "src/index.ts",
"exports": {
".": {
"import": {
"node": "./dist/index.cjs.js",
"default": "./dist/index.es.js"
},
"require": "./dist/index.cjs.js"
}
},
"publishConfig": {
"exports": {
".": {
"import": {
"node": "./dist/index.cjs.js",
"default": "./dist/index.es.js"
},
"require": "./dist/index.cjs.js"
}
},
"access": "public",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",

View File

@@ -1,5 +1,12 @@
# @nhost/react-auth
## 2.0.10
### Patch Changes
- Updated dependencies [8f7643a]
- @nhost/nhost-js@0.3.12
## 2.0.9
### Patch Changes

View File

@@ -1,6 +1,6 @@
{
"name": "@nhost/react-auth",
"version": "2.0.9",
"version": "2.0.10",
"description": "Nhost React client",
"license": "MIT",
"keywords": [

1246
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff