@forinda/kickjs-drizzle 1.2.12 → 1.2.13

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.
Files changed (2) hide show
  1. package/README.md +68 -0
  2. package/package.json +3 -3
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.2.12",
3
+ "version": "1.2.13",
4
4
  "description": "Drizzle ORM adapter with DI integration, transaction support, and query building for KickJS",
5
5
  "keywords": [
6
6
  "kickjs",
@@ -44,8 +44,8 @@
44
44
  ],
45
45
  "dependencies": {
46
46
  "reflect-metadata": "^0.2.2",
47
- "@forinda/kickjs-http": "1.2.12",
48
- "@forinda/kickjs-core": "1.2.12"
47
+ "@forinda/kickjs-core": "1.2.13",
48
+ "@forinda/kickjs-http": "1.2.13"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "drizzle-orm": ">=0.30.0"