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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as sqlTag, n as Sql } from "./sql-
|
|
1
|
+
import { c as sqlTag, n as Sql } from "./sql-CXtSIPzy.mjs";
|
|
2
2
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
|
|
4
4
|
//#region src/schema/scalars/native-types.d.ts
|
|
@@ -362,413 +362,6 @@ declare const SQLITE: {
|
|
|
362
362
|
};
|
|
363
363
|
};
|
|
364
364
|
//#endregion
|
|
365
|
-
//#region src/validation/primitives/decimal-value.d.ts
|
|
366
|
-
/**
|
|
367
|
-
* The two PRIMITIVE forms of an exact decimal a caller may hand the value type:
|
|
368
|
-
* a spelling, or a whole coefficient. Both name an exact decimal; a JavaScript
|
|
369
|
-
* number names a double, so it is not one of them.
|
|
370
|
-
*/
|
|
371
|
-
type DecimalPrimitive = string | bigint;
|
|
372
|
-
/**
|
|
373
|
-
* How a quotient resolves a value exactly between two representable ones.
|
|
374
|
-
*
|
|
375
|
-
* Two modes, each with a caller: `"half-up"` is what an application reading a
|
|
376
|
-
* money column expects and what every VibORM release so far has produced;
|
|
377
|
-
* `"half-even"` is what the SQL engines do, so a caller reconciling against a
|
|
378
|
-
* server-side division can ask for the server's answer. There is no third mode
|
|
379
|
-
* because there is no third caller.
|
|
380
|
-
*/
|
|
381
|
-
type DecimalRounding = "half-up" | "half-even";
|
|
382
|
-
/**
|
|
383
|
-
* The exact decimal VALUE.
|
|
384
|
-
*
|
|
385
|
-
* Immutable: every operation returns a new instance and none of them mutates
|
|
386
|
-
* the receiver. Every binary operation accepts the same
|
|
387
|
-
* `Decimal | DecimalPrimitive` the constructor does, so there is one admission
|
|
388
|
-
* grammar for the whole type.
|
|
389
|
-
*
|
|
390
|
-
* This is an INTERFACE, and {@link Decimal} below is the const that holds the
|
|
391
|
-
* class implementing it. They carry the same name on purpose — a caller writes
|
|
392
|
-
* `Decimal` for both — and the const's declared type is what keeps them in
|
|
393
|
-
* step: a method added to one side and not the other stops compiling.
|
|
394
|
-
*
|
|
395
|
-
* @example
|
|
396
|
-
* new Decimal("19.99").times("3").toString(); // "59.97"
|
|
397
|
-
* new Decimal("1").div("3", 5).toString(); // "0.33333"
|
|
398
|
-
*/
|
|
399
|
-
interface Decimal {
|
|
400
|
-
/** Immutable canonical text retained by deep equality and structured cloning. */
|
|
401
|
-
readonly value: string;
|
|
402
|
-
/** This value plus `other`, exactly. */
|
|
403
|
-
plus(other: Decimal | DecimalPrimitive): Decimal;
|
|
404
|
-
/** This value minus `other`, exactly. */
|
|
405
|
-
minus(other: Decimal | DecimalPrimitive): Decimal;
|
|
406
|
-
/** This value times `other`, exactly: coefficients multiply, scales add. */
|
|
407
|
-
times(other: Decimal | DecimalPrimitive): Decimal;
|
|
408
|
-
/**
|
|
409
|
-
* This value divided by `other`, to `fractionDigits` fraction digits.
|
|
410
|
-
*
|
|
411
|
-
* A quotient is the one operation with no exact answer, so it is the one that
|
|
412
|
-
* asks: how many digits, and what happens to a tie.
|
|
413
|
-
*
|
|
414
|
-
* @throws {RangeError} when `other` is zero.
|
|
415
|
-
*/
|
|
416
|
-
div(other: Decimal | DecimalPrimitive, fractionDigits?: number, rounding?: DecimalRounding): Decimal;
|
|
417
|
-
/** `-1`, `0` or `1` as this value is below, equal to, or above `other`. */
|
|
418
|
-
cmp(other: Decimal | DecimalPrimitive): -1 | 0 | 1;
|
|
419
|
-
/** Whether this value and `other` are the same number. */
|
|
420
|
-
eq(other: Decimal | DecimalPrimitive): boolean;
|
|
421
|
-
/** Whether this value is below `other`. */
|
|
422
|
-
lt(other: Decimal | DecimalPrimitive): boolean;
|
|
423
|
-
/** Whether this value is below `other` or the same number. */
|
|
424
|
-
lte(other: Decimal | DecimalPrimitive): boolean;
|
|
425
|
-
/** Whether this value is above `other`. */
|
|
426
|
-
gt(other: Decimal | DecimalPrimitive): boolean;
|
|
427
|
-
/** Whether this value is above `other` or the same number. */
|
|
428
|
-
gte(other: Decimal | DecimalPrimitive): boolean;
|
|
429
|
-
/** This value without its sign. */
|
|
430
|
-
abs(): Decimal;
|
|
431
|
-
/** This value with its sign flipped. Zero has no sign to flip. */
|
|
432
|
-
neg(): Decimal;
|
|
433
|
-
/**
|
|
434
|
-
* The canonical text of this value: no exponent, ever, and no insignificant
|
|
435
|
-
* zero, so two instances naming the same number spell it the same way.
|
|
436
|
-
*/
|
|
437
|
-
toString(): string;
|
|
438
|
-
/**
|
|
439
|
-
* This value with exactly `fractionDigits` fraction digits, rounding half
|
|
440
|
-
* away from zero. With no argument it is {@link Decimal.toString}: the whole
|
|
441
|
-
* value, in normal notation, rounded nowhere.
|
|
442
|
-
*/
|
|
443
|
-
toFixed(fractionDigits?: number): string;
|
|
444
|
-
/**
|
|
445
|
-
* This value as a JavaScript number, which is a double: the conversion is
|
|
446
|
-
* exact only for values a double can hold, and is the caller's decision.
|
|
447
|
-
*/
|
|
448
|
-
toNumber(): number;
|
|
449
|
-
/** The canonical text, so `` `${value}` `` and `+value` read the number. */
|
|
450
|
-
valueOf(): string;
|
|
451
|
-
/** The canonical text, so `JSON.stringify` writes the number, not `{}`. */
|
|
452
|
-
toJSON(): string;
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* The public constructor, carrying the one grammar a caller may spell.
|
|
456
|
-
*
|
|
457
|
-
* The same object as the class, so `instanceof` and `Object.create(
|
|
458
|
-
* Decimal.prototype)` behave exactly as they would for a plain class
|
|
459
|
-
* declaration — only the internal two-argument construction is hidden, and the
|
|
460
|
-
* instance TYPE stays free of private fields so a mapped result type keeps it.
|
|
461
|
-
*/
|
|
462
|
-
declare const Decimal: {
|
|
463
|
-
/**
|
|
464
|
-
* @param value a `Decimal` to copy, an exact decimal string, or a whole
|
|
465
|
-
* `bigint`.
|
|
466
|
-
* @throws {TypeError} for every other value, including every JavaScript
|
|
467
|
-
* number, a string outside the accepted grammar, and a value of any other
|
|
468
|
-
* type.
|
|
469
|
-
*/
|
|
470
|
-
new (value: Decimal | DecimalPrimitive): Decimal;
|
|
471
|
-
readonly prototype: Decimal;
|
|
472
|
-
};
|
|
473
|
-
//#endregion
|
|
474
|
-
//#region src/validation/primitives/decimal-codec.d.ts
|
|
475
|
-
/**
|
|
476
|
-
* The fixed-decimal domain: multiples of `10^-scale` whose unscaled coefficient
|
|
477
|
-
* has at most `precision` digits. Frozen once by `s.decimal` and carried by
|
|
478
|
-
* reference through every modifier.
|
|
479
|
-
*/
|
|
480
|
-
interface DecimalDescriptor {
|
|
481
|
-
readonly precision: number;
|
|
482
|
-
readonly scale: number;
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* The two exact physical vocabularies a decimal field can cross through.
|
|
486
|
-
*
|
|
487
|
-
* The active adapter selects one; this codec alone interprets it. The value
|
|
488
|
-
* cannot select its own vocabulary because `"120"` is logical 120 as native
|
|
489
|
-
* decimal text and logical 1.2 as a scale-2 coefficient.
|
|
490
|
-
*/
|
|
491
|
-
type DecimalPhysicalRepresentation = "text" | "coefficient";
|
|
492
|
-
//#endregion
|
|
493
|
-
//#region src/validation/primitives/geo-values.d.ts
|
|
494
|
-
/** The sole public value represented by an `s.point()` field. */
|
|
495
|
-
interface GeoPoint {
|
|
496
|
-
longitude: number;
|
|
497
|
-
latitude: number;
|
|
498
|
-
}
|
|
499
|
-
/** One inclusive latitude/longitude rectangle. */
|
|
500
|
-
interface GeoBounds {
|
|
501
|
-
south: number;
|
|
502
|
-
west: number;
|
|
503
|
-
north: number;
|
|
504
|
-
east: number;
|
|
505
|
-
}
|
|
506
|
-
/** One simple geographic polygon with optional holes. */
|
|
507
|
-
interface GeoPolygon {
|
|
508
|
-
outer: readonly GeoPoint[];
|
|
509
|
-
holes?: readonly (readonly GeoPoint[])[];
|
|
510
|
-
}
|
|
511
|
-
/** The two query-only geographic area forms. */
|
|
512
|
-
type GeoArea = {
|
|
513
|
-
readonly bounds: GeoBounds;
|
|
514
|
-
} | {
|
|
515
|
-
readonly polygon: GeoPolygon;
|
|
516
|
-
};
|
|
517
|
-
//#endregion
|
|
518
|
-
//#region src/validation/primitives/id-codec.d.ts
|
|
519
|
-
/**
|
|
520
|
-
* The ONE codec of a declared identifier DOMAIN.
|
|
521
|
-
*
|
|
522
|
-
* A domain is `{ format, prefix?, length? }` — exactly the facts a generator
|
|
523
|
-
* modifier already recorded on the scalar, never a second declaration. This
|
|
524
|
-
* module answers the three questions every boundary asks about a value in one:
|
|
525
|
-
*
|
|
526
|
-
* 1. Is this string IN the domain, and what is its canonical spelling?
|
|
527
|
-
* (`canonicalizeId`: the uppercase UUID and the lowercase ULID are aliases,
|
|
528
|
-
* and an identity-sensitive consumer — a cache key, a captured row key, an
|
|
529
|
-
* `fkEquals` — must see one spelling for one identifier.)
|
|
530
|
-
* 2. What does the column physically hold for it? (`encodePhysicalId`)
|
|
531
|
-
* 3. Which public value did a physical one come back as? (`decodePhysicalId`)
|
|
532
|
-
*
|
|
533
|
-
* It is PURE and dialect-blind on purpose. It takes an
|
|
534
|
-
* {@link IdRepresentation}, never a provider: choosing the representation is a
|
|
535
|
-
* storage question, owned one layer up in
|
|
536
|
-
* {@link file://../../schema/scalars/string/id-domain.ts}, and a codec that
|
|
537
|
-
* knew about `bytea` could not be read by the validation schemas that run
|
|
538
|
-
* before any adapter exists.
|
|
539
|
-
*
|
|
540
|
-
* Two things it deliberately does NOT do. It never splits a value on `-`: a
|
|
541
|
-
* prefix is matched WHOLE, because `usr-01H…` and a UUID both contain hyphens
|
|
542
|
-
* and a generic split would silently reinterpret one as the other. And it
|
|
543
|
-
* never widens a format: a text that is not a spelling of the declared format
|
|
544
|
-
* is `undefined` here, so the boundary that asked owns the message.
|
|
545
|
-
*/
|
|
546
|
-
/** The six string generators that name an identifier domain. */
|
|
547
|
-
type IdFormat = "uuid" | "uuidv7" | "ulid" | "ksuid" | "nanoid" | "cuid";
|
|
548
|
-
/**
|
|
549
|
-
* A declared or derived identifier domain.
|
|
550
|
-
*
|
|
551
|
-
* `prefix` is absent rather than empty when none was declared — `""` is how a
|
|
552
|
-
* caller spells "no prefix", and carrying it would make a bare `-` part of
|
|
553
|
-
* every value. `length` belongs to `nanoid` alone; every other format's width
|
|
554
|
-
* is the format's own.
|
|
555
|
-
*/
|
|
556
|
-
interface IdDomain {
|
|
557
|
-
readonly format: IdFormat;
|
|
558
|
-
readonly prefix?: string | undefined;
|
|
559
|
-
readonly length?: number | undefined;
|
|
560
|
-
}
|
|
561
|
-
/**
|
|
562
|
-
* What a column physically holds for one identifier.
|
|
563
|
-
*
|
|
564
|
-
* - `"text"` — the whole PUBLIC string, prefix included. Every `nanoid` and
|
|
565
|
-
* `cuid` field, and any domain field whose native type override keeps a text
|
|
566
|
-
* column.
|
|
567
|
-
* - `"uuid"` — the payload as canonical UUID text, which is what a PostgreSQL
|
|
568
|
-
* `uuid` column takes and returns on the wire.
|
|
569
|
-
* - `"bytes"` — the payload's own bytes: 16 for a UUID or ULID, 20 for a KSUID.
|
|
570
|
-
*
|
|
571
|
-
* A declared PREFIX is never stored. It is a fact of the declaration, identical
|
|
572
|
-
* in every row, and re-applied on read — which is also why `"uuid"` and
|
|
573
|
-
* `"bytes"` are not identity paths for a prefixed field.
|
|
574
|
-
*/
|
|
575
|
-
type IdRepresentation = "text" | "uuid" | "bytes";
|
|
576
|
-
//#endregion
|
|
577
|
-
//#region src/adapters/adapter-capabilities.d.ts
|
|
578
|
-
/** Database feature flags consulted by query construction. */
|
|
579
|
-
interface DatabaseAdapterCapabilities {
|
|
580
|
-
/** Whether database supports RETURNING clause (PG, SQLite 3.35+). */
|
|
581
|
-
supportsReturning: boolean;
|
|
582
|
-
/** Whether database supports CTEs with data-modifying statements. */
|
|
583
|
-
supportsCteWithMutations: boolean;
|
|
584
|
-
/** Whether database supports FULL OUTER JOIN. */
|
|
585
|
-
supportsFullOuterJoin: boolean;
|
|
586
|
-
/** Whether database supports LATERAL joins. */
|
|
587
|
-
supportsLateralJoins: boolean;
|
|
588
|
-
/** Whether this driver instance supports vector operations. */
|
|
589
|
-
supportsVector: boolean;
|
|
590
|
-
/** Whether database supports target/set WHERE clauses in upsert. */
|
|
591
|
-
supportsUpsertWhere: boolean;
|
|
592
|
-
/**
|
|
593
|
-
* Whether the dialect's upsert grammar ARBITRATES ON THE NAMED TARGET.
|
|
594
|
-
*
|
|
595
|
-
* PostgreSQL and SQLite spell `INSERT … ON CONFLICT (cols) DO UPDATE`: only a
|
|
596
|
-
* collision on `cols` takes the update branch, and a collision on any OTHER
|
|
597
|
-
* unique index is raised as the constraint error it is. MySQL spells
|
|
598
|
-
* `ON DUPLICATE KEY UPDATE`, which carries no target at all and fires on ANY
|
|
599
|
-
* unique collision (`mysql-adapter.ts` `onConflict` ignores its `_target`
|
|
600
|
-
* parameter and says so) — so an unrelated collision would silently ADOPT and
|
|
601
|
-
* update a row the caller never named.
|
|
602
|
-
*
|
|
603
|
-
* That difference is a wrong answer, not a missing optimization, which is why
|
|
604
|
-
* it is a capability and not an inference. It reads `false` on exactly the same
|
|
605
|
-
* adapters as {@link DatabaseAdapterCapabilities.supportsReturning} today, and
|
|
606
|
-
* that is a COINCIDENCE of the three adapters shipped, not an implication:
|
|
607
|
-
* MariaDB has `RETURNING` on `INSERT` and still arbitrates on any key. Do not
|
|
608
|
-
* collapse the two.
|
|
609
|
-
*/
|
|
610
|
-
supportsTargetedUpsert: boolean;
|
|
611
|
-
/** Whether a mutation may reference its target table in a subquery. */
|
|
612
|
-
supportsMutationTargetInSubquery: boolean;
|
|
613
|
-
/**
|
|
614
|
-
* Whether a single-table `UPDATE`/`DELETE` accepts a native row cap
|
|
615
|
-
* (`... LIMIT n`). MySQL does; PostgreSQL and SQLite (in the default builds
|
|
616
|
-
* this project targets — `SQLITE_ENABLE_UPDATE_DELETE_LIMIT` is off) do not,
|
|
617
|
-
* so `updateMany`/`deleteMany` `limit` is realized there by restricting the
|
|
618
|
-
* mutation's `WHERE` to a primary-key subquery that carries the `LIMIT`.
|
|
619
|
-
* See `buildBulkLimitWhere` in query-engine/operations/bulk-limit.ts.
|
|
620
|
-
*/
|
|
621
|
-
supportsMutationRowLimit: boolean;
|
|
622
|
-
/**
|
|
623
|
-
* Whether a read can lock the rows it takes (`SELECT … FOR UPDATE`).
|
|
624
|
-
* PostgreSQL and MySQL do; SQLite locks the whole database and omits the
|
|
625
|
-
* clause, so a read taken only to lock rows is skipped there.
|
|
626
|
-
*/
|
|
627
|
-
supportsRowLocks: boolean;
|
|
628
|
-
/**
|
|
629
|
-
* Whether a locking read whose exact match finds NOTHING still takes a lock.
|
|
630
|
-
* MySQL (InnoDB) does: a gap or next-key lock that two concurrent misses
|
|
631
|
-
* both hold and that each one's INSERT then waits on, a deadlock. So a read
|
|
632
|
-
* whose other arm inserts the key it looked for reads unlocked there and is
|
|
633
|
-
* confirmed under lock once it finds a row. PostgreSQL locks only the rows a
|
|
634
|
-
* read returns, so there that read locks what it finds and needs no
|
|
635
|
-
* confirmation. SQLite takes no row lock at all (`supportsRowLocks`), so
|
|
636
|
-
* its confirmation stays: it is the read that sees what changed. Absent:
|
|
637
|
-
* false.
|
|
638
|
-
*/
|
|
639
|
-
locksMissingKeys?: boolean;
|
|
640
|
-
/**
|
|
641
|
-
* Whether a statement states each relation filter body it repeats ONCE, in
|
|
642
|
-
* a `WITH`, as the key set every arm repeating it tests (a semijoin on the
|
|
643
|
-
* correlated columns), rather than once per arm. A driver declares it for
|
|
644
|
-
* a provider that bounds one statement's text or the relations one
|
|
645
|
-
* statement references; a statement that repeats no body is unchanged, and
|
|
646
|
-
* a recursive walk stays where it is. Absent: false.
|
|
647
|
-
*/
|
|
648
|
-
sharesRelationBodies?: boolean;
|
|
649
|
-
/**
|
|
650
|
-
* Whether a many-to-many relation filter reads its junction joined to the
|
|
651
|
-
* target, correlated in the filter's own `WHERE` (`EXISTS (SELECT 1 FROM
|
|
652
|
-
* junction j JOIN target t ON t.key = j.target WHERE j.source = parent.key
|
|
653
|
-
* AND …)`), rather than as the target's membership in a correlated junction
|
|
654
|
-
* subquery. `true` where the dialect plans the joined form at least as well
|
|
655
|
-
* everywhere measured (SQLite); `"unbounded"` where it does only in a
|
|
656
|
-
* statement whose root read is unbounded, a count, an aggregate, a
|
|
657
|
-
* `findMany` without `take` or a write: PostgreSQL turns the join into a
|
|
658
|
-
* hashed semijoin there (10–300× faster scans) but plans it about 0.2 ms
|
|
659
|
-
* more slowly, which a bounded read (a unique, first or existence read, a
|
|
660
|
-
* `take`) pays without the scan to win it back. Absent: false.
|
|
661
|
-
*/
|
|
662
|
-
joinsJunctionFilters?: boolean | "unbounded";
|
|
663
|
-
/**
|
|
664
|
-
* Whether a recursive CTE fails once it runs a fixed number of iterations
|
|
665
|
-
* (MySQL's `cte_max_recursion_depth`, 1000 by default): a recursive filter
|
|
666
|
-
* then keeps its walk in place, whose anchor holds the first hop, rather
|
|
667
|
-
* than a reaching set, which spends one iteration per depth from its
|
|
668
|
-
* anchor. Absent: false.
|
|
669
|
-
*/
|
|
670
|
-
boundsRecursionIterations?: boolean;
|
|
671
|
-
/**
|
|
672
|
-
* Whether a recursive projection whose caller states `recurse.fewRows`
|
|
673
|
-
* reads each node it reached by key, in a scalar subquery, rather than
|
|
674
|
-
* joining the table to the walk: PostgreSQL, guessing ten rows a level,
|
|
675
|
-
* plans that join as a hash of the whole table, once per outer row (1,040
|
|
676
|
-
* rows of a 5,000-row tree with their ancestors: 128 → 13 ms). SQLite and
|
|
677
|
-
* MySQL join by index, and the subquery costs them 3–17 %. Absent: false.
|
|
678
|
-
*/
|
|
679
|
-
readsNodesByKey?: boolean;
|
|
680
|
-
/**
|
|
681
|
-
* The most terms one compound `SELECT` may chain, where the transport
|
|
682
|
-
* bounds it below anything the engine writes: Cloudflare D1, 5. The engine
|
|
683
|
-
* nests a longer union in derived tables of at most that many. Absent:
|
|
684
|
-
* unbounded.
|
|
685
|
-
*/
|
|
686
|
-
compoundSelectTerms?: number;
|
|
687
|
-
/**
|
|
688
|
-
* Whether the transport bounds expression depth below what nested relation
|
|
689
|
-
* filters reach unless each level reads from a derived table SQLite
|
|
690
|
-
* flattens (D1, depth 100; `SQLiteAdapter({ deepExpressions: false })`):
|
|
691
|
-
* a relation filter's own `EXISTS` then joins no flag member. Absent: false.
|
|
692
|
-
*/
|
|
693
|
-
boundsExpressionDepth?: boolean;
|
|
694
|
-
/**
|
|
695
|
-
* Where relation bodies are shared, the relations (`FROM` items) a
|
|
696
|
-
* statement may reference before the engine trades plans for fewer:
|
|
697
|
-
* PlanetScale Neki refuses a statement over 256. Over it, a recursive
|
|
698
|
-
* filter's walk the statement repeats becomes one reaching set, then rows
|
|
699
|
-
* join the key sets they test, each as far as the statement needs. Absent:
|
|
700
|
-
* unbounded, so neither.
|
|
701
|
-
*/
|
|
702
|
-
relationsPerStatement?: number;
|
|
703
|
-
/**
|
|
704
|
-
* Whether the transport's affected-row count of an `UPDATE` or `DELETE`
|
|
705
|
-
* also counts the rows a foreign key's cascade changed: Cloudflare D1's
|
|
706
|
-
* `meta.changes` reports 3 for one post deleted with its two junction rows,
|
|
707
|
-
* where SQLite's own count is 1. The engine then counts the rows such a
|
|
708
|
-
* statement writes by returning one marker per row, where the count is an
|
|
709
|
-
* answer (`updateMany` / `deleteMany`) or a check (a captured mutation).
|
|
710
|
-
* Absent: false.
|
|
711
|
-
*/
|
|
712
|
-
countsCascadedChanges?: boolean;
|
|
713
|
-
}
|
|
714
|
-
//#endregion
|
|
715
|
-
//#region src/adapters/adapter-core-types.d.ts
|
|
716
|
-
/**
|
|
717
|
-
* What an arithmetic assignment's TARGET COLUMN is, as a semantic fact the
|
|
718
|
-
* query engine knows and the adapter spells.
|
|
719
|
-
*
|
|
720
|
-
* The engine decides THAT a quantized decimal multiply happens; the adapter
|
|
721
|
-
* decides HOW it is written, which is why the descriptor travels here rather
|
|
722
|
-
* than a `CASE` expression being composed upstream. At most one member is ever
|
|
723
|
-
* populated — an integer column is not a decimal one — and an absent target is
|
|
724
|
-
* the ordinary numeric column every dialect multiplies natively.
|
|
725
|
-
*/
|
|
726
|
-
interface ArithmeticTarget {
|
|
727
|
-
/** An `int`/`bigInt` column: division truncates toward zero. */
|
|
728
|
-
readonly integer?: boolean;
|
|
729
|
-
/** The exact decimal domain the result must land back inside. */
|
|
730
|
-
readonly decimal?: DecimalDescriptor;
|
|
731
|
-
}
|
|
732
|
-
/**
|
|
733
|
-
* Logical cast types that adapters map to dialect-specific SQL types.
|
|
734
|
-
*
|
|
735
|
-
* Instead of hardcoding SQL type names like "TEXT" or "VARCHAR",
|
|
736
|
-
* use these logical types and let each adapter map to the correct syntax.
|
|
737
|
-
*
|
|
738
|
-
* `numeric` is the approximate/whatever-the-dialect-calls-a-number cast used
|
|
739
|
-
* for `number`; fixed decimals do not enter this type map. They need the field's
|
|
740
|
-
* exact descriptor, which a flat cast-name union cannot carry, and therefore use
|
|
741
|
-
* `DatabaseAdapter.expressions.decimalCast` instead. Spelling a fixed decimal
|
|
742
|
-
* as `numeric` is silent corruption on SQLite, whose NUMERIC affinity may put a
|
|
743
|
-
* fractional spelling through a double.
|
|
744
|
-
*
|
|
745
|
-
* This split also removes the old undeclared fallback domains: unconstrained
|
|
746
|
-
* PostgreSQL `NUMERIC` and MySQL `DECIMAL(65,30)`. A concrete decimal binds
|
|
747
|
-
* through `literals.decimal(canonical, descriptor)`; a deferred relation key
|
|
748
|
-
* casts through `decimalCast(expression, descriptor)`. Both consume the one
|
|
749
|
-
* descriptor from `s.decimal({ precision, scale })`.
|
|
750
|
-
*/
|
|
751
|
-
type CastType = "text" | "integer" | "bigint" | "boolean" | "numeric";
|
|
752
|
-
//#endregion
|
|
753
|
-
//#region src/drivers/async-dispose.d.ts
|
|
754
|
-
/**
|
|
755
|
-
* `Symbol.asyncDispose`'s type where the ambient declarations define it, and
|
|
756
|
-
* `never` where they do not.
|
|
757
|
-
*
|
|
758
|
-
* `never` is the load-bearing half: it turns {@link AsyncDisposeMember} into the
|
|
759
|
-
* empty object, so the member simply is not there for a consumer whose `lib`
|
|
760
|
-
* and `@types` never declared the symbol in the first place.
|
|
761
|
-
*/
|
|
762
|
-
type AsyncDisposeKey = SymbolConstructor extends {
|
|
763
|
-
readonly asyncDispose: infer Key extends symbol;
|
|
764
|
-
} ? Key : never;
|
|
765
|
-
/**
|
|
766
|
-
* `{ [Symbol.asyncDispose](): Promise<void> }` where the symbol is typed, and
|
|
767
|
-
* `{}` where it is not — the graceful-degradation carrier for every viborm type
|
|
768
|
-
* that participates in `await using`.
|
|
769
|
-
*/
|
|
770
|
-
type AsyncDisposeMember = { [Key in AsyncDisposeKey]: () => Promise<void> };
|
|
771
|
-
//#endregion
|
|
772
365
|
//#region src/errors/diagnostics.d.ts
|
|
773
366
|
interface DiagnosticDisclosure {
|
|
774
367
|
includeSql?: boolean | undefined;
|
|
@@ -1358,61 +951,30 @@ declare class TransactionError extends TransactionError_base {}
|
|
|
1358
951
|
declare class InvalidTransactionInputError extends VibORMError {
|
|
1359
952
|
static readonly diagnosticName = "InvalidTransactionInputError";
|
|
1360
953
|
/** Literal discriminant: this class always carries `INVALID_TRANSACTION_INPUT`. */
|
|
1361
|
-
readonly code: typeof VibORMErrorCode.INVALID_TRANSACTION_INPUT;
|
|
1362
|
-
constructor(options?: {
|
|
1363
|
-
meta?: VibORMErrorMeta;
|
|
1364
|
-
});
|
|
1365
|
-
}
|
|
1366
|
-
//#endregion
|
|
1367
|
-
//#region src/
|
|
1368
|
-
/**
|
|
1369
|
-
* Validation issue details
|
|
1370
|
-
*/
|
|
1371
|
-
interface ValidationIssue$1 {
|
|
1372
|
-
path: string;
|
|
1373
|
-
message: string;
|
|
1374
|
-
}
|
|
1375
|
-
/** The boundary that rejected a value. */
|
|
1376
|
-
type ValidationErrorSource = {
|
|
1377
|
-
readonly kind: "operation";
|
|
1378
|
-
readonly operation: Operation;
|
|
1379
|
-
readonly model?: string | undefined;
|
|
1380
|
-
} | {
|
|
1381
|
-
readonly kind: "registry";
|
|
1382
|
-
readonly model?: string | undefined;
|
|
1383
|
-
readonly property?: string | undefined;
|
|
1384
|
-
} | {
|
|
1385
|
-
readonly kind: "schema-builder";
|
|
1386
|
-
readonly builder: string;
|
|
1387
|
-
readonly path: string;
|
|
1388
|
-
} | {
|
|
1389
|
-
readonly kind: "json-schema";
|
|
1390
|
-
readonly target?: string | undefined;
|
|
1391
|
-
readonly schemaType?: string | undefined;
|
|
1392
|
-
};
|
|
954
|
+
readonly code: typeof VibORMErrorCode.INVALID_TRANSACTION_INPUT;
|
|
955
|
+
constructor(options?: {
|
|
956
|
+
meta?: VibORMErrorMeta;
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
//#endregion
|
|
960
|
+
//#region src/drivers/async-dispose.d.ts
|
|
1393
961
|
/**
|
|
1394
|
-
*
|
|
962
|
+
* `Symbol.asyncDispose`'s type where the ambient declarations define it, and
|
|
963
|
+
* `never` where they do not.
|
|
964
|
+
*
|
|
965
|
+
* `never` is the load-bearing half: it turns {@link AsyncDisposeMember} into the
|
|
966
|
+
* empty object, so the member simply is not there for a consumer whose `lib`
|
|
967
|
+
* and `@types` never declared the symbol in the first place.
|
|
1395
968
|
*/
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
readonly code: typeof VibORMErrorCode.VALIDATION_FAILED | typeof VibORMErrorCode.INVALID_INPUT;
|
|
1400
|
-
/** Validation issues */
|
|
1401
|
-
readonly issues: ValidationIssue$1[];
|
|
1402
|
-
/** Boundary that rejected the value. */
|
|
1403
|
-
readonly source: ValidationErrorSource;
|
|
1404
|
-
/**
|
|
1405
|
-
* Operation that failed validation, in its CLIENT spelling — a bulk write
|
|
1406
|
-
* validated through its internal row-returning arm still reports the family
|
|
1407
|
-
* name the caller used (see {@link publicOperationName}).
|
|
1408
|
-
*/
|
|
1409
|
-
readonly operation?: Operation | undefined;
|
|
1410
|
-
constructor(sourceOrOperation: Operation | ValidationErrorSource, issues: ValidationIssue$1[], options?: VibORMErrorOptions);
|
|
1411
|
-
}
|
|
969
|
+
type AsyncDisposeKey = SymbolConstructor extends {
|
|
970
|
+
readonly asyncDispose: infer Key extends symbol;
|
|
971
|
+
} ? Key : never;
|
|
1412
972
|
/**
|
|
1413
|
-
*
|
|
973
|
+
* `{ [Symbol.asyncDispose](): Promise<void> }` where the symbol is typed, and
|
|
974
|
+
* `{}` where it is not — the graceful-degradation carrier for every viborm type
|
|
975
|
+
* that participates in `await using`.
|
|
1414
976
|
*/
|
|
1415
|
-
|
|
977
|
+
type AsyncDisposeMember = { [Key in AsyncDisposeKey]: () => Promise<void> };
|
|
1416
978
|
//#endregion
|
|
1417
979
|
//#region src/drivers/types.d.ts
|
|
1418
980
|
/**
|
|
@@ -1429,6 +991,12 @@ interface QueryExecutionContext {
|
|
|
1429
991
|
readonly model?: string;
|
|
1430
992
|
readonly operation?: string;
|
|
1431
993
|
readonly correlationId?: string;
|
|
994
|
+
/**
|
|
995
|
+
* The call's `named` option, carried to each of its statements: `true`
|
|
996
|
+
* asks a driver with named statements to name them at once, `false` never
|
|
997
|
+
* to name them. Absent when the call did not pass it.
|
|
998
|
+
*/
|
|
999
|
+
readonly named?: boolean;
|
|
1432
1000
|
}
|
|
1433
1001
|
/**
|
|
1434
1002
|
* Normalized successful result from every driver execution.
|
|
@@ -2027,6 +1595,134 @@ interface DateSchema<TInput = Date, TOutput = Date> extends VibSchema<TInput, TO
|
|
|
2027
1595
|
*/
|
|
2028
1596
|
declare function date<const Opts extends ScalarOptions<Date, any> | undefined = undefined>(options?: Opts): DateSchema<ComputeInput<Date, Opts>, ComputeOutput<Date, Opts>>;
|
|
2029
1597
|
//#endregion
|
|
1598
|
+
//#region src/validation/primitives/decimal-value.d.ts
|
|
1599
|
+
/**
|
|
1600
|
+
* The two PRIMITIVE forms of an exact decimal a caller may hand the value type:
|
|
1601
|
+
* a spelling, or a whole coefficient. Both name an exact decimal; a JavaScript
|
|
1602
|
+
* number names a double, so it is not one of them.
|
|
1603
|
+
*/
|
|
1604
|
+
type DecimalPrimitive = string | bigint;
|
|
1605
|
+
/**
|
|
1606
|
+
* How a quotient resolves a value exactly between two representable ones.
|
|
1607
|
+
*
|
|
1608
|
+
* Two modes, each with a caller: `"half-up"` is what an application reading a
|
|
1609
|
+
* money column expects and what every VibORM release so far has produced;
|
|
1610
|
+
* `"half-even"` is what the SQL engines do, so a caller reconciling against a
|
|
1611
|
+
* server-side division can ask for the server's answer. There is no third mode
|
|
1612
|
+
* because there is no third caller.
|
|
1613
|
+
*/
|
|
1614
|
+
type DecimalRounding = "half-up" | "half-even";
|
|
1615
|
+
/**
|
|
1616
|
+
* The exact decimal VALUE.
|
|
1617
|
+
*
|
|
1618
|
+
* Immutable: every operation returns a new instance and none of them mutates
|
|
1619
|
+
* the receiver. Every binary operation accepts the same
|
|
1620
|
+
* `Decimal | DecimalPrimitive` the constructor does, so there is one admission
|
|
1621
|
+
* grammar for the whole type.
|
|
1622
|
+
*
|
|
1623
|
+
* This is an INTERFACE, and {@link Decimal} below is the const that holds the
|
|
1624
|
+
* class implementing it. They carry the same name on purpose — a caller writes
|
|
1625
|
+
* `Decimal` for both — and the const's declared type is what keeps them in
|
|
1626
|
+
* step: a method added to one side and not the other stops compiling.
|
|
1627
|
+
*
|
|
1628
|
+
* @example
|
|
1629
|
+
* new Decimal("19.99").times("3").toString(); // "59.97"
|
|
1630
|
+
* new Decimal("1").div("3", 5).toString(); // "0.33333"
|
|
1631
|
+
*/
|
|
1632
|
+
interface Decimal {
|
|
1633
|
+
/** Immutable canonical text retained by deep equality and structured cloning. */
|
|
1634
|
+
readonly value: string;
|
|
1635
|
+
/** This value plus `other`, exactly. */
|
|
1636
|
+
plus(other: Decimal | DecimalPrimitive): Decimal;
|
|
1637
|
+
/** This value minus `other`, exactly. */
|
|
1638
|
+
minus(other: Decimal | DecimalPrimitive): Decimal;
|
|
1639
|
+
/** This value times `other`, exactly: coefficients multiply, scales add. */
|
|
1640
|
+
times(other: Decimal | DecimalPrimitive): Decimal;
|
|
1641
|
+
/**
|
|
1642
|
+
* This value divided by `other`, to `fractionDigits` fraction digits.
|
|
1643
|
+
*
|
|
1644
|
+
* A quotient is the one operation with no exact answer, so it is the one that
|
|
1645
|
+
* asks: how many digits, and what happens to a tie.
|
|
1646
|
+
*
|
|
1647
|
+
* @throws {RangeError} when `other` is zero.
|
|
1648
|
+
*/
|
|
1649
|
+
div(other: Decimal | DecimalPrimitive, fractionDigits?: number, rounding?: DecimalRounding): Decimal;
|
|
1650
|
+
/** `-1`, `0` or `1` as this value is below, equal to, or above `other`. */
|
|
1651
|
+
cmp(other: Decimal | DecimalPrimitive): -1 | 0 | 1;
|
|
1652
|
+
/** Whether this value and `other` are the same number. */
|
|
1653
|
+
eq(other: Decimal | DecimalPrimitive): boolean;
|
|
1654
|
+
/** Whether this value is below `other`. */
|
|
1655
|
+
lt(other: Decimal | DecimalPrimitive): boolean;
|
|
1656
|
+
/** Whether this value is below `other` or the same number. */
|
|
1657
|
+
lte(other: Decimal | DecimalPrimitive): boolean;
|
|
1658
|
+
/** Whether this value is above `other`. */
|
|
1659
|
+
gt(other: Decimal | DecimalPrimitive): boolean;
|
|
1660
|
+
/** Whether this value is above `other` or the same number. */
|
|
1661
|
+
gte(other: Decimal | DecimalPrimitive): boolean;
|
|
1662
|
+
/** This value without its sign. */
|
|
1663
|
+
abs(): Decimal;
|
|
1664
|
+
/** This value with its sign flipped. Zero has no sign to flip. */
|
|
1665
|
+
neg(): Decimal;
|
|
1666
|
+
/**
|
|
1667
|
+
* The canonical text of this value: no exponent, ever, and no insignificant
|
|
1668
|
+
* zero, so two instances naming the same number spell it the same way.
|
|
1669
|
+
*/
|
|
1670
|
+
toString(): string;
|
|
1671
|
+
/**
|
|
1672
|
+
* This value with exactly `fractionDigits` fraction digits, rounding half
|
|
1673
|
+
* away from zero. With no argument it is {@link Decimal.toString}: the whole
|
|
1674
|
+
* value, in normal notation, rounded nowhere.
|
|
1675
|
+
*/
|
|
1676
|
+
toFixed(fractionDigits?: number): string;
|
|
1677
|
+
/**
|
|
1678
|
+
* This value as a JavaScript number, which is a double: the conversion is
|
|
1679
|
+
* exact only for values a double can hold, and is the caller's decision.
|
|
1680
|
+
*/
|
|
1681
|
+
toNumber(): number;
|
|
1682
|
+
/** The canonical text, so `` `${value}` `` and `+value` read the number. */
|
|
1683
|
+
valueOf(): string;
|
|
1684
|
+
/** The canonical text, so `JSON.stringify` writes the number, not `{}`. */
|
|
1685
|
+
toJSON(): string;
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* The public constructor, carrying the one grammar a caller may spell.
|
|
1689
|
+
*
|
|
1690
|
+
* The same object as the class, so `instanceof` and `Object.create(
|
|
1691
|
+
* Decimal.prototype)` behave exactly as they would for a plain class
|
|
1692
|
+
* declaration — only the internal two-argument construction is hidden, and the
|
|
1693
|
+
* instance TYPE stays free of private fields so a mapped result type keeps it.
|
|
1694
|
+
*/
|
|
1695
|
+
declare const Decimal: {
|
|
1696
|
+
/**
|
|
1697
|
+
* @param value a `Decimal` to copy, an exact decimal string, or a whole
|
|
1698
|
+
* `bigint`.
|
|
1699
|
+
* @throws {TypeError} for every other value, including every JavaScript
|
|
1700
|
+
* number, a string outside the accepted grammar, and a value of any other
|
|
1701
|
+
* type.
|
|
1702
|
+
*/
|
|
1703
|
+
new (value: Decimal | DecimalPrimitive): Decimal;
|
|
1704
|
+
readonly prototype: Decimal;
|
|
1705
|
+
};
|
|
1706
|
+
//#endregion
|
|
1707
|
+
//#region src/validation/primitives/decimal-codec.d.ts
|
|
1708
|
+
/**
|
|
1709
|
+
* The fixed-decimal domain: multiples of `10^-scale` whose unscaled coefficient
|
|
1710
|
+
* has at most `precision` digits. Frozen once by `s.decimal` and carried by
|
|
1711
|
+
* reference through every modifier.
|
|
1712
|
+
*/
|
|
1713
|
+
interface DecimalDescriptor {
|
|
1714
|
+
readonly precision: number;
|
|
1715
|
+
readonly scale: number;
|
|
1716
|
+
}
|
|
1717
|
+
/**
|
|
1718
|
+
* The two exact physical vocabularies a decimal field can cross through.
|
|
1719
|
+
*
|
|
1720
|
+
* The active adapter selects one; this codec alone interprets it. The value
|
|
1721
|
+
* cannot select its own vocabulary because `"120"` is logical 120 as native
|
|
1722
|
+
* decimal text and logical 1.2 as a scale-2 coefficient.
|
|
1723
|
+
*/
|
|
1724
|
+
type DecimalPhysicalRepresentation = "text" | "coefficient";
|
|
1725
|
+
//#endregion
|
|
2030
1726
|
//#region src/validation/primitives/decimal.d.ts
|
|
2031
1727
|
/**
|
|
2032
1728
|
* What a decimal accepts on the way IN: the public value type, or its lossless
|
|
@@ -2157,7 +1853,7 @@ interface ObjectOptions<T$1 = unknown, TKeys extends string = string> {
|
|
|
2157
1853
|
* recursive filter surface, and distributing them into the type would turn
|
|
2158
1854
|
* every filter object into a union of one variant per operator.
|
|
2159
1855
|
*/
|
|
2160
|
-
refuse?: (value: Record<string, unknown>) => string | ValidationIssue | undefined;
|
|
1856
|
+
refuse?: (value: Record<string, unknown>) => string | ValidationIssue$1 | undefined;
|
|
2161
1857
|
/**
|
|
2162
1858
|
* The name this object's fields are provided under: inside
|
|
2163
1859
|
* {@link parseProviding}, a required field the caller's context provides
|
|
@@ -2397,6 +2093,31 @@ type ComputeEntries<TObject extends Record<string, any>, TPath extends string> =
|
|
|
2397
2093
|
*/
|
|
2398
2094
|
declare function fromObject<TObject extends Record<string, any>, TPath extends string, const TOpts extends FromObjectOptions | undefined = undefined>(sourceObject: TObject, path: TPath, options?: TOpts): ObjectSchema<ComputeEntries<TObject, TPath>, TOpts>;
|
|
2399
2095
|
//#endregion
|
|
2096
|
+
//#region src/validation/primitives/geo-values.d.ts
|
|
2097
|
+
/** The sole public value represented by an `s.point()` field. */
|
|
2098
|
+
interface GeoPoint {
|
|
2099
|
+
longitude: number;
|
|
2100
|
+
latitude: number;
|
|
2101
|
+
}
|
|
2102
|
+
/** One inclusive latitude/longitude rectangle. */
|
|
2103
|
+
interface GeoBounds {
|
|
2104
|
+
south: number;
|
|
2105
|
+
west: number;
|
|
2106
|
+
north: number;
|
|
2107
|
+
east: number;
|
|
2108
|
+
}
|
|
2109
|
+
/** One simple geographic polygon with optional holes. */
|
|
2110
|
+
interface GeoPolygon {
|
|
2111
|
+
outer: readonly GeoPoint[];
|
|
2112
|
+
holes?: readonly (readonly GeoPoint[])[];
|
|
2113
|
+
}
|
|
2114
|
+
/** The two query-only geographic area forms. */
|
|
2115
|
+
type GeoArea = {
|
|
2116
|
+
readonly bounds: GeoBounds;
|
|
2117
|
+
} | {
|
|
2118
|
+
readonly polygon: GeoPolygon;
|
|
2119
|
+
};
|
|
2120
|
+
//#endregion
|
|
2400
2121
|
//#region src/validation/primitives/iso.d.ts
|
|
2401
2122
|
interface BaseIsoTimestampSchema<Opts extends ScalarOptions<string, any> | undefined = undefined> extends VibSchema<ComputeInput<string | Date, Opts>, ComputeOutput<string, Opts>> {}
|
|
2402
2123
|
interface IsoTimestampSchema<TInput = string | Date, TOutput = string> extends VibSchema<TInput, TOutput> {
|
|
@@ -5018,6 +4739,65 @@ type ClientSchema<C$1 extends VibORMConfig> = { [K in keyof C$1["schema"]]: " vi
|
|
|
5018
4739
|
/** Driver and other config facts do not participate in schema projection. */
|
|
5019
4740
|
type LinkedClientConfig<C$1 extends VibORMConfig, L$1 = undefined> = { [P in keyof C$1]: P extends "schema" ? SchemaSnapshot<C$1["schema"], L$1 extends undefined ? SchemaLinks<C$1["schema"]> : L$1> : C$1[P] } & Links$1<L$1 extends undefined ? SchemaLinks<C$1["schema"]> : L$1>;
|
|
5020
4741
|
//#endregion
|
|
4742
|
+
//#region src/validation/primitives/id-codec.d.ts
|
|
4743
|
+
/**
|
|
4744
|
+
* The ONE codec of a declared identifier DOMAIN.
|
|
4745
|
+
*
|
|
4746
|
+
* A domain is `{ format, prefix?, length? }` — exactly the facts a generator
|
|
4747
|
+
* modifier already recorded on the scalar, never a second declaration. This
|
|
4748
|
+
* module answers the three questions every boundary asks about a value in one:
|
|
4749
|
+
*
|
|
4750
|
+
* 1. Is this string IN the domain, and what is its canonical spelling?
|
|
4751
|
+
* (`canonicalizeId`: the uppercase UUID and the lowercase ULID are aliases,
|
|
4752
|
+
* and an identity-sensitive consumer — a cache key, a captured row key, an
|
|
4753
|
+
* `fkEquals` — must see one spelling for one identifier.)
|
|
4754
|
+
* 2. What does the column physically hold for it? (`encodePhysicalId`)
|
|
4755
|
+
* 3. Which public value did a physical one come back as? (`decodePhysicalId`)
|
|
4756
|
+
*
|
|
4757
|
+
* It is PURE and dialect-blind on purpose. It takes an
|
|
4758
|
+
* {@link IdRepresentation}, never a provider: choosing the representation is a
|
|
4759
|
+
* storage question, owned one layer up in
|
|
4760
|
+
* {@link file://../../schema/scalars/string/id-domain.ts}, and a codec that
|
|
4761
|
+
* knew about `bytea` could not be read by the validation schemas that run
|
|
4762
|
+
* before any adapter exists.
|
|
4763
|
+
*
|
|
4764
|
+
* Two things it deliberately does NOT do. It never splits a value on `-`: a
|
|
4765
|
+
* prefix is matched WHOLE, because `usr-01H…` and a UUID both contain hyphens
|
|
4766
|
+
* and a generic split would silently reinterpret one as the other. And it
|
|
4767
|
+
* never widens a format: a text that is not a spelling of the declared format
|
|
4768
|
+
* is `undefined` here, so the boundary that asked owns the message.
|
|
4769
|
+
*/
|
|
4770
|
+
/** The six string generators that name an identifier domain. */
|
|
4771
|
+
type IdFormat = "uuid" | "uuidv7" | "ulid" | "ksuid" | "nanoid" | "cuid";
|
|
4772
|
+
/**
|
|
4773
|
+
* A declared or derived identifier domain.
|
|
4774
|
+
*
|
|
4775
|
+
* `prefix` is absent rather than empty when none was declared — `""` is how a
|
|
4776
|
+
* caller spells "no prefix", and carrying it would make a bare `-` part of
|
|
4777
|
+
* every value. `length` belongs to `nanoid` alone; every other format's width
|
|
4778
|
+
* is the format's own.
|
|
4779
|
+
*/
|
|
4780
|
+
interface IdDomain {
|
|
4781
|
+
readonly format: IdFormat;
|
|
4782
|
+
readonly prefix?: string | undefined;
|
|
4783
|
+
readonly length?: number | undefined;
|
|
4784
|
+
}
|
|
4785
|
+
/**
|
|
4786
|
+
* What a column physically holds for one identifier.
|
|
4787
|
+
*
|
|
4788
|
+
* - `"text"` — the whole PUBLIC string, prefix included. Every `nanoid` and
|
|
4789
|
+
* `cuid` field, and any domain field whose native type override keeps a text
|
|
4790
|
+
* column.
|
|
4791
|
+
* - `"uuid"` — the payload as canonical UUID text, which is what a PostgreSQL
|
|
4792
|
+
* `uuid` column takes and returns on the wire.
|
|
4793
|
+
* - `"bytes"` — the payload's own bytes: 16 for a UUID or ULID, 20 for a KSUID.
|
|
4794
|
+
*
|
|
4795
|
+
* A declared PREFIX is never stored. It is a fact of the declaration, identical
|
|
4796
|
+
* in every row, and re-applied on read — which is also why `"uuid"` and
|
|
4797
|
+
* `"bytes"` are not identity paths for a prefixed field.
|
|
4798
|
+
*/
|
|
4799
|
+
type IdRepresentation = "text" | "uuid" | "bytes";
|
|
4800
|
+
//#endregion
|
|
5021
4801
|
//#region src/validation/scalars/negatable-filter.d.ts
|
|
5022
4802
|
interface NegatableFilter<S$1 extends V$1.Schema, TBase extends ObjectEntries> extends V$1.Object<TBase & {
|
|
5023
4803
|
not: NegatableFilterSchema<S$1, TBase>;
|
|
@@ -6222,14 +6002,34 @@ type IsDecimalScalar<F$1> = ExtractScalarState<F$1> extends {
|
|
|
6222
6002
|
* half that is pinned behaviorally (tests/drivers/scalar-roundtrip-behavior.ts),
|
|
6223
6003
|
* so the type follows it.
|
|
6224
6004
|
*/
|
|
6225
|
-
type AggregateResultType<T$1 extends ModelShape, Args> = Prettify<SelectedFields<Args, { [K in keyof Args as K extends `_${string}` ? K : never]: K extends "_count" ? Args[K] extends boolean ? number : Args[K] extends object ? SelectedCountResult<Args[K]> : never : K extends "_sum" ? Args[K] extends object ? SelectedFields<Args[K], { [F in keyof Args[K]]: (F extends ScalarKeys$1<T$1> ? InferScalarBase<T$1[F]> : number) | null }> : never : K extends "_avg" ? Args[K] extends object ? SelectedFields<Args[K], { [F in keyof Args[K]]: (F extends ScalarKeys$1<T$1> ? IsDecimalScalar<T$1[F]> extends true ? Decimal : number : number) | null }> : never : K extends "_min" | "_max" ? Args[K] extends object ? SelectedFields<Args[K], { [F in keyof Args[K]]: F extends ScalarKeys$1<T$1> ? InferScalarBase<T$1[F]> | null : never }> : never : never }>>;
|
|
6005
|
+
type AggregateResultType<T$1 extends ModelShape, Args> = Prettify<SelectedFields<Args, { [K in keyof Args as K extends `_${string}` ? K : never]: K extends "_count" ? Args[K] extends boolean ? number : Args[K] extends object ? SelectedCountResult<Args[K]> : never : K extends "_sum" ? Args[K] extends object ? SelectedFields<Args[K], { [F in keyof Args[K]]: (F extends ScalarKeys$1<T$1> ? InferScalarBase<T$1[F]> : number) | null }> : never : K extends "_avg" ? Args[K] extends object ? SelectedFields<Args[K], { [F in keyof Args[K]]: (F extends ScalarKeys$1<T$1> ? IsDecimalScalar<T$1[F]> extends true ? Decimal : number : number) | null }> : never : K extends "_min" | "_max" ? Args[K] extends object ? SelectedFields<Args[K], { [F in keyof Args[K]]: F extends ScalarKeys$1<T$1> ? InferScalarBase<T$1[F]> | null : never }> : never : never }>>;
|
|
6006
|
+
/**
|
|
6007
|
+
* The columns a `by` member grouped by a time step names: its keys that are
|
|
6008
|
+
* required and not `undefined` (a closer such as `jour?: never`, or a key
|
|
6009
|
+
* spelled `undefined`, names nothing; admission strips it). Distributive: for
|
|
6010
|
+
* a member typed as a union of arms, every arm's columns.
|
|
6011
|
+
*/
|
|
6012
|
+
type NamedPeriodKeys<Member$1> = Member$1 extends object ? { [P in keyof Member$1]-?: undefined extends Member$1[P] ? never : P }[keyof Member$1] : never;
|
|
6013
|
+
/** The columns every arm of a member names: those its rows surely have. */
|
|
6014
|
+
type SurePeriodKeys<Member$1, All = NamedPeriodKeys<Member$1>> = Exclude<All, Member$1 extends object ? Exclude<All, NamedPeriodKeys<Member$1>> : All>;
|
|
6015
|
+
type PeriodValue<F$1> = ExtractScalarState<F$1>["nullable"] extends true ? string | null : string;
|
|
6016
|
+
/**
|
|
6017
|
+
* The fields the members of `by` grouped by a time step publish: the
|
|
6018
|
+
* period's first day as `YYYY-MM-DD`, the string an `s.date()` value is
|
|
6019
|
+
* written as, `null` too where the column is nullable (the rows with no
|
|
6020
|
+
* date). In a tuple each member is read on its own, so a column only some
|
|
6021
|
+
* arms of one member name may be absent from a row; the element type of an
|
|
6022
|
+
* array is the members it holds, each present.
|
|
6023
|
+
*/
|
|
6024
|
+
type GroupedPeriods<T$1 extends ModelShape, B$1 extends readonly unknown[]> = number extends B$1["length"] ? PeriodFields<T$1, NamedPeriodKeys<B$1[number]>, never> : PeriodFields<T$1, { [I in keyof B$1]: SurePeriodKeys<B$1[I]> }[number], { [I in keyof B$1]: NamedPeriodKeys<B$1[I]> }[number]>;
|
|
6025
|
+
type PeriodFields<T$1 extends ModelShape, Sure, Named> = { [F in Sure & ScalarKeys$1<T$1> & keyof T$1]: PeriodValue<T$1[F]> } & { [F in Exclude<Named, Sure> & ScalarKeys$1<T$1> & keyof T$1]?: PeriodValue<T$1[F]> };
|
|
6226
6026
|
/**
|
|
6227
6027
|
* Result type for groupBy operations
|
|
6228
6028
|
* Includes the grouped-by fields plus any requested aggregates
|
|
6229
6029
|
*/
|
|
6230
6030
|
type GroupByResultType<T$1 extends ModelShape, Args> = Args extends {
|
|
6231
6031
|
by: infer B;
|
|
6232
|
-
} ? Prettify<(B extends readonly (infer K)[] ? { [F in Extract<K, ScalarKeys$1<T$1> & keyof T$1>]: InferScalarBase<T$1[F]> } : B extends ScalarKeys$1<T$1> & keyof T$1 ? { [F in B]: InferScalarBase<T$1[F]> } : never) & AggregateResultType<T$1, Args>> : never;
|
|
6032
|
+
} ? Prettify<(B extends readonly (infer K)[] ? { [F in Extract<K, ScalarKeys$1<T$1> & keyof T$1>]: InferScalarBase<T$1[F]> } & GroupedPeriods<T$1, B> : B extends ScalarKeys$1<T$1> & keyof T$1 ? { [F in B]: InferScalarBase<T$1[F]> } : B extends object ? GroupedPeriods<T$1, [B]> : never) & AggregateResultType<T$1, Args>> : never;
|
|
6233
6033
|
//#endregion
|
|
6234
6034
|
//#region src/extensions/result-types.d.ts
|
|
6235
6035
|
type AllModels = "$allModels";
|
|
@@ -6421,6 +6221,20 @@ type ContextualOperationResult<C$1 extends VibORMConfig, ModelName$2 extends key
|
|
|
6421
6221
|
* Each operation returns a Promise with the properly inferred result type
|
|
6422
6222
|
*/
|
|
6423
6223
|
type Client<C$1 extends VibORMConfig, ClientDefaults = ClientRelationOmitContext<C$1>, Arguments extends object = NoArguments> = { [K in keyof ClientSchema<C$1>]: { [O in Operations]: Operation$1<O, ClientSchema<C$1>[K], ClientDefaultOmit<C$1, K>, ClientDefaults, PlacedOperationArguments<Arguments, K, O>> } };
|
|
6224
|
+
/**
|
|
6225
|
+
* What every operation of every client takes beside its payload, whatever its
|
|
6226
|
+
* driver: a driver without named statements accepts it and does nothing, so
|
|
6227
|
+
* code written for one database runs on another.
|
|
6228
|
+
*/
|
|
6229
|
+
interface CallOptions {
|
|
6230
|
+
/**
|
|
6231
|
+
* Named statements for this call (`namedStatements` on `viborm/pg` and
|
|
6232
|
+
* `viborm/postgres`): `true` names every statement of the call at its first
|
|
6233
|
+
* sending, within `max`; `false` never names them. Absent, the client's mode
|
|
6234
|
+
* decides. It changes neither the SQL nor what an extension sees.
|
|
6235
|
+
*/
|
|
6236
|
+
readonly named?: boolean;
|
|
6237
|
+
}
|
|
6424
6238
|
/** The arguments one (model, operation) accepts; none without a declaration. */
|
|
6425
6239
|
type PlacedOperationArguments<Arguments, ModelName$2, O$1> = [keyof Arguments] extends [never] ? NoArguments : OperationArguments<Arguments, ModelName$2, O$1>;
|
|
6426
6240
|
/** The operations that write a model's data: where `data` narrows. */
|
|
@@ -7017,17 +6831,31 @@ type DirectWriteKeysGuard<O$1 extends Operations, Arg, M$1 extends Model<any>, K
|
|
|
7017
6831
|
}, "create"> & ClauseGuard<Arg, {
|
|
7018
6832
|
update: Record<Keys$1, unknown>;
|
|
7019
6833
|
}, "update"> : unknown;
|
|
6834
|
+
/** The field a `by` member groups: a column, or the one `{ column: step }` names. */
|
|
6835
|
+
type GroupedField<Member$1> = Member$1 extends PropertyKey ? Member$1 : NamedPeriodKeys<Member$1>;
|
|
7020
6836
|
/**
|
|
7021
|
-
* groupBy `orderBy` names an aggregate or a field the literal `by` grouped
|
|
7022
|
-
* Aggregates are admitted before `by` is read, so a
|
|
7023
|
-
* parameter still orders by aggregates, while a field
|
|
7024
|
-
* no grouped key can be proven. An empty `by` stays a
|
|
7025
|
-
* because refusing `[]` here would refuse every
|
|
6837
|
+
* groupBy `orderBy` names an aggregate or a field the literal `by` grouped,
|
|
6838
|
+
* by a time step or not. Aggregates are admitted before `by` is read, so a
|
|
6839
|
+
* `by` list that is a type parameter still orders by aggregates, while a field
|
|
6840
|
+
* beside it is refused: no grouped key can be proven. An empty `by` stays a
|
|
6841
|
+
* runtime refusal (V4001) because refusing `[]` here would refuse every
|
|
6842
|
+
* generic `by` list too.
|
|
7026
6843
|
*/
|
|
7027
6844
|
type GroupByOrderGuard<O$1 extends Operations, Arg, Payload, M$1 extends Model<any>> = O$1 extends "groupBy" ? "orderBy" extends keyof Arg ? {
|
|
7028
|
-
orderBy?: NoExtraClauseKeys<NonNullable<Arg["orderBy"]>, Record<
|
|
6845
|
+
orderBy?: NoExtraClauseKeys<NonNullable<Arg["orderBy"]>, Record<GroupedField<ElementOf$1<NonNullable<ValueAt$1<Arg, "by">>>>, unknown>, Exclude<ClauseKeys<ElementOf$1<NonNullable<ValueAt$1<Payload, "orderBy">>>>, keyof M$1["~"]["state"]["scalars"]>>;
|
|
6846
|
+
} : unknown : unknown;
|
|
6847
|
+
/**
|
|
6848
|
+
* groupBy `by` members spelled as `{ column: step }` name model scalars only:
|
|
6849
|
+
* a typo beside a real column (`{ date: "month", dtae: "month" }`) is refused
|
|
6850
|
+
* when the member is held in a variable too, where excess-property checking
|
|
6851
|
+
* does not reach. Column members are strings and spell no key. The columns
|
|
6852
|
+
* arm keeps a generic `by` of columns assignable (a type parameter cannot be
|
|
6853
|
+
* keyed, so the seal alone would refuse it, as `OperatorBagGuard` notes).
|
|
6854
|
+
*/
|
|
6855
|
+
type GroupByMembersGuard<O$1 extends Operations, Arg, M$1 extends Model<any>> = O$1 extends "groupBy" ? "by" extends keyof Arg ? {
|
|
6856
|
+
by?: NoExtraClauseKeys<NonNullable<Arg["by"]>, M$1["~"]["state"]["scalars"]> | string | readonly string[];
|
|
7029
6857
|
} : unknown : unknown;
|
|
7030
|
-
type NoExtraOperationKeys<O$1 extends Operations, Arg, Payload, M$1 extends Model<any>, Arguments = NoArguments> = Arg & ExclusiveSelection<Arg> & Record<Exclude<keyof Arg, keyof Payload | keyof Arguments>, never> & ClauseGuard<Arg, Payload, "where"> & NestedClauseGuard<Arg, Payload, M$1, "where"> & OperatorBagGuard<Arg, Payload, M$1> & ClauseGuard<Arg, Payload, "select"> & ClauseGuard<Arg, Payload, "include"> & ClauseGuard<Arg, Payload, "orderBy"> & ClauseGuard<Arg, Payload, "omit"> & ClauseGuard<Arg, Arguments, "cache"> & DirectPolymorphicProjectionGuard<Arg, M$1, "select"> & DirectPolymorphicProjectionGuard<Arg, M$1, "include"> & RecursiveProjectionRootGuard<Arg, M$1> & DirectWriteKeysGuard<O$1, Arg, M$1> & NestedClauseGuard<Arg, Payload, M$1, "data"> & NestedClauseGuard<Arg, Payload, M$1, "create"> & NestedClauseGuard<Arg, Payload, M$1, "update"> & GroupByOrderGuard<O$1, Arg, Payload, M$1> & DirectDecimalUpdateGuard<O$1, Arg, M$1> & DirectGeoPointGuard<O$1, Arg, M$1>;
|
|
6858
|
+
type NoExtraOperationKeys<O$1 extends Operations, Arg, Payload, M$1 extends Model<any>, Arguments = NoArguments> = Arg & ExclusiveSelection<Arg> & CallOptions & Record<Exclude<keyof Arg, keyof Payload | keyof Arguments | keyof CallOptions>, never> & ClauseGuard<Arg, Payload, "where"> & NestedClauseGuard<Arg, Payload, M$1, "where"> & OperatorBagGuard<Arg, Payload, M$1> & ClauseGuard<Arg, Payload, "select"> & ClauseGuard<Arg, Payload, "include"> & ClauseGuard<Arg, Payload, "orderBy"> & ClauseGuard<Arg, Payload, "omit"> & ClauseGuard<Arg, Arguments, "cache"> & DirectPolymorphicProjectionGuard<Arg, M$1, "select"> & DirectPolymorphicProjectionGuard<Arg, M$1, "include"> & RecursiveProjectionRootGuard<Arg, M$1> & DirectWriteKeysGuard<O$1, Arg, M$1> & NestedClauseGuard<Arg, Payload, M$1, "data"> & NestedClauseGuard<Arg, Payload, M$1, "create"> & NestedClauseGuard<Arg, Payload, M$1, "update"> & GroupByOrderGuard<O$1, Arg, Payload, M$1> & GroupByMembersGuard<O$1, Arg, M$1> & DirectDecimalUpdateGuard<O$1, Arg, M$1> & DirectGeoPointGuard<O$1, Arg, M$1>;
|
|
7031
6859
|
/**
|
|
7032
6860
|
* One client method signature. `Pending` picks its carrier: a PendingOperation
|
|
7033
6861
|
* (PromiseLike, so it can be awaited directly or batched in
|
|
@@ -10382,8 +10210,21 @@ type GroupByOrderBySchema<M$1 extends AnyModel> = V$1.Object<V$1.FromKeys<Ordera
|
|
|
10382
10210
|
*/
|
|
10383
10211
|
type GroupByScalarKeys<M$1 extends AnyModel> = NonPointScalarKeys<ModelStateOf$1<M$1>["scalars"]>;
|
|
10384
10212
|
type EnumOfScalarMap<M$1 extends AnyModel> = V$1.Enum<GroupByScalarKeys<M$1>[]>;
|
|
10213
|
+
/** The single `date` and `dateTime` columns a time step can group. */
|
|
10214
|
+
type TemporalScalarKeys<M$1 extends AnyModel> = { [K in keyof ModelStateOf$1<M$1>["scalars"]]: ModelStateOf$1<M$1>["scalars"][K]["~"]["state"] extends {
|
|
10215
|
+
array: true;
|
|
10216
|
+
} ? never : ModelStateOf$1<M$1>["scalars"][K]["~"]["state"] extends {
|
|
10217
|
+
type: "date" | "datetime";
|
|
10218
|
+
} ? K & string : never }[keyof ModelStateOf$1<M$1>["scalars"]];
|
|
10219
|
+
/**
|
|
10220
|
+
* `{ [column]: step }`: exactly one key, so a union of one-key objects, each
|
|
10221
|
+
* closing every other column (a union alone would admit a second key).
|
|
10222
|
+
*/
|
|
10223
|
+
type TimeStepMember<M$1 extends AnyModel> = { [K in TemporalScalarKeys<M$1>]: { readonly [P in K]: TimeStep } & { readonly [P in Exclude<GroupByScalarKeys<M$1>, K>]?: never } }[TemporalScalarKeys<M$1>];
|
|
10224
|
+
type GroupByMemberSchema<M$1 extends AnyModel> = V$1.Union<readonly [EnumOfScalarMap<M$1>, VibSchema<TimeStepMember<M$1>, TimeStepMember<M$1>>]>;
|
|
10385
10225
|
type GroupByArgs<M$1 extends AnyModel, F$1 extends ScalarSchemas<M$1>> = V$1.Object<{
|
|
10386
|
-
by: V$1.Union<readonly [V$1.Array<
|
|
10226
|
+
by: V$1.Union<readonly [V$1.Array<GroupByMemberSchema<M$1>>, V$1.ShorthandArray<GroupByMemberSchema<M$1>>]>;
|
|
10227
|
+
timeZone: VibSchema<string, string>;
|
|
10387
10228
|
where: CoreSchemas<M$1, F$1>["where"];
|
|
10388
10229
|
having: HavingSchema<M$1, F$1>;
|
|
10389
10230
|
orderBy: V$1.Union<readonly [GroupByOrderBySchema<M$1>, V$1.Array<GroupByOrderBySchema<M$1>>]>;
|
|
@@ -10790,7 +10631,7 @@ interface ComputeOutputLookup<T$1, _Opts> {
|
|
|
10790
10631
|
ft: T$1 | null;
|
|
10791
10632
|
ff: T$1;
|
|
10792
10633
|
}
|
|
10793
|
-
interface ValidationIssue {
|
|
10634
|
+
interface ValidationIssue$1 {
|
|
10794
10635
|
readonly message: string;
|
|
10795
10636
|
readonly path?: readonly PropertyKey[];
|
|
10796
10637
|
}
|
|
@@ -10799,7 +10640,7 @@ interface ValidationSuccess<T$1> {
|
|
|
10799
10640
|
readonly issues?: undefined;
|
|
10800
10641
|
}
|
|
10801
10642
|
interface ValidationFailure {
|
|
10802
|
-
readonly issues: readonly ValidationIssue[];
|
|
10643
|
+
readonly issues: readonly ValidationIssue$1[];
|
|
10803
10644
|
}
|
|
10804
10645
|
type ValidationResult<T$1> = ValidationSuccess<T$1> | ValidationFailure;
|
|
10805
10646
|
type ParseResult<TSchema extends StandardSchemaV1> = TSchema extends VibSchema ? ValidationResult<InferOutput<TSchema>> : StandardSchemaV1.Result<StandardSchemaV1.InferOutput<TSchema>>;
|
|
@@ -13242,6 +13083,265 @@ declare class TransactionBoundDriver<TClient, TTransaction> extends Driver<TClie
|
|
|
13242
13083
|
declare const OPERATIONS: readonly ["findFirst", "findMany", "findUnique", "create", "createMany", "createManyAndReturn", "update", "updateMany", "updateManyAndReturn", "delete", "deleteMany", "deleteManyAndReturn", "upsert", "count", "aggregate", "groupBy", "exist"];
|
|
13243
13084
|
type Operation = (typeof OPERATIONS)[number];
|
|
13244
13085
|
//#endregion
|
|
13086
|
+
//#region src/errors/validation.d.ts
|
|
13087
|
+
/**
|
|
13088
|
+
* Validation issue details
|
|
13089
|
+
*/
|
|
13090
|
+
interface ValidationIssue {
|
|
13091
|
+
path: string;
|
|
13092
|
+
message: string;
|
|
13093
|
+
}
|
|
13094
|
+
/** The boundary that rejected a value. */
|
|
13095
|
+
type ValidationErrorSource = {
|
|
13096
|
+
readonly kind: "operation";
|
|
13097
|
+
readonly operation: Operation;
|
|
13098
|
+
readonly model?: string | undefined;
|
|
13099
|
+
} | {
|
|
13100
|
+
readonly kind: "registry";
|
|
13101
|
+
readonly model?: string | undefined;
|
|
13102
|
+
readonly property?: string | undefined;
|
|
13103
|
+
} | {
|
|
13104
|
+
readonly kind: "schema-builder";
|
|
13105
|
+
readonly builder: string;
|
|
13106
|
+
readonly path: string;
|
|
13107
|
+
} | {
|
|
13108
|
+
readonly kind: "json-schema";
|
|
13109
|
+
readonly target?: string | undefined;
|
|
13110
|
+
readonly schemaType?: string | undefined;
|
|
13111
|
+
};
|
|
13112
|
+
/**
|
|
13113
|
+
* Input validation errors
|
|
13114
|
+
*/
|
|
13115
|
+
declare class ValidationError extends VibORMError {
|
|
13116
|
+
static readonly diagnosticName = "ValidationError";
|
|
13117
|
+
/** Operation failures use V4001; other validation boundaries use V4002. */
|
|
13118
|
+
readonly code: typeof VibORMErrorCode.VALIDATION_FAILED | typeof VibORMErrorCode.INVALID_INPUT;
|
|
13119
|
+
/** Validation issues */
|
|
13120
|
+
readonly issues: ValidationIssue[];
|
|
13121
|
+
/** Boundary that rejected the value. */
|
|
13122
|
+
readonly source: ValidationErrorSource;
|
|
13123
|
+
/**
|
|
13124
|
+
* Operation that failed validation, in its CLIENT spelling — a bulk write
|
|
13125
|
+
* validated through its internal row-returning arm still reports the family
|
|
13126
|
+
* name the caller used (see {@link publicOperationName}).
|
|
13127
|
+
*/
|
|
13128
|
+
readonly operation?: Operation | undefined;
|
|
13129
|
+
constructor(sourceOrOperation: Operation | ValidationErrorSource, issues: ValidationIssue[], options?: VibORMErrorOptions);
|
|
13130
|
+
}
|
|
13131
|
+
/**
|
|
13132
|
+
* Type guard for validation errors
|
|
13133
|
+
*/
|
|
13134
|
+
declare function isValidationError(error: unknown): error is ValidationError;
|
|
13135
|
+
//#endregion
|
|
13136
|
+
//#region src/validation/model/args/time-step.d.ts
|
|
13137
|
+
/** The periods a `date` or `dateTime` column can be grouped by. */
|
|
13138
|
+
declare const TIME_STEPS: readonly ["day", "week", "month", "quarter", "year"];
|
|
13139
|
+
type TimeStep = (typeof TIME_STEPS)[number];
|
|
13140
|
+
//#endregion
|
|
13141
|
+
//#region src/adapters/adapter-capabilities.d.ts
|
|
13142
|
+
/** Database feature flags consulted by query construction. */
|
|
13143
|
+
interface DatabaseAdapterCapabilities {
|
|
13144
|
+
/** Whether database supports RETURNING clause (PG, SQLite 3.35+). */
|
|
13145
|
+
supportsReturning: boolean;
|
|
13146
|
+
/** Whether database supports CTEs with data-modifying statements. */
|
|
13147
|
+
supportsCteWithMutations: boolean;
|
|
13148
|
+
/** Whether database supports FULL OUTER JOIN. */
|
|
13149
|
+
supportsFullOuterJoin: boolean;
|
|
13150
|
+
/** Whether database supports LATERAL joins. */
|
|
13151
|
+
supportsLateralJoins: boolean;
|
|
13152
|
+
/** Whether this driver instance supports vector operations. */
|
|
13153
|
+
supportsVector: boolean;
|
|
13154
|
+
/** Whether database supports target/set WHERE clauses in upsert. */
|
|
13155
|
+
supportsUpsertWhere: boolean;
|
|
13156
|
+
/**
|
|
13157
|
+
* Whether the dialect's upsert grammar ARBITRATES ON THE NAMED TARGET.
|
|
13158
|
+
*
|
|
13159
|
+
* PostgreSQL and SQLite spell `INSERT … ON CONFLICT (cols) DO UPDATE`: only a
|
|
13160
|
+
* collision on `cols` takes the update branch, and a collision on any OTHER
|
|
13161
|
+
* unique index is raised as the constraint error it is. MySQL spells
|
|
13162
|
+
* `ON DUPLICATE KEY UPDATE`, which carries no target at all and fires on ANY
|
|
13163
|
+
* unique collision (`mysql-adapter.ts` `onConflict` ignores its `_target`
|
|
13164
|
+
* parameter and says so) — so an unrelated collision would silently ADOPT and
|
|
13165
|
+
* update a row the caller never named.
|
|
13166
|
+
*
|
|
13167
|
+
* That difference is a wrong answer, not a missing optimization, which is why
|
|
13168
|
+
* it is a capability and not an inference. It reads `false` on exactly the same
|
|
13169
|
+
* adapters as {@link DatabaseAdapterCapabilities.supportsReturning} today, and
|
|
13170
|
+
* that is a COINCIDENCE of the three adapters shipped, not an implication:
|
|
13171
|
+
* MariaDB has `RETURNING` on `INSERT` and still arbitrates on any key. Do not
|
|
13172
|
+
* collapse the two.
|
|
13173
|
+
*/
|
|
13174
|
+
supportsTargetedUpsert: boolean;
|
|
13175
|
+
/** Whether a mutation may reference its target table in a subquery. */
|
|
13176
|
+
supportsMutationTargetInSubquery: boolean;
|
|
13177
|
+
/**
|
|
13178
|
+
* Whether a single-table `UPDATE`/`DELETE` accepts a native row cap
|
|
13179
|
+
* (`... LIMIT n`). MySQL does; PostgreSQL and SQLite (in the default builds
|
|
13180
|
+
* this project targets — `SQLITE_ENABLE_UPDATE_DELETE_LIMIT` is off) do not,
|
|
13181
|
+
* so `updateMany`/`deleteMany` `limit` is realized there by restricting the
|
|
13182
|
+
* mutation's `WHERE` to a primary-key subquery that carries the `LIMIT`.
|
|
13183
|
+
* See `buildBulkLimitWhere` in query-engine/operations/bulk-limit.ts.
|
|
13184
|
+
*/
|
|
13185
|
+
supportsMutationRowLimit: boolean;
|
|
13186
|
+
/**
|
|
13187
|
+
* Whether a read can lock the rows it takes (`SELECT … FOR UPDATE`).
|
|
13188
|
+
* PostgreSQL and MySQL do; SQLite locks the whole database and omits the
|
|
13189
|
+
* clause, so a read taken only to lock rows is skipped there.
|
|
13190
|
+
*/
|
|
13191
|
+
supportsRowLocks: boolean;
|
|
13192
|
+
/**
|
|
13193
|
+
* Whether a locking read whose exact match finds NOTHING still takes a lock.
|
|
13194
|
+
* MySQL (InnoDB) does: a gap or next-key lock that two concurrent misses
|
|
13195
|
+
* both hold and that each one's INSERT then waits on, a deadlock. So a read
|
|
13196
|
+
* whose other arm inserts the key it looked for reads unlocked there and is
|
|
13197
|
+
* confirmed under lock once it finds a row. PostgreSQL locks only the rows a
|
|
13198
|
+
* read returns, so there that read locks what it finds and needs no
|
|
13199
|
+
* confirmation. SQLite takes no row lock at all (`supportsRowLocks`), so
|
|
13200
|
+
* its confirmation stays: it is the read that sees what changed. Absent:
|
|
13201
|
+
* false.
|
|
13202
|
+
*/
|
|
13203
|
+
locksMissingKeys?: boolean;
|
|
13204
|
+
/**
|
|
13205
|
+
* Whether a statement states each relation filter body it repeats ONCE, in
|
|
13206
|
+
* a `WITH`, as the key set every arm repeating it tests (a semijoin on the
|
|
13207
|
+
* correlated columns), rather than once per arm. A driver declares it for
|
|
13208
|
+
* a provider that bounds one statement's text or the relations one
|
|
13209
|
+
* statement references; a statement that repeats no body is unchanged, and
|
|
13210
|
+
* a recursive walk stays where it is. Absent: false.
|
|
13211
|
+
*/
|
|
13212
|
+
sharesRelationBodies?: boolean;
|
|
13213
|
+
/**
|
|
13214
|
+
* Whether a many-to-many relation filter reads its junction joined to the
|
|
13215
|
+
* target, correlated in the filter's own `WHERE` (`EXISTS (SELECT 1 FROM
|
|
13216
|
+
* junction j JOIN target t ON t.key = j.target WHERE j.source = parent.key
|
|
13217
|
+
* AND …)`), rather than as the target's membership in a correlated junction
|
|
13218
|
+
* subquery. `true` where the dialect plans the joined form at least as well
|
|
13219
|
+
* everywhere measured (SQLite); `"unbounded"` where it does only in a
|
|
13220
|
+
* statement whose root read is unbounded, a count, an aggregate, a
|
|
13221
|
+
* `findMany` without `take` or a write: PostgreSQL turns the join into a
|
|
13222
|
+
* hashed semijoin there (10–300× faster scans) but plans it about 0.2 ms
|
|
13223
|
+
* more slowly, which a bounded read (a unique, first or existence read, a
|
|
13224
|
+
* `take`) pays without the scan to win it back. Absent: false.
|
|
13225
|
+
*/
|
|
13226
|
+
joinsJunctionFilters?: boolean | "unbounded";
|
|
13227
|
+
/**
|
|
13228
|
+
* Whether a recursive CTE fails once it runs a fixed number of iterations
|
|
13229
|
+
* (MySQL's `cte_max_recursion_depth`, 1000 by default): a recursive filter
|
|
13230
|
+
* then keeps its walk in place, whose anchor holds the first hop, rather
|
|
13231
|
+
* than a reaching set, which spends one iteration per depth from its
|
|
13232
|
+
* anchor. Absent: false.
|
|
13233
|
+
*/
|
|
13234
|
+
boundsRecursionIterations?: boolean;
|
|
13235
|
+
/**
|
|
13236
|
+
* Whether a recursive projection whose caller states `recurse.fewRows`
|
|
13237
|
+
* reads each node it reached by key, in a scalar subquery, rather than
|
|
13238
|
+
* joining the table to the walk: PostgreSQL, guessing ten rows a level,
|
|
13239
|
+
* plans that join as a hash of the whole table, once per outer row (1,040
|
|
13240
|
+
* rows of a 5,000-row tree with their ancestors: 128 → 13 ms). SQLite and
|
|
13241
|
+
* MySQL join by index, and the subquery costs them 3–17 %. Absent: false.
|
|
13242
|
+
*/
|
|
13243
|
+
readsNodesByKey?: boolean;
|
|
13244
|
+
/**
|
|
13245
|
+
* Whether the dialect names an unaliased `"t"."c"` result column `c`
|
|
13246
|
+
* (PostgreSQL, MySQL, Snowflake): `identifiers.aliased` then leaves out an
|
|
13247
|
+
* alias that only repeats the column's own name, and the engine does not
|
|
13248
|
+
* ask it about a column it projects as stored, under its stored name.
|
|
13249
|
+
* SQLite promises no name for an unaliased column. Absent: false.
|
|
13250
|
+
*/
|
|
13251
|
+
namesQualifiedColumns?: boolean;
|
|
13252
|
+
/**
|
|
13253
|
+
* Whether a to-one relation a read projects is joined `LEFT JOIN LATERAL`
|
|
13254
|
+
* rather than read by a scalar subquery: PostgreSQL then caches the related
|
|
13255
|
+
* row per key (`Memoize`) where many rows share one, which a subquery in
|
|
13256
|
+
* the select list never is — 18 % of a post → author → posts read. Not
|
|
13257
|
+
* under {@link relationsPerStatement}: each join is one relation more.
|
|
13258
|
+
* Absent: false.
|
|
13259
|
+
*/
|
|
13260
|
+
joinsToOneLaterally?: boolean;
|
|
13261
|
+
/**
|
|
13262
|
+
* Whether a document the statement builds INSIDE another value — a relation
|
|
13263
|
+
* row, a count or aggregate carrier, a link row, evidence — is carried as
|
|
13264
|
+
* a JSON array of its members' values, in the prepared shape's order, and
|
|
13265
|
+
* read by position: no member name is written per document, sent as a
|
|
13266
|
+
* parameter or parsed back. On PostgreSQL that is 45 % fewer bytes for a
|
|
13267
|
+
* read with relations and 5 to 30 µs less server time per call than
|
|
13268
|
+
* `json_build_object`. The engine that lowers the document and the decoder
|
|
13269
|
+
* that reads it ask this one fact. Absent: false, a keyed object.
|
|
13270
|
+
*/
|
|
13271
|
+
carriesDocumentsAsArrays?: boolean;
|
|
13272
|
+
/**
|
|
13273
|
+
* The most terms one compound `SELECT` may chain, where the transport
|
|
13274
|
+
* bounds it below anything the engine writes: Cloudflare D1, 5. The engine
|
|
13275
|
+
* nests a longer union in derived tables of at most that many. Absent:
|
|
13276
|
+
* unbounded.
|
|
13277
|
+
*/
|
|
13278
|
+
compoundSelectTerms?: number;
|
|
13279
|
+
/**
|
|
13280
|
+
* Whether the transport bounds expression depth below what nested relation
|
|
13281
|
+
* filters reach unless each level reads from a derived table SQLite
|
|
13282
|
+
* flattens (D1, depth 100; `SQLiteAdapter({ deepExpressions: false })`):
|
|
13283
|
+
* a relation filter's own `EXISTS` then joins no flag member. Absent: false.
|
|
13284
|
+
*/
|
|
13285
|
+
boundsExpressionDepth?: boolean;
|
|
13286
|
+
/**
|
|
13287
|
+
* Where relation bodies are shared, the relations (`FROM` items) a
|
|
13288
|
+
* statement may reference before the engine trades plans for fewer:
|
|
13289
|
+
* PlanetScale Neki refuses a statement over 256. Over it, a recursive
|
|
13290
|
+
* filter's walk the statement repeats becomes one reaching set, then rows
|
|
13291
|
+
* join the key sets they test, each as far as the statement needs. Absent:
|
|
13292
|
+
* unbounded, so neither.
|
|
13293
|
+
*/
|
|
13294
|
+
relationsPerStatement?: number;
|
|
13295
|
+
/**
|
|
13296
|
+
* Whether the transport's affected-row count of an `UPDATE` or `DELETE`
|
|
13297
|
+
* also counts the rows a foreign key's cascade changed: Cloudflare D1's
|
|
13298
|
+
* `meta.changes` reports 3 for one post deleted with its two junction rows,
|
|
13299
|
+
* where SQLite's own count is 1. The engine then counts the rows such a
|
|
13300
|
+
* statement writes by returning one marker per row, where the count is an
|
|
13301
|
+
* answer (`updateMany` / `deleteMany`) or a check (a captured mutation).
|
|
13302
|
+
* Absent: false.
|
|
13303
|
+
*/
|
|
13304
|
+
countsCascadedChanges?: boolean;
|
|
13305
|
+
}
|
|
13306
|
+
//#endregion
|
|
13307
|
+
//#region src/adapters/adapter-core-types.d.ts
|
|
13308
|
+
/**
|
|
13309
|
+
* What an arithmetic assignment's TARGET COLUMN is, as a semantic fact the
|
|
13310
|
+
* query engine knows and the adapter spells.
|
|
13311
|
+
*
|
|
13312
|
+
* The engine decides THAT a quantized decimal multiply happens; the adapter
|
|
13313
|
+
* decides HOW it is written, which is why the descriptor travels here rather
|
|
13314
|
+
* than a `CASE` expression being composed upstream. At most one member is ever
|
|
13315
|
+
* populated — an integer column is not a decimal one — and an absent target is
|
|
13316
|
+
* the ordinary numeric column every dialect multiplies natively.
|
|
13317
|
+
*/
|
|
13318
|
+
interface ArithmeticTarget {
|
|
13319
|
+
/** An `int`/`bigInt` column: division truncates toward zero. */
|
|
13320
|
+
readonly integer?: boolean;
|
|
13321
|
+
/** The exact decimal domain the result must land back inside. */
|
|
13322
|
+
readonly decimal?: DecimalDescriptor;
|
|
13323
|
+
}
|
|
13324
|
+
/**
|
|
13325
|
+
* Logical cast types that adapters map to dialect-specific SQL types.
|
|
13326
|
+
*
|
|
13327
|
+
* Instead of hardcoding SQL type names like "TEXT" or "VARCHAR",
|
|
13328
|
+
* use these logical types and let each adapter map to the correct syntax.
|
|
13329
|
+
*
|
|
13330
|
+
* `numeric` is the approximate/whatever-the-dialect-calls-a-number cast used
|
|
13331
|
+
* for `number`; fixed decimals do not enter this type map. They need the field's
|
|
13332
|
+
* exact descriptor, which a flat cast-name union cannot carry, and therefore use
|
|
13333
|
+
* `DatabaseAdapter.expressions.decimalCast` instead. Spelling a fixed decimal
|
|
13334
|
+
* as `numeric` is silent corruption on SQLite, whose NUMERIC affinity may put a
|
|
13335
|
+
* fractional spelling through a double.
|
|
13336
|
+
*
|
|
13337
|
+
* This split also removes the old undeclared fallback domains: unconstrained
|
|
13338
|
+
* PostgreSQL `NUMERIC` and MySQL `DECIMAL(65,30)`. A concrete decimal binds
|
|
13339
|
+
* through `literals.decimal(canonical, descriptor)`; a deferred relation key
|
|
13340
|
+
* casts through `decimalCast(expression, descriptor)`. Both consume the one
|
|
13341
|
+
* descriptor from `s.decimal({ precision, scale })`.
|
|
13342
|
+
*/
|
|
13343
|
+
type CastType = "text" | "integer" | "bigint" | "boolean" | "numeric";
|
|
13344
|
+
//#endregion
|
|
13245
13345
|
//#region src/adapters/adapter-result-parser.d.ts
|
|
13246
13346
|
interface AdapterResultParser {
|
|
13247
13347
|
/**
|
|
@@ -13416,6 +13516,31 @@ interface AdapterResultParser {
|
|
|
13416
13516
|
}
|
|
13417
13517
|
//#endregion
|
|
13418
13518
|
//#region src/adapters/database-adapter.d.ts
|
|
13519
|
+
/**
|
|
13520
|
+
* The column a time-step period is taken of: a calendar date or a date and
|
|
13521
|
+
* time, whether it declares a zone, and its native type, which may state the
|
|
13522
|
+
* zone instead.
|
|
13523
|
+
*/
|
|
13524
|
+
interface PeriodSource {
|
|
13525
|
+
readonly date: boolean;
|
|
13526
|
+
readonly withTimezone: boolean;
|
|
13527
|
+
readonly nativeType: NativeTypeDeclaration | undefined;
|
|
13528
|
+
}
|
|
13529
|
+
/** A `groupBy` time step's period: computed once, then spelled. */
|
|
13530
|
+
interface PeriodSql {
|
|
13531
|
+
/**
|
|
13532
|
+
* The first day of the `step` period holding `column`, as a date: what a
|
|
13533
|
+
* grouped read groups and orders. A column that stores an instant is read
|
|
13534
|
+
* as wall time in `zone` (an admitted IANA name); a date, or a date and
|
|
13535
|
+
* time with no zone, as written.
|
|
13536
|
+
*/
|
|
13537
|
+
readonly of: (column: Sql, step: TimeStep, source: PeriodSource, zone: string) => Sql;
|
|
13538
|
+
/**
|
|
13539
|
+
* That date as the text the engine publishes from, `YYYY-MM-DD AD` or
|
|
13540
|
+
* `YYYY-MM-DD BC`, whatever the session's date style or the driver.
|
|
13541
|
+
*/
|
|
13542
|
+
readonly text: (period: Sql) => Sql;
|
|
13543
|
+
}
|
|
13419
13544
|
/** The one physical SQL vocabulary for a logical EPSG:4326 GeoPoint. */
|
|
13420
13545
|
interface GeoPointSql {
|
|
13421
13546
|
/** Construct a stored point from already-bound longitude and latitude. */
|
|
@@ -14282,7 +14407,13 @@ interface DatabaseAdapter {
|
|
|
14282
14407
|
* GeoPoint tier; optional members distinguish the full polygon/distance tier.
|
|
14283
14408
|
*/
|
|
14284
14409
|
readonly geoPoint?: GeoPointSql;
|
|
14410
|
+
/**
|
|
14411
|
+
* The periods of a `by` member grouped by a time step. Absence means this
|
|
14412
|
+
* adapter groups by no time step, and the engine refuses such a call before
|
|
14413
|
+
* any statement is sent.
|
|
14414
|
+
*/
|
|
14415
|
+
readonly period?: PeriodSql;
|
|
14285
14416
|
result: AdapterResultParser;
|
|
14286
14417
|
}
|
|
14287
14418
|
//#endregion
|
|
14288
|
-
export {
|
|
14419
|
+
export { With as $, QueryResult as $a, BaseIntegerSchema as $i, only as $n, CachedClient as $r, ModelSchemas as $t, BoundAccepted as A, AnyNull as Aa, BooleanScalar as Ai, statement as An, CacheInvalidKeyError as Ao, validateOperationPayload as Ar, AutoGenerate as At, Outcome as B, JunctionReferentialAction as Ba, FieldRef as Bi, reads as Bn, DiagnosticDisclosure as Bo, DateTimePhysicalForm as Br, createSchemaRegistry as Bt, DriverResultParser as C, BaseBooleanSchema as Ca, RelationLinks as Ci, driver as Cn, ValueTooLongError as Co, accepts as Cr, RowsFragment as Ct, AnyFacts as D, BaseBigIntSchema as Da, TimeScalar as Di, origin as Dn, isUniqueConstraintError as Do, getOperationPayloadSchema as Dr, VariantToOneRelation as Dt, AnyCallContext as E, BlobSchema as Ea, ModelToManyRelation as Ei, notes as En, isNotNullConstraintError as Eo, oneOf as Er, VariantToManyRelation as Et, Exact as F, isJsonNullSentinel as Fa, VectorSchema as Fi, settled as Fn, VibORMErrorCode as Fo, isPendingOperation as Fr, ScalarType as Ft, Selection$1 as G, BatchTransactionOptions as Ga, IndexDefinition as Gi, methods as Gn, PG as Go, validateSchemaOrThrow as Gr, SchemaRegistryLookup as Gt, Parts as H, RelationCardinality as Ha, createModelFieldRefs as Hi, target as Hn, NativeType as Ho, InsertValueContext as Hr, InferOutput as Ht, Extension as I, JsonSchema$1 as Ia, StringSchema as Ii, rule as In, isRetryableError as Io, WriteOutcome as Ir, UpdateState as It, TargetOf as J, TransactionOptions as Ja, InitialModelState as Ji, check as Jn, SchemaValidationIssue as Jr, ModelArgsSchemas as Jt, StampedFields as K, DriverTransactionOptions as Ka, IndexOptions as Ki, modelMethods as Kn, SQLITE as Ko, SchemaValidationError as Kr, SchemaRegistryOperation as Kt, Facts as L, inferred as La, BasePointSchema as Li, parts as Ln, isVibORMError as Lo, WriteKind as Lr, parse as Lt, CallResult as M, JsonNull as Ma, V$1 as Mi, table as Mn, CacheOperationNotCacheableError as Mo, PendingOperation as Mr, GeneratorDefaultBrand as Mt, ConfiguredBy as N, JsonNullKind as Na, v as Ni, text as Nn, PrismaErrorCode as No, UnwrapPendingOperation as Nr, InitialScalarState as Nt, AnyTarget as O, BigIntSchema as Oa, DateTimeScalar as Oi, parameters as On, isValueTooLongError as Oo, renderOperationResultType as Or, Scalar as Ot, EmptyFacts as P, JsonNullSentinel as Pa, BaseVectorSchema as Pi, unit as Pn, VibORMError as Po, UnwrapPendingOperations as Pr, ScalarState as Pt, Watcher as Q, QueryExecutionContext as Qa, UpdateState$1 as Qi, lazy as Qn, CacheableOperations as Qr, ModelRelationNestedInput as Qt, NoArguments as R, AnyRelation as Ra, PointSchema as Ri, deletes as Rn, toPrismaErrorCode as Ro, around as Rr, createJsonSchemaConverter as Rt, PinnedSessionReservation as S, Decimal as Sa, Links$1 as Si, correlation as Sn, UniqueConstraintError as So, watch as Sr, RawOperation as St, Accepted as T, BaseBlobSchema as Ta, ReferencesStage as Ti, note as Tn, isForeignKeyError as To, bound as Tr, ScalarKeys as Tt, PlacedArgument as U, RelationSlot as Ua, isFieldRef as Ui, writes as Un, NativeTypeDeclaration as Uo, ModelSql as Ur, ParseResult as Ut, type Part as V, ReferentialAction as Va, ModelFieldRefs as Vi, selecting as Vn, MYSQL as Vo, QueryBackend as Vr, InferInput as Vt, Run as W, sqliteResultParser as Wa, AnyModel as Wi, work as Wn, NativeTypeMap as Wo, validateSchema as Wr, Prettify as Wt, UnitKind as X, CommittedBatchNotification as Xa, ModelInternal as Xi, gate as Xn, ValidationResult$1 as Xr, ModelCoreSchemas as Xt, UnitContext as Y, BatchQuery as Ya, Model as Yi, facts as Yn, Severity as Yr, ModelCoreInput as Yt, UnitOutcome as Z, Dialect as Za, ModelState as Zi, keep as Zn, Schema$2 as Zr, ModelOperationInput as Zt, MigrationFrameDriver as _, ObjectSchema as _a, IdRepresentation as _i, JoinedSource as _n, MigrationError as _o, within as _r, ChainedExtensionState as _t, TextMatch as a, JsonSchema as aa, OperationPayload as ai, VectorScalar as an, ForbiddenError as ao, row as ar, DelegateOperationPayload as at, SqliteMigrationCapability as b, DecimalSchema as ba, Linked as bi, stored as bn, ForeignKeyError as bo, again as br, ExtensionResultConsumerState as bt, ArithmeticTarget as c, BaseIsoTimeSchema as ca, Operations as ci, NumberScalar as cn, NotFoundError as co, fields as cr, ExtendedClient as ct, ValidationErrorSource as d, IsoTimeSchema as da, AggregateResultType as di, EnumScalar as dn, QueryError as do, DisclosurePolicy as dr, TransactionClient as dt, BaseNumberSchema as ea, CallOptions as ei, ModelStateSchemas as en, InvalidTransactionInputError as eo, arg as er, AddedProjectedState as et, isValidationError as f, IsoTimestampSchema as fa, BatchPayload as fi, DecimalScalar as fn, UnsupportedOperationError as fo, disclosure as fr, TransactionClientOf as ft, MigrationFrame as g, GeoPolygon as ga, InferSelectInclude as gi, VIBORM_VERSION as gn, isUnsupportedOperationError as go, database as gr, AddedExtensionState as gt, Driver as h, GeoPoint as ha, GroupByResultType as hi, getRowKey as hn, isPendingOperationError as ho, Database as hr, createClient as ht, PeriodSql as i, InputJsonValue as ia, NoExtraOperationKeys as ii, NumericScalar as in, FeatureNotSupportedError as io, provided as ir, DelegateOperationArgs as it, CallContext as j, DbNull as ja, BlobScalar as ji, statements as jn, CacheInvalidTTLError as jo, ProjectedModelOperations as jr, AutoGenerateType as jt, ArgTest as k, AnyJsonNullSentinel as ka, DateScalar as ki, run as kn, CacheConfigurationError as ko, renderSchemaType as kr, BigIntScalar as kt, CastType as l, BaseIsoTimestampSchema as la, Schema$3 as li, JsonScalar as ln, PendingOperationError as lo, extension as lr, ExtendedOperationResult as lt, CommitRerunningDriver as m, GeoBounds as ma, CountResultType as mi, getSchemas as mn, isNotFoundError as mo, omitted as mr, VibORMConfig as mt, EngineFacts as n, NumberSchema as na, InferDatabase as ni, ArgsSchemas as nn, ClientInitializationError as no, nothing as nr, ClientTypeState as nt, VectorOrderKey as o, JsonValue as oa, OperationPayloadSchema as oi, StringScalar as on, NestedWriteAssertionError as oo, unless as or, DelegateOperationResult as ot, AnyDriver as p, GeoArea as pa, ClientHiddenContext as pi, s as pn, isClientInitializationError as po, defaults as pr, VibORMClient as pt, Target$1 as q, TransactionOptionSupport as qa, IndexType as qi, key as qn, isSchemaValidationError as qr, VibSchema as qt, GeoPointSql as r, BaseJsonSchema as ra, MutationOperations as ri, CoreSchemas as rn, ConnectionError as ro, now as rr, DelegateConfig as rt, AdapterResultParser as s, BaseIsoDateSchema as sa, OperationResult as si, PointScalar as sn, NestedWriteError as so, when as sr, DriverConfig as st, DatabaseAdapter as t, IntegerSchema as ta, Client as ti, ScalarSchemas as tn, TransactionError as to, exists as tr, CachedClientOf as tt, ValidationError as u, IsoDateSchema as ua, ValidatedOperationPayload as ui, IntScalar as un, QueryEngineError as uo, disclosed as ur, NoExtraDriverConfigKeys as ut, MigrationSessionAttestation as v, BaseEnumSchema as va, ClientSchema as vi, computed as vn, isMigrationError as vo, Codec as vr, ClientExtensionState as vt, MigrationNamespaceAttestation as w, BooleanSchema as wa, ModelToOneRelation as wi, failure as wn, isCheckConstraintError as wo, args as wr, ModelShape as wt, TransactionBoundDriver as x, DecimalDescriptor as xa, LinkedClientConfig as xi, BatchMember as xn, NotNullConstraintError as xo, via as xr, ExtensionStateConstraint as xt, SQLITE_MIGRATION_CAPABILITY as y, EnumSchema as ya, FlatSchema as yi, joined as yn, CheckConstraintError as yo, codec as yr, EmptyClientExtensionState as yt, OperationSet as z, Getter as za, AnyFieldRef as zi, models as zn, wrapError as zo, call as zr, toJsonSchema as zt };
|