uql-orm 0.111.1 → 0.112.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 +4 -4
- package/dist/browser/uql-browser.min.js +1 -1
- package/dist/browser/uql-browser.min.js.map +3 -3
- package/dist/bunSql/bunSql.util.d.ts +5 -5
- package/dist/bunSql/bunSql.util.js +7 -9
- package/dist/bunSql/bunSqlQuerier.js +2 -4
- package/dist/bunSql/bunSqlQuerierPool.js +5 -7
- package/dist/cockroachdb/crdbQuerierPool.d.ts +2 -5
- package/dist/cockroachdb/crdbQuerierPool.js +2 -6
- package/dist/entity/decorator/members.d.ts +14 -18
- package/dist/entity/decorator/members.js +19 -10
- package/dist/entity/metadata/definedFixture/author.d.ts +2 -1
- package/dist/entity/metadata/definedFixture/folder.d.ts +126 -0
- package/dist/entity/metadata/definedFixture/folder.js +12 -0
- package/dist/entity/metadata/definition.js +3 -3
- package/dist/mariadb/mariadbQuerierPool.d.ts +7 -1
- package/dist/mariadb/mariadbQuerierPool.js +0 -1
- package/dist/migrate/codegen/entityCodeGenerator.js +2 -3
- package/dist/migrate/migrationLock.js +2 -1
- package/dist/mssql/mssqlQuerier.js +2 -1
- package/dist/mysql/mysql2QuerierPool.js +2 -1
- package/dist/neon/neonQuerierPool.js +2 -2
- package/dist/pglite/pgliteDialect.d.ts +1 -3
- package/dist/pglite/pgliteDialect.js +1 -3
- package/dist/pglite/pgliteQuerier.d.ts +2 -8
- package/dist/pglite/pgliteQuerier.js +2 -6
- package/dist/postgres/abstractPgQuerierPool.d.ts +5 -9
- package/dist/postgres/abstractPgQuerierPool.js +7 -4
- package/dist/postgres/pgExecution.d.ts +2 -2
- package/dist/postgres/pgQuerier.js +3 -3
- package/dist/postgres/pgQuerierPool.d.ts +1 -2
- package/dist/postgres/pgQuerierPool.js +1 -5
- package/dist/postgres/pgWireTypes.d.ts +1 -2
- package/dist/querier/abstractQuerier.js +3 -3
- package/dist/querier/abstractSharedHandleQuerierPool.js +2 -1
- package/dist/sqlite/hranaQuerier.d.ts +2 -2
- package/dist/sqlite/localSqliteQuerierPool.d.ts +1 -1
- package/dist/sqlite/sqliteQuerierPool.d.ts +2 -2
- package/dist/sqlite/sqliteQuerierPool.js +2 -2
- package/dist/type/definedEntity.d.ts +8 -1
- package/dist/util/object.util.d.ts +2 -0
- package/dist/util/object.util.js +2 -0
- package/package.json +7 -7
- package/skills/uql-orm/SKILL.md +5 -5
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"homepage": "https://uql-orm.dev",
|
|
4
4
|
"description": "JSON-native TypeScript ORM for Bun, Browsers, Edge, Node, Workers. Supports PostgreSQL, PGlite, MySQL, MariaDB, SQLite, CockroachDB, SQL Server, Turso, Neon, Cloudflare D1 and MongoDB. Queries are plain JSON, typed to the leaf.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.112.0",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=22.18"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"clean": "rimraf dist .tsconfig.tsbuildinfo"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@electric-sql/pglite": ">=0.5.
|
|
58
|
+
"@electric-sql/pglite": ">=0.5.10 <0.6",
|
|
59
59
|
"@libsql/client": ">=0.6.0 <0.19",
|
|
60
60
|
"@neondatabase/serverless": ">=0.9.0 <2",
|
|
61
61
|
"@nestjs/common": ">=10.0.0 <13",
|
|
@@ -123,13 +123,13 @@
|
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
|
-
"@electric-sql/pglite": "0.5.
|
|
127
|
-
"@electric-sql/pglite-pgvector": "0.0.
|
|
126
|
+
"@electric-sql/pglite": "0.5.15",
|
|
127
|
+
"@electric-sql/pglite-pgvector": "0.0.16",
|
|
128
128
|
"@libsql/client": "^0.18.0",
|
|
129
129
|
"@neondatabase/serverless": "^1.2.0",
|
|
130
|
-
"@nestjs/common": "^12.3.
|
|
131
|
-
"@nestjs/core": "^12.3.
|
|
132
|
-
"@nestjs/testing": "^12.3.
|
|
130
|
+
"@nestjs/common": "^12.3.3",
|
|
131
|
+
"@nestjs/core": "^12.3.3",
|
|
132
|
+
"@nestjs/testing": "^12.3.3",
|
|
133
133
|
"@tursodatabase/database": "^0.8.3",
|
|
134
134
|
"@tursodatabase/serverless": "^1.4.1",
|
|
135
135
|
"@types/better-sqlite3": "^9.6.0",
|
package/skills/uql-orm/SKILL.md
CHANGED
|
@@ -67,7 +67,7 @@ export class User {
|
|
|
67
67
|
@Field(f.string().unique())
|
|
68
68
|
email!: string;
|
|
69
69
|
|
|
70
|
-
@OneToMany(
|
|
70
|
+
@OneToMany(() => Post, { mappedBy: (post) => post.author })
|
|
71
71
|
posts?: Post[];
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -82,7 +82,7 @@ export class Post {
|
|
|
82
82
|
@Field(f.references(() => User).nullable())
|
|
83
83
|
authorId?: string | null;
|
|
84
84
|
|
|
85
|
-
@ManyToOne(
|
|
85
|
+
@ManyToOne(() => User, { references: (post) => post.authorId })
|
|
86
86
|
author?: User;
|
|
87
87
|
}
|
|
88
88
|
```
|
|
@@ -92,7 +92,7 @@ export class Post {
|
|
|
92
92
|
- `.default()` takes a value of the field's type, or SQL the database evaluates per row: `currentTimestamp`, `currentDate`, `currentTime`, `uuid` (not SQLite), `uuidv7` (Postgres 18+, MariaDB 11.7+), or ``sql`...` ``. A plain string is always text, `'CURRENT_TIMESTAMP'` included. A JSON column defaults to a value, `.default({})` or `.default(0)`, never its JSON text (`'{}'`, `'0'` are refused); any other string there is a JSON string.
|
|
93
93
|
- `Date` is an instant, stored in UTC to the millisecond. `f.decimal()` is exact text (`price?: string | null`); `f.number().precision(10).scale(2)` opts into a rounding JS number.
|
|
94
94
|
- A JSON column's property is `Json<T>`: `settings?: Json<{ theme?: string }> | null`. A plain object type reads as a relation, which `$where`, `$sort` and the update operators refuse.
|
|
95
|
-
- `mappedBy` and `references` may be left out where only one member fits
|
|
95
|
+
- A relation decorator takes its target first, then its options, as `rel.*` does. `mappedBy` and `references` may be left out where only one member fits, and then the options too: `@OneToMany(() => Post)`. `@ManyToMany(() => Tag, { through: () => PostTag })` names the junction entity. `cascade: true` writes related rows with their row, in one transaction on SQL and, on MongoDB, inside one the caller opens; an update replaces a to-many's rows.
|
|
96
96
|
- A class inherits its base's fields, relations, hooks, filters, indexes, checks and triggers. A base of fields alone needs no `@Entity()`; one declaring entity options but no table is `@Entity({ abstract: true, ... }) abstract class`, which cannot be queried.
|
|
97
97
|
- Optimistic lock: `@Field(f.version())` with `[versionKey]?: 'version'` on the class. An update, and an upsert or save of a row that exists, must carry the version it read; a stale one throws `UqlOptimisticLockError`.
|
|
98
98
|
- Computed fields are `readonly`: ``@Computed((u) => f.string().as(sql`${u.first} || ' ' || ${u.last}`))``, `.stored()` for a generated column, or a relation aggregate, `@Computed((user) => user.posts.count())`.
|
|
@@ -120,7 +120,7 @@ export const Author = defineEntity({
|
|
|
120
120
|
(rel) => ({ books: () => rel.oneToMany(Book, { mappedBy: (book) => book.author }) }),
|
|
121
121
|
(author) => ({ bookCount: () => author.books.count() }),
|
|
122
122
|
);
|
|
123
|
-
export
|
|
123
|
+
export interface Author extends InstanceType<typeof Author> {}
|
|
124
124
|
|
|
125
125
|
export const Book = defineEntity({
|
|
126
126
|
name: 'Book',
|
|
@@ -138,7 +138,7 @@ export const Book = defineEntity({
|
|
|
138
138
|
}));
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
- Columns are the same builders. No `!` or `?` to write: a `.nullable()` column reads `| null`, a default makes it optional on insert, `f.enum()` gives the literal union. A constructor's type argument narrows the column, a brand or a JSON payload with no runtime schema: `f.uuid<UserId>().id()`, `f.json<Settings>()`. It checks the type against the column and exists only in types; a default is written as that type. A filter then takes the branded type, and a foreign key to a branded key must carry the same brand, whether a relation or a decorated property declares it.
|
|
141
|
+
- Columns are the same builders. No `!` or `?` to write: a `.nullable()` column reads `| null`, a default makes it optional on insert, `f.enum()` gives the literal union. A constructor's type argument narrows the column, a brand or a JSON payload with no runtime schema: `f.uuid<UserId>().id()`, `f.json<Settings>()`. It checks the type against the column and exists only in types; a default is written as that type. A filter then takes the branded type, and a foreign key to a branded key must carry the same brand, whether a relation or a decorated property declares it. Name its rows with an interface, `export interface Author extends InstanceType<typeof Author> {}`: hovers and errors then print `Author`, which a type alias expands.
|
|
142
142
|
- `defineEntity` takes `name` (the table derives from it), `table`, `schema`, `extends`, `abstract` and `fields`. Every other option is a section chained after it, each called at most once: `computed`, `indexes`, `checks`, `triggers`, `filters`, `hooks`, then `relations` last; only a `filters` reading through relations follows it.
|
|
143
143
|
- A relation is a thunk, so entities pointing at each other can sit in any order and file. A foreign key is a plain field that a `manyToOne` names as `references`, checked against the target's key type. `relations`' second callback declares aggregate fields: aggregates over a to-many, or expressions mixing them with columns.
|
|
144
144
|
- A JSON column's payload is any Standard Schema (Zod, Valibot, ArkType), typed by its output. uql never runs it, so a write is not validated.
|