@warlock.js/cascade 4.6.0 → 4.7.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 (61) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/cjs/index.cjs +372 -56
  3. package/cjs/index.cjs.map +1 -1
  4. package/esm/contracts/database-driver.contract.d.mts +8 -0
  5. package/esm/contracts/database-driver.contract.d.mts.map +1 -1
  6. package/esm/contracts/index.d.mts +1 -1
  7. package/esm/contracts/query-builder.contract.d.mts +36 -1
  8. package/esm/contracts/query-builder.contract.d.mts.map +1 -1
  9. package/esm/drivers/mongodb/mongodb-driver.d.mts +5 -0
  10. package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -1
  11. package/esm/drivers/mongodb/mongodb-driver.mjs +10 -4
  12. package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -1
  13. package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +4 -0
  14. package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -1
  15. package/esm/drivers/mongodb/mongodb-migration-driver.mjs +5 -2
  16. package/esm/drivers/mongodb/mongodb-migration-driver.mjs.map +1 -1
  17. package/esm/drivers/mongodb/mongodb-query-builder.d.mts +15 -0
  18. package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -1
  19. package/esm/drivers/mongodb/mongodb-query-builder.mjs +24 -0
  20. package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -1
  21. package/esm/drivers/mongodb/mongodb-query-parser.d.mts +16 -0
  22. package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -1
  23. package/esm/drivers/mongodb/mongodb-query-parser.mjs +33 -1
  24. package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -1
  25. package/esm/drivers/postgres/postgres-driver.d.mts +69 -13
  26. package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -1
  27. package/esm/drivers/postgres/postgres-driver.mjs +155 -27
  28. package/esm/drivers/postgres/postgres-driver.mjs.map +1 -1
  29. package/esm/drivers/postgres/postgres-query-builder.d.mts +14 -3
  30. package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -1
  31. package/esm/drivers/postgres/postgres-query-builder.mjs +44 -8
  32. package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -1
  33. package/esm/drivers/postgres/postgres-query-parser.d.mts +6 -1
  34. package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -1
  35. package/esm/drivers/postgres/postgres-query-parser.mjs +13 -0
  36. package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -1
  37. package/esm/drivers/postgres/postgres-sql-serializer.mjs +15 -4
  38. package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -1
  39. package/esm/index.d.mts +2 -2
  40. package/esm/migration/migration-runner.d.mts.map +1 -1
  41. package/esm/migration/migration-runner.mjs +25 -3
  42. package/esm/migration/migration-runner.mjs.map +1 -1
  43. package/esm/migration/migration.d.mts +6 -3
  44. package/esm/migration/migration.d.mts.map +1 -1
  45. package/esm/migration/migration.mjs +6 -3
  46. package/esm/migration/migration.mjs.map +1 -1
  47. package/esm/model/methods/scope-methods.mjs +18 -4
  48. package/esm/model/methods/scope-methods.mjs.map +1 -1
  49. package/esm/model/model.d.mts +6 -0
  50. package/esm/model/model.d.mts.map +1 -1
  51. package/esm/model/model.mjs +6 -0
  52. package/esm/model/model.mjs.map +1 -1
  53. package/esm/query-builder/query-builder.d.mts +12 -1
  54. package/esm/query-builder/query-builder.d.mts.map +1 -1
  55. package/esm/query-builder/query-builder.mjs +19 -0
  56. package/esm/query-builder/query-builder.mjs.map +1 -1
  57. package/llms-full.txt +41 -7
  58. package/llms.txt +1 -1
  59. package/package.json +4 -4
  60. package/skills/README.md +1 -1
  61. package/skills/manage-transactions/SKILL.md +41 -7
package/CHANGELOG.md CHANGED
@@ -4,6 +4,34 @@ All notable changes to `@warlock.js/cascade` are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
6
 
7
+ ## 4.7.0
8
+
9
+ ### Added
10
+
11
+ - `lockForUpdate({ skipLocked?, noWait? })` — row locking on SELECT (`FOR UPDATE [SKIP LOCKED | NOWAIT]`), the concurrent job-queue claim shape; Postgres-only, the MongoDB driver throws
12
+ - `DatabaseDriverContract.supportsSqlSerialization` — capability flag (default `true`); `false` routes the MigrationRunner through direct migration-driver execution
13
+
14
+ ### Fixed
15
+
16
+ - Postgres model-level `sum`/`avg`/`min`/`max`/`distinct`/`countDistinct`/`pluck`/`value` no longer return `0`/`undefined` — the hydration callback is reset before reading, matching MongoDB
17
+ - Postgres `Model.findAndUpdate` / `Model.atomic` now update every matching row instead of one arbitrary row (a hidden `LIMIT 1`; MongoDB was already multi-row)
18
+ - Postgres query-builder `update()` / `unset()` now honor the chained `where` filter — previously they updated the whole table
19
+ - Postgres query-builder `deleteOne()` deletes exactly one row — the internal `limit(1)` was silently ignored, deleting every matching row
20
+ - Postgres pivot `detach(ids)` (and `sync` / `toggle`) works — the driver translates Mongo-style filter operators (`$in`, `$nin`, `$eq`, `$ne`, `$gt`, `$gte`, `$lt`, `$lte`) instead of binding the operator object literally
21
+ - CHECK constraints are no longer silently dropped on the MigrationRunner SQL path — the Postgres serializer emits `ADD CONSTRAINT ... CHECK` for `this.check(...)` and column `.check(...)`
22
+ - MongoDB `with()` eager loading is no longer a silent no-op — `get()` runs the relation loader, same wiring as Postgres
23
+ - MongoDB pipelines order `$match` before `$project` (SQL semantics), so `select()` before `where()` no longer strips the filter column and returns `[]` — fixes pivot `attach` de-duplication and `sync` / `toggle` deltas
24
+ - The MigrationRunner works on MongoDB — migrations execute directly through the migration driver; `exportSQL` stays SQL-only with a clear unsupported error
25
+ - MongoDB `dropIndex(table, name)` honors the literal index name — the string form is no longer rewritten to `<name>_1` (the columns-array form keeps the convention name)
26
+ - `addGlobalScope` / `addLocalScope` register per-subclass — a scope added on one model (e.g. a soft-delete `notDeleted`) no longer leaks onto every other model
27
+
28
+ ## 4.6.1
29
+
30
+ ### Fixed
31
+
32
+ - Native Postgres array columns (`TEXT[]` / `JSONB[]`, from `arrayText()` / `arrayJson()`) are now auto-detected by introspecting the schema on connect and bound as raw arrays — no more "malformed array literal" on insert and no need to hand-list `nativeArrayColumns` (which stays as an optional per-connection override, now consulted per-table)
33
+ - `transaction()` now flat-nests: a nested `transaction()` joins the active one (same session, sees its uncommitted writes) instead of opening a second, independent transaction — fixes phantom foreign-key violations when a service that opens its own transaction is called inside an outer one (e.g. a seeder creating a row, then a service inserting a child that references it). MongoDB joins too, replacing its "nested not supported" throw
34
+
7
35
  ## 4.6.0
8
36
 
9
37
  ### Added