kinetic-sql 1.0.2 → 1.0.3

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 +35 -19
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -19,14 +19,14 @@ Kinetic SQL is a next-gen Node.js client that wraps **PostgreSQL** and **MySQL**
19
19
  ### 1. Install
20
20
 
21
21
  ```bash
22
-
23
- # For PostgreSQL
24
-
22
+ # For PostgreSQL:
25
23
  npm install kinetic-sql drizzle-orm postgres
26
24
 
27
- # For MySQL
28
-
25
+ # For MySQL:
29
26
  npm install kinetic-sql drizzle-orm mysql2 @rodrigogs/mysql-events
27
+
28
+ # For SQLite (Local Dev / Edge):
29
+ npm install kinetic-sql better-sqlite3
30
30
  ```
31
31
 
32
32
  ### 2. Initialize
@@ -34,12 +34,19 @@ npm install kinetic-sql drizzle-orm mysql2 @rodrigogs/mysql-events
34
34
  ```typescript
35
35
  import { KineticClient } from 'kinetic-sql';
36
36
 
37
- // Connects using your DATABASE_URL env var by default
37
+ /* PostgreSQL/MySQL Example */
38
+ /* Connects using your DATABASE_URL env var by default */
38
39
  const db = await KineticClient.create({
39
40
  type: 'pg', // or 'mysql'
40
41
  connectionString: process.env.DATABASE_URL,
41
42
  realtimeEnabled: true
42
43
  });
44
+
45
+ /* SQLite Example */
46
+ const db = await KineticClient.create({
47
+ type: 'sqlite',
48
+ filename: './dev.db'
49
+ });
43
50
  ```
44
51
 
45
52
  ### 3. Generate Types (The Magic)
@@ -47,14 +54,16 @@ realtimeEnabled: true
47
54
  Run this command in your terminal. It reads your DB and patches the library automatically.
48
55
 
49
56
  ```bash
50
-
51
57
  # PostgreSQL (Default)
52
-
53
58
  npx k-sql gen --connection "postgres://..."
59
+ OR
60
+ npx k-sql gen --type pg --host localhost --user postgres --db mydb
54
61
 
55
62
  # MySQL
56
-
57
63
  npx k-sql gen --type mysql --host localhost --user root --db mydb
64
+
65
+ # SQLite
66
+ npx k-sql gen --type sqlite --db ./dev.db
58
67
  ```
59
68
 
60
69
  ---
@@ -66,7 +75,7 @@ npx k-sql gen --type mysql --host localhost --user root --db mydb
66
75
  #### Listen to database events without setting up WebSockets.
67
76
 
68
77
  ```typescript
69
- // 'tasks' is auto-completed!
78
+ /* 'tasks' is auto-completed! */
70
79
  const sub = await db.subscribe('tasks', (event) => {
71
80
  console.log(event.action); // 'INSERT' | 'UPDATE'
72
81
  console.log(event.data.title); // Typed!
@@ -81,11 +90,12 @@ await sub.unsubscribe();
81
90
  #### Call stored procedures as native JS methods.
82
91
 
83
92
  ```typescript
84
- // 'add_todo' is auto-completed!
85
- const { data, error } = await db.rpc('add_todo', {
86
- p_title: "Build cool app", // Param names are checked!
87
- p_user_id: 123
88
- });
93
+ /* 'add_todo' is auto-completed! */
94
+ const { data, error } = await db.rpc(
95
+ 'add_todo',
96
+ /* Param names are checked! */
97
+ { p_title: "Build cool app", p_user_id: 123 }
98
+ );
89
99
  ```
90
100
 
91
101
  ### Standard Queries (via Drizzle) ✨
@@ -106,7 +116,6 @@ const users = await db.orm
106
116
  ## ⚙️ Configuration
107
117
 
108
118
  ### PostgreSQL
109
-
110
119
  ```typescript
111
120
  const db = await KineticClient.create({
112
121
  type: 'pg',
@@ -120,7 +129,6 @@ realtimeEnabled: true
120
129
  ```
121
130
 
122
131
  ### MySQL
123
-
124
132
  ```typescript
125
133
  const db = await KineticClient.create({
126
134
  type: 'mysql',
@@ -133,12 +141,20 @@ realtimeEnabled: true // Requires Binary Logging enabled on server
133
141
  });
134
142
  ```
135
143
 
144
+ ### SQLite
145
+ ```typescript
146
+ const db = await KineticClient.create({
147
+ type: 'sqlite',
148
+ filename: './prisma/dev.db' // Path to your file
149
+ });
150
+ ```
151
+
136
152
  ## ⚠️ Requirements
137
153
 
138
154
  - **Node.js:** 18+
139
155
  - **PostgreSQL:** 12+ (Native `LISTEN/NOTIFY` used)
140
- - **MySQL:** 5.7+
141
- - *Note:* For Realtime features, your MySQL server must have **Binary Logging** enabled (`log_bin = ON`).
156
+ - **MySQL:** 5.7+ (Requires Binary Logging Enabled i.e. ` log_bin = ON ` for Realtime features)
157
+ - **SQLite:** 3+ (Bundled with `better-sqlite3`)
142
158
 
143
159
  ## 📄 License
144
160
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kinetic-sql",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Zero-config, type-safe Postgres & MySQL client with Realtime subscriptions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",