Skip to content

Commit f7ec32f

Browse files
authored
Revert #317 (#347)
* Revert #317 * asd * asd
1 parent 55d4c66 commit f7ec32f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+7760
-995
lines changed

.changeset/nice-rivers-kiss.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
'hasura-auth': minor
3+
---
4+
5+
Revert #317 (connect directly to postgres)
6+
7+
We are reverting #317 because of issues we found with connections being exhausted on the database side. Having hasura-auth connect directly means that we have to consider/tweak an additional connection pooler. It also makes things a bit more cumbersome, operationally speaking, when provisioning projects in the cloud.
8+
9+
The initial goal of #317 was to allow users to choose the naming convention to use with hasura. We have found that using hasura's run_sql, available through its schema API (https://hasura.io/docs/latest/api-reference/schema-api/run-sql/#schema-run-sql), allows for the same naming flexibility while funneling all connections through the same entry point.

.husky/commit-msg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit $1

DEVELOPERS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ cp .env.example .env
2626
make dev
2727
```
2828

29-
Hasura-auth is now running on `http://localhost:4000` and will restart on evey change.
29+
Hasura-auth is now running on `http://localhost:4000` and will restart on evey change. GraphQL-codegen is watching the Hasura GraphQL and will regenerate every change in the schema.
3030

3131
## Test
3232

apollo.config.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
require('dotenv').config();
2+
module.exports = {
3+
client: {
4+
service: {
5+
name: 'Hasura Auth',
6+
url: process.env.HASURA_GRAPHQL_GRAPHQL_URL,
7+
headers: {
8+
'x-hasura-admin-secret': process.env.HASURA_GRAPHQL_ADMIN_SECRET,
9+
},
10+
},
11+
includes: ['src/**/*.graphql'],
12+
},
13+
};

graphql.config.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
require('dotenv').config();
2+
3+
module.exports = {
4+
overwrite: true,
5+
schema: [
6+
{
7+
[process.env.HASURA_GRAPHQL_GRAPHQL_URL]: {
8+
headers: {
9+
'x-hasura-admin-secret': process.env.HASURA_GRAPHQL_ADMIN_SECRET,
10+
},
11+
},
12+
},
13+
],
14+
15+
documents: 'src/gql/**/*.graphql',
16+
generates: {
17+
'src/utils/__generated__/graphql-request.ts': {
18+
plugins: [
19+
{
20+
add: {
21+
content: [
22+
'/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars */',
23+
],
24+
},
25+
},
26+
'typescript',
27+
'typescript-operations',
28+
'typescript-graphql-request',
29+
],
30+
},
31+
},
32+
};

package.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"start": "node ./dist/start.js",
1414
"lint": "eslint --ext .ts .",
1515
"lint:fix": "npm run lint --fix",
16-
"dev": "run-p dev:start",
16+
"dev": "run-p dev:start codegen:watch",
17+
"codegen": "dotenv graphql-codegen -- --config graphql.config.js",
18+
"codegen:watch": "dotenv graphql-codegen -- --config graphql.config.js --watch",
1719
"dev:start": "ts-node-dev -r tsconfig-paths/register --respawn --clear --unhandled-rejections=strict src/start.ts",
1820
"test": "AUTH_LOG_LEVEL=error jest --runInBand",
1921
"test:watch": "AUTH_LOG_LEVEL=error jest --runInBand --watch",
@@ -69,6 +71,13 @@
6971
},
7072
"devDependencies": {
7173
"@changesets/cli": "^2.25.2",
74+
"@commitlint/cli": "^16.0.2",
75+
"@commitlint/config-conventional": "^16.0.0",
76+
"@graphql-codegen/add": "^3.1.1",
77+
"@graphql-codegen/cli": "^2.13.7",
78+
"@graphql-codegen/typescript": "^2.8.0",
79+
"@graphql-codegen/typescript-graphql-request": "^4.5.7",
80+
"@graphql-codegen/typescript-operations": "^2.5.5",
7281
"@simplewebauthn/typescript-types": "^5.3.0",
7382
"@types/bcryptjs": "^2.4.2",
7483
"@types/body-parser": "1.19.0",
@@ -100,6 +109,7 @@
100109
"@vuepress/plugin-back-to-top": "1.4.1",
101110
"codecov": "^3.7.1",
102111
"commitizen": "^4.2.4",
112+
"cz-conventional-changelog": "3.1.0",
103113
"dotenv-cli": "^4.1.1",
104114
"eslint": "6.8.0",
105115
"eslint-config-prettier": "6.10.1",
@@ -108,6 +118,7 @@
108118
"faker": "^5.5.3",
109119
"get-port": "^5.1.1",
110120
"git-cz": "^4.8.0",
121+
"husky": "^7.0.4",
111122
"jest": "^27.4.7",
112123
"jest-extended": "0.11.5",
113124
"lint-staged": "10.1.3",
@@ -124,5 +135,20 @@
124135
},
125136
"engines": {
126137
"node": ">=16 <17"
138+
},
139+
"commitlint": {
140+
"extends": [
141+
"@commitlint/config-conventional"
142+
],
143+
"rules": {
144+
"subject-case": [
145+
2,
146+
"never",
147+
[
148+
"start-case",
149+
"pascal-case"
150+
]
151+
]
152+
}
127153
}
128154
}

0 commit comments

Comments
 (0)