@forinda/kickjs-drizzle 1.2.12 → 1.3.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 +68 -0
- package/package.json +14 -5
package/README.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @forinda/kickjs-drizzle
|
|
2
|
+
|
|
3
|
+
Drizzle ORM adapter with DI integration, transaction support, and query building for KickJS.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Using the KickJS CLI (recommended — auto-installs peer dependencies)
|
|
9
|
+
kick add drizzle
|
|
10
|
+
|
|
11
|
+
# Manual install
|
|
12
|
+
pnpm add @forinda/kickjs-drizzle drizzle-orm
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- `DrizzleAdapter` — lifecycle adapter that manages the Drizzle connection
|
|
18
|
+
- `DRIZZLE_DB` token for injecting the database instance via DI
|
|
19
|
+
- `DrizzleQueryAdapter` — translates `ParsedQuery` from `@forinda/kickjs-http` into Drizzle queries
|
|
20
|
+
- `toQueryFieldConfig` helper for field mapping
|
|
21
|
+
|
|
22
|
+
## Quick Example
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { DrizzleAdapter, DRIZZLE_DB, DrizzleQueryAdapter } from '@forinda/kickjs-drizzle'
|
|
26
|
+
import { drizzle } from 'drizzle-orm/postgres-js'
|
|
27
|
+
import postgres from 'postgres'
|
|
28
|
+
|
|
29
|
+
const client = postgres(process.env.DATABASE_URL!)
|
|
30
|
+
const db = drizzle(client)
|
|
31
|
+
|
|
32
|
+
bootstrap({
|
|
33
|
+
modules,
|
|
34
|
+
adapters: [
|
|
35
|
+
new DrizzleAdapter({ db }),
|
|
36
|
+
],
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
// In a service, inject the DB
|
|
40
|
+
@Service()
|
|
41
|
+
class UserService {
|
|
42
|
+
@Inject(DRIZZLE_DB) private db!: typeof db
|
|
43
|
+
|
|
44
|
+
async findAll() {
|
|
45
|
+
return this.db.select().from(users)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Query Adapter
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { DrizzleQueryAdapter } from '@forinda/kickjs-drizzle'
|
|
54
|
+
|
|
55
|
+
const adapter = new DrizzleQueryAdapter()
|
|
56
|
+
const query = adapter.build(parsedQuery, {
|
|
57
|
+
columns: { name: users.name, email: users.email },
|
|
58
|
+
searchColumns: [users.name, users.email],
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Documentation
|
|
63
|
+
|
|
64
|
+
[Full documentation](https://forinda.github.io/kick-js/)
|
|
65
|
+
|
|
66
|
+
## License
|
|
67
|
+
|
|
68
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forinda/kickjs-drizzle",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Drizzle ORM adapter with DI integration, transaction support, and query building for KickJS",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kickjs",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"orm",
|
|
18
18
|
"database",
|
|
19
19
|
"query-builder",
|
|
20
|
-
"adapter",
|
|
21
20
|
"sql",
|
|
22
21
|
"postgres",
|
|
23
22
|
"mysql",
|
|
@@ -28,7 +27,17 @@
|
|
|
28
27
|
"@forinda/kickjs-cli",
|
|
29
28
|
"@forinda/kickjs-swagger",
|
|
30
29
|
"@forinda/kickjs-testing",
|
|
31
|
-
"@forinda/kickjs-
|
|
30
|
+
"@forinda/kickjs-prisma",
|
|
31
|
+
"@forinda/kickjs-ws",
|
|
32
|
+
"@forinda/kickjs-otel",
|
|
33
|
+
"@forinda/kickjs-graphql",
|
|
34
|
+
"@forinda/kickjs-auth",
|
|
35
|
+
"@forinda/kickjs-cron",
|
|
36
|
+
"@forinda/kickjs-mailer",
|
|
37
|
+
"@forinda/kickjs-queue",
|
|
38
|
+
"@forinda/kickjs-multi-tenant",
|
|
39
|
+
"@forinda/kickjs-devtools",
|
|
40
|
+
"@forinda/kickjs-notifications"
|
|
32
41
|
],
|
|
33
42
|
"type": "module",
|
|
34
43
|
"main": "dist/index.js",
|
|
@@ -44,8 +53,8 @@
|
|
|
44
53
|
],
|
|
45
54
|
"dependencies": {
|
|
46
55
|
"reflect-metadata": "^0.2.2",
|
|
47
|
-
"@forinda/kickjs-http": "1.
|
|
48
|
-
"@forinda/kickjs-core": "1.
|
|
56
|
+
"@forinda/kickjs-http": "1.3.0",
|
|
57
|
+
"@forinda/kickjs-core": "1.3.0"
|
|
49
58
|
},
|
|
50
59
|
"peerDependencies": {
|
|
51
60
|
"drizzle-orm": ">=0.30.0"
|