Compare commits
32 Commits
@nhost/rea
...
@nhost/nex
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d2d3ba6eb7 | ||
|
|
e688600ea2 | ||
|
|
d9aec711c4 | ||
|
|
9bd01e756f | ||
|
|
8f7643a90e | ||
|
|
50b9d763ae | ||
|
|
63cb1f0ce6 | ||
|
|
7c70b1823d | ||
|
|
d2aae774a0 | ||
|
|
322e8a1b07 | ||
|
|
d154f8d71b | ||
|
|
0931afd84c | ||
|
|
837548cfd5 | ||
|
|
a6cabbca79 | ||
|
|
82f19fe717 | ||
|
|
82be281153 | ||
|
|
0112ca775f | ||
|
|
b30b812b93 | ||
|
|
bace64c306 | ||
|
|
be49b641e3 | ||
|
|
5ac8c2f516 | ||
|
|
168ae1d82b | ||
|
|
b4a2e28fc3 | ||
|
|
ca3ae21286 | ||
|
|
9f30c1af09 | ||
|
|
e1f9f64910 | ||
|
|
2634dd8335 | ||
|
|
42b4c78d4c | ||
|
|
54174c1b0f | ||
|
|
9fad359ae9 | ||
|
|
1cbf460223 | ||
|
|
8a3aa007b8 |
@@ -25,6 +25,6 @@ esbuild
|
||||
platform: 'browser',
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
target: 'esnext'
|
||||
target: 'es2019'
|
||||
})
|
||||
.catch(() => process.exit(1))
|
||||
|
||||
2
.github/workflows/changesets.yaml
vendored
2
.github/workflows/changesets.yaml
vendored
@@ -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
|
||||
|
||||
47
.github/workflows/tests.yaml
vendored
47
.github/workflows/tests.yaml
vendored
@@ -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
|
||||
|
||||
@@ -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
BIN
assets/nhost-diagram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
)
|
||||
|
||||
@@ -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.
|
||||
|
||||

|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
95
docs/public/images/platform/permission-variables-preview.svg
Normal file
95
docs/public/images/platform/permission-variables-preview.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 227 KiB |
@@ -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
|
||||
```
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
22
package.json
22
package.json
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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}`)
|
||||
* });
|
||||
*
|
||||
|
||||
@@ -78,12 +78,14 @@ export interface SignInPasswordlessSmsOtpParams {
|
||||
}
|
||||
|
||||
export type Provider =
|
||||
| 'apple'
|
||||
| 'facebook'
|
||||
| 'github'
|
||||
| 'google'
|
||||
| 'linkedin'
|
||||
| 'spotify'
|
||||
| 'discord'
|
||||
| 'twitch'
|
||||
| 'apple'
|
||||
| 'twitter'
|
||||
| 'windowslive'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @nhost/nextjs
|
||||
|
||||
## 0.3.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- 9bd01e7: Export refresh function
|
||||
|
||||
## 0.3.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/nextjs",
|
||||
"version": "0.3.0",
|
||||
"version": "0.3.1",
|
||||
"description": "Nhost NextJS library",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
export * from './get-session'
|
||||
export * from './utils'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,7 @@ const nhost = new NhostClient({
|
||||
|
||||
### GraphQL
|
||||
|
||||
Access Nhost Auth methods using `nhost.graphql`.
|
||||
Access Nhost GraphQL methods using `nhost.graphql`.
|
||||
|
||||
### Authentication
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
1246
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user