drizzle-graphql-suite 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -3
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
[](https://www.npmjs.com/package/drizzle-graphql-suite)
|
|
2
|
+
[](https://www.npmjs.com/package/drizzle-graphql-suite)
|
|
3
|
+
[](https://github.com/annexare/drizzle-graphql-suite/actions/workflows/ci.yml)
|
|
4
|
+
|
|
1
5
|
# drizzle-graphql-suite
|
|
2
6
|
|
|
3
7
|
Auto-generated GraphQL CRUD, type-safe clients, and React Query hooks from Drizzle PostgreSQL schemas.
|
|
@@ -6,7 +10,7 @@ Auto-generated GraphQL CRUD, type-safe clients, and React Query hooks from Drizz
|
|
|
6
10
|
|
|
7
11
|
`drizzle-graphql-suite` is a three-layer toolkit that turns your Drizzle ORM schema into a fully working GraphQL API with end-to-end type safety:
|
|
8
12
|
|
|
9
|
-
1. **Schema builder** — generates a complete GraphQL schema with CRUD operations, relation-level filtering,
|
|
13
|
+
1. **Schema builder** — generates a complete GraphQL schema with CRUD operations, relation-level filtering, per-operation hooks, and runtime permissions from Drizzle table definitions.
|
|
10
14
|
2. **Client** — provides a type-safe GraphQL client that infers query/mutation types directly from your Drizzle schema, with full TypeScript support for filters, relations, and results.
|
|
11
15
|
3. **React Query hooks** — wraps the client in TanStack React Query hooks for caching, pagination, and mutations with automatic cache invalidation.
|
|
12
16
|
|
|
@@ -16,7 +20,7 @@ Inspired by [`drizzle-graphql`](https://github.com/drizzle-team/drizzle-graphql)
|
|
|
16
20
|
|
|
17
21
|
| Subpath | Package | Description |
|
|
18
22
|
|---------|---------|-------------|
|
|
19
|
-
| `drizzle-graphql-suite/schema` | [`@drizzle-graphql-suite/schema`](packages/schema/README.md) | GraphQL schema builder with CRUD, filtering, hooks, and codegen |
|
|
23
|
+
| `drizzle-graphql-suite/schema` | [`@drizzle-graphql-suite/schema`](packages/schema/README.md) | GraphQL schema builder with CRUD, filtering, hooks, permissions, and codegen |
|
|
20
24
|
| `drizzle-graphql-suite/client` | [`@drizzle-graphql-suite/client`](packages/client/README.md) | Type-safe GraphQL client with full Drizzle type inference |
|
|
21
25
|
| `drizzle-graphql-suite/query` | [`@drizzle-graphql-suite/query`](packages/query/README.md) | TanStack React Query hooks for the client |
|
|
22
26
|
|
|
@@ -50,7 +54,7 @@ import { createYoga } from 'graphql-yoga'
|
|
|
50
54
|
import { createServer } from 'node:http'
|
|
51
55
|
import { db } from './db'
|
|
52
56
|
|
|
53
|
-
const { schema } = buildSchema(db, {
|
|
57
|
+
const { schema, withPermissions } = buildSchema(db, {
|
|
54
58
|
tables: { exclude: ['session', 'verification'] },
|
|
55
59
|
hooks: {
|
|
56
60
|
user: {
|
|
@@ -68,6 +72,19 @@ const server = createServer(yoga)
|
|
|
68
72
|
server.listen(4000)
|
|
69
73
|
```
|
|
70
74
|
|
|
75
|
+
#### Per-Role Schemas (Optional)
|
|
76
|
+
|
|
77
|
+
```ts
|
|
78
|
+
import { permissive, restricted, readOnly } from 'drizzle-graphql-suite/schema'
|
|
79
|
+
|
|
80
|
+
// Cached per id — call withPermissions on each request
|
|
81
|
+
const schemas = {
|
|
82
|
+
admin: schema,
|
|
83
|
+
editor: withPermissions(permissive('editor', { audit: false, user: readOnly() })),
|
|
84
|
+
viewer: withPermissions(restricted('viewer', { post: { query: true } })),
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
71
88
|
### 2. Client — Type-Safe Queries
|
|
72
89
|
|
|
73
90
|
```ts
|
|
@@ -160,6 +177,15 @@ new Elysia()
|
|
|
160
177
|
.listen(3000)
|
|
161
178
|
```
|
|
162
179
|
|
|
180
|
+
## AI Agent Skill
|
|
181
|
+
|
|
182
|
+
This repo includes a [skills.sh](https://skills.sh) skill that provides AI coding agents (Claude Code, Cursor, etc.) with accurate, up-to-date guidance for all three packages.
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
bunx skills add annexare/drizzle-graphql-suite
|
|
186
|
+
# or: npx skills add annexare/drizzle-graphql-suite
|
|
187
|
+
```
|
|
188
|
+
|
|
163
189
|
## License
|
|
164
190
|
|
|
165
191
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drizzle-graphql-suite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Auto-generated GraphQL CRUD, type-safe clients, and React Query hooks from Drizzle PostgreSQL schemas",
|
|
5
5
|
"author": "https://github.com/dmythro",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,9 +53,10 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@drizzle-graphql-suite/
|
|
57
|
-
"@drizzle-graphql-suite/
|
|
58
|
-
"@drizzle-graphql-suite/
|
|
56
|
+
"@drizzle-graphql-suite/client": "0.8.0",
|
|
57
|
+
"@drizzle-graphql-suite/query": "0.8.0",
|
|
58
|
+
"@drizzle-graphql-suite/schema": "0.8.0",
|
|
59
|
+
"graphql": "16.13.1"
|
|
59
60
|
},
|
|
60
61
|
"workspaces": [
|
|
61
62
|
"packages/*"
|
|
@@ -73,8 +74,8 @@
|
|
|
73
74
|
"release": "bun run build && bun run prepare-publish"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
|
-
"@biomejs/biome": "2.4.
|
|
77
|
-
"@types/bun": "1.3.
|
|
77
|
+
"@biomejs/biome": "2.4.6",
|
|
78
|
+
"@types/bun": "1.3.10",
|
|
78
79
|
"typescript": "5.9.3"
|
|
79
80
|
}
|
|
80
81
|
}
|