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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory-G4cSuc6A.mjs","names":[],"sources":["../src/migrations/storage/conformance.ts","../src/migrations/storage/memory.ts"],"sourcesContent":["/**\n * Reusable storage conformance suite. A writable driver that cannot pass\n * these tests is not a V1 estate owner.\n */\n\nimport { MigrationError, VibORMErrorCode } from \"../../errors\";\nimport { bytesEqual } from \"../canonical-json\";\nimport { utf8Bytes } from \"../identity\";\nimport { encodeSqlBlob } from \"../v1-parse\";\nimport type { MigrationStorageWriter } from \"./contract\";\n\nconst RACERS = 8;\nconst LISTED = 5;\n\nconst isCorruption = (error: unknown): boolean =>\n error instanceof MigrationError &&\n error.code === VibORMErrorCode.MIGRATION_CORRUPTION;\n\nexport function createStorageConformanceSuite(\n createWriter: () => MigrationStorageWriter\n): { readonly name: string; readonly run: () => Promise<void> }[] {\n return [\n {\n name: \"identical content-addressed publish is idempotent\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"hello\");\n const hash = encodeSqlBlob(bytes);\n const first = await storage.publishSql(hash, bytes);\n const second = await storage.publishSql(hash, bytes);\n if (first.outcome !== \"created\" || second.outcome !== \"identical\") {\n throw new Error(\"idempotent publish failed\");\n }\n },\n },\n {\n name: \"same hash with different bytes is corruption\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"hello\");\n const hash = encodeSqlBlob(bytes);\n await storage.publishSql(hash, bytes);\n try {\n await storage.publishSql(hash, utf8Bytes(\"other\"));\n } catch (error) {\n if (isCorruption(error)) return;\n }\n throw new Error(\"corrupt publish was accepted\");\n },\n },\n {\n name: \"listStates returns only committed manifests\",\n run: async () => {\n const storage = createWriter();\n const listed = await storage.listStates();\n if (listed.length !== 0) throw new Error(\"fresh writer is not empty\");\n },\n },\n {\n name: \"estate publish is idempotent for identical bytes\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes('{\"format\":\"1\"}');\n const first = await storage.publishEstate(bytes);\n const second = await storage.publishEstate(bytes);\n if (first.outcome !== \"created\" || second.outcome !== \"identical\") {\n throw new Error(\"estate idempotent publish failed\");\n }\n },\n },\n {\n name: \"concurrent identical creates report created exactly once\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"race-identical\");\n const id = encodeSqlBlob(bytes);\n const outcomes = await Promise.all(\n Array.from({ length: RACERS }, () => storage.publishState(id, bytes))\n );\n const created = outcomes.filter((o) => o.outcome === \"created\").length;\n if (created !== 1) {\n throw new Error(`${created} of ${RACERS} concurrent creates won`);\n }\n },\n },\n {\n name: \"concurrent conflicting creates keep one winner and refuse the rest\",\n run: async () => {\n const storage = createWriter();\n const id = encodeSqlBlob(utf8Bytes(\"race-conflicting\"));\n const candidates = Array.from({ length: RACERS }, (_, n) =>\n utf8Bytes(`{\"racer\":${n}}`)\n );\n const settled = await Promise.allSettled(\n candidates.map((bytes) => storage.publishState(id, bytes))\n );\n const winners = candidates.filter(\n (_, n) => settled[n]?.status === \"fulfilled\"\n );\n const refused = settled.filter(\n (result) =>\n result.status === \"rejected\" && isCorruption(result.reason)\n ).length;\n const stored = await storage.readState(id);\n if (\n winners.length !== 1 ||\n refused !== RACERS - 1 ||\n !(stored && bytesEqual(stored, winners[0]!))\n ) {\n throw new Error(\n `${winners.length} winners and ${refused} refusals of ${RACERS} conflicting creates`\n );\n }\n },\n },\n {\n name: \"absent artifacts read as null\",\n run: async () => {\n const storage = createWriter();\n const id = encodeSqlBlob(utf8Bytes(\"absent\"));\n const reads = await Promise.all([\n storage.readState(id),\n storage.readSnapshot(id),\n storage.readSql(id),\n ]);\n if (reads.some((bytes) => bytes !== null)) {\n throw new Error(\"an absent artifact read as bytes\");\n }\n },\n },\n {\n name: \"published artifacts are listed as soon as publish returns\",\n run: async () => {\n const storage = createWriter();\n const artifacts = Array.from({ length: LISTED }, (_, n) =>\n utf8Bytes(`listed-${n}`)\n );\n const ids = artifacts.map(encodeSqlBlob);\n for (const [n, id] of ids.entries()) {\n await storage.publishState(id, artifacts[n]!);\n await storage.publishSnapshot(id, artifacts[n]!);\n await storage.publishSql(id, artifacts[n]!);\n }\n const listings = await Promise.all([\n storage.listStates(),\n storage.listSnapshots(),\n storage.listSql(),\n ]);\n if (listings.some((listed) => ids.some((id) => !listed.includes(id)))) {\n throw new Error(\"a published artifact is missing from its listing\");\n }\n },\n },\n {\n name: \"a listed state's snapshot and SQL are already readable (manifest last)\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"manifest-last\");\n const hash = encodeSqlBlob(bytes);\n let published = false;\n const publishing = (async () => {\n await storage.publishSnapshot(hash, bytes);\n await storage.publishSql(hash, bytes);\n await storage.publishState(hash, bytes);\n })().finally(() => {\n published = true;\n });\n try {\n for (;;) {\n const settled = published;\n if ((await storage.listStates()).includes(hash)) break;\n if (settled) throw new Error(\"a published state is not listed\");\n }\n const [snapshot, sql] = await Promise.all([\n storage.readSnapshot(hash),\n storage.readSql(hash),\n ]);\n if (!(snapshot && sql)) {\n throw new Error(\"a listed state's artifacts are not readable yet\");\n }\n } finally {\n await publishing;\n }\n },\n },\n ];\n}\n","/**\n * In-memory estate writer for tests and conformance.\n * Conditional create: same hash + same bytes is identical; different bytes is corruption.\n */\n\nimport { MigrationError, VibORMErrorCode } from \"../../errors\";\nimport { bytesEqual } from \"../canonical-json\";\nimport { isSha256, type Sha256 } from \"../identity\";\nimport type { MigrationStorageWriter, PublishResult } from \"./contract\";\n\nexport class MemoryEstateStorage implements MigrationStorageWriter {\n private estate: Uint8Array | null = null;\n private readonly states = new Map<Sha256, Uint8Array>();\n private readonly snapshots = new Map<Sha256, Uint8Array>();\n private readonly sql = new Map<Sha256, Uint8Array>();\n\n async readEstate(): Promise<Uint8Array | null> {\n return this.estate ? this.estate.slice() : null;\n }\n\n async listStates(): Promise<readonly Sha256[]> {\n return [...this.states.keys()].sort();\n }\n\n async listSnapshots(): Promise<readonly Sha256[]> {\n return [...this.snapshots.keys()].sort();\n }\n\n async listSql(): Promise<readonly Sha256[]> {\n return [...this.sql.keys()].sort();\n }\n\n async readState(id: Sha256): Promise<Uint8Array | null> {\n const bytes = this.states.get(id);\n return bytes ? bytes.slice() : null;\n }\n\n async readSnapshot(hash: Sha256): Promise<Uint8Array | null> {\n const bytes = this.snapshots.get(hash);\n return bytes ? bytes.slice() : null;\n }\n\n async readSql(hash: Sha256): Promise<Uint8Array | null> {\n const bytes = this.sql.get(hash);\n return bytes ? bytes.slice() : null;\n }\n\n async publishEstate(bytes: Uint8Array): Promise<PublishResult> {\n if (this.estate && !bytesEqual(this.estate, bytes)) {\n throw new MigrationError(\n \"estate.json already exists with different bytes\",\n VibORMErrorCode.MIGRATION_CORRUPTION\n );\n }\n if (this.estate) return { outcome: \"identical\" };\n this.estate = bytes.slice();\n return { outcome: \"created\" };\n }\n\n async publishSnapshot(\n hash: Sha256,\n bytes: Uint8Array\n ): Promise<PublishResult> {\n return publishMap(this.snapshots, hash, bytes, \"snapshot\");\n }\n\n async publishSql(hash: Sha256, bytes: Uint8Array): Promise<PublishResult> {\n return publishMap(this.sql, hash, bytes, \"sql\");\n }\n\n async publishState(id: Sha256, bytes: Uint8Array): Promise<PublishResult> {\n if (!isSha256(id)) {\n throw new MigrationError(\n \"State id is not a SHA-256 digest\",\n VibORMErrorCode.MIGRATION_INVALID_ESTATE\n );\n }\n return publishMap(this.states, id, bytes, \"state\");\n }\n}\n\nfunction publishMap(\n store: Map<Sha256, Uint8Array>,\n key: Sha256,\n bytes: Uint8Array,\n label: string\n): PublishResult {\n const existing = store.get(key);\n if (existing) {\n if (!bytesEqual(existing, bytes)) {\n throw new MigrationError(\n `${label} ${key} already holds different bytes`,\n VibORMErrorCode.MIGRATION_CORRUPTION\n );\n }\n return { outcome: \"identical\" };\n }\n store.set(key, bytes.slice());\n return { outcome: \"created\" };\n}\n"],"mappings":"8QAWA,MAGM,aAAgB,GACpB,aAAiB,GACjB,EAAM,OAAS,EAAgB,qBAEjC,SAAgB,8BACd,EACgE,CAChE,MAAO,CACL,CACE,KAAM,oDACN,IAAK,SAAY,CACf,IAAM,EAAU,GAAc,CACxB,EAAQ,EAAU,QAAQ,CAC1B,EAAO,EAAc,EAAM,CAC3B,EAAQ,MAAM,EAAQ,WAAW,EAAM,EAAM,CAC7C,EAAS,MAAM,EAAQ,WAAW,EAAM,EAAM,CACpD,GAAI,EAAM,UAAY,WAAa,EAAO,UAAY,YACpD,MAAU,MAAM,4BAA4B,EAGjD,CACD,CACE,KAAM,+CACN,IAAK,SAAY,CACf,IAAM,EAAU,GAAc,CACxB,EAAQ,EAAU,QAAQ,CAC1B,EAAO,EAAc,EAAM,CACjC,MAAM,EAAQ,WAAW,EAAM,EAAM,CACrC,GAAI,CACF,MAAM,EAAQ,WAAW,EAAM,EAAU,QAAQ,CAAC,OAC3C,EAAO,CACd,GAAI,aAAa,EAAM,CAAE,OAE3B,MAAU,MAAM,+BAA+B,EAElD,CACD,CACE,KAAM,8CACN,IAAK,SAAY,CAGf,IADe,MADC,GAAc,CACD,YAAY,EAC9B,SAAW,EAAG,MAAU,MAAM,4BAA4B,EAExE,CACD,CACE,KAAM,mDACN,IAAK,SAAY,CACf,IAAM,EAAU,GAAc,CACxB,EAAQ,EAAU,iBAAiB,CACnC,EAAQ,MAAM,EAAQ,cAAc,EAAM,CAC1C,EAAS,MAAM,EAAQ,cAAc,EAAM,CACjD,GAAI,EAAM,UAAY,WAAa,EAAO,UAAY,YACpD,MAAU,MAAM,mCAAmC,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e,CACf,IAAM,EAAW,EAAM,IAAI,EAAI,CAC/B,GAAI,EAAU,CACZ,GAAI,CAAC,EAAW,EAAU,EAAM,CAC9B,MAAM,IAAI,EACR,GAAG,EAAM,GAAG,EAAI,gCAChB,EAAgB,qBACjB,CAEH,MAAO,CAAE,QAAS,YAAa,CAGjC,OADA,EAAM,IAAI,EAAK,EAAM,OAAO,CAAC,CACtB,CAAE,QAAS,UAAW"}
|
|
1
|
+
{"version":3,"file":"memory-gjKMy3Ql.mjs","names":[],"sources":["../src/migrations/storage/conformance.ts","../src/migrations/storage/memory.ts"],"sourcesContent":["/**\n * Reusable storage conformance suite. A writable driver that cannot pass\n * these tests is not a V1 estate owner.\n */\n\nimport { MigrationError, VibORMErrorCode } from \"../../errors\";\nimport { bytesEqual } from \"../canonical-json\";\nimport { utf8Bytes } from \"../identity\";\nimport { encodeSqlBlob } from \"../v1-parse\";\nimport type { MigrationStorageWriter } from \"./contract\";\n\nconst RACERS = 8;\nconst LISTED = 5;\n\nconst isCorruption = (error: unknown): boolean =>\n error instanceof MigrationError &&\n error.code === VibORMErrorCode.MIGRATION_CORRUPTION;\n\nexport function createStorageConformanceSuite(\n createWriter: () => MigrationStorageWriter\n): { readonly name: string; readonly run: () => Promise<void> }[] {\n return [\n {\n name: \"identical content-addressed publish is idempotent\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"hello\");\n const hash = encodeSqlBlob(bytes);\n const first = await storage.publishSql(hash, bytes);\n const second = await storage.publishSql(hash, bytes);\n if (first.outcome !== \"created\" || second.outcome !== \"identical\") {\n throw new Error(\"idempotent publish failed\");\n }\n },\n },\n {\n name: \"same hash with different bytes is corruption\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"hello\");\n const hash = encodeSqlBlob(bytes);\n await storage.publishSql(hash, bytes);\n try {\n await storage.publishSql(hash, utf8Bytes(\"other\"));\n } catch (error) {\n if (isCorruption(error)) return;\n }\n throw new Error(\"corrupt publish was accepted\");\n },\n },\n {\n name: \"listStates returns only committed manifests\",\n run: async () => {\n const storage = createWriter();\n const listed = await storage.listStates();\n if (listed.length !== 0) throw new Error(\"fresh writer is not empty\");\n },\n },\n {\n name: \"estate publish is idempotent for identical bytes\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes('{\"format\":\"1\"}');\n const first = await storage.publishEstate(bytes);\n const second = await storage.publishEstate(bytes);\n if (first.outcome !== \"created\" || second.outcome !== \"identical\") {\n throw new Error(\"estate idempotent publish failed\");\n }\n },\n },\n {\n name: \"concurrent identical creates report created exactly once\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"race-identical\");\n const id = encodeSqlBlob(bytes);\n const outcomes = await Promise.all(\n Array.from({ length: RACERS }, () => storage.publishState(id, bytes))\n );\n const created = outcomes.filter((o) => o.outcome === \"created\").length;\n if (created !== 1) {\n throw new Error(`${created} of ${RACERS} concurrent creates won`);\n }\n },\n },\n {\n name: \"concurrent conflicting creates keep one winner and refuse the rest\",\n run: async () => {\n const storage = createWriter();\n const id = encodeSqlBlob(utf8Bytes(\"race-conflicting\"));\n const candidates = Array.from({ length: RACERS }, (_, n) =>\n utf8Bytes(`{\"racer\":${n}}`)\n );\n const settled = await Promise.allSettled(\n candidates.map((bytes) => storage.publishState(id, bytes))\n );\n const winners = candidates.filter(\n (_, n) => settled[n]?.status === \"fulfilled\"\n );\n const refused = settled.filter(\n (result) =>\n result.status === \"rejected\" && isCorruption(result.reason)\n ).length;\n const stored = await storage.readState(id);\n if (\n winners.length !== 1 ||\n refused !== RACERS - 1 ||\n !(stored && bytesEqual(stored, winners[0]!))\n ) {\n throw new Error(\n `${winners.length} winners and ${refused} refusals of ${RACERS} conflicting creates`\n );\n }\n },\n },\n {\n name: \"absent artifacts read as null\",\n run: async () => {\n const storage = createWriter();\n const id = encodeSqlBlob(utf8Bytes(\"absent\"));\n const reads = await Promise.all([\n storage.readState(id),\n storage.readSnapshot(id),\n storage.readSql(id),\n ]);\n if (reads.some((bytes) => bytes !== null)) {\n throw new Error(\"an absent artifact read as bytes\");\n }\n },\n },\n {\n name: \"published artifacts are listed as soon as publish returns\",\n run: async () => {\n const storage = createWriter();\n const artifacts = Array.from({ length: LISTED }, (_, n) =>\n utf8Bytes(`listed-${n}`)\n );\n const ids = artifacts.map(encodeSqlBlob);\n for (const [n, id] of ids.entries()) {\n await storage.publishState(id, artifacts[n]!);\n await storage.publishSnapshot(id, artifacts[n]!);\n await storage.publishSql(id, artifacts[n]!);\n }\n const listings = await Promise.all([\n storage.listStates(),\n storage.listSnapshots(),\n storage.listSql(),\n ]);\n if (listings.some((listed) => ids.some((id) => !listed.includes(id)))) {\n throw new Error(\"a published artifact is missing from its listing\");\n }\n },\n },\n {\n name: \"a listed state's snapshot and SQL are already readable (manifest last)\",\n run: async () => {\n const storage = createWriter();\n const bytes = utf8Bytes(\"manifest-last\");\n const hash = encodeSqlBlob(bytes);\n let published = false;\n const publishing = (async () => {\n await storage.publishSnapshot(hash, bytes);\n await storage.publishSql(hash, bytes);\n await storage.publishState(hash, bytes);\n })().finally(() => {\n published = true;\n });\n try {\n for (;;) {\n const settled = published;\n if ((await storage.listStates()).includes(hash)) break;\n if (settled) throw new Error(\"a published state is not listed\");\n }\n const [snapshot, sql] = await Promise.all([\n storage.readSnapshot(hash),\n storage.readSql(hash),\n ]);\n if (!(snapshot && sql)) {\n throw new Error(\"a listed state's artifacts are not readable yet\");\n }\n } finally {\n await publishing;\n }\n },\n },\n ];\n}\n","/**\n * In-memory estate writer for tests and conformance.\n * Conditional create: same hash + same bytes is identical; different bytes is corruption.\n */\n\nimport { MigrationError, VibORMErrorCode } from \"../../errors\";\nimport { bytesEqual } from \"../canonical-json\";\nimport { isSha256, type Sha256 } from \"../identity\";\nimport type { MigrationStorageWriter, PublishResult } from \"./contract\";\n\nexport class MemoryEstateStorage implements MigrationStorageWriter {\n private estate: Uint8Array | null = null;\n private readonly states = new Map<Sha256, Uint8Array>();\n private readonly snapshots = new Map<Sha256, Uint8Array>();\n private readonly sql = new Map<Sha256, Uint8Array>();\n\n async readEstate(): Promise<Uint8Array | null> {\n return this.estate ? this.estate.slice() : null;\n }\n\n async listStates(): Promise<readonly Sha256[]> {\n return [...this.states.keys()].sort();\n }\n\n async listSnapshots(): Promise<readonly Sha256[]> {\n return [...this.snapshots.keys()].sort();\n }\n\n async listSql(): Promise<readonly Sha256[]> {\n return [...this.sql.keys()].sort();\n }\n\n async readState(id: Sha256): Promise<Uint8Array | null> {\n const bytes = this.states.get(id);\n return bytes ? bytes.slice() : null;\n }\n\n async readSnapshot(hash: Sha256): Promise<Uint8Array | null> {\n const bytes = this.snapshots.get(hash);\n return bytes ? bytes.slice() : null;\n }\n\n async readSql(hash: Sha256): Promise<Uint8Array | null> {\n const bytes = this.sql.get(hash);\n return bytes ? bytes.slice() : null;\n }\n\n async publishEstate(bytes: Uint8Array): Promise<PublishResult> {\n if (this.estate && !bytesEqual(this.estate, bytes)) {\n throw new MigrationError(\n \"estate.json already exists with different bytes\",\n VibORMErrorCode.MIGRATION_CORRUPTION\n );\n }\n if (this.estate) return { outcome: \"identical\" };\n this.estate = bytes.slice();\n return { outcome: \"created\" };\n }\n\n async publishSnapshot(\n hash: Sha256,\n bytes: Uint8Array\n ): Promise<PublishResult> {\n return publishMap(this.snapshots, hash, bytes, \"snapshot\");\n }\n\n async publishSql(hash: Sha256, bytes: Uint8Array): Promise<PublishResult> {\n return publishMap(this.sql, hash, bytes, \"sql\");\n }\n\n async publishState(id: Sha256, bytes: Uint8Array): Promise<PublishResult> {\n if (!isSha256(id)) {\n throw new MigrationError(\n \"State id is not a SHA-256 digest\",\n VibORMErrorCode.MIGRATION_INVALID_ESTATE\n );\n }\n return publishMap(this.states, id, bytes, \"state\");\n }\n}\n\nfunction publishMap(\n store: Map<Sha256, Uint8Array>,\n key: Sha256,\n bytes: Uint8Array,\n label: string\n): PublishResult {\n const existing = store.get(key);\n if (existing) {\n if (!bytesEqual(existing, bytes)) {\n throw new MigrationError(\n `${label} ${key} already holds different bytes`,\n VibORMErrorCode.MIGRATION_CORRUPTION\n );\n }\n return { outcome: \"identical\" };\n }\n store.set(key, bytes.slice());\n return { outcome: \"created\" };\n}\n"],"mappings":"8QAWA,MAGM,aAAgB,GACpB,aAAiB,GACjB,EAAM,OAAS,EAAgB,qBAEjC,SAAgB,8BACd,EACgE,CAChE,MAAO,CACL,CACE,KAAM,oDACN,IAAK,SAAY,CACf,IAAM,EAAU,GAAc,CACxB,EAAQ,EAAU,QAAQ,CAC1B,EAAO,EAAc,EAAM,CAC3B,EAAQ,MAAM,EAAQ,WAAW,EAAM,EAAM,CAC7C,EAAS,MAAM,EAAQ,WAAW,EAAM,EAAM,CACpD,GAAI,EAAM,UAAY,WAAa,EAAO,UAAY,YACpD,MAAU,MAAM,4BAA4B,EAGjD,CACD,CACE,KAAM,+CACN,IAAK,SAAY,CACf,IAAM,EAAU,GAAc,CACxB,EAAQ,EAAU,QAAQ,CAC1B,EAAO,EAAc,EAAM,CACjC,MAAM,EAAQ,WAAW,EAAM,EAAM,CACrC,GAAI,CACF,MAAM,EAAQ,WAAW,EAAM,EAAU,QAAQ,CAAC,OAC3C,EAAO,CACd,GAAI,aAAa,EAAM,CAAE,OAE3B,MAAU,MAAM,+BAA+B,EAElD,CACD,CACE,KAAM,8CACN,IAAK,SAAY,CAGf,IADe,MADC,GAAc,CACD,YAAY,EAC9B,SAAW,EAAG,MAAU,MAAM,4BAA4B,EAExE,CACD,CACE,KAAM,mDACN,IAAK,SAAY,CACf,IAAM,EAAU,GAAc,CACxB,EAAQ,EAAU,iBAAiB,CACnC,EAAQ,MAAM,EAAQ,cAAc,EAAM,CAC1C,EAAS,MAAM,EAAQ,cAAc,EAAM,CACjD,GAAI,EAAM,UAAY,WAAa,EAAO,UAAY,YACpD,MAAU,MAAM,mCAAmC,EAGxD,CACD,CACE,KAAM,2DACN,IAAK,SAAY,CACf,IAAM,EAAU,GAAc,CACxB,EAAQ,EAAU,iBAAiB,CACnC,EAAK,EAAc,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I,EACR,GAAG,EAAM,GAAG,EAAI,gCAChB,EAAgB,qBACjB,CAEH,MAAO,CAAE,QAAS,YAAa,CAGjC,OADA,EAAM,IAAI,EAAK,EAAM,OAAO,CAAC,CACtB,CAAE,QAAS,UAAW"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{t,y as n}from"./base-z-cH5ZBI.mjs";import{p as r,t as i}from"./validation--qS7OPmg.mjs";import{t as a}from"./routed-operations-wytpbYKv.mjs";import{i as o,o as s}from"./value-guards-CBuxSC66.mjs";import{r as c}from"./extension-CGepsF-p.mjs";import{et as l}from"./native-types-DspZ0Z5E.mjs";import{i as u}from"./schema-MB-pPNTO.mjs";import{t as d}from"./raw-uaVIxHcE.mjs";function bindArguments(e,t,n,r){let i={...r};for(let[r,a]of Object.entries(n)){let n=e.find(e=>e.name===r&&e.extension===t&&e.bound===!0);n===void 0&¬Bound(t,r),i[r]=n.admit(n,a)}return i}function notBound(e,t){return c(`Extension "${e}" binds argument "${t}", which it does not declare with bound(schema).`,e)}function argsOwnedBy(e,t){let n={};for(let r of t)e&&Object.hasOwn(e,r)&&(n[r]=e[r]);return n}const closedValues=e=>(t,n,r,i)=>{if(e.some(e=>e===n))return n;throw invalidArgument(t,r,i,[`must be one of ${e.map(e=>JSON.stringify(e)).join(`, `)}`])},checkedBy=e=>(n,r,i,a)=>{let o;try{o=e[`~standard`].validate(r)}catch(e){throw e instanceof t?e:validatorFailure(n,i,a,`threw`,e)}if(`then`in o)throw l(o),validatorFailure(n,i,a,`returned a promise`,TypeError(`Argument validators must return synchronously`));if(o.issues)throw invalidArgument(n,i,a,o.issues.map(e=>e.message));return o.value};function invalidArgument(e,t,n,r){return new i(n===void 0?{kind:`schema-builder`,builder:`$bind`,path:e.name}:{kind:`operation`,operation:n,model:t},r.map(t=>({path:e.name,message:`Argument "${e.name}" ${t}`})),{meta:{model:t,extension:e.extension}})}function validatorFailure(e,t,i,a,o){return new r(`Extension "${e.extension}" argument "${e.name}" validator for ${i===void 0?`$bind`:`${t}.${i}`} ${a}.`,{cause:n(o),meta:{model:t,operation:i}})}function appendArguments(e,t){let n=[...e?.all??[],...t],r=n.find(e=>e.bind)?.bind,i=new Set;for(let{name:e,extension:t}of n)e===`named`&&c(`Extension "${t}" declares argument "named", which VibORM reserves for named statements.`,t),i.has(e)&&c(`Extension "${t}" declares argument "${e}", which extension "${n.find(t=>t.name===e)?.extension}" already declares.`,t),i.add(e);let a=new Map,placed=(e,t)=>u(a,`${e}\u0000${t}`,()=>n.filter(({on:n,models:r})=>(n===void 0||n.includes(t))&&(r===void 0||r.includes(e))));return{names:i,all:n,placed,owned:argsOwnedBy,admit:(e,t,n,r,i)=>{let a=placed(e,t);if(a.length===0)return;if(typeof r!=`object`||!r)return{args:r,values:void 0};let o,s;for(let t of a){let{name:a,required:c}=t,l;t.bound!==!0&&Object.hasOwn(r,a)&&(l=r[a],s??={...r},delete s[a]);let u=l===void 0?i?.[a]??t.default:t.admit(t,l,e,n);if(u!==void 0)(o??={})[a]=u;else if(c===!0||c?.includes(e))throw invalidArgument(t,e,n,[`is required`])}return{args:s??r,values:o}},bind:r&&((...e)=>r(n,...e))}}const f=Object.freeze(Object.create(null)),p=Object.freeze({client:()=>f,model:()=>f,force:()=>void 0}),m=new Set([`$driver`,`$schema`,`$transaction`,`$connect`,`$disconnect`,`$extends`]);function addMethods(e,t,n,r,i,a=``){let s=Object.assign(Object.create(null),e);for(let[e,c]of t){let t=`${i} method "${a}${e}"`;o(c)||n(`${t} must be a function`),(Object.hasOwn(s,e)||r(e))&&n(`${t} collides with the existing ${i} surface`),s[e]=c}return Object.freeze(s)}const clientLayer=({prior:t,answer:n,refuse:r})=>{let i,a=e(()=>i??=addMethods(t.client(),Object.entries(n()),r,e=>m.has(e)||Object.hasOwn(d,e),`client`),`methods`);return{client:a,model:t.model,force:()=>{t.force(),a()}}},modelLayer=({prior:t,answer:n,scope:r,refuse:i})=>{let c=new Map,l=e(e=>{let l=c.get(e);if(l===void 0){let u=n()[e],d=Reflect.get(r(),e),f=o(u)?Reflect.apply(u,void 0,[d,r()]):u;f!==void 0&&!s(f)&&i(`methods.${e} must be an object of methods`),l=addMethods(t.model(e),Object.entries(f??{}).map(([e,t])=>[e,o(t)?(...e)=>Reflect.apply(t,d,e):t]),i,e=>e===`then`||e===`$rows`||a.has(e),`model`,`${e}.`),c.set(e,l)}return l},`methods`);return{client:t.client,model:l,force:()=>{t.force();for(let e of Object.keys(n()))l(e)}}};function methodsPart(e,t,n){return{join({next:r,name:i,schema:a}){let o=r.methods;r.methods={bind:r=>{let l=o?.bind(r)??p,refuse=e=>c(`Extension "${i}" ${e}.`,i),u,scopeOf=()=>u??=r(l,i),d;return t({prior:l,answer:()=>{if(d!==void 0)return d;let t=Reflect.apply(e,void 0,[scopeOf()]);s(t)||refuse(`methods factory must return an object`);for(let e of Object.keys(t)){let t=n(e,a);t&&refuse(`methods returned "${e}", ${t}`)}return d=t,t},scope:scopeOf,refuse})},bindNone:(e,t,n)=>{for(let n of Object.keys(t))notBound(e,n);return{...n}}}}}}function methods(e){return methodsPart(e,clientLayer,e=>e.startsWith(`$`)?void 0:`which is not a $ client method (a model's are written with modelMethods)`)}function modelMethods(e){return methodsPart(e,modelLayer,(e,t)=>Object.hasOwn(t,e)?void 0:`which is not a model`)}export{checkedBy as a,bindArguments as i,modelMethods as n,closedValues as o,appendArguments as r,methods as t};
|
|
2
|
+
//# sourceMappingURL=methods-part-DoTrY6b9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"methods-part-DoTrY6b9.mjs","names":["methods"],"sources":["../src/extensions/arguments.ts","../src/extensions/methods.ts","../src/extensions/methods-part.ts"],"sourcesContent":["/**\n * Arguments: what `args` declares, placed on a chain and admitted once per\n * call. Brought by `args` alone: an extension that declares no argument\n * carries none of it.\n */\n\nimport { QueryError, ValidationError, VibORMError } from \"@errors\";\nimport { memo } from \"@query-engine/raptor3/shared/schema\";\nimport type { Operation } from \"@query-engine/types\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { discardAsyncValidationResult } from \"@validation/parse-failure\";\nimport { errorCause } from \"../errors/diagnostic-safety\";\nimport { extensionError } from \"./chain\";\nimport type { ResolvedArgs } from \"./chain-state\";\n\ntype ArgLiteral = string | number | boolean;\n\n/**\n * One argument an extension declares. Its values are a closed list or a\n * Standard Schema, and `admit` is the code that checks one, brought by the\n * word that declared it (`oneOf`, or `accepts` and `bound`), so a chain of\n * closed arguments carries no Standard Schema admission. `on` names the\n * operations that accept it (every operation when absent), `models` the\n * models (every model when absent). With `required`, a call on one of those\n * operations that does not pass it is refused: on every model that accepts\n * it, or on the models it lists. With `bound`, it is accepted only from a\n * binding (the client scope's `$bind`, which `bind` runs), never from a\n * call's arguments, so a call that passes it is refused as passing an\n * unknown key. With `volatile`, a call that holds a value of it has no key\n * (`key(run)`): a read that holds one is never served from a store nor kept\n * in one.\n */\nexport interface ArgDeclaration {\n /** A closed argument's values; absent for a Standard Schema's. */\n readonly oneOf?: readonly ArgLiteral[];\n readonly admit: AdmitValue;\n readonly on?: readonly string[];\n readonly models?: readonly string[];\n readonly required?: true | readonly string[];\n /** The value a call that passes none reads. */\n readonly default?: ArgLiteral;\n readonly bound?: boolean;\n readonly bind?: typeof bindArguments;\n readonly volatile?: boolean;\n}\n\n/** One value admitted for a call's (model, operation), or, without them, a binding. */\ntype AdmitValue = (\n argument: ResolvedArg,\n value: unknown,\n model?: string,\n operation?: Operation\n) => unknown;\n\n/**\n * One argument of a chain: its declaration as written, its name and the\n * extension that declares it. Its declaration alone places it: no other part\n * moves it.\n */\nexport type ResolvedArg = ArgDeclaration & {\n readonly name: string;\n readonly extension: string;\n};\n\n/** The arguments one call admitted, by name; one it did not pass is absent. */\nexport type AdmittedArgs = Readonly<Record<string, unknown>>;\n\nexport interface ArgAdmission {\n /** The call's arguments without the chain's; the input itself when it passed none. */\n readonly args: Record<string, unknown>;\n /** `undefined` when the call admitted no value. */\n readonly values: AdmittedArgs | undefined;\n}\n\n/**\n * The values a view binds after one extension binds its own arguments: each\n * admitted once, over the values the view already binds, a value replacing\n * an earlier one. Brought by `bound`: only a `bound` argument is bound.\n */\nexport function bindArguments(\n all: readonly ResolvedArg[],\n extension: string,\n values: Readonly<Record<string, unknown>>,\n previous: AdmittedArgs | undefined\n): AdmittedArgs {\n const next: Record<string, unknown> = { ...previous };\n for (const [name, raw] of Object.entries(values)) {\n const argument = all.find(\n (candidate) =>\n candidate.name === name &&\n candidate.extension === extension &&\n candidate.bound === true\n );\n if (argument === undefined) notBound(extension, name);\n next[name] = argument.admit(argument, raw);\n }\n return next;\n}\n\n/** The refusal of a `$bind` naming an argument its extension does not declare `bound`. */\nexport function notBound(extension: string, name: string): never {\n return extensionError(\n `Extension \"${extension}\" binds argument \"${name}\", which it does not declare with bound(schema).`,\n extension\n );\n}\n\n/** One extension's own admitted arguments, as its parts see them (`c.values`). */\nfunction argsOwnedBy(\n admitted: AdmittedArgs | undefined,\n names: readonly string[]\n): AdmittedArgs {\n const owned: Record<string, unknown> = {};\n for (const name of names)\n if (admitted && Object.hasOwn(admitted, name)) owned[name] = admitted[name];\n return owned;\n}\n\n/** What admits a value of one of `values`, brought by `oneOf`. */\nexport const closedValues =\n (values: readonly ArgLiteral[]): AdmitValue =>\n (argument, value, model, operation) => {\n if (values.some((allowed) => allowed === value)) return value;\n throw invalidArgument(argument, model, operation, [\n `must be one of ${values.map((allowed) => JSON.stringify(allowed)).join(\", \")}`,\n ]);\n };\n\n/** What admits a value `schema` checks, brought by `accepts` and `bound`. */\nexport const checkedBy =\n (schema: StandardSchemaV1): AdmitValue =>\n (argument, value, model, operation) => {\n let result: ReturnType<StandardSchemaV1[\"~standard\"][\"validate\"]>;\n try {\n result = schema[\"~standard\"].validate(value);\n } catch (cause) {\n // A validator may own its typed failure; anything else is a failure of\n // extension code, as a throwing first moment is.\n if (cause instanceof VibORMError) throw cause;\n throw validatorFailure(argument, model, operation, \"threw\", cause);\n }\n if (\"then\" in result) {\n // The refused promise is still live; without a handler its rejection\n // would surface as an unhandled rejection (D-37).\n discardAsyncValidationResult(result);\n throw validatorFailure(\n argument,\n model,\n operation,\n \"returned a promise\",\n new TypeError(\"Argument validators must return synchronously\")\n );\n }\n if (result.issues)\n throw invalidArgument(\n argument,\n model,\n operation,\n result.issues.map((issue) => issue.message)\n );\n return result.value;\n };\n\nfunction invalidArgument(\n argument: ResolvedArg,\n model: string | undefined,\n operation: Operation | undefined,\n messages: readonly string[]\n): ValidationError {\n return new ValidationError(\n operation === undefined\n ? { kind: \"schema-builder\", builder: \"$bind\", path: argument.name }\n : { kind: \"operation\", operation, model },\n messages.map((message) => ({\n path: argument.name,\n message: `Argument \"${argument.name}\" ${message}`,\n })),\n { meta: { model, extension: argument.extension } }\n );\n}\n\nfunction validatorFailure(\n argument: ResolvedArg,\n model: string | undefined,\n operation: Operation | undefined,\n failure: string,\n cause: unknown\n): QueryError {\n return new QueryError(\n `Extension \"${argument.extension}\" argument \"${argument.name}\" validator for ${operation === undefined ? \"$bind\" : `${model}.${operation}`} ${failure}.`,\n { cause: errorCause(cause), meta: { model, operation } }\n );\n}\n\n/**\n * The chain's arguments with one extension's added, each (model, operation)\n * listing the ones it accepts the first time a call asks. One name, one\n * argument: a call's value is read once and admitted against one\n * declaration, so a second declaration of a name would refuse every call\n * that passes either value, and a binding would answer for both.\n */\nexport function appendArguments(\n previous: ResolvedArgs | undefined,\n declared: readonly ResolvedArg[]\n): ResolvedArgs {\n const all = [...(previous?.all ?? []), ...declared];\n const binder = all.find((argument) => argument.bind)?.bind;\n const names = new Set<string>();\n for (const { name, extension } of all) {\n // `named` is core's own call option (named statements): no extension takes it.\n if (name === \"named\")\n extensionError(\n `Extension \"${extension}\" declares argument \"named\", which VibORM reserves for named statements.`,\n extension\n );\n if (names.has(name))\n extensionError(\n `Extension \"${extension}\" declares argument \"${name}\", which extension \"${all.find((argument) => argument.name === name)?.extension}\" already declares.`,\n extension\n );\n names.add(name);\n }\n const lists = new Map<string, readonly ResolvedArg[]>();\n const placed = (model: string, operation: string): readonly ResolvedArg[] => {\n const key = `${model}\\u0000${operation}`;\n return memo(lists, key, () =>\n all.filter(\n ({ on, models }) =>\n (on === undefined || on.includes(operation)) &&\n (models === undefined || models.includes(model))\n )\n );\n };\n return {\n names,\n all,\n placed,\n owned: argsOwnedBy,\n /**\n * Take every argument placed on this operation out of the call's\n * arguments and admit each once, before any first moment runs. A key\n * naming an argument placed elsewhere, or a bound one, stays in the\n * arguments, where core validation refuses it as an unknown key. An\n * argument the call did not pass takes the value its view binds, else\n * its default; without either it is refused where it is required.\n */\n admit: (\n model: string,\n placement: string,\n operation: Operation,\n input: Record<string, unknown>,\n bound: AdmittedArgs | undefined\n ): ArgAdmission | undefined => {\n const list = placed(model, placement);\n if (list.length === 0) return undefined;\n // Arguments that are not an object hold no extension argument: core\n // validation refuses them as it does on a client without extensions.\n if (typeof input !== \"object\" || input === null) {\n return { args: input, values: undefined };\n }\n let values: Record<string, unknown> | undefined;\n let args: Record<string, unknown> | undefined;\n for (const argument of list) {\n const { name, required } = argument;\n let raw: unknown;\n if (argument.bound !== true && Object.hasOwn(input, name)) {\n raw = input[name];\n args ??= { ...input };\n delete args[name];\n }\n // A bound value was admitted once, when its view was bound.\n const value =\n raw === undefined\n ? (bound?.[name] ?? argument.default)\n : argument.admit(argument, raw, model, operation);\n if (value !== undefined) (values ??= {})[name] = value;\n else if (required === true || required?.includes(model)) {\n throw invalidArgument(argument, model, operation, [\"is required\"]);\n }\n }\n return { args: args ?? input, values };\n },\n // Brought by `bound`: a chain that declares no bound argument binds none.\n bind: binder && ((...binding) => binder(all, ...binding)),\n };\n}\n","import type { TransactionClient, VibORMConfig } from \"@client/client\";\nimport {\n RAW_METHOD_NAMES,\n type RawSurface,\n type RowsFragment,\n} from \"@client/raw\";\nimport type { ClientSchema } from \"@client/schema-links\";\nimport type {\n Client,\n ClientRowsContext,\n ComputedOperation,\n ComputedOperations,\n Schema,\n StampedOperation,\n StampedOperations,\n} from \"@client/types\";\nimport type { ModelSql } from \"@query-engine/raptor3/shared/insert-value\";\nimport { ROUTED_OPERATIONS } from \"@query-engine/routed-operations\";\nimport { isFunction, isRecord } from \"@validation/value-guards\";\nimport { type AdmittedArgs, notBound } from \"./arguments\";\nimport type { ExtensionPart } from \"./chain\";\nimport { extensionError } from \"./chain\";\nimport type { NoArguments } from \"./contract\";\nimport type { MergeResultFields } from \"./result-types\";\n\ntype NoMethods = Record<never, never>;\ntype RuntimeExtensionMethodFunction = (...args: never[]) => unknown;\n\ndeclare const extensionResultConsumerState: unique symbol;\nexport interface ExtensionResultConsumerState {\n readonly [extensionResultConsumerState]: true;\n}\n\n/** The only static facts accumulated while extensions are chained. */\nexport interface ClientExtensionState<\n ClientMethods extends object = NoMethods,\n ModelMethods extends object = NoMethods,\n ResultConsumerState extends\n | ExtensionResultConsumerState\n | undefined = undefined,\n Arguments extends object = NoArguments,\n Filtered extends string = never,\n Defaults = never,\n Fields extends object = Record<never, never>,\n> {\n readonly client: ClientMethods;\n readonly models: ModelMethods;\n readonly resultConsumer: ResultConsumerState;\n /** The arguments the chain declares: each one's values and placement. */\n readonly args: Arguments;\n /** The models whose rows the chain's rules filter: a relation read can find none. */\n readonly filtered: Filtered;\n /** The fields the chain's `defaults` write on a create, which a caller no longer writes. */\n readonly defaults: Defaults;\n /** The fields the chain's `fields` compute, per model key, and their types. */\n readonly fields: Fields;\n}\n\nexport type EmptyClientExtensionState = ClientExtensionState;\n\n/** What every extension state is: the widest of each fact. */\nexport type ExtensionStateConstraint = ClientExtensionState<\n object,\n object,\n ExtensionResultConsumerState | undefined,\n object,\n string,\n unknown,\n object\n>;\n\n/** Whether an earlier extension was typed against result-bearing delegates. */\ntype HasResultConsumingExtension<X extends ExtensionStateConstraint> = [\n X[\"resultConsumer\"],\n] extends [undefined]\n ? false\n : [X[\"resultConsumer\"]] extends [ExtensionResultConsumerState]\n ? true\n : false;\n\ndeclare const delegateState: unique symbol;\n/**\n * Declaration-only: what a result read on a delegate of a chain that adds\n * model methods depends on (its client's config, the models the chain's\n * rules filter, its computed fields, the model), so a method typed with a\n * `this` parameter reads its result from the client it is called on\n * (`DelegateOperationResult`), whatever the chain added after it. Nothing\n * else of the extension state: a later step that changes none of these (the\n * cache) keeps the client assignable to the one before it. No property is\n * installed at runtime.\n */\nexport interface DelegateState<C, Rows, Result, ModelName> {\n readonly [delegateState]?: readonly [C, Rows, Result, ModelName];\n}\n\ntype MethodsForModel<\n X extends ExtensionStateConstraint,\n ModelName extends PropertyKey,\n> = ModelName extends keyof X[\"models\"] ? X[\"models\"][ModelName] : NoMethods;\n\n/**\n * The link, on every delegate of a chain that adds model methods: decided by\n * the extension state alone, so a client generic over its schema without\n * them (the empty state) compares as before.\n */\ntype DelegateLink<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n ModelName extends PropertyKey,\n> = [keyof X[\"models\"]] extends [never]\n ? unknown\n : DelegateState<C, X[\"filtered\"], X[\"fields\"], ModelName>;\n\n/**\n * One model's delegate after the chain's methods and arguments. On a chain\n * that writes `defaults` on a create, its writes may leave out the fields the chain\n * writes on a create.\n */\nexport type ExtensionModelDelegate<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n ModelName extends keyof ClientSchema<C>,\n> = ([X[\"defaults\"]] extends [never]\n ? Client<C, ClientRowsContext<C, X[\"filtered\"]>, X[\"args\"]>[ModelName]\n : Omit<\n Client<C, ClientRowsContext<C, X[\"filtered\"]>, X[\"args\"]>[ModelName],\n StampedOperation\n > &\n StampedOperations<\n C,\n ClientRowsContext<C, X[\"filtered\"]>,\n X[\"args\"],\n X[\"defaults\"],\n ModelName\n >) &\n MethodsForModel<X, ModelName> &\n DelegateLink<C, X, ModelName> &\n ModelRows;\n\n/** The core member every model delegate has beside its operations. */\ninterface ModelRows {\n /**\n * The rows of this model this client may read, as a `FROM` item of a\n * tagged `$queryRaw` named `alias`: a derived table filtered by the row\n * domain a `findMany` of this model on this client takes (permissions,\n * soft delete, bound arguments). Refused anywhere else.\n *\n * @example\n * ```ts\n * await db.$as(actor).$queryRaw`\n * SELECT p.id FROM ${db.$as(actor).page.$rows(\"p\")} WHERE p.title LIKE ${q}\n * `;\n * ```\n */\n $rows(alias: string): RowsFragment;\n /**\n * This model's names and values as this client's statements spell them:\n * its table, its columns, a value bound as one of its fields, and the rows\n * a call may see as a condition. For a fragment you write by hand and hand\n * to a model operation (a `computed` value, a filter's expression).\n */\n readonly $sql: ModelSql;\n}\n\n/**\n * One model's delegate on a chain that declares `fields`: its projecting\n * operations rebuilt so `select` and `omit` name the computed fields and the\n * rows carry them. A chain without `fields` never reaches this type.\n */\ntype ComputedModelDelegate<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n ModelName extends keyof ClientSchema<C>,\n> = Omit<ExtensionModelDelegate<C, X, ModelName>, ComputedOperation> &\n ComputedOperations<\n C,\n ClientRowsContext<C, X[\"filtered\"]>,\n X[\"args\"],\n X[\"defaults\"],\n ModelName,\n X[\"fields\"]\n >;\n\n/**\n * Model delegates after the methods contributed by the current chain. The\n * always-true test is deliberate: for a client generic over its config it\n * stays deferred, so the model map adds no index signature to that client and\n * its `$` members stay reachable inside a body generic over `C`. A chain\n * that declares `fields` is told apart here, once per client.\n */\nexport type ExtensionModelClient<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n> = [keyof C[\"schema\"]] extends [PropertyKey]\n ? [keyof X[\"fields\"]] extends [never]\n ? {\n [ModelName in keyof ClientSchema<C>]: ExtensionModelDelegate<\n C,\n X,\n ModelName\n >;\n }\n : {\n [ModelName in keyof ClientSchema<C>]: ComputedModelDelegate<\n C,\n X,\n ModelName\n >;\n }\n : unknown;\n\n/** The surface given to one client-method factory. */\nexport type ExtensionClientScope<\n C extends VibORMConfig,\n X extends ExtensionStateConstraint,\n> = ExtensionModelClient<C, X> &\n RawSurface &\n X[\"client\"] & {\n readonly $schema: ClientSchema<C>;\n readonly $transaction: TransactionClient<C, X>[\"$transaction\"];\n /**\n * The client this scope's methods are called on, its calls admitting\n * these values of this extension's own arguments as if passed (a\n * `bound: true` argument only from here). Its type is that client's,\n * which only the method knows: declare it with a `this` parameter,\n * `$with<Self>(this: Self, value: Value): Self`, outside the returned\n * literal (inside it, the factory's contextual type makes `Self` void).\n */\n readonly $bind: (values: Readonly<Record<string, unknown>>) => unknown;\n };\n\nexport type MergeModelMethods<Left extends object, Right extends object> = {\n readonly [ModelName in\n | keyof Left\n | keyof Right]: (ModelName extends keyof Left\n ? Left[ModelName]\n : NoMethods) &\n (ModelName extends keyof Right ? Right[ModelName] : NoMethods);\n};\n\n/** Incoming facts keep their nominal bit derivation inside this named state. */\nexport interface AddedExtensionState<\n ClientMethods extends object,\n ModelMethods extends object,\n Arguments extends object,\n Filtered extends string,\n Defaults,\n ConsumerContext extends string,\n // Defaulted: 1.3.3 exported this state with six parameters.\n Fields extends object = Record<never, never>,\n> extends ExtensionStateConstraint {\n readonly client: ClientMethods;\n readonly models: ModelMethods;\n readonly resultConsumer: ConsumerContext extends \"result-consuming\"\n ? ExtensionResultConsumerState\n : undefined;\n readonly args: Arguments;\n readonly filtered: Filtered;\n readonly defaults: Defaults;\n readonly fields: Fields;\n}\n\n/** Accumulate the same seven facts lazily, without retaining callback definitions. */\nexport interface ChainedExtensionState<\n X extends ExtensionStateConstraint,\n Added extends ExtensionStateConstraint,\n> extends ExtensionStateConstraint {\n readonly client: X[\"client\"] & Added[\"client\"];\n readonly models: MergeModelMethods<X[\"models\"], Added[\"models\"]>;\n readonly resultConsumer: HasResultConsumingExtension<Added> extends true\n ? ExtensionResultConsumerState\n : X[\"resultConsumer\"];\n readonly args: X[\"args\"] & Added[\"args\"];\n readonly filtered: X[\"filtered\"] | Added[\"filtered\"];\n readonly defaults: X[\"defaults\"] | Added[\"defaults\"];\n readonly fields: MergeResultFields<X[\"fields\"], Added[\"fields\"]>;\n}\n\ntype MethodRecord = Readonly<Record<string, RuntimeExtensionMethodFunction>>;\n\n/**\n * The methods a view answers after some prefix of its chain: its client\n * methods, and one model's. Each is computed the first time it is read.\n */\nexport interface ExtensionMethods {\n readonly client: () => MethodRecord;\n readonly model: (model: string) => MethodRecord;\n}\n\n/** A view's methods, and what invokes every factory of its chain in order. */\ntype BoundExtensionMethods = ExtensionMethods & {\n readonly force: () => void;\n};\n\nconst NO_METHODS: MethodRecord = /* @__PURE__ */ Object.freeze(\n Object.create(null)\n);\nconst NO_LAYER: BoundExtensionMethods = /* @__PURE__ */ Object.freeze({\n client: () => NO_METHODS,\n model: () => NO_METHODS,\n force: () => undefined,\n});\n\nconst CORE_CLIENT_METHODS = new Set([\n \"$driver\",\n \"$schema\",\n \"$transaction\",\n \"$connect\",\n \"$disconnect\",\n \"$extends\",\n]);\n\n/**\n * The methods before one extension with its own added, each a function and\n * each name (`at` the model's, for a model method) checked against what the\n * view already answers.\n */\nfunction addMethods(\n previous: MethodRecord,\n added: readonly (readonly [string, unknown])[],\n refuse: (problem: string) => never,\n collides: (name: string) => boolean,\n surface: \"client\" | \"model\",\n at = \"\"\n): MethodRecord {\n const methods: Record<string, RuntimeExtensionMethodFunction> = Object.assign(\n Object.create(null),\n previous\n );\n for (const [name, method] of added) {\n const label = `${surface} method \"${at}${name}\"`;\n if (!isFunction(method)) refuse(`${label} must be a function`);\n if (Object.hasOwn(methods, name) || collides(name))\n refuse(`${label} collides with the existing ${surface} surface`);\n methods[name] = method;\n }\n return Object.freeze(methods);\n}\n\n/**\n * What one factory's methods add to a view, given the view's methods before\n * it: brought by the builder (`methods` its client methods, `modelMethods`\n * its model methods), so an extension carries only the half it writes. Its\n * `force` forces the view before it first.\n */\ntype MethodsLayer = (made: {\n readonly prior: BoundExtensionMethods;\n /** The factory's answer, once per view, each key checked by `owns`. */\n readonly answer: () => Readonly<Record<string, unknown>>;\n readonly scope: () => object;\n readonly refuse: (problem: string) => never;\n}) => BoundExtensionMethods;\n\n/** `methods`' half: the `$` client methods its factory returns. */\nexport const clientLayer: MethodsLayer = ({ prior, answer, refuse }) => {\n let client: MethodRecord | undefined;\n const methods = () =>\n (client ??= addMethods(\n prior.client(),\n Object.entries(answer()),\n refuse,\n (method) =>\n CORE_CLIENT_METHODS.has(method) ||\n Object.hasOwn(RAW_METHOD_NAMES, method),\n \"client\"\n ));\n return {\n client: methods,\n model: prior.model,\n force: () => {\n prior.force();\n methods();\n },\n };\n};\n\n/**\n * `modelMethods`' half: each model's methods, made the first time the model\n * is read on a view; a model's entry may be a function of its delegate and\n * the scope, and a model method is called with `this` equal to its delegate.\n */\nexport const modelLayer: MethodsLayer = ({ prior, answer, scope, refuse }) => {\n const models = new Map<string, MethodRecord>();\n const methods = (model: string) => {\n let made = models.get(model);\n if (made === undefined) {\n const given = answer()[model];\n const delegate: unknown = Reflect.get(scope(), model);\n const own: unknown = isFunction(given)\n ? Reflect.apply(given, undefined, [delegate, scope()])\n : given;\n if (own !== undefined && !isRecord(own))\n refuse(`methods.${model} must be an object of methods`);\n made = addMethods(\n prior.model(model),\n Object.entries(own ?? {}).map(([method, fn]) => [\n method,\n isFunction(fn)\n ? (...args: unknown[]) => Reflect.apply(fn, delegate, args)\n : fn,\n ]),\n refuse,\n (method) =>\n method === \"then\" ||\n method === \"$rows\" ||\n ROUTED_OPERATIONS.has(method),\n \"model\",\n `${model}.`\n );\n models.set(model, made);\n }\n return made;\n };\n return {\n client: prior.client,\n model: methods,\n force: () => {\n prior.force();\n for (const key of Object.keys(answer())) methods(key);\n },\n };\n};\n\n/** A `methods` factory as its part keeps it. */\ntype RuntimeMethodsFactory = (scope: never) => unknown;\n\n/** A chain's methods, and what binds one view's methods. */\nexport interface ExtensionMethodsState {\n readonly bind: (\n createScope: (prior: ExtensionMethods, extension: string) => object\n ) => BoundExtensionMethods;\n /**\n * A factory scope's `$bind` on a chain that declares no `bound` argument:\n * it binds nothing, and refuses any argument it is asked to.\n */\n readonly bindNone: (\n extension: string,\n values: Readonly<Record<string, unknown>>,\n previous: AdmittedArgs | undefined\n ) => AdmittedArgs;\n}\n\n/**\n * A methods part: what a view answers, in chain order. `owns` (which keys\n * the factory may return: why not, else `undefined`) and `layer` (what its\n * methods add to a view) are its builder's half (`methods-part.ts`).\n *\n * A view's methods are this part's layer over the view the chain's methods\n * before it bind. The factory is invoked against the scope `createScope`\n * builds over those, the first time a method it returns could be read: a\n * view costs the factories it uses. `force` invokes every factory in chain\n * order, where a root view surfaces an extension's faults.\n */\nexport function methodsPart(\n factory: RuntimeMethodsFactory,\n layer: MethodsLayer,\n owns: (key: string, schema: Schema) => string | undefined\n): ExtensionPart {\n return {\n join({ next, name, schema }) {\n const before = next.methods;\n next.methods = {\n bind: (createScope) => {\n const prior = before?.bind(createScope) ?? NO_LAYER;\n // Typed where it is declared, so a call to it ends the argument flow.\n const refuse: (problem: string) => never = (problem) =>\n extensionError(`Extension \"${name}\" ${problem}.`, name);\n let scope: object | undefined;\n const scopeOf = () => (scope ??= createScope(prior, name));\n let returned: Readonly<Record<string, unknown>> | undefined;\n return layer({\n prior,\n // The factory's answer, once per view: the methods come from it.\n answer: () => {\n if (returned !== undefined) return returned;\n const value: unknown = Reflect.apply(factory, undefined, [\n scopeOf(),\n ]);\n if (!isRecord(value))\n refuse(\"methods factory must return an object\");\n for (const key of Object.keys(value)) {\n const problem = owns(key, schema);\n if (problem) refuse(`methods returned \"${key}\", ${problem}`);\n }\n returned = value;\n return value;\n },\n scope: scopeOf,\n refuse,\n });\n },\n bindNone: (extension, values, previous) => {\n for (const key of Object.keys(values)) notBound(extension, key);\n return { ...previous };\n },\n };\n },\n };\n}\n","/**\n * `methods((scope) => ({ $name: fn }))`: functions added to the client, and\n * `modelMethods((scope) => ({ model: { name: fn } }))`: functions added to\n * the models. Each factory runs once per view it serves, the first time one\n * of its methods is read; a model method is called with `this` equal to the\n * delegate it is read from. Two builders, each bringing its own half of the\n * methods host (`methods.ts`): an extension that adds client methods only\n * carries no model-method code, and the reverse.\n */\nimport type {\n AnyTarget,\n ConsumesResults,\n MethodsCheck,\n MethodsFacts,\n MethodsScope,\n ModelName,\n Part,\n} from \"./contract\";\nimport { clientLayer, methodsPart, modelLayer } from \"./methods\";\n\n/** Functions added to the client of the extension's chain: `$` names. */\nexport function methods<\n T extends AnyTarget,\n F extends (\n scope: MethodsScope<T>\n ) => MethodsCheck<ReturnType<F>, T, \"client\"> = (\n scope: MethodsScope<T>\n ) => object,\n>(factory: F): Part<T, MethodsFacts<ReturnType<F>, ConsumesResults<F>, never>>;\nexport function methods(factory: (scope: never) => unknown): unknown {\n return methodsPart(factory, clientLayer, (key) =>\n key.startsWith(\"$\")\n ? undefined\n : \"which is not a $ client method (a model's are written with modelMethods)\"\n );\n}\n\n/** Functions added to the models of the extension's chain, by model. */\nexport function modelMethods<\n T extends AnyTarget,\n F extends (\n scope: MethodsScope<T>\n ) => MethodsCheck<ReturnType<F>, T, \"model\"> = (\n scope: MethodsScope<T>\n ) => object,\n>(\n factory: F\n): Part<T, MethodsFacts<ReturnType<F>, ConsumesResults<F>, ModelName<T>>>;\nexport function modelMethods(factory: (scope: never) => unknown): unknown {\n return methodsPart(factory, modelLayer, (key, schema) =>\n Object.hasOwn(schema, key) ? undefined : \"which is not a model\"\n );\n}\n"],"mappings":"maA+EA,SAAgB,cACd,EACA,EACA,EACA,EACc,CACd,IAAM,EAAgC,CAAE,GAAG,EAAU,CACrD,IAAK,GAAM,CAAC,EAAM,KAAQ,OAAO,QAAQ,EAAO,CAAE,CAChD,IAAM,EAAW,EAAI,KAClB,GACC,EAAU,OAAS,GACnB,EAAU,YAAc,GACxB,EAAU,QAAU,GACvB,CACG,IAAa,IAAA,IAAW,SAAS,EAAW,EAAK,CACrD,EAAK,GAAQ,EAAS,MAAM,EAAU,EAAI,CAE5C,OAAO,EAIT,SAAgB,SAAS,EAAmB,EAAqB,CAC/D,OAAO,EACL,cAAc,EAAU,oBAAoB,EAAK,kDACjD,EACD,CAIH,SAAS,YACP,EACA,EACc,CACd,IAAM,EAAiC,EAAE,CACzC,IAAK,IAAM,KAAQ,EACb,GAAY,OAA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AM,CAAE,CACpC,IAAM,EAAU,EAAK,EAAK,EAAO,CAC7B,GAAS,OAAO,qBAAqB,EAAI,KAAK,IAAU,CAG9D,MADA,GAAW,EACJ,GAET,MAAO,QACP,OACD,CAAC,EAEJ,UAAW,EAAW,EAAQ,IAAa,CACzC,IAAK,IAAM,KAAO,OAAO,KAAK,EAAO,CAAE,SAAS,EAAW,EAAI,CAC/D,MAAO,CAAE,GAAG,EAAU,EAEzB,EAEJ,CCpdH,SAAgB,QAAQ,EAA6C,CACnE,OAAO,YAAY,EAAS,YAAc,GACxC,EAAI,WAAW,IAAI,CACf,IAAA,GACA,2EACL,CAcH,SAAgB,aAAa,EAA6C,CACxE,OAAO,YAAY,EAAS,YAAa,EAAK,IAC5C,OAAO,OAAO,EAAQ,EAAI,CAAG,IAAA,GAAY,uBAC1C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-
|
|
1
|
+
import { _o as MigrationError, vo as isMigrationError } from "../database-adapter-D62c-uC6.mjs";
|
|
2
|
+
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-Ckoxeruk.mjs";
|
|
3
3
|
import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
|
|
4
|
-
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-
|
|
5
|
-
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-
|
|
4
|
+
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-DZ39sYy2.mjs";
|
|
5
|
+
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-D5x-Yf7w.mjs";
|
|
6
6
|
export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-
|
|
1
|
+
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-B2kk7NAR.mjs";import{t as l}from"../mysql-BH0Z3PlH.mjs";import{t as u}from"../identifier-conversion-Ci_iaJ0b.mjs";import{s as d,t as f}from"../client-DtPTegtA.mjs";import{n as p,t as m}from"../memory-gjKMy3Ql.mjs";import{n as h,r as g,t as _}from"../object-store-WIE0DGGG.mjs";c(l);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,u as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
|
|
2
2
|
//# sourceMappingURL=mysql.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-
|
|
1
|
+
import { _o as MigrationError, vo as isMigrationError } from "../database-adapter-D62c-uC6.mjs";
|
|
2
|
+
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-Ckoxeruk.mjs";
|
|
3
3
|
import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
|
|
4
|
-
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-
|
|
5
|
-
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-
|
|
4
|
+
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-DZ39sYy2.mjs";
|
|
5
|
+
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-D5x-Yf7w.mjs";
|
|
6
6
|
export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-
|
|
1
|
+
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-B2kk7NAR.mjs";import{t as l}from"../identifier-conversion-Ci_iaJ0b.mjs";import{t as u}from"../postgres-DQ_pO0hi.mjs";import{s as d,t as f}from"../client-DtPTegtA.mjs";import{n as p,t as m}from"../memory-gjKMy3Ql.mjs";import{n as h,r as g,t as _}from"../object-store-WIE0DGGG.mjs";c(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
|
|
2
2
|
//# sourceMappingURL=postgres.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-
|
|
1
|
+
import { _o as MigrationError, vo as isMigrationError } from "../database-adapter-D62c-uC6.mjs";
|
|
2
|
+
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-Ckoxeruk.mjs";
|
|
3
3
|
import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
|
|
4
|
-
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-
|
|
5
|
-
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-
|
|
4
|
+
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-DZ39sYy2.mjs";
|
|
5
|
+
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-D5x-Yf7w.mjs";
|
|
6
6
|
export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-
|
|
1
|
+
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-B2kk7NAR.mjs";import{t as l}from"../identifier-conversion-Ci_iaJ0b.mjs";import{t as u}from"../snowflake-6sBLJi34.mjs";import{s as d,t as f}from"../client-DtPTegtA.mjs";import{n as p,t as m}from"../memory-gjKMy3Ql.mjs";import{n as h,r as g,t as _}from"../object-store-WIE0DGGG.mjs";c(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
|
|
2
2
|
//# sourceMappingURL=snowflake.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-
|
|
1
|
+
import { _o as MigrationError, vo as isMigrationError } from "../database-adapter-D62c-uC6.mjs";
|
|
2
|
+
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-Ckoxeruk.mjs";
|
|
3
3
|
import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
|
|
4
|
-
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-
|
|
5
|
-
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-
|
|
4
|
+
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-DZ39sYy2.mjs";
|
|
5
|
+
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-D5x-Yf7w.mjs";
|
|
6
6
|
export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-
|
|
1
|
+
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-B2kk7NAR.mjs";import{n as l,t as u}from"../libsql-DJRsCDT_.mjs";import{t as d}from"../identifier-conversion-Ci_iaJ0b.mjs";import{s as f,t as p}from"../client-DtPTegtA.mjs";import{n as m,t as h}from"../memory-gjKMy3Ql.mjs";import{n as g,r as _,t as v}from"../object-store-WIE0DGGG.mjs";c(l),c(u);export{v as MemoryConditionalObjectStore,h as MemoryEstateStorage,t as MigrationError,g as ObjectStoreEstateStorage,r as addDropResolver,f as auditStorage,p as createMigrationClient,o as createPredefinedResolver,m as createStorageConformanceSuite,d as identifierConversionChecks,e as isMigrationError,a as lenientResolver,_ as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
|
|
2
2
|
//# sourceMappingURL=sqlite.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"../../chunk-BuuaeEvq.mjs";import{n as t}from"../../object-store-
|
|
1
|
+
import{n as e}from"../../chunk-BuuaeEvq.mjs";import{n as t}from"../../object-store-WIE0DGGG.mjs";const n=`viborm_migration_estate`;function createDurableObjectStorageWriter(e,r={}){let{sql:i}=e,a=r.prefix??``;return i.exec(`CREATE TABLE IF NOT EXISTS ${n} (key TEXT PRIMARY KEY, bytes BLOB NOT NULL)`),new t({putIfAbsent:async(e,t)=>i.exec(`INSERT INTO ${n} (key, bytes) VALUES (?, ?) ON CONFLICT (key) DO NOTHING RETURNING key`,`${a}${e}`,t.slice().buffer).toArray().length===1?`created`:`exists`,get:async e=>{let[t]=i.exec(`SELECT bytes FROM ${n} WHERE key = ?`,`${a}${e}`).toArray();return t?new Uint8Array(t.bytes):null},list:async e=>i.exec(`SELECT key FROM ${n} WHERE substr(key, 1, length(?)) = ? ORDER BY key`,`${a}${e}`,`${a}${e}`).toArray().map(e=>e.key.slice(a.length))})}export{createDurableObjectStorageWriter};
|
|
2
2
|
//# sourceMappingURL=durable-object.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"../../chunk-BuuaeEvq.mjs";import{n as t}from"../../object-store-
|
|
1
|
+
import{n as e}from"../../chunk-BuuaeEvq.mjs";import{n as t}from"../../object-store-WIE0DGGG.mjs";function createR2StorageWriter(e,n={}){let r=n.prefix??``;return new t({putIfAbsent:async(t,n)=>{let i=`${r}${t}`;try{return await e.put(i,n,{onlyIf:{etagDoesNotMatch:`*`}})?`created`:`exists`}catch(t){if(!(t instanceof Error&&t.message.includes(`(10058)`)&&await e.head(i)!==null))throw t;return`exists`}},get:async t=>{let n=await e.get(`${r}${t}`);return n?new Uint8Array(await n.arrayBuffer()):null},list:async t=>{let n=[],i;do{let a=await e.list({prefix:`${r}${t}`,cursor:i});for(let e of a.objects)n.push(e.key.slice(r.length));i=a.truncated?a.cursor:void 0}while(i);return n}})}export{createR2StorageWriter};
|
|
2
2
|
//# sourceMappingURL=r2.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-
|
|
1
|
+
import { _o as MigrationError, vo as isMigrationError } from "../database-adapter-D62c-uC6.mjs";
|
|
2
|
+
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "../planner-Ckoxeruk.mjs";
|
|
3
3
|
import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "../contract-CrIB-3ZJ.mjs";
|
|
4
|
-
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-
|
|
5
|
-
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-
|
|
4
|
+
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "../client-DZ39sYy2.mjs";
|
|
5
|
+
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "../object-store-D5x-Yf7w.mjs";
|
|
6
6
|
export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-
|
|
1
|
+
import{n as e,t}from"../migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s,v as c}from"../serializer-B2kk7NAR.mjs";import{t as l}from"../identifier-conversion-Ci_iaJ0b.mjs";import{t as u}from"../surrealql-DY7sgVnJ.mjs";import{s as d,t as f}from"../client-DtPTegtA.mjs";import{n as p,t as m}from"../memory-gjKMy3Ql.mjs";import{n as h,r as g,t as _}from"../object-store-WIE0DGGG.mjs";c(u);export{_ as MemoryConditionalObjectStore,m as MemoryEstateStorage,t as MigrationError,h as ObjectStoreEstateStorage,r as addDropResolver,d as auditStorage,f as createMigrationClient,o as createPredefinedResolver,p as createStorageConformanceSuite,l as identifierConversionChecks,e as isMigrationError,a as lenientResolver,g as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
|
|
2
2
|
//# sourceMappingURL=surrealdb.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { s as MigrationLimits, t as MigrationClient } from "../planner-
|
|
1
|
+
import { s as MigrationLimits, t as MigrationClient } from "../planner-Ckoxeruk.mjs";
|
|
2
2
|
import { i as Sha256, n as MigrationStorageWriter } from "../contract-CrIB-3ZJ.mjs";
|
|
3
|
-
import { U as MigrationMarkerV1, V as MigrationDecisionV1, c as ReadableMigrations } from "../client-
|
|
3
|
+
import { U as MigrationMarkerV1, V as MigrationDecisionV1, c as ReadableMigrations } from "../client-DZ39sYy2.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/migrations/tenant.d.ts
|
|
6
6
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"../chunk-BuuaeEvq.mjs";import{a as t,i as n,n as r}from"../base-z-cH5ZBI.mjs";import{mn as i,rn as a}from"../serializer-
|
|
1
|
+
import{n as e}from"../chunk-BuuaeEvq.mjs";import{a as t,i as n,n as r}from"../base-z-cH5ZBI.mjs";import{mn as i,rn as a}from"../serializer-B2kk7NAR.mjs";import{i as o,r as s,t as c}from"../client-DtPTegtA.mjs";const l=new Set([r.MIGRATION_PARTIAL_EFFECT,r.MIGRATION_AMBIGUOUS_COMMIT,r.MIGRATION_UNFINISHED_ATTEMPT]),u=new Set([r.MIGRATION_FAILED,r.MIGRATION_MARKER_CONFLICT]);function createTenantMigrator({client:e,history:t,tables:n,limits:r}){let a={storage:t,tables:n,limits:r},l=c(e,a),u=Promise.resolve(),exclusive=async(e,t)=>{let n=u,release=()=>void 0;u=new Promise(e=>{release=e}).then(()=>n);try{return await untilAborted(n,t),await e()}finally{release()}},change=async(n,{decisions:r=[],signal:l,beforeDestructive:u}={})=>{let d,f;try{l?.throwIfAborted(),o(s(e),`batch`,`apply()`),f=c({$driver:e.$driver,$schema:n},a);let p=i(r);if(u&&await isDestructive(f,p,t)){l?.throwIfAborted();try{await u()}catch(e){return{kind:`refused`,error:describe(e)}}}l?.throwIfAborted(),d=(await f.generate({resolve:p})).outcome===`published`}catch(e){return{kind:classify(e),error:describe(e)}}for(let e=1;;e+=1)try{let e=await f.apply();return e.outcome===`noop`&&!d?{kind:`noop`}:{kind:`applied`,path:e.path,...e.warnings?{warnings:e.warnings}:{}}}catch(t){let n=classify(t),r=d&&n===`refused`?`failed`:n;if(e===4||r!==`failed`||!retryable(t)||!await backoff(e,l))return withMarker({kind:r,error:describe(t)},f)}};return Object.freeze({change:(e,t)=>exclusive(()=>change(e,t),t?.signal).catch(e=>({kind:`failed`,error:describe(e)})),status:()=>l.status(),log:()=>l.log(),resolve:e=>exclusive(()=>l.resolve(e)),down:e=>exclusive(()=>l.down(e)),reanchor:e=>exclusive(()=>l.reanchor(e)),prune:e=>exclusive(()=>l.prune(e))})}async function isDestructive(e,t,n){if((await e.generate({dryRun:!0,resolve:t})).operations.some(a))return!0;if(!await n.readEstate())return!1;let{states:r,edges:i}=await e.graph();if(r.length===0)return!1;let{path:o}=await e.apply({dryRun:!0});return i.some(e=>o.includes(e.toState)&&(e.approvals.length>0||e.risks.includes(`destructive`)))}function retryable(e){if(t(e)&&e.code===r.MIGRATION_LOCK_FAILED)return!0;for(let t=e;t instanceof Error;t=t.cause)if(n(t))return!0;return!1}function classify(e){return t(e)?l.has(e.code)||e.meta.partial===!0?`ambiguous`:u.has(e.code)||retryable(e)?`failed`:`refused`:`failed`}async function withMarker(e,t){try{return{...e,marker:(await t.status()).marker}}catch{return e}}function describe(e){if(!(e instanceof Error))return{name:`Error`,message:String(e)};let n=e.cause instanceof Error?Reflect.get(e.cause,`code`):null,r=t(e)?e.meta.providerSqlState:void 0;return{name:e.name,...t(e)?{code:e.code}:{},message:e.message,...typeof n==`string`?{causeCode:n}:{},...typeof r==`string`?{providerSqlState:r}:{}}}function untilAborted(e,t){if(!t)return e;t.throwIfAborted();let abort=()=>void 0,n=new Promise((e,n)=>{abort=()=>n(t.reason),t.addEventListener(`abort`,abort,{once:!0})});return Promise.race([e,n]).finally(()=>t.removeEventListener(`abort`,abort))}async function backoff(e,t){let n=200*2**(e-1)*(.5+Math.random()/2);try{return await untilAborted(new Promise(e=>setTimeout(e,n)),t),!0}catch{return!1}}export{createTenantMigrator};
|
|
2
2
|
//# sourceMappingURL=tenant.mjs.map
|
package/dist/migrations.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "./planner-
|
|
1
|
+
import { _o as MigrationError, vo as isMigrationError } from "./database-adapter-D62c-uC6.mjs";
|
|
2
|
+
import { a as ResolveChange, i as ResolveCallback, o as SchemaSnapshot, r as MigrationTarget, s as MigrationLimits } from "./planner-Ckoxeruk.mjs";
|
|
3
3
|
import { n as MigrationStorageWriter, r as PublishResult, t as MigrationStorageReader } from "./contract-CrIB-3ZJ.mjs";
|
|
4
|
-
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "./client-
|
|
5
|
-
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "./object-store-
|
|
4
|
+
import { A as InvalidIndex, B as MigrationCheckInput, C as MigrationStateListItem, D as PruneResult, E as PruneOptions, F as ExactPushOptions, G as PushConsent, H as MigrationEstateDescriptorV1, I as GenerateV1Options, J as ResetV1Options, K as PushOptionsV1, L as ManualMigrationInput, M as BaselineOptions, N as DownPreviewEdgeV1, O as CheckFinding, P as DownV1Options, R as ManualTransitionInput, S as MigrationStateDetails, T as ShowResult, V as MigrationDecisionV1, W as MigrationStateManifestV1, X as StateSelector, Y as ResolveV1Options, _ as PushPreview, a as LiveMigrations, b as MigrationEdgeMetadata, c as ReadableMigrations, d as ResolveResult, f as StatusResult, g as PushApplyResult, h as createMigrationClient, i as GenerateResult, j as ApplyV1Options, k as CheckResult, l as ReanchorResult, m as WritableMigrations, n as BaselineResult, o as LogResult, p as VerifyResult, q as ReanchorOptions, r as DownResult, s as MigrationClientOptions, t as ApplyResult, u as ResetResult, v as GraphResult, w as MigrationStateMetadata, x as MigrationRollbackMetadata, y as ListResult, z as MigrationApprovalV1 } from "./client-DZ39sYy2.mjs";
|
|
5
|
+
import { a as MemoryEstateStorage, c as auditStorage, d as lenientResolver, f as rejectAllResolver, g as sqliteCanonicalTimeExpression, h as sqliteCanonicalDateTimeExpression, i as refuseWorkersKvWritable, l as addDropResolver, m as identifierConversionChecks, n as ObjectStoreConditionalPut, o as createStorageConformanceSuite, p as IdentifierConversionRequest, r as ObjectStoreEstateStorage, s as StorageColumnAudit, t as MemoryConditionalObjectStore, u as createPredefinedResolver } from "./object-store-D5x-Yf7w.mjs";
|
|
6
6
|
export { ApplyV1Options as ApplyOptions, ApplyResult, BaselineOptions, BaselineResult, CheckFinding, CheckResult, DownV1Options as DownOptions, DownPreviewEdgeV1 as DownPreviewEdge, DownResult, ExactPushOptions, GenerateV1Options as GenerateOptions, GenerateResult, GraphResult, IdentifierConversionRequest, InvalidIndex, ListResult, LiveMigrations, LogResult, ManualMigrationInput, ManualTransitionInput, MemoryConditionalObjectStore, MemoryEstateStorage, MigrationApprovalV1 as MigrationApproval, MigrationCheckInput, MigrationClientOptions, MigrationDecisionV1 as MigrationDecision, MigrationEdgeMetadata, MigrationError, MigrationEstateDescriptorV1, MigrationLimits, MigrationRollbackMetadata, MigrationStateDetails, MigrationStateListItem, MigrationStateManifestV1, MigrationStateMetadata, MigrationStorageReader, MigrationStorageWriter, MigrationTarget, ObjectStoreConditionalPut, ObjectStoreEstateStorage, PruneOptions, PruneResult, PublishResult, PushApplyResult, PushConsent, PushOptionsV1 as PushOptions, PushPreview, ReadableMigrations, ReanchorOptions, ReanchorResult, ResetV1Options as ResetOptions, ResetResult, ResolveCallback, ResolveChange, ResolveV1Options as ResolveOptions, ResolveResult, SchemaSnapshot, ShowResult, StateSelector, StatusResult, StorageColumnAudit, VerifyResult, WritableMigrations, addDropResolver, auditStorage, createMigrationClient, createPredefinedResolver, createStorageConformanceSuite, identifierConversionChecks, isMigrationError, lenientResolver, refuseWorkersKvWritable, rejectAllResolver, sqliteCanonicalDateTimeExpression, sqliteCanonicalTimeExpression };
|
package/dist/migrations.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"./migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s}from"./serializer-
|
|
1
|
+
import{n as e,t}from"./migrations-BMiRjR-N.mjs";import{_n as n,cn as r,d as i,hn as a,mn as o,p as s}from"./serializer-B2kk7NAR.mjs";import{t as c}from"./identifier-conversion-Ci_iaJ0b.mjs";import{t as l}from"./every-BHEmfLOW.mjs";import{s as u,t as d}from"./client-DtPTegtA.mjs";import{n as f,t as p}from"./memory-gjKMy3Ql.mjs";import{n as m,r as h,t as g}from"./object-store-WIE0DGGG.mjs";l();export{g as MemoryConditionalObjectStore,p as MemoryEstateStorage,t as MigrationError,m as ObjectStoreEstateStorage,r as addDropResolver,u as auditStorage,d as createMigrationClient,o as createPredefinedResolver,f as createStorageConformanceSuite,c as identifierConversionChecks,e as isMigrationError,a as lenientResolver,h as refuseWorkersKvWritable,n as rejectAllResolver,i as sqliteCanonicalDateTimeExpression,s as sqliteCanonicalTimeExpression};
|
|
2
2
|
//# sourceMappingURL=migrations.mjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-BuuaeEvq.mjs";import{n as t}from"./base-z-cH5ZBI.mjs";import{t as n}from"./migrations-BMiRjR-N.mjs";import{R as r,j as i,o as a}from"./native-types-
|
|
1
|
+
import{n as e}from"./chunk-BuuaeEvq.mjs";import{n as t}from"./base-z-cH5ZBI.mjs";import{t as n}from"./migrations-BMiRjR-N.mjs";import{R as r,j as i,o as a}from"./native-types-DspZ0Z5E.mjs";import{a as o}from"./physical-wboFLAg9.mjs";import{r as s}from"./datetime-physical-codec-BS2T81sD.mjs";import{r as c}from"./identifiers-BTCfD5ic.mjs";import{$n as l,An as u,Gn as d,Gt as f,Mn as p,On as m,Qn as h,Wn as g,Xn as _,Zn as v,ar as y,c as b,er as x,ir as S,jn as C,kn as w,l as T,lr as E,nr as D,or as O,qn as k,rr as A,s as j,sr as M,tr as N}from"./serializer-B2kk7NAR.mjs";import{r as P}from"./identity-CtW15WlB.mjs";import{t as F}from"./sql-CFxGrk3K.mjs";const namespaceMeta=e=>({dialect:`mysql`,namespace:e});async function resolveCatalogNamespace(e,r){if(r===void 0)throw new n(`This MySQL client's adapter declares no database, so there is no catalog to read. MySQL migration artifacts are database-relative on purpose: supply the live destination explicitly, in the connection URL, or through the driver's database option.`,t.MIGRATION_INVALID_STATE,{meta:{dialect:`mysql`,type:`unbound-database`}});let{rows:i}=await e(`
|
|
2
2
|
SELECT SCHEMA_NAME
|
|
3
3
|
FROM information_schema.SCHEMATA
|
|
4
4
|
WHERE LOWER(SCHEMA_NAME) = LOWER(?)
|
|
@@ -97,4 +97,4 @@ WHERE tc.CONSTRAINT_TYPE = 'FOREIGN KEY'
|
|
|
97
97
|
ORDER BY tc.TABLE_NAME, tc.CONSTRAINT_NAME, kcu.ORDINAL_POSITION
|
|
98
98
|
`,[a,a]);admitContainedForeignKeys(f.rows,a,i);let p=j(c.rows,e=>e.TABLE_NAME),g=j(l.rows,e=>e.TABLE_NAME),v=b(d.rows,e=>e.TABLE_NAME,e=>e.INDEX_NAME),y=b(f.rows.filter(e=>e.TABLE_SCHEMA===a),e=>e.TABLE_NAME,e=>e.CONSTRAINT_NAME),x=[],S=new Set,C=[];for(let e of s.rows){let r=e.TABLE_NAME,a=[];for(let e of p.get(r)||[]){if((i===void 0||i.includes(r))&&(e.EXTRA.toUpperCase().includes(`VIRTUAL GENERATED`)||e.EXTRA.toUpperCase().includes(`STORED GENERATED`)))throw new n(`MySQL column "${r}.${e.COLUMN_NAME}" is generated. Synchronization refuses before effects because its expression cannot be represented.`,t.MIGRATION_INVALID_STATE,{meta:{table:r,column:e.COLUMN_NAME,feature:`generated column`}});if(e.DATA_TYPE===`enum`){let t=h(e.COLUMN_TYPE),n=t&&_(t);t&&n&&!S.has(n)&&(x.push({name:n,values:t}),S.add(n))}let o=i===void 0||i.includes(r),s=o?readDecimalDomain(e):void 0;a.push({name:e.COLUMN_NAME,type:o?formatColumnType(e):e.COLUMN_TYPE,nullable:e.IS_NULLABLE===`YES`,default:o?cleanDefault(e):void 0,autoIncrement:isAutoIncrement(e.EXTRA),decimal:s})}let o,s=g.get(r);if(s&&s.length>0){s.sort((e,t)=>e.ORDINAL_POSITION-t.ORDINAL_POSITION);let e=s[0];e&&(o={columns:s.map(e=>e.COLUMN_NAME),name:e.CONSTRAINT_NAME})}let c=[],l=v.get(r),d=new Set(y.get(r)?.keys()??[]);if(l)for(let[e,t]of l){if(d.has(e))continue;t.sort((e,t)=>e.SEQ_IN_INDEX-t.SEQ_IN_INDEX);let n=t[0],r=n?.INDEX_COMMENT?.startsWith(m)?u(n.INDEX_COMMENT.slice(m.length),e):void 0;if(r){c.push(r);continue}if(n){let r=n.INDEX_TYPE.toLowerCase(),i=r===`rtree`?`spatial`:r;c.push({name:e,columns:t.map(e=>e.COLUMN_NAME),unique:n.NON_UNIQUE===0,type:i===`btree`||i===`hash`||i===`fulltext`||i===`spatial`?i:void 0})}}let f=[],b=y.get(r);if(b)for(let[e,t]of b){t.sort((e,t)=>e.ORDINAL_POSITION-t.ORDINAL_POSITION);let n=t[0];n&&f.push({name:e,columns:t.map(e=>e.COLUMN_NAME),referencedTable:n.REFERENCED_TABLE_NAME,referencedColumns:t.map(e=>e.REFERENCED_COLUMN_NAME),onDelete:T(n.DELETE_RULE),onUpdate:T(n.UPDATE_RULE)})}C.push({name:r,columns:a,primaryKey:o,indexes:c,foreignKeys:f,uniqueConstraints:[]})}return{tables:C,enums:x.length>0?x:void 0}}const W=/[^a-z0-9_]/g;function hashLockScope(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return(t>>>0).toString(16).padStart(8,`0`)}function mysqlMigrationLockName(e){let t=e.toLowerCase();return`viborm_migration_${t.replace(W,`_`).slice(0,38)}_${hashLockScope(t)}`}function mysqlAcquireLockStatement(e,t,n){return`SELECT GET_LOCK(${n(mysqlMigrationLockName(e))}, ${t}) AS acquired`}function mysqlReleaseLockStatement(e,t){return`SELECT RELEASE_LOCK(${t(mysqlMigrationLockName(e))}) AS released`}function mysqlLockAnswer(e,t){if(e.length!==1)return!1;let n=e[0];if(typeof n!=`object`||!n)return!1;let r=Reflect.get(n,t);return typeof r==`number`?r===1:typeof r==`string`?Number(r)===1:!1}function mysqlSelectTargetStatement(e,t){return`USE ${t(e)}`}const G=/^(\d+)\.(\d+)\.(\d+)/;async function proveMySQLExactValueSession(e,r){let{rows:i}=await e(`SELECT @@SESSION.sql_mode AS sql_mode, VERSION() AS server_version`),a=i[0],o=typeof a==`object`&&a?Reflect.get(a,`sql_mode`):void 0,s=typeof o==`string`?o:``,c=typeof a==`object`&&a?Reflect.get(a,`server_version`):void 0,l=typeof c==`string`?c:`<unreported>`;if(!supportsEnforcedMySQLChecks(l))throw new n(`This MySQL migration session reports version "${l}". Fixed-decimal conversions require MySQL 8.0.16 or later, where CHECK constraints are enforced; the command is refused before any migration effect.`,t.DRIVER_NOT_SUPPORTED,{meta:{dialect:`mysql`,type:`unenforced-check-constraints`,target:r}});if(!s.split(`,`).some(e=>{let t=e.trim();return t===`STRICT_TRANS_TABLES`||t===`STRICT_ALL_TABLES`}))throw new n(`This MySQL session runs in sql_mode "${s}", which has neither STRICT_TRANS_TABLES nor STRICT_ALL_TABLES. Effectful migration work is refused: without a strict mode MySQL answers an out-of-range DECIMAL with a warning and stores the clamped value, so an exact fixed-decimal column would silently stop holding what it was given. Enable a strict mode on the server or on this connection and run the command again.`,t.DRIVER_NOT_SUPPORTED,{meta:{dialect:`mysql`,type:`non-strict-sql-mode`,target:r}})}function supportsEnforcedMySQLChecks(e){if(e.toLowerCase().includes(`mariadb`))return!1;let t=G.exec(e);if(t===null)return!1;let n=Number(t[1]),r=Number(t[2]),i=Number(t[3]);return n>8||n===8&&(r>0||i>=16)}const K=[/^GEOMETRY\b/,/^POINT\b/,/^LINESTRING\b/,/^POLYGON\b/,/^MULTIPOINT\b/,/^MULTILINESTRING\b/,/^MULTIPOLYGON\b/,/^GEOMETRYCOLLECTION\b/],q=/^(?:(?:TINY|MEDIUM|LONG)?(?:TEXT|BLOB)|JSON|GEOMETRY|POINT|LINESTRING|POLYGON|MULTI(?:POINT|LINESTRING|POLYGON)|GEOMETRYCOLLECTION)\b/i,J=/[\s(]/;function classifyDecimalListDescriptorChange(e,t){return e.scale===t.scale?e.precision<t.precision?`widening`:e.precision>t.precision?`narrowing`:`same`:`rescaling`}const Y=`InnoDB`,X=`utf8mb4_0900_bin`,Z=d.point.indexOf(` `),Q=d.point.slice(0,Z),$=d.point.slice(Z+1);function mysqlRefusesLiteralDefault(e){let t=e.toUpperCase();return t.includes(`TEXT`)||t.includes(`BLOB`)||t.includes(`JSON`)||K.some(e=>e.test(t))}const ee=/^(?:DATETIME|TIMESTAMP)\s*(?:\((\d+)\))?$/i;function mysqlNowExpression(e){let t=ee.exec(e.trim());if(t!==null)return t[1]===void 0?`CURRENT_TIMESTAMP`:`CURRENT_TIMESTAMP(${t[1]})`}function finalizeMySQLColumn(e,t){let n=e.type.toUpperCase()===`TEXT`&&t?`VARCHAR(191)`:e.type,r=e.default!==void 0&&mysqlRefusesLiteralDefault(n)?`(${e.default})`:e.default;return n===e.type&&r===e.default?e:{...e,type:n,default:r}}function isMySQLExactIntegerType(e){let t=e.trim().toUpperCase().split(J,1)[0];return t===`INT`||t===`INTEGER`||t===`BIGINT`}const te=new class MySQLMigrationDriver extends F{dialect=`mysql`;driverName=`mysql`;capabilities={supportsNativeEnums:!0,supportsAddEnumValueInTransaction:!1,supportsIndexTypes:[`btree`,`fulltext`,`spatial`],supportsNativeArrays:!1,supportsAddForeignKeyViaAlter:!0,introspectionReadsConstraintNames:!0};getIrreversibleRollbackReason(e){if(e.type!==`alterColumn`)return;let t=e.from.decimal,n=e.to.decimal;if(!(t===void 0||n===void 0||M(e.from)!==`list`||M(e.to)!==`list`||classifyDecimalListDescriptorChange(t,n)!==`narrowing`))return`MySQL cannot automatically roll back the decimal-list widening of "${e.tableName}"."${e.columnName}": the inverse narrows ${i(t)} to ${i(n)}, and its implicit DDL commits cannot make the stricter proof, descriptor-marker change, and cleanup indivisible.`}async preflightSchemaRequirements(e,r){let i=new Set(e.flatMap(e=>e.tables.map(e=>e.name)));if(i.size===0)return!1;let a=await resolveCatalogNamespace(r,this.namespace),o=(await r(`SELECT TABLE_NAME FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ?`,[a])).rows.find(e=>i.has(e.TABLE_NAME));if(o)throw new n(`MySQL relation "${o.TABLE_NAME}" is a view, but this schema declares a table. Synchronization refuses before effects and preserves the view.`,t.MIGRATION_INVALID_STATE,{meta:{table:o.TABLE_NAME,feature:`view`,namespace:a}});return!1}introspect(e){return introspect(e,this.namespace,this.target?.tables)}async adoptionHazards(e,t){if(e.length===0)return[];let n=await resolveCatalogNamespace(t,this.namespace),r=[];for(let i of e){let e=[n,i],[a]=(await t(`SELECT ENGINE, TABLE_COLLATION FROM information_schema.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?`,e)).rows,o=await t(`SELECT TRIGGER_NAME AS name FROM information_schema.TRIGGERS WHERE EVENT_OBJECT_SCHEMA = ? AND EVENT_OBJECT_TABLE = ? ORDER BY TRIGGER_NAME`,e),s=await t(`SELECT CONSTRAINT_NAME AS name FROM information_schema.TABLE_CONSTRAINTS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND CONSTRAINT_TYPE = 'CHECK' ORDER BY CONSTRAINT_NAME`,e),c=await t(`SELECT COLUMN_NAME AS name FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLLATION_NAME IS NOT NULL AND COLLATION_NAME <> ? ORDER BY ORDINAL_POSITION`,[...e,X]),l=[...o.rows.map(({name:e})=>`trigger "${e}"`),...s.rows.map(({name:e})=>`CHECK constraint "${e}"`),...a?.ENGINE&&a.ENGINE!==Y?[`ENGINE=${a.ENGINE}`]:[],...a?.TABLE_COLLATION&&a.TABLE_COLLATION!==X?[`the table collation ${a.TABLE_COLLATION}`]:[],...c.rows.map(({name:e})=>`a collation on column "${e}"`)];r.push(...l.map(e=>({table:i,feature:e})))}return r}escapeValue(e){return e==null?`NULL`:v(String(e))}escapeIdentifier(e){if(e==null)throw new n(`Cannot escape null or undefined identifier`,t.INVALID_INPUT);return`\`${String(e).replace(/`/g,"``")}\``}tableRef(e,t){return c(e=>this.escapeIdentifier(e),t===`live`?this.namespace:void 0,e)}mapScalarType(e,t,n){let r=e[`~`].nativeType,i=n===void 0||t.array===!0?void 0:o(n,r,`mysql`);if(i)return i.columnType;let s=a(r,`mysql`);return s&&!t.array?s.type:k({type:t.type,array:t.array,decimal:t.decimal})}getDefaultExpression(e,t){let n=t.type===`datetime`&&!t.array&&t.hasDefault&&!t.autoGenerate?this.literalDefaultValue(t):void 0;if(t.type===`datetime`&&!t.array&&t.hasDefault&&!t.autoGenerate&&typeof n==`string`)return this.escapeValue(s(n));if(!(t.hasDefault&&t.default===null))return t.autoGenerate?.kind===`now`?mysqlNowExpression(this.mapScalarType(e,t)):super.getDefaultExpression(e,t)}finalizeTable(e){let r=new Set([...e.primaryKey?.columns??[],...e.uniqueConstraints.flatMap(e=>e.columns),...e.indexes.flatMap(e=>e.raw?[]:e.columns),...e.foreignKeys.flatMap(e=>e.columns)]),i=new Set(e.indexes.map(e=>e.name)),a=e.uniqueConstraints.filter(e=>!i.has(e.name)).map(e=>({name:e.name,columns:e.columns,unique:!0})),o={...e,primaryKey:e.primaryKey?{...e.primaryKey,name:`PRIMARY`}:void 0,columns:e.columns.map(e=>finalizeMySQLColumn(e,r.has(e.name))),indexes:[...e.indexes,...a],uniqueConstraints:[]},s=o.indexes.filter(e=>!(e.raw||e.type&&e.type!==`btree`)),c=[{name:`PRIMARY`,columns:o.primaryKey?.columns??[]},...s.map(e=>({name:e.name,columns:e.columns})),...o.foreignKeys.map(e=>({name:e.name,columns:e.columns}))];for(let{name:r,columns:i}of c)for(let a of i){let i=o.columns.find(e=>e.name===a);if(i&&q.test(i.type))throw new n(`MySQL key "${e.name}.${r}" cannot directly index ${i.type} column "${i.name}". Use an indexable native type such as VARCHAR, or manage a reviewed prefix/expression index outside this declaration.`,t.FEATURE_NOT_SUPPORTED,{meta:{table:e.name,column:i.name}})}let l=o.columns.filter(e=>e.autoIncrement);if(l.length>1||l.some(e=>o.primaryKey?.columns[0]!==e.name&&!s.some(t=>t.columns[0]===e.name&&!t.where)&&!o.foreignKeys.some(t=>t.columns[0]===e.name)))throw new n(`MySQL table "${e.name}" requires at most one AUTO_INCREMENT column, first in an ordinary key. Declare its primary key or leading index explicitly.`,t.INVALID_INPUT,{meta:{table:e.name}});return o}formatBooleanDefault(e){return e?`1`:`0`}getEnumColumnType(e,t,n){return _(n)}static AUTO_INCREMENT_TYPES=new Set([`tinyint`,`smallint`,`mediumint`,`int`,`integer`,`bigint`]);validateAutoIncrementType(e){let r=e.type.toLowerCase().split(J)[0];if(!MySQLMigrationDriver.AUTO_INCREMENT_TYPES.has(r))throw new n(`MySQL AUTO_INCREMENT requires an integer type (TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT). Column "${e.name}" has type "${e.type}" which is not compatible with AUTO_INCREMENT.`,t.INVALID_INPUT,{meta:{column:e.name,type:e.type,autoIncrement:!0}})}generateColumnDef(e,t){let n=[this.escapeIdentifier(e.name)],r=e.type.toUpperCase()===d.point;return e.autoIncrement?(this.validateAutoIncrementType(e),n.push(e.type),n.push(`AUTO_INCREMENT`)):n.push(r?Q:e.type),e.nullable||n.push(`NOT NULL`),r&&n.push($),e.default!==void 0&&!e.autoIncrement&&n.push(`DEFAULT ${e.default}`),e.decimal&&M(e)===`list`&&n.push(`COMMENT ${this.escapeValue(O(e.decimal))}`),n.join(` `)}generateCreateTable(e,t){let{table:n}=e,r=n.columns.map(e=>this.generateColumnDef(e,t)),i=n.columns.find(e=>e.autoIncrement),a=i&&n.primaryKey?.columns[0]!==i.name?n.indexes.find(e=>(!e.type||e.type===`btree`)&&!e.where&&!e.raw&&e.columns[0]===i.name):void 0;if(a&&r.push(`${a.unique?`UNIQUE `:``}KEY ${this.escapeIdentifier(a.name)} (${a.columns.map(e=>this.escapeIdentifier(e)).join(`, `)})`),n.primaryKey){let e=n.primaryKey.columns.map(e=>this.escapeIdentifier(e)).join(`, `);r.push(`PRIMARY KEY (${e})`)}for(let e of n.uniqueConstraints){let t=e.columns.map(e=>this.escapeIdentifier(e)).join(`, `);r.push(`CONSTRAINT ${this.escapeIdentifier(e.name)} UNIQUE (${t})`)}for(let e of n.foreignKeys)r.push(this.foreignKeyClause(e,t));let o=[`CREATE TABLE ${this.tableRef(n.name,t.destination)} (\n ${r.join(`,
|
|
99
99
|
`)}\n) ENGINE=${Y} DEFAULT CHARSET=utf8mb4 COLLATE=${X}`];for(let e of n.indexes)e!==a&&o.push(this.generateCreateIndex({type:`createIndex`,tableName:n.name,index:e},t));return o}generateDropTable(e,t){return`DROP TABLE IF EXISTS ${this.tableRef(e.tableName,t.destination)}`}generateRenameTable(e,t){return`RENAME TABLE ${this.tableRef(e.from,t.destination)} TO ${this.tableRef(e.to,t.destination)}`}renameDerivedNames(e,t,n,r){let i=[...t].map(([e,{to:t}])=>{let i=n.foreignKeys.find(t=>t.name===e);return i?`DROP FOREIGN KEY ${this.escapeIdentifier(e)}, ADD ${this.foreignKeyClause({...i,name:t},r)}`:`RENAME INDEX ${this.escapeIdentifier(e)} TO ${this.escapeIdentifier(t)}`});return[`ALTER TABLE ${this.tableRef(e,r.destination)} ${i.join(`, `)}`]}generateAddColumn(e,t){let n=this.generateColumnDef(e.column,t);return`ALTER TABLE ${this.tableRef(e.tableName,t.destination)} ADD COLUMN ${n}`}generateDropColumn(e,t){return`ALTER TABLE ${this.tableRef(e.tableName,t.destination)} DROP COLUMN ${this.escapeIdentifier(e.columnName)}`}generateRenameColumn(e,t){return[`ALTER TABLE ${this.tableRef(e.tableName,t.destination)} RENAME COLUMN ${this.escapeIdentifier(e.from)} TO ${this.escapeIdentifier(e.to)}`,...this.rawIndexesRenamedBy(e,t).flatMap(n=>[this.generateDropIndex({type:`dropIndex`,tableName:e.tableName,indexName:n.name},t),this.generateCreateIndex({type:`createIndex`,tableName:e.tableName,index:n},t)])]}generateAlterColumn(e,t){let{tableName:n,columnName:r,to:i}=e,a=this.tableRef(n,t.destination),o=this.generateColumnDef(i,t),s=r===i.name?`ALTER TABLE ${a} MODIFY COLUMN ${o}`:`ALTER TABLE ${a} CHANGE COLUMN ${this.escapeIdentifier(r)} ${o}`,c=this.decimalConversionBracket(e,a,t);return c===null?[s]:[c.validate,s,c.release]}decimalConversionBracket(e,r,a){let{from:o,to:s}=e,c=o.decimal,l=s.decimal;if(l===void 0||!x(o,s))return null;if(e.columnName!==s.name)throw new n(`The MySQL decimal conversion for "${e.tableName}"."${e.columnName}" also renames the column to "${s.name}". Run the rename as a separate migration step before changing the decimal descriptor; an interrupted CHECK proof must keep one stable column identity across MySQL's implicit DDL commits.`,t.MIGRATION_INVALID_STATE,{meta:{dialect:`mysql`,table:e.tableName,column:e.columnName,type:`decimal-conversion-with-rename`}});let u=M(s);if(c===void 0)return(u!==`scalar`||!isMySQLExactIntegerType(o.type))&&this.refuseDecimalAdoption(e,a,u),this.decimalScalarConversionBracket(e,r,s.type,l);let d=M(o);if((u===void 0||d!==u)&&this.refuseDecimalConversion(e,a,`moves it from ${N(d)} to ${N(u)} storage, which`),u===`list`){let t=classifyDecimalListDescriptorChange(c,l);return t===`rescaling`&&this.refuseDecimalConversion(e,a,`moves its JSON list from ${i(c)} to ${i(l)}, which rescales every member and so`),t===`narrowing`&&this.refuseDecimalConversion(e,a,`narrows its JSON list from ${i(c)} to ${i(l)}, which`),this.decimalListConversionBracket(e,r,c)}return this.decimalScalarConversionBracket(e,r,s.type,l)}decimalListConversionBracket(e,t,n){let r=this.escapeIdentifier(l(`list`,n));return{validate:`ALTER TABLE ${t} ADD CONSTRAINT ${r} CHECK (${y(this.escapeIdentifier(e.columnName),n)})`,release:`ALTER TABLE ${t} DROP CHECK ${r}`}}decimalScalarConversionBracket(e,t,n,r){let i=this.escapeIdentifier(l(`scalar`,r));return{validate:`ALTER TABLE ${t} ADD CONSTRAINT ${i} CHECK (${A(this.escapeIdentifier(e.columnName),n)})`,release:`ALTER TABLE ${t} DROP CHECK ${i}`}}refuseDecimalAdoption(e,r,i){throw new n(`The declared change to "${e.tableName}"."${e.columnName}" would adopt unmarked ${e.from.type} storage as a fixed-decimal ${N(i)}. Only INT and BIGINT have one exact descriptor-free meaning that a transient target-domain CHECK can prove. Approximate, text, native-decimal-without-descriptor, and unmarked JSON storage could already contain rounded values or members at an unknown scale. The change is refused before any statement runs, so MySQL cannot implicitly round or reinterpret the stored data. Use an explicit migration that validates and rewrites the source values.`,t.FEATURE_NOT_SUPPORTED,{meta:{table:e.tableName,column:e.columnName,feature:`decimal storage adoption`,dialect:`mysql`,target:r.destination}})}refuseDecimalConversion(e,r,i){throw new n(`The declared change to "${e.tableName}"."${e.columnName}" ${i} would rewrite every stored value, and MySQL commits each DDL statement implicitly. There is no boundary that could make the member rewrite and its descriptor-marker change indivisible. The change is refused before any statement runs, so the schema and its data are unchanged. Only same-scale precision widening is applied automatically; narrowing or a scale change needs an explicit migration that validates and moves the values itself.`,t.FEATURE_NOT_SUPPORTED,{meta:{table:e.tableName,column:e.columnName,feature:`decimal descriptor conversion`,dialect:`mysql`,target:r.destination}})}generateCreateIndex(e,r){let{tableName:i,index:a}=e;if(a.raw){let e=p(a,{name:this.escapeIdentifier(a.name),table:this.tableRef(i,r.destination),column:e=>this.escapeIdentifier(e)});C(a,e,e=>f(e,`mysql`),[`COMMENT`,`ALGORITHM`,`LOCK`]);let o=m+w(a);if(new TextEncoder().encode(o).length>1024)throw new n(`The raw index "${a.name}" names too many or too long columns for MySQL's 1024-byte index comment, which holds VibORM's marker.`,t.FEATURE_NOT_SUPPORTED,{meta:{indexName:a.name}});return`${e}\nCOMMENT ${this.escapeValue(o)}`}if(this.validateIndexType(a.type,a.name),a.where)throw new n(`Index "${a.name}" declares a partial index predicate (where: "${a.where}"). MySQL does not support partial indexes. Either remove 'where' from the index definition, or move the predicate into a generated column and index that.`,t.FEATURE_NOT_SUPPORTED,{meta:{indexName:a.name,indexWhere:a.where}});let o=a.columns.map(e=>this.escapeIdentifier(e)).join(`, `),s=``;if(a.type===`fulltext`?s=`FULLTEXT `:a.type===`spatial`&&(s=`SPATIAL `),a.unique&&s)throw new n(`Cannot combine UNIQUE with ${a.type?.toUpperCase()} index "${a.name}". MySQL does not support UNIQUE ${a.type?.toUpperCase()} indexes. Either remove 'unique: true' from the index definition, or create a separate unique index.`,t.MIGRATION_FAILED,{meta:{indexName:a.name,indexType:a.type}});return`CREATE ${a.unique?`UNIQUE `:``}${s}INDEX ${this.escapeIdentifier(a.name)} ON ${this.tableRef(i,r.destination)} (${o})`}generateDropIndex(e,t){return`DROP INDEX ${this.escapeIdentifier(e.indexName)} ON ${this.tableRef(e.tableName,t.destination)}`}generateAddForeignKey(e,t){return`ALTER TABLE ${this.tableRef(e.tableName,t.destination)} ADD ${this.foreignKeyClause(e.fk,t)}`}foreignKeyClause(e,t){let n=e.columns.map(e=>this.escapeIdentifier(e)).join(`, `),r=e.referencedColumns.map(e=>this.escapeIdentifier(e)).join(`, `),i=`CONSTRAINT ${this.escapeIdentifier(e.name)} `;return i+=`FOREIGN KEY (${n}) `,i+=`REFERENCES ${this.tableRef(e.referencedTable,t.destination)} (${r})`,e.onDelete&&e.onDelete!==`noAction`&&(i+=` ON DELETE ${this.formatReferentialAction(e.onDelete)}`),e.onUpdate&&e.onUpdate!==`noAction`&&(i+=` ON UPDATE ${this.formatReferentialAction(e.onUpdate)}`),i}generateDropForeignKey(e,t){return`ALTER TABLE ${this.tableRef(e.tableName,t.destination)} DROP FOREIGN KEY ${this.escapeIdentifier(e.fkName)}`}generateAddUniqueConstraint(e,t){let{tableName:n,constraint:r}=e,i=r.columns.map(e=>this.escapeIdentifier(e)).join(`, `);return`ALTER TABLE ${this.tableRef(n,t.destination)} ADD CONSTRAINT ${this.escapeIdentifier(r.name)} UNIQUE (${i})`}generateDropUniqueConstraint(e,t){return`ALTER TABLE ${this.tableRef(e.tableName,t.destination)} DROP INDEX ${this.escapeIdentifier(e.constraintName)}`}generateAddPrimaryKey(e,t){let{tableName:n,primaryKey:r}=e,i=r.columns.map(e=>this.escapeIdentifier(e)).join(`, `);return`ALTER TABLE ${this.tableRef(n,t.destination)} ADD PRIMARY KEY (${i})`}generateDropPrimaryKey(e,t){return`ALTER TABLE ${this.tableRef(e.tableName,t.destination)} DROP PRIMARY KEY`}generateCreateEnum(e,t){return`-- MySQL: ENUM type is part of column definition`}generateDropEnum(e,t){return`-- MySQL: ENUM type is part of column definition`}generateAlterEnum(e,t){let{enumName:n,newValues:r,dependentColumns:i}=e;if(!r||r.length===0)return[`-- MySQL: no new values provided for enum "${n}"`];if(!i||i.length===0)return[`-- MySQL: no dependent columns found for enum "${n}"`];let a=[],o=this.getEnumColumnType(``,``,r);a.push(...this.buildEnumReplacementUpdates(e,t));for(let e of i){let n=(t.currentSchema?.tables.find(t=>t.name===e.tableName))?.columns.find(t=>t.name===e.columnName);if(!n){a.push(`-- MySQL: column "${e.columnName}" not found in table "${e.tableName}"`);continue}let r=this.tableRef(e.tableName,t.destination),i=this.escapeIdentifier(e.columnName),s=n.nullable?``:` NOT NULL`,c=n.default===void 0?``:` DEFAULT ${n.default}`;a.push(`ALTER TABLE ${r} MODIFY COLUMN ${i} ${o}${s}${c}`)}return a}async proveNamespaceExists(e){await this.resolveCommandNamespace(e)}async resolveCommandNamespace(e){return await resolveCatalogNamespace(e,this.namespace)}generateAcquireLock(e){return mysqlAcquireLockStatement(this.requireLockScope(),30,e=>this.escapeValue(e))}generateReleaseLock(e){return mysqlReleaseLockStatement(this.requireLockScope(),e=>this.escapeValue(e))}provesLockAcquired(e){return mysqlLockAnswer(e,`acquired`)}provesLockReleased(e){return mysqlLockAnswer(e,`released`)}generateSelectTarget(){return this.namespace===void 0?null:mysqlSelectTargetStatement(this.namespace,e=>this.escapeIdentifier(e))}async proveSession(e){await proveMySQLExactValueSession(e,`database "${this.namespace??`(unbound)`}"`);let t=this.requireLockScope(),n=!1,r,i=Object.create(this);return Object.defineProperty(i,`programPreamble`,{value:async e=>{if(n)return[];if(r!==void 0)return await r,[];r=planInterruptedMySQLDecimalRecovery((t,n)=>e._executeRaw(t,n),t,e=>this.escapeIdentifier(e));try{let e=await r;return n=!0,e}catch(e){throw r=void 0,e}}}),Object.freeze(i),i}programPreamble(){return Promise.reject(new n(`This MySQL sequential migration program is not bound to its locked command's decimal-recovery scope.`,t.MIGRATION_INVALID_STATE,{meta:{dialect:`mysql`,type:`unbound-migration-command`}}))}requireLockScope(){if(this.namespace===void 0)throw new n(`This MySQL migration driver is not bound to a database, so there is no lock scope to name. A MySQL named lock is server-wide, and VibORM will not take one that covers every database on the instance. Supply the live destination explicitly, in the connection URL, or through the driver's database option.`,t.MIGRATION_INVALID_STATE,{meta:{dialect:`mysql`,type:`unbound-database`}});return this.namespace}generateInventoryTables(){if(this.namespace===void 0)throw new n(`This MySQL migration driver is not bound to a database, so there is no table inventory to read. VibORM will not fall back to the connection's ambient default database here: a reset inventory decides what gets DROPPED. Supply the live destination explicitly, in the connection URL, or through the driver's database option.`,t.MIGRATION_INVALID_STATE,{meta:{dialect:`mysql`,type:`unbound-database`}});return{sql:`SELECT TABLE_NAME AS name FROM information_schema.TABLES WHERE TABLE_SCHEMA = ? AND TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME`,params:[this.namespace]}}generateInventoryEnums(){return null}};export{te as t};
|
|
100
|
-
//# sourceMappingURL=mysql-
|
|
100
|
+
//# sourceMappingURL=mysql-BH0Z3PlH.mjs.map
|