@uql/core 3.7.0 → 3.7.1
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/CHANGELOG.md +5 -1
- package/README.md +45 -28
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## [3.7.1](https://github.com/rogerpadilla/uql/compare/@uql/core@3.7.0...@uql/core@3.7.1) (2026-01-04)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @uql/core
|
|
9
9
|
|
|
@@ -17,6 +17,10 @@ All notable changes to this project will be documented in this file. Please add
|
|
|
17
17
|
|
|
18
18
|
date format is [yyyy-mm-dd]
|
|
19
19
|
|
|
20
|
+
## [3.7.1] - 2026-01-04
|
|
21
|
+
### Improve documentation
|
|
22
|
+
- Update examples in docs and improve formatting of README
|
|
23
|
+
|
|
20
24
|
## [3.7.0] - 2026-01-04
|
|
21
25
|
### Improvements
|
|
22
26
|
- **Repository Pattern Removal**: Removed the built-in Repository pattern implementation (`GenericRepository`, etc.) to simplify the framework architecture (KISS). Users should rely on the `Querier` interface or implement custom layers if needed.
|
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ const users = await querier.findMany(User, {
|
|
|
37
37
|
|
|
38
38
|
| Feature | Description |
|
|
39
39
|
| :----------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------ |
|
|
40
|
-
| **[Context-Aware Queries](https://uql.app/querying/relations)** | Deep type-safety for operators and
|
|
40
|
+
| **[Context-Aware Queries](https://uql.app/querying/relations)** | Deep type-safety for operators and [relations](https://uql.app/querying/relations) at any depth. |
|
|
41
41
|
| **Serializable JSON** | 100% valid JSON queries for easy transport over HTTP/Websockets. |
|
|
42
42
|
| **Unified Dialects** | Write once, run anywhere: PostgreSQL, MySQL, SQLite, MongoDB, and more. |
|
|
43
43
|
| **Naming Strategies** | Pluggable system to translate between TypeScript `camelCase` and database `snake_case`. |
|
|
@@ -58,17 +58,17 @@ Install the core package and the driver for your database:
|
|
|
58
58
|
npm install @uql/core # or bun add / pnpm add
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
###
|
|
61
|
+
### Supported Drivers (pick according to your database)
|
|
62
62
|
|
|
63
|
-
| Database
|
|
64
|
-
|
|
|
65
|
-
| **PostgreSQL** (incl. Neon, Cockroach, Yugabyte) | `npm install pg`
|
|
66
|
-
| **MySQL** (incl. TiDB, Aurora)
|
|
67
|
-
| **MariaDB**
|
|
68
|
-
| **SQLite**
|
|
69
|
-
| **LibSQL** (incl. Turso)
|
|
70
|
-
| **MongoDB**
|
|
71
|
-
| **Cloudflare D1**
|
|
63
|
+
| Database | Command |
|
|
64
|
+
| :----------------------------------------------------- | :----------------------------- |
|
|
65
|
+
| **PostgreSQL** (incl. Neon, Cockroach, Yugabyte) | `npm install pg` |
|
|
66
|
+
| **MySQL** (incl. TiDB, Aurora) | `npm install mysql2` |
|
|
67
|
+
| **MariaDB** | `npm install mariadb` |
|
|
68
|
+
| **SQLite** | `npm install better-sqlite3` |
|
|
69
|
+
| **LibSQL** (incl. Turso) | `npm install @libsql/client` |
|
|
70
|
+
| **MongoDB** | `npm install mongodb` |
|
|
71
|
+
| **Cloudflare D1** | _Native (no driver needed)_ |
|
|
72
72
|
|
|
73
73
|
### TypeScript Configuration
|
|
74
74
|
|
|
@@ -93,12 +93,17 @@ Annotate your classes with decorators. UQL's engine uses this metadata for both
|
|
|
93
93
|
|
|
94
94
|
### Core Decorators
|
|
95
95
|
|
|
96
|
-
| Decorator
|
|
97
|
-
|
|
|
98
|
-
| `@Entity()`
|
|
99
|
-
| `@Id()`
|
|
100
|
-
| `@Field()`
|
|
101
|
-
| `@
|
|
96
|
+
| Decorator | Purpose |
|
|
97
|
+
| :--------------- | :----------------------------------------------------------------------------- |
|
|
98
|
+
| `@Entity()` | Marks a class as a database table/collection. |
|
|
99
|
+
| `@Id()` | Defines the Primary Key with support for `onInsert` generators (UUIDs, etc). |
|
|
100
|
+
| `@Field()` | Standard column. Use `{ reference: ... }` for Foreign Keys. |
|
|
101
|
+
| `@OneToOne` | Defines a one-to-one relationship. |
|
|
102
|
+
| `@OneToMany` | Defines a one-to-many relationship. |
|
|
103
|
+
| `@ManyToOne` | Defines a many-to-one relationship. |
|
|
104
|
+
| `@ManyToMany` | Defines a many-to-many relationship. |
|
|
105
|
+
|
|
106
|
+
|
|
102
107
|
|
|
103
108
|
```ts
|
|
104
109
|
import { v7 as uuidv7 } from 'uuid';
|
|
@@ -109,16 +114,28 @@ export class User {
|
|
|
109
114
|
@Id({ onInsert: () => uuidv7() })
|
|
110
115
|
id?: string;
|
|
111
116
|
|
|
112
|
-
@Field({
|
|
117
|
+
@Field({
|
|
118
|
+
index: true,
|
|
119
|
+
})
|
|
113
120
|
name?: string;
|
|
114
121
|
|
|
115
|
-
@Field({
|
|
122
|
+
@Field({
|
|
123
|
+
unique: true,
|
|
124
|
+
comment: 'User login email',
|
|
125
|
+
})
|
|
116
126
|
email?: string;
|
|
117
127
|
|
|
118
|
-
@OneToOne({
|
|
128
|
+
@OneToOne({
|
|
129
|
+
entity: () => Profile,
|
|
130
|
+
mappedBy: 'user',
|
|
131
|
+
cascade: true,
|
|
132
|
+
})
|
|
119
133
|
profile?: Relation<Profile>; // Relation<T> handles circular dependencies
|
|
120
134
|
|
|
121
|
-
@OneToMany({
|
|
135
|
+
@OneToMany({
|
|
136
|
+
entity: () => Post,
|
|
137
|
+
mappedBy: 'author',
|
|
138
|
+
})
|
|
122
139
|
posts?: Relation<Post>[];
|
|
123
140
|
}
|
|
124
141
|
|
|
@@ -151,7 +168,10 @@ export class Post {
|
|
|
151
168
|
@ManyToOne({ entity: () => User })
|
|
152
169
|
author?: User;
|
|
153
170
|
|
|
154
|
-
@ManyToMany({
|
|
171
|
+
@ManyToMany({
|
|
172
|
+
entity: () => Tag,
|
|
173
|
+
through: () => PostTag,
|
|
174
|
+
})
|
|
155
175
|
tags?: Tag[];
|
|
156
176
|
}
|
|
157
177
|
|
|
@@ -186,8 +206,8 @@ export class PostTag {
|
|
|
186
206
|
A pool manages connections (queriers). Initialize it once at application bootstrap (e.g., in `server.ts`).
|
|
187
207
|
|
|
188
208
|
```ts
|
|
189
|
-
import { PgQuerierPool } from '@uql/core/postgres';
|
|
190
209
|
import { SnakeCaseNamingStrategy, type Config } from '@uql/core';
|
|
210
|
+
import { PgQuerierPool } from '@uql/core/postgres'; // or mysql2, sqlite, etc.
|
|
191
211
|
import { User, Profile, Post } from './entities';
|
|
192
212
|
|
|
193
213
|
export const pool = new PgQuerierPool(
|
|
@@ -299,9 +319,6 @@ export class UserService {
|
|
|
299
319
|
}
|
|
300
320
|
```
|
|
301
321
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
322
|
|
|
306
323
|
|
|
307
324
|
## 5. Migrations & Synchronization
|
|
@@ -382,7 +399,7 @@ Learn more about UQL at [uql.app](https://uql.app) for details on:
|
|
|
382
399
|
- [Soft Deletes & Auditing](https://uql.app/entities/soft-delete)
|
|
383
400
|
- [Database Migration & Syncing](https://uql.app/migrations)
|
|
384
401
|
|
|
385
|
-
|
|
402
|
+
|
|
386
403
|
|
|
387
404
|
## 🛠 Deep Dive: Tests & Technical Resources
|
|
388
405
|
|
|
@@ -395,7 +412,7 @@ For those who want to see the "engine under the hood," check out these resources
|
|
|
395
412
|
- [PostgreSQL](https://github.com/rogerpadilla/uql/blob/main/packages/core/src/postgres/postgresDialect.spec.ts) \| [MySQL](https://github.com/rogerpadilla/uql/blob/main/packages/core/src/mysql/mysqlDialect.spec.ts) \| [SQLite](https://github.com/rogerpadilla/uql/blob/main/packages/core/src/sqlite/sqliteDialect.spec.ts) specs.
|
|
396
413
|
- [Querier Integration Tests](https://github.com/rogerpadilla/uql/blob/main/packages/core/src/querier/abstractSqlQuerier-spec.ts): SQL generation & connection management tests.
|
|
397
414
|
|
|
398
|
-
|
|
415
|
+
|
|
399
416
|
|
|
400
417
|
## Built with ❤️ and supported by
|
|
401
418
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"homepage": "https://uql.app",
|
|
4
4
|
"description": "One Language. Frontend to Backend.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "3.7.
|
|
6
|
+
"version": "3.7.1",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
@@ -143,5 +143,5 @@
|
|
|
143
143
|
"publishConfig": {
|
|
144
144
|
"access": "public"
|
|
145
145
|
},
|
|
146
|
-
"gitHead": "
|
|
146
|
+
"gitHead": "a4e36bf8ee122b234bf6b4d6e00c2386ce068ac7"
|
|
147
147
|
}
|