Merge commit '36c66dd290d3ce6eb1ccd310d0c658d4a32bb8eb' as 'repos/effect'

This commit is contained in:
-Puter
2026-07-19 03:25:10 +05:30
parent dd1071cc10
commit 2daf979036
2214 changed files with 673090 additions and 0 deletions

View File

@@ -0,0 +1,312 @@
# @effect/sql-pglite
## 4.0.0-beta.99
### Patch Changes
- Updated dependencies [[`8ce4795`](https://github.com/Effect-TS/effect/commit/8ce4795ccbaebca4292757db568c005a992546a4), [`80b539f`](https://github.com/Effect-TS/effect/commit/80b539f8aba68f478c75c35c2b4140c4ffc4fada), [`88a54cc`](https://github.com/Effect-TS/effect/commit/88a54cc341006e3ebcb13482c618f62a680ce199), [`e6e6dba`](https://github.com/Effect-TS/effect/commit/e6e6dba6e9d86e7c2ad27dcedf289db76a19697f), [`bfb203e`](https://github.com/Effect-TS/effect/commit/bfb203e95aa439f731acad37fc3a9a831a190f1c), [`2e9a34a`](https://github.com/Effect-TS/effect/commit/2e9a34ac2bece4f3a206160480c991e3841dc67a), [`55d4eb3`](https://github.com/Effect-TS/effect/commit/55d4eb34f2c64d54f6a25a305b5c5438ebd7934e), [`bddb010`](https://github.com/Effect-TS/effect/commit/bddb010eac3d4436cb094edbbee7460c5440c162), [`a328835`](https://github.com/Effect-TS/effect/commit/a328835e50d76bc96648a1c1550456e8c9f81210), [`5560d05`](https://github.com/Effect-TS/effect/commit/5560d05aa6abdd29466d9c3412cc5e648b0adbde), [`8f6e3ad`](https://github.com/Effect-TS/effect/commit/8f6e3adb185b16e8820b98c509b308086f7ff1af), [`46997fa`](https://github.com/Effect-TS/effect/commit/46997fa60401f5e3c93daa4b61f7df8e31caaab4), [`9e6e12d`](https://github.com/Effect-TS/effect/commit/9e6e12d75c118cd265496f2880490d1f33a5c8bf), [`3394b93`](https://github.com/Effect-TS/effect/commit/3394b93d97d6f24fc38670641d1490289ffca7f1), [`febeabc`](https://github.com/Effect-TS/effect/commit/febeabc3f7c31094da000a23edeaabfe2ab00a38), [`54161c9`](https://github.com/Effect-TS/effect/commit/54161c98f6f3569e0c31842f54e6a257f9421c4c), [`385f7a4`](https://github.com/Effect-TS/effect/commit/385f7a4ee4a7359928597ea56d151dbaf5eb5802), [`7eea4d0`](https://github.com/Effect-TS/effect/commit/7eea4d0b73ec554915d7066a71f46326ce2ba45f), [`7543afe`](https://github.com/Effect-TS/effect/commit/7543afea6f4d97d1f1ad876224323838a48daadd), [`44b9cf3`](https://github.com/Effect-TS/effect/commit/44b9cf3d240d726997b4bbcd0ede48e074d3c456), [`7eea4d0`](https://github.com/Effect-TS/effect/commit/7eea4d0b73ec554915d7066a71f46326ce2ba45f), [`0a8aa6a`](https://github.com/Effect-TS/effect/commit/0a8aa6acb90a72b91c24d17133c950e4cacd8abd), [`c8d9fcf`](https://github.com/Effect-TS/effect/commit/c8d9fcf7b030f7c474effbab2764ce7aee1c7209), [`9ca7f9a`](https://github.com/Effect-TS/effect/commit/9ca7f9a69363e4485645966d5a93b8f9597c5206), [`e7aca89`](https://github.com/Effect-TS/effect/commit/e7aca894bb32fbb785b5830837e6061c415a6015), [`55d7560`](https://github.com/Effect-TS/effect/commit/55d75609b8acf8a1b54c1b1c7fbbb65ec741aa3e), [`f809189`](https://github.com/Effect-TS/effect/commit/f809189ddf6b6011ba43a9901baaa734e315da2a), [`88a54cc`](https://github.com/Effect-TS/effect/commit/88a54cc341006e3ebcb13482c618f62a680ce199), [`0ebdbe7`](https://github.com/Effect-TS/effect/commit/0ebdbe74463dc84385956d0b1e8c2b79ebab5400), [`7517d09`](https://github.com/Effect-TS/effect/commit/7517d09f12a0b183a81bd425962c4e280a68b05d), [`212493b`](https://github.com/Effect-TS/effect/commit/212493b9a1eb98cd1ef6959c707a2e5784a5ae91), [`88a54cc`](https://github.com/Effect-TS/effect/commit/88a54cc341006e3ebcb13482c618f62a680ce199), [`80ea8cb`](https://github.com/Effect-TS/effect/commit/80ea8cb9222ca73f564c8267ab2f82966fea027a), [`8df19f4`](https://github.com/Effect-TS/effect/commit/8df19f4fe81d90cc33ace88b9a77e5534f82d604)]:
- effect@4.0.0-beta.99
## 4.0.0-beta.98
### Patch Changes
- Updated dependencies [[`989603b`](https://github.com/Effect-TS/effect-smol/commit/989603b60ab1197b64acf214208e0d370cd1f842), [`214c458`](https://github.com/Effect-TS/effect-smol/commit/214c458084bb6995d543cd37d1055f24be3d454e), [`a037273`](https://github.com/Effect-TS/effect-smol/commit/a0372736ac34796969b051bbba4717d7983f1ebe), [`97fdaa9`](https://github.com/Effect-TS/effect-smol/commit/97fdaa9c1f522c65e579365d314a07878e2b904f), [`b24d248`](https://github.com/Effect-TS/effect-smol/commit/b24d248c8df44222ce642087cde2bd859a2dc709), [`19c222c`](https://github.com/Effect-TS/effect-smol/commit/19c222cac2353a3d7b7733caecb00556fffe9a5c), [`eec85dd`](https://github.com/Effect-TS/effect-smol/commit/eec85ddba09ea326fd268ee33eeffd47e50d4671), [`0082f4f`](https://github.com/Effect-TS/effect-smol/commit/0082f4f74fb139fd578f87f0a790e845133983dc), [`8849052`](https://github.com/Effect-TS/effect-smol/commit/884905232d1e9a365e046d8dde27bf9c5707f57f), [`c15e16a`](https://github.com/Effect-TS/effect-smol/commit/c15e16ad130d1fbde25d912b7ac55995066cb35b), [`01d00a3`](https://github.com/Effect-TS/effect-smol/commit/01d00a3abfbf1f37996cdbe738ea5137c646cdd7), [`8bd4589`](https://github.com/Effect-TS/effect-smol/commit/8bd458975a1b3a8ed042eccf317b93d28ded91e7), [`0082f4f`](https://github.com/Effect-TS/effect-smol/commit/0082f4f74fb139fd578f87f0a790e845133983dc), [`6e08428`](https://github.com/Effect-TS/effect-smol/commit/6e08428d980501b856f846ad3f3f0e4ea46e7786), [`388dcf9`](https://github.com/Effect-TS/effect-smol/commit/388dcf953f65d317547f34d40e6443c5f264205f), [`2b7ce2b`](https://github.com/Effect-TS/effect-smol/commit/2b7ce2b513e7ec2a77822f1116dc6ffb6ba93f4e), [`87bea7e`](https://github.com/Effect-TS/effect-smol/commit/87bea7e16259246f3bcdf565446394751abca953), [`ce38dc3`](https://github.com/Effect-TS/effect-smol/commit/ce38dc33bda805a684432cca071f4dc3c6b9a1ba), [`a807cd1`](https://github.com/Effect-TS/effect-smol/commit/a807cd170341deca8a1cfb52c4222585f2431bb9), [`fd8a356`](https://github.com/Effect-TS/effect-smol/commit/fd8a356f06a8c9ce4e7e0a13fc4021c178ed31de), [`c2a5edc`](https://github.com/Effect-TS/effect-smol/commit/c2a5edc3abd31ad5bc123362bc1213e03e4095c3), [`5946da3`](https://github.com/Effect-TS/effect-smol/commit/5946da3804a1be5e752b05b96bd058cdba50a1bf), [`4ae0c5f`](https://github.com/Effect-TS/effect-smol/commit/4ae0c5ffcbe6c56ddfcb05c639112a079483539e), [`5b2a0bc`](https://github.com/Effect-TS/effect-smol/commit/5b2a0bceea3a28a33a58555210c90a415dc74a76), [`72ac585`](https://github.com/Effect-TS/effect-smol/commit/72ac585884befde6af9208da738699a93f1bae79), [`5e8c1b8`](https://github.com/Effect-TS/effect-smol/commit/5e8c1b82bfafa121311f987a49ab75395e3647a7), [`0f9c078`](https://github.com/Effect-TS/effect-smol/commit/0f9c07841b04183f485ee6e6458de73b290b09f5)]:
- effect@4.0.0-beta.98
## 4.0.0-beta.97
### Patch Changes
- Updated dependencies []:
- effect@4.0.0-beta.97
## 4.0.0-beta.96
### Patch Changes
- Updated dependencies [[`1503f45`](https://github.com/Effect-TS/effect-smol/commit/1503f45cb5bb2a74f4705252ec505a1f0ade7e62), [`57fe793`](https://github.com/Effect-TS/effect-smol/commit/57fe79316ffbc380b30626a168981fb26ae97459), [`0c2f78f`](https://github.com/Effect-TS/effect-smol/commit/0c2f78f695ec474e1ff5474da183577975e418f5), [`0c2f78f`](https://github.com/Effect-TS/effect-smol/commit/0c2f78f695ec474e1ff5474da183577975e418f5), [`0c2f78f`](https://github.com/Effect-TS/effect-smol/commit/0c2f78f695ec474e1ff5474da183577975e418f5), [`97f29df`](https://github.com/Effect-TS/effect-smol/commit/97f29df457f7ffd07cfb4b379315c12c086af805)]:
- effect@4.0.0-beta.96
## 4.0.0-beta.95
### Patch Changes
- Updated dependencies [[`a482442`](https://github.com/Effect-TS/effect-smol/commit/a482442abdeb490e9652b854ec3495e4aa7273e7), [`fbefa85`](https://github.com/Effect-TS/effect-smol/commit/fbefa850fab2f0a302c20614496aeaaa2a8b5590), [`0b4a32f`](https://github.com/Effect-TS/effect-smol/commit/0b4a32f4260f0d8500942a133001b0d349328102), [`18a49e1`](https://github.com/Effect-TS/effect-smol/commit/18a49e1786679456258002ff9397faf02f678c2d), [`266cb90`](https://github.com/Effect-TS/effect-smol/commit/266cb90bb2c17aabc40563c32db334f09ba3d74b), [`912f095`](https://github.com/Effect-TS/effect-smol/commit/912f095a34572bbd3cedf6edb27878443e3e4a95), [`a6718f9`](https://github.com/Effect-TS/effect-smol/commit/a6718f9e00a15ca903b0732da46116cbf3d6aca7), [`bef5154`](https://github.com/Effect-TS/effect-smol/commit/bef51540a243aa2f872a00c01d0cd58b7a769baa), [`18e0564`](https://github.com/Effect-TS/effect-smol/commit/18e0564bd0f8ebbdfcaf1e2c21529948e9e4a81d), [`fb50f14`](https://github.com/Effect-TS/effect-smol/commit/fb50f14fc3657c1973785aa5b72ecf0b0d28e0b2)]:
- effect@4.0.0-beta.95
## 4.0.0-beta.94
### Patch Changes
- Updated dependencies [[`95a0e9b`](https://github.com/Effect-TS/effect-smol/commit/95a0e9bb62797af0e81c9998773405f248f218c5), [`a0a3490`](https://github.com/Effect-TS/effect-smol/commit/a0a3490bbce765f199d8e077aceac504f0462e63), [`f11ce73`](https://github.com/Effect-TS/effect-smol/commit/f11ce73af60823754dc24194f4ffc561b9ea1c2d), [`ff30b6e`](https://github.com/Effect-TS/effect-smol/commit/ff30b6e7c2c63ffc56a4c5818d6d86b01b5ad528), [`1caab3c`](https://github.com/Effect-TS/effect-smol/commit/1caab3cc30f626efbf15e59d74f539a487e5c85c), [`aa80c47`](https://github.com/Effect-TS/effect-smol/commit/aa80c4775a04db87553e5568764cab7e32a72814), [`c2ae4fc`](https://github.com/Effect-TS/effect-smol/commit/c2ae4fce2f03a4cd1861c2b1179da7df656e662d), [`a0a3490`](https://github.com/Effect-TS/effect-smol/commit/a0a3490bbce765f199d8e077aceac504f0462e63)]:
- effect@4.0.0-beta.94
## 4.0.0-beta.93
### Patch Changes
- Updated dependencies [[`00652fe`](https://github.com/Effect-TS/effect-smol/commit/00652fe95c18f87208e91343eb8bf218faa2f677), [`6c58167`](https://github.com/Effect-TS/effect-smol/commit/6c5816746eaf91d2a3c7c899c5720809fa230ae3), [`2bc5415`](https://github.com/Effect-TS/effect-smol/commit/2bc541501a7ef89e542d7cb98e96beb53cd205cc), [`e11cccc`](https://github.com/Effect-TS/effect-smol/commit/e11cccc7d5fe631abccc7d6e3bd296938de0fa2e), [`ba7e77e`](https://github.com/Effect-TS/effect-smol/commit/ba7e77e046b8641a3a4e9750bb88ca4a1d063d3f), [`5713ee7`](https://github.com/Effect-TS/effect-smol/commit/5713ee7edbc3054efde407b2286bbfd45bbc6e1c)]:
- effect@4.0.0-beta.93
## 4.0.0-beta.92
### Patch Changes
- Updated dependencies [[`affdc13`](https://github.com/Effect-TS/effect-smol/commit/affdc139045cc325dce321a84a580fdc1b2da7b9)]:
- effect@4.0.0-beta.92
## 4.0.0-beta.91
### Patch Changes
- Updated dependencies [[`b135b25`](https://github.com/Effect-TS/effect-smol/commit/b135b2517fca9e7839734ace3699a7dfa75b9075), [`aaa21a3`](https://github.com/Effect-TS/effect-smol/commit/aaa21a369a171c600db294f2a4f640583043e150), [`3475ee6`](https://github.com/Effect-TS/effect-smol/commit/3475ee6c2bda6b05c6d7a12ce30c8bb840b5b1a6)]:
- effect@4.0.0-beta.91
## 4.0.0-beta.90
### Patch Changes
- Updated dependencies [[`d237fdf`](https://github.com/Effect-TS/effect-smol/commit/d237fdf726481f76eb52a6196e111b24122bc3d5)]:
- effect@4.0.0-beta.90
## 4.0.0-beta.89
### Patch Changes
- Updated dependencies [[`b7d46ab`](https://github.com/Effect-TS/effect-smol/commit/b7d46ab7e1a29d8711817bab583c9febf48a0dad), [`7777e15`](https://github.com/Effect-TS/effect-smol/commit/7777e1540fd3680dd8346723cffec812b9384669), [`5376197`](https://github.com/Effect-TS/effect-smol/commit/5376197ca8e50358a41b1fd3cec27bd1ec680ec6)]:
- effect@4.0.0-beta.89
## 4.0.0-beta.88
### Patch Changes
- Updated dependencies [[`911f1b8`](https://github.com/Effect-TS/effect-smol/commit/911f1b84790ce42b3a70c95b33e6f6fd9e74de8b), [`8beeeea`](https://github.com/Effect-TS/effect-smol/commit/8beeeea52879d8613a39468848f01c3092bd54d4), [`c306fcf`](https://github.com/Effect-TS/effect-smol/commit/c306fcfeb1ef38455156932a1faf49292b1318da)]:
- effect@4.0.0-beta.88
## 4.0.0-beta.87
### Patch Changes
- Updated dependencies [[`5a0c1a4`](https://github.com/Effect-TS/effect-smol/commit/5a0c1a4faee5707b5cc35e646ff1ffdad70f1956), [`1eea2ea`](https://github.com/Effect-TS/effect-smol/commit/1eea2ea3795ba47316b82b1ac8d4612c0ba389ed)]:
- effect@4.0.0-beta.87
## 4.0.0-beta.86
### Patch Changes
- [#2462](https://github.com/Effect-TS/effect-smol/pull/2462) [`0b5795a`](https://github.com/Effect-TS/effect-smol/commit/0b5795a0ab4395e8f15955d8d96f2303084bfc64) Thanks @tim-smart! - Add `Statement.valuesUnprepared` for returning unprepared SQL statement rows as arrays.
- Updated dependencies [[`0b5795a`](https://github.com/Effect-TS/effect-smol/commit/0b5795a0ab4395e8f15955d8d96f2303084bfc64), [`3e3a859`](https://github.com/Effect-TS/effect-smol/commit/3e3a859ec6351a9e0d31674aabbd48fcefabb12e), [`7dbec24`](https://github.com/Effect-TS/effect-smol/commit/7dbec240dbf3bca599a20c486632abce694ef5ab), [`d8c00a1`](https://github.com/Effect-TS/effect-smol/commit/d8c00a171ac7141e8adc08c332d1162d9a9d56fc), [`85b6317`](https://github.com/Effect-TS/effect-smol/commit/85b631701e935866f2762bd595237aa718370cd9), [`6d0fda0`](https://github.com/Effect-TS/effect-smol/commit/6d0fda0d0cbdfffc523c89c57dfdb1608f84fb12), [`108a933`](https://github.com/Effect-TS/effect-smol/commit/108a9335ff8571928197e5847a09c28ac83d6f46), [`7e1f455`](https://github.com/Effect-TS/effect-smol/commit/7e1f455fab5005d769b939c91e519d450f802cf9), [`46b3e79`](https://github.com/Effect-TS/effect-smol/commit/46b3e79944cfdae7901eb148135c85b7eb39834e)]:
- effect@4.0.0-beta.86
## 4.0.0-beta.85
### Patch Changes
- Updated dependencies [[`328d97c`](https://github.com/Effect-TS/effect-smol/commit/328d97cc53c0dcb89077a5623e35b095eaa59a8c), [`8441836`](https://github.com/Effect-TS/effect-smol/commit/8441836e6dde70e8ae2126be9cefe9b45798b134), [`074e436`](https://github.com/Effect-TS/effect-smol/commit/074e4361091289104cb0ab6959dc3b0ea7794a6a), [`c1dfd60`](https://github.com/Effect-TS/effect-smol/commit/c1dfd60663eb13a58916f3712d877499943b628a), [`2ba316b`](https://github.com/Effect-TS/effect-smol/commit/2ba316bd15fcbf1c50626500d44a2c9b3bec19f5), [`7ce7344`](https://github.com/Effect-TS/effect-smol/commit/7ce7344c41056c79e2ee19ee6a9346c0f1d227c1)]:
- effect@4.0.0-beta.85
## 4.0.0-beta.84
### Patch Changes
- Updated dependencies [[`87f52ba`](https://github.com/Effect-TS/effect-smol/commit/87f52ba16c4370ffa3f84bf8e53038e1419c284e), [`b8ee07f`](https://github.com/Effect-TS/effect-smol/commit/b8ee07ffda8903b5ec2e45a786ddcba59f128fda), [`867c0d7`](https://github.com/Effect-TS/effect-smol/commit/867c0d70a09079b040260d45a1e92ff04dbfbf2f), [`b93bc6c`](https://github.com/Effect-TS/effect-smol/commit/b93bc6c9cb27b909a41d094c97c4f9d25bbc6d6b), [`57d387f`](https://github.com/Effect-TS/effect-smol/commit/57d387f92c30ab63e15e3e641f0a903b65886610), [`bacca41`](https://github.com/Effect-TS/effect-smol/commit/bacca4141c2400effae1eabfdb36c89a459cf246), [`0f8ac79`](https://github.com/Effect-TS/effect-smol/commit/0f8ac7959d29ed68c68ce25aabd6bf0cb7e63ecc), [`25b4482`](https://github.com/Effect-TS/effect-smol/commit/25b448270c01317703f25107e1480d4cd0246d9a), [`9cf3a25`](https://github.com/Effect-TS/effect-smol/commit/9cf3a25c66b0c44a52be9829870c44517ea52db2), [`8def767`](https://github.com/Effect-TS/effect-smol/commit/8def7674b1787f91035298cda4d122937e87ef72)]:
- effect@4.0.0-beta.84
## 4.0.0-beta.83
### Patch Changes
- Updated dependencies [[`1f2e8ce`](https://github.com/Effect-TS/effect-smol/commit/1f2e8ceef09e0a791c850ed2ade01f97089596f9)]:
- effect@4.0.0-beta.83
## 4.0.0-beta.82
### Patch Changes
- Updated dependencies [[`193690b`](https://github.com/Effect-TS/effect-smol/commit/193690b642ea802bbed40d663bd677251bbe9dc3)]:
- effect@4.0.0-beta.82
## 4.0.0-beta.81
### Patch Changes
- Updated dependencies [[`93cb4f8`](https://github.com/Effect-TS/effect-smol/commit/93cb4f8fbfb9e07cb9dc86ce6b155fd1f8167914), [`60341d9`](https://github.com/Effect-TS/effect-smol/commit/60341d9ca744d0473ce3fab621ca9bd225af3a39), [`1105ab5`](https://github.com/Effect-TS/effect-smol/commit/1105ab56cb724212f7ea7b431396ce82e8fd0484), [`4500fbf`](https://github.com/Effect-TS/effect-smol/commit/4500fbfe00763d8a72af6e5d6c5988e8bd4ade36)]:
- effect@4.0.0-beta.81
## 4.0.0-beta.80
### Patch Changes
- Updated dependencies [[`d944330`](https://github.com/Effect-TS/effect-smol/commit/d94433090ee03f426d43e13b883abae4494e55e6), [`f48659f`](https://github.com/Effect-TS/effect-smol/commit/f48659fdcc84930ebc1e5b45b540c0f973389182), [`7652aaa`](https://github.com/Effect-TS/effect-smol/commit/7652aaa3bdbc39f241fe58b54b9a43b713e22e12), [`98630b7`](https://github.com/Effect-TS/effect-smol/commit/98630b7c8f679c352ba6796636c85688fa009d8d), [`90ae23c`](https://github.com/Effect-TS/effect-smol/commit/90ae23cf07284da5e1bcd9dffa882e85df7e617b)]:
- effect@4.0.0-beta.80
## 4.0.0-beta.79
### Patch Changes
- Updated dependencies [[`b9704dc`](https://github.com/Effect-TS/effect-smol/commit/b9704dc9de9f1649ad502371014fe869b69a49a3), [`a207113`](https://github.com/Effect-TS/effect-smol/commit/a207113f66837bb54416926718a9a7d66774d079), [`5e9b9e2`](https://github.com/Effect-TS/effect-smol/commit/5e9b9e217b164ebfd4a002dd4380b3b1563200c3), [`7c128ae`](https://github.com/Effect-TS/effect-smol/commit/7c128aef458a1e2d224712e51c483c9badad1d44), [`0ada457`](https://github.com/Effect-TS/effect-smol/commit/0ada457c0513d8d908254ab77ebb7d29d2b523d6), [`d7cc5a2`](https://github.com/Effect-TS/effect-smol/commit/d7cc5a2bede3de10943aa0c6bdb4f26836a91efd), [`aad63be`](https://github.com/Effect-TS/effect-smol/commit/aad63becf65e0a6b076e94f8973be7bbe7fbd46f), [`09809f6`](https://github.com/Effect-TS/effect-smol/commit/09809f60f19ec98232f98b33e33e02ecb7e4fbd6), [`2fddda5`](https://github.com/Effect-TS/effect-smol/commit/2fddda5311929f46b61e503f0ade4fc749e8c77d), [`5f21768`](https://github.com/Effect-TS/effect-smol/commit/5f2176833399757c4500d8875b7f2fba0393de75), [`f27003e`](https://github.com/Effect-TS/effect-smol/commit/f27003e00524ff83f20dd9909f62b2f8795efe03)]:
- effect@4.0.0-beta.79
## 4.0.0-beta.78
### Patch Changes
- Updated dependencies [[`7836b8e`](https://github.com/Effect-TS/effect-smol/commit/7836b8eb8bb0f3e04cdf554ee070caccf74f00c1), [`35d49a3`](https://github.com/Effect-TS/effect-smol/commit/35d49a3a09bdba6b513de87ddcead9e61a1042ba), [`4093258`](https://github.com/Effect-TS/effect-smol/commit/40932580e65bafab5f23c5f14b520cb411d0b2cd)]:
- effect@4.0.0-beta.78
## 4.0.0-beta.77
### Patch Changes
- Updated dependencies [[`6e9a5ca`](https://github.com/Effect-TS/effect-smol/commit/6e9a5ca62a61156fd67b2518ad3ab14ac0d25f23), [`302f398`](https://github.com/Effect-TS/effect-smol/commit/302f3984ce206e35d86ddd99d3b72be144850a51)]:
- effect@4.0.0-beta.77
## 4.0.0-beta.76
### Patch Changes
- Updated dependencies [[`016108a`](https://github.com/Effect-TS/effect-smol/commit/016108a472af7048ddbbfd05f233e67529fafe12), [`95c03d2`](https://github.com/Effect-TS/effect-smol/commit/95c03d2c55930668c215b5a41c23cf7742fead84), [`07299a3`](https://github.com/Effect-TS/effect-smol/commit/07299a33c09fd52faa9810d30835a2622c752386)]:
- effect@4.0.0-beta.76
## 4.0.0-beta.75
### Patch Changes
- Updated dependencies [[`81b187c`](https://github.com/Effect-TS/effect-smol/commit/81b187c17a0d8817b58232826939154010ae49d7), [`ad4b535`](https://github.com/Effect-TS/effect-smol/commit/ad4b535e17f94ce35261829d5a3675f0a7808b4e), [`a29c2e7`](https://github.com/Effect-TS/effect-smol/commit/a29c2e7e3570920156702671d6f3367cd0195f6c), [`1fdd9ae`](https://github.com/Effect-TS/effect-smol/commit/1fdd9aeed92b6bb70987c862e7f6f66ead0339b3), [`1fdd9ae`](https://github.com/Effect-TS/effect-smol/commit/1fdd9aeed92b6bb70987c862e7f6f66ead0339b3), [`ffea4ec`](https://github.com/Effect-TS/effect-smol/commit/ffea4ecf2925f6a4c9fd13079d47584cbf2bed00), [`4255c9b`](https://github.com/Effect-TS/effect-smol/commit/4255c9ba78bb98c7838fbe9dccdd8465e9da5427)]:
- effect@4.0.0-beta.75
## 4.0.0-beta.74
### Patch Changes
- Updated dependencies [[`b1fc6a4`](https://github.com/Effect-TS/effect-smol/commit/b1fc6a4b4d0ca7fa9fd162799ae17c86f2f7ee8e)]:
- effect@4.0.0-beta.74
## 4.0.0-beta.73
### Patch Changes
- Updated dependencies [[`361ca30`](https://github.com/Effect-TS/effect-smol/commit/361ca30eb6e134feece547d6e00f82be4cb23f75), [`b9598c6`](https://github.com/Effect-TS/effect-smol/commit/b9598c6a209e75bfdb87ee3b024ecd1e3923ff6e)]:
- effect@4.0.0-beta.73
## 4.0.0-beta.72
### Patch Changes
- Updated dependencies [[`73e67d1`](https://github.com/Effect-TS/effect-smol/commit/73e67d119a84d697773eaecb4865c6a71eb1a9cb), [`01d71ec`](https://github.com/Effect-TS/effect-smol/commit/01d71ec5a75f3c2747a8d3b1ad9701d1e27b7ce5), [`fcd707e`](https://github.com/Effect-TS/effect-smol/commit/fcd707e091a16e1b35343c901cc4052274e32239)]:
- effect@4.0.0-beta.72
## 4.0.0-beta.71
### Patch Changes
- Updated dependencies [[`d8ac76b`](https://github.com/Effect-TS/effect-smol/commit/d8ac76b5bad458c42cebe8a0c1b3843f955ac293), [`2c3c00a`](https://github.com/Effect-TS/effect-smol/commit/2c3c00af6faba7b7d422af26a7a2bbc35636d230), [`3751e7c`](https://github.com/Effect-TS/effect-smol/commit/3751e7cf353e7a54cd692c37401207d9afba1e63), [`fc5f25b`](https://github.com/Effect-TS/effect-smol/commit/fc5f25b03ada5fc2431987768a74d3d3e75ca485), [`7ccced4`](https://github.com/Effect-TS/effect-smol/commit/7ccced42867c14c013b01160b3d292f14c05bd04), [`a2e1fe5`](https://github.com/Effect-TS/effect-smol/commit/a2e1fe5835c98c8ee4393a091b1d11b75126e349), [`4a4a36b`](https://github.com/Effect-TS/effect-smol/commit/4a4a36b10e6e616cad07584a43908f6a7e07e618), [`d350292`](https://github.com/Effect-TS/effect-smol/commit/d3502922b4740fa9d745797cbc3775cb67839b6d), [`730afb6`](https://github.com/Effect-TS/effect-smol/commit/730afb66696adf9bd5a328cbca29df9c05968771), [`df1b008`](https://github.com/Effect-TS/effect-smol/commit/df1b008f370f414c2a67a7b8139ef747af8e5fba), [`6d469d5`](https://github.com/Effect-TS/effect-smol/commit/6d469d567a7c41d7e5343bdee21d45b07b0e8190)]:
- effect@4.0.0-beta.71
## 4.0.0-beta.70
### Patch Changes
- Updated dependencies [[`af7782d`](https://github.com/Effect-TS/effect-smol/commit/af7782d3008d08b043f3a3f261516001514b2b4e), [`7212d70`](https://github.com/Effect-TS/effect-smol/commit/7212d701a3eee7b3553ff502e2c066126e52e839)]:
- effect@4.0.0-beta.70
## 4.0.0-beta.69
### Patch Changes
- Updated dependencies [[`70ea04a`](https://github.com/Effect-TS/effect-smol/commit/70ea04aa96a2a7859d738d414e1f0e3ed081a27a), [`d0ea8b0`](https://github.com/Effect-TS/effect-smol/commit/d0ea8b03f7d73ae076c1db12666141e480d11178), [`a57674b`](https://github.com/Effect-TS/effect-smol/commit/a57674b64845e9e75a456cf907bfdcb858859118), [`59aa334`](https://github.com/Effect-TS/effect-smol/commit/59aa334fbd0a504dda3c36f6d2ef1be7449b4b8b), [`8f4208e`](https://github.com/Effect-TS/effect-smol/commit/8f4208ee83bc7bdaa6793b5429847b45aab72470)]:
- effect@4.0.0-beta.69
## 4.0.0-beta.68
### Patch Changes
- Updated dependencies [[`af8267f`](https://github.com/Effect-TS/effect-smol/commit/af8267f2f3588c3fb611e9286f6f933f29ce1217), [`0176eaf`](https://github.com/Effect-TS/effect-smol/commit/0176eaf3ecd7c1b99a10268f2af02d7e8ce161e5), [`0176eaf`](https://github.com/Effect-TS/effect-smol/commit/0176eaf3ecd7c1b99a10268f2af02d7e8ce161e5), [`f136bb7`](https://github.com/Effect-TS/effect-smol/commit/f136bb763048cbc6b17edd26496dba3e2415b9fa), [`6f38f07`](https://github.com/Effect-TS/effect-smol/commit/6f38f07d5941a211b251383aaab0f4f55e8a6557), [`aec9c40`](https://github.com/Effect-TS/effect-smol/commit/aec9c401a53db227f18bf5e0c84db7130ad862d6)]:
- effect@4.0.0-beta.68
## 4.0.0-beta.67
### Patch Changes
- Updated dependencies [[`a42ef66`](https://github.com/Effect-TS/effect-smol/commit/a42ef6632abbddfa820995ae310ccc84ae8d9b6f), [`35594f8`](https://github.com/Effect-TS/effect-smol/commit/35594f811cafe471acd490114b103a1f8392c8d8), [`8bddd62`](https://github.com/Effect-TS/effect-smol/commit/8bddd628cb623f9533d345082583ff51cead6836), [`4be4c8d`](https://github.com/Effect-TS/effect-smol/commit/4be4c8d60862aa963869ee2ed9ffa048ffac0527), [`0c9d3ab`](https://github.com/Effect-TS/effect-smol/commit/0c9d3ab43eb721a370ed8306260cbac218c27e87), [`b156acc`](https://github.com/Effect-TS/effect-smol/commit/b156accd2691b4a051f823affdece7c39923ce85), [`d16c034`](https://github.com/Effect-TS/effect-smol/commit/d16c03434ee3e6dcd3bfc82b65d99e881d89025b), [`b559d68`](https://github.com/Effect-TS/effect-smol/commit/b559d68845f848a10153395778f035682d399075), [`a3de5d9`](https://github.com/Effect-TS/effect-smol/commit/a3de5d9215e5cc4a62e2666efbd7c1bf595eb84f), [`7e6c12e`](https://github.com/Effect-TS/effect-smol/commit/7e6c12ec9b3a5945f6c26e272cc8f6390541ad3e), [`098167a`](https://github.com/Effect-TS/effect-smol/commit/098167a220fe07da6f14455818733ab1b269c9dd)]:
- effect@4.0.0-beta.67
## 4.0.0-beta.66
### Patch Changes
- Updated dependencies [[`ca2498e`](https://github.com/Effect-TS/effect-smol/commit/ca2498e702ac2d83fb7187707b7eb069bdb261a2), [`cd7d1fb`](https://github.com/Effect-TS/effect-smol/commit/cd7d1fba7e2e2c5ac3ad64e1be433440a5bda436), [`19a7033`](https://github.com/Effect-TS/effect-smol/commit/19a703367ec817cffc41d152da9b594827408e2b), [`33d26b4`](https://github.com/Effect-TS/effect-smol/commit/33d26b4210b2e974f146a71e7eed962f8ce00900), [`856766b`](https://github.com/Effect-TS/effect-smol/commit/856766b2c506aaed6d2df1d63bf3a5b1b062e1d4), [`079c7df`](https://github.com/Effect-TS/effect-smol/commit/079c7df82559bb9ce10a86dffb85d25e6ce07dc3)]:
- effect@4.0.0-beta.66
## 4.0.0-beta.65
### Patch Changes
- [#2148](https://github.com/Effect-TS/effect-smol/pull/2148) [`6f11454`](https://github.com/Effect-TS/effect-smol/commit/6f11454a9b6c3bd00f6b35fd7af14a2f2d63a0a2) Thanks @tim-smart! - Add `UniqueViolation` as a new SQL error reason. Supported unique constraint violations now classify as `UniqueViolation` instead of the broader `ConstraintError` reason.
This covers PostgreSQL, PGlite, MySQL, MSSQL, and the shared SQLite classification used by the SQLite-family clients. `UniqueViolation.constraint` contains the best available constraint, index, or key identifier and falls back to exactly `"unknown"` when no reliable identifier is available.
- Updated dependencies [[`6f11454`](https://github.com/Effect-TS/effect-smol/commit/6f11454a9b6c3bd00f6b35fd7af14a2f2d63a0a2)]:
- effect@4.0.0-beta.65
## 4.0.0-beta.64
### Patch Changes
- Updated dependencies [[`7d4877a`](https://github.com/Effect-TS/effect-smol/commit/7d4877a1929cdb690280ea254326c04f2ec97ea5)]:
- effect@4.0.0-beta.64
## 4.0.0-beta.63
### Patch Changes
- Updated dependencies [[`7f927ff`](https://github.com/Effect-TS/effect-smol/commit/7f927ffb7a9801dcfc4096c29e369d13d65cd0ac), [`a696b3e`](https://github.com/Effect-TS/effect-smol/commit/a696b3e83a8504cdbe261a18c10a1cc0619ae102)]:
- effect@4.0.0-beta.63
## 4.0.0-beta.62
### Patch Changes
- Updated dependencies [[`4ab4b90`](https://github.com/Effect-TS/effect-smol/commit/4ab4b9007dc27a52ffabc6fcb37c96eeec795bf7)]:
- effect@4.0.0-beta.62
## 4.0.0-beta.61
### Patch Changes
- Updated dependencies [[`50790af`](https://github.com/Effect-TS/effect-smol/commit/50790af9b190c38d10fb0723837d49b66432638f), [`71f7c3d`](https://github.com/Effect-TS/effect-smol/commit/71f7c3df997deda92c84146d569696dab3bd645c), [`aae8797`](https://github.com/Effect-TS/effect-smol/commit/aae8797b9cb383be0c182dd58d03d787c354238b)]:
- effect@4.0.0-beta.61
## 4.0.0-beta.60
### Patch Changes
- Updated dependencies [[`f69d567`](https://github.com/Effect-TS/effect-smol/commit/f69d5675dcff9f4137295752baf066b7153fdc09), [`7909c95`](https://github.com/Effect-TS/effect-smol/commit/7909c954b8f6244a35a4b429f8dd0dff45dad620), [`bbb4dcc`](https://github.com/Effect-TS/effect-smol/commit/bbb4dcc6c406b83a416b4ad3541cc02037c420e4), [`7af2207`](https://github.com/Effect-TS/effect-smol/commit/7af2207901eabf3132c1b7010a69b3899c06fbbe), [`848b40a`](https://github.com/Effect-TS/effect-smol/commit/848b40a4bd4bf54a5098617d50c33c88eee8270a)]:
- effect@4.0.0-beta.60
## 4.0.0-beta.59
### Patch Changes
- Updated dependencies [[`56837ea`](https://github.com/Effect-TS/effect-smol/commit/56837ea2a338395b35550641374e9e589bd8b71d)]:
- effect@4.0.0-beta.59
## 4.0.0-beta.58
### Patch Changes
- Updated dependencies [[`11993d4`](https://github.com/Effect-TS/effect-smol/commit/11993d4934c66f5dc611b8bbf553f01d501ef8f7), [`96c8b22`](https://github.com/Effect-TS/effect-smol/commit/96c8b22c2057ccddbf10ed269d7697f22119b3ec), [`96c8b22`](https://github.com/Effect-TS/effect-smol/commit/96c8b22c2057ccddbf10ed269d7697f22119b3ec)]:
- effect@4.0.0-beta.58
## 4.0.0-beta.57
### Minor Changes
- [#2073](https://github.com/Effect-TS/effect-smol/pull/2073) [`5045e62`](https://github.com/Effect-TS/effect-smol/commit/5045e625b40b9c50f8829868224ced4ac2045bcb) Thanks @blntrsz! - Add `@effect/sql-pglite` package, wrapping `@electric-sql/pglite` with the Effect SQL client (Postgres dialect, Effect-managed transactions via savepoints, listen/notify, dumpDataDir/refreshArrayTypes, and a Migrator).
### Patch Changes
- Updated dependencies [[`a971f5c`](https://github.com/Effect-TS/effect-smol/commit/a971f5cbd92dfe4274420bf0966595eb35531060), [`8e110c5`](https://github.com/Effect-TS/effect-smol/commit/8e110c5f02a429ccc43a91df8678e402138c0851)]:
- effect@4.0.0-beta.57

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024-present The Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,7 @@
# `@effect/sql-pglite`
An Effect SQL implementation using the `@electric-sql/pglite` library.
## Documentation
- **API Reference**: [View the full documentation](https://effect-ts.github.io/effect/docs/sql-pglite).

View File

@@ -0,0 +1,23 @@
{
"$schema": "../../node_modules/@effect/docgen/schema.json",
"srcLink": "https://github.com/Effect-TS/effect/tree/main/packages/sql/pglite/src/",
"exclude": ["src/internal/**/*.ts"],
"examplesCompilerOptions": {
"noEmit": true,
"strict": true,
"skipLibCheck": true,
"moduleResolution": "Bundler",
"module": "ES2022",
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"rewriteRelativeImportExtensions": true,
"allowImportingTsExtensions": true,
"paths": {
"effect": ["../../../effect/src/index.js"],
"effect/*": ["../../../effect/src/*.js"]
},
"plugins": [
{ "name": "@effect/language-service", "includeSuggestionsInTsc": false }
]
}
}

View File

@@ -0,0 +1,73 @@
{
"name": "@effect/sql-pglite",
"version": "4.0.0-beta.99",
"type": "module",
"license": "MIT",
"description": "A PGlite toolkit for Effect",
"homepage": "https://effect.website",
"repository": {
"type": "git",
"url": "https://github.com/Effect-TS/effect.git",
"directory": "packages/sql/pglite"
},
"bugs": {
"url": "https://github.com/Effect-TS/effect/issues"
},
"tags": [
"typescript",
"sql",
"pglite",
"postgres",
"database"
],
"keywords": [
"typescript",
"sql",
"pglite",
"postgres",
"database"
],
"sideEffects": [],
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts",
"./*": "./src/*.ts",
"./internal/*": null,
"./*/index": null
},
"files": [
"src/**/*.ts",
"dist/**/*.js",
"dist/**/*.js.map",
"dist/**/*.d.ts",
"dist/**/*.d.ts.map"
],
"publishConfig": {
"access": "public",
"provenance": true,
"exports": {
"./package.json": "./package.json",
".": "./dist/index.js",
"./*": "./dist/*.js",
"./internal/*": null,
"./*/index": null
}
},
"scripts": {
"codegen": "effect-utils codegen",
"build": "tsc -b tsconfig.json && pnpm babel",
"babel": "babel dist --plugins annotate-pure-calls --out-dir dist --source-maps",
"check": "tsc -b tsconfig.json",
"test": "vitest",
"coverage": "vitest --coverage"
},
"devDependencies": {
"effect": "workspace:^"
},
"peerDependencies": {
"effect": "workspace:^"
},
"dependencies": {
"@electric-sql/pglite": "^0.5.4"
}
}

View File

@@ -0,0 +1,513 @@
/**
* Connects Effect SQL to PGlite, the embedded PostgreSQL-compatible database
* from `@electric-sql/pglite`.
*
* This module can create a managed PGlite instance or wrap an existing one and
* expose it as both `PgliteClient` and the generic Effect SQL client. The client
* runs PostgreSQL-style SQL, adds helpers for JSON values and LISTEN/NOTIFY
* messages, can dump the PGlite data directory, and can refresh PGlite array
* types. It also provides layers and maps common PostgreSQL-style failures into
* Effect SQL errors.
*
* @since 4.0.0
*/
import { PGlite, type PGliteInterface, type PGliteOptions } from "@electric-sql/pglite"
import * as Config from "effect/Config"
import * as Context from "effect/Context"
import * as Effect from "effect/Effect"
import * as Fiber from "effect/Fiber"
import * as Layer from "effect/Layer"
import * as Queue from "effect/Queue"
import * as Scope from "effect/Scope"
import * as Semaphore from "effect/Semaphore"
import * as Stream from "effect/Stream"
import * as Reactivity from "effect/unstable/reactivity/Reactivity"
import * as Client from "effect/unstable/sql/SqlClient"
import type { Connection } from "effect/unstable/sql/SqlConnection"
import {
AuthenticationError,
AuthorizationError,
ConnectionError,
ConstraintError,
DeadlockError,
LockTimeoutError,
SerializationError,
SqlError,
SqlSyntaxError,
StatementTimeoutError,
UniqueViolation,
UnknownError
} from "effect/unstable/sql/SqlError"
import type { Custom, Fragment } from "effect/unstable/sql/Statement"
import * as Statement from "effect/unstable/sql/Statement"
/**
* Runtime type identifier used to mark `PgliteClient` values.
*
* @category type IDs
* @since 4.0.0
*/
export const TypeId: TypeId = "~@effect/sql-pglite/PgliteClient"
/**
* Type-level identifier used to mark `PgliteClient` values.
*
* @category type IDs
* @since 4.0.0
*/
export type TypeId = "~@effect/sql-pglite/PgliteClient"
/**
* PGlite-backed PostgreSQL client service, extending `SqlClient` with access to the PGlite instance, JSON fragments, LISTEN/NOTIFY, data directory dumps, and array type refresh.
*
* @category models
* @since 4.0.0
*/
export interface PgliteClient extends Client.SqlClient {
readonly [TypeId]: TypeId
readonly config: PgliteClientConfig
readonly pglite: PGliteInterface
readonly json: (_: unknown) => Fragment
readonly listen: (channel: string) => Stream.Stream<string, SqlError>
readonly notify: (channel: string, payload: string) => Effect.Effect<void, SqlError>
readonly dumpDataDir: (compression?: "none" | "gzip" | "auto") => Effect.Effect<File | Blob, SqlError>
readonly refreshArrayTypes: Effect.Effect<void, SqlError>
}
/**
* Service tag for the PGlite client service.
*
* **When to use**
*
* Use to access or provide a PGlite client through the Effect context.
*
* @category services
* @since 4.0.0
*/
export const PgliteClient = Context.Service<PgliteClient>("@effect/sql-pglite/PgliteClient")
/**
* Configuration for a PGlite client, either by supplying PGlite creation options or an existing live PGlite client.
*
* @category models
* @since 4.0.0
*/
export type PgliteClientConfig = PgliteClientConfig.Create | PgliteClientConfig.Live
/**
* Namespace containing the configuration variants for `PgliteClient`.
*
* @since 4.0.0
*/
export declare namespace PgliteClientConfig {
/**
* Shared PGlite client options for span attributes, query/result name transformations, and JSON value transformation.
*
* @category models
* @since 4.0.0
*/
export interface Base {
readonly spanAttributes?: Record<string, unknown> | undefined
readonly transformResultNames?: ((str: string) => string) | undefined
readonly transformQueryNames?: ((str: string) => string) | undefined
readonly transformJson?: boolean | undefined
}
/**
* Configuration used to create a managed PGlite instance from PGlite constructor options.
*
* @category models
* @since 4.0.0
*/
export interface Create extends Base, PGliteOptions {}
/**
* Configuration that uses an existing PGlite client. The supplied `liveClient` is caller-owned and is not closed by the Effect client.
*
* @category models
* @since 4.0.0
*/
export interface Live extends Base {
readonly liveClient: PGliteInterface
}
/**
* Config-friendly subset of PGlite creation options, including data directory, username, database, relaxed durability, and shared transform options.
*
* @category models
* @since 4.0.0
*/
export interface ConfigBase extends Base {
readonly dataDir?: string | undefined
readonly username?: string | undefined
readonly database?: string | undefined
readonly relaxedDurability?: boolean | undefined
}
}
/**
* Creates a scoped PGlite SQL client. When no live client is supplied it creates and closes a PGlite instance; when `liveClient` is supplied, the caller retains ownership.
*
* @category constructors
* @since 4.0.0
*/
export const make = (
options: PgliteClientConfig = {}
): Effect.Effect<PgliteClient, SqlError, Scope.Scope | Reactivity.Reactivity> =>
Effect.gen(function*() {
const pglite = "liveClient" in options
? options.liveClient
: yield* Effect.acquireRelease(
Effect.tryPromise({
try: async () => {
const pg = new PGlite(options)
await pg.waitReady
return pg
},
catch: (cause) => new SqlError({ reason: classifyError(cause, "PgliteClient: Failed to connect", "connect") })
}),
(pg) => Effect.promise(() => pg.close()).pipe(Effect.timeoutOption(1000)),
{ interruptible: true }
)
return yield* fromClient({ ...options, liveClient: pglite })
})
/**
* Builds a `PgliteClient` around an existing PGlite instance, adding SQL client operations, LISTEN/NOTIFY, dump helpers, and serialized access.
*
* @category constructors
* @since 4.0.0
*/
export const fromClient = (
options:
& PgliteClientConfig.Base
& {
readonly liveClient: PGliteInterface
}
): Effect.Effect<PgliteClient, SqlError, Scope.Scope | Reactivity.Reactivity> =>
Effect.gen(function*() {
const pglite = options.liveClient
const compiler = makeCompiler(options.transformQueryNames, options.transformJson)
const transformRows = options.transformResultNames
? Statement.defaultTransforms(options.transformResultNames, options.transformJson).array
: undefined
const spanAttributes: Array<[string, unknown]> = [
...(options.spanAttributes ? Object.entries(options.spanAttributes) : []),
[ATTR_DB_SYSTEM_NAME, "postgresql"]
]
const connection = new PgliteConnection(pglite)
const semaphore = Semaphore.makeUnsafe(1)
const acquirer = semaphore.withPermits(1)(Effect.succeed(connection))
const transactionAcquirer = Effect.uninterruptibleMask((restore) => {
const fiber = Fiber.getCurrent()!
const scope = Context.getUnsafe(fiber.context, Scope.Scope)
return Effect.as(
Effect.tap(
restore(semaphore.take(1)),
() => Scope.addFinalizer(scope, semaphore.release(1))
),
connection
)
})
const config = options as PgliteClientConfig
const client = yield* Client.make({
acquirer,
compiler,
transactionAcquirer,
spanAttributes,
transformRows
})
return Object.assign(
client,
{
[TypeId]: TypeId as TypeId,
config,
pglite,
json: (_: unknown) => Statement.fragment([PgJson(_)]),
listen: (channel: string) =>
Stream.callback<string, SqlError>((queue) =>
Effect.acquireRelease(
Effect.tryPromise({
try: () =>
pglite.listen(channel, (payload) => {
Queue.offerUnsafe(queue, payload)
}),
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to listen", "listen") })
}),
(unlisten) => Effect.promise(() => unlisten()),
{ interruptible: true }
)
),
notify: (channel: string, payload: string) =>
Effect.tryPromise({
try: () => pglite.exec(`NOTIFY ${escape(channel)}, ${escapeLiteral(payload)}`),
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to notify", "notify") })
}).pipe(
semaphore.withPermit,
Effect.asVoid
),
dumpDataDir: (compression?: "none" | "gzip" | "auto") =>
semaphore.withPermit(
Effect.tryPromise({
try: () => pglite.dumpDataDir(compression),
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to dump data dir", "dumpDataDir") })
})
),
refreshArrayTypes: semaphore.withPermit(
Effect.tryPromise({
try: () => pglite.refreshArrayTypes(),
catch: (cause) =>
new SqlError({ reason: classifyError(cause, "Failed to refresh array types", "refreshArrayTypes") })
})
)
}
)
})
class PgliteConnection implements Connection {
readonly pglite: PGliteInterface
constructor(pglite: PGliteInterface) {
this.pglite = pglite
}
private run(method: string, sql: string, params: ReadonlyArray<unknown>) {
return Effect.map(
Effect.tryPromise({
try: () => this.pglite.query<any>(sql, params as Array<any>),
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", method) })
}),
(result) => result.rows
)
}
execute(
sql: string,
params: ReadonlyArray<unknown>,
transformRows: (<A extends object>(row: ReadonlyArray<A>) => ReadonlyArray<A>) | undefined
) {
return transformRows
? Effect.map(this.run("execute", sql, params), transformRows)
: this.run("execute", sql, params)
}
executeRaw(sql: string, params: ReadonlyArray<unknown>) {
return Effect.tryPromise({
try: () => this.pglite.query<any>(sql, params as Array<any>),
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "executeRaw") })
})
}
executeValues(sql: string, params: ReadonlyArray<unknown>) {
return Effect.map(
Effect.tryPromise({
try: () => this.pglite.query<any>(sql, params as Array<any>, { rowMode: "array" }),
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "executeValues") })
}),
(result) => result.rows as ReadonlyArray<ReadonlyArray<any>>
)
}
executeValuesUnprepared(sql: string, params: ReadonlyArray<unknown>) {
return Effect.map(
Effect.tryPromise({
try: () => this.pglite.query<any>(sql, params as Array<any>, { rowMode: "array" }),
catch: (cause) =>
new SqlError({ reason: classifyError(cause, "Failed to execute statement", "executeValuesUnprepared") })
}),
(result) => result.rows as ReadonlyArray<ReadonlyArray<any>>
)
}
executeUnprepared(
sql: string,
params: ReadonlyArray<unknown>,
transformRows: (<A extends object>(row: ReadonlyArray<A>) => ReadonlyArray<A>) | undefined
) {
return transformRows
? Effect.map(this.run("executeUnprepared", sql, params), transformRows)
: this.run("executeUnprepared", sql, params)
}
executeStream(
sql: string,
params: ReadonlyArray<unknown>,
transformRows: (<A extends object>(row: ReadonlyArray<A>) => ReadonlyArray<A>) | undefined
) {
const eff = transformRows
? Effect.map(this.run("executeStream", sql, params), transformRows)
: this.run("executeStream", sql, params)
return Stream.fromArrayEffect(eff)
}
}
/**
* Creates a layer from an effect that acquires a `PgliteClient`, providing both `PgliteClient` and `SqlClient`.
*
* @category layers
* @since 4.0.0
*/
export const layerFrom = <E, R>(
acquire: Effect.Effect<PgliteClient, E, R>
): Layer.Layer<PgliteClient | Client.SqlClient, E, Exclude<R, Scope.Scope | Reactivity.Reactivity>> =>
Layer.effectContext(
Effect.map(acquire, (client) =>
Context.make(PgliteClient, client).pipe(
Context.add(Client.SqlClient, client)
))
).pipe(Layer.provide(Reactivity.layer)) as any
/**
* Creates a layer from a `Config`-wrapped PGlite client configuration, providing both `PgliteClient` and `SqlClient`.
*
* @category layers
* @since 4.0.0
*/
export const layerConfig: (
config: Config.Wrap<PgliteClientConfig.ConfigBase>
) => Layer.Layer<PgliteClient | Client.SqlClient, Config.ConfigError | SqlError> = (
config: Config.Wrap<PgliteClientConfig.ConfigBase>
): Layer.Layer<PgliteClient | Client.SqlClient, Config.ConfigError | SqlError> =>
layerFrom(Effect.flatMap(
Config.unwrap(config),
(resolved) => make(resolved as PgliteClientConfig)
))
/**
* Creates a layer from a concrete PGlite client configuration, providing both `PgliteClient` and `SqlClient`.
*
* @category layers
* @since 4.0.0
*/
export const layer = (
config?: PgliteClientConfig | undefined
): Layer.Layer<PgliteClient | Client.SqlClient, SqlError> => layerFrom(make(config))
/**
* Creates the PGlite statement compiler, using PostgreSQL `$1` placeholders, double-quoted identifiers, returning clauses, and optional JSON value transformation.
*
* @category constructors
* @since 4.0.0
*/
export const makeCompiler = (
transform?: (_: string) => string,
transformJson = true
): Statement.Compiler => {
const transformValue = transformJson && transform
? Statement.defaultTransforms(transform).value
: undefined
return Statement.makeCompiler<PgCustom>({
dialect: "pg",
placeholder(_) {
return `$${_}`
},
onIdentifier: transform ?
function(value, withoutTransform) {
return withoutTransform ? escape(value) : escape(transform(value))
} :
escape,
onRecordUpdate(placeholders, valueAlias, valueColumns, values, returning) {
return [
`(values ${placeholders}) AS ${valueAlias}${valueColumns}${returning ? ` RETURNING ${returning[0]}` : ""}`,
returning ?
values.flat().concat(returning[1]) :
values.flat()
]
},
onCustom(type, placeholder, withoutTransform) {
switch (type.kind) {
case "PgJson": {
return [
placeholder(undefined),
[
withoutTransform || transformValue === undefined
? type.paramA
: transformValue(type.paramA)
]
]
}
}
}
})
}
const escape = Statement.defaultEscape("\"")
const escapeLiteral = (value: string) => `'${value.replace(/'/g, "''")}'`
/**
* PGlite-specific custom statement fragments supported by the compiler, currently JSON parameter fragments.
*
* @category custom types
* @since 4.0.0
*/
export type PgCustom = PgJson
/**
* @category custom types
* @since 4.0.0
*/
interface PgJson extends Custom<"PgJson", unknown> {}
const PgJson = Statement.custom<PgJson>("PgJson")
const ATTR_DB_SYSTEM_NAME = "db.system.name"
const pgCodeFromCause = (cause: unknown): string | undefined => {
if (typeof cause !== "object" || cause === null || !("code" in cause)) {
return undefined
}
const code = cause.code
return typeof code === "string" ? code : undefined
}
const pgConstraintFromCause = (cause: unknown): string => {
if (typeof cause !== "object" || cause === null || !("constraint" in cause)) {
return "unknown"
}
const constraint = cause.constraint
if (typeof constraint !== "string") {
return "unknown"
}
const normalized = constraint.trim()
return normalized.length === 0 ? "unknown" : normalized
}
const classifyError = (
cause: unknown,
message: string,
operation: string
) => {
const props = { cause, message, operation }
const code = pgCodeFromCause(cause)
if (code !== undefined) {
if (code.startsWith("08")) {
return new ConnectionError(props)
}
if (code.startsWith("28")) {
return new AuthenticationError(props)
}
if (code === "42501") {
return new AuthorizationError(props)
}
if (code.startsWith("42")) {
return new SqlSyntaxError(props)
}
if (code === "23505") {
return new UniqueViolation({ ...props, constraint: pgConstraintFromCause(cause) })
}
if (code.startsWith("23")) {
return new ConstraintError(props)
}
if (code === "40P01") {
return new DeadlockError(props)
}
if (code === "40001") {
return new SerializationError(props)
}
if (code === "55P03") {
return new LockTimeoutError(props)
}
if (code === "57014") {
return new StatementTimeoutError(props)
}
}
return new UnknownError(props)
}

View File

@@ -0,0 +1,44 @@
/**
* Runs database migrations for PGlite projects that use Effect SQL.
*
* This module re-exports the shared migration loaders and errors, then provides
* `run` and `layer` helpers that apply pending migration files with the current
* `SqlClient`. It does not require a separate PGlite service; the active SQL
* client supplies the database connection.
*
* @since 4.0.0
*/
import type * as Effect from "effect/Effect"
import * as Layer from "effect/Layer"
import * as Migrator from "effect/unstable/sql/Migrator"
import type * as Client from "effect/unstable/sql/SqlClient"
import type { SqlError } from "effect/unstable/sql/SqlError"
/**
* @since 4.0.0
*/
export * from "effect/unstable/sql/Migrator"
/**
* Runs SQL migrations using the configured `SqlClient`, returning the migrations that were applied.
*
* @category constructors
* @since 4.0.0
*/
export const run: <R2 = never>(
options: Migrator.MigratorOptions<R2>
) => Effect.Effect<
ReadonlyArray<readonly [id: number, name: string]>,
Migrator.MigrationError | SqlError,
Client.SqlClient | R2
> = Migrator.make({})
/**
* Creates a layer that runs the configured SQL migrations during layer construction.
*
* @category constructors
* @since 4.0.0
*/
export const layer = <R>(
options: Migrator.MigratorOptions<R>
): Layer.Layer<never, Migrator.MigrationError | SqlError, Client.SqlClient | R> => Layer.effectDiscard(run(options))

View File

@@ -0,0 +1,15 @@
/**
* @since 4.0.0
*/
// @barrel: Auto-generated exports. Do not edit manually.
/**
* @since 4.0.0
*/
export * as PgliteClient from "./PgliteClient.ts"
/**
* @since 4.0.0
*/
export * as PgliteMigrator from "./PgliteMigrator.ts"

View File

@@ -0,0 +1,149 @@
import { PgliteClient } from "@effect/sql-pglite"
import { assert, describe, layer } from "@effect/vitest"
import * as Pglite from "@electric-sql/pglite"
import { Deferred, Effect, Layer } from "effect"
import { SqlClient } from "effect/unstable/sql/SqlClient"
const ClientLayer = PgliteClient.layer()
const Migrations = Layer.effectDiscard(
Effect.gen(function*() {
const sql = yield* SqlClient
yield* sql`DROP TABLE test`.pipe(Effect.ignore)
yield* sql`CREATE TABLE test (id SERIAL PRIMARY KEY, name TEXT)`
})
)
describe("PgliteClient", () => {
layer(ClientLayer, { timeout: "30 seconds" })((it) => {
it.effect("basic insert/select", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
yield* sql`INSERT INTO test (name) VALUES ('hello')`
const rows = yield* sql<{ id: number; name: string }>`SELECT * FROM test`
assert.deepStrictEqual(rows, [{ id: 1, name: "hello" }])
const values = yield* sql`SELECT * FROM test`.values
assert.deepStrictEqual(values, [[1, "hello"]])
}).pipe(Effect.provide(Migrations)))
it.effect("insert helper", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const [query, params] = sql`INSERT INTO people ${sql.insert({ name: "Tim", age: 10 })}`.compile()
assert.strictEqual(query, `INSERT INTO people ("name","age") VALUES ($1,$2)`)
assert.deepStrictEqual(params, ["Tim", 10])
}))
it.effect("update helper", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const [query, params] = sql`UPDATE people SET ${sql.update({ name: "Tim" })}`.compile()
assert.strictEqual(query, `UPDATE people SET "name" = $1`)
assert.deepStrictEqual(params, ["Tim"])
}))
it.effect("updateValues helper", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const [query, params] = sql`UPDATE people SET name = data.name FROM ${
sql.updateValues([{ name: "Tim" }, { name: "John" }], "data")
}`.compile()
assert.strictEqual(
query,
`UPDATE people SET name = data.name FROM (values ($1),($2)) AS data("name")`
)
assert.deepStrictEqual(params, ["Tim", "John"])
}))
it.effect("in helper", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const [query, params] = sql`SELECT * FROM ${sql("people")} WHERE id IN ${sql.in([1, 2, "x"])}`.compile()
assert.strictEqual(query, `SELECT * FROM "people" WHERE id IN ($1,$2,$3)`)
assert.deepStrictEqual(params, [1, 2, "x"])
}))
it.effect("and helper", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const now = new Date()
const [query, params] = sql`SELECT * FROM ${sql("people")} WHERE ${
sql.and([sql.in("name", ["Tim", "John"]), sql`created_at < ${now}`])
}`.compile()
assert.strictEqual(query, `SELECT * FROM "people" WHERE ("name" IN ($1,$2) AND created_at < $3)`)
assert.deepStrictEqual(params, ["Tim", "John", now])
}))
it.effect("identifier transform", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const compiler = PgliteClient.makeCompiler((s) => s.replace(/[A-Z]/g, (c) => `_${c.toLowerCase()}`))
const [query] = compiler.compile(sql`SELECT * FROM ${sql("peopleTest")}`, false)
assert.strictEqual(query, `SELECT * FROM "people_test"`)
}))
it.effect("json fragment", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const rows = yield* sql<{ json: unknown }>`SELECT ${sql.json({ a: 1 })}::jsonb AS json`
assert.deepStrictEqual(rows[0].json, { a: 1 })
}))
it.effect("listen + notify", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const deferred = yield* Deferred.make<string>()
const unsub = yield* Effect.tryPromise({
try: () => sql.pglite.listen("ch1", (payload) => Effect.runFork(Deferred.succeed(deferred, payload))),
catch: (cause) => cause
})
yield* sql.notify("ch1", "hello")
assert.strictEqual(yield* Deferred.await(deferred), "hello")
yield* Effect.promise(() => unsub())
}), { timeout: 15_000 })
it.effect("provider extras", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const dump = yield* sql.dumpDataDir("none")
assert.isAbove((dump as Blob).size, 0)
}))
})
describe("fromClient", () => {
layer(
PgliteClient.layerFrom(Effect.gen(function*() {
const pg = new Pglite.PGlite()
return yield* PgliteClient.fromClient({ liveClient: pg })
})),
{ timeout: "30 seconds" }
)((it) => {
it.effect("works", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const rows = yield* sql<{ value: number }>`SELECT 1 AS value`
assert.deepStrictEqual(rows, [{ value: 1 }])
}))
})
layer(
Layer.effectDiscard(Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
yield* sql`CREATE TYPE mood AS ENUM ('sad', 'happy')`
yield* sql`CREATE TABLE test_moods (id SERIAL PRIMARY KEY, name TEXT, moods mood[])`
yield* sql.refreshArrayTypes
})).pipe(
Layer.provideMerge(ClientLayer)
),
{ timeout: "30 seconds" }
)((it) => {
it.effect("refreshArrayTypes", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
yield* sql`INSERT INTO test_moods (name, moods) VALUES (${"test2"}, ${["sad", "happy"]})`
const rows = yield* sql<{ moods: ReadonlyArray<string> }>`SELECT moods FROM test_moods`
assert.deepStrictEqual(rows, [{ moods: ["sad", "happy"] }])
}))
})
})
})

View File

@@ -0,0 +1,45 @@
import { PgliteClient, PgliteMigrator } from "@effect/sql-pglite"
import { assert, describe, layer } from "@effect/vitest"
import { Effect, Layer } from "effect"
import { SqlClient } from "effect/unstable/sql/SqlClient"
const ClientLayer = PgliteClient.layer({})
const loader = Effect.succeed([
[
1,
"init",
Effect.succeed(Effect.gen(function*() {
const sql = yield* SqlClient
yield* sql`CREATE TABLE migrator_test (id SERIAL PRIMARY KEY, value TEXT)`
}))
] as const,
[
2,
"insert",
Effect.succeed(Effect.gen(function*() {
const sql = yield* SqlClient
yield* sql`INSERT INTO migrator_test (value) VALUES ('hello')`
}))
] as const
])
const MigratorLayer = PgliteMigrator.layer({ loader }).pipe(Layer.provide(ClientLayer))
describe("PgliteMigrator", () => {
layer(Layer.merge(ClientLayer, MigratorLayer), { timeout: "30 seconds" })((it) => {
it.effect("runs migrations and records them", () =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
const rows = yield* sql<{ value: string }>`SELECT value FROM migrator_test`
assert.deepStrictEqual(rows, [{ value: "hello" }])
const migrations = yield* sql<
{ migration_id: number; name: string }
>`SELECT migration_id, name FROM effect_sql_migrations ORDER BY migration_id`
assert.deepStrictEqual(
migrations.map((m) => [m.migration_id, m.name]),
[[1, "init"], [2, "insert"]]
)
}))
})
})

View File

@@ -0,0 +1,56 @@
import { PgliteClient } from "@effect/sql-pglite"
import { assert, describe, it } from "@effect/vitest"
import { Effect } from "effect"
import * as Reactivity from "effect/unstable/reactivity/Reactivity"
import type * as SqlError from "effect/unstable/sql/SqlError"
const queryFailureReason = (cause: unknown) =>
Effect.gen(function*() {
const client = yield* PgliteClient.fromClient({
liveClient: makeFailingClient(cause) as any
})
const error = yield* Effect.flip(client`SELECT 1`)
return error.reason
}).pipe(
Effect.scoped,
Effect.provide(Reactivity.layer)
)
const queryFailureReasonTag = (cause: unknown) => Effect.map(queryFailureReason(cause), (reason) => reason._tag)
const assertUniqueViolation = (reason: SqlError.SqlErrorReason, constraint: string) => {
assert.strictEqual(reason._tag, "UniqueViolation")
if (reason._tag === "UniqueViolation") {
assert.strictEqual(reason.constraint, constraint)
}
}
const makeFailingClient = (cause: unknown) => ({
query: () => Promise.reject(cause)
})
describe("PgliteClient SqlError classification", () => {
it.effect("classifies 23505 as UniqueViolation and trims the constraint name", () =>
Effect.gen(function*() {
const reason = yield* queryFailureReason({ code: "23505", constraint: " users_email_key " })
assertUniqueViolation(reason, "users_email_key")
}))
it.effect("uses unknown for missing, non-string, or blank unique violation constraints", () =>
Effect.gen(function*() {
const missing = yield* queryFailureReason({ code: "23505" })
assertUniqueViolation(missing, "unknown")
const nonString = yield* queryFailureReason({ code: "23505", constraint: 123 })
assertUniqueViolation(nonString, "unknown")
const blank = yield* queryFailureReason({ code: "23505", constraint: " " })
assertUniqueViolation(blank, "unknown")
}))
it.effect("keeps non-unique integrity constraints classified as ConstraintError", () =>
Effect.gen(function*() {
const tag = yield* queryFailureReasonTag({ code: "23503", constraint: "orders_user_id_fkey" })
assert.strictEqual(tag, "ConstraintError")
}))
})

View File

@@ -0,0 +1,62 @@
import { PgliteClient } from "@effect/sql-pglite"
import { assert, describe, layer } from "@effect/vitest"
import { Effect } from "effect"
const ClientLayer = PgliteClient.layer({})
const setup = (table: string) =>
Effect.gen(function*() {
const sql = yield* PgliteClient.PgliteClient
yield* sql.unsafe(`CREATE TABLE IF NOT EXISTS ${table} (id SERIAL PRIMARY KEY, name TEXT)`)
yield* sql.unsafe(`TRUNCATE TABLE ${table} RESTART IDENTITY`)
return sql
})
describe("PgliteClient transactions", () => {
layer(ClientLayer, { timeout: "30 seconds" })((it) => {
it.effect("withTransaction commit", () =>
Effect.gen(function*() {
const sql = yield* setup("tx_commit")
yield* sql.withTransaction(sql.unsafe(`INSERT INTO tx_commit (name) VALUES ('hello')`))
const rows = yield* sql.unsafe<{ name: string }>(`SELECT name FROM tx_commit`)
assert.deepStrictEqual(rows, [{ name: "hello" }])
}))
it.effect("withTransaction rollback", () =>
Effect.gen(function*() {
const sql = yield* setup("tx_rollback")
yield* sql.unsafe(`INSERT INTO tx_rollback (name) VALUES ('hello')`).pipe(
Effect.andThen(Effect.fail("boom")),
sql.withTransaction,
Effect.ignore
)
const rows = yield* sql.unsafe(`SELECT * FROM tx_rollback`)
assert.deepStrictEqual(rows, [])
}))
it.effect("nested transaction commits both", () =>
Effect.gen(function*() {
const sql = yield* setup("tx_nested_commit")
const stmt = sql.unsafe(`INSERT INTO tx_nested_commit (name) VALUES ('hello')`)
yield* stmt.pipe(Effect.andThen(() => stmt.pipe(sql.withTransaction)), sql.withTransaction)
const rows = yield* sql.unsafe<{ total: number }>(
`SELECT count(*)::int AS total FROM tx_nested_commit`
)
assert.strictEqual(rows.at(0)?.total, 2)
}))
it.effect("nested transaction rollback via savepoint", () =>
Effect.gen(function*() {
const sql = yield* setup("tx_nested_rollback")
const stmt = sql.unsafe(`INSERT INTO tx_nested_rollback (name) VALUES ('hello')`)
yield* stmt.pipe(
Effect.andThen(() => stmt.pipe(Effect.andThen(Effect.fail("boom")), sql.withTransaction, Effect.ignore)),
sql.withTransaction
)
const rows = yield* sql.unsafe<{ total: number }>(
`SELECT count(*)::int AS total FROM tx_nested_rollback`
)
assert.strictEqual(rows.at(0)?.total, 1)
}))
})
})

View File

@@ -0,0 +1,8 @@
{
"$schema": "http://json.schemastore.org/tsconfig",
"extends": "../../../tsconfig.base.json",
"include": ["src"],
"references": [
{ "path": "../../effect" }
]
}

View File

@@ -0,0 +1,6 @@
import { mergeConfig, type ViteUserConfig } from "vitest/config"
import shared from "../../../vitest.shared.ts"
const config: ViteUserConfig = {}
export default mergeConfig(shared, config)