gemi 0.116.0 → 0.117.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/dist/ai/index.js +2 -2
- package/dist/ai/index.js.map +1 -1
- package/dist/app/index.js +2 -2
- package/dist/app/index.js.map +1 -1
- package/dist/auth/AuthServiceProvider.d.ts.map +1 -1
- package/dist/auth/config.d.ts +27 -0
- package/dist/auth/config.d.ts.map +1 -1
- package/dist/auth/connections/ConnectionManager.d.ts +133 -0
- package/dist/auth/connections/ConnectionManager.d.ts.map +1 -0
- package/dist/auth/connections/ConnectionStore.d.ts +146 -0
- package/dist/auth/connections/ConnectionStore.d.ts.map +1 -0
- package/dist/auth/connections/ConnectionsController.d.ts +23 -0
- package/dist/auth/connections/ConnectionsController.d.ts.map +1 -0
- package/dist/auth/connections/OAuthConnectionProvider.d.ts +105 -0
- package/dist/auth/connections/OAuthConnectionProvider.d.ts.map +1 -0
- package/dist/auth/connections/errors.d.ts +32 -0
- package/dist/auth/connections/errors.d.ts.map +1 -0
- package/dist/auth/oauth/oauthState.d.ts +15 -2
- package/dist/auth/oauth/oauthState.d.ts.map +1 -1
- package/dist/auth/routes.d.ts +13 -0
- package/dist/auth/routes.d.ts.map +1 -1
- package/dist/bin/orm/emit.d.ts.map +1 -1
- package/dist/bin/orm-generator.js +51 -4
- package/dist/bin/orm-generator.js.map +4 -4
- package/dist/bun/plugin.js +2 -2
- package/dist/bun/plugin.js.map +1 -1
- package/dist/bun/preload.js +2 -2
- package/dist/bun/preload.js.map +1 -1
- package/dist/chunk-00n3gwr8.js +71 -0
- package/dist/chunk-00n3gwr8.js.map +13 -0
- package/dist/{chunk-t4yh4nf9.js → chunk-076jezzg.js} +3 -3
- package/dist/{chunk-t4yh4nf9.js.map → chunk-076jezzg.js.map} +1 -1
- package/dist/{chunk-qjhw8nje.js → chunk-077rea02.js} +1 -1
- package/dist/{chunk-6cx8ncd4.js → chunk-1ckha5dt.js} +3 -3
- package/dist/{chunk-6cx8ncd4.js.map → chunk-1ckha5dt.js.map} +1 -1
- package/dist/{chunk-mschc94q.js → chunk-1zzd39qg.js} +2 -2
- package/dist/{chunk-mschc94q.js.map → chunk-1zzd39qg.js.map} +1 -1
- package/dist/{chunk-5stgtwqw.js → chunk-2bja99cq.js} +2 -2
- package/dist/{chunk-5stgtwqw.js.map → chunk-2bja99cq.js.map} +1 -1
- package/dist/chunk-2czfefn2.js +10 -0
- package/dist/{chunk-yf1njzd5.js.map → chunk-2czfefn2.js.map} +5 -4
- package/dist/{chunk-aazmrxj9.js → chunk-37pk2cjg.js} +2 -2
- package/dist/{chunk-aazmrxj9.js.map → chunk-37pk2cjg.js.map} +1 -1
- package/dist/{chunk-qsrcdzan.js → chunk-3w4hk6q2.js} +3 -3
- package/dist/{chunk-qsrcdzan.js.map → chunk-3w4hk6q2.js.map} +1 -1
- package/dist/chunk-51w202vr.js +5 -0
- package/dist/{chunk-whtzggn6.js.map → chunk-51w202vr.js.map} +3 -4
- package/dist/{chunk-4088szy9.js → chunk-5m8vvtvn.js} +3 -3
- package/dist/{chunk-4088szy9.js.map → chunk-5m8vvtvn.js.map} +1 -1
- package/dist/{chunk-6d8rvr1v.js → chunk-5p4z1fgc.js} +2 -2
- package/dist/{chunk-6d8rvr1v.js.map → chunk-5p4z1fgc.js.map} +1 -1
- package/dist/{chunk-kejwjerj.js → chunk-5w6kyxsj.js} +2 -2
- package/dist/{chunk-kejwjerj.js.map → chunk-5w6kyxsj.js.map} +1 -1
- package/dist/{chunk-pyk3gzvc.js → chunk-62jw0vsf.js} +2 -2
- package/dist/{chunk-pyk3gzvc.js.map → chunk-62jw0vsf.js.map} +1 -1
- package/dist/chunk-63ewmmhc.js +5 -0
- package/dist/{chunk-1q9kd20m.js.map → chunk-63ewmmhc.js.map} +1 -1
- package/dist/{chunk-p1aqq0ga.js → chunk-6ggmk2eg.js} +3 -3
- package/dist/{chunk-p1aqq0ga.js.map → chunk-6ggmk2eg.js.map} +1 -1
- package/dist/{chunk-2tzm58j3.js → chunk-6y4nk9f1.js} +2 -2
- package/dist/{chunk-2tzm58j3.js.map → chunk-6y4nk9f1.js.map} +1 -1
- package/dist/{chunk-1hr4xht1.js → chunk-8gtc3s1y.js} +2 -2
- package/dist/{chunk-1hr4xht1.js.map → chunk-8gtc3s1y.js.map} +1 -1
- package/dist/{chunk-frerzsxq.js → chunk-a22h5cby.js} +2 -2
- package/dist/{chunk-frerzsxq.js.map → chunk-a22h5cby.js.map} +1 -1
- package/dist/{chunk-zyt2w03d.js → chunk-a32wfzdq.js} +2 -2
- package/dist/{chunk-zyt2w03d.js.map → chunk-a32wfzdq.js.map} +1 -1
- package/dist/{chunk-t04f3akb.js → chunk-a77586gv.js} +2 -2
- package/dist/{chunk-t04f3akb.js.map → chunk-a77586gv.js.map} +1 -1
- package/dist/chunk-a7r39713.js +5 -0
- package/dist/chunk-a7r39713.js.map +10 -0
- package/dist/{chunk-vxm6yevm.js → chunk-arwmvgrz.js} +2 -2
- package/dist/{chunk-vxm6yevm.js.map → chunk-arwmvgrz.js.map} +1 -1
- package/dist/{chunk-41da9628.js → chunk-bvqae0px.js} +1 -1
- package/dist/{chunk-d9mar37g.js → chunk-c2n6zdyd.js} +2 -2
- package/dist/{chunk-d9mar37g.js.map → chunk-c2n6zdyd.js.map} +1 -1
- package/dist/{chunk-56jky6vf.js → chunk-cytss9mb.js} +2 -2
- package/dist/{chunk-56jky6vf.js.map → chunk-cytss9mb.js.map} +1 -1
- package/dist/{chunk-vw8849ys.js → chunk-dcgvq79a.js} +2 -2
- package/dist/{chunk-m54s6jpr.js.map → chunk-dcgvq79a.js.map} +1 -1
- package/dist/{chunk-6chz1ktz.js → chunk-de4t48j9.js} +3 -3
- package/dist/{chunk-6chz1ktz.js.map → chunk-de4t48j9.js.map} +1 -1
- package/dist/{chunk-cbqazg9k.js → chunk-dz99g58c.js} +2 -2
- package/dist/{chunk-cbqazg9k.js.map → chunk-dz99g58c.js.map} +1 -1
- package/dist/{chunk-e573yxpq.js → chunk-e7ezmag9.js} +3 -3
- package/dist/{chunk-e573yxpq.js.map → chunk-e7ezmag9.js.map} +1 -1
- package/dist/{chunk-yer1r3t3.js → chunk-epvpmakp.js} +2 -2
- package/dist/{chunk-yer1r3t3.js.map → chunk-epvpmakp.js.map} +1 -1
- package/dist/{chunk-yhrye9cm.js → chunk-f8vcwzgd.js} +2 -2
- package/dist/{chunk-yhrye9cm.js.map → chunk-f8vcwzgd.js.map} +1 -1
- package/dist/chunk-fa37qzm3.js +5 -0
- package/dist/chunk-fa37qzm3.js.map +12 -0
- package/dist/{chunk-fxgxf16k.js → chunk-ffgmqwzy.js} +2 -2
- package/dist/{chunk-fxgxf16k.js.map → chunk-ffgmqwzy.js.map} +1 -1
- package/dist/{chunk-er3wf6ng.js → chunk-fk6nxhxn.js} +2 -2
- package/dist/{chunk-er3wf6ng.js.map → chunk-fk6nxhxn.js.map} +1 -1
- package/dist/{chunk-3hrj5rwm.js → chunk-fnwbbmnk.js} +2 -2
- package/dist/{chunk-3hrj5rwm.js.map → chunk-fnwbbmnk.js.map} +1 -1
- package/dist/chunk-g2wncay4.js +9 -0
- package/dist/{chunk-hytt9qyj.js.map → chunk-g2wncay4.js.map} +3 -4
- package/dist/{chunk-gts5p6mw.js → chunk-ge9xjwgq.js} +4 -4
- package/dist/{chunk-gts5p6mw.js.map → chunk-ge9xjwgq.js.map} +1 -1
- package/dist/{chunk-tw5kwbx4.js → chunk-gjy2qjcr.js} +2 -2
- package/dist/{chunk-tw5kwbx4.js.map → chunk-gjy2qjcr.js.map} +1 -1
- package/dist/{chunk-15c2vgaf.js → chunk-gn7kne7r.js} +2 -2
- package/dist/{chunk-15c2vgaf.js.map → chunk-gn7kne7r.js.map} +1 -1
- package/dist/{chunk-9n1hx3mq.js → chunk-hr61ekcr.js} +3 -3
- package/dist/{chunk-9n1hx3mq.js.map → chunk-hr61ekcr.js.map} +1 -1
- package/dist/{chunk-m54s6jpr.js → chunk-hvgmqt6z.js} +2 -2
- package/dist/{chunk-vw8849ys.js.map → chunk-hvgmqt6z.js.map} +1 -1
- package/dist/{chunk-aeh67ynz.js → chunk-hvpn18bb.js} +3 -3
- package/dist/{chunk-aeh67ynz.js.map → chunk-hvpn18bb.js.map} +1 -1
- package/dist/{chunk-jdhdrr2k.js → chunk-j1453bn1.js} +2 -2
- package/dist/{chunk-jdhdrr2k.js.map → chunk-j1453bn1.js.map} +1 -1
- package/dist/{chunk-tn2bryy2.js → chunk-jpetnpzn.js} +2 -2
- package/dist/{chunk-tn2bryy2.js.map → chunk-jpetnpzn.js.map} +1 -1
- package/dist/{chunk-v1tfdgy1.js → chunk-jqrs16g2.js} +3 -3
- package/dist/{chunk-v1tfdgy1.js.map → chunk-jqrs16g2.js.map} +1 -1
- package/dist/{chunk-4mfrgd5m.js → chunk-kk77x2v4.js} +2 -2
- package/dist/{chunk-4mfrgd5m.js.map → chunk-kk77x2v4.js.map} +1 -1
- package/dist/chunk-kpn7f58a.js +14 -0
- package/dist/{chunk-pn8v6fj2.js.map → chunk-kpn7f58a.js.map} +11 -6
- package/dist/chunk-mhteg4yz.js +57 -0
- package/dist/{chunk-ms9k0rx6.js.map → chunk-mhteg4yz.js.map} +15 -11
- package/dist/{chunk-n672d4g8.js → chunk-n9jyjp4a.js} +2 -2
- package/dist/{chunk-n672d4g8.js.map → chunk-n9jyjp4a.js.map} +1 -1
- package/dist/{chunk-vbdty91k.js → chunk-nb2gggba.js} +3 -3
- package/dist/{chunk-vbdty91k.js.map → chunk-nb2gggba.js.map} +1 -1
- package/dist/chunk-ntxsdchf.js +50 -0
- package/dist/chunk-ntxsdchf.js.map +10 -0
- package/dist/{chunk-2z1981d0.js → chunk-pepzecrm.js} +2 -2
- package/dist/{chunk-2z1981d0.js.map → chunk-pepzecrm.js.map} +1 -1
- package/dist/{chunk-785b41h1.js → chunk-pgy3mfxw.js} +3 -3
- package/dist/{chunk-785b41h1.js.map → chunk-pgy3mfxw.js.map} +1 -1
- package/dist/{chunk-98m15b9x.js → chunk-qhw0hej0.js} +2 -2
- package/dist/{chunk-98m15b9x.js.map → chunk-qhw0hej0.js.map} +1 -1
- package/dist/{chunk-303mprnv.js → chunk-r3v2cnrj.js} +2 -2
- package/dist/{chunk-303mprnv.js.map → chunk-r3v2cnrj.js.map} +1 -1
- package/dist/{chunk-ktr3k768.js → chunk-rhmpphhc.js} +3 -3
- package/dist/{chunk-ktr3k768.js.map → chunk-rhmpphhc.js.map} +1 -1
- package/dist/{chunk-fre6f4nk.js → chunk-s4f56035.js} +2 -2
- package/dist/{chunk-fre6f4nk.js.map → chunk-s4f56035.js.map} +1 -1
- package/dist/{chunk-sr942vb1.js → chunk-sj4f7x4p.js} +2 -2
- package/dist/{chunk-sr942vb1.js.map → chunk-sj4f7x4p.js.map} +1 -1
- package/dist/{chunk-wyw6p3fg.js → chunk-sksmnjkn.js} +3 -3
- package/dist/{chunk-wyw6p3fg.js.map → chunk-sksmnjkn.js.map} +1 -1
- package/dist/{chunk-kqxdsv22.js → chunk-stnd9qht.js} +2 -2
- package/dist/{chunk-kqxdsv22.js.map → chunk-stnd9qht.js.map} +1 -1
- package/dist/{chunk-1myhm0g3.js → chunk-t65074mw.js} +3 -3
- package/dist/{chunk-1myhm0g3.js.map → chunk-t65074mw.js.map} +1 -1
- package/dist/chunk-t87w4h84.js +24 -0
- package/dist/{chunk-79xg42e7.js.map → chunk-t87w4h84.js.map} +2 -2
- package/dist/{chunk-z10cas5r.js → chunk-thz75w6e.js} +2 -2
- package/dist/{chunk-z10cas5r.js.map → chunk-thz75w6e.js.map} +1 -1
- package/dist/{chunk-xt9tv99x.js → chunk-v8vnxkvp.js} +2 -2
- package/dist/{chunk-xt9tv99x.js.map → chunk-v8vnxkvp.js.map} +1 -1
- package/dist/{chunk-x7cpth2f.js → chunk-veq07rp8.js} +1 -1
- package/dist/{chunk-agyfv3f8.js → chunk-vj5necm0.js} +1 -1
- package/dist/{chunk-p91b8zcn.js → chunk-vtc23xpk.js} +2 -2
- package/dist/{chunk-p91b8zcn.js.map → chunk-vtc23xpk.js.map} +1 -1
- package/dist/{chunk-jmpw6bqz.js → chunk-w4e480he.js} +2 -2
- package/dist/{chunk-jmpw6bqz.js.map → chunk-w4e480he.js.map} +1 -1
- package/dist/{chunk-8rv62v14.js → chunk-wgb79ysr.js} +2 -2
- package/dist/{chunk-8rv62v14.js.map → chunk-wgb79ysr.js.map} +1 -1
- package/dist/{chunk-1vzks22y.js → chunk-wk1tp1f1.js} +2 -2
- package/dist/{chunk-1vzks22y.js.map → chunk-wk1tp1f1.js.map} +1 -1
- package/dist/{chunk-bra1a1fq.js → chunk-wwdbgshx.js} +2 -2
- package/dist/{chunk-bra1a1fq.js.map → chunk-wwdbgshx.js.map} +1 -1
- package/dist/{chunk-eqse2m6n.js → chunk-wzzrz612.js} +2 -2
- package/dist/{chunk-eqse2m6n.js.map → chunk-wzzrz612.js.map} +1 -1
- package/dist/{chunk-hdps9n52.js → chunk-x7qwx07b.js} +3 -3
- package/dist/{chunk-hdps9n52.js.map → chunk-x7qwx07b.js.map} +1 -1
- package/dist/chunk-x84as3vy.js +5 -0
- package/dist/chunk-x84as3vy.js.map +12 -0
- package/dist/chunk-y0en07zh.js +302 -0
- package/dist/chunk-y0en07zh.js.map +17 -0
- package/dist/{chunk-d2gfcf85.js → chunk-yfwrbfnw.js} +2 -2
- package/dist/{chunk-d2gfcf85.js.map → chunk-yfwrbfnw.js.map} +1 -1
- package/dist/{chunk-mazznq15.js → chunk-yhp6bvhj.js} +3 -3
- package/dist/{chunk-mazznq15.js.map → chunk-yhp6bvhj.js.map} +1 -1
- package/dist/{chunk-tzm3c7n6.js → chunk-yvtmygrk.js} +4 -4
- package/dist/{chunk-tzm3c7n6.js.map → chunk-yvtmygrk.js.map} +1 -1
- package/dist/{chunk-mqfzdfnz.js → chunk-zkjs3m5m.js} +2 -2
- package/dist/{chunk-mqfzdfnz.js.map → chunk-zkjs3m5m.js.map} +1 -1
- package/dist/chunk-zw6843j3.js +5 -0
- package/dist/chunk-zw6843j3.js.map +12 -0
- package/dist/client/Head.d.ts.map +1 -1
- package/dist/client/fonts.d.ts +69 -0
- package/dist/client/fonts.d.ts.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +75 -1
- package/dist/client/index.js.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/builtins.d.ts +13 -0
- package/dist/console/builtins.d.ts.map +1 -0
- package/dist/console/run.js +13 -11
- package/dist/console/run.js.map +6 -5
- package/dist/console/runner.d.ts.map +1 -1
- package/dist/console/usage.d.ts +2 -0
- package/dist/console/usage.d.ts.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/Connections.d.ts +36 -0
- package/dist/facades/Connections.d.ts.map +1 -0
- package/dist/facades/Crypt.d.ts +26 -0
- package/dist/facades/Crypt.d.ts.map +1 -0
- package/dist/facades/Meta.d.ts +7 -1
- package/dist/facades/Meta.d.ts.map +1 -1
- package/dist/facades/Storage.d.ts +29 -0
- package/dist/facades/Storage.d.ts.map +1 -1
- package/dist/facades/index.d.ts +2 -0
- package/dist/facades/index.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/HttpRequest.d.ts +1 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/Metadata.d.ts +5 -0
- package/dist/http/Metadata.d.ts.map +1 -1
- package/dist/http/index.d.ts +3 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/http/requestContext.d.ts +1 -0
- package/dist/http/requestContext.d.ts.map +1 -1
- package/dist/http/safeFetch/errors.d.ts +10 -0
- package/dist/http/safeFetch/errors.d.ts.map +1 -1
- package/dist/http/safeFetch/index.d.ts +1 -1
- package/dist/http/safeFetch/index.d.ts.map +1 -1
- package/dist/http/sitemap/Robots.d.ts +95 -0
- package/dist/http/sitemap/Robots.d.ts.map +1 -0
- package/dist/http/sitemap/Sitemap.d.ts +145 -0
- package/dist/http/sitemap/Sitemap.d.ts.map +1 -0
- package/dist/http/sitemap/fetchText.d.ts +16 -0
- package/dist/http/sitemap/fetchText.d.ts.map +1 -0
- package/dist/http/sitemap/index.d.ts +3 -0
- package/dist/http/sitemap/index.d.ts.map +1 -0
- package/dist/http/sitemap/xml.d.ts +21 -0
- package/dist/http/sitemap/xml.d.ts.map +1 -0
- package/dist/i18n/Translator.d.ts.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +2 -2
- package/dist/i18n/resolveLocale.d.ts +18 -0
- package/dist/i18n/resolveLocale.d.ts.map +1 -1
- package/dist/kernel/index.js +3 -3
- package/dist/kernel/index.js.map +3 -3
- package/dist/kernel/providers.d.ts +2 -2
- package/dist/kernel/providers.d.ts.map +1 -1
- package/dist/orm/Model.d.ts.map +1 -1
- package/dist/orm/encryption-rotate.d.ts +44 -0
- package/dist/orm/encryption-rotate.d.ts.map +1 -0
- package/dist/orm/encryption.d.ts +54 -0
- package/dist/orm/encryption.d.ts.map +1 -0
- package/dist/orm/index.d.ts +2 -0
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +3 -3
- package/dist/orm/index.js.map +4 -4
- package/dist/orm/schema.d.ts +25 -1
- package/dist/orm/schema.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/encryption/Encrypter.d.ts +86 -0
- package/dist/services/encryption/Encrypter.d.ts.map +1 -0
- package/dist/services/encryption/EncryptionServiceProvider.d.ts +13 -0
- package/dist/services/encryption/EncryptionServiceProvider.d.ts.map +1 -0
- package/dist/services/encryption/config.d.ts +36 -0
- package/dist/services/encryption/config.d.ts.map +1 -0
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts +12 -1
- package/dist/services/file-storage/drivers/FileStorageDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +8 -1
- package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
- package/dist/services/file-storage/drivers/types.d.ts +17 -0
- package/dist/services/file-storage/drivers/types.d.ts.map +1 -1
- package/dist/services/file-storage/putFromUrl.d.ts +56 -0
- package/dist/services/file-storage/putFromUrl.d.ts.map +1 -0
- package/dist/services/file-storage/sniffContentType.d.ts +33 -0
- package/dist/services/file-storage/sniffContentType.d.ts.map +1 -0
- package/dist/services/index.d.ts +18 -4
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +10 -10
- package/dist/services/index.js.map +4 -3
- package/dist/services/queue/DatabaseQueueDriver.d.ts +96 -7
- package/dist/services/queue/DatabaseQueueDriver.d.ts.map +1 -1
- package/dist/services/queue/Job.d.ts +72 -0
- package/dist/services/queue/Job.d.ts.map +1 -1
- package/dist/services/queue/MemoryQueueDriver.d.ts +22 -2
- package/dist/services/queue/MemoryQueueDriver.d.ts.map +1 -1
- package/dist/services/queue/QueueDriver.d.ts +74 -1
- package/dist/services/queue/QueueDriver.d.ts.map +1 -1
- package/dist/services/queue/QueueManager.d.ts +47 -0
- package/dist/services/queue/QueueManager.d.ts.map +1 -1
- package/dist/services/queue/batch.d.ts +112 -0
- package/dist/services/queue/batch.d.ts.map +1 -0
- package/dist/services/queue/queueDriverContract.d.ts +5 -0
- package/dist/services/queue/queueDriverContract.d.ts.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/vitest/index.js +2 -2
- package/dist/vitest/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-1q9kd20m.js +0 -5
- package/dist/chunk-49nyyjfe.js +0 -5
- package/dist/chunk-49nyyjfe.js.map +0 -11
- package/dist/chunk-79xg42e7.js +0 -24
- package/dist/chunk-7vb4eey2.js +0 -217
- package/dist/chunk-7vb4eey2.js.map +0 -16
- package/dist/chunk-hytt9qyj.js +0 -54
- package/dist/chunk-jmg2zsaf.js +0 -5
- package/dist/chunk-jmg2zsaf.js.map +0 -12
- package/dist/chunk-ms9k0rx6.js +0 -46
- package/dist/chunk-pn8v6fj2.js +0 -14
- package/dist/chunk-whtzggn6.js +0 -5
- package/dist/chunk-yf1njzd5.js +0 -10
- /package/dist/{chunk-qjhw8nje.js.map → chunk-077rea02.js.map} +0 -0
- /package/dist/{chunk-41da9628.js.map → chunk-bvqae0px.js.map} +0 -0
- /package/dist/{chunk-x7cpth2f.js.map → chunk-veq07rp8.js.map} +0 -0
- /package/dist/{chunk-agyfv3f8.js.map → chunk-vj5necm0.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{_ as F}from"./chunk-
|
|
2
|
+
import{_ as F}from"./chunk-wzzrz612.js";import{aa as w}from"./chunk-s4f56035.js";import{Wi as h}from"./chunk-dcgvq79a.js";var P=h((p)=>{var t=w(),l=F();function d(e){try{let o=new Set(Array.from(e.match(/([A-Z_]){3,}/g)??[]));return o.delete("CONFIG"),o.delete("CONFIG_PREFIX_SEPARATOR"),o.delete("ENV"),[...o].join(", ")}catch(o){return e}}var u=(e,o)=>async()=>{try{let r=e(process.env,o);if(r===void 0)throw Error();return r}catch(r){throw new t.CredentialsProviderError(r.message||`Not found in ENV: ${d(e.toString())}`,{logger:o?.logger})}},C=(e,{preferredFile:o="config",...r}={})=>async()=>{let n=l.getProfileName(r),{configFile:i,credentialsFile:c}=await l.loadSharedConfigFiles(r),s=c[n]||{},g=i[n]||{},m=o==="config"?{...s,...g}:{...g,...s};try{let f=e(m,o==="config"?i:c);if(f===void 0)throw Error();return f}catch(a){throw new t.CredentialsProviderError(a.message||`Not found in config files w/ profile [${n}]: ${d(e.toString())}`,{logger:r.logger})}},y=(e)=>typeof e==="function",E=(e)=>y(e)?async()=>await e():t.fromStatic(e),N=({environmentVariableSelector:e,configFileSelector:o,default:r},n={})=>{let{signingName:i,logger:c}=n,s={signingName:i,logger:c};return t.memoize(t.chain(u(e,s),C(o,n),E(r)))};p.loadConfig=N});
|
|
3
3
|
export{P as Y};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=B8488973B0C7FA0164756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"'use strict';\n\nvar propertyProvider = require('@smithy/property-provider');\nvar sharedIniFileLoader = require('@smithy/shared-ini-file-loader');\n\nfunction getSelectorName(functionString) {\n try {\n const constants = new Set(Array.from(functionString.match(/([A-Z_]){3,}/g) ?? []));\n constants.delete(\"CONFIG\");\n constants.delete(\"CONFIG_PREFIX_SEPARATOR\");\n constants.delete(\"ENV\");\n return [...constants].join(\", \");\n }\n catch (e) {\n return functionString;\n }\n}\n\nconst fromEnv = (envVarSelector, options) => async () => {\n try {\n const config = envVarSelector(process.env, options);\n if (config === undefined) {\n throw new Error();\n }\n return config;\n }\n catch (e) {\n throw new propertyProvider.CredentialsProviderError(e.message || `Not found in ENV: ${getSelectorName(envVarSelector.toString())}`, { logger: options?.logger });\n }\n};\n\nconst fromSharedConfigFiles = (configSelector, { preferredFile = \"config\", ...init } = {}) => async () => {\n const profile = sharedIniFileLoader.getProfileName(init);\n const { configFile, credentialsFile } = await sharedIniFileLoader.loadSharedConfigFiles(init);\n const profileFromCredentials = credentialsFile[profile] || {};\n const profileFromConfig = configFile[profile] || {};\n const mergedProfile = preferredFile === \"config\"\n ? { ...profileFromCredentials, ...profileFromConfig }\n : { ...profileFromConfig, ...profileFromCredentials };\n try {\n const cfgFile = preferredFile === \"config\" ? configFile : credentialsFile;\n const configValue = configSelector(mergedProfile, cfgFile);\n if (configValue === undefined) {\n throw new Error();\n }\n return configValue;\n }\n catch (e) {\n throw new propertyProvider.CredentialsProviderError(e.message || `Not found in config files w/ profile [${profile}]: ${getSelectorName(configSelector.toString())}`, { logger: init.logger });\n }\n};\n\nconst isFunction = (func) => typeof func === \"function\";\nconst fromStatic = (defaultValue) => isFunction(defaultValue) ? async () => await defaultValue() : propertyProvider.fromStatic(defaultValue);\n\nconst loadConfig = ({ environmentVariableSelector, configFileSelector, default: defaultValue }, configuration = {}) => {\n const { signingName, logger } = configuration;\n const envOptions = { signingName, logger };\n return propertyProvider.memoize(propertyProvider.chain(fromEnv(environmentVariableSelector, envOptions), fromSharedConfigFiles(configFileSelector, configuration), fromStatic(defaultValue)));\n};\n\nexports.loadConfig = loadConfig;\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";oJAEA,FAAI,AACA,MAEJ,SAAS,CAAe,CAAC,EAAgB,CACrC,GAAI,CACA,IAAM,EAAY,IAAI,IAAI,MAAM,KAAK,EAAe,MAAM,eAAe,GAAK,CAAC,CAAC,CAAC,EAIjF,OAHA,EAAU,OAAO,QAAQ,EACzB,EAAU,OAAO,yBAAyB,EAC1C,EAAU,OAAO,KAAK,EACf,CAAC,GAAG,CAAS,EAAE,KAAK,IAAI,EAEnC,MAAO,EAAG,CACN,OAAO,GAIf,IAAM,EAAU,CAAC,EAAgB,IAAY,SAAY,CACrD,GAAI,CACA,IAAM,EAAS,EAAe,QAAQ,IAAK,CAAO,EAClD,GAAI,IAAW,OACX,MAAU,MAAM,EAEpB,OAAO,EAEX,MAAO,EAAG,CACN,MAAM,IAAI,EAAiB,yBAAyB,EAAE,SAAW,qBAAqB,EAAgB,EAAe,SAAS,CAAC,IAAK,CAAE,OAAQ,GAAS,MAAO,CAAC,IAIjK,EAAwB,CAAC,GAAkB,gBAAgB,YAAa,GAAS,CAAC,IAAM,SAAY,CACtG,IAAM,EAAU,EAAoB,eAAe,CAAI,GAC/C,aAAY,mBAAoB,MAAM,EAAoB,sBAAsB,CAAI,EACtF,EAAyB,EAAgB,IAAY,CAAC,EACtD,EAAoB,EAAW,IAAY,CAAC,EAC5C,EAAgB,IAAkB,SAClC,IAAK,KAA2B,CAAkB,EAClD,IAAK,KAAsB,CAAuB,EACxD,GAAI,CAEA,IAAM,EAAc,EAAe,EADnB,IAAkB,SAAW,EAAa,CACD,EACzD,GAAI,IAAgB,OAChB,MAAU,MAAM,EAEpB,OAAO,EAEX,MAAO,EAAG,CACN,MAAM,IAAI,EAAiB,yBAAyB,EAAE,SAAW,yCAAyC,OAAa,EAAgB,EAAe,SAAS,CAAC,IAAK,CAAE,OAAQ,EAAK,MAAO,CAAC,IAI9L,EAAa,CAAC,IAAS,OAAO,IAAS,WACvC,EAAa,CAAC,IAAiB,EAAW,CAAY,EAAI,SAAY,MAAM,EAAa,EAAI,EAAiB,WAAW,CAAY,EAErI,EAAa,EAAG,8BAA6B,qBAAoB,QAAS,GAAgB,EAAgB,CAAC,IAAM,CACnH,IAAQ,cAAa,UAAW,EAC1B,EAAa,CAAE,cAAa,QAAO,EACzC,OAAO,EAAiB,QAAQ,EAAiB,MAAM,EAAQ,EAA6B,CAAU,EAAG,EAAsB,EAAoB,CAAa,EAAG,EAAW,CAAY,CAAC,CAAC,GAGxL,aAAa",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "B8488973B0C7FA0164756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{eh as X,qh as P}from"./chunk-ntxsdchf.js";function f(){return{now:new Date,resolved:{}}}var b={now:new Date(0),resolved:{}};function x(z){return(G,H=b)=>{let V=[];for(let Z=0;Z<z.length;Z++)V.push(z[Z](G,H));return V}}var j="\x00";function W(z){return{text:z,binders:[]}}function Q(z,G=""){return{text:j+G,binders:[z]}}function p(z){return z.text.split(j)}function m(z,G){return{text:z.join(j),binders:G}}function $(...z){return I(z,"")}function I(z,G){let H="",V=[];for(let Z=0;Z<z.length;Z++){if(Z>0)H+=G;H+=z[Z].text;for(let Y of z[Z].binders)V.push(Y)}return{text:H,binders:V}}function c(z,G,H){let V=z.text.split(j),Z=V.length-1;if(Z!==z.binders.length)throw Error(`Compiled ${Z} parameter placeholders but collected ${z.binders.length} binders.`);if(Z>G.maxBoundParameters)throw new P(H.model,H.operation,Z,G.maxBoundParameters,G.name,G.bindsListAsOneParameter?"That is one parameter per value in the statement.":`That is one parameter per value, and on ${G.name} each element of an 'in' list counts separately.`);let Y=V[0];for(let B=0;B<Z;B++)Y+=G.placeholder(B)+V[B+1];return{text:Y,binders:z.binders}}class K{name="postgres";supportsInsensitiveMode=!0;bindsListAsOneParameter=!0;supportsReturning=!0;maxBoundParameters=65535;typesParametersFromStatement=!0;quoteIdent(z){if(z.includes("\x00"))throw Error(`Refusing to quote the identifier ${JSON.stringify(z)}: it contains a NUL byte, which is reserved as the parameter marker.`);return`"${z.replace(/"/g,'""')}"`}placeholder(z){return`$${z+1}`}inList(z,G,H,V){return $(W(`${z} ${G?"<> all":"= any"} (`),Q((Y,B)=>C(V(Y,B))),W(")"))}static COMPOSITE_IN_TYPES={Int:"int",BigInt:"bigint",String:"text",Boolean:"boolean"};canBindCompositeIn(z){return z.length>0&&z.every((G)=>K.COMPOSITE_IN_TYPES[G])}compositeIn(z,G,H){let V=z.map((Z,Y)=>$(Q((B,J)=>C(H(B,J).map((F)=>F[Y]))),W(`::${K.COMPOSITE_IN_TYPES[G[Y]]}[]`)));return $(W(`(${z.join(", ")}) in (select * from unnest(`),...V.flatMap((Z,Y)=>Y===0?[Z]:[W(", "),Z]),W("))"))}listFilters=new Set(["equals","has","hasEvery","hasSome","isEmpty"]);listHas(z,G){return $(G,W(` = any(${z})`))}listHasEvery(z,G){return $(W(`${z} @> `),G)}listHasSome(z,G){return $(W(`${z} && `),G)}listIsEmpty(z,G){return $(W(`${z} ${G?"=":"<>"} `),Q(()=>C([])))}listPush(z,G){return $(W(`array_cat(${z}, `),G,W(")"))}jsonPathSyntax="array";jsonFilters=new Set(["equals","not","string_contains","string_starts_with","string_ends_with","array_contains","lt","lte","gt","gte"]);jsonComparesAsText=!0;jsonExtract(z,G,H){return $(W(`${z} ${H?"#>>":"#>"} `),Q((V,Z)=>C(G(V,Z))))}jsonValueAt(z,G){return $(W("("),this.jsonExtract(z,G,!1),W(")::jsonb"))}jsonHasKeys(z,G,H,V){let Z=()=>G===void 0?W(`(${z})::jsonb`):$(W("("),this.jsonExtract(z,G,!1),W(")::jsonb")),Y=V==="one"?$(Q(H),W("::text")):$(Q((J,F)=>C(H(J,F)??[])),W("::text[]")),B=V==="one"?"?":V==="some"?"?|":"?&";return $(W("(jsonb_typeof("),Z(),W(") = 'object' and "),Z(),W(` ${B} `),Y,W(")"))}distinctFrom(z,G,H){let V=H.type==="Json"&&!H.isList;return $(W(V?`(${z})::jsonb is distinct from `:`${z} is distinct from `),G)}jsonArrayContains(z,G,H){return $(W("("),this.jsonExtract(z,G,!1),W(") @> "),Q((V,Z)=>{let Y=H(V,Z);if(Y===null||Y===void 0)return null;return typeof Y==="string"||typeof Y==="object"?Y:JSON.stringify(Y)}),W("::jsonb"))}like(z,G,H){return $(W(`${z} ${G?"ilike":"like"} `),Q(H))}ignoreConflicts(){return W(" on conflict do nothing")}rowLock(z,G){let H=z.onLocked==="skipLocked"?" skip locked":z.onLocked==="noWait"?" nowait":"";return W(` for ${z.mode==="share"?"share":"update"} of ${this.quoteIdent(G)}${H}`)}paginate(z,G){let H=[];if(z)H.push($(W(" limit "),Q(z)));if(G)H.push($(W(" offset "),Q(G)));return $(...H)}constraintViolation(z){let G=z;if(!G)return null;if(String(G.errno??G.code??"")!=="23505")return null;let V=typeof G.constraint==="string"&&G.constraint!==""?G.constraint:void 0,Z=typeof G.detail==="string"?G.detail:"",Y=/\((.+?)\)=/.exec(Z);return{kind:"unique",columns:Y?(Y[1].match(/"(?:[^"]|"")*"|[^,]+/g)??[]).map((J)=>J.trim()).filter((J)=>J!=="").map((J)=>/^".*"$/s.test(J)?J.slice(1,-1).replace(/""/g,'"'):J):[],constraint:V}}castParameter(z){if(z.isList)return"";return z.type==="Json"?"::text::jsonb":""}encode(z,G){if(z===null||z===void 0)return null;if(G.isList){if(!Array.isArray(z))throw Error(`gemi ORM bug: a non-array reached the parameter binder for the scalar list '${G.column}' (received ${typeof z}). Every path that binds a list is supposed to have checked its operand.`);return C(G.type==="Json"?z.map((H)=>H===null||H===void 0?null:JSON.stringify(H)):z)}return z}encodeUntyped(z){return z}needsDecode(z){return z.isList===!0||z.type==="BigInt"||z.type==="Bytes"}decode(z,G){if(z===null||z===void 0)return null;if(G.isList)return this.decodeList(z,G);return this.decodeScalar(z,G)}decodeList(z,G){let H=Array.isArray(z)?z:typeof z==="string"?E(z,G):ArrayBuffer.isView(z)?Array.from(z):null;if(H===null)throw new X(G,z);return H.map((V)=>V===null||V===void 0?null:this.decodeScalar(V,G))}decodeScalar(z,G){switch(G.type){case"BigInt":if(typeof z==="bigint")return z;try{return BigInt(z)}catch{throw new X(G,z)}case"Json":return z;case"Bytes":return Buffer.isBuffer(z)?new Uint8Array(z.buffer,z.byteOffset,z.byteLength):z;default:return z}}}function C(z){let G="{";for(let H=0;H<z.length;H++){if(H>0)G+=",";G+=D(z[H])}return G+"}"}function D(z){if(z===null||z===void 0)return"NULL";if(z instanceof Date)return`"${z.toISOString()}"`;if(ArrayBuffer.isView(z)){let H="";for(let V of new Uint8Array(z.buffer,z.byteOffset,z.byteLength))H+=V.toString(16).padStart(2,"0");return`"\\\\x${H}"`}return`"${(typeof z==="string"?z:String(z)).replace(/\\/g,"\\\\").replace(/"/g,"\\\"")}"`}function E(z,G){if(!z.startsWith("{")||!z.endsWith("}"))throw new X(G,z);if(z==="{}")return[];let H=[],V=1,Z=z.length-1;while(V<=Z){let Y="",B=!1;if(z[V]==='"'){B=!0,V++;while(V<Z&&z[V]!=='"')Y+=z[V]==="\\"?z[++V]:z[V],V++;V++}else while(V<Z&&z[V]!==","){if(z[V]==="{")throw new X(G,z);Y+=z[V],V++}if(H.push(!B&&Y.toUpperCase()==="NULL"?null:Y),V<Z&&z[V]!==",")throw new X(G,z);V++}if(G.type!=="Json")return H;return H.map((Y)=>{if(Y===null)return null;try{return JSON.parse(Y)}catch{throw new X(G,Y)}})}var k={"Prisma.DbNull":"db","Prisma.JsonNull":"json","Prisma.AnyNull":"any"};function _(z){return new class{toString(){return z}}}var s=_("Prisma.DbNull"),y=_("Prisma.JsonNull"),u=_("Prisma.AnyNull"),r=y;function A(z){if(typeof z!=="object"||z===null)return null;for(let H in z)return null;if(Object.getOwnPropertyNames(z).length>0)return null;let G;try{G=String(z)}catch{return null}return k[G]??null}var h=/^\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}:\d{2}(\.\d+)?$/;function q(z,G){if(z instanceof Date)return z;let H;if(typeof z==="number")H=new Date(z);else if(typeof z==="bigint")H=new Date(Number(z));else if(typeof z==="string")H=new Date(h.test(z)?`${z.replace(" ","T")}Z`:z);else throw new X(G,z);if(Number.isNaN(H.getTime()))throw new X(G,z);return H}class S{name="sqlite";supportsInsensitiveMode=!1;bindsListAsOneParameter=!1;supportsReturning=!0;maxBoundParameters=32766;typesParametersFromStatement=!1;quoteIdent(z){if(z.includes("\x00"))throw Error(`Refusing to quote the identifier ${JSON.stringify(z)}: it contains a NUL byte, which is reserved as the parameter marker.`);return`"${z.replace(/"/g,'""')}"`}placeholder(z){return"?"}inList(z,G,H,V){let Z=G?"not in":"in",Y=[];for(let B=0;B<H;B++)Y.push(Q((J,F)=>V(J,F)[B]));return $(W(`${z} ${Z} (`),I(Y,", "),W(")"))}canBindCompositeIn(){return!1}compositeIn(){throw Error("SQLite cannot bind a composite `in`; `canBindCompositeIn` is the guard.")}listFilters=new Set;listHas(){throw Error(N("has"))}listHasEvery(){throw Error(N("hasEvery"))}listHasSome(){throw Error(N("hasSome"))}listIsEmpty(){throw Error(N("isEmpty"))}listPush(){throw Error(N("push"))}jsonPathSyntax="jsonpath";jsonFilters=new Set(["equals","not","string_contains","string_starts_with","string_ends_with"]);jsonComparesAsText=!1;jsonExtract(z,G,H){return $(W(`json_extract(${z}, `),Q(G),W(")"))}jsonValueAt(z,G){return $(W(`(${z} -> `),Q(G),W(")"))}jsonHasKeys(z,G,H,V,Z){let Y=(O,U)=>G===void 0?"$":G(O,U),B=(O)=>$(W(`json_type(${z}, `),Q((U,M)=>{let w=H(U,M),L=O===void 0?w:w[O];return`${Y(U,M)}.${JSON.stringify(String(L))}`}),W(") is not null")),J=V==="one"?[B(void 0)]:Array.from({length:Z},(O,U)=>B(U)),F=J.length===0?W(V==="some"?"0":"1"):I(J,V==="every"?" and ":" or ");return $(W(`(json_type(${z}, `),Q(Y),W(") = 'object' and ("),F,W("))"))}distinctFrom(z,G,H){if(H.type==="Json"&&!H.isList)return $(W(`json(${z}) is not json(`),G,W(")"));return $(W(`${z} is not `),G)}jsonArrayContains(){throw Error("SQLite cannot express array_contains; `jsonFilters` is the guard.")}like(z,G,H){return $(W(`${z} like `),Q(H))}ignoreConflicts(){return null}rowLock(z,G){return W("")}paginate(z,G){if(!z&&!G)return W("");if(!G)return $(W(" limit "),Q(z));return $(W(" limit "),Q(z??(()=>-1)),W(" offset "),Q(G))}constraintViolation(z){let G=z?.code;if(G!=="SQLITE_CONSTRAINT_UNIQUE"&&G!=="SQLITE_CONSTRAINT_PRIMARYKEY")return null;let H=String(z.message??""),V=/constraint failed:\s*(.+)$/.exec(H);if(!V)return{kind:"unique",columns:[]};return{kind:"unique",columns:V[1].split(",").map((Y)=>Y.trim()).map((Y)=>{let B=Y.indexOf(".");return B===-1?Y:Y.slice(B+1)}).filter((Y)=>Y!=="")}}castParameter(z){return""}encode(z,G){if(z===null||z===void 0)return null;switch(G.type){case"DateTime":return z instanceof Date?z.getTime():z;case"Boolean":return typeof z==="boolean"?z?1:0:z;case"Json":{let H=A(z);if(H==="db")return null;if(H==="json")return"null";if(H==="any")throw Error("gemi ORM bug: Prisma.AnyNull reached the SQLite encoder. It is a filter operand only, and both the filter and write paths are supposed to have handled it before this point.")}return JSON.stringify(z);default:return z}}encodeUntyped(z){if(z instanceof Date)return z.getTime();if(typeof z==="boolean")return z?1:0;return z}needsDecode(z){switch(z.type){case"DateTime":case"Boolean":case"BigInt":case"Json":return!0;default:return!1}}decode(z,G){if(z===null||z===void 0)return null;switch(G.type){case"DateTime":return q(z,G);case"Boolean":if(typeof z==="boolean")return z;return Number(z)!==0;case"BigInt":if(typeof z==="bigint")return z;try{return BigInt(z)}catch{throw new X(G,z)}case"Json":try{return typeof z==="string"?JSON.parse(z):z}catch{throw new X(G,z)}default:return z}}}function N(z){return`SQLite has no array type, so it cannot express '${z}' on a scalar list; \`listFilters\` is the guard.`}class R extends Error{constructor(z){super(`The gemi ORM does not support the '${z}' dialect. Only sqlite `+"and postgres are implemented \u2014 see the supported matrix in "+`docs/orm.md.
|
|
3
|
+
|
|
4
|
+
The *connection* is fine: Bun's client speaks ${z}, so raw SQL through DB.query / DB.sql and transactions all work. It is the query compiler that has no ${z} dialect, so every model operation raises this.
|
|
5
|
+
|
|
6
|
+
Point DATABASE_URL at Postgres or SQLite to use the ORM, or keep using Prisma's own client for this database.`);this.name="UnsupportedDialectError"}}function Vz(z){return T[z]!==null}function Wz(){return Object.keys(T)}var T={sqlite:new S,postgres:new K,mysql:null,mariadb:null};function Yz(z){let G=T[z];if(G===null)throw new R(z);return G}
|
|
7
|
+
export{f as We,x as Xe,W as Ye,Q as Ze,p as _e,m as $e,$ as af,I as bf,c as cf,K as df,s as ef,y as ff,u as gf,r as hf,A as if,S as jf,R as kf,Vz as lf,Wz as mf,Yz as nf};
|
|
8
|
+
|
|
9
|
+
//# debugId=E28B956D1D2C542F64756E2164756E21
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../orm/
|
|
3
|
+
"sources": ["../orm/compile/fragment.ts", "../orm/dialect/postgres.ts", "../orm/json-null.ts", "../orm/dialect/sqlite.ts", "../orm/dialect/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Thrown when the compiler is handed an argument it does not implement yet.\n *\n * Every public operation accepts the full Prisma argument type from iteration 1\n * — signatures are final, capability grows underneath them. The price of that is\n * that anything unimplemented has to fail loudly: silently dropping a `take: 10`\n * and returning the whole table is the worst failure mode this ORM has.\n */\nexport class UnsupportedQueryError extends Error {\n constructor(\n public readonly argument: string,\n public readonly model: string,\n public readonly operation: string,\n /**\n * What cannot work, and what to do instead.\n *\n * **Required**, which is the second half of #61 — the first being the\n * `UnsupportedByDesignError` split beside this. It was optional, and the\n * refusals that omitted it were the highest-traffic ones: an argument the\n * operation does not accept, on the path a typo takes. Those said only\n * *that* something was refused, to the reader least likely to know why.\n *\n * Required rather than conventionally-supplied for the reason five other\n * parameters here are — `render`'s `origin`, `changedFields`' `schema`,\n * `RelationExecutor.exec`'s `preScoped`, `resolveLink`'s `operation`,\n * `assertPageArgument`'s reported name: where omitting an argument produces\n * a *worse* result rather than an error, `tsc` is the only thing that keeps\n * a convention. Ninety-five of a hundred call sites already passed one; the\n * five that did not are exactly the ones nobody revisited.\n *\n * `UnknownFieldError` and `UnknownRelationError` set the standard this\n * meets: both enumerate the valid names rather than only rejecting the\n * invalid one.\n */\n detail: string,\n ) {\n super(\n `gemi ORM does not support '${argument}' yet (${model}.${operation}). ` +\n detail,\n );\n this.name = \"UnsupportedQueryError\";\n }\n}\n\n/**\n * An argument the ORM has **decided not to implement**, as opposed to one it has\n * not implemented yet.\n *\n * The distinction is the whole point, and it is a distinction a caller can act\n * on: \"yet\" means wait for a release, \"will not\" means change the code. Sharing\n * one error for both meant `docs/orm.md` could list `omit` under *Not in scope*\n * while the runtime said \"yet\" — a contradiction a reader has no way to\n * resolve, and the one #68 exists to end.\n *\n * A subclass rather than a sibling, so `catch (e) { if (e instanceof\n * UnsupportedQueryError) … }` keeps working for callers that do not care which\n * kind it is.\n */\n/**\n * An argument the ORM **does** implement, given a value it cannot mean.\n *\n * The third category, and the one that made \"yet\" wrong four separate times —\n * #82, #88, #100 and #101 each corrected it at their own call site before #61\n * was found to own the problem. The taxonomy the three classes now draw:\n *\n * not implemented yet UnsupportedQueryError wait for a release\n * decided against UnsupportedByDesignError change the call (#78)\n * implemented, bad value InvalidArgumentError fix the value\n *\n * `take: \"-2\"` is the clearest case. `take` is implemented; `\"-2\"` is not a\n * take. Telling that caller the ORM \"does not support 'take' yet\" is wrong on\n * both halves — it does, and there is nothing to wait for — and it sends them\n * to a changelog when the fix is one character in their own code.\n *\n * **Extends `UnsupportedQueryError`**, so every existing `catch` and every test\n * asserting the base class keeps working. That is the same choice\n * `UnsupportedByDesignError` made, and it is what lets a taxonomy be added to a\n * shipped ORM without a breaking change: the specific classes are for the\n * reader, the base class is for the handler.\n *\n * **Where the taxonomy stops, and why it stops there.** An argument that is not\n * in the grammar at all keeps the base class and its \"yet\" — `{ nope: 1 }`\n * reports \"does not support 'nope' yet\". That is right for half of what reaches\n * that path and wrong for the other half: the same check refuses a typo and a\n * real Prisma argument this ORM has genuinely not implemented, and nothing at\n * that point can tell them apart. Splitting it would mean carrying Prisma's\n * full argument grammar per operation, which is a large amount of duplicated\n * schema for a small gain.\n *\n * What makes it tolerable is the sentence after it. Since #61's other half made\n * `detail` mandatory, that refusal always continues *\"findMany takes include,\n * omit, orderBy, select, skip, take, where\"* — so a caller who typed `nope`\n * learns it is not coming from the very next clause, without the class having\n * to know. Recorded here rather than left to be re-derived, because \"the third\n * class did not cover this one\" is the obvious first reading and it is not the\n * interesting part.\n */\nexport class InvalidArgumentError extends UnsupportedQueryError {\n constructor(\n argument: string,\n model: string,\n operation: string,\n /** What is wrong with the value, and what a good one looks like. */\n reason: string,\n ) {\n super(argument, model, operation, reason);\n this.name = \"InvalidArgumentError\";\n this.message = `Invalid '${argument}' (${model}.${operation}). ${reason}`;\n }\n}\n\nexport class UnsupportedByDesignError extends UnsupportedQueryError {\n constructor(\n argument: string,\n model: string,\n operation: string,\n /** What to use instead. Required — see #61: a refusal owes the caller a next step. */\n reason: string,\n ) {\n super(argument, model, operation, reason);\n this.name = \"UnsupportedByDesignError\";\n this.message =\n `gemi ORM does not implement '${argument}' (${model}.${operation}), ` +\n `and this is a decision rather than a gap. ${reason}`;\n }\n}\n\n/**\n * Thrown when an argument names something that is not a field on the model. A\n * `where` key with no matching field is an error, never a passthrough — that is\n * the rule that keeps user input out of the identifier positions in the SQL.\n */\nexport class UnknownFieldError extends Error {\n constructor(\n public readonly field: string,\n public readonly model: string,\n known: string[],\n ) {\n super(\n `'${field}' is not a field on model ${model}. ` +\n `Known fields: ${known.join(\", \")}.`,\n );\n this.name = \"UnknownFieldError\";\n }\n}\n\n/**\n * Thrown when a column holds something the generated schema says it cannot —\n * an unparseable timestamp, a fractional value in a `BigInt` column, malformed\n * JSON. Every dialect needs it, which is why it lives here rather than beside\n * one of them.\n *\n * It exists so those cases fail rather than decode into a plausible wrong\n * value: `new Date(\"nonsense\")` is an `Invalid Date`, not an error, and it\n * would travel a long way before anyone noticed.\n */\nexport class DecodeError extends Error {\n constructor(\n public readonly field: { column: string; type: string },\n public readonly value: unknown,\n ) {\n super(\n `Could not decode the value ${JSON.stringify(String(value))} from column ` +\n `'${field.column}' as ${field.type}. The column's contents do not match ` +\n `the Prisma schema — was it written by something other than Prisma or ` +\n `the gemi ORM?`,\n );\n this.name = \"DecodeError\";\n }\n}\n\n/**\n * Thrown by the `*OrThrow` operations when the query matched nothing. Prisma\n * raises `NotFoundError` / `P2025` for the same case; the differential harness\n * compares the fact of throwing, not the error type.\n */\nexport class RecordNotFoundError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n ) {\n super(`No ${model} found (${model}.${operation}).`);\n this.name = \"RecordNotFoundError\";\n }\n}\n\n/**\n * The dispatchers' test for a lookup that matched nothing and should be\n * answered with a 404.\n *\n * Matches the name as well as the class for the reason `isPolicyDeniedError`\n * and `isUniqueConstraintError` do: `instanceof` compares against *this*\n * module instance's class object, so a second copy of `gemi/orm` — two\n * versions in one dependency tree, a linked package beside a bundled one —\n * throws an error this would not recognise, and the request would go back to\n * being a 500 carrying the model's name in its body.\n *\n * The name is the identity here, so an application error that calls itself\n * `RecordNotFoundError` is deliberately matched too. That is the same bargain\n * the other two predicates make, and the failure it trades against — a 500\n * where a 404 was meant — is the worse one.\n */\nexport function isRecordNotFoundError(error: unknown): error is RecordNotFoundError {\n if (error instanceof RecordNotFoundError) return true;\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { name?: unknown }).name === \"RecordNotFoundError\"\n );\n}\n\n/**\n * Thrown when a write violates a unique constraint.\n *\n * DECISION — gemi defines its own error rather than mirroring Prisma's codes.\n *\n * Prisma raises `PrismaClientKnownRequestError` with code `P2002` and\n * `meta.target` holding the field names. Mirroring that would ease a migration\n * for code already branching on `P2002`.\n *\n * **The premise this note used to rest on was wrong, and the conclusion is\n * unchanged.** It said \"nothing in this repository does (checked)\", which was\n * true of *this* repository and was never the question — the code that branches\n * on `P2002` lives in the applications the ORM is for. The first real port\n * measured four such guards, every one of them in concurrency-recovery code\n * (catch the collision, re-read, retry), and every one of them silently dead the\n * moment the write moved onto gemi: the `catch` still ran, the condition was\n * false, the recovery did not happen. Nor was the repository itself clean —\n * `templates/saas-starter/app/models/differential.ts:621` branches on `P2002`\n * today, and did when this was written.\n *\n * What the premise was doing was answering \"would anyone notice?\", and the\n * answer is that four people noticed at once. The decision never depended on it.\n * Carrying a `P` code implies the rest of the taxonomy is implemented too:\n * `P2003`, `P2025`, and the fifty others an application might reasonably then\n * expect to catch. Claiming a compatibility surface we have not built is worse\n * than asking the call sites that need it to catch a gemi error instead —\n * *especially* when the code in question is a retry loop, because a\n * compatibility surface that covers `P2002` and not `P2034` fails in exactly\n * the same silent way, one layer further in.\n *\n * A porter reaches for `isUniqueConstraintError` below. `UPGRADE.md` carries\n * the temporary `|| error.code === \"P2002\"` bridge, for a codebase halfway\n * through the move, with the marker that says when to delete it; it is\n * deliberately not exported, because a Prisma code in gemi's permanent surface\n * is the thing this note declined.\n *\n * What the contract does promise is the part that matters: the error is typed,\n * catchable, and names the fields — as *field* names, the way Prisma's\n * `meta.target` does, not as the database columns the driver reported.\n */\nexport class UniqueConstraintError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n /** Field names, mapped back through the schema from the driver's columns. */\n public readonly fields: string[],\n /** The constraint's own name, when the dialect reports one. */\n public readonly constraint?: string,\n options?: { cause?: unknown },\n ) {\n super(\n `Unique constraint violated on ${model}.${operation}` +\n (fields.length > 0 ? ` for ${fields.join(\", \")}` : \"\") +\n (constraint ? ` (constraint '${constraint}')` : \"\") +\n `. A ${model} with those values already exists.`,\n options,\n );\n this.name = \"UniqueConstraintError\";\n }\n}\n\n/**\n * The guard to write in a retry-on-collision `catch`, which is where a\n * `code === \"P2002\"` test almost always was:\n *\n * try {\n * return await Invite.create({ data: { token } })\n * } catch (error) {\n * if (!isUniqueConstraintError(error)) throw error\n * return await Invite.findUniqueOrThrow({ where: { token } })\n * }\n *\n * **Why this is worth shipping rather than telling people to write\n * `instanceof`**, which is the obvious objection and the reason it nearly was\n * not shipped. The second half of the test is the whole of it:\n *\n * error instanceof UniqueConstraintError || error.name === \"UniqueConstraintError\"\n *\n * `instanceof` compares against *this module instance's* class object, so it is\n * false across a duplicate copy of `gemi/orm` — two versions in one dependency\n * tree, a bundled build alongside a linked one, a monorepo package resolving\n * its own. The error is the right error, thrown by the right code, and the\n * guard silently does not fire. That is not a hypothetical: duck-typing rather\n * than importing the class is precisely what the ported application had already\n * done for Prisma's error, for precisely this reason, and shipping a predicate\n * that only does `instanceof` would hand it back the same trap under a new\n * name.\n *\n * So the name is load-bearing rather than a convenience: it is the identity\n * that survives module duplication, which is why every error in this file sets\n * `this.name` explicitly instead of relying on the class name surviving\n * minification.\n *\n * **The narrowing is a claim, and this is what it rests on.** The name branch\n * asserts `UniqueConstraintError` on the strength of a string — a second copy\n * of this module really does carry `model`, `operation` and `fields`, so the\n * claim holds for the case it exists for. An unrelated object named\n * `\"UniqueConstraintError\"` would defeat it, and that is not something that\n * happens by accident.\n *\n * **It deliberately does not match `code === \"P2002\"`.** See the DECISION\n * above: the temporary bridge for a half-ported codebase is in `UPGRADE.md`,\n * where it can carry a delete-me marker, rather than in gemi's permanent\n * surface, where it would have neither.\n */\nexport function isUniqueConstraintError(\n error: unknown,\n): error is UniqueConstraintError {\n if (error instanceof UniqueConstraintError) return true;\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { name?: unknown }).name === \"UniqueConstraintError\"\n );\n}\n\n/**\n * Thrown when a write needs `RETURNING` and the dialect has none.\n *\n * Unreachable on SQLite and Postgres, which both support it. It exists so that\n * the MySQL / MariaDB path is a named gap rather than a wrong answer: the\n * fallback there is `lastInsertRowid` plus a re-select, which is a different\n * statement shape and is not implemented.\n */\nexport class ReturningUnsupportedError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly dialect: string,\n ) {\n super(\n `${model}.${operation} needs RETURNING to report its result, and the ` +\n `'${dialect}' dialect does not support it. The fallback — ` +\n `lastInsertRowid plus a re-select — is not implemented.`,\n );\n this.name = \"ReturningUnsupportedError\";\n }\n}\n\n/**\n * Thrown when a policy denies an operation.\n *\n * Two ways to get here, and the message distinguishes them because the fixes\n * are different: a policy's `before` returned false, or the model is policied\n * and there is no user in scope at all.\n *\n * The second is the deny-by-default rule, and it is the reason this error is\n * loud. A cron tick or a queue worker reading a policied model has no user, and\n * the alternative — treating \"no user\" as \"no policy\" — means the dangerous\n * case is the silent one: a request whose auth middleware was misconfigured\n * would read every tenant's rows rather than failing. So unscoped access is\n * always a decision written at the call site, through `Model.asSystem`.\n */\nexport class PolicyDeniedError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly reason: \"denied\" | \"no-user\" = \"denied\",\n ) {\n super(\n reason === \"no-user\"\n ? `${model}.${operation} is governed by a policy and there is no user ` +\n `in scope. If this is a cron tick, a queue worker or a script, say ` +\n `so at the call site: Model.asSystem(() => ...). Policies are ` +\n `never skipped just because a user failed to turn up.`\n : `${model}.${operation} was denied by ${model}'s policy.`,\n );\n this.name = \"PolicyDeniedError\";\n }\n}\n\n/**\n * The api dispatcher's test for a denial it should answer with a 403. It\n * matches the name as well as the class for the reason\n * `isUniqueConstraintError` does: a second copy of `gemi/orm` throws an error\n * that is not `instanceof` this class, and a denial that failed the test would\n * go back to being a 500 that carries the policy's message.\n */\nexport function isPolicyDeniedError(error: unknown): error is PolicyDeniedError {\n if (error instanceof PolicyDeniedError) return true;\n\n return (\n typeof error === \"object\" &&\n error !== null &&\n (error as { name?: unknown }).name === \"PolicyDeniedError\"\n );\n}\n\n/**\n * Thrown when an `update` writes to a column its own policy's `scope` selects on,\n * and the policy has no `onUpdate` saying what that should mean.\n *\n * The shape it catches:\n *\n * scope: (ctx) => ({ organizationId: ctx.user.organizationId })\n * // ...and then\n * User.update({ where: { id }, data: { organizationId: 999 } })\n *\n * The scope did its job — only rows in the caller's own tenant could be selected\n * — and the statement still hands one of them to another tenant. Afterwards the\n * row is outside the scope, so it cannot be read back and cannot be put right by\n * the same caller: a one-way door rather than a visible failure. The usual way in\n * is not malice but mass assignment, a handler forwarding request fields into\n * `data`.\n *\n * This is `assertCreateCovered`'s question asked of the other write. There it is\n * \"you scoped reads but never said what an insert means\"; here it is \"you scoped\n * reads but never said whether an update may move a row out\". Both are answered\n * by writing the hook, including when the answer is \"allow it\" —\n * `onUpdate: (_ctx, data) => data` is a complete and legitimate answer, and\n * saying it out loud is the point.\n *\n * **What it cannot see.** The scope-owned columns are read off the top level of\n * the fragment the policy returned, so `{ organizationId: 7 }` is understood and\n * `{ OR: [...] }` is not — a scope built from combinators is not attributed to\n * any column and an update through it is not checked. Narrowing that would mean\n * either interpreting arbitrary `where` grammar or refusing every update on such\n * a model, and neither is worth it: the guard is a rail on the common shape, not\n * a proof.\n */\nexport class ScopeEscapeError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly fields: readonly string[],\n ) {\n const named = fields.map((field) => `'${field}'`).join(\", \");\n super(\n `${model}.${operation} writes ${named}, which ${model}'s policy also ` +\n `scopes on — so this update can move a row outside the scope that ` +\n `selected it, where the caller can no longer read or repair it.\\n\\n` +\n `Add an onUpdate to that policy. It may reassert the column ` +\n `(data => ({ ...data, ${fields[0]}: ctx.user.${fields[0]} })), reject ` +\n `the write, or allow it explicitly with (_ctx, data) => data — all ` +\n `three are fine, and the point is that the policy says which.`,\n );\n this.name = \"ScopeEscapeError\";\n }\n}\n\n/**\n * Thrown when a model class carries policies but is not the class the registry\n * resolves its name to.\n *\n * This exists because of a cross-tenant leak that shipped past review. The\n * generated `index.ts` registers the *generated* base — `register(\"Account\",\n * AccountModel)` — while an application authors its policy on a subclass:\n *\n * export class Account extends AccountModel {\n * static $policies = [{ scope: (ctx) => ({ organizationId: … }) }]\n * }\n *\n * A root query goes through `Account`, so `policiesFor(this)` finds the policy\n * and the scope applies. A **nested** relation read resolves through the\n * registry, gets `AccountModel`, and walks a prototype chain the policy is not\n * on — so `User.findMany({ include: { accounts: true } })` returned every\n * tenant's accounts. Root queries scoped, nested reads unscoped: exactly the\n * Prisma behaviour policies exist to fix, and silent.\n *\n * Raised at the first query through the unregistered class, naming the one-line\n * fix, because the alternative is data crossing a tenant boundary with nothing\n * to notice it.\n *\n * It fires on a divergence in the resolved policy *chain*, not merely on the two\n * classes differing. A plain subclass that adds no policy of its own inherits\n * the same policy objects in the same order, so a nested read resolving to its\n * parent applies exactly what the root query applied — no divergence, nothing\n * to refuse. An earlier version compared class identity and rejected\n * `class AdminUser extends User {}` for policies it had not written.\n */\nexport class UnregisteredPolicyClassError extends Error {\n constructor(\n public readonly model: string,\n /**\n * Under `carries: \"narrowing\"` this is the *ancestor* — the class the model\n * belongs to — rather than whatever the registry currently holds. The two\n * classes are on one prototype chain there, and which of them is registered\n * is the thing in question, so naming them by their relationship is what\n * makes the message readable.\n */\n public readonly registered: string,\n /** Under `carries: \"narrowing\"`, the descendant: the view that narrows. */\n public readonly queried: string,\n /**\n * Which side carries the policies that would be skipped, and therefore what\n * the author should do about it. Three, because they need three different\n * answers: a missing registration, a query through the wrong class, and a\n * view that should not be competing for the name at all.\n */\n public readonly carries: \"queried\" | \"registered\" | \"narrowing\" = \"queried\",\n ) {\n super(\n carries === \"narrowing\"\n ? `${queried} extends ${registered}, which owns the model '${model}', ` +\n `and carries policies of its own on top of it. A class that ` +\n `narrows an existing model is a view, and the registry holds one ` +\n `class per name — so registering ${queried} would apply its ` +\n `narrowing to every nested read of ${model}, and leaving ` +\n `${registered} registered would skip ${queried}'s policies ` +\n `entirely. Neither is a thing to choose for you.\\n\\n` +\n `Keep the view out of the modules you hand to Kernel.models, and ` +\n `query it directly where you want it:\\n\\n` +\n ` ${queried}.findMany(…) // narrowed, at the call site\\n\\n` +\n `If it is not a view but the model itself, move the policies onto ` +\n `${registered} — the class the model's name resolves to — and ` +\n `${queried} inherits them everywhere.\\n`\n : carries === \"queried\"\n ? `${queried} carries policies but the registry resolves '${model}' to ` +\n `${registered}. Nested relation reads go through the registry, so ` +\n `they would run on ${registered} and skip every policy on ` +\n `${queried} — scoped at the root, unscoped inside an include. ` +\n `Register the class that carries the policy:\\n\\n` +\n ` import { register } from \"gemi/orm\"\\n` +\n ` export class ${queried} extends ${registered} { … }\\n` +\n ` register(\"${model}\", ${queried})\\n`\n : `This query goes through ${queried}, but the registry resolves ` +\n `'${model}' to ${registered}, which carries policies ${queried} ` +\n `does not. Nested relation reads would be scoped and this query is ` +\n `not — the same policy applying to some queries and not others. ` +\n `Query ${registered} instead:\\n\\n` +\n ` ${registered}.findMany(…)\\n\\n` +\n `If skipping policies is intended, say so at the call site — that ` +\n `is what Model.asSystem() is for, and it is the only way to do it ` +\n `that a reader can see.\\n`,\n );\n this.name = \"UnregisteredPolicyClassError\";\n }\n}\n\n/**\n * Thrown when a `$policies` array holds something that is not a usable policy.\n *\n * Every case it covers is refused today — by `tsc`, at the class declaration,\n * with `TS2417`, because `Model` declares `static $policies?: readonly\n * PolicyEntry[]` and `ModelPolicy`'s members are all optional, so a typo'd key\n * trips weak-type detection. This is therefore a guard on the paths that import\n * user code *without* having type-checked it: `registerModels` at boot, and\n * `gemi check models`, whose whole job is to find mistakes in a file somebody is\n * still writing.\n *\n * Two failures, and the second is the one that matters.\n *\n * **A function the ORM cannot get a policy out of.** `resolveEntry` instantiates\n * every function entry with no arguments, and there are two ways that goes\n * wrong. A factory nobody called — `softDeletes` rather than\n * `softDeletes({ field })` — is not constructable at all and reached `new entry`\n * to produce `TypeError: function is not a constructor`. A class that *is*\n * constructable and whose constructor wants an argument gets through that check\n * and dies inside its own body instead, with\n * `TypeError: undefined is not an object (evaluating 'opts.field')`. Both are\n * loud and neither named the model, the index or the file, which on a 79-model\n * app leaves the first question unanswered; the second is the case that survived\n * a first pass at this error, because \"constructable\" is a fact about\n * `[[Construct]]` and says nothing about what the constructor then does.\n *\n * **An entry with no recognised hook.** `{ scopes: … }` and\n * `{ default: { scope: … } }` were accepted in silence: `applyPolicies`\n * dispatches on `before` / `scope` / `onCreate` / `onUpdate` and\n * `applyRedaction` on `redact`, so an entry spelling none of them contributes\n * nothing. The model then carries a visible `$policies` array, passes\n * `gemi check models` as correctly registered, and **reads unscoped** — the same\n * written-believed-not-in-effect shape `UnregisteredPolicyClassError` exists\n * for, arriving through a typo instead of through the registry.\n *\n * The line between *empty but valid* and *malformed* is drawn at \"would this\n * ever run\": an entry with at least one recognised hook that is callable is\n * accepted whatever else it carries, because a factory's return value and a\n * policy class routinely hold configuration and helpers beside the hooks, and\n * refusing unknown *extra* keys would reject code that works. An entry with no\n * callable hook at all is refused, `{}` included — it is indistinguishable from\n * a policy that was meant to do something, and a conditional policy belongs in\n * the array rather than in the entry.\n */\nexport class InvalidPolicyEntryError extends Error {\n constructor(\n /**\n * The class whose **own** `$policies` array holds the entry — the class the\n * author wrote the array on, which is not necessarily the model being\n * queried when the array is on a base.\n */\n public readonly model: string,\n /** The entry's index in that array. */\n public readonly index: number,\n public readonly reason:\n | \"not-a-policy\"\n | \"not-constructable\"\n | \"constructor-threw\"\n | \"no-hooks\"\n | \"hook-not-callable\",\n /** What was found in the entry's place, rendered for a human. */\n public readonly found: string,\n /**\n * The hook names the runtime dispatches on, supplied by `policy.ts` so the\n * list lives beside the code that reads it rather than being restated here.\n */\n hooks: readonly string[],\n /**\n * A key the entry actually spells and the hook it is within one edit of.\n *\n * **The pair, not the hook alone.** An unattributed \"Did you mean `scope`?\"\n * after a list of five keys does not say which of them was read as a\n * misspelling, so a reader who can see that none of them are has no way to\n * dismiss it — and this error is about an authorization rule that is not in\n * effect, where a suggestion followed wrongly costs a rename of something\n * that was never the problem.\n */\n public readonly suggestion?: { key: string; hook: string },\n options?: { cause?: unknown },\n ) {\n const where = `${model}.$policies[${index}]`;\n const named =\n hooks.length > 1\n ? `${hooks.slice(0, -1).join(\", \")} or ${hooks[hooks.length - 1]}`\n : (hooks[0] ?? \"\");\n\n super(\n reason === \"not-a-policy\"\n ? `${where} is ${found}, which is not a policy. An entry is either a ` +\n `policy object — { scope, onCreate, … } — or a class the ORM ` +\n `constructs with no arguments.\\n\\n` +\n `A policy that only sometimes applies belongs in the array rather ` +\n `than in the entry:\\n\\n` +\n ` static $policies = [...(multiTenant ? [tenantScope] : [])]\\n`\n : reason === \"not-constructable\"\n ? `${where} is ${found}, and a function entry is instantiated with ` +\n `no arguments — so an arrow function, a plain function, or a ` +\n `factory that was never called cannot be one.\\n\\n` +\n `If it is a factory, call it:\\n\\n` +\n ` static $policies = [softDeletes({ field: \"deletedAt\" })]\\n`\n : reason === \"constructor-threw\"\n ? `${where} is ${found}\\n\\n` +\n `A class entry is constructed with no arguments. If this one ` +\n `needs some, construct it yourself and put the instance in the ` +\n `array:\\n\\n` +\n ` static $policies = [new TenantPolicy({ field: \"orgId\" })]\\n\\n` +\n `If the constructor reaches for something that is not ready yet, ` +\n `note that it runs on the first query through this model, not at ` +\n `boot.\\n`\n : reason === \"hook-not-callable\"\n ? `${where} has a ${found}, and every hook is called — so this ` +\n `would throw on the first query that reached it rather than ` +\n `doing whatever it was meant to do. Give it a function, or ` +\n `leave the key out.\\n`\n : `${where} has none of ${named}, so it would never run. The ` +\n `model carries a visible $policies array and nothing in it ` +\n `applies to any query — which for a scope means the model ` +\n `reads unscoped. ${found}` +\n (suggestion\n ? ` Is '${suggestion.key}' meant to be \\`${suggestion.hook}\\`?`\n : \"\") +\n `\\n`,\n options,\n );\n this.name = \"InvalidPolicyEntryError\";\n }\n}\n\n/**\n * Thrown when `registerModels` finds two unrelated classes in one module both\n * claiming the same model name.\n *\n * Deriving registration from a module namespace works because the candidates\n * are normally a chain — a generated base, the application's subclass, perhaps\n * a typed view over it — and a chain has a least element to elect. Two classes\n * that extend the same base without extending each other do not: both were\n * written for this model, and only the author knows which one nested reads\n * should run.\n *\n * Refused rather than guessed at, because both guesses are silent. Picking\n * either would scope every `include` of the model by one class's policies while\n * the other's code keeps reading as though its own applied.\n *\n * **\"In one module\" is the exact scope, and the asymmetry is deliberate.**\n * Election happens per module, so two unrelated claims split across *different*\n * modules never meet inside one — the later import simply wins. What catches\n * that is the audit at the end of `registerModels` rather than this error, and\n * only when the two diverge in policies. Two unrelated *unpolicied* claims on\n * one name resolve by import order and nothing reports it, which is tolerable\n * for the same reason it is invisible: with no policies on either, the choice\n * changes no query's scope.\n */\nexport class AmbiguousModelRegistrationError extends Error {\n constructor(\n public readonly model: string,\n public readonly candidates: readonly string[],\n ) {\n const named = candidates.map((candidate) => `'${candidate}'`).join(\", \");\n super(\n `Two classes in one module claim the model '${model}' — ${named} — and ` +\n `neither extends the other, so there is no way to tell which one ` +\n `nested relation reads should run.\\n\\n` +\n `Say which, and registerModels will leave it alone:\\n\\n` +\n ` import { register } from \"gemi/orm\"\\n` +\n ` register(\"${model}\", ${candidates[0]})\\n\\n` +\n `A class that is only a typed view over the same rows belongs in a ` +\n `module you do not hand to registerModels.`,\n );\n this.name = \"AmbiguousModelRegistrationError\";\n }\n}\n\n/**\n * Thrown when a statement would bind more parameters than the driver's wire\n * protocol can carry.\n *\n * Three shapes reach it, all of them scaling with the caller's *data* rather\n * than with the query's shape: `createMany` at `rows × columns`, an `in` list on\n * SQLite (one placeholder per element, and such a list is routinely\n * request-derived), and a to-many `include` on SQLite, which batches an `in`\n * over the parent keys. Both limits are hard and low enough to hit with an\n * ordinary import — Postgres counts parameters in an int16 (65535), SQLite\n * defaults `SQLITE_MAX_VARIABLE_NUMBER` to 32766. Postgres escapes the last two\n * either way: `= any($1)` is one parameter however long the array.\n *\n * Prisma chunks the insert automatically. Doing that here means several\n * statements, which without a transaction is a partially-applied `createMany`\n * on failure — so it waits for iteration 5, and until then this is a named gap\n * rather than a driver error naming neither the model nor the cause. Same\n * treatment as `ReturningUnsupportedError`, for the same reason.\n */\nexport class ParameterLimitError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly required: number,\n public readonly limit: number,\n public readonly dialect: string,\n detail: string,\n ) {\n super(\n `${model}.${operation} would bind ${required} parameters, and the ` +\n `'${dialect}' driver accepts at most ${limit} in one statement. ` +\n `${detail}` +\n (operation === \"createMany\"\n ? ` A createMany over the ceiling is normally split across statements ` +\n `inside one transaction, so reaching this means splitting cannot ` +\n `help: a single row binds more than the driver accepts.`\n : ` Splitting is not something this operation can do for you — one ` +\n `statement has to carry one answer. Narrow the query.`),\n );\n this.name = \"ParameterLimitError\";\n }\n}\n\n/**\n * Thrown when a write omits a column that has no value to fall back on: not\n * supplied, no client-side default, no database default, and not nullable.\n *\n * Raised in the compiler rather than left to the database so the message names\n * the field and the model, instead of surfacing as `NOT NULL constraint failed`\n * with a column name and no context.\n */\nexport class MissingRequiredValueError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n public readonly field: string,\n ) {\n super(\n `${model}.${operation} is missing a value for '${field}', which is ` +\n `required and has no default.`,\n );\n this.name = \"MissingRequiredValueError\";\n }\n}\n\n/**\n * Thrown when an `include` — or a relation-shaped key inside a `select` — names\n * something the model does not declare as a relation.\n */\nexport class UnknownRelationError extends Error {\n constructor(\n public readonly relation: string,\n public readonly model: string,\n known: string[],\n ) {\n super(\n `'${relation}' is not a relation on model ${model}. ` +\n (known.length > 0\n ? `Known relations: ${known.join(\", \")}.`\n : `${model} declares no relations.`),\n );\n this.name = \"UnknownRelationError\";\n }\n}\n\n/**\n * Thrown when an include tree nests deeper than the guard allows.\n *\n * A cyclic include is legal and finite — `user -> accounts -> user` terminates\n * because the caller wrote a finite tree. What this catches is an *unbounded*\n * one: an argument tree built by a loop, or forwarded from a request body, that\n * describes a thousand levels. Under the batched planner every level is at least\n * one query, so the guard is what stops a malformed argument from becoming a\n * self-inflicted denial of service.\n */\nexport class RelationDepthExceededError extends Error {\n constructor(\n public readonly model: string,\n public readonly limit: number,\n ) {\n super(\n `The include tree nests more than ${limit} relations deep (at model ` +\n `${model}). Deeply nested includes are legal, so this is a guard ` +\n `against a generated or malformed argument tree rather than a limit on ` +\n `modelling — every level costs at least one query.`,\n );\n this.name = \"RelationDepthExceededError\";\n }\n}\n\n/**\n * Thrown when a relation names a model the registry does not hold. Every\n * relation in a generated artifact was emitted from a model in the same\n * `schema.prisma`, so this can only mean the artifact and the registry disagree.\n */\nexport class UnregisteredRelationTargetError extends Error {\n constructor(\n public readonly model: string,\n public readonly relation: string,\n public readonly target: string,\n known: string[],\n ) {\n super(\n `${model}.${relation} points at model '${target}', which nothing has ` +\n `registered. The generated artifact and the registry disagree: re-run ` +\n `\\`prisma generate\\`, and check that app/models/generated/index.ts is ` +\n `imported. ` +\n (known.length > 0\n ? `Registered models: ${known.join(\", \")}.`\n : `Nothing is registered at all.`),\n );\n this.name = \"UnregisteredRelationTargetError\";\n }\n}\n\n/**\n * Thrown when a relation is registered on both sides but the two sides do not\n * describe a link the planner can follow: no matching `relationName` on the\n * other model, or a `from` / `to` naming a field that is not there. Like\n * `UnregisteredRelationTargetError`, it means a stale generated artifact — a\n * consistent one cannot produce it.\n */\nexport class MalformedRelationError extends Error {\n constructor(\n public readonly model: string,\n public readonly relation: string,\n detail: string,\n ) {\n super(\n `Cannot resolve how ${model}.${relation} joins: ${detail} This means ` +\n `app/models/generated is stale or hand-edited — re-run ` +\n `\\`prisma generate\\`.`,\n );\n this.name = \"MalformedRelationError\";\n }\n}\n\n/** Thrown when a relation resolves to a model name nothing registered. */\nexport class ModelNotRegisteredError extends Error {\n constructor(name: string, known: string[]) {\n super(\n `No model is registered under the name '${name}'. ` +\n (known.length > 0\n ? `Registered models: ${known.join(\", \")}.`\n : `Nothing is registered — is app/models/generated/index.ts imported?`),\n );\n this.name = \"ModelNotRegisteredError\";\n }\n}\n\n/** Thrown when a model class is used before the generator has given it a schema. */\nexport class MissingModelSchemaError extends Error {\n constructor(className: string) {\n super(\n `${className} has no $schema. Model subclasses must extend a generated ` +\n `base class from app/models/generated/models.ts.`,\n );\n this.name = \"MissingModelSchemaError\";\n }\n}\n\n/**\n * A `lock` asked for outside a transaction.\n *\n * A row lock is held until the transaction that took it ends. Outside one, the\n * statement is its own transaction, so the lock is released the moment the row\n * comes back — before the write it was meant to guard has even been issued. The\n * read would succeed and protect nothing, which is the failure this refuses: the\n * race the lock was written to close stays open, silently.\n *\n * Raised on SQLite too, where the lock itself compiles to nothing, so code that\n * forgot its transaction fails in development rather than first on Postgres.\n */\nexport class LockOutsideTransactionError extends Error {\n constructor(\n public readonly model: string,\n public readonly operation: string,\n ) {\n super(\n `${model}.${operation} was given 'lock' outside a transaction. A row ` +\n `lock lasts until the transaction that took it ends, so outside one it ` +\n `is released as soon as the row is read and protects nothing. Run the ` +\n `read and the writes it guards inside Model.transaction(async () => { ` +\n `... }).`,\n );\n this.name = \"LockOutsideTransactionError\";\n }\n}\n",
|
|
6
5
|
"import type { SqlDialect } from \"../dialect\";\nimport { ParameterLimitError } from \"../errors\";\n\n/**\n * Pulls one value out of the argument tree at bind time. Compilation closes\n * over the *path* to a value, never the value itself — that is what makes two\n * calls with the same argument shape and different values produce byte\n * identical SQL, and it is what the plan cache depends on.\n *\n * Writes add a second source: values that do not exist in the argument tree at\n * all. A `@default(cuid())` is minted per call, `@default(now())` has to be the\n * *same* instant across every field and row of one logical operation, and a\n * nested `create` produces a foreign key only once its own insert has run. All\n * three arrive through the context rather than through `args`, so the binder\n * stays a pure function of (arguments, call) and compilation stays pure.\n */\nexport type Binder = (args: any, context: BindContext) => unknown;\n\n/**\n * Per-call state a binder may read. Created once per `$exec`, never cached with\n * the plan — a plan outlives the call, and `now` must not.\n */\nexport interface BindContext {\n /**\n * One instant for the whole operation. Prisma returns `createdAt` and\n * `updatedAt` from a single `create` as the same instant (verified against\n * 6.19.2), which reading the clock per field would not reproduce.\n */\n now: Date;\n /**\n * Values produced before the main statement runs, keyed by field name. Today\n * that is exactly the foreign keys a nested `connect` or `create` resolved.\n */\n resolved: Record<string, unknown>;\n}\n\nexport function createBindContext(): BindContext {\n return { now: new Date(), resolved: {} };\n}\n\n/**\n * The default context for a read. Reads never consult it, but `bind` takes one\n * argument on every path so the choke point does not have to branch.\n */\nconst READ_CONTEXT: BindContext = { now: new Date(0), resolved: {} };\n\n/** Turns a compiled binder list into a plan's `bind`. */\nexport function bindValues(\n binders: Binder[],\n): (args: any, context?: BindContext) => unknown[] {\n return (args: any, context: BindContext = READ_CONTEXT) => {\n const values: unknown[] = [];\n for (let i = 0; i < binders.length; i++) {\n values.push(binders[i](args, context));\n }\n return values;\n };\n}\n\n/**\n * Marks a parameter position inside a fragment's text. Placeholders are only\n * rendered once the whole statement is assembled, because Postgres numbers them\n * (`$1`, `$2`) and the number is not knowable until a fragment's position in\n * the final statement is fixed. A sentinel rather than a shared mutable counter\n * is what lets fragments compose in any order without corrupting parameter\n * ordering.\n *\n * NUL cannot appear in an identifier from the schema and never appears in the\n * keywords the compiler emits, so it cannot collide with real text.\n */\nconst PARAM_MARKER = \"\\u0000\";\n\nexport interface Fragment {\n text: string;\n binders: Binder[];\n}\n\n/** A fragment with no parameters: keywords, quoted identifiers, punctuation. */\nexport function sql(text: string): Fragment {\n return { text, binders: [] };\n}\n\n/**\n * A single parameter position, bound from the argument tree at call time.\n *\n * `cast` is SQL appended immediately after the placeholder — `$1::text::jsonb`.\n * It rides as ordinary text rather than as a parallel array because the marker\n * is replaced in place at render, so text following it needs no bookkeeping and\n * cannot fall out of step with the binders.\n *\n * Only a dialect may supply one, and only from a constant: it is the one string\n * here that reaches the statement without being a parameter. See\n * `castParameter`.\n */\nexport function param(binder: Binder, cast = \"\"): Fragment {\n return { text: PARAM_MARKER + cast, binders: [binder] };\n}\n\n/**\n * A fragment's text cut at every parameter: `segments[i]` is the text that\n * precedes parameter `i`, and `segments[i + 1]` the text that follows it. The\n * inverse is `fromParamSegments`.\n *\n * It exists so that one caller — `renderFragment` — can read *what the author\n * wrote next to a parameter* before placeholders are assigned. A `::jsonb` a\n * caller wrote onto their own placeholder is the only thing that says a raw\n * parameter is JSON, and it is only readable here, in the marker's own\n * coordinates; after `render` the text holds `$1` and the segment boundaries\n * are gone.\n *\n * Nothing in the compiler uses this. A plan's casts come from the dialect and\n * are already correct, and re-deriving them from text would be a second,\n * weaker source for something the schema already answers.\n */\nexport function paramSegments(fragment: Fragment): string[] {\n return fragment.text.split(PARAM_MARKER);\n}\n\n/** `paramSegments` reversed: the segments woven back around the markers. */\nexport function fromParamSegments(\n segments: readonly string[],\n binders: Binder[],\n): Fragment {\n return { text: segments.join(PARAM_MARKER), binders };\n}\n\nexport function concat(...parts: Fragment[]): Fragment {\n return joinFragments(parts, \"\");\n}\n\nexport function joinFragments(parts: Fragment[], separator: string): Fragment {\n let text = \"\";\n const binders: Binder[] = [];\n for (let i = 0; i < parts.length; i++) {\n if (i > 0) text += separator;\n text += parts[i].text;\n for (const binder of parts[i].binders) binders.push(binder);\n }\n return { text, binders };\n}\n\n/**\n * Replace every parameter marker with the dialect's placeholder for its\n * position. Runs once per compiled plan, never per call.\n */\nexport function render(\n fragment: Fragment,\n dialect: SqlDialect,\n /**\n * Where the statement came from, for the parameter-ceiling error.\n *\n * Required, and deliberately so. Optional would reintroduce in miniature the\n * hole this check exists to close — a new call site that omits it skips the\n * ceiling silently, which is the same failure as a per-compiler guard, one\n * level down. Making it required is the difference between a convention and\n * something `tsc` enforces. A test that wants to render bare can pass\n * `{ model: \"test\", operation: \"test\" }`.\n */\n origin: { model: string; operation: string },\n): { text: string; binders: Binder[] } {\n const segments = fragment.text.split(PARAM_MARKER);\n const count = segments.length - 1;\n\n if (count !== fragment.binders.length) {\n // Unreachable unless a fragment was built by hand with a mismatched count.\n // Worth an assertion rather than a subtly misaligned parameter array.\n throw new Error(\n `Compiled ${count} parameter placeholders but collected ` +\n `${fragment.binders.length} binders.`,\n );\n }\n\n // The parameter ceiling, checked here because this is the one place that\n // knows a *statement's* final count — and because a guard at any single\n // compiler is a guard the next compiler forgets.\n //\n // It started life inside `compileCreateMany`, on the reasoning that\n // `rows × columns` was the only count that scaled with the caller's data.\n // That was wrong: on SQLite an `in` list binds one placeholder per element,\n // so `findMany({ where: { id: { in: <40 000 ids> } } })` walks into the same\n // driver error, and such a list is routinely request-derived. The relation\n // loader has the same shape, batching an `in` over the parent keys — so a\n // large `findMany` with an `include` reaches it without anyone writing a big\n // list by hand. Postgres is unaffected either way: `= any($1)` is one\n // parameter however long the array.\n //\n // Compile-time is exact rather than approximate, on both dialects: where the\n // length changes the placeholder count it also changes the SQL text, so it is\n // already part of the plan's identity.\n if (count > dialect.maxBoundParameters) {\n throw new ParameterLimitError(\n origin.model,\n origin.operation,\n count,\n dialect.maxBoundParameters,\n dialect.name,\n dialect.bindsListAsOneParameter\n ? `That is one parameter per value in the statement.`\n : `That is one parameter per value, and on ${dialect.name} each ` +\n `element of an 'in' list counts separately.`,\n );\n }\n\n let text = segments[0];\n for (let i = 0; i < count; i++) {\n text += dialect.placeholder(i) + segments[i + 1];\n }\n\n return { text, binders: fragment.binders };\n}\n",
|
|
7
6
|
"import type { Dialect } from \"../../database/dialect\";\nimport {\n type Binder,\n type Fragment,\n concat,\n param,\n sql,\n} from \"../compile/fragment\";\nimport type { RowLockClause } from \"../compile/lock\";\nimport { DecodeError } from \"../errors\";\nimport type { FieldSchema, ScalarType } from \"../schema\";\nimport type { ConstraintViolation, SqlDialect } from \"./index\";\n\n// Postgres has real `timestamptz`, `boolean`, `numeric` and `jsonb` types, so\n// its driver already returns what Prisma returns and `decode` is almost\n// entirely a pass-through. That asymmetry with SQLite is the point: the same\n// query returns the same JavaScript values on both dialects, which is exactly\n// what the differential harness checks.\nexport class PostgresDialect implements SqlDialect {\n readonly name: Dialect = \"postgres\";\n\n // `ilike`. Note this makes the *default* `contains` case-*sensitive* here and\n // case-insensitive on SQLite, because SQLite's `like` is ASCII-insensitive\n // and has no way to opt out. Prisma has the same split; gemi matches Prisma\n // per dialect rather than inventing a uniformity Prisma does not have.\n readonly supportsInsensitiveMode = true;\n\n // `= any($1)`: one parameter, one SQL text, one plan for every list length.\n readonly bindsListAsOneParameter = true;\n\n readonly supportsReturning = true;\n\n // The wire protocol's Bind message carries the parameter count as an int16,\n // so 65535 is the ceiling for any client, not a Bun or a server setting. Past\n // it the driver's error names neither the model nor the cause.\n readonly maxBoundParameters = 65535;\n\n // The server describes the statement and Bun encodes to the type it is told,\n // which is why a `::jsonb` on the placeholder changes what a JS string means.\n // See `json-param.ts`.\n readonly typesParametersFromStatement = true;\n\n quoteIdent(name: string): string {\n // See the SQLite implementation: NUL is the parameter sentinel in\n // compile/fragment.ts, so it is the one character that could shift a\n // placeholder's position rather than merely produce broken SQL.\n if (name.includes(\"\\u0000\")) {\n throw new Error(\n `Refusing to quote the identifier ${JSON.stringify(name)}: it contains ` +\n `a NUL byte, which is reserved as the parameter marker.`,\n );\n }\n return `\"${name.replace(/\"/g, '\"\"')}\"`;\n }\n\n placeholder(index: number): string {\n return `$${index + 1}`;\n }\n\n // The whole array binds to a single parameter, so every list length shares one\n // SQL text — one plan cache entry and one prepared statement, instead of one\n // per distinct length the way SQLite needs. That matters more from iteration 3\n // on, where every batched relation query is an `in` over the parent keys and\n // the list length is the *number of parent rows*.\n //\n // The array is serialized to a Postgres array literal rather than handed over\n // as a JS array: Bun's driver rejects an array bound to a `= any($1)`\n // parameter outright — `insufficient data left in message` for numbers,\n // `malformed array literal` for strings. It is still one bound parameter and\n // still never touches the SQL text, so nothing about the injection story or\n // the plan cache changes.\n inList(\n lhs: string,\n negated: boolean,\n _length: number,\n values: Binder,\n ): Fragment {\n const operator = negated ? \"<> all\" : \"= any\";\n return concat(\n sql(`${lhs} ${operator} (`),\n param((args, context) => arrayLiteral(values(args, context) as unknown[])),\n sql(\")\"),\n );\n }\n\n /**\n * The SQL type each Prisma scalar takes inside an `unnest` cast.\n *\n * **Deliberately not the whole table.** Only the types a composite join key\n * realistically uses are here, and anything else falls back to the portable\n * `OR` rather than being guessed at — the cast has to round-trip the value\n * exactly, and a wrong one is silently wrong rows rather than an error.\n *\n * `DateTime` is the instructive absence: Prisma maps it to `timestamp(3)`,\n * and this driver's own note records that a zoneless timestamp decodes\n * differently depending on which protocol the statement used. Putting that\n * through a text array literal adds a second representation question to one\n * that is already open, for a key type nobody joins on.\n */\n private static readonly COMPOSITE_IN_TYPES: Partial<\n Record<ScalarType, string>\n > = {\n Int: \"int\",\n BigInt: \"bigint\",\n String: \"text\",\n Boolean: \"boolean\",\n };\n\n canBindCompositeIn(types: readonly ScalarType[]): boolean {\n return (\n types.length > 0 &&\n types.every((type) => PostgresDialect.COMPOSITE_IN_TYPES[type])\n );\n }\n\n /**\n * `(a, b) in (select * from unnest($1::int[], $2::text[]))`.\n *\n * **One parameter per column, not per parent**, which is the whole point:\n * the text is fixed however many tuples arrive, so a batched composite\n * `include` is one plan entry rather than one per parent count (#97). The\n * `OR` it replaces costs a placeholder per field *per parent* and a plan key\n * per length.\n *\n * The tuples arrive row-wise — one array per parent — and are transposed\n * here, because that is the shape the loader has and the shape `unnest`\n * needs. Serialized as Postgres array literals for the reason `inList`\n * already documents: this driver rejects a JS array bound against an array\n * parameter, and the literal is still one bound value that never touches the\n * SQL text.\n */\n compositeIn(\n columns: readonly string[],\n types: readonly ScalarType[],\n values: Binder,\n ): Fragment {\n const arrays = columns.map((_column, index) =>\n concat(\n param((args, context) =>\n arrayLiteral(\n (values(args, context) as unknown[][]).map((tuple) => tuple[index]),\n ),\n ),\n sql(`::${PostgresDialect.COMPOSITE_IN_TYPES[types[index]]}[]`),\n ),\n );\n\n return concat(\n sql(`(${columns.join(\", \")}) in (select * from unnest(`),\n ...arrays.flatMap((array, index) =>\n index === 0 ? [array] : [sql(\", \"), array],\n ),\n sql(\"))\"),\n );\n }\n\n /**\n * Everything Prisma exposes on a scalar list, because `text[]` can express\n * all of it (#300).\n *\n * `equals` is in the set even though it is compiled by the generic `equals`\n * path rather than by a method here: the set is what the compiler consults to\n * decide whether a list filter is *available at all*, and leaving it out\n * would make `{ tags: [\"a\"] }` — the bare-array shorthand — refuse itself on\n * the one dialect that can serve it.\n */\n readonly listFilters: ReadonlySet<string> = new Set([\n \"equals\",\n \"has\",\n \"hasEvery\",\n \"hasSome\",\n \"isEmpty\",\n ]);\n\n /**\n * `$1 = any(\"tags\")` — the element on the left, which is the mirror of\n * {@link inList} and worth not confusing with it. There, one column is\n * matched against a caller's list; here, one caller value is matched against\n * a column that *is* a list.\n *\n * No cast is added *here*, in this method or the three below. An untyped\n * array literal resolves against the column's own element type in every one\n * of these positions — measured through Bun 1.3.14 against Postgres 16 on\n * `text[]`, `jsonb[]`, `bytea[]`, `timestamp(3)[]` and an `enum[]`. That is\n * not merely convenient: an explicit cast would have to *name* the element\n * type, and for an enum that name is the database's own enum type, which the\n * generated artifact does not carry. Leaning on inference is what lets enum\n * lists work without widening the artifact.\n *\n * **The operand is a `Fragment`, not a `Binder`**, and `Json` is why. A\n * single element of a `Json[]` still needs #209's `::text::jsonb`, and it\n * needs the serialisation that travels with it — so the parameter is built by\n * `fieldParam` before it gets here, and this method only picks the operator.\n * Measured, because every wrong form fails *silently*:\n *\n * $1 = any(docs) {\"a\":1} -> false\n * $1::jsonb = any(docs) {\"a\":1} -> false\n * $1::text::jsonb = any(docs) {\"a\":1} -> true\n *\n * No error on either of the first two. A dialect that built its own parameter\n * here would have to restate `fieldParam`'s rule, and the version that\n * restated it slightly wrong would return \"no rows\" rather than raising.\n */\n listHas(column: string, value: Fragment): Fragment {\n return concat(value, sql(` = any(${column})`));\n }\n\n /** `\"tags\" @> $1` — containment: every element of the operand is present. */\n listHasEvery(column: string, values: Fragment): Fragment {\n return concat(sql(`${column} @> `), values);\n }\n\n /** `\"tags\" && $1` — overlap: at least one element is shared. */\n listHasSome(column: string, values: Fragment): Fragment {\n return concat(sql(`${column} && `), values);\n }\n\n /**\n * `\"tags\" = $1` against the empty array, rather than `cardinality(…) = 0`.\n *\n * The two are equivalent on a non-null column — and a scalar list cannot be\n * null, since Prisma refuses `String[]?` — including on the NULL case, where\n * both yield NULL and so exclude the row.\n *\n * The comparison is the one that keeps the invariant `FALSE` is spelled\n * `false` for: **no digit reaches the SQL text outside an identifier**. A\n * literal `0` would be the first, for a constant the compiler already knows —\n * which is exactly the exception `jsonNullComparison` declines to make.\n */\n listIsEmpty(column: string, empty: boolean): Fragment {\n return concat(\n sql(`${column} ${empty ? \"=\" : \"<>\"} `),\n param(() => arrayLiteral([])),\n );\n }\n\n /**\n * `array_cat(\"tags\", $1)` — the right-hand side of a `push`.\n *\n * **`array_cat` rather than `||`**, and the difference is not stylistic.\n * `||` is overloaded `anyarray || anyarray` *and* `anyarray || anyelement`,\n * so an untyped parameter beside it is genuinely ambiguous — and Prisma's\n * `push` accepts both a single element and a list, which is precisely the\n * pair that would resolve differently. `array_cat` has one signature, so the\n * compiler can normalise `push` to an array once and the operator cannot be\n * read the other way.\n */\n listPush(column: string, values: Fragment): Fragment {\n return concat(sql(`array_cat(${column}, `), values, sql(\")\"));\n }\n\n /** `path: [\"a\", \"b\"]`, where SQLite takes `\"$.a.b\"`. Prisma's own split. */\n readonly jsonPathSyntax = \"array\" as const;\n\n /** Everything, which is what `jsonb` can express and Prisma exposes here. */\n readonly jsonFilters: ReadonlySet<string> = new Set([\n \"equals\",\n \"not\",\n \"string_contains\",\n \"string_starts_with\",\n \"string_ends_with\",\n \"array_contains\",\n \"lt\",\n \"lte\",\n \"gt\",\n \"gte\",\n ]);\n\n /** `#>>` yields `text`, so a comparison binds the value's text form. */\n readonly jsonComparesAsText = true;\n\n /**\n * `\"col\" #> $1` for the JSON value, `#>>` for its text.\n *\n * Both take the path as a **`text[]` parameter**, which is the whole reason\n * this is expressible without bending invariant 2 — the one place a caller's\n * value decides part of an expression's meaning, and it still never reaches\n * the SQL text. The array is serialized the same way `inList` serializes\n * one, for the same driver reason.\n */\n jsonExtract(column: string, path: Binder, asText: boolean): Fragment {\n return concat(\n sql(`${column} ${asText ? \"#>>\" : \"#>\"} `),\n param((args, context) => arrayLiteral(path(args, context) as unknown[])),\n );\n }\n\n /**\n * `(\"col\" #> $1)::jsonb` — the JSON value at the path, comparable.\n *\n * The cast is load-bearing on a `@db.Json` column and a no-op on the `jsonb`\n * one Prisma maps `Json` to by default. Measured against Postgres 16, on a\n * `json` column:\n *\n * (payload #> '{operation}') = 'null'::jsonb operator does not exist: json = jsonb\n * ((payload #> '{operation}')::jsonb) = 'null'::jsonb the row whose key holds a JSON null\n *\n * Prisma emits the same cast — `(\"Doc\".\"payload\"#>ARRAY[$1]::text[])::jsonb`\n * — which is where this one comes from rather than from the manual.\n */\n jsonValueAt(column: string, path: Binder): Fragment {\n return concat(\n sql(\"(\"),\n this.jsonExtract(column, path, false),\n sql(\")::jsonb\"),\n );\n }\n\n /**\n * `jsonb_typeof(doc) = 'object' and doc ? $1` — and `?|` / `?&` with a\n * `text[]` for the list forms, so every list length is one statement.\n *\n * The operators rather than `jsonb_exists()`: only the operator form can use\n * a GIN index on the column. `?` is not a placeholder here — Postgres numbers\n * its parameters `$n` — so nothing has to escape it. The `::jsonb` keeps a\n * `@db.Json` column working, which has no `?` operator of its own.\n */\n jsonHasKeys(\n column: string,\n path: Binder | undefined,\n keys: Binder,\n mode: \"one\" | \"some\" | \"every\",\n ): Fragment {\n const doc = (): Fragment =>\n path === undefined\n ? sql(`(${column})::jsonb`)\n : concat(sql(\"(\"), this.jsonExtract(column, path, false), sql(\")::jsonb\"));\n\n const operand =\n mode === \"one\"\n ? concat(param(keys), sql(\"::text\"))\n : concat(\n param((args, context) =>\n arrayLiteral((keys(args, context) as unknown[]) ?? []),\n ),\n sql(\"::text[]\"),\n );\n\n const operator = mode === \"one\" ? \"?\" : mode === \"some\" ? \"?|\" : \"?&\";\n\n return concat(\n sql(\"(jsonb_typeof(\"),\n doc(),\n sql(\") = 'object' and \"),\n doc(),\n sql(` ${operator} `),\n operand,\n sql(\")\"),\n );\n }\n\n /**\n * `is distinct from`, with the column cast to `jsonb` for a `Json` field so a\n * `@db.Json` column compares too — `json` has no equality operator.\n */\n distinctFrom(lhs: string, rhs: Fragment, field: FieldSchema): Fragment {\n const json = field.type === \"Json\" && !field.isList;\n return concat(\n sql(json ? `(${lhs})::jsonb is distinct from ` : `${lhs} is distinct from `),\n rhs,\n );\n }\n\n /**\n * `(\"col\" #> $1) @> $2` — containment, which is what Prisma's\n * `array_contains` compiles to and why it accepts both a scalar and a list:\n * `@>` asks whether the left document contains the right one, and a bare\n * value is a one-element containment test.\n */\n jsonArrayContains(column: string, path: Binder, value: Binder): Fragment {\n return concat(\n sql(\"(\"),\n this.jsonExtract(column, path, false),\n sql(\") @> \"),\n // **Raw, not `JSON.stringify`d**, and the cast is what makes that safe.\n // Bun already encodes a parameter bound against `jsonb` as JSON, so\n // stringifying first sends the *string* `\"[\\\"a\\\"]\"` rather than the\n // array — containment then asks whether a JSON array contains a JSON\n // string spelling of itself, which is `false`. No error, no rows.\n // Measured through the driver:\n //\n // raw scalar \"a\" -> true\n // raw array [\"a\"] -> true\n // JSON.stringify([\"a\"]) -> false <- what this used to send\n // raw number 3 -> cannot cast type integer to jsonb\n //\n // The last line is why the cast is explicit and the value is normalised:\n // a number has to become JSON text for the driver to type it as `jsonb`\n // at all.\n param((args, context) => {\n const raw = value(args, context);\n if (raw === null || raw === undefined) return null;\n return typeof raw === \"string\" || typeof raw === \"object\"\n ? raw\n : JSON.stringify(raw);\n }),\n sql(\"::jsonb\"),\n );\n }\n\n like(lhs: string, insensitive: boolean, pattern: Binder): Fragment {\n return concat(\n sql(`${lhs} ${insensitive ? \"ilike\" : \"like\"} `),\n param(pattern),\n );\n }\n\n // `on conflict do nothing` with no target: it covers every unique constraint\n // and the primary key at once, which is what `skipDuplicates` means — Prisma\n // names no conflict target either. A targeted `on conflict (col)` would skip\n // rows that collide on that column and still fail on any other constraint,\n // which is the plausible wrong version.\n //\n // Rows it skips are absent from `RETURNING`, so the `{ count }` the compiler\n // builds from the returned rows is the number *inserted* rather than the\n // number supplied — which is the part the issue flags as most likely to be\n // got wrong, and it falls out rather than needing a second count.\n ignoreConflicts(): Fragment {\n return sql(\" on conflict do nothing\");\n }\n\n // `of <table>`, so a lateral include in the same statement is not asked to\n // lock too — see `SqlDialect.rowLock`. The clause is built from constants\n // and a schema identifier only; nothing here comes from a value.\n rowLock(lock: RowLockClause, table: string): Fragment {\n const onLocked =\n lock.onLocked === \"skipLocked\"\n ? \" skip locked\"\n : lock.onLocked === \"noWait\"\n ? \" nowait\"\n : \"\";\n return sql(\n ` for ${lock.mode === \"share\" ? \"share\" : \"update\"} of ` +\n `${this.quoteIdent(table)}${onLocked}`,\n );\n }\n\n // Unlike SQLite, Postgres accepts `offset` on its own, so neither clause has\n // to be invented to satisfy the other.\n paginate(take: Binder | null, skip: Binder | null): Fragment {\n const parts: Fragment[] = [];\n if (take) parts.push(concat(sql(\" limit \"), param(take)));\n if (skip) parts.push(concat(sql(\" offset \"), param(skip)));\n return concat(...parts);\n }\n\n // Postgres reports a duplicate key as SQLSTATE 23505, and unlike SQLite it\n // carries structured fields alongside the message. Read off a live server\n // through Bun rather than from the Postgres manual, because the placement is\n // the surprise:\n //\n // name: 'PostgresError'\n // code: 'ERR_POSTGRES_SERVER_ERROR' <- Bun's own code, not the SQLSTATE\n // errno: '23505' <- the SQLSTATE lives here\n // constraint: 'User_email_key'\n // detail: 'Key (email)=(a@x) already exists.'\n // table: 'User'\n //\n // Checking `code` alone — the obvious reading, and the one this started with\n // — matches nothing at all, so every unique violation escaped as a raw driver\n // error. Both are consulted now: `errno` is where Bun puts it today, and\n // `code` is where a driver following the `pg` convention would.\n //\n // The class code `23` covers integrity violations generally — 23502 not-null,\n // 23503 foreign key, 23514 check — so matching the *full* five characters is\n // what keeps those from being reported as duplicate keys.\n //\n // Only the constraint name is taken as authoritative. `detail` is parsed\n // best-effort for the column list because Postgres localises it: on a server\n // with `lc_messages` set to anything but English the prefix is not `Key`, and\n // the regex simply does not match. That degrades to a violation with no\n // columns — still typed, still catchable, still naming the constraint — rather\n // than to a wrong column list.\n constraintViolation(error: unknown): ConstraintViolation | null {\n const source = error as Record<string, unknown> | null;\n if (!source) return null;\n\n const sqlstate = String(source.errno ?? source.code ?? \"\");\n if (sqlstate !== \"23505\") return null;\n\n const constraint =\n typeof source.constraint === \"string\" && source.constraint !== \"\"\n ? source.constraint\n : undefined;\n\n const detail = typeof source.detail === \"string\" ? source.detail : \"\";\n const listed = /\\((.+?)\\)=/.exec(detail);\n // The detail quotes any column that is not all lowercase, as it would in\n // SQL: `Key (provider, \"providerId\")=…`. Tokenised rather than split on\n // `,`, since a quoted name can hold a comma; then unquoted, or the column\n // list names a field nobody declared.\n const columns = listed\n ? (listed[1].match(/\"(?:[^\"]|\"\")*\"|[^,]+/g) ?? [])\n .map((entry) => entry.trim())\n .filter((entry) => entry !== \"\")\n .map((entry) =>\n /^\".*\"$/s.test(entry) ? entry.slice(1, -1).replace(/\"\"/g, '\"') : entry,\n )\n : [];\n\n return { kind: \"unique\", columns, constraint };\n }\n\n // `$1::text::jsonb` for a `Json` column, nothing for a scalar list, and\n // nothing for anything else. A scalar `Date`, `boolean` or `bigint` binds\n // natively and needs neither a cast nor an encoder — which is why `encode`\n // below reads `field` for exactly two questions and passes everything else\n // through.\n //\n // The value is serialised by `fieldParam`, not by `encode` below, so a\n // binding site that does not ask for the cast still binds raw and keeps the\n // loud failure rather than acquiring a silent mis-store. The comment on\n // `encode` has the measurements.\n castParameter(field: FieldSchema): string {\n // A list is bound as an array literal and needs no cast in any position it\n // can occupy — see `listHas` for the measurements. Checked *before* the\n // `Json` branch rather than after, because a `Json[]` would otherwise take\n // it and bind `$1::text::jsonb` against a `jsonb[]` column, which is a type\n // error rather than a wrong answer. The order is the whole check.\n if (field.isList) return \"\";\n return field.type === \"Json\" ? \"::text::jsonb\" : \"\";\n }\n\n encode(value: unknown, field: FieldSchema): unknown {\n if (value === null || value === undefined) return null;\n\n // A scalar list crosses as one Postgres array literal, which is the same\n // trick `inList` and `compositeIn` already use for a bound array: still one\n // parameter, still nothing in the SQL text.\n //\n // `Json` is the element type that needs work here rather than in\n // `fieldParam`, and it is not the exception it looks like. `fieldParam`'s\n // rule is that the cast and the serialisation travel together; a list emits\n // *no* cast, because the array literal already carries the element's text\n // form and Postgres casts each element to the column's element type. So\n // serialising a `Json` element here is what makes the literal well-formed,\n // not a second place doing `fieldParam`'s job.\n if (field.isList) {\n // Not an `InvalidArgumentError`: the compiler validates every list\n // operand where the model and operation are in scope to name them, so a\n // non-array arriving here reports an ORM bug rather than a caller's —\n // the same call `fieldParam` makes about a stray `AnyNull`.\n if (!Array.isArray(value)) {\n throw new Error(\n `gemi ORM bug: a non-array reached the parameter binder for the ` +\n `scalar list '${field.column}' (received ${typeof value}). Every ` +\n `path that binds a list is supposed to have checked its operand.`,\n );\n }\n return arrayLiteral(\n field.type === \"Json\"\n ? value.map((element) =>\n element === null || element === undefined\n ? null\n : JSON.stringify(element),\n )\n : value,\n );\n }\n // **`Json` is handed over raw**, because Bun serializes it for a `jsonb`\n // parameter and doing it here first is the mirror of the decode bug beside\n // it: `JSON.stringify({a:1})` produces the *string* `{\"a\":1}`, and Bun then\n // stores that as the JSON string `\"{\\\"a\\\":1}\"` rather than as an object.\n //\n // The two used to cancel: encode over-serialized, decode re-parsed, and the\n // round trip looked right as long as nothing else read the column. What it\n // could not survive was a value that is legitimately a JSON *string* —\n // `\"42\"` went in as the number 42 — and nothing noticed, because the\n // template's schema had no `Json` column for the differential harness to\n // compare.\n //\n // Measured through Bun 1.3.14 against Postgres 16: an object, an array, a\n // string and null all round-trip identically when bound raw.\n //\n // A bare number or boolean is the one shape Bun binds as its own type, so\n // it now raises — `column is of type jsonb but expression is of type\n // boolean`. That reads like a regression and is not one: under the old\n // encoder `42` was stored as the jsonb **string** `\"42\"` (checked with\n // `jsonb_typeof`, which answered `string` for a number, a boolean and an\n // object alike). It only looked correct because the old decoder re-parsed\n // it on the way out — so the value was wrong in the database the whole\n // time, and anything reading that column *other than this ORM* saw a\n // string. A loud failure replaces a silent mis-store.\n //\n // **Fixed, in the compiler rather than here** — see `compile/cast.ts`. The\n // placeholder carries `::text::jsonb` and `fieldParam` serialises the value\n // to match, which is the only one of the four forms measured that carries\n // all six shapes:\n //\n // values ($1) 42 integer vs jsonb\n // values ($1::jsonb) \"42\" jsonb_typeof -> string\n // values (to_jsonb($1)) {a:1} could not determine polymorphic type\n // values ($1::text::jsonb) \"42\" jsonb_typeof -> number\n //\n // The serialisation deliberately does **not** live here. `encode` runs at\n // every binding site, and a site that serialises without also emitting the\n // cast is the second row above — the silent mis-store this whole comment is\n // about. Keeping the two together in `fieldParam` means a site nobody\n // converted still binds raw and still fails loudly.\n //\n // **The second row is also what a raw statement hits**, and there the cast\n // is the caller's rather than the dialect's: `payload || $1::jsonb` is a\n // Prisma port's spelling, and under Bun it appends the serialised text to an\n // array instead of merging. `json-param.ts` retypes it, on the same\n // reasoning and with the cast and the serialisation kept together for the\n // same reason.\n //\n return value;\n }\n\n // Nothing to do without a field: the only conversion `encode` makes here is\n // the JSON one, and that is precisely the one that needs the column's\n // declared type to be legitimate. `Date`, `boolean`, `bigint` and arrays all\n // bind natively, which is why a raw fragment is portable across the two\n // dialects even though only SQLite has to normalise anything.\n //\n // A parameter the caller cast to `json`/`jsonb` never arrives here: it has a\n // declared type after all, and `renderFragment` binds it as JSON text.\n encodeUntyped(value: unknown): unknown {\n return value;\n }\n\n // Postgres returns real `timestamptz`, `boolean` and `double precision`, so\n // most columns need nothing. Two do, and neither is reachable from the\n // template's schema — which is why they went unnoticed until a fixture with\n // every scalar type existed. Read off a live server through Bun:\n //\n // integer -> number ✓\n // double precision -> number ✓\n // boolean -> boolean ✓\n // text -> string ✓\n // timestamp(3) -> Date ✓ (but see the protocol note below)\n // bytea -> Buffer ✗ where Prisma gives a plain Uint8Array\n // bigint -> \"123\" ✗ string, where Prisma gives 123n\n // jsonb / json -> '{\"a\":1}' ✗ unparsed text, where Prisma gives an object\n //\n // The `bytea` line carried a ✓ and the parenthetical \"a Uint8Array, which is\n // what Prisma gives\". Both halves are true and the conclusion was still wrong:\n // a `Buffer` *is* a `Uint8Array`, so the type checks out, but it is not the\n // one Prisma returns and it does not behave the same. Checked against a\n // generated Prisma 6 client on both dialects rather than reasoned about —\n // Prisma returns a plain `Uint8Array` for `Bytes` everywhere.\n //\n // `numeric` also arrives as a string, which is the correct thing for it to\n // do — but `Decimal` is refused at *generation* time (iteration 1), so no\n // such field can reach this.\n needsDecode(field: FieldSchema): boolean {\n // `Json` is deliberately absent: Bun hands back a parsed JSON value, so\n // `decode` returns it unchanged, and this predicate documents itself as\n // \"false when the driver already returns exactly what Prisma would\" — which\n // is now exactly true. Leaving it in cost a function call per Json value on\n // every read for nothing.\n //\n // **Every list is decoded**, including a `String[]` whose elements the\n // driver already hands back correctly. Three separate reasons, and the\n // first alone settles it: the *container* is wrong for two element types\n // regardless of the elements — `int[]` arrives as an `Int32Array`, and an\n // `enum[]` arrives as an unparsed `{…}` literal — so a predicate that\n // answered per element type would have to encode which container Bun picks\n // for which Postgres type, which is a table nothing keeps in step. Second,\n // `int[]`'s container differs *by protocol*: `Int32Array` when the\n // statement binds a parameter, a plain `Array` when it does not. Third, the\n // cost is one call per list value, not per element.\n return field.isList === true || field.type === \"BigInt\" || field.type === \"Bytes\";\n }\n\n decode(value: unknown, field: FieldSchema): unknown {\n if (value === null || value === undefined) return null;\n if (field.isList) return this.decodeList(value, field);\n return this.decodeScalar(value, field);\n }\n\n /**\n * One array column, element by element.\n *\n * **Three container shapes arrive here**, all measured through Bun 1.3.14\n * against Postgres 16 rather than read off a driver's documentation:\n *\n * text[] float8[] bool[] timestamp[] bytea[] jsonb[] bigint[] -> Array\n * int[] -> Int32Array\n * enum[] domain[] -> \"{a,b}\"\n *\n * The third is the surprise and the reason this is not four lines: Bun has no\n * decoder for an array whose element type it does not recognise, so it hands\n * the **Postgres array output literal back as a string** — and every enum\n * list is in that case. `real[]` is the same story as `int[]` with a\n * `Float32Array`, which is why the typed-array branch is written against\n * `ArrayBuffer.isView` rather than against `Int32Array` by name.\n *\n * `int[]`'s container also depends on the *protocol*: a statement that binds\n * at least one parameter goes over the extended protocol and yields an\n * `Int32Array`, one that binds none yields a plain `Array`. Same column, same\n * row, two shapes — so this cannot be decided once and cached.\n *\n * Elements then go through {@link decodeScalar}, which is the same function\n * the scalar path uses. That is what makes `BigInt[]` exact and `Bytes[]` a\n * `Uint8Array[]` rather than a `Buffer[]` without restating either rule.\n */\n private decodeList(value: unknown, field: FieldSchema): unknown {\n const elements = Array.isArray(value)\n ? value\n : typeof value === \"string\"\n ? parseArrayLiteral(value, field)\n : ArrayBuffer.isView(value)\n ? Array.from(value as unknown as ArrayLike<unknown>)\n : null;\n\n if (elements === null) throw new DecodeError(field, value);\n\n return elements.map((element) =>\n element === null || element === undefined\n ? null\n : this.decodeScalar(element, field),\n );\n }\n\n private decodeScalar(value: unknown, field: FieldSchema): unknown {\n switch (field.type) {\n case \"BigInt\":\n if (typeof value === \"bigint\") return value;\n try {\n return BigInt(value as string);\n } catch {\n throw new DecodeError(field, value);\n }\n case \"Json\":\n // **Bun parses `json` and `jsonb` for us**, so there is nothing to do.\n // Measured against Postgres 16 through Bun 1.3.14, one row per shape:\n //\n // '{\"a\":1}' -> object '[]' -> object (array)\n // '\"42\"' -> string '42' -> number\n // '\"text\"' -> string 'null' -> null\n //\n // This used to read `typeof value === \"string\" ? JSON.parse(value) :\n // value`, on the reasoning that jsonb \"arrives as text\" and that the\n // `typeof` check would cope either way. It does not cope, and cannot:\n // **a JS string is ambiguous** between \"raw JSON text the driver did\n // not parse\" and \"a JSON string value the driver did parse\", and the\n // two are indistinguishable by inspection. So the guard silently\n // re-parsed legitimate string values — a column holding the JSON string\n // `\"42\"` came back as the *number* 42, `\"true\"` as a boolean, and\n // `\"{\\\"a\\\":1}\"` as an object. `\"text\"` survived only because\n // `JSON.parse` threw and the catch handed the value back.\n //\n // Found by adding a `Json` column to the template schema: the\n // differential harness had never seen one, and every unit test that\n // \"covered\" this was written against the same assumption as the code.\n return value;\n case \"Bytes\":\n // The driver hands back a `Buffer`; Prisma 6 returns a `Uint8Array`,\n // on **every** dialect, and so does this ORM on SQLite where the\n // driver's own value already is one. Returning the `Buffer` verbatim\n // therefore diverged from Prisma and from our own SQLite path at the\n // same time — and `Buffer` being a `Uint8Array` subclass is exactly\n // what made it invisible: it satisfies the generated type, survives\n // `ArrayBuffer.isView`, and compares equal element by element.\n //\n // What it does not survive is `toString`. `Buffer.prototype.toString`\n // takes an encoding; `Uint8Array.prototype.toString` ignores its\n // argument and joins with commas. So `row.digest.toString(\"hex\")` read\n // `\"0102ff\"` in production on Postgres and `\"1,2,255\"` in development\n // on SQLite, with no error on either.\n //\n // A view, not a copy: same bytes, same lifetime, no allocation.\n return Buffer.isBuffer(value)\n ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength)\n : value;\n default:\n return value;\n }\n }\n\n // KNOWN DIVERGENCE, and not one this can fix: Prisma maps `DateTime` to\n // `timestamp(3)` — no time zone — and stores UTC in it, but Bun's driver\n // decodes that column differently depending on the *protocol* the statement\n // used. A query that binds no parameters goes over the simple query protocol\n // and comes back as zoneless text, which is then parsed as local time; a\n // query that binds even one parameter goes over the extended protocol, comes\n // back in binary, and is correct. Same row, same column, two instants, on any\n // machine whose clock is not already UTC.\n //\n // select \"createdAt\" from \"User\" limit 1 -> 10:26:40Z\n // select \"createdAt\" from \"User\" where \"id\" = $1 -> 12:26:40Z\n // select \"createdAt\"::text from \"User\" limit 1 -> 12:26:40\n //\n // A `decode` cannot correct it, because the value alone does not say which\n // protocol produced it; nothing below the plan does. Until it is fixed\n // upstream, run the process with TZ=UTC, where both paths agree.\n //\n // Note this is why `DateTime` stays out of `needsDecode` above: there is no\n // correction to apply, only a caveat to record.\n}\n\n/**\n * `[1, 2]` -> `{\"1\",\"2\"}`: Postgres' text form for an array value.\n *\n * Every element is quoted, including numbers and booleans — Postgres casts a\n * quoted element to the array's element type, so one rule covers every column\n * type instead of a per-type branch that has to stay in step with `encode`.\n * `NULL` is the one thing that cannot be quoted, since `\"NULL\"` is the string.\n *\n * Verified against a real database for `int`, `text` (with quotes, commas,\n * braces, backslashes and newlines in the value), `timestamp`, `boolean`,\n * `bigint` past 2^53, `bytea` and `double precision`.\n */\nfunction arrayLiteral(values: unknown[]): string {\n let out = \"{\";\n for (let i = 0; i < values.length; i++) {\n if (i > 0) out += \",\";\n out += arrayElement(values[i]);\n }\n return out + \"}\";\n}\n\nfunction arrayElement(value: unknown): string {\n if (value === null || value === undefined) return \"NULL\";\n\n // ISO 8601 keeps the value's own UTC wall clock, which is what Prisma stores\n // in a `timestamp(3)`; the zone designator is ignored on the way in.\n if (value instanceof Date) return `\"${value.toISOString()}\"`;\n\n if (ArrayBuffer.isView(value)) {\n let hex = \"\";\n for (const byte of new Uint8Array(\n value.buffer,\n value.byteOffset,\n value.byteLength,\n )) {\n hex += byte.toString(16).padStart(2, \"0\");\n }\n // `\\x…` is Postgres' hex bytea form, and the backslash is doubled because\n // the array literal parser reads one level of escapes first.\n return `\"\\\\\\\\x${hex}\"`;\n }\n\n const text = typeof value === \"string\" ? value : String(value);\n return `\"${text.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"')}\"`;\n}\n\n/**\n * `{a,\"b,c\",NULL}` -> `[\"a\", \"b,c\", null]`: the same form, read back.\n *\n * **Only reached for an array type Bun has no decoder for**, which today means\n * an `enum[]` or a `domain[]` — everything else arrives as a JS array and never\n * comes near this. That is why it exists at all: an enum list is the one scalar\n * list a Prisma schema is *likely* to declare, and it is precisely the one the\n * driver hands back as text.\n *\n * Splitting on commas is wrong and looks right, which is the whole reason this\n * is a state machine. Postgres quotes an element only when it has to, and then\n * escapes `\"` and `\\` inside the quotes — so a label containing a comma, a\n * brace, a quote or a backslash all survive the output format and none of them\n * survive a `split(\",\")`. Verified against a live server with an enum declaring\n * exactly those labels, plus one spelled `NULL`: unquoted `NULL` is the null\n * element, and quoted `\"NULL\"` is the four-character string.\n *\n * A nested `{` is a multi-dimensional array, which Prisma's scalar lists cannot\n * be. It is refused rather than flattened — flattening would return a row shape\n * that disagrees with the type Prisma handed the caller, which is the failure\n * this whole feature was refused for eight iterations to avoid.\n */\nfunction parseArrayLiteral(text: string, field: FieldSchema): unknown[] {\n if (!text.startsWith(\"{\") || !text.endsWith(\"}\")) {\n throw new DecodeError(field, text);\n }\n if (text === \"{}\") return [];\n\n const out: unknown[] = [];\n let index = 1;\n const end = text.length - 1;\n\n while (index <= end) {\n let raw = \"\";\n let quoted = false;\n\n if (text[index] === '\"') {\n quoted = true;\n index++;\n while (index < end && text[index] !== '\"') {\n // One level of backslash escaping, which is what the writer above emits\n // and what `bytea`'s own `\\x` prefix is doubled to survive.\n raw += text[index] === \"\\\\\" ? text[++index] : text[index];\n index++;\n }\n // The closing quote.\n index++;\n } else {\n while (index < end && text[index] !== \",\") {\n if (text[index] === \"{\") throw new DecodeError(field, text);\n raw += text[index];\n index++;\n }\n }\n\n // Unquoted `NULL` is the null element; quoted, it is the string.\n out.push(!quoted && raw.toUpperCase() === \"NULL\" ? null : raw);\n\n // Either a separator or the closing brace, and nothing else is well-formed.\n if (index < end && text[index] !== \",\") throw new DecodeError(field, text);\n index++;\n }\n\n if (field.type !== \"Json\") return out;\n\n // **The one place a JS string is not ambiguous**, which is worth saying next\n // to `decodeScalar`'s `Json` case insisting that it usually is. There, a\n // string could be raw JSON text the driver skipped *or* a JSON string value\n // it parsed, and nothing distinguishes them. Here the element was read out of\n // Postgres' own array output a moment ago, so it is raw text by construction\n // and there is no second reading to guess between.\n return out.map((element) => {\n if (element === null) return null;\n try {\n return JSON.parse(element as string);\n } catch {\n throw new DecodeError(field, element);\n }\n });\n}\n",
|
|
8
7
|
"/**\n * Prisma's two null sentinels for a `Json` column, recognised without importing\n * Prisma.\n *\n * A nullable `Json` column has *two* legal empty values and Prisma makes the\n * caller choose between them, because they are different rows:\n *\n * Prisma.DbNull the column is SQL NULL\n * Prisma.JsonNull the column holds the JSON value `null`\n *\n * A bare `null` is a type error on both libraries — gemi takes Prisma's\n * argument types verbatim, so the sentinels are what type-checks here too, and\n * `differential.test.ts` already notes that \"a decoder that conflates them\n * returns the wrong one of two legal answers\".\n *\n * Nothing translated them. Both are ordinary objects with no enumerable\n * properties, so every path that serialises a Json value turned them into the\n * jsonb object `{}` — a plausible-looking value, silently wrong, on both\n * dialects and with nothing raised. That is the same silent mis-store the\n * bare-scalar refusal existed to prevent.\n *\n * **Recognised by `toString`, not by `instanceof` or the constructor's name.**\n * The ORM runtime may not import the Prisma client package at all —\n * `runtime-isolation.test.ts` greps for the name, comments included — so\n * `instanceof` is unavailable. Prisma implements\n * `toString` on these deliberately, returning `Prisma.DbNull` and\n * `Prisma.JsonNull`; a constructor name would be the other candidate and is the\n * one a minifier is free to rewrite.\n */\nexport type JsonNullKind = \"db\" | \"json\" | \"any\";\n\nconst SENTINELS: Record<string, JsonNullKind> = {\n \"Prisma.DbNull\": \"db\",\n \"Prisma.JsonNull\": \"json\",\n \"Prisma.AnyNull\": \"any\",\n};\n\n/**\n * Which sentinel this is, or `null` for any ordinary value.\n *\n * **`\"any\"` is not a storable value, and the two others are.** `DbNull` and\n * `JsonNull` each name one of the column's two legal empty states, so an\n * encoder can turn either into something to write. `AnyNull` names *both at\n * once* — it is a question, only ever meaningful in a filter, and Prisma raises\n * if it reaches a write. Callers that encode must therefore handle it\n * separately rather than treating the three alike; `cast.ts` and the SQLite\n * encoder refuse it outright, since by the time a value reaches them the filter\n * and write paths have each had their say.\n *\n * It was previously absent from this table, and **absent is not the same as\n * refused** — it fell through to the data path, where a write stored it as the\n * jsonb object `{}` and a filter compiled to `= '{}'`, returning the complement\n * of the rows it asks for. That was #259.\n */\n/**\n * A sentinel, built the way the recogniser below demands.\n *\n * **A class, so the prototype's `toString` is non-enumerable.** A method in an\n * object literal is enumerable, `for…in` walks it, and the shape check below\n * would reject it — which is how the first version of the test helper in\n * `json-null.test.ts` failed while Prisma's real sentinels passed. Prisma builds\n * them as classes; this matches, and `json-null.test.ts` pins that they are\n * recognised so the two cannot drift apart.\n *\n * **The tag still reads `Prisma.…`, and that is deliberate.** It is what makes\n * gemi's sentinel and Prisma's the *same value* as far as every reader is\n * concerned: an app migrating off `@prisma/client` can swap the import without\n * touching a call site, and one that still passes Prisma's keeps working. The\n * tag is a wire format shared with another library, not a name gemi is free to\n * choose.\n */\nfunction sentinel(tag: string): object {\n return new (class {\n toString() {\n return tag;\n }\n })();\n}\n\n/**\n * Nominal types for the three sentinels.\n *\n * Branded rather than typed as `object`, so a `Json` column's input type can\n * name exactly these and nothing else. The brand is a type-level fiction — the\n * runtime values carry no such property, and must not: `jsonNullKind` rejects\n * any object with own properties, which is what stops an ordinary value from\n * being mistaken for a sentinel.\n */\ndeclare const sentinelBrand: unique symbol;\n\nexport interface DbNullValue {\n readonly [sentinelBrand]: \"db\";\n}\nexport interface JsonNullValue {\n readonly [sentinelBrand]: \"json\";\n}\nexport interface AnyNullValue {\n readonly [sentinelBrand]: \"any\";\n}\n\n/**\n * The two empty states of a nullable `Json` column, and the filter that means\n * both.\n *\n * `docs/orm.md` used to spell these `Prisma.DbNull` and `Prisma.JsonNull`,\n * which made a *runtime* value import of `@prisma/client` the one piece of\n * ordinary application code that could not be written without the package. The\n * recogniser never needed it — it has always matched structurally, precisely so\n * that the ORM runtime could stay free of Prisma — so exporting gemi's own\n * costs nothing and removes the last such import.\n *\n * `AnyNull` is a question, not a value: it is only meaningful in a filter, and\n * both `cast.ts` and the SQLite encoder refuse it in a write.\n */\nexport const DbNull = sentinel(\"Prisma.DbNull\") as DbNullValue;\nexport const JsonNull = sentinel(\"Prisma.JsonNull\") as JsonNullValue;\nexport const AnyNull = sentinel(\"Prisma.AnyNull\") as AnyNullValue;\n\n/**\n * The ORM's own spelling of `JsonNull`, for a comparison the *compiler* authors\n * rather than the caller.\n *\n * `AnyNull` compiles to `is null or = <JSON null>`, and the right-hand side has\n * no argument to read it out of — the caller wrote `AnyNull`, not `JsonNull`.\n * Rather than teach the encoders a second way to say the same thing, or splice\n * a literal into the SQL text, the compiler binds this and every existing path\n * treats it exactly as it treats the real sentinel.\n *\n * The same object as the exported `JsonNull` rather than a second one: two\n * values with one tag would be two things to keep recognisable, and the\n * compiler's need and the caller's are the same need.\n */\nexport const JSON_NULL: object = JsonNull as unknown as object;\n\nexport function jsonNullKind(value: unknown): JsonNullKind | null {\n if (typeof value !== \"object\" || value === null) return null;\n\n // **A sentinel carries no data**, and checking that before anything else is\n // what makes this safe rather than merely usually-right.\n //\n // Recognising by `toString` alone is forgeable: an object whose `toString`\n // happens to return `Prisma.DbNull` was read as the sentinel and written as\n // SQL NULL, losing the object. It also made the bind *throw* for a value\n // whose `toString` throws — something Prisma stores without ever calling it,\n // since `JSON.stringify` does not consult `toString`.\n //\n // Both reach `String` only for an object with nothing in it, which no\n // application stores on purpose. The enumerable check runs first because it\n // allocates nothing and exits on the first key, which is the common case; the\n // own-property scan is for the handful of values that get past it, and is\n // what keeps `[]` and `{}` out — an empty array is a legitimate Json value.\n for (const _key in value) return null;\n if (Object.getOwnPropertyNames(value).length > 0) return null;\n\n // A null-prototype object has no `toString` at all and `String` throws on it.\n // It is a legitimate Json value, so this answers \"not a sentinel\" rather than\n // failing the write.\n let tag: string;\n try {\n tag = String(value);\n } catch {\n return null;\n }\n\n return SENTINELS[tag] ?? null;\n}\n",
|
|
9
8
|
"import type { Dialect } from \"../../database/dialect\";\nimport {\n type Binder,\n type Fragment,\n concat,\n joinFragments,\n param,\n sql,\n} from \"../compile/fragment\";\nimport type { RowLockClause } from \"../compile/lock\";\nimport { DecodeError } from \"../errors\";\nimport { jsonNullKind } from \"../json-null\";\nimport type { FieldSchema } from \"../schema\";\nimport type { ConstraintViolation, SqlDialect } from \"./index\";\n\n// SQLite has five storage classes and neither `DateTime` nor `Boolean` is among\n// them. Prisma stores a `DateTime` as integer milliseconds since the epoch and a\n// `Boolean` as `0` / `1`, so handing the driver's values straight back would\n// already diverge from Prisma's result shape on the template's `createdAt`.\n//\n// `CURRENT_TIMESTAMP` column defaults are the one exception: a row inserted by\n// raw SQL or by a migration rather than by Prisma holds the text form\n// `YYYY-MM-DD HH:MM:SS`, which SQLite defines as UTC. Both forms are decoded.\nconst SQLITE_TEXT_TIMESTAMP =\n /^\\d{4}-\\d{2}-\\d{2}[ T]\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?$/;\n\nfunction toDate(value: unknown, field: FieldSchema): Date {\n if (value instanceof Date) return value;\n\n let date: Date;\n if (typeof value === \"number\") {\n date = new Date(value);\n } else if (typeof value === \"bigint\") {\n date = new Date(Number(value));\n } else if (typeof value === \"string\") {\n // Naked SQLite timestamps carry no zone but are documented as UTC; `Date`\n // would otherwise read them as local time and shift them.\n date = new Date(\n SQLITE_TEXT_TIMESTAMP.test(value) ? `${value.replace(\" \", \"T\")}Z` : value,\n );\n } else {\n throw new DecodeError(field, value);\n }\n\n // `new Date(\"nonsense\")` is an `Invalid Date`, not a throw — every field on it\n // reads `NaN`. Returning one would be a wrong answer rather than an error,\n // which is the failure mode this whole file exists to avoid.\n if (Number.isNaN(date.getTime())) throw new DecodeError(field, value);\n return date;\n}\n\nexport class SqliteDialect implements SqlDialect {\n readonly name: Dialect = \"sqlite\";\n\n // Prisma rejects `mode: \"insensitive\"` on SQLite rather than emulating it, so\n // gemi does too — the contract is with Prisma's behaviour, not with\n // cross-dialect uniformity. Note SQLite's `like` is *already* case-insensitive\n // for ASCII, which is the opposite of Postgres and is why the two dialects\n // legitimately return different rows for the same `contains`.\n readonly supportsInsensitiveMode = false;\n\n // `in (?, ?, ?)`: the length is part of the text, so it is part of the plan.\n readonly bindsListAsOneParameter = false;\n\n // SQLite has had RETURNING since 3.35; Bun 1.3.14 bundles 3.51.0, confirmed by\n // querying `select sqlite_version()` through the driver rather than by reading\n // a changelog. Multi-row `insert ... returning` was verified there too, since\n // `createMany` depends on it for its row count.\n readonly supportsReturning = true;\n\n // `SQLITE_MAX_VARIABLE_NUMBER`, which has defaulted to 32766 since SQLite\n // 3.32 (it was 999 before). A build can lower it and `sqlite3_limit` can\n // lower it further at runtime, so this is the documented default rather than\n // a reading off the connection — which makes it an upper bound on what is\n // safe, which is the direction that matters for a guard.\n readonly maxBoundParameters = 32766;\n\n // A parameter's type is the bound value's, and `cast(x as json)` is NUMERIC\n // affinity rather than a JSON cast — `cast('{\"a\":1}' as json)` is `0`. So\n // there is no #376 mis-store to correct here, and correcting one anyway would\n // emit `cast(? as text)::json`, which SQLite refuses to parse. Measured with\n // `bun:sqlite`; the table is on `SqlDialect.typesParametersFromStatement`.\n readonly typesParametersFromStatement = false;\n\n quoteIdent(name: string): string {\n // NUL is the parameter sentinel in compile/fragment.ts, so it is the one\n // character that could shift a placeholder's position rather than merely\n // produce broken SQL. An identifier from the generated schema cannot\n // contain one — but asserting it makes the invariant unconditional instead\n // of argued, which is the standard the rest of this file holds.\n if (name.includes(\"\\u0000\")) {\n throw new Error(\n `Refusing to quote the identifier ${JSON.stringify(name)}: it contains ` +\n `a NUL byte, which is reserved as the parameter marker.`,\n );\n }\n // An embedded quote is not an attack vector for the same reason, but\n // escaping it costs nothing.\n return `\"${name.replace(/\"/g, '\"\"')}\"`;\n }\n\n placeholder(_index: number): string {\n return \"?\";\n }\n\n // One placeholder per element, so the array's length is part of the SQL text\n // and therefore part of the plan key. `in: [1,2]` and `in: [1,2,3]` are two\n // plans here; on Postgres they are one. See the note on `SqlDialect`.\n inList(\n lhs: string,\n negated: boolean,\n length: number,\n values: Binder,\n ): Fragment {\n const operator = negated ? \"not in\" : \"in\";\n const elements: Fragment[] = [];\n for (let i = 0; i < length; i++) {\n elements.push(\n param((args, context) => (values(args, context) as unknown[])[i]),\n );\n }\n return concat(\n sql(`${lhs} ${operator} (`),\n joinFragments(elements, \", \"),\n sql(\")\"),\n );\n }\n\n /**\n * Never. SQLite has no `unnest`, and its row-value `in` still needs one\n * `(?, ?)` group per tuple — so the text grows with the list either way and\n * there is nothing to gain over the `OR` the loader already builds.\n *\n * That is consistent with the single-column case: `plan.ts` records that \"a\n * coarser key cannot fix the SQLite side\", because every distinct length is\n * genuinely a different statement here.\n */\n canBindCompositeIn(): boolean {\n return false;\n }\n\n compositeIn(): Fragment {\n // Unreachable: the caller asks `canBindCompositeIn` first and keeps the\n // portable `OR` when it says no. Throwing rather than emitting something\n // plausible keeps the two from disagreeing silently.\n throw new Error(\n \"SQLite cannot bind a composite `in`; `canBindCompositeIn` is the guard.\",\n );\n }\n\n /**\n * **None**, because SQLite has no array type — and this is Prisma's answer\n * before it is gemi's. The generated client never sees such a column here:\n * `prisma generate` refuses the *schema* with *\"Field `tags` in model `User`\n * can't be a list. The current connector does not support lists of primitive\n * types.\"*\n *\n * So the only way to reach a scalar list on this dialect is an artifact\n * generated against a Postgres schema and a `DATABASE_URL` pointed at SQLite\n * — a real configuration, since the artifact is deliberately dialect-agnostic\n * (#300), and one where the underlying table has no such column either. An\n * empty set is what turns that into a refusal naming the dialect, in place of\n * `no such column: tags` from the driver.\n */\n readonly listFilters: ReadonlySet<string> = new Set();\n\n // All five are unreachable: `listFilters` is empty, so `where.ts` and\n // `write.ts` refuse first with a message naming the dialect. Throwing rather\n // than emitting something plausible keeps the two from disagreeing silently —\n // the same call `compositeIn` and `jsonArrayContains` above already make.\n listHas(): Fragment {\n throw new Error(unsupportedList(\"has\"));\n }\n\n listHasEvery(): Fragment {\n throw new Error(unsupportedList(\"hasEvery\"));\n }\n\n listHasSome(): Fragment {\n throw new Error(unsupportedList(\"hasSome\"));\n }\n\n listIsEmpty(): Fragment {\n throw new Error(unsupportedList(\"isEmpty\"));\n }\n\n listPush(): Fragment {\n throw new Error(unsupportedList(\"push\"));\n }\n\n /**\n * `path: \"$.a.b\"` — a JSONPath *string*, where Postgres takes an array.\n *\n * Prisma's own split, measured on both: the generated client refuses\n * `[\"a\",\"b\"]` here with *\"Expected String, provided (String)\"* and refuses\n * `\"$.a.b\"` on Postgres with *\"Expected String[], provided String\"*. So the\n * argument a caller writes is dialect-specific before it reaches this ORM,\n * and reproducing that is what compatibility means.\n */\n readonly jsonPathSyntax = \"jsonpath\" as const;\n\n /**\n * What Prisma will apply to an extracted value here — and the absences are\n * the point. `array_contains` and the numeric comparisons are refused by the\n * generated client on SQLite with *\"Unknown argument\"*, so accepting them\n * would put gemi ahead of Prisma on a dialect where a differential test has\n * no oracle to check it against.\n */\n readonly jsonFilters: ReadonlySet<string> = new Set([\n \"equals\",\n \"not\",\n \"string_contains\",\n \"string_starts_with\",\n \"string_ends_with\",\n ]);\n\n /**\n * `json_extract` returns a *native* value — an INTEGER for a JSON number —\n * so `equals: 3` binds `3`. Binding `\"3\"` compares INTEGER to TEXT, which\n * SQLite answers `false` rather than refusing: no rows, no error, and the\n * differential harness catching it against Prisma is the only reason it did\n * not ship that way.\n */\n readonly jsonComparesAsText = false;\n\n /**\n * `json_extract(\"col\", ?)`, with the path bound.\n *\n * SQLite has no separate text-returning extraction: `json_extract` already\n * yields a SQL value rather than a JSON document for a scalar at the path, so\n * `asText` changes nothing. That is why the string filters can compare\n * against it directly.\n */\n jsonExtract(column: string, path: Binder, _asText: boolean): Fragment {\n return concat(sql(`json_extract(${column}, `), param(path), sql(\")\"));\n }\n\n /**\n * `(\"col\" -> ?)` — the JSON value at the path, as JSON text.\n *\n * **`->` rather than `json_extract`, and the difference is the whole point.**\n * `json_extract` returns a *native* SQL value, so a JSON `null` comes back as\n * SQL NULL and is then indistinguishable from an absent key — the collapse\n * that had the sentinels refused here. `->` returns the JSON *text* of the\n * subcomponent, which keeps them apart. Measured on SQLite 3.51 against\n * `'$.operation'`:\n *\n * {\"operation\":null} ->: 'null' json_extract: NULL\n * {\"other\":1} ->: NULL json_extract: NULL\n * {\"operation\":\"sync\"} ->: '\"sync\"' json_extract: 'sync'\n * {\"operation\":\"null\"} ->: '\"null\"' json_extract: 'null'\n *\n * The last row is why this is a real distinction rather than a spelling one:\n * a JSON string `\"null\"` and a JSON null differ under `->` (the quotes are\n * part of the text) and are the same under `json_extract`. So\n * `equals: JsonNull` does not accidentally match a document holding the\n * string.\n *\n * `json_type` would answer the same question and is the form #407 proposed;\n * `->` is what Prisma emits here — `` `Doc`.`payload`->? IS NULL `` — and\n * matching the oracle's operator costs nothing over inventing a second one.\n * It needs SQLite 3.38 (2022); Bun ships 3.51.\n *\n * No cast, unlike Postgres: `->` already yields the text form both sides of\n * the comparison are in, and `encode` spells a JSON null `'null'` for the\n * bound side.\n */\n jsonValueAt(column: string, path: Binder): Fragment {\n return concat(sql(`(${column} -> `), param(path), sql(\")\"));\n }\n\n /**\n * `json_type(col, '$.\"key\"') is not null`, one term per key, behind\n * `json_type(col, '$') = 'object'`.\n *\n * The key is appended to the path as a JSON string — `$.\"a.b\"` — which SQLite\n * reads as one label however many dots, brackets or quotes it holds. Both\n * paths are bound. `json_each` would take the keys as one parameter, but it\n * cannot be correlated safely: a column named `key`, `value` or `json`\n * resolves to `json_each`'s own column inside the subquery, and the filter\n * silently matches nothing. Measured on SQLite 3.51.\n */\n jsonHasKeys(\n column: string,\n path: Binder | undefined,\n keys: Binder,\n mode: \"one\" | \"some\" | \"every\",\n count: number,\n ): Fragment {\n const base: Binder = (args, context) =>\n path === undefined ? \"$\" : (path(args, context) as string);\n\n const term = (index: number | undefined): Fragment =>\n concat(\n sql(`json_type(${column}, `),\n param((args, context) => {\n const value = keys(args, context);\n const key = index === undefined ? value : (value as unknown[])[index];\n return `${base(args, context)}.${JSON.stringify(String(key))}`;\n }),\n sql(\") is not null\"),\n );\n\n const terms =\n mode === \"one\"\n ? [term(undefined)]\n : Array.from({ length: count }, (_, index) => term(index));\n\n const body =\n terms.length === 0\n ? sql(mode === \"some\" ? \"0\" : \"1\")\n : joinFragments(terms, mode === \"every\" ? \" and \" : \" or \");\n\n return concat(\n sql(`(json_type(${column}, `),\n param(base),\n sql(\") = 'object' and (\"),\n body,\n sql(\"))\"),\n );\n }\n\n /**\n * `is not`, SQLite's null-safe inequality. A `Json` column is stored as text,\n * so both sides go through `json()` first and whitespace stops mattering.\n */\n distinctFrom(lhs: string, rhs: Fragment, field: FieldSchema): Fragment {\n if (field.type === \"Json\" && !field.isList) {\n return concat(sql(`json(${lhs}) is not json(`), rhs, sql(\")\"));\n }\n return concat(sql(`${lhs} is not `), rhs);\n }\n\n jsonArrayContains(): Fragment {\n // Unreachable: `jsonFilters` does not list it, so `where.ts` refuses first\n // with a message naming the dialect. Throwing here rather than returning\n // something plausible keeps the two from disagreeing silently.\n throw new Error(\n \"SQLite cannot express array_contains; `jsonFilters` is the guard.\",\n );\n }\n\n like(lhs: string, _insensitive: boolean, pattern: Binder): Fragment {\n // `_insensitive` is unreachable — the compiler checks\n // `supportsInsensitiveMode` and raises a contextful error first.\n return concat(sql(`${lhs} like `), param(pattern));\n }\n\n // Not offered, and deliberately: see `SqlDialect.ignoreConflicts`. SQLite can\n // express it — `on conflict do nothing` works here — but Prisma rejects the\n // argument on this dialect, so implementing it would put gemi ahead of Prisma\n // on the one dialect where the differential harness could no longer check it.\n ignoreConflicts(): Fragment | null {\n return null;\n }\n\n // Nothing to emit: SQLite has no row locks, and its transactions are already\n // serializable at the database level. See `SqlDialect.rowLock` for why this\n // is a no-op rather than a refusal.\n rowLock(_lock: RowLockClause, _table: string): Fragment {\n return sql(\"\");\n }\n\n // SQLite cannot parse `offset` without a preceding `limit`, so a bare `skip`\n // needs a limit anyway. `-1` is SQLite's \"no limit\", and it goes through a\n // parameter rather than into the text like everything else.\n paginate(take: Binder | null, skip: Binder | null): Fragment {\n if (!take && !skip) return sql(\"\");\n if (!skip) return concat(sql(\" limit \"), param(take!));\n return concat(\n sql(\" limit \"),\n param(take ?? (() => -1)),\n sql(\" offset \"),\n param(skip),\n );\n }\n\n // SQLite reports every constraint failure as a `SQLiteError`, distinguished\n // only by `code`. Read off the driver rather than guessed:\n //\n // UNIQUE constraint failed: T.email SQLITE_CONSTRAINT_UNIQUE\n // UNIQUE constraint failed: C.a, C.b SQLITE_CONSTRAINT_UNIQUE (composite)\n // NOT NULL constraint failed: N.v SQLITE_CONSTRAINT_NOTNULL\n // FOREIGN KEY constraint failed SQLITE_CONSTRAINT_FOREIGNKEY\n //\n // Matching on the code and not on the message is what keeps the last two from\n // being reported as duplicate keys. There is no constraint *name* in any of\n // them — SQLite does not carry one — so only the columns come back.\n constraintViolation(error: unknown): ConstraintViolation | null {\n const code = (error as { code?: unknown } | null)?.code;\n if (code !== \"SQLITE_CONSTRAINT_UNIQUE\" && code !== \"SQLITE_CONSTRAINT_PRIMARYKEY\") {\n return null;\n }\n\n const message = String((error as { message?: unknown }).message ?? \"\");\n const listed = /constraint failed:\\s*(.+)$/.exec(message);\n if (!listed) return { kind: \"unique\", columns: [] };\n\n const columns = listed[1]\n .split(\",\")\n .map((entry) => entry.trim())\n // Each entry is `Table.column`; the table is the one being written, so\n // only the column carries information. A column name may itself contain a\n // dot, so the split is on the *first* one.\n .map((entry) => {\n const dot = entry.indexOf(\".\");\n return dot === -1 ? entry : entry.slice(dot + 1);\n })\n .filter((entry) => entry !== \"\");\n\n return { kind: \"unique\", columns };\n }\n\n // Nothing to cast. SQLite stores JSON as text and has no typed jsonb column\n // to disagree with the parameter, which is why the boundary #209 describes is\n // a Postgres one.\n castParameter(_field: FieldSchema): string {\n return \"\";\n }\n\n encode(value: unknown, field: FieldSchema): unknown {\n if (value === null || value === undefined) return null;\n\n switch (field.type) {\n case \"DateTime\":\n // The one that bites: Bun's SQLite driver binds a `Date` object to\n // NULL, so `where: { createdAt: date }` would quietly match nothing.\n // Prisma stores DateTime as integer milliseconds, so that is what the\n // parameter has to be.\n return value instanceof Date ? value.getTime() : value;\n case \"Boolean\":\n // Bun already maps true/false to 1/0, but doing it here keeps the\n // stored representation the dialect's decision rather than the driver's.\n return typeof value === \"boolean\" ? (value ? 1 : 0) : value;\n case \"Json\":\n // **Always serialized, never passed through.** SQLite stores JSON as\n // text, so the column holds whatever string this returns — and the\n // `typeof value === \"string\" ? value : …` guard it used to carry could\n // not tell \"already JSON text\" from \"a JSON string value\". A field set\n // to the string `\"42\"` was stored as the text `42` and decoded back as\n // the *number* 42.\n //\n // `JSON.stringify` on every value is unambiguous: a string becomes\n // `\"42\"` with its quotes, which is what `JSON.parse` needs to hand back\n // a string. The mirror of `decode`, which parses unconditionally.\n //\n // Except Prisma's two null sentinels, which have no enumerable\n // properties and would serialise to `{}` — see `json-null.ts`.\n // `DbNull` is the column being NULL; `JsonNull` is the JSON value.\n {\n const kind = jsonNullKind(value);\n if (kind === \"db\") return null;\n if (kind === \"json\") return \"null\";\n // `AnyNull` is not one of the two storable nulls — it asks for both.\n // The same backstop as `compile/cast.ts`, and for the same reason:\n // silently serialising it here is #259's `{}` by another route.\n if (kind === \"any\") {\n throw new Error(\n \"gemi ORM bug: Prisma.AnyNull reached the SQLite encoder. It is \" +\n \"a filter operand only, and both the filter and write paths \" +\n \"are supposed to have handled it before this point.\",\n );\n }\n }\n return JSON.stringify(value);\n default:\n // BigInt passes through. Bun's driver truncates integers above 2^53 on\n // the way in, which affects a raw `db.sql` query identically — it is\n // not something the compiler can correct at the parameter level.\n return value;\n }\n }\n\n // The two conversions above that do not need a field to decide: a `Date` is\n // milliseconds and a boolean is 0/1, which is what the ORM writes and\n // therefore what a raw statement has to compare against.\n //\n // Everything else is handed to the driver as it arrived, **including a plain\n // object**, and that is a decision rather than an omission. Measured, since\n // the obvious guesses are both wrong: Bun binds a plain object without\n // complaint on *both* dialects, and on Postgres it lands correctly in a\n // `jsonb` column — an object bound into one comes back as the object. So\n // refusing them here would break the legitimate case to catch the mistaken\n // one. On SQLite the same value binds to something no row matches, silently;\n // stringify it yourself if the column is JSON.\n //\n // Guessing from the value is the other tempting fix and is worse: the\n // compiler only JSON-encodes because a field says `Json`, and encoding on\n // sight would turn a mistyped parameter into a successfully-written string.\n // (An *array* is the one Bun does reject on SQLite, with\n // `SQLite query expected 1 values, received 2` — a confusing message for a\n // real mistake, but a loud one.)\n encodeUntyped(value: unknown): unknown {\n if (value instanceof Date) return value.getTime();\n if (typeof value === \"boolean\") return value ? 1 : 0;\n return value;\n }\n\n needsDecode(field: FieldSchema): boolean {\n switch (field.type) {\n case \"DateTime\":\n case \"Boolean\":\n case \"BigInt\":\n case \"Json\":\n return true;\n default:\n return false;\n }\n }\n\n decode(value: unknown, field: FieldSchema): unknown {\n // The driver reports a missing value as `null`; Prisma does too, so there\n // is nothing to convert. `undefined` can only appear if a column was not\n // selected, which the explicit column list makes impossible.\n if (value === null || value === undefined) return null;\n\n switch (field.type) {\n case \"DateTime\":\n return toDate(value, field);\n case \"Boolean\":\n if (typeof value === \"boolean\") return value;\n // `Number(...)` rather than `value !== 0`: a bigint zero is `0n`, and\n // `0n !== 0` is true, so a strict comparison would decode it as `true`.\n return Number(value) !== 0;\n case \"BigInt\":\n if (typeof value === \"bigint\") return value;\n try {\n return BigInt(value as string);\n } catch {\n // `BigInt(3.5)` throws a RangeError naming neither the column nor the\n // field, which is not enough to act on.\n throw new DecodeError(field, value);\n }\n case \"Json\":\n try {\n return typeof value === \"string\" ? JSON.parse(value) : value;\n } catch {\n throw new DecodeError(field, value);\n }\n default:\n return value;\n }\n }\n}\n\nfunction unsupportedList(operator: string): string {\n return (\n `SQLite has no array type, so it cannot express '${operator}' on a scalar ` +\n `list; \\`listFilters\\` is the guard.`\n );\n}\n",
|
|
10
9
|
"import type { Dialect } from \"../../database/dialect\";\nimport type { Binder, Fragment } from \"../compile/fragment\";\nimport type { RowLockClause } from \"../compile/lock\";\nimport type { FieldSchema, ScalarType } from \"../schema\";\nimport { PostgresDialect } from \"./postgres\";\nimport { SqliteDialect } from \"./sqlite\";\n\n/**\n * The per-database strategy.\n *\n * The rule this interface exists to enforce: no `if (dialect === \"postgres\")`\n * ever appears inside the compiler. When something genuinely cannot be\n * expressed through the interface, the interface widens — which is why\n * `inList`, `like` and `paginate` return `Fragment`s rather than strings. Each\n * of the three is a place where SQLite and Postgres disagree about *structure*,\n * not just spelling:\n *\n * - `inList` — SQLite expands one placeholder per element, so `in: [1,2]` and\n * `in: [1,2,3]` are different SQL and different plans. Postgres binds the\n * whole array to one parameter with `= any($1)`, so every length shares a\n * single plan and a single prepared statement.\n * - `like` — Postgres has `ilike` for `mode: \"insensitive\"`; SQLite has no\n * equivalent, and Prisma rejects the argument there outright.\n * - `paginate` — SQLite cannot parse `offset` without a preceding `limit`.\n */\nexport interface SqlDialect {\n readonly name: Dialect;\n\n /**\n * Whether `mode: \"insensitive\"` can be expressed at all. False on SQLite,\n * where Prisma rejects the argument rather than emulating it.\n */\n readonly supportsInsensitiveMode: boolean;\n\n /**\n * Whether an `in` list binds as a single parameter however long it is.\n *\n * True on Postgres (`= any($1)`), false on SQLite (`in (?, ?, ?)`). It is the\n * plan *cache* that needs to know: where the length does not change the SQL\n * text, it must not change the cache key either, or every distinct list\n * length mints another entry holding SQL identical to its neighbours'. That\n * matters most for relations, where the list length is the parent row count\n * and so varies with the data rather than with the code.\n */\n readonly bindsListAsOneParameter: boolean;\n\n /**\n * Whether `insert`/`update`/`delete` can return the rows they touched.\n *\n * True on both implemented dialects — Postgres has had `RETURNING` forever,\n * and SQLite since 3.35 (Bun 1.3.14 bundles 3.51.0, verified by querying\n * `sqlite_version()` rather than by reading a changelog).\n *\n * It is a capability rather than an assumption because MySQL and MariaDB have\n * no `RETURNING` at all. Their fallback — `lastInsertRowid` plus a re-select,\n * and no way to identify the rows an `updateMany` touched — is a different\n * statement shape, not a different spelling. Iteration 4 does not build it,\n * but it must stay expressible, so the write compiler asks rather than\n * assumes and raises a clear error when the answer is no.\n */\n readonly supportsReturning: boolean;\n\n /**\n * How many parameters one statement may bind.\n *\n * A hard protocol/driver limit, not a tuning knob: Postgres sends the\n * parameter count as an int16 in the Bind message, and SQLite compiles\n * `SQLITE_MAX_VARIABLE_NUMBER` in.\n *\n * Three shapes can approach it, all of them scaling with the caller's *data*\n * rather than with the query's shape:\n *\n * - `createMany`, at `rows × columns`.\n * - An `in` list on SQLite, which binds one placeholder per element — and\n * such a list is routinely request-derived (`?ids=…`).\n * - A to-many `include` on SQLite, which batches an `in` over the parent\n * keys, so a large enough `findMany` reaches it with no big list in sight.\n *\n * Postgres escapes the last two: `= any($1)` is one parameter however long\n * the array. The check itself lives in `compile/fragment.ts`'s `render`,\n * because that is the one place that sees a statement's final count.\n *\n * It lives *here* rather than as a constant in the compiler for the usual\n * reason: the number differs per dialect, and the compiler is not allowed to\n * know which dialect it is compiling for.\n */\n readonly maxBoundParameters: number;\n\n /**\n * Whether the **statement** decides a parameter's type, so a cast the caller\n * wrote onto their own placeholder changes how the driver encodes the value.\n *\n * True on Postgres: the server describes the statement, the client is told\n * the parameter is `jsonb`, and Bun then JSON-*encodes* whatever JS value it\n * was handed. That is the whole of #376 — the reason `json-param.ts` retypes\n * such a parameter through `text` and serialises it to match.\n *\n * False on SQLite, and not merely because the correction is unnecessary\n * there: it would be **wrong**, and it would not parse. A parameter's type is\n * the bound value's, and `cast(x as json)` is not a JSON cast at all — SQLite\n * takes any type name and applies affinity rules, and a name containing none\n * of INT/CHAR/CLOB/TEXT/BLOB/REAL/FLOA/DOUB gets NUMERIC affinity, so\n * `cast('{\"a\":1}' as json)` is `0`. Measured through `bun:sqlite` (Bun\n * 1.3.14):\n *\n * select cast(? as jsonb) -> 0 (runs)\n * select json_set('{\"a\":1}','$.b', cast(? as json)) -> {\"a\":1,\"b\":2}\n * select cast(? as text)::json -> ERROR unrecognized token: \":\"\n *\n * So the retyping's rewrite — `cast(? as text)::json` — turns a statement\n * that runs on SQLite today into a syntax error. `::` genuinely cannot fire\n * there (it does not parse), but `cast(… as …)` is not Postgres-only syntax,\n * and \"SQLite has no jsonb type\" is a claim about semantics rather than about\n * what the parser accepts. Asking here rather than matching on `name` is what\n * makes that a fact `tsc` and a test can hold.\n */\n readonly typesParametersFromStatement: boolean;\n\n /** Quote a table or column name. Only ever called with names from the schema. */\n quoteIdent(name: string): string;\n\n /**\n * The parameter marker for the `index`-th (0-based) parameter in a statement.\n * SQLite ignores the index and returns `?`; Postgres returns `$1`, `$2`, ...\n */\n placeholder(index: number): string;\n\n /**\n * Prisma-shaped value -> the value the driver must be handed for this field.\n * The mirror of `decode`, and just as load-bearing: Bun's SQLite driver binds\n * a `Date` to `NULL`, so an unencoded `where: { createdAt: date }` would\n * return no rows rather than failing.\n *\n * Applied at bind time, not compile time — it is a function of the value.\n * Which encoder runs is still decided from the schema, so compile stays pure.\n */\n encode(value: unknown, field: FieldSchema): unknown;\n\n /**\n * SQL appended to this field's placeholder, or `\"\"` for none.\n *\n * The one string a dialect contributes to the statement that is not a\n * parameter, so it must be a constant — never derived from a value, and never\n * from anything an application supplies. `fieldParam` is the only caller, and\n * a non-empty cast also means it serialises the value; the two travel\n * together and neither is correct alone (#209).\n */\n castParameter(field: FieldSchema): string;\n\n /**\n * The same, for a value with **no declared column type** — a parameter\n * interpolated into a composed raw fragment, where there is no schema to ask.\n *\n * It exists because \"raw\" cannot mean \"unportable\". Bun's SQLite driver\n * rejects a `Date` outright (`Binding expected string, TypedArray, boolean,\n * number, bigint or null`) while Postgres takes one, so\n * ``sql`where \"createdAt\" > ${date}` `` would work on one dialect and throw on\n * the other — and the caller has no dialect-independent value to reach for\n * instead, because milliseconds are only correct if that is what the ORM\n * stored. Which it is: this converts to exactly what `encode` writes for a\n * `DateTime`, so a raw statement compares against ORM-written rows correctly.\n *\n * Deliberately narrow. It normalises the JavaScript types whose SQL form the\n * ORM has already decided — a `Date`, a boolean — and touches nothing else. A\n * plain object is *not* JSON-encoded here: the compiler only knows to do that\n * because a field says `Json`, and guessing from the value would turn a\n * mistyped parameter into a successfully-written string.\n *\n * The exception is a parameter the *caller* cast to `json`/`jsonb`, which is\n * a declared type by another route and does not reach this at all — see\n * `json-param.ts`. It is still not a guess from the value: the statement says\n * so.\n */\n encodeUntyped(value: unknown): unknown;\n\n /** Driver value -> the value Prisma would have returned for this field. */\n decode(value: unknown, field: FieldSchema): unknown;\n\n /**\n * False when the driver already returns exactly what Prisma would for this\n * field, letting the shaper skip the call entirely on the hot path.\n */\n needsDecode(field: FieldSchema): boolean;\n\n /**\n * `<lhs> in (...)` / `<lhs> not in (...)`.\n *\n * `length` is the element count, which is shape information and is already\n * part of the plan key. `values` returns the whole array at bind time; how it\n * is spread across parameters is the dialect's business.\n */\n inList(\n lhs: string,\n negated: boolean,\n length: number,\n values: Binder,\n ): Fragment;\n\n /** `<lhs> like <pattern>`, case-insensitively when the dialect can. */\n like(lhs: string, insensitive: boolean, pattern: Binder): Fragment;\n\n /**\n * Whether this dialect can match a **tuple** of columns against a list of\n * tuples in a statement whose text does not grow with the list.\n *\n * The single-column case is `inList`, and on Postgres `= any($1)` already\n * gives one SQL text for every length — which is what lets `collapsedList`\n * keep a batched relation query to one plan entry however many parents it\n * has. A relation joining on *more than one* field cannot use it, so the\n * loader falls back to an `OR` of `AND`s whose text does grow, and the plan\n * cache churns with the parent count (#97).\n *\n * `unnest` closes that on Postgres — one array parameter per *column*, so the\n * text is fixed — but it needs each column's SQL type for the cast, and the\n * types are asked about here rather than assumed: a dialect that cannot spell\n * one of them says so and the caller keeps the portable `OR`.\n */\n canBindCompositeIn(types: readonly ScalarType[]): boolean;\n\n /**\n * `(a, b) in (select * from unnest($1::t[], $2::u[]))`.\n *\n * `values` yields one tuple per parent at bind time; the dialect decides how\n * they are transposed into per-column arrays. Only called when\n * {@link canBindCompositeIn} returned true for these types.\n */\n compositeIn(\n columns: readonly string[],\n types: readonly ScalarType[],\n values: Binder,\n ): Fragment;\n\n /**\n * The filters this dialect can apply to a **scalar list** — `tags String[]`.\n *\n * **Empty is the whole of SQLite's answer**, and it is a capability rather\n * than a gap in this ORM: SQLite has no array type, and Prisma refuses the\n * declaration there at validation time — *\"Field `tags` in model `User` can't\n * be a list. The current connector does not support lists of primitive\n * types.\"* So a SQLite database cannot hold such a column to begin with.\n *\n * The refusal lives here rather than in the generator, which is where it used\n * to live (#300). The generated artifact is dialect-agnostic on purpose —\n * `DATABASE_URL` can name a different database than `prisma generate` saw —\n * so a generator that refused a scalar list refused it for Postgres too, and\n * one `String[]` anywhere meant no artifact for *any* model. Asking the\n * dialect at compile time refuses exactly the combination that cannot work,\n * and names it, which is the shape {@link UnsupportedDialectError} already\n * has for the dialects with no compiler at all.\n */\n readonly listFilters: ReadonlySet<string>;\n\n /**\n * `<value> = any(<column>)` — is this element in the list?\n *\n * The mirror of {@link inList} rather than a variant of it, and the two are\n * easy to confuse: there, one column is matched against a caller's list;\n * here, one caller value is matched against a column that *is* a list.\n *\n * **These four take a `Fragment` where every other member here takes a\n * `Binder`**, which is a deliberate exception. A list operand may need a cast\n * on its placeholder — a single element of a `Json[]` needs #209's\n * `::text::jsonb`, and the serialisation that must travel with it — so the\n * parameter is built by `fieldParam` before it arrives and the dialect\n * chooses only the operator. Handing over a `Binder` instead would oblige\n * each dialect to restate `fieldParam`'s rule, and restating it slightly\n * wrong is silent: `$1::jsonb = any(col)` answers *false* where\n * `$1::text::jsonb = any(col)` answers true, with no error on either.\n */\n listHas(column: string, value: Fragment): Fragment;\n\n /** `hasEvery` — every element of the operand is present in the column. */\n listHasEvery(column: string, values: Fragment): Fragment;\n\n /** `hasSome` — the column and the operand share at least one element. */\n listHasSome(column: string, values: Fragment): Fragment;\n\n /**\n * `isEmpty: true`, or its negation when `empty` is false.\n *\n * The odd one out with no operand at all: the value being compared against is\n * the empty list, which is the compiler's own constant rather than the\n * caller's. It stays a bound parameter regardless — see `jsonNullComparison`,\n * which declines the same exception for the same reason.\n */\n listIsEmpty(column: string, empty: boolean): Fragment;\n\n /**\n * The right-hand side of a `push`: the column's current value with the\n * operand appended. An expression rather than a statement, because it is\n * assigned by the write compiler like any other `set` value.\n */\n listPush(column: string, values: Fragment): Fragment;\n\n /**\n * How this dialect spells a JSON path, and which filters it can apply to one.\n *\n * The **path grammar itself differs**, which is unusual enough to be worth\n * stating rather than hiding: Prisma takes `path: [\"a\", \"b\"]` on Postgres and\n * `path: \"$.a.b\"` on SQLite, and refuses the other form on each. That is not\n * a gemi choice — it is the shape the generated client accepts, measured on\n * both — so reproducing it is what \"Prisma-compatible\" means here.\n *\n * `jsonFilters` is the set of scalar filters the dialect can apply to an\n * extracted value. Prisma refuses `array_contains` and the numeric\n * comparisons on SQLite with *\"Unknown argument\"*, so refusing them here is\n * matching it rather than falling short of it.\n */\n readonly jsonPathSyntax: \"array\" | \"jsonpath\";\n readonly jsonFilters: ReadonlySet<string>;\n\n /**\n * Whether an extracted value compares as **text**.\n *\n * Postgres's `#>>` yields `text`, so `equals: 3` has to bind `\"3\"` — comparing\n * text to an integer parameter is a type error there. SQLite's `json_extract`\n * yields a native value, so the same filter has to bind `3`: bind `\"3\"` and\n * SQLite compares an INTEGER to a TEXT, which is silently *false* rather than\n * an error. One filter, two encodings, and the wrong one is a returned-no-rows\n * bug on one dialect and a raised error on the other.\n */\n readonly jsonComparesAsText: boolean;\n\n /**\n * The extracted value, as a fragment whose path is **bound**.\n *\n * A JSON path is the one place a caller's *value* decides part of an\n * expression's meaning, which makes it the obvious place to interpolate by\n * accident and break invariant 2. Both dialects can take it as a parameter —\n * Postgres's `#>` accepts a `text[]`, SQLite's `json_extract` a string — so\n * nothing has to be bent to keep it out of the SQL text.\n *\n * `asText` picks the extraction that yields SQL text rather than JSON. Every\n * comparison in `jsonComparison` passes `true` — the string filters compare\n * against text, and `equals` / `not` / the numeric operators compare an\n * extracted *scalar*, which is what the text form gives them. The JSON form\n * has exactly one caller, `jsonArrayContains`, because containment is the one\n * operator whose right-hand side is a document.\n *\n * SQLite ignores the flag: `json_extract` already yields a SQL value rather\n * than a JSON document for a scalar at the path. That is why the null\n * sentinels need {@link jsonValueAt} instead of this — see there.\n */\n jsonExtract(column: string, path: Binder, asText: boolean): Fragment;\n\n /** `<extracted> @> <value>` — Postgres only; see `jsonFilters`. */\n jsonArrayContains(column: string, path: Binder, value: Binder): Fragment;\n\n /**\n * The value at `path` **as JSON**, in the form two JSON values compare in.\n *\n * The difference from {@link jsonExtract} is the whole of #407, and it is the\n * distinction the null sentinels are made of. Both dialects have an\n * extraction that collapses \"the key is absent\" into \"the key holds the JSON\n * value `null`\", and both have one that does not:\n *\n * | | collapses | keeps the distinction |\n * | --- | --- | --- |\n * | postgres | `#>>` (text) | `#>` (jsonb) |\n * | sqlite | `json_extract` | `->` (JSON text) |\n *\n * `jsonExtract` is the left column at `asText: true`, which is what every\n * scalar comparison wants — a value to compare, not a document. This is the\n * right column, and it is what lets `equals: DbNull` compile to\n * `<value at path> is null` while `equals: JsonNull` compiles to\n * `<value at path> = <the JSON null>`. Refusing them because `#>>` cannot\n * tell the two apart was true of `#>>` and not of the dialect.\n *\n * **Postgres casts and SQLite does not**, and the cast is not decoration:\n * `#>` on a `json` column (a `@db.Json` field) yields `json`, which has no\n * equality operator at all — *\"operator does not exist: json = jsonb\"*, a\n * raised error rather than a wrong answer, but still one Prisma does not\n * raise. Prisma emits `(…#>…)::jsonb` for exactly this reason and so does\n * this. SQLite's `->` already yields the JSON text form.\n *\n * Bound, never interpolated, for the same reason `jsonExtract` is.\n */\n jsonValueAt(column: string, path: Binder): Fragment;\n\n /**\n * Whether the JSON value at `path` — the column itself when `path` is\n * `undefined` — is an **object** holding the key, any of the keys, or all of\n * them: `has_key`, `has_some_keys`, `has_every_key` (#664).\n *\n * `keys` binds a string for `\"one\"` and a string array for the other two;\n * `count` is that array's length, which SQLite needs because it tests one\n * key per term. Postgres binds the array whole, so its text does not depend\n * on `count` and the plan key collapses the list (`LIST_KEYS` in `plan.ts`).\n *\n * **Objects only, on both dialects.** Postgres's `?` also matches a string\n * *element* of a top-level array; SQLite's path lookup does not. Both forms\n * are guarded with \"the value is an object\" so the two answer the same rows:\n * `has_every_key: []` is \"is an object\", and `has_some_keys: []` is false.\n * A key holding the JSON value `null` exists.\n */\n jsonHasKeys(\n column: string,\n path: Binder | undefined,\n keys: Binder,\n mode: \"one\" | \"some\" | \"every\",\n count: number,\n ): Fragment;\n\n /**\n * `lhs` differs from `rhs`, treating NULL as equal to NULL — the guard\n * `skipIfUnchanged` adds to an update's `where` (#664).\n *\n * `rhs` is the same parameter the `set` binds, so the comparison is against\n * the stored encoding of the value. A `Json` column compares as JSON rather\n * than as text: `jsonb` equality on Postgres (key order and whitespace do not\n * matter), and `json()`-normalised text on SQLite (whitespace does not\n * matter; key order does).\n */\n distinctFrom(lhs: string, rhs: Fragment, field: FieldSchema): Fragment;\n\n /**\n * `limit`/`offset`. Both are values and therefore parameters — this is the\n * single most tempting place in the compiler to inline a number.\n */\n paginate(take: Binder | null, skip: Binder | null): Fragment;\n\n /**\n * The clause that makes an insert skip rows violating a unique constraint —\n * `createMany({ skipDuplicates: true })` — or `null` where it is not offered.\n *\n * **`null` is a parity decision, not a missing feature**, and that is worth\n * knowing before someone \"fixes\" SQLite by returning `insert or ignore`.\n * SQLite has `on conflict do nothing` and has since 3.24; Prisma nonetheless\n * rejects the *argument* on SQLite — `Unknown argument 'skipDuplicates'`,\n * whatever its value, verified against a generated 6.19 client. Offering it\n * here would make gemi a silent superset of Prisma on the one dialect the\n * differential harness could then no longer compare, which is the trade this\n * project has declined every other time it came up.\n *\n * A method rather than a boolean because the SQL differs where it exists, and\n * a `Fragment` because everything the compiler emits is one.\n */\n ignoreConflicts(): Fragment | null;\n\n /**\n * The clause a locking read ends with — `lock: \"update\"` on a `findMany` —\n * naming `table` as the only table whose rows are locked.\n *\n * Scoped to the root table (`for update of \"User\"`) rather than left bare,\n * because a folded `include` puts a lateral subquery in the `from` clause and\n * Postgres refuses to lock through one (`FOR UPDATE is not allowed with\n * aggregate functions`). Scoping it also matches the documented contract on\n * both strategies: the root rows are locked, related rows never are.\n *\n * **Empty on SQLite, and that is a decision.** SQLite has no row locks, and\n * does not need them for what a locking read is for: its transactions are\n * serializable, with one writer at a time on the whole database, so the lost\n * update a row lock prevents cannot happen there. Two transactions that race\n * wait on (or fail with `SQLITE_BUSY` on) the database lock instead of the\n * row's, and `skipLocked` / `noWait` have no row lock to react to. Refusing\n * would stop code that runs on Postgres in production from running against\n * SQLite in development and tests, for no gain. The one misuse that matters\n * on both — a lock outside a transaction — is refused in `Model.$execute`\n * on every dialect.\n */\n rowLock(lock: RowLockClause, table: string): Fragment;\n\n /**\n * Recognise a driver error as a constraint violation, and say which columns\n * it names.\n *\n * Returns `null` for anything else, including the *other* constraint kinds:\n * SQLite reports NOT NULL and FOREIGN KEY failures through the same exception\n * type, and reporting one of those as a duplicate-key error would send a\n * caller looking for a row that does not exist.\n *\n * Columns, not fields — the driver only knows the database's names. The\n * caller maps them back through the schema, where `@map` is in scope.\n */\n constraintViolation(error: unknown): ConstraintViolation | null;\n}\n\n/** A driver error identified as a constraint failure, in dialect-neutral terms. */\nexport interface ConstraintViolation {\n /** Only `unique` is translated today; the rest surface as the raw error. */\n kind: \"unique\";\n /** Database column names, in the order the driver reported them. */\n columns: string[];\n /** The constraint's own name, when the driver gives one. Postgres does. */\n constraint?: string;\n}\n\n/**\n * The ORM was asked to compile against a dialect it does not implement.\n *\n * **The split this message has to convey**, because it is the surprising part:\n * `DatabaseManager` connects to MySQL and MariaDB perfectly well — Bun's client\n * speaks all four — so raw SQL through `DB.query` / `DB.sql` works, and\n * transactions work. What does not exist is a `SqlDialect` for them, so\n * everything that *compiles* a statement stops here.\n *\n * A caller who reads only \"not supported\" reasonably concludes the connection\n * is unusable, which is wrong and is the more expensive misreading: it is the\n * ORM that is unavailable, not the database.\n */\nexport class UnsupportedDialectError extends Error {\n constructor(dialect: Dialect) {\n super(\n `The gemi ORM does not support the '${dialect}' dialect. Only sqlite ` +\n `and postgres are implemented — see the supported matrix in ` +\n `docs/orm.md.\\n\\n` +\n `The *connection* is fine: Bun's client speaks ${dialect}, so raw SQL ` +\n `through DB.query / DB.sql and transactions all work. It is the query ` +\n `compiler that has no ${dialect} dialect, so every model operation ` +\n `raises this.\\n\\n` +\n `Point DATABASE_URL at Postgres or SQLite to use the ORM, or keep ` +\n `using Prisma's own client for this database.`,\n );\n this.name = \"UnsupportedDialectError\";\n }\n}\n\n/**\n * Whether the ORM can compile for this dialect at all.\n *\n * Exported so an application can find out at **boot** rather than on its first\n * query. That is the whole gap this closes: `DatabaseManager` constructs\n * happily against MySQL, so a deploy pointed at one starts, passes a health\n * check, serves traffic, and fails on the first model read — which is the\n * latest and most expensive moment to learn it.\n */\nexport function ormSupports(dialect: Dialect): boolean {\n return COMPILERS[dialect] !== null;\n}\n\n/** Every dialect `Dialect` names, for anything that has to walk them all. */\nexport function everyDialect(): Dialect[] {\n return Object.keys(COMPILERS) as Dialect[];\n}\n\n/**\n * The compiler for each dialect, or `null` where the ORM has none.\n *\n * **One map rather than two lists, and `satisfies` rather than a lookup.** The\n * supported set used to be written three times — `ormSupports`' `||` chain,\n * `dialectFor`'s `if` chain, and a test enumerating a hand-written copy of the\n * `Dialect` union — so adding a fifth member to that union changed nothing\n * anywhere: `tsc` clean, tests green, the new dialect silently reported as\n * unsupported by one function and unknown to the other.\n *\n * That moment is exactly what the guard exists for. Adding a dialect to the\n * union is the *first step of implementing one*, and it is the step where a\n * half-added dialect would disagree with itself.\n *\n * `satisfies Record<Dialect, …>` makes it a compile error in a file the build\n * actually checks. It has to live here rather than in a test: `tsconfig.json`\n * excludes test files and vitest transpiles without type-checking, so an\n * exhaustiveness check written there is a type error nothing ever evaluates.\n *\n * The sixth thing in this codebase made `tsc`'s job rather than a convention's\n * — see the note on `resolveLink`'s `operation`.\n */\nconst COMPILERS = {\n sqlite: new SqliteDialect(),\n postgres: new PostgresDialect(),\n // Bun's client speaks both; the ORM has no compiler for either. See\n // `UnsupportedDialectError`, which is careful to say that the *connection*\n // still works.\n mysql: null,\n mariadb: null,\n} satisfies Record<Dialect, SqlDialect | null>;\n\n/**\n * Resolved per call from `DatabaseManager.dialect`, never baked into a\n * generated artifact — `DATABASE_URL` can point at a different database than\n * the one `prisma generate` saw.\n */\nexport function dialectFor(dialect: Dialect): SqlDialect {\n const compiler = COMPILERS[dialect];\n if (compiler === null) throw new UnsupportedDialectError(dialect);\n return compiler;\n}\n\nexport { PostgresDialect, SqliteDialect };\n"
|
|
11
10
|
],
|
|
12
|
-
"mappings": ";AAQO,MAAM,UAA8B,KAAM,CAE7B,SACA,MACA,UAHlB,WAAW,CACO,EACA,EACA,EAsBhB,EACA,CACA,MACE,8BAA8B,WAAkB,KAAS,OACvD,CACJ,EA7BgB,gBACA,aACA,iBA4BhB,KAAK,KAAO,wBAEhB,CAuDO,MAAM,UAA6B,CAAsB,CAC9D,WAAW,CACT,EACA,EACA,EAEA,EACA,CACA,MAAM,EAAU,EAAO,EAAW,CAAM,EACxC,KAAK,KAAO,uBACZ,KAAK,QAAU,YAAY,OAAc,KAAS,OAAe,IAErE,CAEO,MAAM,UAAiC,CAAsB,CAClE,WAAW,CACT,EACA,EACA,EAEA,EACA,CACA,MAAM,EAAU,EAAO,EAAW,CAAM,EACxC,KAAK,KAAO,2BACZ,KAAK,QACH,gCAAgC,OAAc,KAAS,iDACV,IAEnD,CAOO,MAAM,UAA0B,KAAM,CAEzB,MACA,MAFlB,WAAW,CACO,EACA,EAChB,EACA,CACA,MACE,IAAI,8BAAkC,oBACnB,EAAM,KAAK,IAAI,IACpC,EAPgB,aACA,aAOhB,KAAK,KAAO,oBAEhB,CAYO,MAAM,UAAoB,KAAM,CAEnB,MACA,MAFlB,WAAW,CACO,EACA,EAChB,CACA,MACE,8BAA8B,KAAK,UAAU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