@shivaedev/sql 0.23.0 → 0.25.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/CHANGELOG.md +29 -0
- package/README.md +185 -170
- package/dist/ChangeDeclarations.d.ts +5 -0
- package/dist/ChangeDeclarations.d.ts.map +1 -0
- package/dist/ChangeDeclarations.js +3 -0
- package/dist/ChangeDeclarations.js.map +1 -0
- package/dist/batchWrites.d.ts +1 -1
- package/dist/batchWrites.d.ts.map +1 -1
- package/dist/batchWrites.js +6 -3
- package/dist/batchWrites.js.map +1 -1
- package/dist/compositeRepository.d.ts +2 -2
- package/dist/compositeRepository.d.ts.map +1 -1
- package/dist/compositeRepository.js +1 -8
- package/dist/compositeRepository.js.map +1 -1
- package/dist/conditionalUpsert.d.ts +11 -4
- package/dist/conditionalUpsert.d.ts.map +1 -1
- package/dist/conditionalUpsert.js +7 -3
- package/dist/conditionalUpsert.js.map +1 -1
- package/dist/conflictWrites.d.ts +14 -1
- package/dist/conflictWrites.d.ts.map +1 -1
- package/dist/conflictWrites.js +5 -3
- package/dist/conflictWrites.js.map +1 -1
- package/dist/insertFromSelect.js +1 -1
- package/dist/insertFromSelect.js.map +1 -1
- package/dist/mapSqlError.d.ts +6 -0
- package/dist/mapSqlError.d.ts.map +1 -0
- package/dist/mapSqlError.js +22 -0
- package/dist/mapSqlError.js.map +1 -0
- package/dist/repository.js +1 -1
- package/dist/repository.js.map +1 -1
- package/dist/repositoryChanges.d.ts +4 -3
- package/dist/repositoryChanges.d.ts.map +1 -1
- package/dist/repositoryChanges.js +46 -13
- package/dist/repositoryChanges.js.map +1 -1
- package/dist/repositoryWrites.d.ts.map +1 -1
- package/dist/repositoryWrites.js +5 -5
- package/dist/repositoryWrites.js.map +1 -1
- package/dist/testing.d.ts +3 -2
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +25 -3
- package/dist/testing.js.map +1 -1
- package/dist/transact.js +1 -1
- package/dist/transact.js.map +1 -1
- package/dist/upsertResult.d.ts +13 -0
- package/dist/upsertResult.d.ts.map +1 -0
- package/dist/upsertResult.js +9 -0
- package/dist/upsertResult.js.map +1 -0
- package/dist/versionedRepository.js +6 -6
- package/dist/versionedRepository.js.map +1 -1
- package/dist/versionedStatements.d.ts +0 -1
- package/dist/versionedStatements.d.ts.map +1 -1
- package/dist/versionedStatements.js +1 -2
- package/dist/versionedStatements.js.map +1 -1
- package/package.json +12 -11
- package/src/ChangeDeclarations.ts +5 -0
- package/src/batchWrites.ts +6 -2
- package/src/compositeRepository.ts +3 -9
- package/src/conditionalUpsert.ts +11 -7
- package/src/conflictWrites.ts +5 -3
- package/src/insertFromSelect.ts +1 -1
- package/src/mapSqlError.ts +31 -0
- package/src/repository.ts +1 -1
- package/src/repositoryChanges.ts +56 -19
- package/src/repositoryWrites.ts +7 -5
- package/src/testing.ts +30 -5
- package/src/transact.ts +1 -1
- package/src/upsertResult.ts +18 -0
- package/src/versionedRepository.ts +6 -6
- package/src/versionedStatements.ts +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.25.0 - 2026-10-30
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Require the Effect 4.0.6 stack.
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Publish committed SQL invalidations immediately for their owning database, including when another database has an open transaction.
|
|
12
|
+
|
|
13
|
+
### Breaking
|
|
14
|
+
|
|
15
|
+
- `@shivaedev/sql`: migration-body SQL failures now propagate as native typed `MigrationError` failures. Handle them with `Effect.catchTag("MigrationError", ...)` instead of defect recovery; migration-body defects remain defects.
|
|
16
|
+
- `@shivaedev/http`: bounded request-body reads use the native reader and its connection cleanup. Do not assume a rejected upload can drain an arbitrarily large unread body and reuse its connection; allow the HTTP client to open a new connection. The optional Node platform peer is no longer required by this package.
|
|
17
|
+
|
|
18
|
+
## 0.24.0 - 2026-10-28
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `mapSqlError` maps named unique, foreign-key and check violations to application errors and all other SQL failures to a supplied fallback. Use the mapper with `transact`'s `onSqlError` or `Effect.mapError`.
|
|
23
|
+
- Mark model fields with `bucket(schema)` from `@shivaedev/changes/buckets.ts`. SQL repositories announce each written record and its old and new buckets after commit, including inserts, deletes, void writes and conflict writes. Bucket codecs decode stored values before building query keys; absent values have no bucket. Bucket writes require PostgreSQL 18 or later for atomic old-row observations.
|
|
24
|
+
|
|
25
|
+
### Breaking
|
|
26
|
+
|
|
27
|
+
- `upsert` returns `{ row, inserted }` and `upsertMany` returns an array of these results. Read the decoded model from `result.row` instead of the result itself, or destructure `{ row }`. Conditional upserts keep their tags and add `inserted: true` or `false` wherever they return a row; `Unchanged` still has no row.
|
|
28
|
+
- `withChangeCoverage` now requires every declared record and bucket key, and a table name alone no longer covers a raw write. Migrate `covers` values from strings to typed item and bucket keys, and record `invalidationKeys(changedKeys)` through `invalidateOnCommit`. Repository writes declare their own keys automatically; raw writers declare all affected records and buckets.
|
|
29
|
+
- Bulk repository writes retain every record key instead of replacing them with `<table>:*` above 1,000 rows. Consumers observing raw notifications should handle the complete key set, which can span several NOTIFY payloads.
|
|
30
|
+
- Direct callers of the repository implementation helpers must pass a `RepositoryChanges` boundary to `makeCompositeCrud`; `versionedStatements` no longer returns `returningKeys`. Use the boundary's `returning()` fragment so void writes retain the row's bucket fields.
|
|
31
|
+
|
|
3
32
|
## 0.23.0 - 2026-10-27
|
|
4
33
|
|
|
5
34
|
### Added
|