viborm 1.14.2 → 1.15.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/{adapter-namespace-DaRiTIIf.mjs → adapter-namespace-DD-BQ2Wk.mjs} +2 -2
- package/dist/{adapter-namespace-DaRiTIIf.mjs.map → adapter-namespace-DD-BQ2Wk.mjs.map} +1 -1
- package/dist/adapters.d.mts +15 -3
- package/dist/adapters.mjs +1 -1
- package/dist/{args-764KdWMr.mjs → args-BvA37zBZ.mjs} +2 -2
- package/dist/{args-764KdWMr.mjs.map → args-BvA37zBZ.mjs.map} +1 -1
- package/dist/{batch-refs-C-gx7A4-.mjs → batch-refs-BmEpMmjI.mjs} +2 -2
- package/dist/{batch-refs-C-gx7A4-.mjs.map → batch-refs-BmEpMmjI.mjs.map} +1 -1
- package/dist/bun-sql.d.mts +1 -1
- package/dist/bun-sql.mjs +1 -1
- package/dist/bun-sqlite.d.mts +1 -1
- package/dist/bun-sqlite.mjs +1 -1
- package/dist/cache/cloudflare-kv.d.mts +1 -1
- package/dist/cache/cloudflare-kv.mjs +1 -1
- package/dist/cache/memory.d.mts +1 -1
- package/dist/cache/memory.mjs +1 -1
- package/dist/cache.d.mts +2 -2
- package/dist/cache.mjs +1 -1
- package/dist/{call-Cz8XUmrl.mjs → call-BWFI7-vU.mjs} +2 -2
- package/dist/{call-Cz8XUmrl.mjs.map → call-BWFI7-vU.mjs.map} +1 -1
- package/dist/cli.mjs +2 -2
- package/dist/cli.mjs.map +1 -1
- package/dist/client-CVCC-D1j.mjs +2 -0
- package/dist/client-CVCC-D1j.mjs.map +1 -0
- package/dist/{client-CRxfhw2y.d.mts → client-DZ39sYy2.d.mts} +2 -2
- package/dist/{client-y7TV0PRZ.mjs → client-DtPTegtA.mjs} +2 -2
- package/dist/{client-y7TV0PRZ.mjs.map → client-DtPTegtA.mjs.map} +1 -1
- package/dist/client.d.mts +3 -3
- package/dist/client.mjs +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/{confine-DqFBTUw6.mjs → confine-BGGv2du0.mjs} +2 -2
- package/dist/{confine-DqFBTUw6.mjs.map → confine-BGGv2du0.mjs.map} +1 -1
- package/dist/{coordination-6qZHx_kl.mjs → coordination-BY6Np3xV.mjs} +2 -2
- package/dist/{coordination-6qZHx_kl.mjs.map → coordination-BY6Np3xV.mjs.map} +1 -1
- package/dist/d1.d.mts +1 -1
- package/dist/d1.mjs +1 -1
- package/dist/{database-adapter-BGqvjeEy.d.mts → database-adapter-D62c-uC6.d.mts} +604 -473
- package/dist/{datetime-physical-codec-Dj-APo9f.mjs → datetime-physical-codec-BS2T81sD.mjs} +2 -2
- package/dist/{datetime-physical-codec-Dj-APo9f.mjs.map → datetime-physical-codec-BS2T81sD.mjs.map} +1 -1
- package/dist/{defaults-DwOHWI_M.mjs → defaults-CrtGVdEC.mjs} +2 -2
- package/dist/{defaults-DwOHWI_M.mjs.map → defaults-CrtGVdEC.mjs.map} +1 -1
- package/dist/{document-BVTQ-cF-.d.mts → document-o5Bd5ZoJ.d.mts} +1 -1
- package/dist/{driver-BBEmaJZy.d.mts → driver-0cdCF_KD.d.mts} +1 -1
- package/dist/{driver-BGVcgnIX.mjs → driver-D1grnHEr.mjs} +2 -2
- package/dist/{driver-BGVcgnIX.mjs.map → driver-D1grnHEr.mjs.map} +1 -1
- package/dist/{driver-BIXhOH2_.mjs → driver-Df88hu4U.mjs} +2 -2
- package/dist/{driver-BIXhOH2_.mjs.map → driver-Df88hu4U.mjs.map} +1 -1
- package/dist/driver.d.mts +1 -1
- package/dist/driver.mjs +1 -1
- package/dist/durable-object.d.mts +1 -1
- package/dist/durable-object.mjs +1 -1
- package/dist/error-mapping-DIRlrmDK.mjs +2 -0
- package/dist/error-mapping-DIRlrmDK.mjs.map +1 -0
- package/dist/every-BHEmfLOW.mjs +2 -0
- package/dist/{every-tOgQmaIE.mjs.map → every-BHEmfLOW.mjs.map} +1 -1
- package/dist/execution-context-VMQm-9CH.mjs +2 -0
- package/dist/execution-context-VMQm-9CH.mjs.map +1 -0
- package/dist/{exports-COCJ8f2f.d.mts → exports-Bzvtum3F.d.mts} +1 -1
- package/dist/geo-area-codec-BDvW7IH-.mjs +2 -0
- package/dist/{geo-area-codec-mHrM3b9A.mjs.map → geo-area-codec-BDvW7IH-.mjs.map} +1 -1
- package/dist/{hydration-A3zffFWP.mjs → hydration-D7U8HACL.mjs} +2 -2
- package/dist/{hydration-A3zffFWP.mjs.map → hydration-D7U8HACL.mjs.map} +1 -1
- package/dist/{identifier-conversion-DHYPTgzr.mjs → identifier-conversion-Ci_iaJ0b.mjs} +2 -2
- package/dist/{identifier-conversion-DHYPTgzr.mjs.map → identifier-conversion-Ci_iaJ0b.mjs.map} +1 -1
- package/dist/identifiers-BTCfD5ic.mjs +2 -0
- package/dist/identifiers-BTCfD5ic.mjs.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/instrumentation.d.mts +1 -1
- package/dist/instrumentation.mjs +1 -1
- package/dist/{introspect-Bm6xnXcG.mjs → introspect-C4T5gt9O.mjs} +2 -2
- package/dist/{introspect-Bm6xnXcG.mjs.map → introspect-C4T5gt9O.mjs.map} +1 -1
- package/dist/{json-DgMc8-GU.mjs → json-CHdgejCt.mjs} +2 -2
- package/dist/{json-DgMc8-GU.mjs.map → json-CHdgejCt.mjs.map} +1 -1
- package/dist/judge-words-DpwxOfre.mjs +2 -0
- package/dist/judge-words-DpwxOfre.mjs.map +1 -0
- package/dist/{key-hxFFCKed.mjs → key-B3xgpu0M.mjs} +2 -2
- package/dist/{key-hxFFCKed.mjs.map → key-B3xgpu0M.mjs.map} +1 -1
- package/dist/{keys-BQxM4c_a.mjs → keys-1Z6WKrnE.mjs} +1 -1
- package/dist/{keys-BQxM4c_a.mjs.map → keys-1Z6WKrnE.mjs.map} +1 -1
- package/dist/{libsql-DuGR904j.mjs → libsql-DJRsCDT_.mjs} +2 -2
- package/dist/{libsql-DuGR904j.mjs.map → libsql-DJRsCDT_.mjs.map} +1 -1
- package/dist/libsql.d.mts +1 -1
- package/dist/libsql.mjs +1 -1
- package/dist/{memory-G4cSuc6A.mjs → memory-gjKMy3Ql.mjs} +2 -2
- package/dist/{memory-G4cSuc6A.mjs.map → memory-gjKMy3Ql.mjs.map} +1 -1
- package/dist/methods-part-DoTrY6b9.mjs +2 -0
- package/dist/methods-part-DoTrY6b9.mjs.map +1 -0
- package/dist/migrations/mysql.d.mts +4 -4
- package/dist/migrations/mysql.mjs +1 -1
- package/dist/migrations/postgres.d.mts +4 -4
- package/dist/migrations/postgres.mjs +1 -1
- package/dist/migrations/snowflake.d.mts +4 -4
- package/dist/migrations/snowflake.mjs +1 -1
- package/dist/migrations/sqlite.d.mts +4 -4
- package/dist/migrations/sqlite.mjs +1 -1
- package/dist/migrations/storage/durable-object.mjs +1 -1
- package/dist/migrations/storage/r2.mjs +1 -1
- package/dist/migrations/surrealdb.d.mts +4 -4
- package/dist/migrations/surrealdb.mjs +1 -1
- package/dist/migrations/tenant.d.mts +2 -2
- package/dist/migrations/tenant.mjs +1 -1
- package/dist/migrations.d.mts +4 -4
- package/dist/migrations.mjs +1 -1
- package/dist/{mysql-BNXWfTOo.mjs → mysql-BH0Z3PlH.mjs} +2 -2
- package/dist/{mysql-BNXWfTOo.mjs.map → mysql-BH0Z3PlH.mjs.map} +1 -1
- package/dist/mysql-adapter-B06Ve3ds.mjs +2 -0
- package/dist/mysql-adapter-B06Ve3ds.mjs.map +1 -0
- package/dist/mysql2.d.mts +1 -1
- package/dist/mysql2.mjs +1 -1
- package/dist/named-statements-Bdz2GD5R.d.mts +13 -0
- package/dist/named-statements-CMj1QEyw.mjs +2 -0
- package/dist/named-statements-CMj1QEyw.mjs.map +1 -0
- package/dist/{native-types-DgjMUikz.mjs → native-types-DspZ0Z5E.mjs} +2 -2
- package/dist/{native-types-DgjMUikz.mjs.map → native-types-DspZ0Z5E.mjs.map} +1 -1
- package/dist/neon-http.d.mts +1 -1
- package/dist/neon-http.mjs +1 -1
- package/dist/{object-store-B_YMoW8u.d.mts → object-store-D5x-Yf7w.d.mts} +3 -3
- package/dist/{object-store-DS0F0yZX.mjs → object-store-WIE0DGGG.mjs} +1 -1
- package/dist/{object-store-DS0F0yZX.mjs.map → object-store-WIE0DGGG.mjs.map} +1 -1
- package/dist/{on-ylYaKuRu.mjs → on-DvrfHGje.mjs} +2 -2
- package/dist/{on-ylYaKuRu.mjs.map → on-DvrfHGje.mjs.map} +1 -1
- package/dist/on.d.mts +1 -1
- package/dist/on.mjs +1 -1
- package/dist/ordering/keys.mjs +1 -1
- package/dist/ordering.d.mts +1 -1
- package/dist/ordering.mjs +1 -1
- package/dist/pending-operation-Dq4rv-Ml.mjs +2 -0
- package/dist/pending-operation-Dq4rv-Ml.mjs.map +1 -0
- package/dist/permissions.d.mts +1 -1
- package/dist/permissions.mjs +1 -1
- package/dist/pg.d.mts +27 -1
- package/dist/pg.mjs +1 -1
- package/dist/pg.mjs.map +1 -1
- package/dist/pglite.d.mts +1 -1
- package/dist/pglite.mjs +1 -1
- package/dist/{physical-CeE2nYmI.mjs → physical-wboFLAg9.mjs} +2 -2
- package/dist/{physical-CeE2nYmI.mjs.map → physical-wboFLAg9.mjs.map} +1 -1
- package/dist/planetscale.d.mts +1 -1
- package/dist/planetscale.mjs +1 -1
- package/dist/{planner-DHjdvjwk.d.mts → planner-Ckoxeruk.d.mts} +1 -1
- package/dist/{postgres-CDdh5dSP.mjs → postgres-DQ_pO0hi.mjs} +2 -2
- package/dist/{postgres-CDdh5dSP.mjs.map → postgres-DQ_pO0hi.mjs.map} +1 -1
- package/dist/{postgres-adapter-axapXX8d.mjs → postgres-adapter-Byp7Zpop.mjs} +2 -2
- package/dist/{postgres-adapter-axapXX8d.mjs.map → postgres-adapter-Byp7Zpop.mjs.map} +1 -1
- package/dist/postgres-adapter-Ia4u0-Ht.mjs +2 -0
- package/dist/postgres-adapter-Ia4u0-Ht.mjs.map +1 -0
- package/dist/postgres-result-CiS5OWp1.mjs +2 -0
- package/dist/postgres-result-CiS5OWp1.mjs.map +1 -0
- package/dist/postgres.d.mts +17 -1
- package/dist/postgres.mjs +1 -1
- package/dist/postgres.mjs.map +1 -1
- package/dist/{provider-limits-Ccsb8PTb.mjs → provider-limits-CCOa4d1E.mjs} +2 -2
- package/dist/{provider-limits-Ccsb8PTb.mjs.map → provider-limits-CCOa4d1E.mjs.map} +1 -1
- package/dist/{provider-parameter-snapshot-BikrgKqI.mjs → provider-parameter-snapshot-C0ehKSAA.mjs} +2 -2
- package/dist/{provider-parameter-snapshot-BikrgKqI.mjs.map → provider-parameter-snapshot-C0ehKSAA.mjs.map} +1 -1
- package/dist/query-Cdy8E2jM.mjs +2 -0
- package/dist/query-Cdy8E2jM.mjs.map +1 -0
- package/dist/{query-inspection-BoG-yAln.mjs → query-inspection-C-T2ttRx.mjs} +2 -2
- package/dist/{query-inspection-BoG-yAln.mjs.map → query-inspection-C-T2ttRx.mjs.map} +1 -1
- package/dist/{raw-Dyq6Y6UX.mjs → raw-uaVIxHcE.mjs} +2 -2
- package/dist/{raw-Dyq6Y6UX.mjs.map → raw-uaVIxHcE.mjs.map} +1 -1
- package/dist/{relation-bound-ku_cMdye.mjs → relation-bound-BaU-LuuI.mjs} +1 -1
- package/dist/{relation-bound-ku_cMdye.mjs.map → relation-bound-BaU-LuuI.mjs.map} +1 -1
- package/dist/{rule-words-ZIGm7cDm.mjs → rule-words-C4lXzgW2.mjs} +2 -2
- package/dist/{rule-words-ZIGm7cDm.mjs.map → rule-words-C4lXzgW2.mjs.map} +1 -1
- package/dist/scalar-B9WizsvR.mjs +4 -0
- package/dist/scalar-B9WizsvR.mjs.map +1 -0
- package/dist/schema/introspect.d.mts +2 -2
- package/dist/schema/introspect.mjs +1 -1
- package/dist/schema/json.d.mts +2 -2
- package/dist/schema/json.mjs +1 -1
- package/dist/{schema-BYA-_bpk.mjs → schema-MB-pPNTO.mjs} +2 -2
- package/dist/schema-MB-pPNTO.mjs.map +1 -0
- package/dist/{schema-CFIaebgi.mjs → schema-TthAXPVP.mjs} +2 -2
- package/dist/{schema-CFIaebgi.mjs.map → schema-TthAXPVP.mjs.map} +1 -1
- package/dist/schema-introspection-wMVZowIF.mjs +6 -0
- package/dist/schema-introspection-wMVZowIF.mjs.map +1 -0
- package/dist/schema.d.mts +1 -1
- package/dist/schema.mjs +1 -1
- package/dist/select-assembly-SuVxJjps.mjs +2 -0
- package/dist/select-assembly-SuVxJjps.mjs.map +1 -0
- package/dist/{serializer-rBq3v1xr.mjs → serializer-B2kk7NAR.mjs} +5 -5
- package/dist/{serializer-rBq3v1xr.mjs.map → serializer-B2kk7NAR.mjs.map} +1 -1
- package/dist/{settled-BjyuA76m.mjs → settled-Dkk5w1vE.mjs} +2 -2
- package/dist/{settled-BjyuA76m.mjs.map → settled-Dkk5w1vE.mjs.map} +1 -1
- package/dist/{snowflake-UOCC820W.mjs → snowflake-6sBLJi34.mjs} +2 -2
- package/dist/{snowflake-UOCC820W.mjs.map → snowflake-6sBLJi34.mjs.map} +1 -1
- package/dist/snowflake.d.mts +2 -2
- package/dist/snowflake.mjs +1 -1
- package/dist/snowflake.mjs.map +1 -1
- package/dist/soft-delete.d.mts +1 -1
- package/dist/soft-delete.mjs +1 -1
- package/dist/{spans-XDUFeTzC.mjs → spans-BE-EjlZK.mjs} +1 -1
- package/dist/{spans-XDUFeTzC.mjs.map → spans-BE-EjlZK.mjs.map} +1 -1
- package/dist/sql-BGjAsoBE.mjs +2 -0
- package/dist/sql-BGjAsoBE.mjs.map +1 -0
- package/dist/{sql-Dl6nykFV.mjs → sql-CFxGrk3K.mjs} +2 -2
- package/dist/{sql-Dl6nykFV.mjs.map → sql-CFxGrk3K.mjs.map} +1 -1
- package/dist/{sql-BVZ8QefY.d.mts → sql-CXtSIPzy.d.mts} +11 -5
- package/dist/sql.d.mts +1 -1
- package/dist/sql.mjs +1 -1
- package/dist/{sqlite-adapter-Ad0d-m2t.mjs → sqlite-adapter-fIbNDvwO.mjs} +2 -2
- package/dist/{sqlite-adapter-Ad0d-m2t.mjs.map → sqlite-adapter-fIbNDvwO.mjs.map} +1 -1
- package/dist/{sqlite-utils-BRvbmlQ1.mjs → sqlite-utils-DcQct689.mjs} +2 -2
- package/dist/{sqlite-utils-BRvbmlQ1.mjs.map → sqlite-utils-DcQct689.mjs.map} +1 -1
- package/dist/sqlite3.d.mts +1 -1
- package/dist/sqlite3.mjs +1 -1
- package/dist/{standard-sql-qLcQyCtK.mjs → standard-sql-Bsf5nrla.mjs} +3 -3
- package/dist/standard-sql-Bsf5nrla.mjs.map +1 -0
- package/dist/surrealdb.d.mts +2 -2
- package/dist/surrealdb.mjs +1 -1
- package/dist/surrealdb.mjs.map +1 -1
- package/dist/{surrealql-C1dp1sWw.mjs → surrealql-DY7sgVnJ.mjs} +2 -2
- package/dist/{surrealql-C1dp1sWw.mjs.map → surrealql-DY7sgVnJ.mjs.map} +1 -1
- package/dist/{to-many-BybuKQM1.mjs → to-many-DiP6cOSQ.mjs} +2 -2
- package/dist/{to-many-BybuKQM1.mjs.map → to-many-DiP6cOSQ.mjs.map} +1 -1
- package/dist/{unit-BhHbZyuJ.mjs → unit-CSaAB0su.mjs} +2 -2
- package/dist/{unit-BhHbZyuJ.mjs.map → unit-CSaAB0su.mjs.map} +1 -1
- package/dist/{unit-words-CT0yeqfZ.mjs → unit-words-BGMVZ1MX.mjs} +2 -2
- package/dist/{unit-words-CT0yeqfZ.mjs.map → unit-words-BGMVZ1MX.mjs.map} +1 -1
- package/dist/{utils-CpAojrCj.mjs → utils-BLlgSQIo.mjs} +2 -2
- package/dist/{utils-CpAojrCj.mjs.map → utils-BLlgSQIo.mjs.map} +1 -1
- package/dist/validation-D0LG854o.mjs +2 -0
- package/dist/validation-D0LG854o.mjs.map +1 -0
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/dist/{validator-CZLW7aR3.mjs → validator-CDYlO9HV.mjs} +2 -2
- package/dist/{validator-CZLW7aR3.mjs.map → validator-CDYlO9HV.mjs.map} +1 -1
- package/dist/{values-B4aj1i1f.mjs → values-Byqn5wAh.mjs} +2 -2
- package/dist/{values-B4aj1i1f.mjs.map → values-Byqn5wAh.mjs.map} +1 -1
- package/dist/version-B_ZLWzLW.mjs +2 -0
- package/dist/{version-CXGIA82S.mjs.map → version-B_ZLWzLW.mjs.map} +1 -1
- package/package.json +35 -35
- package/dist/client-DRpX3-vw.mjs +0 -2
- package/dist/client-DRpX3-vw.mjs.map +0 -1
- package/dist/error-mapping-B1-IWkCQ.mjs +0 -2
- package/dist/error-mapping-B1-IWkCQ.mjs.map +0 -1
- package/dist/every-tOgQmaIE.mjs +0 -2
- package/dist/execution-context-BXpcbyPe.mjs +0 -2
- package/dist/execution-context-BXpcbyPe.mjs.map +0 -1
- package/dist/geo-area-codec-mHrM3b9A.mjs +0 -2
- package/dist/identifiers-s00pGES8.mjs +0 -2
- package/dist/identifiers-s00pGES8.mjs.map +0 -1
- package/dist/judge-words-CzUyXtJ6.mjs +0 -2
- package/dist/judge-words-CzUyXtJ6.mjs.map +0 -1
- package/dist/methods-part-ZY0f2AV_.mjs +0 -2
- package/dist/methods-part-ZY0f2AV_.mjs.map +0 -1
- package/dist/mysql-adapter-C69j1sKh.mjs +0 -2
- package/dist/mysql-adapter-C69j1sKh.mjs.map +0 -1
- package/dist/pending-operation-C_eOFOBE.mjs +0 -2
- package/dist/pending-operation-C_eOFOBE.mjs.map +0 -1
- package/dist/postgres-adapter-Dlr3ZWd7.mjs +0 -2
- package/dist/postgres-adapter-Dlr3ZWd7.mjs.map +0 -1
- package/dist/postgres-result-DF6DmW3r.mjs +0 -2
- package/dist/postgres-result-DF6DmW3r.mjs.map +0 -1
- package/dist/query-BZVHfA0s.mjs +0 -2
- package/dist/query-BZVHfA0s.mjs.map +0 -1
- package/dist/scalar-BHCh7aUz.mjs +0 -4
- package/dist/scalar-BHCh7aUz.mjs.map +0 -1
- package/dist/schema-BYA-_bpk.mjs.map +0 -1
- package/dist/schema-introspection-D0f8cti4.mjs +0 -6
- package/dist/schema-introspection-D0f8cti4.mjs.map +0 -1
- package/dist/select-assembly-DVI7d3tf.mjs +0 -2
- package/dist/select-assembly-DVI7d3tf.mjs.map +0 -1
- package/dist/sql-3o4DOKm9.mjs +0 -2
- package/dist/sql-3o4DOKm9.mjs.map +0 -1
- package/dist/standard-sql-qLcQyCtK.mjs.map +0 -1
- package/dist/validation-CYaJ8ndO.mjs +0 -2
- package/dist/validation-CYaJ8ndO.mjs.map +0 -1
- package/dist/version-CXGIA82S.mjs +0 -2
package/dist/neon-http.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $a as QueryResult, Ga as BatchTransactionOptions, Qa as QueryExecutionContext, Xa as CommittedBatchNotification, Ya as BatchQuery, h as Driver, li as Schema, pt as VibORMClient, qa as TransactionOptionSupport, st as DriverConfig, t as DatabaseAdapter, ut as NoExtraDriverConfigKeys, xi as LinkedClientConfig } from "./database-adapter-D62c-uC6.mjs";
|
|
2
2
|
import { NeonQueryFunction } from "@neondatabase/serverless";
|
|
3
3
|
|
|
4
4
|
//#region src/drivers/neon-http/index.d.ts
|
package/dist/neon-http.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./chunk-BuuaeEvq.mjs";import{h as t}from"./error-mapping-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{h as t}from"./error-mapping-DIRlrmDK.mjs";import{p as n,r}from"./validation--qS7OPmg.mjs";import{i}from"./normalized-result-B8pifWS0.mjs";import{n as a}from"./client-CVCC-D1j.mjs";import{c as o,d as s,r as c}from"./driver-Df88hu4U.mjs";import{t as l}from"./postgres-result-CiS5OWp1.mjs";import{t as u}from"./postgres-adapter-Byp7Zpop.mjs";const d={databaseUrl:!0,options:!0,pgvector:!0,postgis:!0,sharedRelationBodies:!0,relationsPerStatement:!0,namespace:!0};function malformedNeonResult(e,t){let r=e.operation??`execute`;return new n(`Driver "neon-http" returned a malformed result payload for operation "${r}": ${t}.`,{meta:{driver:`neon-http`,...e,operation:r}})}function assertNeonFullResult(e,t){if(!(i(e)&&Array.isArray(e.fields))||typeof e.command!=`string`||!Object.hasOwn(e,`rowCount`)||e.rowCount!==null&&(typeof e.rowCount!=`number`||!Number.isFinite(e.rowCount)||!Number.isSafeInteger(e.rowCount)||e.rowCount<0)||!Array.isArray(e.rows)||!e.rows.every(i)||e.rowAsArray!==!1)throw malformedNeonResult(t,`expected fullResults object with object rows and explicit rowCount`)}var NeonHTTPDriver=class extends c{maxBindParametersPerStatement=65535;supportsTransactions=!1;supportsBatch=!0;supportsOrderedCommittedSegments=!0;driverOptions;queryTypes;constructor(e={}){super(`postgresql`,`neon-http`);let t=s(e);this.driverOptions=e,u(this,t,e)}async initClient(){let{neon:e,types:t}=await import(`@neondatabase/serverless`);if(!this.driverOptions.databaseUrl)throw new r(`Neon HTTP driver requires a databaseUrl`,{meta:{driver:this.driverName}});let identityParser=e=>e,getTypeParser=((e,n)=>[1082,1114,1184,1115,1182,1185].includes(e)&&n!==`binary`?identityParser:t.getTypeParser(e,n));return this.queryTypes={getTypeParser},e(this.driverOptions.databaseUrl,{fetchOptions:this.driverOptions.options?.fetchOptions,authToken:this.driverOptions.options?.authToken,fullResults:!0,arrayMode:!1})}async closeClient(e){}async execute(e,t,n,r){return this.executeQuery(e,t,n,r,`execute`)}async executeQuery(e,t,n,r,i){let a=r??{operation:i},o=await e.query(t,n,{arrayMode:!1,fullResults:!0,types:this.queryTypes});return this.parseResult(o,a)}async executeRaw(e,t,n,r){return this.executeQuery(e,t,n??[],r,`executeRaw`)}transactionOptionSupport(){return{isolationLevel:`provider`,timeout:!1,timeoutReason:`Neon HTTP runs a batch as one provider call with no interactive body to interrupt`,maxWait:`unsupported`,maxWaitReason:`Neon HTTP submits the batch immediately with no connection to acquire`}}transaction(e,n){return Promise.reject(t(this.driverName))}async executeBatch(e,t,n,r,i){let a=n??{operation:`executeBatch`},o=await e.transaction(t.map(t=>{let n=t.context??a;try{return e.query(t.sql,t.params??[],{types:this.queryTypes})}catch(e){throw this.normalizeStatementFailure(e,t.sql,this.getBatchDiagnosticParameters(t),n,!0)}}),{isolationLevel:i?.isolationLevel,arrayMode:!1,fullResults:!0});if(await r?.(),!Array.isArray(o)||o.length!==t.length){let e=Array.isArray(o)?o.length:0;throw malformedNeonResult(a,`expected ${t.length} statement results but received ${e}`)}return o.map((e,n)=>this.parseResult(e,t[n]?.context??a))}parseResult(e,t){let n=t.operation??`execute`;return assertNeonFullResult(e,t),{rows:e.rows,rowCount:l(e.rowCount,e.command,e.rows,{provider:`neon-http`,operation:n,model:t.model,correlationId:t.correlationId})}}};function createClient(e){o(e,`neon-http`,d);let{databaseUrl:t,options:n,pgvector:r,postgis:i}=e,c=s(e);return a(e,new NeonHTTPDriver({databaseUrl:t,options:n,pgvector:r,postgis:i,sharedRelationBodies:e.sharedRelationBodies,relationsPerStatement:e.relationsPerStatement,namespace:c}))}export{NeonHTTPDriver,createClient};
|
|
2
2
|
//# sourceMappingURL=neon-http.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as ResolveCallback, t as MigrationClient } from "./planner-
|
|
1
|
+
import { Wi as AnyModel, Za as Dialect } from "./database-adapter-D62c-uC6.mjs";
|
|
2
|
+
import { i as ResolveCallback, t as MigrationClient } from "./planner-Ckoxeruk.mjs";
|
|
3
3
|
import { i as Sha256, n as MigrationStorageWriter, r as PublishResult } from "./contract-CrIB-3ZJ.mjs";
|
|
4
|
-
import { B as MigrationCheckInput, V as MigrationDecisionV1 } from "./client-
|
|
4
|
+
import { B as MigrationCheckInput, V as MigrationDecisionV1 } from "./client-DZ39sYy2.mjs";
|
|
5
5
|
|
|
6
6
|
//#region src/adapters/databases/sqlite/storage/datetime.d.ts
|
|
7
7
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{n as e}from"./chunk-BuuaeEvq.mjs";import{n as t}from"./base-z-cH5ZBI.mjs";import{t as n}from"./migrations-BMiRjR-N.mjs";import{n as r}from"./canonical-json-Bl-fKFF_.mjs";import{a as i}from"./identity-CtW15WlB.mjs";function refuseWorkersKvWritable(){throw new n(`Workers KV cannot be a V1 estate writer: listing is eventually consistent and puts are not conditional`,t.MIGRATION_UNSUPPORTED_PROVIDER)}var ObjectStoreEstateStorage=class{store;constructor(e){this.store=e}async readEstate(){return this.store.get(`estate.json`)}async listStates(){return this.listHex(`states/`,`.json`)}async listSnapshots(){return this.listHex(`snapshots/`,`.json`)}async listSql(){return this.listHex(`sql/`,`.sql`)}async readState(e){return this.store.get(`states/${e}.json`)}async readSnapshot(e){return this.store.get(`snapshots/${e}.json`)}async readSql(e){return this.store.get(`sql/${e}.sql`)}async publishEstate(e){return this.publish(`estate.json`,e)}async publishSnapshot(e,t){return this.publish(`snapshots/${e}.json`,t)}async publishSql(e,t){return this.publish(`sql/${e}.sql`,t)}async publishState(e,r){if(!i(e))throw new n(`State id is not a SHA-256 digest`,t.MIGRATION_INVALID_ESTATE);return this.publish(`states/${e}.json`,r)}async publish(e,i){if(await this.store.putIfAbsent(e,i)===`created`)return{outcome:`created`};let a=await this.store.get(e);if(!(a&&r(a,i)))throw new n(`Object-store key ${e} already holds different bytes`,t.MIGRATION_CORRUPTION);return{outcome:`identical`}}async listHex(e,t){let n=await this.store.list(e),r=[];for(let a of n){let n=a.slice(e.length);if(!n.endsWith(t))continue;let o=n.slice(0,-t.length);i(o)&&r.push(o)}return r.sort()}},MemoryConditionalObjectStore=class{objects=new Map;async putIfAbsent(e,t){return this.objects.has(e)?`exists`:(this.objects.set(e,t.slice()),`created`)}async get(e){let t=this.objects.get(e);return t?t.slice():null}async list(e){return[...this.objects.keys()].filter(t=>t.startsWith(e)).sort()}};export{ObjectStoreEstateStorage as n,refuseWorkersKvWritable as r,MemoryConditionalObjectStore as t};
|
|
2
|
-
//# sourceMappingURL=object-store-
|
|
2
|
+
//# sourceMappingURL=object-store-WIE0DGGG.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"object-store-
|
|
1
|
+
{"version":3,"file":"object-store-WIE0DGGG.mjs","names":[],"sources":["../src/migrations/storage/object-store.ts"],"sourcesContent":["/**\n * Strong object-store publication contract.\n * A writable driver that cannot do conditional create is not a V1 estate owner.\n * Workers KV is refused here: it has no compare-and-swap publication.\n */\n\nimport { MigrationError, VibORMErrorCode } from \"../../errors\";\nimport { bytesEqual } from \"../canonical-json\";\nimport { isSha256, type Sha256 } from \"../identity\";\nimport type { MigrationStorageWriter, PublishResult } from \"./contract\";\n\nexport function refuseWorkersKvWritable(): never {\n throw new MigrationError(\n \"Workers KV cannot be a V1 estate writer: listing is eventually consistent and puts are not conditional\",\n VibORMErrorCode.MIGRATION_UNSUPPORTED_PROVIDER\n );\n}\n\nexport interface ObjectStoreConditionalPut {\n putIfAbsent(key: string, bytes: Uint8Array): Promise<\"created\" | \"exists\">;\n get(key: string): Promise<Uint8Array | null>;\n list(prefix: string): Promise<readonly string[]>;\n}\n\n/**\n * Estate writer over a strongly consistent object store with if-none-match\n * publication. Manifests become visible only after referenced bytes exist.\n */\nexport class ObjectStoreEstateStorage implements MigrationStorageWriter {\n private readonly store: ObjectStoreConditionalPut;\n\n constructor(store: ObjectStoreConditionalPut) {\n this.store = store;\n }\n\n async readEstate(): Promise<Uint8Array | null> {\n return this.store.get(\"estate.json\");\n }\n\n async listStates(): Promise<readonly Sha256[]> {\n return this.listHex(\"states/\", \".json\");\n }\n\n async listSnapshots(): Promise<readonly Sha256[]> {\n return this.listHex(\"snapshots/\", \".json\");\n }\n\n async listSql(): Promise<readonly Sha256[]> {\n return this.listHex(\"sql/\", \".sql\");\n }\n\n async readState(id: Sha256): Promise<Uint8Array | null> {\n return this.store.get(`states/${id}.json`);\n }\n\n async readSnapshot(hash: Sha256): Promise<Uint8Array | null> {\n return this.store.get(`snapshots/${hash}.json`);\n }\n\n async readSql(hash: Sha256): Promise<Uint8Array | null> {\n return this.store.get(`sql/${hash}.sql`);\n }\n\n async publishEstate(bytes: Uint8Array): Promise<PublishResult> {\n return this.publish(\"estate.json\", bytes);\n }\n\n async publishSnapshot(\n hash: Sha256,\n bytes: Uint8Array\n ): Promise<PublishResult> {\n return this.publish(`snapshots/${hash}.json`, bytes);\n }\n\n async publishSql(hash: Sha256, bytes: Uint8Array): Promise<PublishResult> {\n return this.publish(`sql/${hash}.sql`, bytes);\n }\n\n async publishState(id: Sha256, bytes: Uint8Array): Promise<PublishResult> {\n if (!isSha256(id)) {\n throw new MigrationError(\n \"State id is not a SHA-256 digest\",\n VibORMErrorCode.MIGRATION_INVALID_ESTATE\n );\n }\n return this.publish(`states/${id}.json`, bytes);\n }\n\n private async publish(\n key: string,\n bytes: Uint8Array\n ): Promise<PublishResult> {\n const result = await this.store.putIfAbsent(key, bytes);\n if (result === \"created\") return { outcome: \"created\" };\n const existing = await this.store.get(key);\n if (!(existing && bytesEqual(existing, bytes))) {\n throw new MigrationError(\n `Object-store key ${key} already holds different bytes`,\n VibORMErrorCode.MIGRATION_CORRUPTION\n );\n }\n return { outcome: \"identical\" };\n }\n\n private async listHex(prefix: string, suffix: string): Promise<Sha256[]> {\n const keys = await this.store.list(prefix);\n const hashes: Sha256[] = [];\n for (const key of keys) {\n const name = key.slice(prefix.length);\n if (!name.endsWith(suffix)) continue;\n const hex = name.slice(0, -suffix.length);\n if (isSha256(hex)) hashes.push(hex);\n }\n return hashes.sort();\n }\n}\n\n/** In-memory strong object store for the conformance fixture. */\nexport class MemoryConditionalObjectStore implements ObjectStoreConditionalPut {\n private readonly objects = new Map<string, Uint8Array>();\n\n async putIfAbsent(\n key: string,\n bytes: Uint8Array\n ): Promise<\"created\" | \"exists\"> {\n if (this.objects.has(key)) return \"exists\";\n this.objects.set(key, bytes.slice());\n return \"created\";\n }\n\n async get(key: string): Promise<Uint8Array | null> {\n const bytes = this.objects.get(key);\n return bytes ? bytes.slice() : null;\n }\n\n async list(prefix: string): Promise<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AAI,EAAE,GAAY,EAAW,EAAU,EAAM,EAC3C,MAAM,IAAI,EACR,oBAAoB,EAAI,gCACxB,EAAgB,qBACjB,CAEH,MAAO,CAAE,QAAS,YAAa,CAGjC,MAAc,QAAQ,EAAgB,EAAmC,CACvE,IAAM,EAAO,MAAM,KAAK,MAAM,KAAK,EAAO,CACpC,EAAmB,EAAE,CAC3B,IAAK,IAAM,KAAO,EAAM,CACtB,IAAM,EAAO,EAAI,MAAM,EAAO,OAAO,CACrC,GAAI,CAAC,EAAK,SAAS,EAAO,CAAE,SAC5B,IAAM,EAAM,EAAK,MAAM,EAAG,CAAC,EAAO,OAAO,CACrC,EAAS,EAAI,EAAE,EAAO,KAAK,EAAI,CAErC,OAAO,EAAO,MAAM,GAKX,6BAAb,KAA+E,CAC7E,QAA2B,IAAI,IAE/B,MAAM,YACJ,EACA,EAC+B,CAG/B,OAFI,KAAK,QAAQ,IAAI,EAAI,CAAS,UAClC,KAAK,QAAQ,IAAI,EAAK,EAAM,OAAO,CAAC,CAC7B,WAGT,MAAM,IAAI,EAAyC,CACjD,IAAM,EAAQ,KAAK,QAAQ,IAAI,EAAI,CACnC,OAAO,EAAQ,EAAM,OAAO,CAAG,KAGjC,MAAM,KAAK,EAA4C,CACrD,MAAO,CAAC,GAAG,KAAK,QAAQ,MAAM,CAAC,CAC5B,OAAQ,GAAQ,EAAI,WAAW,EAAO,CAAC,CACvC,MAAM"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./chunk-BuuaeEvq.mjs";import{c as t,i as n,o as r,s as i,t as a}from"./coordination-
|
|
2
|
-
//# sourceMappingURL=on-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{c as t,i as n,o as r,s as i,t as a}from"./coordination-BY6Np3xV.mjs";import{t as o}from"./routed-operations-wytpbYKv.mjs";import{t as s}from"./write-sinks-3IKCDF-S.mjs";function watchWrite(e,n,r){if(e.length===0)return;let a=[];for(let[t,n]of e)n.settled&&a.push({extension:t,listener:n.settled});return{extension:e[0][0],tell:t,listener:e.find(([,e])=>e.show)?.[1].show?.(e,a,n,r)??(e=>i(a,e))}}const watchShown=(e,t,n,r)=>{let a=new Set;for(let[t,n]of e)n.show&&a.add(t);let o=t.filter(({extension:e})=>a.has(e)),s=t.filter(({extension:e})=>!a.has(e)),c=!1,l,wants=(t,n)=>e.some(([,e])=>e.wants?.(t,n)===!0);return showRows(n,wants,t=>{for(let[n,r,i,a]of t)for(let[,t]of e)t.wants?.(n,r)===!0&&t.rows?.(n,r,i,a);c=!0;let n=l;n&&r(()=>i(o,n))}),e=>c||e.certainty===`may-have-committed`?i(t,e):(l=e,i(s,e))},showRows=(e,t,n)=>{s.set(e,{wants:t,attempt(){let e=[];return{wants:t,shows(t,n,r){r.length>0&&e.push([t,n,r,!0])},own(n,r,i,a){let o=r[`~`].names.ts;if(!a.some(e=>t(o,e)))return;let s=i.select,{scalars:c}=r[`~`].state,l={...Object.fromEntries(Object.entries(s??{}).filter(([e,t])=>t&&!Object.hasOwn(c,e))),...i.include};return{projection:n.prepareProjection(r,Object.keys(l).length>0?{include:l}:{}),cut(n,r){if(r&&t(o,r)&&n.length>0&&e.unshift([o,r,n.map(e=>Object.fromEntries(Object.entries(e).filter(([e])=>Object.hasOwn(c,e)))),!1]),s)for(let e of n)for(let t of Object.keys(e))s[t]||Object.hasOwn(l,t)||delete e[t];return n}}},done:()=>n(e)}}})},c=Symbol(`viborm.watch`),l={registering:(e,t)=>({[c](n){return(e.watched??=[]).push([t,n]),!0}}),join({next:e}){e.watch={watch:(e,t,n,r)=>watchWrite(e.call?.watched??[],n,r)},n(e,a,r)}};function set(e,t){return{operations:e,watch:t}}const u=o,d=set([`findMany`,`findUnique`,`findFirst`,`findUniqueOrThrow`,`findFirstOrThrow`,`count`,`aggregate`,`groupBy`,`exist`]),f=set([`create`,`update`,`delete`,`upsert`,`createMany`,`updateMany`,`deleteMany`],l),p=set([`delete`,`deleteMany`],l),m=set([`findMany`,`findUnique`,`findFirst`,`findUniqueOrThrow`,`findFirstOrThrow`,`count`,`aggregate`,`groupBy`,`exist`,`update`,`delete`,`upsert`,`updateMany`,`deleteMany`]),h=set([`findMany`,`findUnique`,`findFirst`,`findUniqueOrThrow`,`findFirstOrThrow`,`count`,`aggregate`,`groupBy`,`exist`,`create`,`update`,`delete`,`upsert`,`createMany`,`updateMany`,`deleteMany`]),selectionOf=e=>e,operationsOf=e=>typeof e==`string`?[e]:Array.isArray(e)?e:selectionOf(e)?.operations;function target(e,t){return typeof e==`object`&&!Array.isArray(e)?e:{models:typeof e==`string`?[e]:e,operations:operationsOf(t),watch:selectionOf(t)?.watch}}export{d as a,target as c,watchShown as d,operationsOf as i,f as l,p as n,m as o,h as r,selectionOf as s,u as t,c as u};
|
|
2
|
+
//# sourceMappingURL=on-DvrfHGje.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-ylYaKuRu.mjs","names":[],"sources":["../src/extensions/written.ts","../src/extensions/watch-part.ts","../src/extensions/on.ts"],"sourcesContent":["// What watches the rows a write call wrote and its commit: `watch` and\n// `settled` in a `call`'s first moment register a watch; the call's one\n// outcome registration tells each watch that the write settled, and, for a\n// watch made with `watch`, the engine shows the rows\n// (`@query-engine/write-sinks`) through what that word brings (`showRows`).\n\nimport type { QueryExecutionContext } from \"@drivers/types\";\nimport { type WriteKind, writeSinks } from \"@query-engine/write-sinks\";\n\nexport type { WriteKind } from \"@query-engine/write-sinks\";\n\nimport type { AdmittedArgs } from \"./arguments\";\nimport type { CallOrigin } from \"./origin\";\nimport {\n type collect,\n publishWriteOutcomes,\n tell,\n type WriteOutcome,\n type WriteOutcomeRegistration,\n} from \"./query\";\n\n/** One write call, as what watches it is asked about before it runs. */\nexport interface WrittenCall {\n /** The model the call names. */\n readonly model: string;\n readonly operation: string;\n /**\n * The call's arguments, after request transforms and the client's omit.\n * They are the call's own: read, never changed.\n */\n readonly args: Readonly<Record<string, unknown>>;\n /** One object per call: what its first moments registered watches under. */\n readonly call?: CallOrigin;\n}\n\n/** Rows one write showed: model, kind, rows, and whether through a relation. */\ntype Shown = readonly [string, WriteKind, readonly object[], boolean];\n\n/**\n * What asks the engine to show the rows a call writes, for one call: what\n * `watch` brings, so a call watched by `settled` alone carries none of it.\n * `told` receives the rows once every write of the call is made.\n */\ntype ShowRows = (\n context: QueryExecutionContext,\n wants: (model: string, kind: WriteKind) => boolean,\n told: (shown: readonly Shown[]) => void\n) => void;\n\n/**\n * One write call under what its first moments registered, where one of them\n * asked for rows: what `watch` brings (`watchShown`), so a call watched by\n * `settled` alone is told its outcome and carries none of it.\n */\ntype WatchShown = (\n watched: Watched,\n settled: readonly WriteOutcomeRegistration[],\n context: QueryExecutionContext,\n late: (settle: () => Promise<void>) => void\n) => WriteOutcomeRegistration[\"listener\"];\n\n/**\n * What `watch(c, …)` and `settled(c, …)` register for one call: which rows\n * it wants shown and receives (every scalar field, as the write left them,\n * as they were before a delete; the call's own first, then those written\n * through its relations; the values are the caller's too), and what it is\n * told once the call's write is durable, or may be: after the call's own\n * commit, after the outermost commit inside a transaction, never after a\n * rollback, and after the rows of an extension that is shown any.\n */\nexport interface Watching {\n readonly wants?: (model: string, kind: WriteKind) => boolean;\n readonly rows?: (\n model: string,\n kind: WriteKind,\n rows: readonly Readonly<Record<string, unknown>>[],\n nested: boolean\n ) => void;\n readonly settled?: (outcome: WriteOutcome) => unknown;\n /** What shows the rows: what `watch` brings, never `settled`. */\n readonly show?: WatchShown;\n /** What installs a transaction's collector: what `settled` brings. */\n readonly collect?: typeof collect;\n /** What tells a raw statement's `settled` of its outcome: what `settled` brings. */\n readonly tell?: typeof tell;\n}\n\n/** What a write call's first moments registered, each with its extension, in chain order. */\nexport type Watched = (readonly [string, Watching])[];\n\n/**\n * One write call under what its first moments registered: the call's one\n * outcome registration tells each `settled` that the write settled, and,\n * where a `watch` asked for rows, what that word brings shows them first\n * (`watchShown`).\n */\nexport function watchWrite(\n watched: Watched,\n context: QueryExecutionContext,\n late: (settle: () => Promise<void>) => void\n): WriteOutcomeRegistration | undefined {\n if (watched.length === 0) return undefined;\n const settled: WriteOutcomeRegistration[] = [];\n for (const [extension, watching] of watched)\n if (watching.settled)\n settled.push({ extension, listener: watching.settled });\n return {\n extension: watched[0]![0],\n tell,\n // Each listener's failure is said as its own, an error of viborm's.\n listener:\n watched\n .find(([, watching]) => watching.show)?.[1]\n .show?.(watched, settled, context, late) ??\n ((outcome) => publishWriteOutcomes(settled, outcome)),\n };\n}\n\n/**\n * A write call some of whose watches asked for rows: the engine is told what\n * they want to see, and the call's one outcome registration tells them that\n * it settled. A unit handed over whole answers after it commits: what an\n * extension shown rows registered is then told it settled once its rows\n * are, by what `late` receives, which the call's value runs and waits for.\n */\nexport const watchShown: WatchShown = (watched, settled, context, late) => {\n const seeing = new Set<string>();\n for (const [extension, watching] of watched)\n if (watching.show) seeing.add(extension);\n const shown = settled.filter(({ extension }) => seeing.has(extension));\n const blind = settled.filter(({ extension }) => !seeing.has(extension));\n let told = false;\n let heard: WriteOutcome | undefined;\n const wants = (model: string, kind: WriteKind) =>\n watched.some(([, watching]) => watching.wants?.(model, kind) === true);\n showRows(context, wants, (rows) => {\n for (const [model, kind, written, nested] of rows)\n for (const [, watching] of watched)\n if (watching.wants?.(model, kind) === true)\n // The engine shows rows as it reads them: records of fields.\n watching.rows?.(\n model,\n kind,\n written as readonly Readonly<Record<string, unknown>>[],\n nested\n );\n told = true;\n const outcome = heard;\n if (outcome) late(() => publishWriteOutcomes(shown, outcome));\n });\n return (outcome) => {\n // A write that may have committed failed: no rows will be told.\n if (told || outcome.certainty === \"may-have-committed\")\n return publishWriteOutcomes(settled, outcome);\n heard = outcome;\n return publishWriteOutcomes(blind, outcome);\n };\n};\n\n/** The engine shows the rows of one call's writes that `wants` wants. */\nconst showRows: ShowRows = (context, wants, told) => {\n writeSinks.set(context, {\n wants,\n attempt() {\n // What this run wrote, the call's own rows before those its relations reach.\n const shown: Shown[] = [];\n return {\n wants,\n shows(model, kind, rows) {\n if (rows.length > 0) shown.push([model, kind, rows, true]);\n },\n own(queries, model, args, kinds) {\n const name = model[\"~\"].names.ts!;\n if (!kinds.some((kind) => wants(name, kind))) return undefined;\n // An operation's `select` is a record of fields where present.\n const select = args.select as Record<string, unknown> | undefined;\n const { scalars } = model[\"~\"].state;\n // What the caller asked for beside the row's own fields: what its\n // selection names that is no scalar, and what it includes.\n const beside: Record<string, unknown> = {\n ...Object.fromEntries(\n Object.entries(select ?? {}).filter(\n ([field, selected]) =>\n selected && !Object.hasOwn(scalars, field)\n )\n ),\n ...args.include,\n };\n return {\n // Whole rows, beside those.\n projection: queries.prepareProjection(\n model,\n Object.keys(beside).length > 0 ? { include: beside } : {}\n ),\n cut(rows, kind) {\n if (kind && wants(name, kind) && rows.length > 0)\n shown.unshift([\n name,\n kind,\n rows.map((row) =>\n Object.fromEntries(\n Object.entries(row).filter(([field]) =>\n Object.hasOwn(scalars, field)\n )\n )\n ),\n false,\n ]);\n if (select)\n for (const row of rows)\n for (const field of Object.keys(row))\n if (!(select[field] || Object.hasOwn(beside, field)))\n delete row[field];\n return rows;\n },\n };\n },\n done: () => told(shown),\n };\n },\n });\n};\n\n/** What watches one write call under the chain's watching parts. */\nexport interface Watching {\n readonly watch: (\n call: WrittenCall,\n values: AdmittedArgs | undefined,\n context: QueryExecutionContext,\n late: (settle: () => Promise<void>) => void\n ) => WriteOutcomeRegistration | undefined;\n}\n","/**\n * What `watch(c, …)` and `settled(c, …)` register in a call's first moment,\n * and the part that tells them of the rows a write call writes and of its\n * commit. Brought by the `writes` and `deletes` sets: a `call` or an\n * `around` watches with `target(writes)` (or `deletes`), and one that never\n * watches carries none of it.\n */\nimport type { Application, ExtensionPart } from \"./chain\";\nimport { ARRAYS, coordinate } from \"./coordination\";\nimport type { CallOrigin } from \"./origin\";\nimport { collect } from \"./query\";\nimport { type Watching, watchWrite } from \"./written\";\n\nexport type { Watched, Watching } from \"./written\";\n\n/** The key a first moment's context registers watches through. */\nexport const REGISTER = Symbol(\"viborm.watch\");\n\n/** What a first moment's context registers watches through, for one call. */\nexport interface Registering {\n readonly [REGISTER]: (watching: Watching) => boolean;\n}\n\nexport interface WatchPart extends ExtensionPart {\n /**\n * What one extension's first moment of one model call registers through,\n * keeping it for the call. A context without it (a `call` that brings no\n * watch part, a raw statement) has nothing to register through, which\n * `call-words.ts` refuses.\n */\n readonly registering: (call: CallOrigin, extension: string) => Registering;\n}\n\nexport const watchPart: WatchPart = {\n registering: (call, extension) => ({\n [REGISTER](watching) {\n (call.watched ??= []).push([extension, watching]);\n return true;\n },\n }),\n join({ next }: Application) {\n // First moments run in chain order: what a call registered is in it.\n next.watch = {\n watch: (written, _values, context, late) =>\n watchWrite(written.call?.watched ?? [], context, late),\n };\n coordinate(next, ARRAYS, collect);\n },\n};\n","/**\n * `target(...)`: the models and operations a `call` or an `around` concerns,\n * and the named operation sets `target` and an argument's `.on(...)` take.\n * (`target`, not `on`: `on` is the hooks of `viborm/on`.) A selection is plain\n * data; the part that reads it resolves it against the schema it is joined\n * to. The types refuse an operation or a model a client does not have.\n */\nimport type {\n CacheableOperations,\n MutationOperations,\n Operations,\n} from \"@client/types\";\nimport { ROUTED_OPERATIONS } from \"@query-engine/routed-operations\";\nimport type {\n AnyTarget,\n DeleteOperations,\n ModelName,\n OperationSet,\n SelectingOperations,\n Selection,\n} from \"./contract\";\nimport { type WatchPart, watchPart } from \"./watch-part\";\n\n/** What `target(...)` returns at runtime, and what an operation set is. */\nexport interface SelectionValue {\n /** The models named; every model when absent. */\n readonly models?: readonly string[] | undefined;\n /** The operations named; every operation when absent. */\n readonly operations?: readonly Operations[] | undefined;\n /** What watches the writes named, when a set that brings it named them. */\n readonly watch?: WatchPart | undefined;\n}\n\nfunction set<O extends Operations>(\n operations: readonly O[],\n watch?: WatchPart\n): OperationSet<O>;\nfunction set(operations: readonly Operations[], watch?: WatchPart): unknown {\n return { operations, watch };\n}\n\n/** Every operation a model has. */\nexport const MODEL_OPERATIONS: ReadonlySet<string> = ROUTED_OPERATIONS;\n\n/** Every read. */\nexport const reads = /* @__PURE__ */ set<CacheableOperations>([\n \"findMany\",\n \"findUnique\",\n \"findFirst\",\n \"findUniqueOrThrow\",\n \"findFirstOrThrow\",\n \"count\",\n \"aggregate\",\n \"groupBy\",\n \"exist\",\n]);\n/** Every write: a `call` or an `around` on them may `watch` its rows and be `settled`. */\nexport const writes = /* @__PURE__ */ set<MutationOperations>(\n [\n \"create\",\n \"update\",\n \"delete\",\n \"upsert\",\n \"createMany\",\n \"updateMany\",\n \"deleteMany\",\n ],\n watchPart\n);\n/** `delete` and `deleteMany`. */\nexport const deletes = /* @__PURE__ */ set<DeleteOperations>(\n [\"delete\", \"deleteMany\"],\n watchPart\n);\n/** Every operation that selects rows: all but `create` and `createMany`. */\nexport const selecting = /* @__PURE__ */ set<SelectingOperations>([\n \"findMany\",\n \"findUnique\",\n \"findFirst\",\n \"findUniqueOrThrow\",\n \"findFirstOrThrow\",\n \"count\",\n \"aggregate\",\n \"groupBy\",\n \"exist\",\n \"update\",\n \"delete\",\n \"upsert\",\n \"updateMany\",\n \"deleteMany\",\n]);\n/** Every model operation, and no raw statement. */\nexport const models = /* @__PURE__ */ set<Operations>([\n \"findMany\",\n \"findUnique\",\n \"findFirst\",\n \"findUniqueOrThrow\",\n \"findFirstOrThrow\",\n \"count\",\n \"aggregate\",\n \"groupBy\",\n \"exist\",\n \"create\",\n \"update\",\n \"delete\",\n \"upsert\",\n \"createMany\",\n \"updateMany\",\n \"deleteMany\",\n]);\n\n/**\n * A `Selection` or an `OperationSet` as it is at runtime: the value\n * `target(...)` or a set returned. Their types carry what only the compiler\n * reads (the client a selection is typed against), so this one assertion\n * crosses from those types to the value.\n */\nexport const selectionOf = (value: unknown): SelectionValue | undefined =>\n value as SelectionValue | undefined;\n\n/** The operations of a set, of a list, or of one name. */\nexport const operationsOf = (\n value: unknown\n): readonly Operations[] | undefined =>\n typeof value === \"string\"\n ? // One name, which the overloads typed as an operation.\n [value as Operations]\n : Array.isArray(value)\n ? value\n : selectionOf(value)?.operations;\n\n/**\n * One model (or several), these operations (every one when absent). First:\n * an editor completes a string argument from the first signature.\n */\nexport function target<\n T extends AnyTarget,\n const M extends ModelName<T> = ModelName<T>,\n const O extends Operations = Operations,\n>(\n models: M | readonly M[],\n operations?: O | readonly O[] | OperationSet<O>\n): Selection<T, M, O>;\n/** Every model, these operations: `target(reads)`. */\nexport function target<T extends AnyTarget, O extends Operations>(\n operations: OperationSet<O>\n): Selection<T, ModelName<T>, O>;\nexport function target(first: unknown, operations?: unknown): unknown {\n // An operation set alone: every model, those operations.\n if (typeof first === \"object\" && !Array.isArray(first)) return first;\n return {\n models: typeof first === \"string\" ? [first] : first,\n operations: operationsOf(operations),\n // A set's own; a list or a name has none.\n watch: selectionOf(operations)?.watch,\n };\n}\n"],"mappings":"yNAgGA,SAAgB,WACd,EACA,EACA,EACsC,CACtC,GAAI,EAAQ,SAAW,EAAG,OAC1B,IAAM,EAAsC,EAAE,CAC9C,IAAK,GAAM,CAAC,EAAW,KAAa,EAC9B,EAAS,SACX,EAAQ,KAAK,CAAE,YAAW,SAAU,EAAS,QAAS,CAAC,CAC3D,MAAO,CACL,UAAW,EAAQ,GAAI,GACvB,OAEA,SACE,EACG,MAAM,EAAG,KAAc,EAAS,KAAK,GAAG,GACxC,OAAO,EAAS,EAAS,EAAS,EAAK,GACxC,GAAY,EAAqB,EAAS,EAAQ,EACvD,CAUH,MAAa,YAA0B,EAAS,EAAS,EAAS,IAAS,CACzE,IAAM,EAAS,IAAI,IACnB,IAAK,GAAM,CAAC,EAAW,KAAa,EAC9B,EAAS,MAAM,EAAO,IAAI,EAAU,CAC1C,IAAM,EAAQ,EAAQ,QAAQ,CAAE,eAAgB,EAAO,IAAI,EAAU,CAAC,CAChE,EAAQ,EAAQ,QAAQ,CAAE,eAAgB,CAAC,EAAO,IAAI,EAAU,CAAC,CACnE,EAAO,GACP,EACE,OAAS,EAAe,IAC5B,EAAQ,MAAM,EAAG,KAAc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AAM,CAClB,EACA,YAAY,EAAM,EAAE,WAkB5B,SAAgB,OAAO,EAAgB,EAA+B,CAGpE,OADI,OAAO,GAAU,UAAY,CAAC,MAAM,QAAQ,EAAM,CAAS,EACxD,CACL,OAAQ,OAAO,GAAU,SAAW,CAAC,EAAM,CAAG,EAC9C,WAAY,aAAa,EAAW,CAEpC,MAAO,YAAY,EAAW,EAAE,MACjC"}
|
|
1
|
+
{"version":3,"file":"on-DvrfHGje.mjs","names":[],"sources":["../src/extensions/written.ts","../src/extensions/watch-part.ts","../src/extensions/on.ts"],"sourcesContent":["// What watches the rows a write call wrote and its commit: `watch` and\n// `settled` in a `call`'s first moment register a watch; the call's one\n// outcome registration tells each watch that the write settled, and, for a\n// watch made with `watch`, the engine shows the rows\n// (`@query-engine/write-sinks`) through what that word brings (`showRows`).\n\nimport type { QueryExecutionContext } from \"@drivers/types\";\nimport { type WriteKind, writeSinks } from \"@query-engine/write-sinks\";\n\nexport type { WriteKind } from \"@query-engine/write-sinks\";\n\nimport type { AdmittedArgs } from \"./arguments\";\nimport type { CallOrigin } from \"./origin\";\nimport {\n type collect,\n publishWriteOutcomes,\n tell,\n type WriteOutcome,\n type WriteOutcomeRegistration,\n} from \"./query\";\n\n/** One write call, as what watches it is asked about before it runs. */\nexport interface WrittenCall {\n /** The model the call names. */\n readonly model: string;\n readonly operation: string;\n /**\n * The call's arguments, after request transforms and the client's omit.\n * They are the call's own: read, never changed.\n */\n readonly args: Readonly<Record<string, unknown>>;\n /** One object per call: what its first moments registered watches under. */\n readonly call?: CallOrigin;\n}\n\n/** Rows one write showed: model, kind, rows, and whether through a relation. */\ntype Shown = readonly [string, WriteKind, readonly object[], boolean];\n\n/**\n * What asks the engine to show the rows a call writes, for one call: what\n * `watch` brings, so a call watched by `settled` alone carries none of it.\n * `told` receives the rows once every write of the call is made.\n */\ntype ShowRows = (\n context: QueryExecutionContext,\n wants: (model: string, kind: WriteKind) => boolean,\n told: (shown: readonly Shown[]) => void\n) => void;\n\n/**\n * One write call under what its first moments registered, where one of them\n * asked for rows: what `watch` brings (`watchShown`), so a call watched by\n * `settled` alone is told its outcome and carries none of it.\n */\ntype WatchShown = (\n watched: Watched,\n settled: readonly WriteOutcomeRegistration[],\n context: QueryExecutionContext,\n late: (settle: () => Promise<void>) => void\n) => WriteOutcomeRegistration[\"listener\"];\n\n/**\n * What `watch(c, …)` and `settled(c, …)` register for one call: which rows\n * it wants shown and receives (every scalar field, as the write left them,\n * as they were before a delete; the call's own first, then those written\n * through its relations; the values are the caller's too), and what it is\n * told once the call's write is durable, or may be: after the call's own\n * commit, after the outermost commit inside a transaction, never after a\n * rollback, and after the rows of an extension that is shown any.\n */\nexport interface Watching {\n readonly wants?: (model: string, kind: WriteKind) => boolean;\n readonly rows?: (\n model: string,\n kind: WriteKind,\n rows: readonly Readonly<Record<string, unknown>>[],\n nested: boolean\n ) => void;\n readonly settled?: (outcome: WriteOutcome) => unknown;\n /** What shows the rows: what `watch` brings, never `settled`. */\n readonly show?: WatchShown;\n /** What installs a transaction's collector: what `settled` brings. */\n readonly collect?: typeof collect;\n /** What tells a raw statement's `settled` of its outcome: what `settled` brings. */\n readonly tell?: typeof tell;\n}\n\n/** What a write call's first moments registered, each with its extension, in chain order. */\nexport type Watched = (readonly [string, Watching])[];\n\n/**\n * One write call under what its first moments registered: the call's one\n * outcome registration tells each `settled` that the write settled, and,\n * where a `watch` asked for rows, what that word brings shows them first\n * (`watchShown`).\n */\nexport function watchWrite(\n watched: Watched,\n context: QueryExecutionContext,\n late: (settle: () => Promise<void>) => void\n): WriteOutcomeRegistration | undefined {\n if (watched.length === 0) return undefined;\n const settled: WriteOutcomeRegistration[] = [];\n for (const [extension, watching] of watched)\n if (watching.settled)\n settled.push({ extension, listener: watching.settled });\n return {\n extension: watched[0]![0],\n tell,\n // Each listener's failure is said as its own, an error of viborm's.\n listener:\n watched\n .find(([, watching]) => watching.show)?.[1]\n .show?.(watched, settled, context, late) ??\n ((outcome) => publishWriteOutcomes(settled, outcome)),\n };\n}\n\n/**\n * A write call some of whose watches asked for rows: the engine is told what\n * they want to see, and the call's one outcome registration tells them that\n * it settled. A unit handed over whole answers after it commits: what an\n * extension shown rows registered is then told it settled once its rows\n * are, by what `late` receives, which the call's value runs and waits for.\n */\nexport const watchShown: WatchShown = (watched, settled, context, late) => {\n const seeing = new Set<string>();\n for (const [extension, watching] of watched)\n if (watching.show) seeing.add(extension);\n const shown = settled.filter(({ extension }) => seeing.has(extension));\n const blind = settled.filter(({ extension }) => !seeing.has(extension));\n let told = false;\n let heard: WriteOutcome | undefined;\n const wants = (model: string, kind: WriteKind) =>\n watched.some(([, watching]) => watching.wants?.(model, kind) === true);\n showRows(context, wants, (rows) => {\n for (const [model, kind, written, nested] of rows)\n for (const [, watching] of watched)\n if (watching.wants?.(model, kind) === true)\n // The engine shows rows as it reads them: records of fields.\n watching.rows?.(\n model,\n kind,\n written as readonly Readonly<Record<string, unknown>>[],\n nested\n );\n told = true;\n const outcome = heard;\n if (outcome) late(() => publishWriteOutcomes(shown, outcome));\n });\n return (outcome) => {\n // A write that may have committed failed: no rows will be told.\n if (told || outcome.certainty === \"may-have-committed\")\n return publishWriteOutcomes(settled, outcome);\n heard = outcome;\n return publishWriteOutcomes(blind, outcome);\n };\n};\n\n/** The engine shows the rows of one call's writes that `wants` wants. */\nconst showRows: ShowRows = (context, wants, told) => {\n writeSinks.set(context, {\n wants,\n attempt() {\n // What this run wrote, the call's own rows before those its relations reach.\n const shown: Shown[] = [];\n return {\n wants,\n shows(model, kind, rows) {\n if (rows.length > 0) shown.push([model, kind, rows, true]);\n },\n own(queries, model, args, kinds) {\n const name = model[\"~\"].names.ts!;\n if (!kinds.some((kind) => wants(name, kind))) return undefined;\n // An operation's `select` is a record of fields where present.\n const select = args.select as Record<string, unknown> | undefined;\n const { scalars } = model[\"~\"].state;\n // What the caller asked for beside the row's own fields: what its\n // selection names that is no scalar, and what it includes.\n const beside: Record<string, unknown> = {\n ...Object.fromEntries(\n Object.entries(select ?? {}).filter(\n ([field, selected]) =>\n selected && !Object.hasOwn(scalars, field)\n )\n ),\n ...args.include,\n };\n return {\n // Whole rows, beside those.\n projection: queries.prepareProjection(\n model,\n Object.keys(beside).length > 0 ? { include: beside } : {}\n ),\n cut(rows, kind) {\n if (kind && wants(name, kind) && rows.length > 0)\n shown.unshift([\n name,\n kind,\n rows.map((row) =>\n Object.fromEntries(\n Object.entries(row).filter(([field]) =>\n Object.hasOwn(scalars, field)\n )\n )\n ),\n false,\n ]);\n if (select)\n for (const row of rows)\n for (const field of Object.keys(row))\n if (!(select[field] || Object.hasOwn(beside, field)))\n delete row[field];\n return rows;\n },\n };\n },\n done: () => told(shown),\n };\n },\n });\n};\n\n/** What watches one write call under the chain's watching parts. */\nexport interface Watching {\n readonly watch: (\n call: WrittenCall,\n values: AdmittedArgs | undefined,\n context: QueryExecutionContext,\n late: (settle: () => Promise<void>) => void\n ) => WriteOutcomeRegistration | undefined;\n}\n","/**\n * What `watch(c, …)` and `settled(c, …)` register in a call's first moment,\n * and the part that tells them of the rows a write call writes and of its\n * commit. Brought by the `writes` and `deletes` sets: a `call` or an\n * `around` watches with `target(writes)` (or `deletes`), and one that never\n * watches carries none of it.\n */\nimport type { Application, ExtensionPart } from \"./chain\";\nimport { ARRAYS, coordinate } from \"./coordination\";\nimport type { CallOrigin } from \"./origin\";\nimport { collect } from \"./query\";\nimport { type Watching, watchWrite } from \"./written\";\n\nexport type { Watched, Watching } from \"./written\";\n\n/** The key a first moment's context registers watches through. */\nexport const REGISTER = Symbol(\"viborm.watch\");\n\n/** What a first moment's context registers watches through, for one call. */\nexport interface Registering {\n readonly [REGISTER]: (watching: Watching) => boolean;\n}\n\nexport interface WatchPart extends ExtensionPart {\n /**\n * What one extension's first moment of one model call registers through,\n * keeping it for the call. A context without it (a `call` that brings no\n * watch part, a raw statement) has nothing to register through, which\n * `call-words.ts` refuses.\n */\n readonly registering: (call: CallOrigin, extension: string) => Registering;\n}\n\nexport const watchPart: WatchPart = {\n registering: (call, extension) => ({\n [REGISTER](watching) {\n (call.watched ??= []).push([extension, watching]);\n return true;\n },\n }),\n join({ next }: Application) {\n // First moments run in chain order: what a call registered is in it.\n next.watch = {\n watch: (written, _values, context, late) =>\n watchWrite(written.call?.watched ?? [], context, late),\n };\n coordinate(next, ARRAYS, collect);\n },\n};\n","/**\n * `target(...)`: the models and operations a `call` or an `around` concerns,\n * and the named operation sets `target` and an argument's `.on(...)` take.\n * (`target`, not `on`: `on` is the hooks of `viborm/on`.) A selection is plain\n * data; the part that reads it resolves it against the schema it is joined\n * to. The types refuse an operation or a model a client does not have.\n */\nimport type {\n CacheableOperations,\n MutationOperations,\n Operations,\n} from \"@client/types\";\nimport { ROUTED_OPERATIONS } from \"@query-engine/routed-operations\";\nimport type {\n AnyTarget,\n DeleteOperations,\n ModelName,\n OperationSet,\n SelectingOperations,\n Selection,\n} from \"./contract\";\nimport { type WatchPart, watchPart } from \"./watch-part\";\n\n/** What `target(...)` returns at runtime, and what an operation set is. */\nexport interface SelectionValue {\n /** The models named; every model when absent. */\n readonly models?: readonly string[] | undefined;\n /** The operations named; every operation when absent. */\n readonly operations?: readonly Operations[] | undefined;\n /** What watches the writes named, when a set that brings it named them. */\n readonly watch?: WatchPart | undefined;\n}\n\nfunction set<O extends Operations>(\n operations: readonly O[],\n watch?: WatchPart\n): OperationSet<O>;\nfunction set(operations: readonly Operations[], watch?: WatchPart): unknown {\n return { operations, watch };\n}\n\n/** Every operation a model has. */\nexport const MODEL_OPERATIONS: ReadonlySet<string> = ROUTED_OPERATIONS;\n\n/** Every read. */\nexport const reads = /* @__PURE__ */ set<CacheableOperations>([\n \"findMany\",\n \"findUnique\",\n \"findFirst\",\n \"findUniqueOrThrow\",\n \"findFirstOrThrow\",\n \"count\",\n \"aggregate\",\n \"groupBy\",\n \"exist\",\n]);\n/** Every write: a `call` or an `around` on them may `watch` its rows and be `settled`. */\nexport const writes = /* @__PURE__ */ set<MutationOperations>(\n [\n \"create\",\n \"update\",\n \"delete\",\n \"upsert\",\n \"createMany\",\n \"updateMany\",\n \"deleteMany\",\n ],\n watchPart\n);\n/** `delete` and `deleteMany`. */\nexport const deletes = /* @__PURE__ */ set<DeleteOperations>(\n [\"delete\", \"deleteMany\"],\n watchPart\n);\n/** Every operation that selects rows: all but `create` and `createMany`. */\nexport const selecting = /* @__PURE__ */ set<SelectingOperations>([\n \"findMany\",\n \"findUnique\",\n \"findFirst\",\n \"findUniqueOrThrow\",\n \"findFirstOrThrow\",\n \"count\",\n \"aggregate\",\n \"groupBy\",\n \"exist\",\n \"update\",\n \"delete\",\n \"upsert\",\n \"updateMany\",\n \"deleteMany\",\n]);\n/** Every model operation, and no raw statement. */\nexport const models = /* @__PURE__ */ set<Operations>([\n \"findMany\",\n \"findUnique\",\n \"findFirst\",\n \"findUniqueOrThrow\",\n \"findFirstOrThrow\",\n \"count\",\n \"aggregate\",\n \"groupBy\",\n \"exist\",\n \"create\",\n \"update\",\n \"delete\",\n \"upsert\",\n \"createMany\",\n \"updateMany\",\n \"deleteMany\",\n]);\n\n/**\n * A `Selection` or an `OperationSet` as it is at runtime: the value\n * `target(...)` or a set returned. Their types carry what only the compiler\n * reads (the client a selection is typed against), so this one assertion\n * crosses from those types to the value.\n */\nexport const selectionOf = (value: unknown): SelectionValue | undefined =>\n value as SelectionValue | undefined;\n\n/** The operations of a set, of a list, or of one name. */\nexport const operationsOf = (\n value: unknown\n): readonly Operations[] | undefined =>\n typeof value === \"string\"\n ? // One name, which the overloads typed as an operation.\n [value as Operations]\n : Array.isArray(value)\n ? value\n : selectionOf(value)?.operations;\n\n/**\n * One model (or several), these operations (every one when absent). First:\n * an editor completes a string argument from the first signature.\n */\nexport function target<\n T extends AnyTarget,\n const M extends ModelName<T> = ModelName<T>,\n const O extends Operations = Operations,\n>(\n models: M | readonly M[],\n operations?: O | readonly O[] | OperationSet<O>\n): Selection<T, M, O>;\n/** Every model, these operations: `target(reads)`. */\nexport function target<T extends AnyTarget, O extends Operations>(\n operations: OperationSet<O>\n): Selection<T, ModelName<T>, O>;\nexport function target(first: unknown, operations?: unknown): unknown {\n // An operation set alone: every model, those operations.\n if (typeof first === \"object\" && !Array.isArray(first)) return first;\n return {\n models: typeof first === \"string\" ? [first] : first,\n operations: operationsOf(operations),\n // A set's own; a list or a name has none.\n watch: selectionOf(operations)?.watch,\n };\n}\n"],"mappings":"yNAgGA,SAAgB,WACd,EACA,EACA,EACsC,CACtC,GAAI,EAAQ,SAAW,EAAG,OAC1B,IAAM,EAAsC,EAAE,CAC9C,IAAK,GAAM,CAAC,EAAW,KAAa,EAC9B,EAAS,SACX,EAAQ,KAAK,CAAE,YAAW,SAAU,EAAS,QAAS,CAAC,CAC3D,MAAO,CACL,UAAW,EAAQ,GAAI,GACvB,OAEA,SACE,EACG,MAAM,EAAG,KAAc,EAAS,KAAK,GAAG,GACxC,OAAO,EAAS,EAAS,EAAS,EAAK,GACxC,GAAY,EAAqB,EAAS,EAAQ,EACvD,CAUH,MAAa,YAA0B,EAAS,EAAS,EAAS,IAAS,CACzE,IAAM,EAAS,IAAI,IACnB,IAAK,GAAM,CAAC,EAAW,KAAa,EAC9B,EAAS,MAAM,EAAO,IAAI,EAAU,CAC1C,IAAM,EAAQ,EAAQ,QAAQ,CAAE,eAAgB,EAAO,IAAI,EAAU,CAAC,CAChE,EAAQ,EAAQ,QAAQ,CAAE,eAAgB,CAAC,EAAO,IAAI,EAAU,CAAC,CACnE,EAAO,GACP,EACE,OAAS,EAAe,IAC5B,EAAQ,MAAM,EAAG,KAAc,EAAS,QAAQ,EAAO,EAAK,GAAK,GAAK,CAgBxE,OAfA,SAAS,EAAS,MAAQ,GAAS,CACjC,IAAK,GAAM,CAAC,EAAO,EAAM,EAAS,KAAW,EAC3C,IAAK,GAAM,EAAG,KAAa,EACrB,EAAS,QAAQ,EAAO,EAAK,GAAK,IAEpC,EAAS,OACP,EACA,EACA,EACA,EACD,CACP,EAAO,GACP,IAAM,EAAU,EACZ,GAAS,MAAW,EAAqB,EAAO,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 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as Extension, Ir as WriteOutcome, O as AnyTarget, P as EmptyFacts, Wi as AnyModel, Yi as Model, do as QueryError, mt as VibORMConfig, si as OperationResult, vi as ClientSchema } from "./database-adapter-D62c-uC6.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/on/index.d.ts
|
|
4
4
|
|
package/dist/on.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./chunk-BuuaeEvq.mjs";import{p as t,r as n}from"./validation--qS7OPmg.mjs";import{t as r}from"./extension-CGepsF-p.mjs";import{c as i,l as a}from"./on-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{p as t,r as n}from"./validation--qS7OPmg.mjs";import{t as r}from"./extension-CGepsF-p.mjs";import{c as i,l as a}from"./on-DvrfHGje.mjs";import{n as o}from"./call-BWFI7-vU.mjs";import{i as s,t as c}from"./settled-Dkk5w1vE.mjs";const l=`viborm.on`;let u=0;const d=new Set([`create`,`update`,`delete`]),f={create:[`create`],createMany:[`create`],update:[`update`],updateMany:[`update`],upsert:[`create`,`update`],delete:[`delete`,`update`],deleteMany:[`delete`,`update`]};function on(e,t){let n=Object.freeze({...e}),p=t?.onError;p!==void 0&&typeof p!=`function`&&refuse(`onError must be a function`);for(let[e,t]of Object.entries(n))for(let[n,r]of Object.entries(t??{}))(!d.has(n)||r!==void 0&&typeof r!=`function`)&&refuse(`${e}.${n} must be a create, update or delete function`);let m=Object.keys(n),h=new WeakMap;return u+=1,r(u===1?l:`${l}.${u}`,...m.length===0?[]:[o(()=>void 0,i(m,`create`))],o(e=>{let t=e.model,{operation:r,schema:i}=e,a=n[t]??{};if(!(f[r].some(e=>a[e]!==void 0)||writesRelation(e.args,i[t][`~`].state.relations)&&[...reachable(i[t],h)].some(e=>n[e]!==void 0)))return;let o=detached(e.args),l=[];s(e,{wants:(e,t)=>n[e]?.[t]!==void 0,rows(e,t,n,r){let i=r&&l.find(n=>n.nested&&n.model===e&&n.kind===t)||l[l.push({model:e,kind:t,rows:[],nested:r})-1];for(let e of n)i.rows.push(detached(e))}}),c(e,async({certainty:e})=>{let i=Object.freeze({model:t,operation:r,args:o,certainty:e});for(let{model:e,kind:t,rows:r}of l)try{await n[e][t](Object.freeze(r),i)}catch(n){let r=failure(n,i,`${e}.${t}`);try{p?await p(r,i):console.error(r)}catch(e){console.error(r,e)}}})},i(a)))}function writesRelation(e,t){return[e.data,e.create,e.update].flat().some(e=>typeof e==`object`&&!!e&&Object.keys(e).some(e=>Object.hasOwn(t,e)))}function reachable(e,t){let n=t.get(e);if(n!==void 0)return n;let r=new Set([e]);for(let e of r)for(let t of Object.values(e[`~`].state.relations)){let e=t[`~`],{target:n,junction:i}=e.state;for(let t of n.kind===`variants`?Object.keys(n.entries):[void 0])r.add(e.settleTarget(t));i?.model&&r.add(e.settleJunctionModel())}let i=new Set([...r].map(e=>e[`~`].names.ts));return t.set(e,i),i}function detached(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e))return e.map(detached);if(e instanceof Uint8Array)return e.slice();if(Object.getPrototypeOf(e)!==Object.prototype)return e;let t={};for(let n of Object.keys(e))t[n]=detached(e[n]);return t}function refuse(e){throw new n(`Extension "${l}" ${e}.`,{meta:{extension:l}})}const p={committed:`committed`,"may-have-committed":`may have committed`};function failure(e,n,r){let i=e instanceof Error?e:Error(String(e)),a=new t(`Extension "${l}" hook ${r} failed after the write ${p[n.certainty]}; the write is not undone.`,{cause:i,meta:{method:`on`,model:n.model,operation:n.operation,commitCertainty:n.certainty}});return Object.defineProperty(a,`cause`,{value:i,configurable:!0,writable:!0}),a}export{on};
|
|
2
2
|
//# sourceMappingURL=on.mjs.map
|
package/dist/ordering/keys.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,i as t,n,o as r,r as i,t as a}from"../keys-
|
|
1
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"../keys-1Z6WKrnE.mjs";export{a as MAX_KEY_LENGTH,n as isKey,i as isKeyFormat,t as keyBetween,e as keysAfter,r as keysBetween};
|
package/dist/ordering.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { I as Extension, K as StampedFields, L as Facts, O as AnyTarget, R as NoArguments, ai as OperationPayload, ii as NoExtraOperationKeys, it as DelegateOperationArgs, mt as VibORMConfig, ot as DelegateOperationResult, pt as VibORMClient, rt as DelegateConfig, si as OperationResult, vi as ClientSchema } from "./database-adapter-D62c-uC6.mjs";
|
|
2
2
|
import { MAX_KEY_LENGTH, isKey, isKeyFormat, keyBetween } from "./ordering/keys.mjs";
|
|
3
3
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
4
4
|
|
package/dist/ordering.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-BuuaeEvq.mjs";import{p as t,r as n,t as i,u as a}from"./validation--qS7OPmg.mjs";import{o}from"./sql-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{p as t,r as n,t as i,u as a}from"./validation--qS7OPmg.mjs";import{o}from"./sql-BGjAsoBE.mjs";import{t as s}from"./extension-CGepsF-p.mjs";import{g as c}from"./validator-CDYlO9HV.mjs";import{n as l}from"./methods-part-DoTrY6b9.mjs";import{t as u}from"./defaults-CrtGVdEC.mjs";import{n as d,r as f,t as p}from"./values-Byqn5wAh.mjs";import{a as m,i as h,n as _,o as v,r as y,t as b}from"./keys-1Z6WKrnE.mjs";const x=o.raw(`'${`0`.repeat(b)}'`),S=o.raw(`'1000000000'`),equal=(e,t,n,i)=>Object.entries(t).map(([t,a])=>a===null?o`${e.column(t,i)} ${o.raw(n)}`:o`${e.column(t,i)} = ${e.value(t,a)}`),C={concat:(...e)=>o`(${o.join(e,` || `)})`,text:e=>o`CAST(${e} AS TEXT)`,trimZeros:e=>o`ltrim(${e}, '0')`},integer=e=>o`CAST(${e} AS INTEGER)`,signed=e=>o`CAST(${e} AS SIGNED)`,w={postgresql:{same:(e,t)=>o`(${e} = ${t} OR (${e} IS NULL AND ${t} IS NULL))`,digits:e=>o`${e} ~ '^[0-9]{2,}$'`,small:e=>o`CAST(${e} AS integer)`,big:e=>o`CAST(${e} AS bigint)`,pad:(e,t)=>o`lpad(${e}, ${t}, '0')`,...C,fence:o` OFFSET 0`},sqlite:{same:(e,t)=>o`${e} IS ${t}`,digits:e=>o`length(${e}) >= 2 AND ${e} NOT GLOB '*[^0-9]*'`,small:integer,big:integer,pad:(e,t)=>o`substr('000000000' || ${e}, -(${t}))`,...C,fence:o.empty},mysql:{same:(e,t)=>o`${e} <=> ${t}`,digits:e=>o`${e} REGEXP '^[0-9]{2,}$'`,small:signed,big:signed,pad:(e,t)=>o`LPAD(${e}, ${t}, '0')`,concat:(...e)=>o`CONCAT(${o.join(e,`, `)})`,text:e=>o`CAST(${e} AS CHAR)`,trimZeros:e=>o`TRIM(LEADING '0' FROM ${e})`,fence:o.empty}};function decoded(e,t){let n=e.small(o`substr(${t}, 1, 1)`),i=e.small(o`substr(${t}, 2, 1)`);return o`CASE WHEN substr(${t}, 1, 1) = '0' THEN ${e.big(o`NULLIF(substr(${t}, 3, 9 - ${i}), '')`)} - ${e.big(o`substr(${S}, 1, 10 - ${i})`)} ELSE ${e.big(o`NULLIF(substr(${t}, 2, ${n}), '')`)} END`}function encoded(e,t){let n=o.raw(`e.n`),i=o`length(${e.text(o`-${n}`)})`;return o`(SELECT CASE WHEN ${n} IS NULL OR ${n} > 999999999 OR ${n} < -999999999 THEN NULL WHEN ${n} >= 0 THEN ${e.concat(e.text(o`length(${e.text(n)})`),e.text(n))} ELSE ${e.concat(o`'0'`,e.text(o`9 - ${i}`),e.pad(e.text(o`${e.big(o`substr(${S}, 1, ${i} + 1)`)} + ${n}`),i))} END FROM (SELECT ${t} AS n${e.fence}) AS e)`}function between(e,t,n,i,a){let s=o.raw(`c.lo`),c=o.raw(`c.hi`),l=o.raw(`c.il`),u=o.raw(`c.ih`),d=typeof i==`string`?o`${i}`:i,f=o`substr(${c}, length(${s}) + 1)`,p=o`length(${f}) - length(${e.trimZeros(f)}) + 1`,m=o`CASE
|
|
2
2
|
WHEN ${a?o`${a===`lower`?s:c} IS NULL`:o`FALSE`} THEN NULL
|
|
3
3
|
WHEN ${s} IS NULL AND ${c} IS NULL THEN ${e.concat(o`'10'`,d)}
|
|
4
4
|
WHEN ${c} IS NULL THEN ${e.concat(encoded(e,o`CASE WHEN ${l} < 0 THEN 0 ELSE ${l} + 1 END`),d)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{I as t}from"./error-mapping-DIRlrmDK.mjs";import{f as n,y as r}from"./validation--qS7OPmg.mjs";import{t as i}from"./transaction-BNomMtme.mjs";import{n as a}from"./transaction-operation-CVVJxQ19.mjs";import{r as o,t as s}from"./routed-operations-wytpbYKv.mjs";import{o as c}from"./value-guards-CBuxSC66.mjs";import{n as l,r as u,t as d}from"./execution-context-VMQm-9CH.mjs";import{t as f}from"./adapter-result-parser-3WP82Cm-.mjs";import{n as p}from"./bind-parameter-capacity-BMD-bxMO.mjs";import{m}from"./validator-CDYlO9HV.mjs";import{n as h,t as g}from"./query-inspection-C-T2ttRx.mjs";function compileBindBudgetChunks(e,t,n){if(e===0)return[];let r=n(0,e);if(t===void 0||r.values.length<=t||e===1)return[{start:0,end:e,statement:r}];let i=[],a=0;for(;a<e;){let r=a+1,o=Math.min(e,a+1),s;for(;;){let i=n(a,o);if(i.values.length>t||(s={start:a,end:o,statement:i},o===e))break;r=o+1,o=Math.min(e,a+(o-a)*2)}if(s?.end!==e)for(--o;r<=o;){let e=r+Math.floor((o-r)/2),i=n(a,e);i.values.length<=t?(s={start:a,end:e,statement:i},r=e+1):o=e-1}let c=s??{start:a,end:a+1,statement:n(a,a+1)};i.push(c),a=c.end}return i}const _=Symbol(`run alone`),v={string:e=>typeof e==`string`,int:e=>typeof e==`number`&&Number.isSafeInteger(e),bigint:e=>typeof e==`bigint`};let y;const b=new WeakSet;function enableFindUniqueBatching(e){b.add(e)}const x=(()=>{let e=globalThis.process,t=e?.nextTick;return typeof t==`function`?n=>t.call(e,n):queueMicrotask})();function sharesFindUnique(e){return engineBatches(e)&&!e.driver.holdsConnectionScope()}function batchFindUnique(e){let t;try{t=e.routed.args}catch{return}let n=keyOf(e.model,t.where);if(n===void 0)return;let{where:r,...i}=e.args,a=signatureOf(i);if(a===void 0)return;let o,s=new Promise(e=>{o=e}),c,l=new Promise(e=>{c=e}),u={values:n.values,signature:signatureOf(n.values),orThrow:e.requested!==`findUnique`,decide:o};return(enqueue(e,`${n.selector}\u0000${a}\u0000${e.context.named}`,n,u,c)?l.then(e=>(runBatch(e),s)):s).then(t=>t===_?e.run():t.value)}function engineBatches(e){let{driver:t}=e;return b.has(e.route)&&t===e.route.driver&&e.extensionChain?.rewrites===void 0&&t.result?.parseResult===void 0&&t.adapter.result.parseResult===f}function keyOf(e,t){if(!c(t))return;let n=Object.keys(t);if(n.length!==1)return;let r=n[0],i=m(e,r);if(i===void 0)return;let a=t[r],o;if(i.name===void 0)o=[a];else{if(!c(a)||Object.keys(a).length!==i.fields.length)return;o=i.fields.map(e=>a[e])}let{scalars:s,omit:l}=e[`~`].state,u=!1;for(let[e,t]of i.fields.entries()){let n=s[t]?.[`~`].state;if(!(n&&!n.array&&v[n.type])?.(o[e])||l?.[t]===!0)return;n.type===`string`&&(u=!0)}return{selector:r,fields:i.fields,values:o,textKey:u}}function enqueue(e,t,n,r,i){y===void 0&&(y=new Map,x(flush));let a=y.get(e.engine);a===void 0&&y.set(e.engine,a=new Map);let o=`${e.model[`~`].names.ts}\u0000${t}`,s=a.get(o);s===void 0&&a.set(o,s=[]);let c=s.find(t=>sameControls(t.leader.values,e.values)),l=!1;if(c===void 0){let t={leader:e,start:()=>i(t),fields:n.fields,textKey:n.textKey,members:[]};c=t,s.push(c),l=!0}return c.members.push(r),l}function sameControls(e,t){if(e===t)return!0;if(e===void 0||t===void 0)return!1;let n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>Object.hasOwn(t,n)&&e[n]===t[n])}function flush(){let e=y;y=void 0;for(let t of e.values())for(let e of t.values())for(let t of e)t.start()}function runBatch(e){let{members:n}=e,runAlone=e=>{for(let t of e)t.decide(_)};if(n.length===1){runAlone(n);return}try{let r=new Map;for(let e of n){let t=r.get(e.signature);t?t.push(e):r.set(e.signature,[e])}let i=planBatch(e,[...r.values()]),{engine:a}=e.leader,o=t(e.leader.context);for(let t of i.chunks){let n=t.signatures.flatMap(e=>r.get(e));t.read.run({committedWriteSegment:void 0,context:o,driverOverride:void 0,engineDriver:a.driver,isWrite:!1,writeMayBeVisible:void 0}).then(a=>{try{dispatch(e,t,r,i.injected,a)}catch{runAlone(n)}},()=>runAlone(n))}}catch{runAlone(n)}}function planBatch(e,t){let{leader:n,fields:r}=e,i=projectionWithKey(n,r),a=n.rows(),o=new Map,read=(e,s)=>{let c=`${e}:${s}`,l=o.get(c);if(l===void 0){let u=t.slice(e,s).map(e=>e[0].values);l=n.engine.route.prepare(n.model[`~`].names.ts,`findMany`,{...i.args,where:mergedWhere(r,u)},a),o.set(c,l)}return l},s=t.map(e=>e[0].signature),c=p(n.engine.driver.maxBindParametersPerStatement);return{chunks:(c===void 0?[{start:0,end:t.length}]:compileBindBudgetChunks(t.length,c,(e,t)=>read(e,t).read.statement)).map(({start:e,end:t})=>({signatures:s.slice(e,t),read:read(e,t)})),injected:i.injected}}function mergedWhere(e,t){return e.length===1?{[e[0]]:{in:t.map(e=>e[0])}}:{OR:t.map(t=>Object.fromEntries(e.map((e,n)=>[e,t[n]])))}}function projectionWithKey(e,t){let{where:n,...r}=e.args,i=e.routed.args.select,a=[];if(!c(i))return{args:r,injected:a};for(let e of t)i[e]!==!0&&(c(r.select)&&(r.select={...r.select,[e]:!0}),c(r.omit)&&(r.omit={...r.omit,[e]:!1}),a.push(e));return{args:r,injected:a}}function dispatch(e,t,n,r,i){let a=new Map;for(let t of i){let n=signatureOf(e.fields.map(e=>t[e]));for(let e of r)delete t[e];a.has(n)||a.set(n,t)}for(let r of t.signatures){let t=a.get(r);for(let[i,a]of n.get(r).entries())t===void 0?a.orThrow||e.textKey?a.decide(_):a.decide({value:null}):a.decide({value:i===0?t:copyResult(t)})}}function signatureOf(e){switch(typeof e){case`undefined`:return`u`;case`boolean`:case`number`:return String(e);case`string`:return JSON.stringify(e);case`bigint`:return`${e}n`;case`object`:break;default:return}if(e===null)return`null`;if(Array.isArray(e)){let t=[];for(let n of e){let e=signatureOf(n);if(e===void 0)return;t.push(e)}return`[${t.join(`,`)}]`}if(e instanceof Date)return`D${e.getTime()}`;let t=Object.getPrototypeOf(e);if(t!==Object.prototype&&t!==null)return;let n=[];for(let[t,r]of Object.entries(e)){let e=signatureOf(r);if(e===void 0)return;n.push(`${JSON.stringify(t)}:${e}`)}return`{${n.join(`,`)}}`}function copyResult(e,t=new Map){if(typeof e!=`object`||!e)return e;let n=t.get(e);if(n!==void 0)return n;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Uint8Array)return Uint8Array.prototype.slice.call(e);if(Array.isArray(e)){let n=[];t.set(e,n);for(let r of e)n.push(copyResult(r,t));return n}let r=Object.getPrototypeOf(e);if(r!==Object.prototype&&r!==null)return e;let i=Object.create(r);t.set(e,i);for(let[n,r]of Object.entries(e))Object.defineProperty(i,n,{value:copyResult(r,t),enumerable:!0,writable:!0,configurable:!0});return i}const S=Symbol.for(`viborm.pendingOperation`);function combineWriteNotifications(e,t){return e===void 0?t:t===void 0||t===e?e:async()=>{let n=!1,i;try{await e()}catch(e){n=!0,i=e}try{await t()}catch(e){throw n?r(i,e,`Write publication callbacks both failed.`):e}if(n)throw i}}const C=Object.freeze({});let createPendingOperationFriend,w;var T=class PendingOperation{[Symbol.toStringTag]=`Promise`;[S]=!0;#e;#t;#n;#r;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p;#m=!1;#h;#g;#_;#v;#y=!1;static{createPendingOperationFriend=(e,t,n,r,i,a,o)=>new PendingOperation(C,e,t,n,r,i,a===void 0?void 0:{prepare:a,status:`pending`},o),w=Object.freeze({clientId:e=>e.#e,scopeId:e=>e.#t,model:e=>e.#o,operation:e=>e.#s,context:e=>e.#n,prepareAdmission:(e,t=`input`)=>{e.#T(),t===`plan`&&e.#w()},around:e=>{let t=e.#c,n=e.#r.extensionChain?.around?.handlers(e.#o,t);return{context:n?.length?e.#E(`array`,e.#T()):void 0,handlers:n,write:!o(t),registration:e.#x()}},executeCore:(e,t,n)=>e.#u.executeReserved(()=>e.#P(t,n?.committed,n?.mayHaveCommitted)),unit:e=>e.#k(),reserveWith:(e,t)=>{e.#u.reserveWith(t)},executeWith:(e,t)=>{let n=e.#r.extensionChain?.observation;return n===void 0?e.#u.executeWith(t,()=>e.#P(t)):e.#u.executeWith(t,()=>n.run(e.#k(!0),()=>e.#P(t)))},finishResult:(e,t)=>e.#l?e.#l(t):t,prepare:e=>e.#w()?.queries[0],prepareBatch:e=>e.#S().prepareBatch(e.#n),parseResult:(e,t)=>{let r=e.#w();if(!r)throw new n(`Operation '${e.#s}' on model '${e.#o}' publishes no single driver result to parse.`);return r.parseResult([t])},observeBatchPhase:(e,t,n)=>l(e.#n,t,n)}),a(PendingOperation.prototype,e=>#n in e,w),Object.freeze(PendingOperation.prototype)}constructor(e,t,n,r,a,o,s,c){if(e!==C)throw new i;this.#r=t,this.#i=n,this.#a=a,this.#d=s,this.#f=c,this.#g=t.route,this.#s=r.endsWith(`OrThrow`)?r.slice(0,-7):r,this.#o=n[`~`].names.ts??`unknown`,this.#u=new h(this.#o,this.#s),this.#c=o?.originalOperation??r,this.#l=o?.finishResult,this.#e=t.clientId,this.#t=t.scopeId,this.#n=d(this.#o,this.#s,t.extensionChain,o?.named),s&&(s.of={engine:t,context:this.#n,prepared:()=>this.#S()}),Object.freeze(this)}#b(){let e=this.#d;if(e===void 0)return this.#a;if(e.status===`success`&&e.args)return e.args;if(e.status===`failure`)throw e.error;try{let t=this.#r.extensionChain?.args?.admit(this.#o,this.#c,this.#s,this.#a,this.#r.bound),n=e.prepare(t?.args??this.#a,t?.values,e);return e.args=n,e.values=t?.values,e.status=`success`,n}catch(t){throw e.error=t,e.status=`failure`,t}}#x(){return this.#m?this.#p:(this.#p=this.#f?.(this.#n,this.#d?.values,this.#d),this.#m=!0,this.#p)}#S(){if(this.#_)return this.#_;if(!s.has(this.#s))throw new n(`Unknown operation '${this.#s}' on model '${this.#o}'. Known operations: ${[...s].sort().join(`, `)}.`);let e=this.#b();this.#x();let t=this.#g.prepare(this.#o,this.#c,e,this.#C());return this.#_=t,t}#C(){return(this.#r.extensionChain?.callRows)?.call(this.#o,this.#d?.values)}#w(){if(this.#y)return this.#v;let e=this.#S().prepareSingle(this.#n);return this.#v=e?.queries.length===1?e:void 0,this.#y=!0,this.#v}#T(){return this.#S().args}#E(e,t){let n=this.#d?.values,r;return Object.freeze({mode:e,kind:`model`,model:this.#o,operation:this.#c,get input(){return r??=g(t),r},...n===void 0?{}:{values:n},call:this.#d})}#D(){return this.#u.executeDefault(()=>{let e=this.#r.extensionChain?.observation;return e===void 0?this.#O(this.#A()):e.run(this.#k(!0),()=>this.#O(this.#A()))})}#O(e){let t=this.#l;return t?e.then(e=>t(e)):e}#k(e){return{kind:`operation`,operation:this.#c,model:this.#o,context:this.#n,driver:this.#r.driver,table:this.#i[`~`].names.sql??this.#o,...e?{certainty:()=>this.#h}:{}}}#A(e,t,n){return u(this.#n,()=>this.#j(e,t,n))}#j(e,t,n){let r=this.#N(`committed`),i=this.#N(`may-have-committed`),a=this.#c,o=this.#r.extensionChain?.around?.handlers(this.#o,a);return(o===void 0||o.length===0)&&this.#f===void 0?this.#P(e,combineWriteNotifications(t,r),combineWriteNotifications(n,i)):this.#M(o,a,r,i,e,t,n)}#M(e,t,n,r,i,a,s){let c;try{c=this.#T()}catch(e){return Promise.reject(e)}let l=this.#x(),u=this.#r.extensionChain?.coordination;if(u===void 0||(e===void 0||e.length===0)&&l===void 0)return this.#P(i,combineWriteNotifications(a,n),combineWriteNotifications(s,r));let d=e===void 0||e.length===0?void 0:this.#E(this.#r.transaction?`transaction`:`direct`,c);return u.executePreparedQuery(d,e,(e,t)=>this.#P(t??i,combineWriteNotifications(a,combineWriteNotifications(e?.committed,n)),combineWriteNotifications(s,combineWriteNotifications(e?.mayHaveCommitted,r))),!o(t),this.#r.transaction,void 0,l)}#N(e){if(!(this.#r.transaction!==void 0||this.#r.extensionChain?.observation===void 0))return async()=>{(e===`committed`||this.#h===void 0)&&(this.#h=e)}}#P(e,t,n){return this.#F(e,t,n)}#F(e,t,n){let r;try{r=this.#S()}catch(e){return Promise.reject(e)}return this.#s===`findUnique`&&e===void 0&&r.seen===void 0&&sharesFindUnique(this.#r)?this.#L(r,t,n):this.#I(r,e,t,n)}#I(e,t,n,r){return e.run({committedWriteSegment:n,context:this.#n,driverOverride:t,engineDriver:this.#r.driver,isWrite:!o(this.#c),writeMayBeVisible:r})}#L(e,t,n){let run=()=>this.#I(e,void 0,t,n),r=batchFindUnique({engine:this.#r,model:this.#i,requested:this.#c,args:this.#b(),values:this.#d?.values,rows:()=>this.#C(),routed:e,context:this.#n,run});return r===void 0?run():r}getArgs(){return this.#a}buildStatement(){return this.#S().read?.statement}then(e,t){return this.#D().then(e,t)}catch(e){return this.#D().catch(e)}finally(e){return this.#D().finally(e)}};function createPendingOperation(e,t,n,r,i,a,o){return createPendingOperationFriend(e,t,n,r,i,a,o)}function isPendingOperation(e){return typeof e==`object`&&!!e&&S in e&&e[S]===!0}export{compileBindBudgetChunks as a,enableFindUniqueBatching as i,createPendingOperation as n,isPendingOperation as r,T as t};
|
|
2
|
+
//# sourceMappingURL=pending-operation-Dq4rv-Ml.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pending-operation-Dq4rv-Ml.mjs","names":["copy","#clientId","#scopeId","#attribution","#engine","#model","#args","#modelName","#operation","#requested","#finishResult","#execution","#inputPreparation","#prepareWriteOutcomeRegistration","#route","#preparedInput","#resolveSinglePackage","#queryContext","#resolveWriteOutcomeRegistration","#runCoreExecution","#unit","#resolveRouted","#writeOutcomeRegistrationResolved","#writeOutcomeRegistration","#routedInstance","#resolveArgs","#callRows","#singlePackageResolved","#singlePackage","#finished","#runExecution","#observationCommitCertainty","#runAttributedExecution","#observationNotification","#runExtendedExecution","#run","#runShared","#runRouted","#getPromise"],"sources":["../src/query-engine/bind-budget.ts","../src/query-engine/find-unique-batch.ts","../src/query-engine/pending-operation.ts"],"sourcesContent":["import type { Sql } from \"@sql\";\n\nexport { normalizedBindParameterLimit } from \"@drivers/bind-parameter-capacity\";\n\nexport interface CompiledBindBudgetChunk {\n /** Inclusive semantic-item offset. */\n readonly start: number;\n /** Exclusive semantic-item offset. */\n readonly end: number;\n readonly statement: Sql;\n}\n\n/**\n * Compile the largest contiguous semantic-item ranges that fit a verified bind\n * budget. The compiled SQL is the meter; callers do not estimate binds from\n * item count or shape. `compile` must be monotonic for a growing prefix, as\n * INSERT value tuples and exact-key predicate lists are.\n *\n * Unknown capacity preserves the original one-statement shape. One item that\n * exceeds a known budget stays indivisible so the executor's final capacity\n * check can refuse it before I/O.\n */\nexport function compileBindBudgetChunks(\n itemCount: number,\n maxBindParametersPerStatement: number | undefined,\n compile: (start: number, end: number) => Sql\n): CompiledBindBudgetChunk[] {\n if (itemCount === 0) return [];\n const whole = compile(0, itemCount);\n if (\n maxBindParametersPerStatement === undefined ||\n whole.values.length <= maxBindParametersPerStatement ||\n itemCount === 1\n ) {\n return [{ start: 0, end: itemCount, statement: whole }];\n }\n\n const chunks: CompiledBindBudgetChunk[] = [];\n let start = 0;\n while (start < itemCount) {\n let lower = start + 1;\n let upper = Math.min(itemCount, start + 1);\n let largest: CompiledBindBudgetChunk | undefined;\n // Probe geometrically from this window, never from the entire remaining\n // suffix. Oversized compilation stays proportional to a window's size.\n while (true) {\n const statement = compile(start, upper);\n if (statement.values.length > maxBindParametersPerStatement) break;\n largest = { start, end: upper, statement };\n if (upper === itemCount) break;\n lower = upper + 1;\n upper = Math.min(itemCount, start + (upper - start) * 2);\n }\n if (largest?.end !== itemCount) {\n upper -= 1;\n while (lower <= upper) {\n const end = lower + Math.floor((upper - lower) / 2);\n const statement = compile(start, end);\n if (statement.values.length <= maxBindParametersPerStatement) {\n largest = { start, end, statement };\n lower = end + 1;\n } else upper = end - 1;\n }\n }\n const chunk = largest ?? {\n start,\n end: start + 1,\n statement: compile(start, start + 1),\n };\n chunks.push(chunk);\n start = chunk.end;\n }\n return chunks;\n}\n","/**\n * `findUnique` batching: Prisma's dataloader, at the operation dispatch layer.\n *\n * Opt-in (`createClient({ findUniqueBatching: true })`, 1.4.1): calls issued\n * in the same tick that would each cost one round trip are answered by ONE\n * `findMany` over the keys they name, and each caller gets its own row back.\n * The shared read runs in its leader's own async context (the first call of\n * its batch), which may not be every member's: a driver that picks a database\n * by `AsyncLocalStorage`, or a trace per request, sees the leader's. That is\n * why it is opt-in. The merge happens below every per-call lifecycle step — request\n * transforms, arguments, default omit, admission, query interceptors, the\n * official cache and observers all still see each call as its own operation —\n * and above the route, which runs the merged read like any other read.\n *\n * Two calls share a batch only when nothing that decides their rows differs:\n * the same engine (so the same client view, extension chain and bound\n * arguments), outside every transaction, the same model, the same unique key\n * spelled the same way, the same projection (`select`/`include`/`omit`, nested\n * arguments included, compared structurally), the same admitted arguments and\n * the same `named` option, which the merged read carries.\n * The `where` must be the key alone: a value per member, nothing else.\n *\n * A row reaches a caller only when its decoded key is EXACTLY the caller's\n * admitted key. Whatever cannot be decided that way runs as the caller's own\n * unbatched operation, so a batch can cost a statement but never change an\n * answer:\n * - a string key without an exact match (a case-insensitive or padding\n * collation can make the database find a row JavaScript does not match);\n * - a missing row for `findUniqueOrThrow` (its own error comes from its owner);\n * - a merged read that fails, for every caller of that read.\n * Only string, integer and bigint key members are batched. An integer or\n * bigint member's decoded value is its bound value, so a row JavaScript does\n * not match is a row the database did not return either: a missing integer\n * key answers `null` from the batch.\n */\n\nimport { passThroughParseResult } from \"@adapters/adapter-result-parser\";\nimport { normalizedBindParameterLimit } from \"@drivers/bind-parameter-capacity\";\nimport { deriveRecoverableExecutionContext } from \"@drivers/execution-context\";\nimport type { QueryExecutionContext } from \"@drivers/exports\";\nimport type { AdmittedArgs } from \"@extensions/arguments\";\nimport type { AnyModel } from \"@schema/model\";\nimport { findAddressableKey } from \"@schema/model/keys\";\nimport { isRecord } from \"@validation/value-guards\";\nimport { compileBindBudgetChunks } from \"./bind-budget\";\nimport type { QueryEngine } from \"./query-engine\";\nimport type { PreparedOperation } from \"./raptor3/commands\";\nimport type { CallRows } from \"./raptor3/shared/row-scope\";\n\n/** One `findUnique` call, as its pending operation knows it at dispatch. */\nexport interface FindUniqueCall {\n readonly engine: QueryEngine;\n readonly model: AnyModel;\n /** `findUnique` or `findUniqueOrThrow`. */\n readonly requested: string;\n /** The client-prepared input: arguments removed, request transforms applied. */\n readonly args: Record<string, unknown>;\n readonly values: AdmittedArgs | undefined;\n /** The call's own row domain, resolved for the batch that runs it. */\n readonly rows: () => CallRows | undefined;\n readonly routed: PreparedOperation;\n readonly context: QueryExecutionContext;\n /** The call's own, unbatched execution. */\n readonly run: () => Promise<unknown>;\n}\n\n/** What a batch decided for one caller. */\ntype Decision = { readonly value: unknown } | typeof RUN_ALONE;\nconst RUN_ALONE = Symbol(\"run alone\");\n\ninterface Member {\n readonly values: readonly unknown[];\n readonly signature: string;\n readonly orThrow: boolean;\n readonly decide: (decision: Decision) => void;\n}\n\ninterface Batch {\n readonly leader: FindUniqueCall;\n /** Starts the batch in its leader's own continuation (its async context). */\n readonly start: () => void;\n readonly fields: readonly string[];\n readonly textKey: boolean;\n readonly members: Member[];\n}\n\n/** Key members whose decoded value is the bound value, by scalar type. */\nconst EXACT_KEY_VALUES: Readonly<Record<string, (value: unknown) => boolean>> =\n {\n string: (value) => typeof value === \"string\",\n int: (value) => typeof value === \"number\" && Number.isSafeInteger(value),\n bigint: (value) => typeof value === \"bigint\",\n };\n\nlet pending: Map<QueryEngine, Map<string, Batch[]>> | undefined;\n\n/** The operation routes of the clients created with `findUniqueBatching`. */\nconst batchingRoutes = new WeakSet<object>();\n\n/** Turn batching on for every engine of the client that owns `route`. */\nexport function enableFindUniqueBatching(route: object): void {\n batchingRoutes.add(route);\n}\n\n/**\n * After the current synchronous run AND the microtasks it queued, so resolvers\n * that each await once before calling still share a batch. Where there is no\n * `process.nextTick`, the end of the current synchronous run.\n */\nconst defer: (callback: () => void) => void = (() => {\n const host = (\n globalThis as {\n process?: { nextTick?: (callback: () => void) => void };\n }\n ).process;\n const nextTick = host?.nextTick;\n return typeof nextTick === \"function\"\n ? (callback) => nextTick.call(host, callback)\n : queueMicrotask;\n})();\n\n/**\n * Whether a `findUnique` of `engine` may share a read now: what its owner asks\n * before it describes the call to {@link batchFindUnique}.\n *\n * A call on the originating client inside its own callback transaction\n * runs alone, and is refused there as it always was: in a batch, the shared\n * read would queue behind the transaction that waits for this call.\n */\nexport function sharesFindUnique(engine: QueryEngine): boolean {\n return engineBatches(engine) && !engine.driver.holdsConnectionScope();\n}\n\n/**\n * Join a batch, or answer `undefined` when this call does not batch and must\n * run as it always has. Its engine {@link sharesFindUnique}.\n */\nexport function batchFindUnique(\n call: FindUniqueCall\n): Promise<unknown> | undefined {\n let admitted: Record<string, unknown>;\n try {\n admitted = call.routed.args;\n } catch {\n // The call's own execution admits again and rejects with the same error.\n return undefined;\n }\n const key = keyOf(call.model, admitted.where);\n if (key === undefined) return undefined;\n const { where: _where, ...projection } = call.args;\n const shape = signatureOf(projection);\n if (shape === undefined) return undefined;\n\n let decide!: (decision: Decision) => void;\n const decision = new Promise<Decision>((resolve) => {\n decide = resolve;\n });\n let lead!: (batch: Batch) => void;\n const leading = new Promise<Batch>((resolve) => {\n lead = resolve;\n });\n const member: Member = {\n values: key.values,\n signature: signatureOf(key.values)!,\n orThrow: call.requested !== \"findUnique\",\n decide,\n };\n const leads = enqueue(\n call,\n `${key.selector}\\u0000${shape}\\u0000${call.context.named}`,\n key,\n member,\n lead\n );\n // Continuations run in the async context of the call that registered them:\n // the leader runs its batch in its own, and a call that runs alone runs in\n // its own. The tick's flush runs in whichever context queued first, and\n // only starts batches.\n const settled = leads\n ? leading.then((batch) => {\n runBatch(batch);\n return decision;\n })\n : decision;\n return settled.then((outcome) =>\n outcome === RUN_ALONE ? call.run() : outcome.value\n );\n}\n\n/**\n * The engine runs outside every transaction scope, and nothing below the\n * operation is keyed on the statement or the operation name: a statement\n * transform sees `findUnique`, and a result middleware is handed the operation\n * name, so either would observe the merged `findMany`.\n */\nfunction engineBatches(engine: QueryEngine): boolean {\n const { driver } = engine;\n return (\n batchingRoutes.has(engine.route) &&\n driver === engine.route.driver &&\n engine.extensionChain?.rewrites === undefined &&\n driver.result?.parseResult === undefined &&\n driver.adapter.result.parseResult === passThroughParseResult\n );\n}\n\ninterface BatchKey {\n readonly selector: string;\n readonly fields: readonly string[];\n readonly values: readonly unknown[];\n readonly textKey: boolean;\n}\n\n/** The admitted `where` as one addressable key and nothing else, or nothing. */\nfunction keyOf(model: AnyModel, where: unknown): BatchKey | undefined {\n if (!isRecord(where)) return undefined;\n const selectors = Object.keys(where);\n if (selectors.length !== 1) return undefined;\n const selector = selectors[0]!;\n const key = findAddressableKey(model, selector);\n if (key === undefined) return undefined;\n const value = where[selector];\n let values: unknown[];\n if (key.name === undefined) values = [value];\n else {\n if (!isRecord(value) || Object.keys(value).length !== key.fields.length)\n return undefined;\n values = key.fields.map((field) => value[field]);\n }\n // A member the model hides from every result cannot be read back to\n // dispatch a row, and no call may select it.\n const { scalars, omit } = model[\"~\"].state;\n let textKey = false;\n for (const [index, field] of key.fields.entries()) {\n const state = scalars[field]?.[\"~\"].state;\n const exact = state && !state.array && EXACT_KEY_VALUES[state.type];\n if (!exact?.(values[index]) || omit?.[field] === true) return undefined;\n if (state.type === \"string\") textKey = true;\n }\n return { selector, fields: key.fields, values, textKey };\n}\n\n/** Join or open a batch; `true` when this call opened it and leads it. */\nfunction enqueue(\n call: FindUniqueCall,\n shape: string,\n key: BatchKey,\n member: Member,\n lead: (batch: Batch) => void\n): boolean {\n if (pending === undefined) {\n pending = new Map();\n defer(flush);\n }\n let byShape = pending.get(call.engine);\n if (byShape === undefined) pending.set(call.engine, (byShape = new Map()));\n const signature = `${call.model[\"~\"].names.ts}\\u0000${shape}`;\n let batches = byShape.get(signature);\n if (batches === undefined) byShape.set(signature, (batches = []));\n let batch = batches.find((candidate) =>\n sameControls(candidate.leader.values, call.values)\n );\n let leads = false;\n if (batch === undefined) {\n const opened: Batch = {\n leader: call,\n start: () => lead(opened),\n fields: key.fields,\n textKey: key.textKey,\n members: [],\n };\n batch = opened;\n batches.push(batch);\n leads = true;\n }\n batch.members.push(member);\n return leads;\n}\n\n/** Admitted arguments decide the row domain: the same values, the same rows. */\nfunction sameControls(\n first: AdmittedArgs | undefined,\n second: AdmittedArgs | undefined\n): boolean {\n if (first === second) return true;\n if (first === undefined || second === undefined) return false;\n const names = Object.keys(first);\n return (\n names.length === Object.keys(second).length &&\n names.every(\n (name) => Object.hasOwn(second, name) && first[name] === second[name]\n )\n );\n}\n\nfunction flush(): void {\n const batches = pending;\n pending = undefined;\n for (const byShape of batches!.values())\n for (const list of byShape.values())\n for (const batch of list) batch.start();\n}\n\ninterface Chunk {\n readonly signatures: readonly string[];\n readonly read: PreparedOperation;\n}\n\n/**\n * Run one batch. Whatever goes wrong before a caller's row is decided sends\n * that caller back to its own execution; a caller is decided once, so a later\n * decision never replaces an earlier one.\n */\nfunction runBatch(batch: Batch): void {\n const { members } = batch;\n const runAlone = (callers: readonly Member[]) => {\n for (const member of callers) member.decide(RUN_ALONE);\n };\n if (members.length === 1) {\n runAlone(members);\n return;\n }\n try {\n const bySignature = new Map<string, Member[]>();\n for (const member of members) {\n const same = bySignature.get(member.signature);\n if (same) same.push(member);\n else bySignature.set(member.signature, [member]);\n }\n const plan = planBatch(batch, [...bySignature.values()]);\n const { engine } = batch.leader;\n // Its callers recover a failure by running alone, so the shared read's\n // own failure is not logged or traced as an error.\n const context = deriveRecoverableExecutionContext(batch.leader.context);\n for (const chunk of plan.chunks) {\n const callers = chunk.signatures.flatMap((key) => bySignature.get(key)!);\n (\n chunk.read.run({\n committedWriteSegment: undefined,\n context,\n driverOverride: undefined,\n engineDriver: engine.driver,\n isWrite: false,\n writeMayBeVisible: undefined,\n }) as Promise<Record<string, unknown>[]>\n ).then(\n (rows) => {\n try {\n dispatch(batch, chunk, bySignature, plan.injected, rows);\n } catch {\n runAlone(callers);\n }\n },\n () => runAlone(callers)\n );\n }\n } catch {\n runAlone(members);\n }\n}\n\n/**\n * The merged reads, split where the driver's bind budget requires, through the\n * one chunking owner: the compiled statement is the meter.\n */\nfunction planBatch(\n batch: Batch,\n keys: readonly (readonly Member[])[]\n): { chunks: Chunk[]; injected: readonly string[] } {\n const { leader, fields } = batch;\n const projected = projectionWithKey(leader, fields);\n const rows = leader.rows();\n const reads = new Map<string, PreparedOperation>();\n const read = (start: number, end: number): PreparedOperation => {\n const id = `${start}:${end}`;\n let operation = reads.get(id);\n if (operation === undefined) {\n const values = keys.slice(start, end).map((same) => same[0]!.values);\n operation = leader.engine.route.prepare(\n leader.model[\"~\"].names.ts!,\n \"findMany\",\n { ...projected.args, where: mergedWhere(fields, values) },\n rows\n );\n reads.set(id, operation);\n }\n return operation;\n };\n const signatures = keys.map((same) => same[0]!.signature);\n const limit = normalizedBindParameterLimit(\n leader.engine.driver.maxBindParametersPerStatement\n );\n const ranges =\n limit === undefined\n ? [{ start: 0, end: keys.length }]\n : compileBindBudgetChunks(\n keys.length,\n limit,\n (start, end) => read(start, end).read!.statement\n );\n return {\n chunks: ranges.map(({ start, end }) => ({\n signatures: signatures.slice(start, end),\n read: read(start, end),\n })),\n injected: projected.injected,\n };\n}\n\n/** One key member: `IN`; a compound key: one equality group per key. */\nfunction mergedWhere(\n fields: readonly string[],\n values: readonly (readonly unknown[])[]\n): Record<string, unknown> {\n if (fields.length === 1)\n return { [fields[0]!]: { in: values.map((value) => value[0]) } };\n return {\n OR: values.map((value) =>\n Object.fromEntries(fields.map((field, index) => [field, value[index]]))\n ),\n };\n}\n\n/**\n * The leader's projection with every key member read, so each row can be\n * dispatched; a member the caller does not read is removed again before the\n * row is handed over. A member can be missing because it is not selected or\n * because it is omitted (an omit wins over a select), so both are lifted.\n */\nfunction projectionWithKey(\n leader: FindUniqueCall,\n fields: readonly string[]\n): { args: Record<string, unknown>; injected: string[] } {\n const { where: _where, ...args } = leader.args;\n const selected = leader.routed.args.select;\n const injected: string[] = [];\n if (!isRecord(selected)) return { args, injected };\n for (const field of fields) {\n if (selected[field] === true) continue;\n if (isRecord(args.select)) args.select = { ...args.select, [field]: true };\n if (isRecord(args.omit)) args.omit = { ...args.omit, [field]: false };\n injected.push(field);\n }\n return { args, injected };\n}\n\nfunction dispatch(\n batch: Batch,\n chunk: Chunk,\n bySignature: ReadonlyMap<string, readonly Member[]>,\n injected: readonly string[],\n rows: readonly Record<string, unknown>[]\n): void {\n const found = new Map<string | undefined, Record<string, unknown>>();\n for (const row of rows) {\n const signature = signatureOf(batch.fields.map((field) => row[field]));\n for (const field of injected) delete row[field];\n if (!found.has(signature)) found.set(signature, row);\n }\n for (const signature of chunk.signatures) {\n const row = found.get(signature);\n for (const [index, member] of bySignature.get(signature)!.entries()) {\n if (row !== undefined)\n member.decide({ value: index === 0 ? row : copyResult(row) });\n else if (member.orThrow || batch.textKey) member.decide(RUN_ALONE);\n else member.decide({ value: null });\n }\n }\n}\n\n/**\n * A structural signature of plain argument data: equal signatures, equal\n * arguments. Anything else (a function, a fragment, a class instance) has\n * none, and the call does not batch.\n */\nfunction signatureOf(value: unknown): string | undefined {\n switch (typeof value) {\n case \"undefined\":\n return \"u\";\n case \"boolean\":\n case \"number\":\n return String(value);\n case \"string\":\n return JSON.stringify(value);\n case \"bigint\":\n return `${value}n`;\n case \"object\":\n break;\n default:\n return undefined;\n }\n if (value === null) return \"null\";\n if (Array.isArray(value)) {\n const items: string[] = [];\n for (const item of value) {\n const signature = signatureOf(item);\n if (signature === undefined) return undefined;\n items.push(signature);\n }\n return `[${items.join(\",\")}]`;\n }\n if (value instanceof Date) return `D${value.getTime()}`;\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return undefined;\n const entries: string[] = [];\n for (const [name, entry] of Object.entries(value)) {\n const signature = signatureOf(entry);\n if (signature === undefined) return undefined;\n entries.push(`${JSON.stringify(name)}:${signature}`);\n }\n return `{${entries.join(\",\")}}`;\n}\n\n/**\n * A second caller of the same key gets its own result, as it would have\n * unbatched: plain objects, arrays, dates and byte arrays are copied, keeping\n * the shape of what is shared inside the result (a node reached twice is one\n * copy); an immutable value (a Decimal) is shared. Members are defined, never\n * assigned, so a JSON key named `__proto__` stays an own member.\n */\nfunction copyResult(\n value: unknown,\n copies = new Map<object, unknown>()\n): unknown {\n if (typeof value !== \"object\" || value === null) return value;\n const known = copies.get(value);\n if (known !== undefined) return known;\n if (value instanceof Date) return new Date(value.getTime());\n if (value instanceof Uint8Array)\n return Uint8Array.prototype.slice.call(value);\n if (Array.isArray(value)) {\n const copy: unknown[] = [];\n copies.set(value, copy);\n for (const item of value) copy.push(copyResult(item, copies));\n return copy;\n }\n const prototype = Object.getPrototypeOf(value);\n if (prototype !== Object.prototype && prototype !== null) return value;\n const copy = Object.create(prototype) as object;\n copies.set(value, copy);\n for (const [name, entry] of Object.entries(value))\n Object.defineProperty(copy, name, {\n value: copyResult(entry, copies),\n enumerable: true,\n writable: true,\n configurable: true,\n });\n return copy;\n}\n","/**\n * Deferred operation lifecycle owned by the query engine.\n * Validation, SQL construction, and execution remain lazy until a lifecycle\n * method is called. Every operation is served by the single (V2) engine.\n */\n\nimport type { AnyDriver, QueryExecutionContext } from \"@drivers/exports\";\nimport {\n InvalidTransactionInputError,\n retainWriteOutcomeFailure,\n} from \"@errors\";\nimport type { AdmittedArgs } from \"@extensions/arguments\";\nimport type { CallOrigin } from \"@extensions/origin\";\nimport type {\n AroundHandlers,\n CallMode,\n PreparedModelQueryContext,\n WriteOutcomeRegistration,\n} from \"@extensions/query\";\nimport type { UnitSource } from \"@extensions/unit-source\";\nimport type { AnyModel } from \"@schema/model\";\nimport type { Sql } from \"@sql\";\nimport {\n createOperationExecutionContext,\n observeTransactionBatchPhase,\n withOperationErrorContext,\n} from \"./execution-context\";\nimport { batchFindUnique, sharesFindUnique } from \"./find-unique-batch\";\nimport { PendingExecution } from \"./pending-execution\";\nimport type { QueryEngine } from \"./query-engine\";\nimport { snapshotQueryInput } from \"./query-inspection\";\nimport type { CommandEngine, PreparedOperation } from \"./raptor3/commands\";\nimport { isReadOperation, ROUTED_OPERATIONS } from \"./routed-operations\";\nimport {\n registerTransactionOperationOwner,\n type TransactionOperation,\n type TransactionOperationOwner,\n} from \"./transaction-operation\";\nimport {\n type Operation,\n type PreparedBatchOperation,\n type PrepareOptions,\n QueryEngineError,\n} from \"./types\";\n\nexport const PENDING_OPERATION_SYMBOL = Symbol.for(\"viborm.pendingOperation\");\n\n/** Publish a durably committed write segment to the cache and observers. */\nexport type CommittedWriteSegmentNotification = () => Promise<void>;\n/** Conservatively invalidate after dispatch when provider acknowledgement is ambiguous. */\nexport type WriteMayBeVisibleNotification = () => Promise<void>;\n\nfunction combineWriteNotifications(\n first: (() => Promise<void>) | undefined,\n second: (() => Promise<void>) | undefined\n): (() => Promise<void>) | undefined {\n if (first === undefined) return second;\n if (second === undefined || second === first) return first;\n return async () => {\n let firstFailed = false;\n let firstFailure: unknown;\n try {\n await first();\n } catch (error) {\n firstFailed = true;\n firstFailure = error;\n }\n try {\n await second();\n } catch (error) {\n if (firstFailed) {\n throw retainWriteOutcomeFailure(\n firstFailure,\n error,\n \"Write publication callbacks both failed.\"\n );\n }\n throw error;\n }\n if (firstFailed) throw firstFailure;\n };\n}\n\n/**\n * Client-owned work that must finish before operation construction starts. It\n * receives the call's arguments without the ones extensions declare (`args`),\n * and the values admitted from those.\n */\nexport type PrepareOperationInput = (\n args: Record<string, unknown>,\n values: AdmittedArgs | undefined,\n /** One object per call: what an extension's two moments of it share. */\n call: object\n) => Record<string, unknown>;\n\n/** Package-owned write listener prepared only after the operation input is trusted. */\nexport type PrepareWriteOutcomeRegistration = (\n context: QueryExecutionContext,\n values: AdmittedArgs | undefined,\n call: object | undefined\n) => WriteOutcomeRegistration | undefined;\n\ninterface OperationInputPreparation extends CallOrigin {\n readonly prepare: PrepareOperationInput;\n status: \"pending\" | \"success\" | \"failure\";\n args?: Record<string, unknown>;\n /** The operation's one admission record, settled with its arguments. */\n values?: AdmittedArgs;\n error?: unknown;\n}\n\nconst OR_THROW_SUFFIX = \"OrThrow\";\nconst pendingOperationConstruction = Object.freeze({});\n\ntype CreatePendingOperation = <T>(\n engine: QueryEngine,\n model: AnyModel,\n operation: Operation | `${Operation}OrThrow`,\n args: Record<string, unknown>,\n options?: PrepareOptions,\n prepareInput?: PrepareOperationInput,\n prepareWriteOutcomeRegistration?: PrepareWriteOutcomeRegistration\n) => PendingOperation<T>;\n\nlet createPendingOperationFriend: CreatePendingOperation;\n\nlet pendingOperationTransactionOwner: TransactionOperationOwner<\n PendingOperation<unknown>\n>;\n\n/** One user operation, from lazy creation through execution and parsing. */\nexport class PendingOperation<T>\n implements Promise<T>, TransactionOperation<T>\n{\n readonly [Symbol.toStringTag] = \"Promise\";\n readonly [PENDING_OPERATION_SYMBOL] = true;\n // Ownership and attribution as they were when the operation was created.\n // Members of the operation itself: a frozen record of the three and a\n // frozen copy of its options were made per call (with the description of\n // a `findUnique` no batch takes, 0.5 kB and 1 % of its client CPU).\n readonly #clientId: symbol;\n readonly #scopeId: symbol;\n readonly #attribution: QueryExecutionContext;\n readonly #engine: QueryEngine;\n readonly #model: AnyModel;\n readonly #args: Record<string, unknown>;\n readonly #modelName: string;\n readonly #operation: Operation;\n /** The verb the caller asked for, `…OrThrow` included. */\n readonly #requested: string;\n /** The client's last step on the operation's value, if any. */\n readonly #finishResult: ((value: unknown) => unknown) | undefined;\n\n readonly #execution: PendingExecution<T>;\n readonly #inputPreparation: OperationInputPreparation | undefined;\n readonly #prepareWriteOutcomeRegistration:\n | PrepareWriteOutcomeRegistration\n | undefined;\n #writeOutcomeRegistration: WriteOutcomeRegistration | undefined;\n #writeOutcomeRegistrationResolved = false;\n #observationCommitCertainty: \"committed\" | \"may-have-committed\" | undefined;\n\n // The ONE operation owner (C-01). Every client lineage builds it in\n // `VibORM`'s constructor and `bind()` forwards it, so an operation that was\n // created from a client has one.\n readonly #route: CommandEngine;\n #routedInstance: PreparedOperation | undefined;\n #singlePackage: PreparedBatchOperation<unknown> | undefined;\n #singlePackageResolved = false;\n\n static {\n createPendingOperationFriend = <T>(\n engine: QueryEngine,\n model: AnyModel,\n operation: Operation | `${Operation}OrThrow`,\n args: Record<string, unknown>,\n options?: PrepareOptions,\n prepareInput?: PrepareOperationInput,\n prepareWriteOutcomeRegistration?: PrepareWriteOutcomeRegistration\n ) =>\n new PendingOperation<T>(\n pendingOperationConstruction,\n engine,\n model,\n operation,\n args,\n options,\n prepareInput === undefined\n ? undefined\n : { prepare: prepareInput, status: \"pending\" },\n prepareWriteOutcomeRegistration\n );\n pendingOperationTransactionOwner = Object.freeze({\n clientId: (operation) => operation.#clientId,\n scopeId: (operation) => operation.#scopeId,\n model: (operation) => operation.#modelName,\n operation: (operation) => operation.#operation,\n context: (operation) => operation.#attribution,\n prepareAdmission: (operation, phase = \"input\") => {\n operation.#preparedInput();\n if (phase === \"plan\") operation.#resolveSinglePackage();\n },\n around: (operation) => {\n const requestedOperation = operation.#requested;\n const handlers = operation.#engine.extensionChain?.around?.handlers(\n operation.#modelName,\n requestedOperation\n );\n return {\n context: handlers?.length\n ? operation.#queryContext(\"array\", operation.#preparedInput())\n : undefined,\n handlers,\n write: !isReadOperation(requestedOperation),\n registration: operation.#resolveWriteOutcomeRegistration(),\n };\n },\n executeCore: (operation, driver, notifications) =>\n operation.#execution.executeReserved(() =>\n operation.#runCoreExecution(\n driver,\n notifications?.committed,\n notifications?.mayHaveCommitted\n )\n ),\n unit: (operation) => operation.#unit(),\n reserveWith: (operation, driver) => {\n operation.#execution.reserveWith(driver);\n },\n executeWith: (operation, driver) => {\n const observation = operation.#engine.extensionChain?.observation;\n if (observation === undefined) {\n return operation.#execution.executeWith(driver, () =>\n operation.#runCoreExecution(driver)\n );\n }\n return operation.#execution.executeWith(driver, () =>\n observation.run(operation.#unit(true), () =>\n operation.#runCoreExecution(driver)\n )\n );\n },\n // One preparation answers both arms: the package this operation prepares\n // to synchronously publishes the one query and the parser for its one\n // result. A verb that needs the asynchronous fold publishes no single\n // query, and the array owner asks it for the package instead.\n finishResult: (operation, value) =>\n operation.#finishResult ? operation.#finishResult(value) : value,\n prepare: (operation) => operation.#resolveSinglePackage()?.queries[0],\n prepareBatch: (operation) =>\n operation.#resolveRouted().prepareBatch(operation.#attribution),\n parseResult: (operation, raw) => {\n const single = operation.#resolveSinglePackage();\n if (!single) {\n throw new QueryEngineError(\n `Operation '${operation.#operation}' on model '${operation.#modelName}' publishes no single driver result to parse.`\n );\n }\n return single.parseResult([raw]);\n },\n observeBatchPhase: (operation, driver, execute) =>\n observeTransactionBatchPhase(operation.#attribution, driver, execute),\n } satisfies TransactionOperationOwner<PendingOperation<unknown>>);\n registerTransactionOperationOwner(\n PendingOperation.prototype,\n (value): value is PendingOperation<unknown> => #attribution in value,\n pendingOperationTransactionOwner\n );\n Object.freeze(PendingOperation.prototype);\n }\n\n private constructor(\n construction: typeof pendingOperationConstruction,\n engine: QueryEngine,\n model: AnyModel,\n requestedOperation: Operation | `${Operation}OrThrow`,\n args: Record<string, unknown>,\n options?: PrepareOptions,\n inputPreparation?: OperationInputPreparation,\n prepareWriteOutcomeRegistration?: PrepareWriteOutcomeRegistration\n ) {\n if (construction !== pendingOperationConstruction) {\n throw new InvalidTransactionInputError();\n }\n this.#engine = engine;\n this.#model = model;\n this.#args = args;\n this.#inputPreparation = inputPreparation;\n this.#prepareWriteOutcomeRegistration = prepareWriteOutcomeRegistration;\n // Every client lineage installs the route in `VibORM`'s constructor and\n // `bind()` forwards it (C-01); an engine built outside that lineage owns no\n // operation path at all.\n this.#route = engine.route;\n const isOrThrow = requestedOperation.endsWith(OR_THROW_SUFFIX);\n this.#operation = isOrThrow\n ? (requestedOperation.slice(0, -OR_THROW_SUFFIX.length) as Operation)\n : (requestedOperation as Operation);\n this.#modelName = model[\"~\"].names.ts ?? \"unknown\";\n this.#execution = new PendingExecution<T>(this.#modelName, this.#operation);\n this.#requested = options?.originalOperation ?? requestedOperation;\n this.#finishResult = options?.finishResult;\n this.#clientId = engine.clientId;\n this.#scopeId = engine.scopeId;\n this.#attribution = createOperationExecutionContext(\n this.#modelName,\n this.#operation,\n engine.extensionChain,\n options?.named\n );\n // The call object an extension's moments share is where the words on the\n // call (`key`, `codec`, `database`) find the operation it became.\n if (inputPreparation)\n inputPreparation.of = {\n engine,\n context: this.#attribution,\n prepared: () => this.#resolveRouted(),\n };\n Object.freeze(this);\n }\n\n /**\n * Resolve client request preparation once, caching both values and throws.\n * The arguments extensions declare leave the call's own and are admitted\n * first, so the record is settled with the call's own arguments and no\n * first moment sees a declared one among them.\n */\n #resolveArgs(): Record<string, unknown> {\n const preparation = this.#inputPreparation;\n if (preparation === undefined) return this.#args;\n if (preparation.status === \"success\" && preparation.args) {\n return preparation.args;\n }\n if (preparation.status === \"failure\") throw preparation.error;\n\n try {\n const admission = this.#engine.extensionChain?.args?.admit(\n this.#modelName,\n this.#requested,\n this.#operation,\n this.#args,\n this.#engine.bound\n );\n const args = preparation.prepare(\n admission?.args ?? this.#args,\n admission?.values,\n preparation\n );\n preparation.args = args;\n preparation.values = admission?.values;\n preparation.status = \"success\";\n return args;\n } catch (error) {\n preparation.error = error;\n preparation.status = \"failure\";\n throw error;\n }\n }\n\n /** Resolve one exact package-owned listener for every lifecycle entry point. */\n #resolveWriteOutcomeRegistration(): WriteOutcomeRegistration | undefined {\n if (this.#writeOutcomeRegistrationResolved) {\n return this.#writeOutcomeRegistration;\n }\n this.#writeOutcomeRegistration = this.#prepareWriteOutcomeRegistration?.(\n this.#attribution,\n this.#inputPreparation?.values,\n this.#inputPreparation\n );\n this.#writeOutcomeRegistrationResolved = true;\n return this.#writeOutcomeRegistration;\n }\n\n /** Construct (once) the route's view of this operation. */\n #resolveRouted(): PreparedOperation {\n if (this.#routedInstance) return this.#routedInstance;\n // The model proxy answers every property with a callable child, so a\n // misspelled or REMOVED operation name (`createManyAndReturn`,\n // `updateManyAndReturn` — see the implicit-returning surface) reaches here\n // instead of failing as \"undefined is not a function\". Name it as what it\n // is, from the one vocabulary owner, before the route is asked for a verb\n // it has no construction path for.\n if (!ROUTED_OPERATIONS.has(this.#operation)) {\n throw new QueryEngineError(\n `Unknown operation '${this.#operation}' on model '${this.#modelName}'. Known operations: ${[...ROUTED_OPERATIONS].sort().join(\", \")}.`\n );\n }\n const args = this.#resolveArgs();\n // A package-owned listener may tell the engine what to report while it\n // plans (a write hook's upsert arm): it exists before any planning.\n this.#resolveWriteOutcomeRegistration();\n const routed = this.#route.prepare(\n this.#modelName,\n // Refused above where it is no operation the engine knows.\n this.#requested as never,\n args,\n this.#callRows()\n );\n this.#routedInstance = routed;\n return routed;\n }\n\n /** The row facts this call's admitted arguments resolve to, if any. */\n #callRows() {\n const binding = this.#engine.extensionChain?.callRows;\n return binding?.call(this.#modelName, this.#inputPreparation?.values);\n }\n\n /**\n * The ONE prepared package this operation compiles to when it compiles to\n * exactly one driver query — every read. The route prepares it once and both\n * array-owner arms read it: the query `prepare()` publishes and the parser\n * `parseResult()` applies come from that single preparation, so a member's\n * statement and its decoder cannot describe different queries.\n */\n #resolveSinglePackage(): PreparedBatchOperation<unknown> | undefined {\n if (this.#singlePackageResolved) return this.#singlePackage;\n const prepared = this.#resolveRouted().prepareSingle(this.#attribution);\n this.#singlePackage = prepared?.queries.length === 1 ? prepared : undefined;\n this.#singlePackageResolved = true;\n return this.#singlePackage;\n }\n\n /**\n * The payload this operation runs: the prepared operation's ONE admission.\n * Resolving it settles request preparation and admits the operation.\n */\n #preparedInput(): Record<string, unknown> {\n return this.#resolveRouted().args;\n }\n\n /**\n * The prepared facts one query handler chain inspects. Its `input` is\n * snapshotted at the first read, once for the whole chain: the prepared\n * payload is the admission's own and nothing writes it after admission, so\n * a later snapshot says what an eager one would, and a chain that never\n * reads it never copies it.\n */\n #queryContext(\n mode: CallMode,\n preparedInput: Record<string, unknown>\n ): PreparedModelQueryContext<Record<string, unknown>> {\n const values = this.#inputPreparation?.values;\n let input: Readonly<Record<string, unknown>> | undefined;\n return Object.freeze({\n mode,\n kind: \"model\" as const,\n model: this.#modelName,\n operation: this.#requested,\n get input() {\n input ??= snapshotQueryInput(preparedInput);\n return input;\n },\n ...(values === undefined ? {} : { values }),\n call: this.#inputPreparation,\n });\n }\n\n #getPromise(): Promise<T> {\n return this.#execution.executeDefault(() => {\n const observation = this.#engine.extensionChain?.observation;\n if (observation === undefined) {\n return this.#finished(this.#runExecution());\n }\n return observation.run(this.#unit(true), () =>\n this.#finished(this.#runExecution())\n );\n });\n }\n\n /** The value its caller receives: the client's last step applied, if any. */\n #finished(value: Promise<T>): Promise<T> {\n const finish = this.#finishResult;\n return finish ? value.then((result) => finish(result) as T) : value;\n }\n\n /**\n * This operation's `operation` unit. Its certainty is the operation's own,\n * except for an array member, whose array reports it.\n */\n #unit(certain?: true): UnitSource {\n return {\n kind: \"operation\",\n operation: this.#requested,\n model: this.#modelName,\n context: this.#attribution,\n driver: this.#engine.driver,\n table: this.#model[\"~\"].names.sql ?? this.#modelName,\n ...(certain ? { certainty: () => this.#observationCommitCertainty } : {}),\n };\n }\n\n #runExecution(\n driverOverride?: AnyDriver,\n committedWriteSegment?: CommittedWriteSegmentNotification,\n writeMayBeVisible?: WriteMayBeVisibleNotification\n ): Promise<T> {\n return withOperationErrorContext(this.#attribution, () =>\n this.#runAttributedExecution(\n driverOverride,\n committedWriteSegment,\n writeMayBeVisible\n )\n );\n }\n\n #runAttributedExecution(\n driverOverride?: AnyDriver,\n committedWriteSegment?: CommittedWriteSegmentNotification,\n writeMayBeVisible?: WriteMayBeVisibleNotification\n ): Promise<T> {\n const observerCommitted = this.#observationNotification(\"committed\");\n const observerMayHaveCommitted =\n this.#observationNotification(\"may-have-committed\");\n const requestedOperation = this.#requested;\n const handlers = this.#engine.extensionChain?.around?.handlers(\n this.#modelName,\n requestedOperation\n );\n if (\n (handlers === undefined || handlers.length === 0) &&\n this.#prepareWriteOutcomeRegistration === undefined\n ) {\n return this.#runCoreExecution(\n driverOverride,\n combineWriteNotifications(committedWriteSegment, observerCommitted),\n combineWriteNotifications(writeMayBeVisible, observerMayHaveCommitted)\n );\n }\n return this.#runExtendedExecution(\n handlers,\n requestedOperation,\n observerCommitted,\n observerMayHaveCommitted,\n driverOverride,\n committedWriteSegment,\n writeMayBeVisible\n );\n }\n\n /** Query extensions and write-outcome registration, out of line. */\n #runExtendedExecution(\n handlers: AroundHandlers | undefined,\n requestedOperation: string,\n observerCommitted: (() => Promise<void>) | undefined,\n observerMayHaveCommitted: (() => Promise<void>) | undefined,\n driverOverride?: AnyDriver,\n committedWriteSegment?: CommittedWriteSegmentNotification,\n writeMayBeVisible?: WriteMayBeVisibleNotification\n ): Promise<T> {\n let preparedInput: Record<string, unknown>;\n try {\n preparedInput = this.#preparedInput();\n } catch (error) {\n return Promise.reject(error);\n }\n const writeOutcomeRegistration = this.#resolveWriteOutcomeRegistration();\n const coordination = this.#engine.extensionChain?.coordination;\n if (\n coordination === undefined ||\n ((handlers === undefined || handlers.length === 0) &&\n writeOutcomeRegistration === undefined)\n ) {\n return this.#runCoreExecution(\n driverOverride,\n combineWriteNotifications(committedWriteSegment, observerCommitted),\n combineWriteNotifications(writeMayBeVisible, observerMayHaveCommitted)\n );\n }\n const context =\n handlers === undefined || handlers.length === 0\n ? undefined\n : this.#queryContext(\n this.#engine.transaction ? \"transaction\" : \"direct\",\n preparedInput\n );\n // Handlers come with `around` and a registration with the part that\n // watches writes: each coordinates with what runs them.\n return coordination.executePreparedQuery!<T, Record<string, unknown>>(\n context,\n handlers,\n (notifications, driver) =>\n this.#runCoreExecution(\n driver ?? driverOverride,\n combineWriteNotifications(\n committedWriteSegment,\n combineWriteNotifications(\n notifications?.committed,\n observerCommitted\n )\n ),\n combineWriteNotifications(\n writeMayBeVisible,\n combineWriteNotifications(\n notifications?.mayHaveCommitted,\n observerMayHaveCommitted\n )\n )\n ),\n !isReadOperation(requestedOperation),\n this.#engine.transaction,\n undefined,\n writeOutcomeRegistration\n );\n }\n\n #observationNotification(\n certainty: \"committed\" | \"may-have-committed\"\n ): (() => Promise<void>) | undefined {\n if (\n this.#engine.transaction !== undefined ||\n this.#engine.extensionChain?.observation === undefined\n ) {\n return undefined;\n }\n return async () => {\n if (\n certainty === \"committed\" ||\n this.#observationCommitCertainty === undefined\n ) {\n this.#observationCommitCertainty = certainty;\n }\n };\n }\n\n #runCoreExecution(\n driverOverride?: AnyDriver,\n committedWriteSegment?: CommittedWriteSegmentNotification,\n writeMayBeVisible?: WriteMayBeVisibleNotification\n ): Promise<T> {\n return this.#run(driverOverride, committedWriteSegment, writeMayBeVisible);\n }\n\n /**\n * Run this operation through the route. The driver an existing transaction or\n * array owner supplied stays exactly the driver it supplied; this owner opens\n * and closes no scope of its own, and retries nothing here. The engine's four\n * bounded recoveries live inside the route (`raptor3/AGENTS.md`, \"Which\n * recovery REPLAYS and which RE-PLANS\"); one of them reads `meta.raceable`\n * off the failure to decide whether a premise may be answered by a second\n * attempt.\n */\n #run(\n driverOverride?: AnyDriver,\n committedWriteSegment?: CommittedWriteSegmentNotification,\n writeMayBeVisible?: WriteMayBeVisibleNotification\n ): Promise<T> {\n let routed: PreparedOperation;\n try {\n routed = this.#resolveRouted();\n } catch (error) {\n return Promise.reject(error);\n }\n // Below every per-call lifecycle step, outside any borrowed scope: a\n // `findUnique` may share one read with the calls of the same tick.\n // A read whose rows are kept (`codec`) is sent alone: a shared read's\n // rows are not its own. Asked before the call is described to the batch:\n // where the client shares none, nothing is made to describe it.\n if (\n this.#operation === \"findUnique\" &&\n driverOverride === undefined &&\n routed.seen === undefined &&\n sharesFindUnique(this.#engine)\n )\n return this.#runShared(routed, committedWriteSegment, writeMayBeVisible);\n return this.#runRouted(\n routed,\n driverOverride,\n committedWriteSegment,\n writeMayBeVisible\n );\n }\n\n #runRouted(\n routed: PreparedOperation,\n driverOverride?: AnyDriver,\n committedWriteSegment?: CommittedWriteSegmentNotification,\n writeMayBeVisible?: WriteMayBeVisibleNotification\n ): Promise<T> {\n return routed.run({\n committedWriteSegment,\n context: this.#attribution,\n driverOverride,\n engineDriver: this.#engine.driver,\n isWrite: !isReadOperation(this.#requested),\n writeMayBeVisible,\n }) as Promise<T>;\n }\n\n /** A `findUnique` on a client that shares reads: in a batch, or alone where it joins none. */\n #runShared(\n routed: PreparedOperation,\n committedWriteSegment?: CommittedWriteSegmentNotification,\n writeMayBeVisible?: WriteMayBeVisibleNotification\n ): Promise<T> {\n const run = () =>\n this.#runRouted(\n routed,\n undefined,\n committedWriteSegment,\n writeMayBeVisible\n );\n const batched = batchFindUnique({\n engine: this.#engine,\n model: this.#model,\n requested: this.#requested,\n args: this.#resolveArgs(),\n values: this.#inputPreparation?.values,\n rows: () => this.#callRows(),\n routed,\n context: this.#attribution,\n run,\n });\n return batched === undefined ? run() : (batched as Promise<T>);\n }\n\n getArgs(): Record<string, unknown> {\n return this.#args;\n }\n\n /**\n * The one SQL statement this operation compiles to, or `undefined` when it\n * does not compile to exactly one (backs {@link QueryEngine.build}).\n *\n * Every read compiles to one statement and publishes it, from the prepared\n * read the execution itself runs — there is no second lowering here. A write\n * answers `undefined`: the engine's only write fold is the asynchronous\n * `prepareBatch()`, which publishes driver-prepared queries rather than an\n * `Sql`, and this accessor is synchronous.\n */\n buildStatement(): Sql | undefined {\n return this.#resolveRouted().read?.statement;\n }\n\n then<TResult1 = T, TResult2 = never>(\n onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,\n onrejected?: ((reason: unknown) => TResult2 | PromiseLike<TResult2>) | null\n ): Promise<TResult1 | TResult2> {\n return this.#getPromise().then(onfulfilled, onrejected);\n }\n\n catch<TResult = never>(\n onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null\n ): Promise<T | TResult> {\n return this.#getPromise().catch(onrejected);\n }\n\n finally(onfinally?: (() => void) | null): Promise<T> {\n return this.#getPromise().finally(onfinally);\n }\n}\n\n/** Create one genuine operation without exposing its construction identity. */\nexport function createPendingOperation<T>(\n engine: QueryEngine,\n model: AnyModel,\n operation: Operation | `${Operation}OrThrow`,\n args: Record<string, unknown>,\n options?: PrepareOptions,\n prepareInput?: PrepareOperationInput,\n prepareWriteOutcomeRegistration?: PrepareWriteOutcomeRegistration\n): PendingOperation<T> {\n return createPendingOperationFriend(\n engine,\n model,\n operation,\n args,\n options,\n prepareInput,\n prepareWriteOutcomeRegistration\n );\n}\n\nexport function isPendingOperation<T = unknown>(\n value: unknown\n): value is PendingOperation<T> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n PENDING_OPERATION_SYMBOL in value &&\n (value as Record<symbol, unknown>)[PENDING_OPERATION_SYMBOL] === true\n );\n}\n\nexport type UnwrapPendingOperation<T> =\n T extends PendingOperation<infer U> ? U : T;\n\nexport type UnwrapPendingOperations<\n T extends readonly PendingOperation<unknown>[],\n> = {\n [K in keyof T]: UnwrapPendingOperation<T[K]>;\n};\n"],"mappings":"6nBAsBA,SAAgB,wBACd,EACA,EACA,EAC2B,CAC3B,GAAI,IAAc,EAAG,MAAO,EAAE,CAC9B,IAAM,EAAQ,EAAQ,EAAG,EAAU,CACnC,GACE,IAAkC,IAAA,IAClC,EAAM,OAAO,QAAU,GACvB,IAAc,EAEd,MAAO,CAAC,CAAE,MAAO,EAAG,IAAK,EAAW,UAAW,EAAO,CAAC,CAGzD,IAAM,EAAoC,EAAE,CACxC,EAAQ,EACZ,KAAO,EAAQ,GAAW,CACxB,IAAI,EAAQ,EAAQ,EAChB,EAAQ,KAAK,IAAI,EAAW,EAAQ,EAAE,CACtC,EAG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AK,EAAa,EAAW,CAGzD,MACE,EACsB,CACtB,OAAO,MAAA,GAAkB,CAAC,MAAM,EAAW,CAG7C,QAAQ,EAA6C,CACnD,OAAO,MAAA,GAAkB,CAAC,QAAQ,EAAU,GAKhD,SAAgB,uBACd,EACA,EACA,EACA,EACA,EACA,EACA,EACqB,CACrB,OAAO,6BACL,EACA,EACA,EACA,EACA,EACA,EACA,EACD,CAGH,SAAgB,mBACd,EAC8B,CAC9B,OAEE,OAAO,GAAU,YADjB,GAEA,KAA4B,GAC3B,EAAkC,KAA8B"}
|
package/dist/permissions.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $n as only, Ht as InferOutput, I as Extension, Jn as check, L as Facts$1, O as AnyTarget, U as PlacedArgument, Xn as gate, Yn as facts, ci as Operations, mt as VibORMConfig, vi as ClientSchema } from "./database-adapter-D62c-uC6.mjs";
|
|
2
2
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
|
|
4
4
|
//#region src/permissions/actor.d.ts
|