@prisma/orm-target-sqlite 8.0.0-rc.24-dev.28 → 8.0.0-rc.24-dev.29

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.
Files changed (173) hide show
  1. package/dist/{adapter-B8OOrks4-CpmcF003.mjs → adapter-B8OOrks4-BKzW_Yc4.mjs} +9 -9
  2. package/dist/{adapter-B8OOrks4-CpmcF003.mjs.map → adapter-B8OOrks4-BKzW_Yc4.mjs.map} +1 -1
  3. package/dist/{adapter-NFsNVlif.d.mts → adapter-DrTWv8F7.d.mts} +5 -5
  4. package/dist/{adapter-NFsNVlif.d.mts.map → adapter-DrTWv8F7.d.mts.map} +1 -1
  5. package/dist/{adapter-xFPDhkod-DB6XDGgl.d.mts → adapter-xFPDhkod-Bfb8AQQJ.d.mts} +3 -3
  6. package/dist/{adapter-xFPDhkod-DB6XDGgl.d.mts.map → adapter-xFPDhkod-Bfb8AQQJ.d.mts.map} +1 -1
  7. package/dist/adapter.d.mts +11 -11
  8. package/dist/adapter.mjs +7 -7
  9. package/dist/adapter__adapter.d.mts +2 -2
  10. package/dist/adapter__adapter.mjs +2 -2
  11. package/dist/adapter__codec-types.d.mts +3 -3
  12. package/dist/adapter__column-types.d.mts +2 -2
  13. package/dist/adapter__column-types.mjs +2 -2
  14. package/dist/adapter__control.d.mts +2 -2
  15. package/dist/adapter__control.mjs +5 -5
  16. package/dist/adapter__control.mjs.map +1 -1
  17. package/dist/adapter__runtime.d.mts +1 -1
  18. package/dist/adapter__runtime.mjs +4 -4
  19. package/dist/adapter__runtime.mjs.map +1 -1
  20. package/dist/adapter__sql-renderer.d.mts +2 -2
  21. package/dist/adapter__sql-renderer.mjs +1 -1
  22. package/dist/adapter__types.d.mts +2 -2
  23. package/dist/{aggregates--0FaH9Te.d.mts → aggregates-CA7Idm1d.d.mts} +4 -4
  24. package/dist/{aggregates--0FaH9Te.d.mts.map → aggregates-CA7Idm1d.d.mts.map} +1 -1
  25. package/dist/{aggregates-DMvLJFlR.mjs → aggregates-hLiHPHBG.mjs} +6 -7
  26. package/dist/aggregates-hLiHPHBG.mjs.map +1 -0
  27. package/dist/{codec-ids-BElbEYb_-CeWfv5bC.d.mts → codec-ids-CH8Nqk89-LNT9hksu.d.mts} +5 -3
  28. package/dist/codec-ids-CH8Nqk89-LNT9hksu.d.mts.map +1 -0
  29. package/dist/{codec-ids-BHBFCNsQ-C1Af_LGF.mjs → codec-ids-CTshXpbg-tcdbf_VC.mjs} +5 -3
  30. package/dist/codec-ids-CTshXpbg-tcdbf_VC.mjs.map +1 -0
  31. package/dist/codec-ids-Do7Ml2pg.d.mts +1 -0
  32. package/dist/codec-types-CBLOfyrr.d.mts +2 -0
  33. package/dist/codec-types-CcuzuROC.d.mts +1 -0
  34. package/dist/{codec-types-CGtSWeZ5-B5RH39BA.d.mts → codec-types-Ci-h2uxN-41PNpdNL.d.mts} +5 -3
  35. package/dist/codec-types-Ci-h2uxN-41PNpdNL.d.mts.map +1 -0
  36. package/dist/{codecs-izBhU4f1-uArTiOxL.mjs → codecs-CE5McdzP-CZ5F4Trz.mjs} +243 -116
  37. package/dist/codecs-CE5McdzP-CZ5F4Trz.mjs.map +1 -0
  38. package/dist/{codecs-A0DbaZRE-CMyLhO_K.d.mts → codecs-DBQsDiM--Cy-r45H3.d.mts} +58 -28
  39. package/dist/codecs-DBQsDiM--Cy-r45H3.d.mts.map +1 -0
  40. package/dist/codecs-Dou3fR1K.d.mts +1 -0
  41. package/dist/{codecs-B-paWXdt.mjs → codecs-EhvrdV8v.mjs} +2 -2
  42. package/dist/codecs-EhvrdV8v.mjs.map +1 -0
  43. package/dist/{column-types-bTPNfz46.d.mts → column-types-D3MMpY3X.d.mts} +13 -7
  44. package/dist/column-types-D3MMpY3X.d.mts.map +1 -0
  45. package/dist/column-types-D_PjRS6w.mjs +24 -0
  46. package/dist/column-types-D_PjRS6w.mjs.map +1 -0
  47. package/dist/{contract-contributions-CyHMdkva-2bg6kg_n.mjs → contract-contributions-CyHMdkva-BE5-kJj3.mjs} +2 -2
  48. package/dist/{contract-contributions-CyHMdkva-2bg6kg_n.mjs.map → contract-contributions-CyHMdkva-BE5-kJj3.mjs.map} +1 -1
  49. package/dist/{contract-free-DVGNrjWW.mjs → contract-free-CJlg0xGJ.mjs} +4 -4
  50. package/dist/{contract-free-DVGNrjWW.mjs.map → contract-free-CJlg0xGJ.mjs.map} +1 -1
  51. package/dist/{control-DGa_C2q6.d.mts → control-CtCvtwJx.d.mts} +183 -17
  52. package/dist/control-CtCvtwJx.d.mts.map +1 -0
  53. package/dist/{control-Dp-pU81N.d.mts → control-DfWteXy-.d.mts} +3 -3
  54. package/dist/{control-Dp-pU81N.d.mts.map → control-DfWteXy-.d.mts.map} +1 -1
  55. package/dist/{control-BvT30n3D.mjs → control-V3kPfMTR.mjs} +4 -3
  56. package/dist/control-V3kPfMTR.mjs.map +1 -0
  57. package/dist/{data-type-entries-B6YmbQDH-RnV5wVv8.mjs → data-type-entries-C0WkKiPF-CKPYj4OT.mjs} +20 -3
  58. package/dist/data-type-entries-C0WkKiPF-CKPYj4OT.mjs.map +1 -0
  59. package/dist/{data-types-CwpMoNK4.d.mts → data-types-C1nzwKt7.d.mts} +10 -2
  60. package/dist/{data-types-CwpMoNK4.d.mts.map → data-types-C1nzwKt7.d.mts.map} +1 -1
  61. package/dist/{data-types-fYwGTal5-BxuZD5EE.mjs → data-types-C_NKe4Ni-D7r8QkSb.mjs} +32 -4
  62. package/dist/data-types-C_NKe4Ni-D7r8QkSb.mjs.map +1 -0
  63. package/dist/{date-time-now-generators-BVQSg28x-DwhOJw5-.mjs → date-time-now-generators-DtRz9c2R-BkrBeLl2.mjs} +4 -4
  64. package/dist/{date-time-now-generators-BVQSg28x-DwhOJw5-.mjs.map → date-time-now-generators-DtRz9c2R-BkrBeLl2.mjs.map} +1 -1
  65. package/dist/{datetime-text-BogpvE70-VwTG2rUc.mjs → datetime-text-nkVy_w0q-DZnIEmgr.mjs} +3 -3
  66. package/dist/{datetime-text-BogpvE70-VwTG2rUc.mjs.map → datetime-text-nkVy_w0q-DZnIEmgr.mjs.map} +1 -1
  67. package/dist/{ddl-BvD-wVtg-BoEWa8CG.mjs → ddl-CgkyurGo-B2o4mSIT.mjs} +3 -3
  68. package/dist/{ddl-BvD-wVtg-BoEWa8CG.mjs.map → ddl-CgkyurGo-B2o4mSIT.mjs.map} +1 -1
  69. package/dist/{default-normalizer-BcGrp77x-CMWxtX1W.mjs → default-normalizer-Xsys5QJm-bPQiHGKp.mjs} +3 -3
  70. package/dist/{default-normalizer-BcGrp77x-CMWxtX1W.mjs.map → default-normalizer-Xsys5QJm-bPQiHGKp.mjs.map} +1 -1
  71. package/dist/{descriptor-meta-C2RNdGqi-BzR_I68E.mjs → descriptor-meta-BUMTRa-0-D2bfF0Yr.mjs} +5 -5
  72. package/dist/descriptor-meta-BUMTRa-0-D2bfF0Yr.mjs.map +1 -0
  73. package/dist/{descriptor-meta-Drr6Abaf-P67SenMd.mjs → descriptor-meta-CkiPlqDS-n3hDP01X.mjs} +23 -3
  74. package/dist/descriptor-meta-CkiPlqDS-n3hDP01X.mjs.map +1 -0
  75. package/dist/{descriptor-meta-CEjGA0WH-CxgiKj3V.mjs → descriptor-meta-uVTby90Y-CUfrzHVW.mjs} +152 -47
  76. package/dist/descriptor-meta-uVTby90Y-CUfrzHVW.mjs.map +1 -0
  77. package/dist/driver.mjs +1 -1
  78. package/dist/driver__control.mjs +1 -1
  79. package/dist/driver__runtime.mjs +9 -6
  80. package/dist/driver__runtime.mjs.map +1 -1
  81. package/dist/{errors-D9vZNPSI-DoNmdfv7.mjs → errors-DxbvEzQp-CeTjoGtL.mjs} +44 -3
  82. package/dist/errors-DxbvEzQp-CeTjoGtL.mjs.map +1 -0
  83. package/dist/{migration-C6RAZsCK.mjs → migration-BZoV6EvH.mjs} +2 -2
  84. package/dist/{migration-C6RAZsCK.mjs.map → migration-BZoV6EvH.mjs.map} +1 -1
  85. package/dist/{op-factory-call-B3oOyB-T-Bhg17pAj.mjs → op-factory-call-2IWWs4es-CajfeAMX.mjs} +19 -19
  86. package/dist/op-factory-call-2IWWs4es-CajfeAMX.mjs.map +1 -0
  87. package/dist/{pack-JeUy8ZB1.d.mts → pack-BG5STIN9.d.mts} +184 -25
  88. package/dist/{pack-JeUy8ZB1.d.mts.map → pack-BG5STIN9.d.mts.map} +1 -1
  89. package/dist/{planner-ccevdpwf.d.mts → planner-Bu5XBkHm.d.mts} +2 -2
  90. package/dist/{planner-ccevdpwf.d.mts.map → planner-Bu5XBkHm.d.mts.map} +1 -1
  91. package/dist/{planner-COl0BmJ_-SJuP-72Y.mjs → planner-gq4m2U9I-BBwAFGko.mjs} +8 -9
  92. package/dist/planner-gq4m2U9I-BBwAFGko.mjs.map +1 -0
  93. package/dist/{planner-produced-sqlite-migration-CE1q5Uqq-9kjqMR-1.mjs → planner-produced-sqlite-migration-BnKx1gAX-BZMX06Q-.mjs} +13 -23
  94. package/dist/planner-produced-sqlite-migration-BnKx1gAX-BZMX06Q-.mjs.map +1 -0
  95. package/dist/{planner-produced-sqlite-migration-BHH_ftCV-CndNmTrH.d.mts → planner-produced-sqlite-migration-CMjzJW5V-dVv0SjJm.d.mts} +3 -4
  96. package/dist/planner-produced-sqlite-migration-CMjzJW5V-dVv0SjJm.d.mts.map +1 -0
  97. package/dist/planner-produced-sqlite-migration-DtytlAAY.d.mts +1 -0
  98. package/dist/{render-ops-B2EHnXIQ-AspapEkF.mjs → render-ops-BdrBMvjY-CyVOYy9i.mjs} +4 -4
  99. package/dist/{render-ops-B2EHnXIQ-AspapEkF.mjs.map → render-ops-BdrBMvjY-CyVOYy9i.mjs.map} +1 -1
  100. package/dist/{require-temporal-qbyZfPgl-DGJhYwmE.mjs → require-temporal-CHWqSDF3-ElFTiAh6.mjs} +3 -3
  101. package/dist/{require-temporal-qbyZfPgl-DGJhYwmE.mjs.map → require-temporal-CHWqSDF3-ElFTiAh6.mjs.map} +1 -1
  102. package/dist/{runtime-H_OgXoaz.d.mts → runtime-CVBk_GlD.d.mts} +2 -2
  103. package/dist/{runtime-H_OgXoaz.d.mts.map → runtime-CVBk_GlD.d.mts.map} +1 -1
  104. package/dist/{runtime-DTjhSsHd.mjs → runtime-DQll1Swl.mjs} +2 -2
  105. package/dist/{runtime-DTjhSsHd.mjs.map → runtime-DQll1Swl.mjs.map} +1 -1
  106. package/dist/sql-renderer-DlZKtvVf.d.mts +1 -0
  107. package/dist/{sql-utils-C9blmi9x-B90QedVA.mjs → sql-utils-CHBxMmv--Dl7wl7n3.mjs} +3 -3
  108. package/dist/{sql-utils-C9blmi9x-B90QedVA.mjs.map → sql-utils-CHBxMmv--Dl7wl7n3.mjs.map} +1 -1
  109. package/dist/{sqlite-contract-view-B0oBTJQ0-DGNLlkLM.mjs → sqlite-contract-view-6qHjyMcG-BHZ8iO5v.mjs} +4 -4
  110. package/dist/{sqlite-contract-view-B0oBTJQ0-DGNLlkLM.mjs.map → sqlite-contract-view-6qHjyMcG-BHZ8iO5v.mjs.map} +1 -1
  111. package/dist/{sqlite-migration-DvNpo879-DcOagmQ1.mjs → sqlite-migration-1OBxvebH-BNjpjOW4.mjs} +13 -10
  112. package/dist/sqlite-migration-1OBxvebH-BNjpjOW4.mjs.map +1 -0
  113. package/dist/{sqlite-unbound-database-Df3Wf5ZA-B1QemRgb.mjs → sqlite-unbound-database-CfLXSiVo-Dy5VBXGz.mjs} +4 -4
  114. package/dist/{sqlite-unbound-database-Df3Wf5ZA-B1QemRgb.mjs.map → sqlite-unbound-database-CfLXSiVo-Dy5VBXGz.mjs.map} +1 -1
  115. package/dist/target.d.mts +14 -14
  116. package/dist/target.mjs +23 -23
  117. package/dist/target__aggregates.d.mts +1 -1
  118. package/dist/target__aggregates.mjs +1 -1
  119. package/dist/target__codec-ids.d.mts +3 -3
  120. package/dist/target__codec-ids.mjs +2 -2
  121. package/dist/target__codec-types.d.mts +3 -3
  122. package/dist/target__codecs.d.mts +3 -3
  123. package/dist/target__codecs.mjs +4 -4
  124. package/dist/target__contract-free.mjs +2 -2
  125. package/dist/target__control.d.mts +1 -1
  126. package/dist/target__control.mjs +8 -7
  127. package/dist/target__control.mjs.map +1 -1
  128. package/dist/target__data-types.d.mts +2 -2
  129. package/dist/target__data-types.mjs +3 -3
  130. package/dist/target__default-normalizer.mjs +1 -1
  131. package/dist/target__migration.mjs +2 -2
  132. package/dist/target__op-factory-call.mjs +1 -1
  133. package/dist/target__pack.d.mts +1 -1
  134. package/dist/target__pack.mjs +1 -1
  135. package/dist/target__planner-produced-sqlite-migration.d.mts +2 -2
  136. package/dist/target__planner-produced-sqlite-migration.mjs +1 -1
  137. package/dist/target__planner.d.mts +1 -1
  138. package/dist/target__planner.mjs +1 -1
  139. package/dist/target__render-ops.mjs +1 -1
  140. package/dist/target__runtime.mjs +3 -3
  141. package/dist/target__sql-utils.mjs +1 -1
  142. package/dist/target__types.mjs +1 -1
  143. package/dist/{types-28E593y9.d.mts → types-CexPOm8x.d.mts} +1 -1
  144. package/package.json +10 -10
  145. package/dist/aggregates-DMvLJFlR.mjs.map +0 -1
  146. package/dist/codec-ids-9Fs9p6ST.d.mts +0 -1
  147. package/dist/codec-ids-BElbEYb_-CeWfv5bC.d.mts.map +0 -1
  148. package/dist/codec-ids-BHBFCNsQ-C1Af_LGF.mjs.map +0 -1
  149. package/dist/codec-types-CGtSWeZ5-B5RH39BA.d.mts.map +0 -1
  150. package/dist/codec-types-Dx9dQe-Y.d.mts +0 -1
  151. package/dist/codec-types-IproBv-Q.d.mts +0 -2
  152. package/dist/codecs-A0DbaZRE-CMyLhO_K.d.mts.map +0 -1
  153. package/dist/codecs-B-paWXdt.mjs.map +0 -1
  154. package/dist/codecs-CX5BZUdO.d.mts +0 -1
  155. package/dist/codecs-izBhU4f1-uArTiOxL.mjs.map +0 -1
  156. package/dist/column-types-bTPNfz46.d.mts.map +0 -1
  157. package/dist/column-types-toYbR7mn.mjs +0 -22
  158. package/dist/column-types-toYbR7mn.mjs.map +0 -1
  159. package/dist/control-BvT30n3D.mjs.map +0 -1
  160. package/dist/control-DGa_C2q6.d.mts.map +0 -1
  161. package/dist/data-type-entries-B6YmbQDH-RnV5wVv8.mjs.map +0 -1
  162. package/dist/data-types-fYwGTal5-BxuZD5EE.mjs.map +0 -1
  163. package/dist/descriptor-meta-C2RNdGqi-BzR_I68E.mjs.map +0 -1
  164. package/dist/descriptor-meta-CEjGA0WH-CxgiKj3V.mjs.map +0 -1
  165. package/dist/descriptor-meta-Drr6Abaf-P67SenMd.mjs.map +0 -1
  166. package/dist/errors-D9vZNPSI-DoNmdfv7.mjs.map +0 -1
  167. package/dist/op-factory-call-B3oOyB-T-Bhg17pAj.mjs.map +0 -1
  168. package/dist/planner-COl0BmJ_-SJuP-72Y.mjs.map +0 -1
  169. package/dist/planner-produced-sqlite-migration-BHH_ftCV-CndNmTrH.d.mts.map +0 -1
  170. package/dist/planner-produced-sqlite-migration-CE1q5Uqq-9kjqMR-1.mjs.map +0 -1
  171. package/dist/planner-produced-sqlite-migration-_n61WaiD.d.mts +0 -1
  172. package/dist/sql-renderer-_NdIrQuX.d.mts +0 -1
  173. package/dist/sqlite-migration-DvNpo879-DcOagmQ1.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ddl-BvD-wVtg-BoEWa8CG.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/ddl-BvD-wVtg.mjs"],"sourcesContent":["import { p as SQLITE_TEXT_CODEC_ID } from \"./codec-ids-BHBFCNsQ.mjs\";\nimport { t as SqliteCreateTable } from \"./nodes-DUZSdX86.mjs\";\nimport { FunctionSource } from \"@internal/sql-relational-core/ast\";\nimport { cfExpr, cfTable, exprSelect } from \"@internal/sql-relational-core/contract-free\";\n//#region src/contract-free/checks.ts\n/**\n* Typed builder for the migration planner's column-existence checks. Produces\n* `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM pragma_table_info(?1) WHERE \"name\" = ?2`\n* ASTs with the table and column names bound as text parameters — never\n* inlined into the SQL.\n*/\nfunction columnExistsAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.identifierRef(\"name\").eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn {\n\t\tcolumnAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tcolumnPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no column of the table has a name SQLite takes for `column`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM pragma_table_info(?1) WHERE \"name\" COLLATE NOCASE\n* = ?2`: SQLite compares column names without regard to the case of ASCII letters, as `NOCASE`\n* does.\n*/\nfunction columnNameTakenAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for table-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ?1 AND \"name\" = ?2`\n* with the table name and the literal `'table'` bound as text parameters.\n*/\nfunction tableExistsAst(tableName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"table\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(tableName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\ttableAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\ttablePresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no table, index or view has a name SQLite takes for `name`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM \"sqlite_master\" WHERE \"name\" COLLATE NOCASE = ?1`:\n* tables, indexes and views share one set of names, which SQLite compares without regard to the\n* case of ASCII letters.\n*/\nfunction tableNameTakenAst(tableName) {\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(tableName, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(cfTable(\"sqlite_master\")).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for index-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ?1 AND \"name\" = ?2`\n* with the index name and the literal `'index'` bound as text parameters.\n*/\nfunction indexExistsAst(indexName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"index\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(indexName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\tindexAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tindexPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n//#endregion\n//#region src/contract-free/ddl.ts\n/**\n* Build a SQLite `CREATE TABLE` query node.\n*\n* Pass `constraints` for table-level composite primary keys, foreign keys, and\n* unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},\n* and {@link UniqueConstraint} classes from `@internal/sql-relational-core/ast`.\n*\n* Precondition: identifiers (`table`, column names/types) are emitted to SQL\n* verbatim — they are not quoted or escaped, so callers must pass pre-trusted\n* values (e.g. fixed control-plane identifiers). String-literal default values,\n* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.\n* Identifier quoting for untrusted identifiers is added when the migration\n* planner adopts this lowering path.\n*/\nfunction createTable(options) {\n\treturn new SqliteCreateTable(options);\n}\n//#endregion\nexport { tableExistsAst as a, indexExistsAst as i, columnExistsAst as n, tableNameTakenAst as o, columnNameTakenAst as r, createTable as t };\n\n//# sourceMappingURL=ddl-BvD-wVtg.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,gBAAgB,OAAO,QAAQ;CACvC,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC;CACrG,MAAM,QAAQ,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,QAAQ,oBAAoB;CAC/E,OAAO;EACN,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAChH,qBAAqB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAClH;AACD;;;;;;;AAOA,SAAS,mBAAmB,OAAO,QAAQ;CAC1C,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC;CACrG,MAAM,QAAQ,OAAO,GAAG;EACvB,QAAQ;EACR,UAAU;EACV,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;;;;;AAMA,SAAS,eAAe,WAAW;CAClC,MAAM,SAAS,QAAQ,eAAe;CACtC,MAAM,QAAQ,OAAO,MAAM,CAAC,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,SAAS,oBAAoB,GAAG,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,WAAW,oBAAoB,CAAC,CAAC;CACvK,OAAO;EACN,mBAAmB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC/G,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CACjH;AACD;;;;;;;;;;;;;;;AAiBA,SAAS,YAAY,SAAS;CAC7B,OAAO,IAAI,kBAAkB,OAAO;AACrC"}
1
+ {"version":3,"file":"ddl-CgkyurGo-B2o4mSIT.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/ddl-CgkyurGo.mjs"],"sourcesContent":["import { h as SQLITE_TEXT_CODEC_ID } from \"./codec-ids-CTshXpbg.mjs\";\nimport { t as SqliteCreateTable } from \"./nodes-DUZSdX86.mjs\";\nimport { FunctionSource } from \"@internal/sql-relational-core/ast\";\nimport { cfExpr, cfTable, exprSelect } from \"@internal/sql-relational-core/contract-free\";\n//#region src/contract-free/checks.ts\n/**\n* Typed builder for the migration planner's column-existence checks. Produces\n* `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM pragma_table_info(?1) WHERE \"name\" = ?2`\n* ASTs with the table and column names bound as text parameters — never\n* inlined into the SQL.\n*/\nfunction columnExistsAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.identifierRef(\"name\").eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn {\n\t\tcolumnAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tcolumnPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no column of the table has a name SQLite takes for `column`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM pragma_table_info(?1) WHERE \"name\" COLLATE NOCASE\n* = ?2`: SQLite compares column names without regard to the case of ASCII letters, as `NOCASE`\n* does.\n*/\nfunction columnNameTakenAst(table, column) {\n\tconst source = FunctionSource.of(\"pragma_table_info\", [cfExpr.param(table, SQLITE_TEXT_CODEC_ID).ast]);\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(column, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for table-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ?1 AND \"name\" = ?2`\n* with the table name and the literal `'table'` bound as text parameters.\n*/\nfunction tableExistsAst(tableName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"table\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(tableName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\ttableAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\ttablePresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n/**\n* Typed builder for the check that no table, index or view has a name SQLite takes for `name`.\n* Produces `SELECT COUNT(*) = 0 AS \"result\" FROM \"sqlite_master\" WHERE \"name\" COLLATE NOCASE = ?1`:\n* tables, indexes and views share one set of names, which SQLite compares without regard to the\n* case of ASCII letters.\n*/\nfunction tableNameTakenAst(tableName) {\n\tconst where = cfExpr.fn({\n\t\tmethod: \"collateNocase\",\n\t\ttemplate: \"{{self}} COLLATE NOCASE\",\n\t\tself: cfExpr.identifierRef(\"name\"),\n\t\treturns: {\n\t\t\tcodecId: SQLITE_TEXT_CODEC_ID,\n\t\t\tnullable: false\n\t\t}\n\t}).eqParam(tableName, SQLITE_TEXT_CODEC_ID);\n\treturn { nameFree: () => exprSelect().from(cfTable(\"sqlite_master\")).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build() };\n}\n/**\n* Typed builder for index-existence checks over `sqlite_master`.\n* Produces `SELECT COUNT(*) {=|>} 0 AS \"result\" FROM \"sqlite_master\" WHERE \"type\" = ?1 AND \"name\" = ?2`\n* with the index name and the literal `'index'` bound as text parameters.\n*/\nfunction indexExistsAst(indexName) {\n\tconst source = cfTable(\"sqlite_master\");\n\tconst where = cfExpr.allOf([cfExpr.identifierRef(\"type\").eqParam(\"index\", SQLITE_TEXT_CODEC_ID), cfExpr.identifierRef(\"name\").eqParam(indexName, SQLITE_TEXT_CODEC_ID)]);\n\treturn {\n\t\tindexAbsent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().eqLit(0)).where(where).build(),\n\t\tindexPresent: () => exprSelect().from(source).project(\"result\", cfExpr.countStar().gtLit(0)).where(where).build()\n\t};\n}\n//#endregion\n//#region src/contract-free/ddl.ts\n/**\n* Build a SQLite `CREATE TABLE` query node.\n*\n* Pass `constraints` for table-level composite primary keys, foreign keys, and\n* unique constraints — use the {@link PrimaryKeyConstraint}, {@link ForeignKeyConstraint},\n* and {@link UniqueConstraint} classes from `@internal/sql-relational-core/ast`.\n*\n* Precondition: identifiers (`table`, column names/types) are emitted to SQL\n* verbatim — they are not quoted or escaped, so callers must pass pre-trusted\n* values (e.g. fixed control-plane identifiers). String-literal default values,\n* by contrast, are single-quote-escaped (embedded `'` doubled) by the renderer.\n* Identifier quoting for untrusted identifiers is added when the migration\n* planner adopts this lowering path.\n*/\nfunction createTable(options) {\n\treturn new SqliteCreateTable(options);\n}\n//#endregion\nexport { tableExistsAst as a, indexExistsAst as i, columnExistsAst as n, tableNameTakenAst as o, columnNameTakenAst as r, createTable as t };\n\n//# sourceMappingURL=ddl-CgkyurGo.mjs.map"],"mappings":";;;;;;;;;;;AAWA,SAAS,gBAAgB,OAAO,QAAQ;CACvC,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC;CACrG,MAAM,QAAQ,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,QAAQ,oBAAoB;CAC/E,OAAO;EACN,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAChH,qBAAqB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CAClH;AACD;;;;;;;AAOA,SAAS,mBAAmB,OAAO,QAAQ;CAC1C,MAAM,SAAS,eAAe,GAAG,qBAAqB,CAAC,OAAO,MAAM,OAAO,oBAAoB,CAAC,CAAC,GAAG,CAAC;CACrG,MAAM,QAAQ,OAAO,GAAG;EACvB,QAAQ;EACR,UAAU;EACV,MAAM,OAAO,cAAc,MAAM;EACjC,SAAS;GACR,SAAS;GACT,UAAU;EACX;CACD,CAAC,CAAC,CAAC,QAAQ,QAAQ,oBAAoB;CACvC,OAAO,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C,CAAC,QAAQ,SAAS,oBAAoB,GAAG,OAAO,cAAc,MAAM,CAAC,CAAC,QAAQ,WAAW,oBAAoB,CAAC,CAAC;CACvK,OAAO;EACN,mBAAmB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;EAC/G,oBAAoB,WAAW,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,QAAQ,UAAU,OAAO,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;CACjH;AACD;;;;;;;;;;;;;;;AAiBA,SAAS,YAAY,SAAS;CAC7B,OAAO,IAAI,kBAAkB,OAAO;AACrC"}
@@ -1,5 +1,5 @@
1
- import { a as SQLITE_TIME_TEXT_FORMAT, i as SQLITE_TIME_NOW_EXPRESSION, n as SQLITE_DATE_NOW_EXPRESSION, o as sqliteNowExpressionFor, t as SQLITE_DATETIME_TEXT_FORMAT } from "./datetime-text-BogpvE70-VwTG2rUc.mjs";
2
- //#region ../../../3-targets/sqlite/1-target/dist/default-normalizer-BcGrp77x.mjs
1
+ import { a as SQLITE_TIME_TEXT_FORMAT, i as SQLITE_TIME_NOW_EXPRESSION, n as SQLITE_DATE_NOW_EXPRESSION, o as sqliteNowExpressionFor, t as SQLITE_DATETIME_TEXT_FORMAT } from "./datetime-text-nkVy_w0q-DZnIEmgr.mjs";
2
+ //#region ../../../3-targets/sqlite/1-target/dist/default-normalizer-Xsys5QJm.mjs
3
3
  const NULL_PATTERN = /^NULL$/i;
4
4
  const INTEGER_PATTERN = /^[+-]?\d+$/;
5
5
  const REAL_PATTERN = /^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/;
@@ -121,4 +121,4 @@ function sqliteResolveDefault(def, column) {
121
121
  //#endregion
122
122
  export { sqliteResolveDefault as n, stripOuterParens as r, readSqliteDefault as t };
123
123
 
124
- //# sourceMappingURL=default-normalizer-BcGrp77x-CMWxtX1W.mjs.map
124
+ //# sourceMappingURL=default-normalizer-Xsys5QJm-bPQiHGKp.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-normalizer-BcGrp77x-CMWxtX1W.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/default-normalizer-BcGrp77x.mjs"],"sourcesContent":["import { a as SQLITE_TIME_TEXT_FORMAT, i as SQLITE_TIME_NOW_EXPRESSION, n as SQLITE_DATE_NOW_EXPRESSION, o as sqliteNowExpressionFor, t as SQLITE_DATETIME_TEXT_FORMAT } from \"./datetime-text-BogpvE70.mjs\";\n//#region src/core/default-normalizer.ts\nconst NULL_PATTERN = /^NULL$/i;\nconst INTEGER_PATTERN = /^[+-]?\\d+$/;\nconst REAL_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;\nconst STRFTIME_NOW_PATTERN = /^strftime\\s*\\(\\s*(['\"])([^'\"]*)\\1\\s*,\\s*(['\"])now\\3\\s*\\)$/i;\nconst DATE_NOW_PATTERN = /^date\\s*\\(\\s*(['\"])now\\1\\s*\\)$/i;\n/** The name of the current instant, as a contract writes it. */\nconst INSTANT_NOW = \"now()\";\n/**\n* The name of the current value `expression` writes: `now()` for the current instant, in any of the forms SQLite writes it, and the expression a `now()` default is written as for the current date and for the current time of day, since those hold different text. `undefined` for any other expression.\n*/\nfunction currentValueNamed(expression) {\n\tconst lower = expression.toLowerCase();\n\tif (lower === \"current_timestamp\" || lower === \"datetime('now')\" || lower === \"datetime(\\\"now\\\")\") return INSTANT_NOW;\n\tif (lower === \"current_date\" || DATE_NOW_PATTERN.test(expression)) return SQLITE_DATE_NOW_EXPRESSION;\n\tswitch (expression.match(STRFTIME_NOW_PATTERN)?.[2]) {\n\t\tcase SQLITE_DATETIME_TEXT_FORMAT: return INSTANT_NOW;\n\t\tcase SQLITE_TIME_TEXT_FORMAT: return SQLITE_TIME_NOW_EXPRESSION;\n\t\tdefault: return;\n\t}\n}\n/**\n* Strips a single matched wrapping pair of outer parens from `s`. Conservative:\n* only strips when the leading `(` is matched by the trailing `)` (so\n* `(a) + (b)` is returned unchanged). Mirrors SQLite's own\n* `pragma_table_info.dflt_value` normalization for expression defaults, and\n* is shared with the recreate-table postcheck builder so both sides agree\n* on the text.\n*/\nfunction stripOuterParens(s) {\n\tif (!s.startsWith(\"(\") || !s.endsWith(\")\")) return s;\n\tlet depth = 0;\n\tfor (let i = 0; i < s.length; i++) if (s[i] === \"(\") depth += 1;\n\telse if (s[i] === \")\") {\n\t\tdepth -= 1;\n\t\tif (depth === 0 && i < s.length - 1) return s;\n\t}\n\treturn s.slice(1, -1);\n}\n/** The type affinity SQLite gives a column of `declaredType`, by its rules in order. */\nfunction affinityOf(declaredType) {\n\tconst upper = declaredType.toUpperCase();\n\tif (upper.includes(\"INT\")) return \"integer\";\n\tif (upper.includes(\"CHAR\") || upper.includes(\"CLOB\") || upper.includes(\"TEXT\")) return \"text\";\n\tif (upper.includes(\"BLOB\") || upper.trim() === \"\") return \"blob\";\n\tif (upper.includes(\"REAL\") || upper.includes(\"FLOA\") || upper.includes(\"DOUB\")) return \"real\";\n\treturn \"numeric\";\n}\n/** A numeral as the driver returns it: a number, or digit text for an integer no double holds exactly. */\nfunction numberBody(numeral) {\n\tif (INTEGER_PATTERN.test(numeral)) {\n\t\tconst integer = BigInt(numeral);\n\t\treturn Number.isSafeInteger(Number(integer)) ? Number(integer) : integer.toString();\n\t}\n\treturn Number(numeral);\n}\n/** What the column stores for a literal written as `text` (quoted) or as a numeral, by its affinity. */\nfunction bodyFor(literal, quoted, affinity) {\n\tconst numeral = INTEGER_PATTERN.test(literal) || REAL_PATTERN.test(literal);\n\tif (affinity === \"text\") return literal;\n\tif (affinity === \"blob\") return quoted || !numeral ? literal : numberBody(literal);\n\treturn numeral ? numberBody(literal) : literal;\n}\n/** A blob literal: `X'` or `x'`, an even number of hexadecimal digits, `'`. */\nconst BLOB_LITERAL_PATTERN = /^[xX]'((?:[0-9a-fA-F]{2})*)'$/;\n/**\n* Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as for an instant are `now()`; `date('now')` and `CURRENT_DATE`, which writes the same text, are read as `date('now')`, and the expression for the current time of day keeps its own name, so a default that writes a date is never read as one that writes an instant. `CURRENT_TIME` writes no fraction of a second, which is not the text `sqlite/time` stores, so it is kept as reported. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.\n*/\nfunction readSqliteDefault(rawDefault, declaredType) {\n\tlet trimmed = rawDefault.trim();\n\twhile (true) {\n\t\tconst stripped = stripOuterParens(trimmed).trim();\n\t\tif (stripped === trimmed) break;\n\t\ttrimmed = stripped;\n\t}\n\tconst currentValue = currentValueNamed(trimmed);\n\tif (currentValue !== void 0) return {\n\t\tkind: \"function\",\n\t\texpression: currentValue\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return { kind: \"null\" };\n\tconst affinity = affinityOf(declaredType);\n\tconst quoted = STRING_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (quoted !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(quoted.replace(/''/g, \"'\"), true, affinity)\n\t\t}\n\t};\n\tconst blobHex = BLOB_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (blobHex !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: new Uint8Array(Buffer.from(blobHex, \"hex\"))\n\t\t}\n\t};\n\tif (INTEGER_PATTERN.test(trimmed) || REAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(trimmed, false, affinity)\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n/**\n* Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A `now()` default is named as the expression the column's data type writes it as, so a `now()` on a date column and one on a date and time column differ, as their stored text does. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.\n*/\nfunction sqliteResolveDefault(def, column) {\n\tif (def.kind !== \"function\") return def;\n\tconst read = readSqliteDefault(def.expression === INSTANT_NOW ? sqliteNowExpressionFor(column.dataTypeId) ?? def.expression : def.expression, column.typeText);\n\treturn read.kind === \"function\" ? read : def;\n}\n//#endregion\nexport { sqliteResolveDefault as n, stripOuterParens as r, readSqliteDefault as t };\n\n//# sourceMappingURL=default-normalizer-BcGrp77x.mjs.map"],"mappings":";;AAEA,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,yBAAyB;AAC/B,MAAM,uBAAuB;AAC7B,MAAM,mBAAmB;;AAEzB,MAAM,cAAc;;;;AAIpB,SAAS,kBAAkB,YAAY;CACtC,MAAM,QAAQ,WAAW,YAAY;CACrC,IAAI,UAAU,uBAAuB,UAAU,qBAAqB,UAAU,qBAAqB,OAAO;CAC1G,IAAI,UAAU,kBAAkB,iBAAiB,KAAK,UAAU,GAAG,OAAO;CAC1E,QAAQ,WAAW,MAAM,oBAAoB,CAAC,GAAG,IAAjD;EACC,KAAK,6BAA6B,OAAO;EACzC,KAAK,yBAAyB,OAAO;EACrC,SAAS;CACV;AACD;;;;;;;;;AASA,SAAS,iBAAiB,GAAG;CAC5B,IAAI,CAAC,EAAE,WAAW,GAAG,KAAK,CAAC,EAAE,SAAS,GAAG,GAAG,OAAO;CACnD,IAAI,QAAQ;CACZ,KAAK,IAAI,IAAI,GAAG,IAAI,EAAE,QAAQ,KAAK,IAAI,EAAE,OAAO,KAAK,SAA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AAO;EACnC,MAAM;EACN,YAAY;CACb;CACA,IAAI,aAAa,KAAK,OAAO,GAAG,OAAO,EAAE,MAAM,OAAO;CACtD,MAAM,WAAW,WAAW,YAAY;CACxC,MAAM,SAAS,uBAAuB,KAAK,OAAO,CAAC,GAAG;CACtD,IAAI,WAAW,KAAK,GAAG,OAAO;EAC7B,MAAM;EACN,SAAS;GACR,MAAM;GACN,MAAM,QAAQ,OAAO,QAAQ,OAAO,GAAG,GAAG,MAAM,QAAQ;EACzD;CACD;CACA,MAAM,UAAU,qBAAqB,KAAK,OAAO,CAAC,GAAG;CACrD,IAAI,YAAY,KAAK,GAAG,OAAO;EAC9B,MAAM;EACN,SAAS;GACR,MAAM;GACN,MAAM,IAAI,WAAW,OAAO,KAAK,SAAS,KAAK,CAAC;EACjD;CACD;CACA,IAAI,gBAAgB,KAAK,OAAO,KAAK,aAAa,KAAK,OAAO,GAAG,OAAO;EACvE,MAAM;EACN,SAAS;GACR,MAAM;GACN,MAAM,QAAQ,SAAS,OAAO,QAAQ;EACvC;CACD;CACA,OAAO;EACN,MAAM;EACN,YAAY;CACb;AACD;;;;AAIA,SAAS,qBAAqB,KAAK,QAAQ;CAC1C,IAAI,IAAI,SAAS,YAAY,OAAO;CACpC,MAAM,OAAO,kBAAkB,IAAI,eAAe,cAAc,uBAAuB,OAAO,UAAU,KAAK,IAAI,aAAa,IAAI,YAAY,OAAO,QAAQ;CAC7J,OAAO,KAAK,SAAS,aAAa,OAAO;AAC1C"}
1
+ {"version":3,"file":"default-normalizer-Xsys5QJm-bPQiHGKp.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/default-normalizer-Xsys5QJm.mjs"],"sourcesContent":["import { a as SQLITE_TIME_TEXT_FORMAT, i as SQLITE_TIME_NOW_EXPRESSION, n as SQLITE_DATE_NOW_EXPRESSION, o as sqliteNowExpressionFor, t as SQLITE_DATETIME_TEXT_FORMAT } from \"./datetime-text-nkVy_w0q.mjs\";\n//#region src/core/default-normalizer.ts\nconst NULL_PATTERN = /^NULL$/i;\nconst INTEGER_PATTERN = /^[+-]?\\d+$/;\nconst REAL_PATTERN = /^[+-]?(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:[eE][+-]?\\d+)?$/;\nconst STRING_LITERAL_PATTERN = /^'((?:[^']|'')*)'$/;\nconst STRFTIME_NOW_PATTERN = /^strftime\\s*\\(\\s*(['\"])([^'\"]*)\\1\\s*,\\s*(['\"])now\\3\\s*\\)$/i;\nconst DATE_NOW_PATTERN = /^date\\s*\\(\\s*(['\"])now\\1\\s*\\)$/i;\n/** The name of the current instant, as a contract writes it. */\nconst INSTANT_NOW = \"now()\";\n/**\n* The name of the current value `expression` writes: `now()` for the current instant, in any of the forms SQLite writes it, and the expression a `now()` default is written as for the current date and for the current time of day, since those hold different text. `undefined` for any other expression.\n*/\nfunction currentValueNamed(expression) {\n\tconst lower = expression.toLowerCase();\n\tif (lower === \"current_timestamp\" || lower === \"datetime('now')\" || lower === \"datetime(\\\"now\\\")\") return INSTANT_NOW;\n\tif (lower === \"current_date\" || DATE_NOW_PATTERN.test(expression)) return SQLITE_DATE_NOW_EXPRESSION;\n\tswitch (expression.match(STRFTIME_NOW_PATTERN)?.[2]) {\n\t\tcase SQLITE_DATETIME_TEXT_FORMAT: return INSTANT_NOW;\n\t\tcase SQLITE_TIME_TEXT_FORMAT: return SQLITE_TIME_NOW_EXPRESSION;\n\t\tdefault: return;\n\t}\n}\n/**\n* Strips a single matched wrapping pair of outer parens from `s`. Conservative:\n* only strips when the leading `(` is matched by the trailing `)` (so\n* `(a) + (b)` is returned unchanged). Mirrors SQLite's own\n* `pragma_table_info.dflt_value` normalization for expression defaults, and\n* is shared with the recreate-table postcheck builder so both sides agree\n* on the text.\n*/\nfunction stripOuterParens(s) {\n\tif (!s.startsWith(\"(\") || !s.endsWith(\")\")) return s;\n\tlet depth = 0;\n\tfor (let i = 0; i < s.length; i++) if (s[i] === \"(\") depth += 1;\n\telse if (s[i] === \")\") {\n\t\tdepth -= 1;\n\t\tif (depth === 0 && i < s.length - 1) return s;\n\t}\n\treturn s.slice(1, -1);\n}\n/** The type affinity SQLite gives a column of `declaredType`, by its rules in order. */\nfunction affinityOf(declaredType) {\n\tconst upper = declaredType.toUpperCase();\n\tif (upper.includes(\"INT\")) return \"integer\";\n\tif (upper.includes(\"CHAR\") || upper.includes(\"CLOB\") || upper.includes(\"TEXT\")) return \"text\";\n\tif (upper.includes(\"BLOB\") || upper.trim() === \"\") return \"blob\";\n\tif (upper.includes(\"REAL\") || upper.includes(\"FLOA\") || upper.includes(\"DOUB\")) return \"real\";\n\treturn \"numeric\";\n}\n/** A numeral as the driver returns it: a number, or digit text for an integer no double holds exactly. */\nfunction numberBody(numeral) {\n\tif (INTEGER_PATTERN.test(numeral)) {\n\t\tconst integer = BigInt(numeral);\n\t\treturn Number.isSafeInteger(Number(integer)) ? Number(integer) : integer.toString();\n\t}\n\treturn Number(numeral);\n}\n/** What the column stores for a literal written as `text` (quoted) or as a numeral, by its affinity. */\nfunction bodyFor(literal, quoted, affinity) {\n\tconst numeral = INTEGER_PATTERN.test(literal) || REAL_PATTERN.test(literal);\n\tif (affinity === \"text\") return literal;\n\tif (affinity === \"blob\") return quoted || !numeral ? literal : numberBody(literal);\n\treturn numeral ? numberBody(literal) : literal;\n}\n/** A blob literal: `X'` or `x'`, an even number of hexadecimal digits, `'`. */\nconst BLOB_LITERAL_PATTERN = /^[xX]'((?:[0-9a-fA-F]{2})*)'$/;\n/**\n* Reads a column's reported default. `CURRENT_TIMESTAMP`, `datetime('now')` and the expression a `now()` default is written as for an instant are `now()`; `date('now')` and `CURRENT_DATE`, which writes the same text, are read as `date('now')`, and the expression for the current time of day keeps its own name, so a default that writes a date is never read as one that writes an instant. `CURRENT_TIME` writes no fraction of a second, which is not the text `sqlite/time` stores, so it is kept as reported. A quoted string, a numeral or a blob literal (`X'6869'`, read as its bytes) is a literal; any other expression is a function default, kept as reported.\n*/\nfunction readSqliteDefault(rawDefault, declaredType) {\n\tlet trimmed = rawDefault.trim();\n\twhile (true) {\n\t\tconst stripped = stripOuterParens(trimmed).trim();\n\t\tif (stripped === trimmed) break;\n\t\ttrimmed = stripped;\n\t}\n\tconst currentValue = currentValueNamed(trimmed);\n\tif (currentValue !== void 0) return {\n\t\tkind: \"function\",\n\t\texpression: currentValue\n\t};\n\tif (NULL_PATTERN.test(trimmed)) return { kind: \"null\" };\n\tconst affinity = affinityOf(declaredType);\n\tconst quoted = STRING_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (quoted !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(quoted.replace(/''/g, \"'\"), true, affinity)\n\t\t}\n\t};\n\tconst blobHex = BLOB_LITERAL_PATTERN.exec(trimmed)?.[1];\n\tif (blobHex !== void 0) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: new Uint8Array(Buffer.from(blobHex, \"hex\"))\n\t\t}\n\t};\n\tif (INTEGER_PATTERN.test(trimmed) || REAL_PATTERN.test(trimmed)) return {\n\t\tkind: \"literal\",\n\t\tliteral: {\n\t\t\tkind: \"value\",\n\t\t\tbody: bodyFor(trimmed, false, affinity)\n\t\t}\n\t};\n\treturn {\n\t\tkind: \"function\",\n\t\texpression: trimmed\n\t};\n}\n/**\n* Names a contract's expression default the way {@link readSqliteDefault} names the same function in the database, so `` sql`CURRENT_TIMESTAMP` `` and the database's `datetime('now')` compare equal. A `now()` default is named as the expression the column's data type writes it as, so a `now()` on a date column and one on a date and time column differ, as their stored text does. A literal default, and an expression that writes a literal, pass through unchanged; introspection reads the latter's literal with the column's codec, and the diff compares the values.\n*/\nfunction sqliteResolveDefault(def, column) {\n\tif (def.kind !== \"function\") return def;\n\tconst read = readSqliteDefault(def.expression === INSTANT_NOW ? sqliteNowExpressionFor(column.dataTypeId) ?? def.expression : def.expression, column.typeText);\n\treturn read.kind === \"function\" ? read : def;\n}\n//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W,OAAO,KAAK,SAAS,KAAK,CAAC;EACjD;CACD;CACA,IAAI,gBAAgB,KAAK,OAAO,KAAK,aAAa,KAAK,OAAO,GAAG,OAAO;EACvE,MAAM;EACN,SAAS;GACR,MAAM;GACN,MAAM,QAAQ,SAAS,OAAO,QAAQ;EACvC;CACD;CACA,OAAO;EACN,MAAM;EACN,YAAY;CACb;AACD;;;;AAIA,SAAS,qBAAqB,KAAK,QAAQ;CAC1C,IAAI,IAAI,SAAS,YAAY,OAAO;CACpC,MAAM,OAAO,kBAAkB,IAAI,eAAe,cAAc,uBAAuB,OAAO,UAAU,KAAK,IAAI,aAAa,IAAI,YAAY,OAAO,QAAQ;CAC7J,OAAO,KAAK,SAAS,aAAa,OAAO;AAC1C"}
@@ -1,6 +1,6 @@
1
- import { a as sqliteCodecRegistry } from "./codecs-B-paWXdt.mjs";
2
- import { n as sqliteAdapterContractContributions } from "./contract-contributions-CyHMdkva-2bg6kg_n.mjs";
3
- //#region ../../../3-targets/sqlite/2-adapter/dist/descriptor-meta-C2RNdGqi.mjs
1
+ import { a as sqliteCodecRegistry } from "./codecs-EhvrdV8v.mjs";
2
+ import { n as sqliteAdapterContractContributions } from "./contract-contributions-CyHMdkva-BE5-kJj3.mjs";
3
+ //#region ../../../3-targets/sqlite/2-adapter/dist/descriptor-meta-BUMTRa-0.mjs
4
4
  const sqliteAdapterDescriptorMeta = {
5
5
  kind: "adapter",
6
6
  familyId: "sql",
@@ -13,7 +13,7 @@ const sqliteAdapterDescriptorMeta = {
13
13
  codecTypes: {
14
14
  codecDescriptors: Array.from(sqliteCodecRegistry.values()),
15
15
  import: {
16
- package: "@internal/adapter-sqlite/codec-types",
16
+ package: `@prisma/orm-target-sqlite/adapter/codec-types`,
17
17
  named: "CodecTypes",
18
18
  alias: "SqliteTypes"
19
19
  }
@@ -23,4 +23,4 @@ const sqliteAdapterDescriptorMeta = {
23
23
  //#endregion
24
24
  export { sqliteAdapterDescriptorMeta as t };
25
25
 
26
- //# sourceMappingURL=descriptor-meta-C2RNdGqi-BzR_I68E.mjs.map
26
+ //# sourceMappingURL=descriptor-meta-BUMTRa-0-D2bfF0Yr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-BUMTRa-0-D2bfF0Yr.mjs","names":[],"sources":["../../../../3-targets/sqlite/2-adapter/dist/descriptor-meta-BUMTRa-0.mjs"],"sourcesContent":["import { t as sqliteAdapterContractContributions } from \"./contract-contributions-CyHMdkva.mjs\";\nimport { sqliteCodecRegistry } from \"@internal/target-sqlite/codecs\";\n//#region src/core/module-base.ts\nconst moduleBase = typeof __PRISMA_PUBLISHED_MODULE_BASE__ADAPTER_SQLITE === \"string\" ? __PRISMA_PUBLISHED_MODULE_BASE__ADAPTER_SQLITE : \"@internal/adapter-sqlite\";\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst sqliteAdapterDescriptorMeta = {\n\tkind: \"adapter\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: sqliteAdapterContractContributions.capabilities,\n\ttypes: {\n\t\taggregateDescriptors: sqliteAdapterContractContributions.types.aggregateDescriptors,\n\t\tcodecTypes: {\n\t\t\tcodecDescriptors: Array.from(sqliteCodecRegistry.values()),\n\t\t\timport: {\n\t\t\t\tpackage: `${moduleBase}/codec-types`,\n\t\t\t\tnamed: \"CodecTypes\",\n\t\t\t\talias: \"SqliteTypes\"\n\t\t\t}\n\t\t}\n\t}\n};\n//#endregion\nexport { sqliteAdapterDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-BUMTRa-0.mjs.map"],"mappings":";;;AAMA,MAAM,8BAA8B;CACnC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,mCAAmC;CACjD,OAAO;EACN,sBAAsB,mCAAmC,MAAM;EAC/D,YAAY;GACX,kBAAkB,MAAM,KAAK,oBAAoB,OAAO,CAAC;GACzD,QAAQ;IACP,SAAS;IACT,OAAO;IACP,OAAO;GACR;EACD;CACD;AACD"}
@@ -1,7 +1,7 @@
1
1
  import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
2
  import { blindCast } from "@prisma/orm-framework/utils/casts";
3
3
  import { SqlConnectionError, SqlQueryError } from "@prisma/orm-family-sql/errors";
4
- //#region ../../../3-targets/sqlite/3-driver/dist/descriptor-meta-Drr6Abaf.mjs
4
+ //#region ../../../3-targets/sqlite/3-driver/dist/descriptor-meta-CkiPlqDS.mjs
5
5
  const closedByDriver = /* @__PURE__ */ new WeakSet();
6
6
  /** Closes a database the driver opened and records that the driver closed it. */
7
7
  function closeDatabase(db) {
@@ -12,6 +12,26 @@ function closeDatabase(db) {
12
12
  function wasClosedByDriver(db) {
13
13
  return closedByDriver.has(db);
14
14
  }
15
+ const MIN_SAFE_INTEGER = BigInt(Number.MIN_SAFE_INTEGER);
16
+ const MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);
17
+ /**
18
+ * Prepares a statement that reads every integer as a `bigint`, so a stored integer of any 64-bit size is read exactly, and `changes` and `lastInsertRowid` are exact too.
19
+ */
20
+ function prepareExact(db, sql) {
21
+ const statement = db.prepare(sql);
22
+ statement.setReadBigInts(true);
23
+ return statement;
24
+ }
25
+ /**
26
+ * A row as the application reads it: an integer within the safe integer range is a `number`, and one outside it stays the exact `bigint` for its codec to read or refuse.
27
+ */
28
+ function safeIntegersAsNumbers(row) {
29
+ for (const key in row) {
30
+ const value = row[key];
31
+ if (typeof value === "bigint" && value >= MIN_SAFE_INTEGER && value <= MAX_SAFE_INTEGER) row[key] = Number(value);
32
+ }
33
+ return row;
34
+ }
15
35
  const SQLITE_CONSTRAINT_BASE = 19;
16
36
  const SQLITE_CONSTRAINT_UNIQUE = 2067;
17
37
  const SQLITE_CONSTRAINT_PRIMARYKEY = 1555;
@@ -112,6 +132,6 @@ const sqliteDriverDescriptorMeta = {
112
132
  capabilities: {}
113
133
  };
114
134
  //#endregion
115
- export { wasClosedByDriver as a, sqliteParams as i, normalizeSqliteError as n, sqliteDriverDescriptorMeta as r, closeDatabase as t };
135
+ export { sqliteDriverDescriptorMeta as a, safeIntegersAsNumbers as i, normalizeSqliteError as n, sqliteParams as o, prepareExact as r, wasClosedByDriver as s, closeDatabase as t };
116
136
 
117
- //# sourceMappingURL=descriptor-meta-Drr6Abaf-P67SenMd.mjs.map
137
+ //# sourceMappingURL=descriptor-meta-CkiPlqDS-n3hDP01X.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-CkiPlqDS-n3hDP01X.mjs","names":[],"sources":["../../../../3-targets/sqlite/3-driver/dist/descriptor-meta-CkiPlqDS.mjs"],"sourcesContent":["import { blindCast } from \"@internal/utils/casts\";\nimport { SqlConnectionError, SqlQueryError } from \"@internal/sql-errors\";\nimport { structuredError } from \"@internal/utils/structured-error\";\n//#region src/database-state.ts\nconst closedByDriver = /* @__PURE__ */ new WeakSet();\n/** Closes a database the driver opened and records that the driver closed it. */\nfunction closeDatabase(db) {\n\tdb.close();\n\tclosedByDriver.add(db);\n}\n/** Whether the driver itself closed this database. */\nfunction wasClosedByDriver(db) {\n\treturn closedByDriver.has(db);\n}\n//#endregion\n//#region src/exact-integers.ts\nconst MIN_SAFE_INTEGER = BigInt(Number.MIN_SAFE_INTEGER);\nconst MAX_SAFE_INTEGER = BigInt(Number.MAX_SAFE_INTEGER);\n/**\n* Prepares a statement that reads every integer as a `bigint`, so a stored integer of any 64-bit size is read exactly, and `changes` and `lastInsertRowid` are exact too.\n*/\nfunction prepareExact(db, sql) {\n\tconst statement = db.prepare(sql);\n\tstatement.setReadBigInts(true);\n\treturn statement;\n}\n/**\n* A row as the application reads it: an integer within the safe integer range is a `number`, and one outside it stays the exact `bigint` for its codec to read or refuse.\n*/\nfunction safeIntegersAsNumbers(row) {\n\tfor (const key in row) {\n\t\tconst value = row[key];\n\t\tif (typeof value === \"bigint\" && value >= MIN_SAFE_INTEGER && value <= MAX_SAFE_INTEGER) row[key] = Number(value);\n\t}\n\treturn row;\n}\n//#endregion\n//#region src/normalize-error.ts\nconst SQLITE_CONSTRAINT_BASE = 19;\nconst SQLITE_CONSTRAINT_UNIQUE = 2067;\nconst SQLITE_CONSTRAINT_PRIMARYKEY = 1555;\nconst SQLITE_CONSTRAINT_FOREIGNKEY = 787;\nconst SQLITE_CONSTRAINT_NOTNULL = 1299;\nconst SQLITE_CONSTRAINT_CHECK = 275;\nconst SQLITE_BUSY = 5;\nconst SQLITE_LOCKED = 6;\nconst SQLITE_CANTOPEN = 14;\nconst SQLITE_NOTADB = 26;\nconst INVALID_STATE_CODE = \"ERR_INVALID_STATE\";\nconst GENERAL_ERROR_SQLSTATE = \"HY000\";\nfunction isConstraintError(errcode) {\n\treturn (errcode & 255) === SQLITE_CONSTRAINT_BASE;\n}\nfunction isBusyOrLocked(errcode) {\n\tconst base = errcode & 255;\n\treturn base === SQLITE_BUSY || base === SQLITE_LOCKED;\n}\nfunction isOpenFailure(errcode) {\n\tconst base = errcode & 255;\n\treturn base === SQLITE_CANTOPEN || base === SQLITE_NOTADB;\n}\nfunction isSqliteError(error) {\n\tif (!(error instanceof Error)) return false;\n\treturn error.code === \"ERR_SQLITE_ERROR\";\n}\n/**\n* The one place the driver reads SQLite's message: SQLite reports which constraint failed only\n* in the text, as in \"UNIQUE constraint failed: table.column\".\n*/\nfunction constraintNameFromMessage(message) {\n\treturn /constraint failed: (.+)/.exec(message)?.[1];\n}\nfunction mapErrCodeToSqlState(errcode) {\n\tswitch (errcode) {\n\t\tcase SQLITE_CONSTRAINT_UNIQUE:\n\t\tcase SQLITE_CONSTRAINT_PRIMARYKEY: return \"23505\";\n\t\tcase SQLITE_CONSTRAINT_FOREIGNKEY: return \"23503\";\n\t\tcase SQLITE_CONSTRAINT_NOTNULL: return \"23502\";\n\t\tcase SQLITE_CONSTRAINT_CHECK: return \"23514\";\n\t\tdefault:\n\t\t\tif (isConstraintError(errcode)) return \"23000\";\n\t\t\treturn GENERAL_ERROR_SQLSTATE;\n\t}\n}\n/**\n* Normalizes a node:sqlite error. `databaseClosedByDriver` says whether the driver closed the\n* database the failing call used; only then is a wrong-state error a closed-database connection error.\n*/\nfunction normalizeSqliteError(error, databaseClosedByDriver) {\n\tif (!(error instanceof Error)) return new Error(String(error));\n\tif (isSqliteError(error)) {\n\t\tconst errcode = error.errcode ?? 0;\n\t\tif (isBusyOrLocked(errcode)) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: true\n\t\t});\n\t\tif (isOpenFailure(errcode)) return new SqlConnectionError(error.message, {\n\t\t\tcause: error,\n\t\t\ttransient: false\n\t\t});\n\t\tconst sqlState = mapErrCodeToSqlState(errcode);\n\t\tconst constraint = constraintNameFromMessage(error.message);\n\t\treturn new SqlQueryError(error.message, {\n\t\t\tcause: error,\n\t\t\tsqlState,\n\t\t\t...constraint !== void 0 ? { constraint } : {}\n\t\t});\n\t}\n\tif (\"code\" in error && error.code === INVALID_STATE_CODE) return databaseClosedByDriver ? new SqlConnectionError(error.message, {\n\t\tcause: error,\n\t\ttransient: false\n\t}) : new SqlQueryError(error.message, {\n\t\tcause: error,\n\t\tsqlState: GENERAL_ERROR_SQLSTATE\n\t});\n\treturn error;\n}\n//#endregion\n//#region src/sqlite-params.ts\n/**\n* The parameters to bind to a SQLite statement. SQLite cannot store NaN and binds it as NULL. The float codecs refuse NaN when they encode, naming the codec; this refuses a NaN no codec encoded, such as a raw SQL parameter, with the same code and `meta.received`, and `meta.paramIndex` in place of `meta.codecId`.\n*/\nfunction sqliteParams(params) {\n\tconst values = params ?? [];\n\tconst nanIndex = values.findIndex((value) => Number.isNaN(value));\n\tif (nanIndex !== -1) throw structuredError(\"RUNTIME.ENCODE_FAILED\", `Parameter ${nanIndex + 1} is NaN, which SQLite cannot store: it would bind it as NULL. Pass null to store no value.`, { meta: {\n\t\tparamIndex: nanIndex,\n\t\treceived: \"NaN\"\n\t} });\n\treturn blindCast(values);\n}\n//#endregion\n//#region src/core/descriptor-meta.ts\nconst sqliteDriverDescriptorMeta = {\n\tkind: \"driver\",\n\tfamilyId: \"sql\",\n\ttargetId: \"sqlite\",\n\tid: \"sqlite\",\n\tversion: \"0.0.1\",\n\tcapabilities: {}\n};\n//#endregion\nexport { safeIntegersAsNumbers as a, prepareExact as i, sqliteParams as n, closeDatabase as o, normalizeSqliteError as r, wasClosedByDriver as s, sqliteDriverDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-CkiPlqDS.mjs.map"],"mappings":";;;;AAIA,MAAM,iCAAiC,IAAI,QAAQ;;AAEnD,SAAS,cAAc,IAAI;CAC1B,GAAG,MAAM;CACT,eAAe,IAAI,EAAE;AACtB;;AAEA,SAAS,kBAAkB,IAAI;CAC9B,OAAO,eAAe,IAAI,EAAE;AAC7B;AAGA,MAAM,mBAAmB,OAAO,OAAO,gBAAgB;AACvD,MAAM,mBAAmB,OAAO,OAAO,gBAAgB;;;;AAIvD,SAAS,aAAa,IAAI,KAAK;CAC9B,MAAM,YAAY,GAAG,QAAQ,GAAG;CAChC,UAAU,eAAe,IAAI;CAC7B,OAAO;AACR;;;;AAIA,SAAS,sBAAsB,KAAK;CACnC,KAAK,MAAM,OAAO,KAAK;EACtB,MAAM,QAAQ,IAAI;EAClB,IAAI,OAAO,UAAU,YAAY,SAAS,oBAAoB,SAAS,kBAAkB,IAAI,OAAO,OAAO,KAAK;CACjH;CACA,OAAO;AACR;AAGA,MAAM,yBAAyB;AAC/B,MAAM,2BAA2B;AACjC,MAAM,+BAA+B;AACrC,MAAM,+BAA+B;AACrC,MAAM,4BAA4B;AAClC,MAAM,0BAA0B;AAChC,MAAM,cAAc;AACpB,MAAM,gBAAgB;AACtB,MAAM,kBAAkB;AACxB,MAAM,gBAAgB;AACtB,MAAM,qBAAqB;AAC3B,MAAM,yBAAyB;AAC/B,SAAS,kBAAkB,SAAS;CACnC,QAAQ,UAAU,SAAS;AAC5B;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,OAAO,U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,MAAM,SAAS;EACrC,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR;;;;AAMA,SAAS,aAAa,QAAQ;CAC7B,MAAM,SAAS,UAAU,CAAC;CAC1B,MAAM,WAAW,OAAO,WAAW,UAAU,OAAO,MAAM,KAAK,CAAC;CAChE,IAAI,aAAa,IAAI,MAAM,gBAAgB,yBAAyB,aAAa,WAAW,EAAE,6FAA6F,EAAE,MAAM;EAClM,YAAY;EACZ,UAAU;CACX,EAAE,CAAC;CACH,OAAO,UAAU,MAAM;AACxB;AAGA,MAAM,6BAA6B;CAClC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;AAChB"}
@@ -1,20 +1,15 @@
1
- import { a as SQLITE_DATETIME_STRING_CODEC_ID, c as SQLITE_DATE_TEMPORAL_CODEC_ID, d as SQLITE_JSON_CODEC_ID, f as SQLITE_REAL_CODEC_ID, h as SQLITE_TIME_TEMPORAL_CODEC_ID, i as SQLITE_DATETIME_CODEC_ID, l as SQLITE_DURATION_STRING_CODEC_ID, m as SQLITE_TIME_STRING_CODEC_ID, o as SQLITE_DATETIME_TEMPORAL_CODEC_ID, p as SQLITE_TEXT_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_DATE_STRING_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQLITE_INTEGER_CODEC_ID } from "./codec-ids-BHBFCNsQ-C1Af_LGF.mjs";
2
- import { m as sqliteInteger, v as sqliteTextDataTypes } from "./data-types-fYwGTal5-BxuZD5EE.mjs";
3
- import { t as sqliteDataTypeEntries } from "./data-type-entries-B6YmbQDH-RnV5wVv8.mjs";
4
- import { n as sqliteTargetDescriptorMetaRuntime, t as sqliteNowGenerators } from "./date-time-now-generators-BVQSg28x-DwhOJw5-.mjs";
1
+ import { _ as SQLITE_TIME_TEMPORAL_CODEC_ID, a as SQLITE_DATETIME_CODEC_ID, c as SQLITE_DATE_STRING_CODEC_ID, d as SQLITE_DURATION_STRING_CODEC_ID, f as SQLITE_INTEGER_CODEC_ID, g as SQLITE_TIME_STRING_CODEC_ID, h as SQLITE_TEXT_CODEC_ID, i as SQLITE_BOOLEAN_CODEC_ID, l as SQLITE_DATE_TEMPORAL_CODEC_ID, m as SQLITE_REAL_CODEC_ID, o as SQLITE_DATETIME_STRING_CODEC_ID, p as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_DATETIME_TEMPORAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQLITE_DECIMAL_CODEC_ID } from "./codec-ids-CTshXpbg-tcdbf_VC.mjs";
2
+ import { _ as sqliteInteger, x as sqliteTextDataTypes } from "./data-types-C_NKe4Ni-D7r8QkSb.mjs";
3
+ import { t as sqliteDataTypeEntries } from "./data-type-entries-C0WkKiPF-CKPYj4OT.mjs";
4
+ import { n as sqliteTargetDescriptorMetaRuntime, t as sqliteNowGenerators } from "./date-time-now-generators-DtRz9c2R-BkrBeLl2.mjs";
5
5
  import { DATE_STRING_NOW_GENERATOR_ID, INSTANT_NOW_GENERATOR_ID, INSTANT_STRING_NOW_GENERATOR_ID, PLAIN_DATE_NOW_GENERATOR_ID, PLAIN_TIME_NOW_GENERATOR_ID, TIME_STRING_NOW_GENERATOR_ID } from "@prisma/orm-framework/type-implementations/now";
6
6
  import { UNBOUND_NAMESPACE_ID } from "@prisma/orm-framework/components/ir";
7
7
  import { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions, sqlTargetTypeConstructors } from "@prisma/orm-family-sql/family/pack";
8
8
  import { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from "@prisma/orm-framework/components/authoring";
9
9
  import { singleGeneratorBinding } from "@prisma/orm-framework/components/components";
10
- //#region ../../../3-targets/sqlite/1-target/dist/descriptor-meta-CEjGA0WH.mjs
10
+ //#region ../../../3-targets/sqlite/1-target/dist/descriptor-meta-uVTby90Y.mjs
11
11
  const sqliteAuthoringTypes = {
12
12
  .../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: "sqlite/real" }),
13
- BigIntNumber: {
14
- kind: "typeConstructor",
15
- documentation: "A SQLite integer represented as a JavaScript number within its safe integer range.",
16
- output: { codecId: "sqlite/bigintnumber@1" }
17
- },
18
13
  temporal: /* @__PURE__ */ temporalTypeAliases({ codecId: "sqlite/datetime@1" }, "a JavaScript Date")
19
14
  };
20
15
  /** The "now" generator for each codec that has one. The `now` generator function binds it. */
@@ -40,53 +35,169 @@ const sqliteGeneratorFunctions = [
40
35
  ];
41
36
  /** The `now` generators SQLite binds. The SQL family registers the identifier generators. */
42
37
  const sqliteGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...sqliteNowGenerators.map(({ id }) => ({ id }))];
38
+ const integerNumber = {
39
+ kind: "typeConstructor",
40
+ documentation: "An integer read as a JavaScript number within its safe integer range, stored as SQLite integer.",
41
+ output: { codecId: SQLITE_INTEGER_CODEC_ID }
42
+ };
43
43
  /**
44
- * The base PSL scalars as zero-arg type constructors in the unified authoring
45
- * channel. Each names a codec; the column's database type is its data type's.
46
- *
47
- * The type position is the only storage decider: a mutation-default generator
48
- * (`@onCreate(uuid())`) never re-picks a column's storage.
49
- *
50
- * The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.
44
+ * The explicit SQLite scalar types. An explicit type is named after the SQLite column type that stores it: `Text`, `Real` and `Blob`. `integer` is read by more than one codec of its data type, so those types carry the value too: `IntegerNumber` and `IntegerBigInt`. A type with a data type of its own, which a `text` column stores, is named after that data type, as ADR 315 and rule 7 of ADR 322 give it: `DecimalString`, `PlainJson` and the date and time types. `IntegerBoolean` is an exception that rule 7 records: `sqlite/boolean` is a data type of its own, which an `integer` column stores, and its name takes the form of the other `integer` types. PSL writes them as field types and the TypeScript builder calls them as `type.X()`. ADR 315, ADR 322.
51
45
  */
52
- const sqliteScalarAuthoringTypes = {
53
- String: {
46
+ const sqliteExplicitScalarTypes = {
47
+ IntegerNumber: integerNumber,
48
+ IntegerBigInt: {
54
49
  kind: "typeConstructor",
55
- documentation: "Variable-length text stored as SQLite text.",
56
- output: { codecId: SQLITE_TEXT_CODEC_ID }
50
+ documentation: "An integer read as a JavaScript bigint, stored as SQLite integer.",
51
+ output: { codecId: SQLITE_BIGINT_CODEC_ID }
57
52
  },
58
- Int: {
53
+ Real: {
59
54
  kind: "typeConstructor",
60
- documentation: "An integer stored as SQLite integer and represented as a JavaScript number.",
61
- output: { codecId: SQLITE_INTEGER_CODEC_ID }
55
+ documentation: "A floating-point number, stored as SQLite real.",
56
+ output: { codecId: SQLITE_REAL_CODEC_ID }
62
57
  },
63
- BigInt: {
58
+ DecimalString: {
64
59
  kind: "typeConstructor",
65
- documentation: "An integer stored as SQLite integer and represented as a JavaScript bigint.",
66
- output: { codecId: SQLITE_BIGINT_CODEC_ID }
60
+ documentation: "An exact decimal number read as decimal text such as \"12.50\", stored as SQLite text. Text compares by its characters, so a field of this type can be compared for equality but not ordered or summed.",
61
+ output: { codecId: SQLITE_DECIMAL_CODEC_ID }
67
62
  },
68
- Float: {
63
+ Text: {
69
64
  kind: "typeConstructor",
70
- documentation: "A floating-point number stored as SQLite real.",
71
- output: { codecId: SQLITE_REAL_CODEC_ID }
65
+ documentation: "Text, stored as SQLite text.",
66
+ output: { codecId: SQLITE_TEXT_CODEC_ID }
72
67
  },
73
- Decimal: {
68
+ IntegerBoolean: {
74
69
  kind: "typeConstructor",
75
- documentation: "A decimal value stored and represented as text to preserve precision.",
76
- output: { codecId: SQLITE_TEXT_CODEC_ID }
70
+ documentation: "A boolean, stored as SQLite integer: 0 for false and 1 for true, as SQLite writes FALSE and TRUE.",
71
+ output: { codecId: SQLITE_BOOLEAN_CODEC_ID }
77
72
  },
78
- Json: {
73
+ Blob: {
74
+ kind: "typeConstructor",
75
+ documentation: "Binary data read as a Uint8Array, stored as SQLite blob.",
76
+ output: { codecId: SQLITE_BLOB_CODEC_ID }
77
+ },
78
+ PlainJson: {
79
79
  kind: "typeConstructor",
80
- documentation: "A JSON value serialized to SQLite text.",
80
+ documentation: "A JSON value, serialized and stored as SQLite text.",
81
81
  output: { codecId: SQLITE_JSON_CODEC_ID }
82
+ }
83
+ };
84
+ function storageOption(storage) {
85
+ return {
86
+ kind: "option",
87
+ name: "storage",
88
+ values: [storage],
89
+ default: storage,
90
+ optional: true
91
+ };
92
+ }
93
+ /**
94
+ * The convenience types of SQLite's scalars. Each is a type choice: `storage` names the SQLite column type that stores the value and, for `BigInt`, `as` chooses the application value. `Int` comes before `BigInt`, so `IntegerNumber`, which both can choose, is written `Int`. ADR 279, ADR 322.
95
+ */
96
+ const sqliteConvenienceScalarTypes = {
97
+ Int: {
98
+ kind: "typeChoice",
99
+ documentation: "An integer read as a JavaScript number within its safe integer range, stored as SQLite integer.",
100
+ args: [storageOption("integer")],
101
+ choices: [{
102
+ when: { storage: "integer" },
103
+ type: "IntegerNumber"
104
+ }]
105
+ },
106
+ BigInt: {
107
+ kind: "typeChoice",
108
+ documentation: "An integer that may exceed the safe integer range, stored as SQLite integer. `as` is what the application reads: bigint, or number within the safe integer range.",
109
+ args: [{
110
+ kind: "option",
111
+ name: "as",
112
+ values: ["bigint", "number"],
113
+ default: "bigint",
114
+ optional: true
115
+ }, storageOption("integer")],
116
+ choices: [{
117
+ when: {
118
+ as: "bigint",
119
+ storage: "integer"
120
+ },
121
+ type: "IntegerBigInt"
122
+ }, {
123
+ when: {
124
+ as: "number",
125
+ storage: "integer"
126
+ },
127
+ type: "IntegerNumber"
128
+ }]
129
+ },
130
+ Float: {
131
+ kind: "typeChoice",
132
+ documentation: "A floating-point number, stored as SQLite real.",
133
+ args: [storageOption("real")],
134
+ choices: [{
135
+ when: { storage: "real" },
136
+ type: "Real"
137
+ }]
138
+ },
139
+ Decimal: {
140
+ kind: "typeChoice",
141
+ documentation: "An exact decimal number read as decimal text such as \"12.50\", stored as SQLite text. It can be compared for equality but not ordered or summed.",
142
+ args: [storageOption("text")],
143
+ choices: [{
144
+ when: { storage: "text" },
145
+ type: "DecimalString"
146
+ }]
147
+ },
148
+ String: {
149
+ kind: "typeChoice",
150
+ documentation: "Text, stored as SQLite text.",
151
+ args: [storageOption("text")],
152
+ choices: [{
153
+ when: { storage: "text" },
154
+ type: "Text"
155
+ }]
156
+ },
157
+ Boolean: {
158
+ kind: "typeChoice",
159
+ documentation: "A boolean, stored as SQLite integer: 0 for false and 1 for true, as SQLite writes FALSE and TRUE.",
160
+ args: [storageOption("integer")],
161
+ choices: [{
162
+ when: { storage: "integer" },
163
+ type: "IntegerBoolean"
164
+ }]
82
165
  },
83
166
  Bytes: {
84
- kind: "typeConstructor",
85
- documentation: "Binary data stored as a SQLite blob.",
86
- output: { codecId: SQLITE_BLOB_CODEC_ID }
167
+ kind: "typeChoice",
168
+ documentation: "Binary data read as a Uint8Array, stored as SQLite blob.",
169
+ args: [storageOption("blob")],
170
+ choices: [{
171
+ when: { storage: "blob" },
172
+ type: "Blob"
173
+ }]
174
+ },
175
+ Json: {
176
+ kind: "typeChoice",
177
+ documentation: "A JSON value, serialized and stored as SQLite text.",
178
+ args: [storageOption("text")],
179
+ choices: [{
180
+ when: { storage: "text" },
181
+ type: "PlainJson"
182
+ }]
87
183
  }
88
184
  };
89
185
  /**
186
+ * The explicit types' former names, kept for one release line as deprecated aliases. Each gives the same codec as its replacement, and the PSL interpreter warns where one is written (ADR 257).
187
+ */
188
+ const sqliteDeprecatedScalarTypes = { BigIntNumber: {
189
+ ...integerNumber,
190
+ deprecated: { replacement: "IntegerNumber" }
191
+ } };
192
+ /**
193
+ * SQLite's scalar types other than the date and time types: the explicit types, the convenience types and the deprecated aliases. `sqliteScalarTypeConstructors` adds the date and time types.
194
+ */
195
+ const sqliteScalarAuthoringTypes = {
196
+ ...sqliteExplicitScalarTypes,
197
+ ...sqliteConvenienceScalarTypes,
198
+ ...sqliteDeprecatedScalarTypes
199
+ };
200
+ /**
90
201
  * The explicit date and time types. SQLite has no date or time column type, so each is stored as text, in one form for each value, and its name says what the text holds and what the application reads. ADR 315.
91
202
  */
92
203
  const sqliteDateTimeTypeConstructors = {
@@ -131,13 +242,7 @@ const sqliteDateTimeTypeConstructors = {
131
242
  output: { codecId: SQLITE_DURATION_STRING_CODEC_ID }
132
243
  }
133
244
  };
134
- const textStorage = {
135
- kind: "option",
136
- name: "storage",
137
- values: ["text"],
138
- default: "text",
139
- optional: true
140
- };
245
+ const textStorage = storageOption("text");
141
246
  /**
142
247
  * The convenience date and time types. Each is a type choice: its `as` argument chooses the explicit type it becomes. Every SQLite date and time type is stored as text, so `storage` is text only. ADR 279, ADR 315.
143
248
  */
@@ -248,7 +353,7 @@ const sqliteConvenienceDateTimeTypes = {
248
353
  }
249
354
  };
250
355
  /**
251
- * The base scalars, the explicit date and time types and the convenience date and time types as type constructors. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.
356
+ * The scalar types, the explicit date and time types and the convenience date and time types. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.
252
357
  */
253
358
  const sqliteScalarTypeConstructors = {
254
359
  ...sqliteScalarAuthoringTypes,
@@ -277,4 +382,4 @@ const sqliteTargetDescriptorMeta = {
277
382
  //#endregion
278
383
  export { sqliteTargetDescriptorMeta as n, sqliteScalarTypeConstructors as t };
279
384
 
280
- //# sourceMappingURL=descriptor-meta-CEjGA0WH-CxgiKj3V.mjs.map
385
+ //# sourceMappingURL=descriptor-meta-uVTby90Y-CUfrzHVW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-uVTby90Y-CUfrzHVW.mjs","names":[],"sources":["../../../../3-targets/sqlite/1-target/dist/descriptor-meta-uVTby90Y.mjs"],"sourcesContent":["import { _ as SQLITE_TIME_TEMPORAL_CODEC_ID, a as SQLITE_DATETIME_CODEC_ID, c as SQLITE_DATE_STRING_CODEC_ID, d as SQLITE_DURATION_STRING_CODEC_ID, f as SQLITE_INTEGER_CODEC_ID, g as SQLITE_TIME_STRING_CODEC_ID, h as SQLITE_TEXT_CODEC_ID, i as SQLITE_BOOLEAN_CODEC_ID, l as SQLITE_DATE_TEMPORAL_CODEC_ID, m as SQLITE_REAL_CODEC_ID, o as SQLITE_DATETIME_STRING_CODEC_ID, p as SQLITE_JSON_CODEC_ID, r as SQLITE_BLOB_CODEC_ID, s as SQLITE_DATETIME_TEMPORAL_CODEC_ID, t as SQLITE_BIGINT_CODEC_ID, u as SQLITE_DECIMAL_CODEC_ID } from \"./codec-ids-CTshXpbg.mjs\";\nimport { _ as sqliteInteger, x as sqliteTextDataTypes } from \"./data-types-C_NKe4Ni.mjs\";\nimport { t as sqliteDataTypeEntries } from \"./data-type-entries-C0WkKiPF.mjs\";\nimport { n as sqliteTargetDescriptorMetaRuntime, t as sqliteNowGenerators } from \"./date-time-now-generators-DtRz9c2R.mjs\";\nimport { UNBOUND_NAMESPACE_ID } from \"@internal/framework-components/ir\";\nimport { idGeneratorFunctionBindings, sqlIntegerArgumentGeneratorFunctions, sqlTargetTypeConstructors } from \"@internal/family-sql/pack\";\nimport { TIMESTAMP_NOW_GENERATOR_ID, temporalTypeAliases } from \"@internal/framework-components/authoring\";\nimport { singleGeneratorBinding } from \"@internal/framework-components/components\";\nimport { DATE_STRING_NOW_GENERATOR_ID, INSTANT_NOW_GENERATOR_ID, INSTANT_STRING_NOW_GENERATOR_ID, PLAIN_DATE_NOW_GENERATOR_ID, PLAIN_TIME_NOW_GENERATOR_ID, TIME_STRING_NOW_GENERATOR_ID } from \"@internal/type-implementations/now\";\n//#region src/core/authoring.ts\nconst sqliteAuthoringTypes = {\n\t.../* @__PURE__ */ sqlTargetTypeConstructors({ sizeType: \"sqlite/real\" }),\n\ttemporal: /* @__PURE__ */ temporalTypeAliases({ codecId: \"sqlite/datetime@1\" }, \"a JavaScript Date\")\n};\n//#endregion\n//#region src/core/generator-functions.ts\n/** The \"now\" generator for each codec that has one. The `now` generator function binds it. */\nconst sqliteNowGeneratorIds = {\n\t[SQLITE_DATETIME_CODEC_ID]: TIMESTAMP_NOW_GENERATOR_ID,\n\t[SQLITE_DATETIME_TEMPORAL_CODEC_ID]: INSTANT_NOW_GENERATOR_ID,\n\t[SQLITE_DATETIME_STRING_CODEC_ID]: INSTANT_STRING_NOW_GENERATOR_ID,\n\t[SQLITE_DATE_STRING_CODEC_ID]: DATE_STRING_NOW_GENERATOR_ID,\n\t[SQLITE_DATE_TEMPORAL_CODEC_ID]: PLAIN_DATE_NOW_GENERATOR_ID,\n\t[SQLITE_TIME_STRING_CODEC_ID]: TIME_STRING_NOW_GENERATOR_ID,\n\t[SQLITE_TIME_TEMPORAL_CODEC_ID]: PLAIN_TIME_NOW_GENERATOR_ID\n};\nconst sqliteGeneratorFunctions = [\n\t...sqlIntegerArgumentGeneratorFunctions({ integer: sqliteInteger.id }),\n\t{\n\t\tname: \"now\",\n\t\tbindings: Object.entries(sqliteNowGeneratorIds).map(([codecId, generatorId]) => singleGeneratorBinding({\n\t\t\tcodecIds: [codecId],\n\t\t\tgeneratorId\n\t\t}))\n\t},\n\t...idGeneratorFunctionBindings({ text: [SQLITE_TEXT_CODEC_ID] })\n];\n/** The `now` generators SQLite binds. The SQL family registers the identifier generators. */\nconst sqliteGeneratorDescriptors = [{ id: TIMESTAMP_NOW_GENERATOR_ID }, ...sqliteNowGenerators.map(({ id }) => ({ id }))];\n//#endregion\n//#region src/core/type-constructors.ts\nconst integerNumber = {\n\tkind: \"typeConstructor\",\n\tdocumentation: \"An integer read as a JavaScript number within its safe integer range, stored as SQLite integer.\",\n\toutput: { codecId: SQLITE_INTEGER_CODEC_ID }\n};\n/**\n* The explicit SQLite scalar types. An explicit type is named after the SQLite column type that stores it: `Text`, `Real` and `Blob`. `integer` is read by more than one codec of its data type, so those types carry the value too: `IntegerNumber` and `IntegerBigInt`. A type with a data type of its own, which a `text` column stores, is named after that data type, as ADR 315 and rule 7 of ADR 322 give it: `DecimalString`, `PlainJson` and the date and time types. `IntegerBoolean` is an exception that rule 7 records: `sqlite/boolean` is a data type of its own, which an `integer` column stores, and its name takes the form of the other `integer` types. PSL writes them as field types and the TypeScript builder calls them as `type.X()`. ADR 315, ADR 322.\n*/\nconst sqliteExplicitScalarTypes = {\n\tIntegerNumber: integerNumber,\n\tIntegerBigInt: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An integer read as a JavaScript bigint, stored as SQLite integer.\",\n\t\toutput: { codecId: SQLITE_BIGINT_CODEC_ID }\n\t},\n\tReal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A floating-point number, stored as SQLite real.\",\n\t\toutput: { codecId: SQLITE_REAL_CODEC_ID }\n\t},\n\tDecimalString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An exact decimal number read as decimal text such as \\\"12.50\\\", stored as SQLite text. Text compares by its characters, so a field of this type can be compared for equality but not ordered or summed.\",\n\t\toutput: { codecId: SQLITE_DECIMAL_CODEC_ID }\n\t},\n\tText: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Text, stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_TEXT_CODEC_ID }\n\t},\n\tIntegerBoolean: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A boolean, stored as SQLite integer: 0 for false and 1 for true, as SQLite writes FALSE and TRUE.\",\n\t\toutput: { codecId: SQLITE_BOOLEAN_CODEC_ID }\n\t},\n\tBlob: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"Binary data read as a Uint8Array, stored as SQLite blob.\",\n\t\toutput: { codecId: SQLITE_BLOB_CODEC_ID }\n\t},\n\tPlainJson: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A JSON value, serialized and stored as SQLite text.\",\n\t\toutput: { codecId: SQLITE_JSON_CODEC_ID }\n\t}\n};\nfunction storageOption(storage) {\n\treturn {\n\t\tkind: \"option\",\n\t\tname: \"storage\",\n\t\tvalues: [storage],\n\t\tdefault: storage,\n\t\toptional: true\n\t};\n}\n/**\n* The convenience types of SQLite's scalars. Each is a type choice: `storage` names the SQLite column type that stores the value and, for `BigInt`, `as` chooses the application value. `Int` comes before `BigInt`, so `IntegerNumber`, which both can choose, is written `Int`. ADR 279, ADR 322.\n*/\nconst sqliteConvenienceScalarTypes = {\n\tInt: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"An integer read as a JavaScript number within its safe integer range, stored as SQLite integer.\",\n\t\targs: [storageOption(\"integer\")],\n\t\tchoices: [{\n\t\t\twhen: { storage: \"integer\" },\n\t\t\ttype: \"IntegerNumber\"\n\t\t}]\n\t},\n\tBigInt: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"An integer that may exceed the safe integer range, stored as SQLite integer. `as` is what the application reads: bigint, or number within the safe integer range.\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"bigint\", \"number\"],\n\t\t\tdefault: \"bigint\",\n\t\t\toptional: true\n\t\t}, storageOption(\"integer\")],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"bigint\",\n\t\t\t\tstorage: \"integer\"\n\t\t\t},\n\t\t\ttype: \"IntegerBigInt\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"number\",\n\t\t\t\tstorage: \"integer\"\n\t\t\t},\n\t\t\ttype: \"IntegerNumber\"\n\t\t}]\n\t},\n\tFloat: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A floating-point number, stored as SQLite real.\",\n\t\targs: [storageOption(\"real\")],\n\t\tchoices: [{\n\t\t\twhen: { storage: \"real\" },\n\t\t\ttype: \"Real\"\n\t\t}]\n\t},\n\tDecimal: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"An exact decimal number read as decimal text such as \\\"12.50\\\", stored as SQLite text. It can be compared for equality but not ordered or summed.\",\n\t\targs: [storageOption(\"text\")],\n\t\tchoices: [{\n\t\t\twhen: { storage: \"text\" },\n\t\t\ttype: \"DecimalString\"\n\t\t}]\n\t},\n\tString: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"Text, stored as SQLite text.\",\n\t\targs: [storageOption(\"text\")],\n\t\tchoices: [{\n\t\t\twhen: { storage: \"text\" },\n\t\t\ttype: \"Text\"\n\t\t}]\n\t},\n\tBoolean: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A boolean, stored as SQLite integer: 0 for false and 1 for true, as SQLite writes FALSE and TRUE.\",\n\t\targs: [storageOption(\"integer\")],\n\t\tchoices: [{\n\t\t\twhen: { storage: \"integer\" },\n\t\t\ttype: \"IntegerBoolean\"\n\t\t}]\n\t},\n\tBytes: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"Binary data read as a Uint8Array, stored as SQLite blob.\",\n\t\targs: [storageOption(\"blob\")],\n\t\tchoices: [{\n\t\t\twhen: { storage: \"blob\" },\n\t\t\ttype: \"Blob\"\n\t\t}]\n\t},\n\tJson: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A JSON value, serialized and stored as SQLite text.\",\n\t\targs: [storageOption(\"text\")],\n\t\tchoices: [{\n\t\t\twhen: { storage: \"text\" },\n\t\t\ttype: \"PlainJson\"\n\t\t}]\n\t}\n};\n/**\n* The explicit types' former names, kept for one release line as deprecated aliases. Each gives the same codec as its replacement, and the PSL interpreter warns where one is written (ADR 257).\n*/\nconst sqliteDeprecatedScalarTypes = { BigIntNumber: {\n\t...integerNumber,\n\tdeprecated: { replacement: \"IntegerNumber\" }\n} };\n/**\n* SQLite's scalar types other than the date and time types: the explicit types, the convenience types and the deprecated aliases. `sqliteScalarTypeConstructors` adds the date and time types.\n*/\nconst sqliteScalarAuthoringTypes = {\n\t...sqliteExplicitScalarTypes,\n\t...sqliteConvenienceScalarTypes,\n\t...sqliteDeprecatedScalarTypes\n};\n/**\n* The explicit date and time types. SQLite has no date or time column type, so each is stored as text, in one form for each value, and its name says what the text holds and what the application reads. ADR 315.\n*/\nconst sqliteDateTimeTypeConstructors = {\n\tDatetimeJsDate: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant stored as SQLite text, 2024-01-01T00:00:00.000Z, and represented as a JavaScript Date.\",\n\t\toutput: { codecId: SQLITE_DATETIME_CODEC_ID }\n\t},\n\tDatetimeTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant stored as SQLite text, 2024-01-01T00:00:00.000Z, and represented as Temporal.Instant.\",\n\t\toutput: { codecId: SQLITE_DATETIME_TEMPORAL_CODEC_ID }\n\t},\n\tDatetimeString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"An instant stored as SQLite text and represented as that text, 2024-01-01T00:00:00.000Z, the instant in UTC.\",\n\t\toutput: { codecId: SQLITE_DATETIME_STRING_CODEC_ID }\n\t},\n\tDateString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date stored as SQLite text and represented as that text, 2024-02-29.\",\n\t\toutput: { codecId: SQLITE_DATE_STRING_CODEC_ID }\n\t},\n\tDateTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A calendar date stored as SQLite text, 2024-02-29, and represented as Temporal.PlainDate.\",\n\t\toutput: { codecId: SQLITE_DATE_TEMPORAL_CODEC_ID }\n\t},\n\tTimeString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A time of day stored as SQLite text and represented as that text, 09:30:00.000, always with three fraction digits.\",\n\t\toutput: { codecId: SQLITE_TIME_STRING_CODEC_ID }\n\t},\n\tTimeTemporal: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A time of day stored as SQLite text, 09:30:00.000, and represented as Temporal.PlainTime.\",\n\t\toutput: { codecId: SQLITE_TIME_TEMPORAL_CODEC_ID }\n\t},\n\tDurationString: {\n\t\tkind: \"typeConstructor\",\n\t\tdocumentation: \"A length of time stored as SQLite text and represented as the ISO 8601 duration it was written as, such as PT1H30M.\",\n\t\toutput: { codecId: SQLITE_DURATION_STRING_CODEC_ID }\n\t}\n};\nconst textStorage = storageOption(\"text\");\n/**\n* The convenience date and time types. Each is a type choice: its `as` argument chooses the explicit type it becomes. Every SQLite date and time type is stored as text, so `storage` is text only. ADR 279, ADR 315.\n*/\nconst sqliteConvenienceDateTimeTypes = {\n\tDateTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A moment in time, stored as SQLite text. `as` is what the application reads: jsDate (a JavaScript Date), temporal (Temporal.Instant) or string, such as \\\"2024-01-01T00:00:00.000Z\\\".\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\n\t\t\t\t\"jsDate\",\n\t\t\t\t\"temporal\",\n\t\t\t\t\"string\"\n\t\t\t],\n\t\t\tdefault: \"jsDate\",\n\t\t\toptional: true\n\t\t}, textStorage],\n\t\tchoices: [\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"jsDate\",\n\t\t\t\t\tstorage: \"text\"\n\t\t\t\t},\n\t\t\t\ttype: \"DatetimeJsDate\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"temporal\",\n\t\t\t\t\tstorage: \"text\"\n\t\t\t\t},\n\t\t\t\ttype: \"DatetimeTemporal\"\n\t\t\t},\n\t\t\t{\n\t\t\t\twhen: {\n\t\t\t\t\tas: \"string\",\n\t\t\t\t\tstorage: \"text\"\n\t\t\t\t},\n\t\t\t\ttype: \"DatetimeString\"\n\t\t\t}\n\t\t]\n\t},\n\tDate: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A calendar date, stored as SQLite text. `as` is what the application reads: string, such as \\\"2024-02-29\\\", or temporal (Temporal.PlainDate).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, textStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"text\"\n\t\t\t},\n\t\t\ttype: \"DateString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"text\"\n\t\t\t},\n\t\t\ttype: \"DateTemporal\"\n\t\t}]\n\t},\n\tTime: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A time of day, stored as SQLite text. `as` is what the application reads: string, such as \\\"09:30:00.000\\\", or temporal (Temporal.PlainTime).\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\", \"temporal\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, textStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"text\"\n\t\t\t},\n\t\t\ttype: \"TimeString\"\n\t\t}, {\n\t\t\twhen: {\n\t\t\t\tas: \"temporal\",\n\t\t\t\tstorage: \"text\"\n\t\t\t},\n\t\t\ttype: \"TimeTemporal\"\n\t\t}]\n\t},\n\tDuration: {\n\t\tkind: \"typeChoice\",\n\t\tdocumentation: \"A length of time, stored as SQLite text. `as` is what the application reads: string, an ISO 8601 duration such as \\\"PT1H30M\\\".\",\n\t\targs: [{\n\t\t\tkind: \"option\",\n\t\t\tname: \"as\",\n\t\t\tvalues: [\"string\"],\n\t\t\tdefault: \"string\",\n\t\t\toptional: true\n\t\t}, textStorage],\n\t\tchoices: [{\n\t\t\twhen: {\n\t\t\t\tas: \"string\",\n\t\t\t\tstorage: \"text\"\n\t\t\t},\n\t\t\ttype: \"DurationString\"\n\t\t}]\n\t}\n};\n/**\n* The scalar types, the explicit date and time types and the convenience date and time types. The target contributes them, so PSL and the TypeScript builder's `type.*` see the same names.\n*/\nconst sqliteScalarTypeConstructors = {\n\t...sqliteScalarAuthoringTypes,\n\t...sqliteDateTimeTypeConstructors,\n\t...sqliteConvenienceDateTimeTypes\n};\nconst sqliteTargetDescriptorMeta = {\n\t...sqliteTargetDescriptorMetaRuntime,\n\tdefaultNamespaceId: UNBOUND_NAMESPACE_ID,\n\tsupportsNamespaces: false,\n\tdisplayName: \"SQLite\",\n\tauthoring: {\n\t\ttype: {\n\t\t\t...sqliteScalarTypeConstructors,\n\t\t\t...sqliteAuthoringTypes\n\t\t},\n\t\tdataTypes: sqliteDataTypeEntries(),\n\t\ttextDataTypes: sqliteTextDataTypes\n\t},\n\tgeneratorFunctions: sqliteGeneratorFunctions,\n\tcontrolMutationDefaults: {\n\t\tdefaultFunctionRegistry: /* @__PURE__ */ new Map(),\n\t\tgeneratorDescriptors: sqliteGeneratorDescriptors\n\t}\n};\n//#endregion\nexport { sqliteScalarTypeConstructors as n, sqliteTargetDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-uVTby90Y.mjs.map"],"mappings":";;;;;;;;;;AAUA,MAAM,uBAAuB;CAC5B,GAAmB,0CAA0B,EAAE,UAAU,cAAc,CAAC;CACxE,UAA0B,oCAAoB,EAAE,SAAS,oBAAoB,GAAG,mBAAmB;AACpG;;AAIA,MAAM,wBAAwB;EAC5B,2BAA2B;EAC3B,oCAAoC;EACpC,kCAAkC;EAClC,8BAA8B;EAC9B,gCAAgC;EAChC,8BAA8B;EAC9B,gCAAgC;AAClC;AACA,MAAM,2BAA2B;CAChC,GAAG,qCAAqC,EAAE,SAAS,cAAc,GAAG,CAAC;CACrE;EACC,MAAM;EACN,UAAU,OAAO,QAAQ,qBAAqB,CAAC,CAAC,KAAK,CAAC,SAAS,iBAAiB,uBAAuB;GACtG,UAAU,CAAC,OAAO;GAClB;EACD,CAAC,CAAC;CACH;CACA,GAAG,4BAA4B,EAAE,MAAM,CAAC,oBAAoB,EAAE,CAAC;AAChE;;AAEA,MAAM,6BAA6B,CAAC,EAAE,IAAI,2BAA2B,GAAG,GAAG,oBAAoB,KAAK,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC;AAGxH,MAAM,gBAAgB;CACrB,MAAM;CACN,eAAe;CACf,QAAQ,EAAE,SAAS,wBAAwB;AAC5C;;;;AAIA,MAAM,4BAA4B;CACjC,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A,UAAU;EACT,MAAM;EACN,eAAe;EACf,MAAM,CAAC;GACN,MAAM;GACN,MAAM;GACN,QAAQ,CAAC,QAAQ;GACjB,SAAS;GACT,UAAU;EACX,GAAG,WAAW;EACd,SAAS,CAAC;GACT,MAAM;IACL,IAAI;IACJ,SAAS;GACV;GACA,MAAM;EACP,CAAC;CACF;AACD;;;;AAIA,MAAM,+BAA+B;CACpC,GAAG;CACH,GAAG;CACH,GAAG;AACJ;AACA,MAAM,6BAA6B;CAClC,GAAG;CACH,oBAAoB;CACpB,oBAAoB;CACpB,aAAa;CACb,WAAW;EACV,MAAM;GACL,GAAG;GACH,GAAG;EACJ;EACA,WAAW,sBAAsB;EACjC,eAAe;CAChB;CACA,oBAAoB;CACpB,yBAAyB;EACxB,yCAAyC,IAAI,IAAI;EACjD,sBAAsB;CACvB;AACD"}
package/dist/driver.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as SqliteControlDriver } from "./control-BvT30n3D.mjs";
1
+ import { t as SqliteControlDriver } from "./control-V3kPfMTR.mjs";
2
2
  export { SqliteControlDriver };
@@ -1,2 +1,2 @@
1
- import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-BvT30n3D.mjs";
1
+ import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-V3kPfMTR.mjs";
2
2
  export { SqliteControlDriver, sqliteDriverDescriptor as default };
@@ -1,5 +1,5 @@
1
- import { i as validateSqliteIsolationLevel } from "./runtime-DTjhSsHd.mjs";
2
- import { a as wasClosedByDriver, i as sqliteParams, n as normalizeSqliteError, r as sqliteDriverDescriptorMeta, t as closeDatabase } from "./descriptor-meta-Drr6Abaf-P67SenMd.mjs";
1
+ import { i as validateSqliteIsolationLevel } from "./runtime-DQll1Swl.mjs";
2
+ import { a as sqliteDriverDescriptorMeta, i as safeIntegersAsNumbers, n as normalizeSqliteError, o as sqliteParams, r as prepareExact, s as wasClosedByDriver, t as closeDatabase } from "./descriptor-meta-CkiPlqDS-n3hDP01X.mjs";
3
3
  import { blindCast } from "@prisma/orm-framework/utils/casts";
4
4
  import { InternalError } from "@prisma/orm-framework/utils/internal-error";
5
5
  import { DatabaseSync } from "node:sqlite";
@@ -36,16 +36,19 @@ var SqliteQueryable = class {
36
36
  this.db = db;
37
37
  }
38
38
  async *query(request) {
39
+ let rows;
39
40
  try {
40
- const stmt = this.db.prepare(request.sql);
41
- for (const row of stmt.iterate(...sqliteParams(request.params))) yield blindCast(row);
41
+ rows = prepareExact(this.db, request.sql).iterate(...sqliteParams(request.params));
42
+ for (let next = rows.next(); next.done !== true; next = rows.next()) yield blindCast(safeIntegersAsNumbers(next.value));
42
43
  } catch (error) {
43
44
  throw normalizeSqliteError(error, wasClosedByDriver(this.db));
45
+ } finally {
46
+ if (this.db.isOpen) rows?.return?.();
44
47
  }
45
48
  }
46
49
  async execute(request) {
47
50
  try {
48
- const stmt = this.db.prepare(request.sql);
51
+ const stmt = prepareExact(this.db, request.sql);
49
52
  if (stmt.columns().length !== 0) throw new InternalError("SQLite cannot execute statements that return rows.");
50
53
  const { changes, lastInsertRowid } = stmt.run(...sqliteParams(request.params));
51
54
  const affectedRows = Number(changes);
@@ -59,7 +62,7 @@ var SqliteQueryable = class {
59
62
  }
60
63
  async explain(request) {
61
64
  try {
62
- return { rows: this.db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...sqliteParams(request.params)) };
65
+ return { rows: prepareExact(this.db, `EXPLAIN QUERY PLAN ${request.sql}`).all(...sqliteParams(request.params)).map(safeIntegersAsNumbers) };
63
66
  } catch (error) {
64
67
  throw normalizeSqliteError(error, wasClosedByDriver(this.db));
65
68
  }
@@ -1 +1 @@
1
- {"version":3,"file":"driver__runtime.mjs","names":["#state","#requireConnected"],"sources":["../../../../3-targets/sqlite/3-driver/dist/runtime.mjs"],"sourcesContent":["import { a as wasClosedByDriver, i as closeDatabase, n as sqliteParams, r as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-Drr6Abaf.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { validateSqliteIsolationLevel } from \"@internal/target-sqlite/runtime\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/sqlite-driver.ts\nfunction driverError(code, message, details) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"RuntimeError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\",\n\t\tmessage,\n\t\tdetails\n\t});\n}\nconst NOT_CONNECTED_MESSAGE = \"SQLite driver not connected. Call connect(binding) before acquireConnection or execute.\";\nconst ALREADY_CONNECTED_MESSAGE = \"SQLite driver already connected. Call close() before reconnecting with a new binding.\";\nfunction openConnection(path) {\n\ttry {\n\t\tconst db = new DatabaseSync(path);\n\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\tdb.exec(\"PRAGMA busy_timeout = 5000\");\n\t\treturn db;\n\t} catch (error) {\n\t\tthrow normalizeSqliteError(error, false);\n\t}\n}\nvar SqliteQueryable = class {\n\tdb;\n\tconstructor(db) {\n\t\tthis.db = db;\n\t}\n\tasync *query(request) {\n\t\ttry {\n\t\t\tconst stmt = this.db.prepare(request.sql);\n\t\t\tfor (const row of stmt.iterate(...sqliteParams(request.params))) yield blindCast(row);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync execute(request) {\n\t\ttry {\n\t\t\tconst stmt = this.db.prepare(request.sql);\n\t\t\tif (stmt.columns().length !== 0) throw new InternalError(\"SQLite cannot execute statements that return rows.\");\n\t\t\tconst { changes, lastInsertRowid } = stmt.run(...sqliteParams(request.params));\n\t\t\tconst affectedRows = Number(changes);\n\t\t\treturn affectedRows === 1 ? {\n\t\t\t\taffectedRows,\n\t\t\t\tinsertId: String(lastInsertRowid)\n\t\t\t} : { affectedRows };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync explain(request) {\n\t\ttry {\n\t\t\treturn { rows: this.db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...sqliteParams(request.params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n};\nvar SqliteConnectionImpl = class extends SqliteQueryable {\n\tasync beginTransaction(start) {\n\t\tif (start?.isolationLevel !== void 0) validateSqliteIsolationLevel(start.isolationLevel);\n\t\ttry {\n\t\t\tthis.db.exec(\"BEGIN\");\n\t\t\treturn new SqliteTransactionImpl(this.db);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync release() {\n\t\treturn this.destroy();\n\t}\n\tasync destroy(_reason) {\n\t\ttry {\n\t\t\tcloseDatabase(this.db);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n};\nvar SqliteTransactionImpl = class extends SqliteQueryable {\n\tasync commit() {\n\t\ttry {\n\t\t\tthis.db.exec(\"COMMIT\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync rollback() {\n\t\ttry {\n\t\t\tthis.db.exec(\"ROLLBACK\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync savepoint(name) {\n\t\treturn openSqliteSavepoint(this.db, name);\n\t}\n};\nvar SqliteSavepointImpl = class extends SqliteQueryable {\n\tname;\n\tconstructor(db, name) {\n\t\tsuper(db);\n\t\tthis.name = name;\n\t}\n\tasync commit() {\n\t\texecSavepointStatement(this.db, `RELEASE SAVEPOINT ${this.name}`);\n\t}\n\tasync rollback() {\n\t\texecSavepointStatement(this.db, `ROLLBACK TO SAVEPOINT ${this.name}`);\n\t}\n\tasync savepoint(name) {\n\t\treturn openSqliteSavepoint(this.db, name);\n\t}\n};\nfunction execSavepointStatement(db, sql) {\n\ttry {\n\t\tdb.exec(sql);\n\t} catch (error) {\n\t\tthrow normalizeSqliteError(error, wasClosedByDriver(db));\n\t}\n}\nfunction openSqliteSavepoint(db, name) {\n\texecSavepointStatement(db, `SAVEPOINT ${name}`);\n\treturn new SqliteSavepointImpl(db, name);\n}\nfunction unboundQuery() {\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn { async next() {\n\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\t} };\n\t} };\n}\nvar SqliteDriver = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\t#state;\n\tconstructor(initialState) {\n\t\tthis.#state = initialState ?? { kind: \"unbound\" };\n\t}\n\t#requireConnected() {\n\t\tif (this.#state.kind !== \"connected\") throw driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\treturn this.#state;\n\t}\n\tget state() {\n\t\treturn this.#state.kind;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#state.kind === \"connected\") throw driverError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });\n\t\tthis.#state = {\n\t\t\tkind: \"connected\",\n\t\t\tpath: binding.path,\n\t\t\tconn: new SqliteConnectionImpl(openConnection(binding.path))\n\t\t};\n\t}\n\tasync acquireConnection() {\n\t\tconst { path } = this.#requireConnected();\n\t\treturn new SqliteConnectionImpl(openConnection(path));\n\t}\n\tasync close() {\n\t\tif (this.#state.kind !== \"connected\") return;\n\t\tconst { conn } = this.#state;\n\t\tthis.#state = { kind: \"closed\" };\n\t\tawait conn.release();\n\t}\n\tquery(request) {\n\t\tif (this.#state.kind !== \"connected\") return unboundQuery();\n\t\treturn this.#state.conn.query(request);\n\t}\n\tasync execute(request) {\n\t\treturn this.#requireConnected().conn.execute(request);\n\t}\n\tasync explain(request) {\n\t\treturn this.#requireConnected().conn.explain(request);\n\t}\n};\n//#endregion\n//#region src/core/runtime/runtime-driver.ts\nconst sqliteRuntimeDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tcreate() {\n\t\treturn new SqliteDriver();\n\t}\n};\n//#endregion\nexport { sqliteRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;AAMA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,MAAM,QAAQ,IAAI,MAAM,OAAO;CAC/B,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,OAAO,OAAO,OAAO;EAC3B;EACA,UAAU;EACV,UAAU;EACV;EACA;CACD,CAAC;AACF;AACA,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAClC,SAAS,eAAe,MAAM;CAC7B,IAAI;EACH,MAAM,KAAK,IAAI,aAAa,IAAI;EAChC,GAAG,KAAK,0BAA0B;EAClC,GAAG,KAAK,4BAA4B;EACpC,OAAO;CACR,SAAS,OAAO;EACf,MAAM,qBAAqB,OAAO,KAAK;CACxC;AACD;AACA,IAAI,kBAAkB,MAAM;CAC3B;CACA,YAAY,IAAI;EACf,KAAK,KAAK;CACX;CACA,OAAO,MAAM,SAAS;EACrB,IAAI;GACH,MAAM,OAAO,KAAK,GAAG,QAAQ,QAAQ,GAAG;GACxC,KAAK,MAAM,OAAO,KAAK,QAAQ,GAAG,aAAa,QAAQ,MAAM,CAAC,GAAG,MAAM,UAAU,GAAG;EACrF,SAAS,OAAO;GACf,MAAM,qBAAqB,OAAO,kBAAkB,KAAK,EAAE,CAAC;EAC7D;CACD;CACA,MAAM,QAAQ,SAAS;EACtB,IAAI;GACH,MAAM,OAAO,KAAK,GAAG,QAAQ,QAAQ,GAAG;GACxC,IAAI,KAAK,QAAQ,CAAC,CAAC,WAAW,GAAG,MAAM,IAAI,cAAc,oDAAoD;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,KAAK,CAAC;EAC5I,KAAKA,SAAS;GACb,MAAM;GACN,MAAM,QAAQ;GACd,MAAM,IAAI,qBAAqB,eAAe,QAAQ,IAAI,CAAC;EAC5D;CACD;CACA,MAAM,oBAAoB;EACzB,MAAM,EAAE,SAAS,KAAKC,kBAAkB;EACxC,OAAO,IAAI,qBAAqB,eAAe,IAAI,CAAC;CACrD;CACA,MAAM,QAAQ;EACb,IAAI,KAAKD,OAAO,SAAS,aAAa;EACtC,MAAM,EAAE,SAAS,KAAKA;EACtB,KAAKA,SAAS,EAAE,MAAM,SAAS;EAC/B,MAAM,KAAK,QAAQ;CACpB;CACA,MAAM,SAAS;EACd,IAAI,KAAKA,OAAO,SAAS,aAAa,OAAO,aAAa;EAC1D,OAAO,KAAKA,OAAO,KAAK,MAAM,OAAO;CACtC;CACA,MAAM,QAAQ,SAAS;EACtB,OAAO,KAAKC,kBAAkB,CAAC,CAAC,KAAK,QAAQ,OAAO;CACrD;CACA,MAAM,QAAQ,SAAS;EACtB,OAAO,KAAKA,kBAAkB,CAAC,CAAC,KAAK,QAAQ,OAAO;CACrD;AACD;AAGA,MAAM,gCAAgC;CACrC,GAAG;CACH,SAAS;EACR,OAAO,IAAI,aAAa;CACzB;AACD"}
1
+ {"version":3,"file":"driver__runtime.mjs","names":["#state","#requireConnected"],"sources":["../../../../3-targets/sqlite/3-driver/dist/runtime.mjs"],"sourcesContent":["import { a as safeIntegersAsNumbers, i as prepareExact, n as sqliteParams, o as closeDatabase, r as normalizeSqliteError, s as wasClosedByDriver, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-CkiPlqDS.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\nimport { blindCast } from \"@internal/utils/casts\";\nimport { validateSqliteIsolationLevel } from \"@internal/target-sqlite/runtime\";\nimport { InternalError } from \"@internal/utils/internal-error\";\n//#region src/sqlite-driver.ts\nfunction driverError(code, message, details) {\n\tconst error = new Error(message);\n\tObject.defineProperty(error, \"name\", {\n\t\tvalue: \"RuntimeError\",\n\t\tconfigurable: true\n\t});\n\treturn Object.assign(error, {\n\t\tcode,\n\t\tcategory: \"DRIVER\",\n\t\tseverity: \"error\",\n\t\tmessage,\n\t\tdetails\n\t});\n}\nconst NOT_CONNECTED_MESSAGE = \"SQLite driver not connected. Call connect(binding) before acquireConnection or execute.\";\nconst ALREADY_CONNECTED_MESSAGE = \"SQLite driver already connected. Call close() before reconnecting with a new binding.\";\nfunction openConnection(path) {\n\ttry {\n\t\tconst db = new DatabaseSync(path);\n\t\tdb.exec(\"PRAGMA foreign_keys = ON\");\n\t\tdb.exec(\"PRAGMA busy_timeout = 5000\");\n\t\treturn db;\n\t} catch (error) {\n\t\tthrow normalizeSqliteError(error, false);\n\t}\n}\nvar SqliteQueryable = class {\n\tdb;\n\tconstructor(db) {\n\t\tthis.db = db;\n\t}\n\tasync *query(request) {\n\t\tlet rows;\n\t\ttry {\n\t\t\trows = prepareExact(this.db, request.sql).iterate(...sqliteParams(request.params));\n\t\t\tfor (let next = rows.next(); next.done !== true; next = rows.next()) yield blindCast(safeIntegersAsNumbers(next.value));\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t} finally {\n\t\t\tif (this.db.isOpen) rows?.return?.();\n\t\t}\n\t}\n\tasync execute(request) {\n\t\ttry {\n\t\t\tconst stmt = prepareExact(this.db, request.sql);\n\t\t\tif (stmt.columns().length !== 0) throw new InternalError(\"SQLite cannot execute statements that return rows.\");\n\t\t\tconst { changes, lastInsertRowid } = stmt.run(...sqliteParams(request.params));\n\t\t\tconst affectedRows = Number(changes);\n\t\t\treturn affectedRows === 1 ? {\n\t\t\t\taffectedRows,\n\t\t\t\tinsertId: String(lastInsertRowid)\n\t\t\t} : { affectedRows };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync explain(request) {\n\t\ttry {\n\t\t\treturn { rows: prepareExact(this.db, `EXPLAIN QUERY PLAN ${request.sql}`).all(...sqliteParams(request.params)).map(safeIntegersAsNumbers) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n};\nvar SqliteConnectionImpl = class extends SqliteQueryable {\n\tasync beginTransaction(start) {\n\t\tif (start?.isolationLevel !== void 0) validateSqliteIsolationLevel(start.isolationLevel);\n\t\ttry {\n\t\t\tthis.db.exec(\"BEGIN\");\n\t\t\treturn new SqliteTransactionImpl(this.db);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync release() {\n\t\treturn this.destroy();\n\t}\n\tasync destroy(_reason) {\n\t\ttry {\n\t\t\tcloseDatabase(this.db);\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n};\nvar SqliteTransactionImpl = class extends SqliteQueryable {\n\tasync commit() {\n\t\ttry {\n\t\t\tthis.db.exec(\"COMMIT\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync rollback() {\n\t\ttry {\n\t\t\tthis.db.exec(\"ROLLBACK\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error, wasClosedByDriver(this.db));\n\t\t}\n\t}\n\tasync savepoint(name) {\n\t\treturn openSqliteSavepoint(this.db, name);\n\t}\n};\nvar SqliteSavepointImpl = class extends SqliteQueryable {\n\tname;\n\tconstructor(db, name) {\n\t\tsuper(db);\n\t\tthis.name = name;\n\t}\n\tasync commit() {\n\t\texecSavepointStatement(this.db, `RELEASE SAVEPOINT ${this.name}`);\n\t}\n\tasync rollback() {\n\t\texecSavepointStatement(this.db, `ROLLBACK TO SAVEPOINT ${this.name}`);\n\t}\n\tasync savepoint(name) {\n\t\treturn openSqliteSavepoint(this.db, name);\n\t}\n};\nfunction execSavepointStatement(db, sql) {\n\ttry {\n\t\tdb.exec(sql);\n\t} catch (error) {\n\t\tthrow normalizeSqliteError(error, wasClosedByDriver(db));\n\t}\n}\nfunction openSqliteSavepoint(db, name) {\n\texecSavepointStatement(db, `SAVEPOINT ${name}`);\n\treturn new SqliteSavepointImpl(db, name);\n}\nfunction unboundQuery() {\n\treturn { [Symbol.asyncIterator]() {\n\t\treturn { async next() {\n\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\t} };\n\t} };\n}\nvar SqliteDriver = class {\n\tfamilyId = \"sql\";\n\ttargetId = \"sqlite\";\n\t#state;\n\tconstructor(initialState) {\n\t\tthis.#state = initialState ?? { kind: \"unbound\" };\n\t}\n\t#requireConnected() {\n\t\tif (this.#state.kind !== \"connected\") throw driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\treturn this.#state;\n\t}\n\tget state() {\n\t\treturn this.#state.kind;\n\t}\n\tasync connect(binding) {\n\t\tif (this.#state.kind === \"connected\") throw driverError(\"DRIVER.ALREADY_CONNECTED\", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });\n\t\tthis.#state = {\n\t\t\tkind: \"connected\",\n\t\t\tpath: binding.path,\n\t\t\tconn: new SqliteConnectionImpl(openConnection(binding.path))\n\t\t};\n\t}\n\tasync acquireConnection() {\n\t\tconst { path } = this.#requireConnected();\n\t\treturn new SqliteConnectionImpl(openConnection(path));\n\t}\n\tasync close() {\n\t\tif (this.#state.kind !== \"connected\") return;\n\t\tconst { conn } = this.#state;\n\t\tthis.#state = { kind: \"closed\" };\n\t\tawait conn.release();\n\t}\n\tquery(request) {\n\t\tif (this.#state.kind !== \"connected\") return unboundQuery();\n\t\treturn this.#state.conn.query(request);\n\t}\n\tasync execute(request) {\n\t\treturn this.#requireConnected().conn.execute(request);\n\t}\n\tasync explain(request) {\n\t\treturn this.#requireConnected().conn.explain(request);\n\t}\n};\n//#endregion\n//#region src/core/runtime/runtime-driver.ts\nconst sqliteRuntimeDriverDescriptor = {\n\t...sqliteDriverDescriptorMeta,\n\tcreate() {\n\t\treturn new SqliteDriver();\n\t}\n};\n//#endregion\nexport { sqliteRuntimeDriverDescriptor as default };\n\n//# sourceMappingURL=runtime.mjs.map"],"mappings":";;;;;;AAMA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,MAAM,QAAQ,IAAI,MAAM,OAAO;CAC/B,OAAO,eAAe,OAAO,QAAQ;EACpC,OAAO;EACP,cAAc;CACf,CAAC;CACD,OAAO,OAAO,OAAO,OAAO;EAC3B;EACA,UAAU;EACV,UAAU;EACV;EACA;CACD,CAAC;AACF;AACA,MAAM,wBAAwB;AAC9B,MAAM,4BAA4B;AAClC,SAAS,eAAe,MAAM;CAC7B,IAAI;EACH,MAAM,KAAK,IAAI,aAAa,IAAI;EAChC,GAAG,KAAK,0BAA0B;EAClC,GAAG,KAAK,4BAA4B;EACpC,OAAO;CACR,SAAS,OAAO;EACf,MAAM,qBAAqB,OAAO,KAAK;CACxC;AACD;AACA,IAAI,kBAAkB,MAAM;CAC3B;CACA,YAAY,IAAI;EACf,KAAK,KAAK;CACX;CACA,OAAO,MAAM,SAAS;EACrB,IAAI;EACJ,IAAI;GACH,OAAO,aAAa,KAAK,IAAI,QAAQ,GAAG,CAAC,CAAC,QAAQ,GAAG,aAAa,QAAQ,MAAM,CAAC;GACjF,KAAK,IAAI,OAAO,KAAK,KAAK,GAAG,KAAK,SAAS,MAAM,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,sBAAsB,KAAK,KAAK,CAAC;EACvH,SAAS,OAAO;GACf,MAAM,qBAAqB,OAAO,kBAAkB,KAAK,EAAE,CAAC;EAC7D,UAAU;GACT,IAAI,KAAK,GAAG,QAAQ,MAAM,SAAS;EACpC;CACD;CACA,MAAM,QAAQ,SAAS;EACtB,IAAI;GACH,MAAM,OAAO,aAAa,KAAK,IAAI,QAAQ,GAAG;GAC9C,IAAI,KAAK,QAAQ,CAAC,CAAC,WAAW,GAAG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