uql-orm 0.77.0 → 0.78.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.
Files changed (49) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/uql-browser.min.js +2 -2
  3. package/dist/browser/uql-browser.min.js.map +4 -4
  4. package/dist/d1/d1Querier.js +2 -1
  5. package/dist/d1/d1SqliteDialect.js +2 -1
  6. package/dist/dialect/abstractDialect.d.ts +7 -1
  7. package/dist/dialect/abstractDialect.js +17 -5
  8. package/dist/dialect/abstractSqlDialect.d.ts +4 -4
  9. package/dist/dialect/abstractSqlDialect.js +30 -26
  10. package/dist/dialect/mysqlLikeSqlDialect.d.ts +3 -1
  11. package/dist/dialect/mysqlLikeSqlDialect.js +3 -3
  12. package/dist/dialect/pgLikeSqlDialect.js +1 -3
  13. package/dist/dialect/queryJoins.js +6 -5
  14. package/dist/dialect/vectorSqlDialect.js +2 -1
  15. package/dist/http/query.js +4 -2
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.js +1 -0
  18. package/dist/maria/mariaDialect.js +2 -2
  19. package/dist/migrate/introspection/mssqlIntrospector.d.ts +1 -0
  20. package/dist/migrate/introspection/mssqlIntrospector.js +4 -1
  21. package/dist/migrate/introspection/mysqlIntrospector.d.ts +1 -0
  22. package/dist/migrate/introspection/mysqlIntrospector.js +2 -0
  23. package/dist/migrate/introspection/postgresIntrospector.d.ts +4 -0
  24. package/dist/migrate/introspection/postgresIntrospector.js +9 -0
  25. package/dist/migrate/introspection/sqliteIntrospector.d.ts +9 -0
  26. package/dist/migrate/introspection/sqliteIntrospector.js +77 -0
  27. package/dist/mongo/mongoDialect.d.ts +0 -6
  28. package/dist/mongo/mongoDialect.js +21 -29
  29. package/dist/mongo/mongodbQuerier.js +0 -1
  30. package/dist/mssql/mssqlDialect.d.ts +1 -5
  31. package/dist/mssql/mssqlDialect.js +4 -11
  32. package/dist/querier/abstractQuerier.d.ts +8 -1
  33. package/dist/querier/abstractQuerier.js +32 -14
  34. package/dist/querier/abstractSqlQuerier.d.ts +0 -5
  35. package/dist/querier/abstractSqlQuerier.js +4 -17
  36. package/dist/querier/queryError.d.ts +1 -27
  37. package/dist/querier/queryError.js +3 -28
  38. package/dist/sqlite/sqliteDialect.js +0 -2
  39. package/dist/type/dialect.d.ts +18 -6
  40. package/dist/type/queryAggregate.js +2 -1
  41. package/dist/type/queryLock.js +2 -1
  42. package/dist/type/queryWhere.d.ts +7 -6
  43. package/dist/type/utility.d.ts +8 -0
  44. package/dist/util/dialect.util.js +14 -13
  45. package/dist/util/relationQuery.util.js +4 -3
  46. package/dist/util/uqlError.d.ts +39 -0
  47. package/dist/util/uqlError.js +35 -0
  48. package/package.json +1 -1
  49. package/skills/uql-orm/SKILL.md +7 -1
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "homepage": "https://uql-orm.dev",
4
4
  "description": "The JSON-native TypeScript ORM for Bun, Browsers, Edge, Deno, 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.77.0",
6
+ "version": "0.78.0",
7
7
  "type": "module",
8
8
  "engines": {
9
9
  "node": ">=24"
@@ -82,7 +82,7 @@ export class Post {
82
82
  - `@Field({ type: Number, version: true })`, with `[versionKey]?: 'version'` on the class, makes the column an
83
83
  optimistic lock: every update payload must carry the version it read (a compile error otherwise), the update
84
84
  matches on it and writes the next one, and a write against a row someone else moved on throws
85
- `UqlOptimisticLockError` (`status` 409) instead of overwriting it. Save and upsert are refused on such an entity; the update is named by its id, so `updateMany` over a many-row filter is refused too, and delete and restore carry no version.
85
+ `UqlOptimisticLockError` (kind `optimisticLock`, HTTP 409) instead of overwriting it. Save and upsert are refused on such an entity; the update is named by its id, so `updateMany` over a many-row filter is refused too, and delete and restore carry no version.
86
86
  - `defineEntity` defines the same entity without decorators: https://uql-orm.dev/entities/imperative.md
87
87
 
88
88
  ## Queries
@@ -124,6 +124,12 @@ const users = await pool.findMany(User, {
124
124
  - An update takes `{ stock: { $inc: -1 } }` to add, or `$mul` to multiply, in the statement, a NULL counting as 0,
125
125
  so a guard in `$where` (`stock: { $gte: 1 }`) makes a decrement race-safe. JSON fields take `$set`, `$unset`,
126
126
  `$push`, `$pull`.
127
+ - `$lock: true` locks the rows a read returns (`{ $wait: 'skip' | 'nowait' }` says what to do about a row
128
+ someone else holds) and needs an open transaction; SQLite, libSQL, Turso, D1 and MongoDB have no row lock and
129
+ refuse it.
130
+ - `queryErrorKind(err)` names any failure the same on every engine - `uniqueViolation`, `foreignKeyViolation`,
131
+ `notNullViolation`, `checkViolation`, `optimisticLock`, `retryable`, `usage` - so catch by kind rather than by
132
+ a driver's code or an `instanceof`.
127
133
  - `raw()` embeds SQL anywhere a value or field goes; `pool.all(sql, values)` runs a raw `SELECT`.
128
134
 
129
135
  ## Connections and transactions