@prisma/orm-target-sqlite 0.16.0-dev.36

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 (188) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +23 -0
  3. package/dist/adapter-DizMsGCb-n4h4w8ms.d.mts +22 -0
  4. package/dist/adapter-DizMsGCb-n4h4w8ms.d.mts.map +1 -0
  5. package/dist/adapter-m_BtnNSn.d.mts +2 -0
  6. package/dist/adapter-wc9p_v2Z-y8pzqMfG.mjs +997 -0
  7. package/dist/adapter-wc9p_v2Z-y8pzqMfG.mjs.map +1 -0
  8. package/dist/adapter.d.mts +14 -0
  9. package/dist/adapter.mjs +6 -0
  10. package/dist/adapter__adapter.d.mts +4 -0
  11. package/dist/adapter__adapter.mjs +2 -0
  12. package/dist/adapter__codec-types.d.mts +4 -0
  13. package/dist/adapter__codec-types.mjs +1 -0
  14. package/dist/adapter__column-types.d.mts +2 -0
  15. package/dist/adapter__column-types.mjs +2 -0
  16. package/dist/adapter__control.d.mts +5 -0
  17. package/dist/adapter__control.mjs +261 -0
  18. package/dist/adapter__control.mjs.map +1 -0
  19. package/dist/adapter__runtime.d.mts +2 -0
  20. package/dist/adapter__runtime.mjs +32 -0
  21. package/dist/adapter__runtime.mjs.map +1 -0
  22. package/dist/adapter__types.d.mts +3 -0
  23. package/dist/adapter__types.mjs +1 -0
  24. package/dist/codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts +31 -0
  25. package/dist/codec-descriptor-BcgD9f3L-BjEkn9Ob.d.mts.map +1 -0
  26. package/dist/codec-descriptor-CyCQXvSl.d.mts +2 -0
  27. package/dist/codec-descriptor-kVCSW1OR-CPatZUPM.mjs +104 -0
  28. package/dist/codec-descriptor-kVCSW1OR-CPatZUPM.mjs.map +1 -0
  29. package/dist/codec-descriptor-rFuZ9DzY-DO0k8l6N.d.mts +1 -0
  30. package/dist/codec-ids-ChRBs2aB.d.mts +1 -0
  31. package/dist/codec-ids-DocGjhs--CHhP1jNZ.d.mts +13 -0
  32. package/dist/codec-ids-DocGjhs--CHhP1jNZ.d.mts.map +1 -0
  33. package/dist/codec-ids-xicqpuAa-DHnKqnIs.mjs +13 -0
  34. package/dist/codec-ids-xicqpuAa-DHnKqnIs.mjs.map +1 -0
  35. package/dist/codec-types-DKB--ltR-CIuvX0zx.d.mts +24 -0
  36. package/dist/codec-types-DKB--ltR-CIuvX0zx.d.mts.map +1 -0
  37. package/dist/codec-types-Tw3EFTjf.d.mts +1 -0
  38. package/dist/codec-types-wPDlPoD7.d.mts +2 -0
  39. package/dist/codecs-1-oOsTPG-Bv518Lbm.d.mts +155 -0
  40. package/dist/codecs-1-oOsTPG-Bv518Lbm.d.mts.map +1 -0
  41. package/dist/codecs-CM_2W3uA.mjs +345 -0
  42. package/dist/codecs-CM_2W3uA.mjs.map +1 -0
  43. package/dist/codecs-j-8RDkOt.d.mts +1 -0
  44. package/dist/column-types-StKUDF6A.mjs +34 -0
  45. package/dist/column-types-StKUDF6A.mjs.map +1 -0
  46. package/dist/column-types-iWGuW-0W.d.mts +33 -0
  47. package/dist/column-types-iWGuW-0W.d.mts.map +1 -0
  48. package/dist/contract-free-CCLAXZV2.d.mts +88 -0
  49. package/dist/contract-free-CCLAXZV2.d.mts.map +1 -0
  50. package/dist/contract-free-DElSXD0q.mjs +90 -0
  51. package/dist/contract-free-DElSXD0q.mjs.map +1 -0
  52. package/dist/control--wMueaTg.d.mts +61 -0
  53. package/dist/control--wMueaTg.d.mts.map +1 -0
  54. package/dist/control-8G9x72lw.mjs +42 -0
  55. package/dist/control-8G9x72lw.mjs.map +1 -0
  56. package/dist/control-DLO163u8.d.mts +19 -0
  57. package/dist/control-DLO163u8.d.mts.map +1 -0
  58. package/dist/control-cahq7u71.d.mts +117 -0
  59. package/dist/control-cahq7u71.d.mts.map +1 -0
  60. package/dist/control-tables-D_o8dKRB-BXi43noL.mjs +12 -0
  61. package/dist/control-tables-D_o8dKRB-BXi43noL.mjs.map +1 -0
  62. package/dist/control-tables-Dua-YcJL.d.mts +12 -0
  63. package/dist/control-tables-Dua-YcJL.d.mts.map +1 -0
  64. package/dist/ddl-CW34JvfE-rd1ZIxOn.mjs +66 -0
  65. package/dist/ddl-CW34JvfE-rd1ZIxOn.mjs.map +1 -0
  66. package/dist/ddl-CfSqNT0M.d.mts +1 -0
  67. package/dist/default-normalizer-B9V7TY5u.d.mts +7 -0
  68. package/dist/default-normalizer-B9V7TY5u.d.mts.map +1 -0
  69. package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs +69 -0
  70. package/dist/default-normalizer-DuoHj9-O-DsK7lJZn.mjs.map +1 -0
  71. package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs +30 -0
  72. package/dist/descriptor-meta-CbYkqTkO-DEJNrICG.mjs.map +1 -0
  73. package/dist/descriptor-meta-DnwDwnGg-D3f936hn.mjs +23 -0
  74. package/dist/descriptor-meta-DnwDwnGg-D3f936hn.mjs.map +1 -0
  75. package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs +13 -0
  76. package/dist/descriptor-meta-runtime-BkXK3OjD-CxZdKHCw.mjs.map +1 -0
  77. package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs +70 -0
  78. package/dist/descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs.map +1 -0
  79. package/dist/driver.d.mts +3 -0
  80. package/dist/driver.mjs +2 -0
  81. package/dist/driver__control.d.mts +2 -0
  82. package/dist/driver__control.mjs +2 -0
  83. package/dist/driver__runtime.d.mts +2 -0
  84. package/dist/driver__runtime.mjs +197 -0
  85. package/dist/driver__runtime.mjs.map +1 -0
  86. package/dist/errors-CKsaaSnD-BeB4JS8h.mjs +38 -0
  87. package/dist/errors-CKsaaSnD-BeB4JS8h.mjs.map +1 -0
  88. package/dist/migration-jsmNRI_8.mjs +47 -0
  89. package/dist/migration-jsmNRI_8.mjs.map +1 -0
  90. package/dist/migration-uylRe5MP.d.mts +43 -0
  91. package/dist/migration-uylRe5MP.d.mts.map +1 -0
  92. package/dist/native-type-normalizer-CO2wKGL6.d.mts +12 -0
  93. package/dist/native-type-normalizer-CO2wKGL6.d.mts.map +1 -0
  94. package/dist/native-type-normalizer-GpQMEyN5.mjs +14 -0
  95. package/dist/native-type-normalizer-GpQMEyN5.mjs.map +1 -0
  96. package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts +29 -0
  97. package/dist/nodes-D8EC1yCx-rpfpuJ4T.d.mts.map +1 -0
  98. package/dist/nodes-DUZSdX86-BBEEaxXY.mjs +33 -0
  99. package/dist/nodes-DUZSdX86-BBEEaxXY.mjs.map +1 -0
  100. package/dist/op-factory-call-C_or6163-B_LDzC37.mjs +829 -0
  101. package/dist/op-factory-call-C_or6163-B_LDzC37.mjs.map +1 -0
  102. package/dist/op-factory-call-DoHN7Q7L.d.mts +161 -0
  103. package/dist/op-factory-call-DoHN7Q7L.d.mts.map +1 -0
  104. package/dist/pack-BfwyQ0b3.d.mts +93 -0
  105. package/dist/pack-BfwyQ0b3.d.mts.map +1 -0
  106. package/dist/planner-Bxdi7jZF.d.mts +104 -0
  107. package/dist/planner-Bxdi7jZF.d.mts.map +1 -0
  108. package/dist/planner-DiGcIjl1-QnNAhVmX.mjs +811 -0
  109. package/dist/planner-DiGcIjl1-QnNAhVmX.mjs.map +1 -0
  110. package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts +31 -0
  111. package/dist/planner-produced-sqlite-migration-BuJysRxx-CaDUbNVx.d.mts.map +1 -0
  112. package/dist/planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs +150 -0
  113. package/dist/planner-produced-sqlite-migration-C8nxPT0P-DdBqfmAD.mjs.map +1 -0
  114. package/dist/planner-produced-sqlite-migration-uySoqJO-.d.mts +1 -0
  115. package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs +15 -0
  116. package/dist/planner-target-details-CIQ789Gc-C5U4yVY9.mjs.map +1 -0
  117. package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts +13 -0
  118. package/dist/planner-target-details-xR6UfIcz-CMahymzq.d.mts.map +1 -0
  119. package/dist/render-ops-B10yqmdG.d.mts +11 -0
  120. package/dist/render-ops-B10yqmdG.d.mts.map +1 -0
  121. package/dist/render-ops-DIOn_wOx-D33LOy3b.mjs +27 -0
  122. package/dist/render-ops-DIOn_wOx-D33LOy3b.mjs.map +1 -0
  123. package/dist/runtime-B1coahKC.d.mts +15 -0
  124. package/dist/runtime-B1coahKC.d.mts.map +1 -0
  125. package/dist/runtime-B99c4n56.d.mts +28 -0
  126. package/dist/runtime-B99c4n56.d.mts.map +1 -0
  127. package/dist/runtime-tbBYTw7Z.d.mts +10 -0
  128. package/dist/runtime-tbBYTw7Z.d.mts.map +1 -0
  129. package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts +68 -0
  130. package/dist/shared-BYAX0FaQ--VvRXVRC.d.mts.map +1 -0
  131. package/dist/sql-utils-0SJZOd7Q.d.mts +18 -0
  132. package/dist/sql-utils-0SJZOd7Q.d.mts.map +1 -0
  133. package/dist/sql-utils-DqPXZBMA-Mm27NNjs.mjs +35 -0
  134. package/dist/sql-utils-DqPXZBMA-Mm27NNjs.mjs.map +1 -0
  135. package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts +31 -0
  136. package/dist/sqlite-contract-view-BpNMaU2m-COMDaGaq.d.mts.map +1 -0
  137. package/dist/sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs +151 -0
  138. package/dist/sqlite-contract-view-CnDITHEE-BvjSbmzL.mjs.map +1 -0
  139. package/dist/sqlite-migration-CV6LIqhx-D5eMTAbH.mjs +94 -0
  140. package/dist/sqlite-migration-CV6LIqhx-D5eMTAbH.mjs.map +1 -0
  141. package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts +105 -0
  142. package/dist/sqlite-migration-o23JHwzY-CwNJcqwl.d.mts.map +1 -0
  143. package/dist/target.d.mts +28 -0
  144. package/dist/target.mjs +19 -0
  145. package/dist/target__codec-descriptor.d.mts +3 -0
  146. package/dist/target__codec-descriptor.mjs +2 -0
  147. package/dist/target__codec-ids.d.mts +3 -0
  148. package/dist/target__codec-ids.mjs +2 -0
  149. package/dist/target__codec-types.d.mts +4 -0
  150. package/dist/target__codec-types.mjs +1 -0
  151. package/dist/target__codecs.d.mts +3 -0
  152. package/dist/target__codecs.mjs +2 -0
  153. package/dist/target__contract-free.d.mts +2 -0
  154. package/dist/target__contract-free.mjs +3 -0
  155. package/dist/target__control-tables.d.mts +2 -0
  156. package/dist/target__control-tables.mjs +2 -0
  157. package/dist/target__control.d.mts +3 -0
  158. package/dist/target__control.mjs +432 -0
  159. package/dist/target__control.mjs.map +1 -0
  160. package/dist/target__ddl.d.mts +3 -0
  161. package/dist/target__ddl.mjs +2 -0
  162. package/dist/target__default-normalizer.d.mts +2 -0
  163. package/dist/target__default-normalizer.mjs +2 -0
  164. package/dist/target__migration.d.mts +3 -0
  165. package/dist/target__migration.mjs +3 -0
  166. package/dist/target__native-type-normalizer.d.mts +2 -0
  167. package/dist/target__native-type-normalizer.mjs +2 -0
  168. package/dist/target__op-factory-call.d.mts +2 -0
  169. package/dist/target__op-factory-call.mjs +2 -0
  170. package/dist/target__pack.d.mts +2 -0
  171. package/dist/target__pack.mjs +2 -0
  172. package/dist/target__planner-produced-sqlite-migration.d.mts +3 -0
  173. package/dist/target__planner-produced-sqlite-migration.mjs +2 -0
  174. package/dist/target__planner-target-details.d.mts +2 -0
  175. package/dist/target__planner-target-details.mjs +2 -0
  176. package/dist/target__planner.d.mts +2 -0
  177. package/dist/target__planner.mjs +2 -0
  178. package/dist/target__render-ops.d.mts +2 -0
  179. package/dist/target__render-ops.mjs +2 -0
  180. package/dist/target__runtime.d.mts +3 -0
  181. package/dist/target__runtime.mjs +17 -0
  182. package/dist/target__runtime.mjs.map +1 -0
  183. package/dist/target__sql-utils.d.mts +2 -0
  184. package/dist/target__sql-utils.mjs +2 -0
  185. package/dist/types-C5FSREvo-Bm6N5Kog.d.mts +25 -0
  186. package/dist/types-C5FSREvo-Bm6N5Kog.d.mts.map +1 -0
  187. package/dist/types-DiH2oWUJ.d.mts +1 -0
  188. package/package.json +78 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs","names":[],"sources":["../../../../3-targets/7-drivers/sqlite/dist/descriptor-meta-vjJkUDsn.mjs"],"sourcesContent":["import { SqlConnectionError, SqlQueryError } from \"@internal/sql-errors\";\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;\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 isSqliteError(error) {\n\tif (!(error instanceof Error)) return false;\n\treturn error.code === \"ERR_SQLITE_ERROR\";\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 \"HY000\";\n\t}\n}\nfunction normalizeSqliteError(error) {\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\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 (error.message.includes(\"database is locked\") || error.message.includes(\"unable to open database\")) return new SqlConnectionError(error.message, {\n\t\tcause: error,\n\t\ttransient: false\n\t});\n\treturn error;\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 { normalizeSqliteError as n, sqliteDriverDescriptorMeta as t };\n\n//# sourceMappingURL=descriptor-meta-vjJkUDsn.mjs.map"],"mappings":";;AAEA,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,SAAS,kBAAkB,SAAS;CACnC,QAAQ,UAAU,SAAS;AAC5B;AACA,SAAS,eAAe,SAAS;CAChC,MAAM,OAAO,UAAU;CACvB,OAAO,SAAS,eAAe,SAAS;AACzC;AACA,SAAS,cAAc,OAAO;CAC7B,IAAI,EAAE,iBAAiB,QAAQ,OAAO;CACtC,OAAO,MAAM,SAAS;AACvB;AACA,SAAS,0BAA0B,SAAS;CAC3C,OAAO,0BAA0B,KAAK,OAAO,CAAC,GAAG;AAClD;AACA,SAAS,qBAAqB,SAAS;CACtC,QAAQ,SAAR;EACC,KAAK;EACL,KAAK,8BAA8B,OAAO;EAC1C,KAAK,8BAA8B,OAAO;EAC1C,KAAK,2BAA2B,OAAO;EACvC,KAAK,yBAAyB,OAAO;EACrC;GACC,IAAI,kBAAkB,OAAO,GAAG,OAAO;GACvC,OAAO;CACT;AACD;AACA,SAAS,qBAAqB,OAAO;CACpC,IAAI,EAAE,iBAAiB,QAAQ,OAAO,IAAI,MAAM,OAAO,KAAK,CAAC;CAC7D,IAAI,cAAc,KAAK,GAAG;EACzB,MAAM,UAAU,MAAM,WAAW;EACjC,IAAI,eAAe,OAAO,GAAG,OAAO,IAAI,mBAAmB,MAAM,SAAS;GACzE,OAAO;GACP,WAAW;EACZ,CAAC;EACD,MAAM,WAAW,qBAAqB,OAAO;EAC7C,MAAM,aAAa,0BAA0B,MAAM,OAAO;EAC1D,OAAO,IAAI,cAAc,MAAM,SAAS;GACvC,OAAO;GACP;GACA,GAAG,eAAe,KAAK,IAAI,EAAE,WAAW,IAAI,CAAC;EAC9C,CAAC;CACF;CACA,IAAI,MAAM,QAAQ,SAAS,oBAAoB,KAAK,MAAM,QAAQ,SAAS,yBAAyB,GAAG,OAAO,IAAI,mBAAmB,MAAM,SAAS;EACnJ,OAAO;EACP,WAAW;CACZ,CAAC;CACD,OAAO;AACR;AAGA,MAAM,6BAA6B;CAClC,MAAM;CACN,UAAU;CACV,UAAU;CACV,IAAI;CACJ,SAAS;CACT,cAAc,CAAC;AAChB"}
@@ -0,0 +1,3 @@
1
+ import { t as SqliteControlDriver } from "./control-DLO163u8.mjs";
2
+ import { n as SqliteRuntimeDriver, t as SqliteBinding } from "./runtime-B1coahKC.mjs";
3
+ export { type SqliteBinding, SqliteControlDriver, type SqliteRuntimeDriver };
@@ -0,0 +1,2 @@
1
+ import { t as SqliteControlDriver } from "./control-8G9x72lw.mjs";
2
+ export { SqliteControlDriver };
@@ -0,0 +1,2 @@
1
+ import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-DLO163u8.mjs";
2
+ export { SqliteControlDriver, sqliteDriverDescriptor as default };
@@ -0,0 +1,2 @@
1
+ import { n as sqliteDriverDescriptor, t as SqliteControlDriver } from "./control-8G9x72lw.mjs";
2
+ export { SqliteControlDriver, sqliteDriverDescriptor as default };
@@ -0,0 +1,2 @@
1
+ import { n as SqliteRuntimeDriver, r as sqliteRuntimeDriverDescriptor, t as SqliteBinding } from "./runtime-B1coahKC.mjs";
2
+ export { type SqliteBinding, type SqliteRuntimeDriver, sqliteRuntimeDriverDescriptor as default };
@@ -0,0 +1,197 @@
1
+ import { n as sqliteDriverDescriptorMeta, t as normalizeSqliteError } from "./descriptor-meta-vjJkUDsn-Hz3rnAnk.mjs";
2
+ import { DatabaseSync } from "node:sqlite";
3
+ //#region ../../../3-targets/7-drivers/sqlite/dist/runtime.mjs
4
+ function driverError(code, message, details) {
5
+ const error = new Error(message);
6
+ Object.defineProperty(error, "name", {
7
+ value: "RuntimeError",
8
+ configurable: true
9
+ });
10
+ return Object.assign(error, {
11
+ code,
12
+ category: "DRIVER",
13
+ severity: "error",
14
+ message,
15
+ details
16
+ });
17
+ }
18
+ const NOT_CONNECTED_MESSAGE = "SQLite driver not connected. Call connect(binding) before acquireConnection or execute.";
19
+ const ALREADY_CONNECTED_MESSAGE = "SQLite driver already connected. Call close() before reconnecting with a new binding.";
20
+ function toSqliteParams(params) {
21
+ return params ?? [];
22
+ }
23
+ function openConnection(path) {
24
+ try {
25
+ const db = new DatabaseSync(path);
26
+ db.exec("PRAGMA foreign_keys = ON");
27
+ db.exec("PRAGMA busy_timeout = 5000");
28
+ return db;
29
+ } catch (error) {
30
+ throw normalizeSqliteError(error);
31
+ }
32
+ }
33
+ var SqliteConnectionImpl = class {
34
+ #db;
35
+ constructor(db) {
36
+ this.#db = db;
37
+ }
38
+ async *execute(request) {
39
+ try {
40
+ const stmt = this.#db.prepare(request.sql);
41
+ for (const row of stmt.iterate(...toSqliteParams(request.params))) yield row;
42
+ } catch (error) {
43
+ throw normalizeSqliteError(error);
44
+ }
45
+ }
46
+ executePrepared(request) {
47
+ return this.execute({
48
+ sql: request.sql,
49
+ params: request.params
50
+ });
51
+ }
52
+ async explain(request) {
53
+ try {
54
+ return { rows: this.#db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...toSqliteParams(request.params)) };
55
+ } catch (error) {
56
+ throw normalizeSqliteError(error);
57
+ }
58
+ }
59
+ async query(sql, params) {
60
+ try {
61
+ return { rows: this.#db.prepare(sql).all(...toSqliteParams(params)) };
62
+ } catch (error) {
63
+ throw normalizeSqliteError(error);
64
+ }
65
+ }
66
+ async beginTransaction() {
67
+ try {
68
+ this.#db.exec("BEGIN");
69
+ return new SqliteTransactionImpl(this.#db);
70
+ } catch (error) {
71
+ throw normalizeSqliteError(error);
72
+ }
73
+ }
74
+ async release() {
75
+ return this.destroy();
76
+ }
77
+ async destroy(_reason) {
78
+ try {
79
+ this.#db.close();
80
+ } catch (error) {
81
+ throw normalizeSqliteError(error);
82
+ }
83
+ }
84
+ };
85
+ var SqliteTransactionImpl = class {
86
+ #db;
87
+ constructor(db) {
88
+ this.#db = db;
89
+ }
90
+ async *execute(request) {
91
+ try {
92
+ const stmt = this.#db.prepare(request.sql);
93
+ for (const row of stmt.iterate(...toSqliteParams(request.params))) yield row;
94
+ } catch (error) {
95
+ throw normalizeSqliteError(error);
96
+ }
97
+ }
98
+ executePrepared(request) {
99
+ return this.execute({
100
+ sql: request.sql,
101
+ params: request.params
102
+ });
103
+ }
104
+ async explain(request) {
105
+ try {
106
+ return { rows: this.#db.prepare(`EXPLAIN QUERY PLAN ${request.sql}`).all(...toSqliteParams(request.params)) };
107
+ } catch (error) {
108
+ throw normalizeSqliteError(error);
109
+ }
110
+ }
111
+ async query(sql, params) {
112
+ try {
113
+ return { rows: this.#db.prepare(sql).all(...toSqliteParams(params)) };
114
+ } catch (error) {
115
+ throw normalizeSqliteError(error);
116
+ }
117
+ }
118
+ async commit() {
119
+ try {
120
+ this.#db.exec("COMMIT");
121
+ } catch (error) {
122
+ throw normalizeSqliteError(error);
123
+ }
124
+ }
125
+ async rollback() {
126
+ try {
127
+ this.#db.exec("ROLLBACK");
128
+ } catch (error) {
129
+ throw normalizeSqliteError(error);
130
+ }
131
+ }
132
+ };
133
+ var SqliteDriver = class {
134
+ familyId = "sql";
135
+ targetId = "sqlite";
136
+ #state;
137
+ constructor(initialState) {
138
+ this.#state = initialState ?? { kind: "unbound" };
139
+ }
140
+ #requireConnected() {
141
+ if (this.#state.kind !== "connected") throw driverError("DRIVER.NOT_CONNECTED", NOT_CONNECTED_MESSAGE);
142
+ return this.#state;
143
+ }
144
+ get state() {
145
+ return this.#state.kind;
146
+ }
147
+ async connect(binding) {
148
+ if (this.#state.kind === "connected") throw driverError("DRIVER.ALREADY_CONNECTED", ALREADY_CONNECTED_MESSAGE, { bindingKind: binding.kind });
149
+ this.#state = {
150
+ kind: "connected",
151
+ path: binding.path,
152
+ conn: new SqliteConnectionImpl(openConnection(binding.path))
153
+ };
154
+ }
155
+ async acquireConnection() {
156
+ const { path } = this.#requireConnected();
157
+ return new SqliteConnectionImpl(openConnection(path));
158
+ }
159
+ async close() {
160
+ if (this.#state.kind !== "connected") return;
161
+ const { conn } = this.#state;
162
+ this.#state = { kind: "closed" };
163
+ await conn.release();
164
+ }
165
+ execute(request) {
166
+ if (this.#state.kind !== "connected") return { [Symbol.asyncIterator]() {
167
+ return { async next() {
168
+ throw driverError("DRIVER.NOT_CONNECTED", NOT_CONNECTED_MESSAGE);
169
+ } };
170
+ } };
171
+ return this.#state.conn.execute(request);
172
+ }
173
+ executePrepared(request) {
174
+ if (this.#state.kind !== "connected") return { [Symbol.asyncIterator]() {
175
+ return { async next() {
176
+ throw driverError("DRIVER.NOT_CONNECTED", NOT_CONNECTED_MESSAGE);
177
+ } };
178
+ } };
179
+ return this.#state.conn.executePrepared(request);
180
+ }
181
+ async explain(request) {
182
+ return this.#requireConnected().conn.explain(request);
183
+ }
184
+ async query(sql, params) {
185
+ return this.#requireConnected().conn.query(sql, params);
186
+ }
187
+ };
188
+ const sqliteRuntimeDriverDescriptor = {
189
+ ...sqliteDriverDescriptorMeta,
190
+ create() {
191
+ return new SqliteDriver();
192
+ }
193
+ };
194
+ //#endregion
195
+ export { sqliteRuntimeDriverDescriptor as default };
196
+
197
+ //# sourceMappingURL=driver__runtime.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"driver__runtime.mjs","names":["#db","#state","#requireConnected"],"sources":["../../../../3-targets/7-drivers/sqlite/dist/runtime.mjs"],"sourcesContent":["import { n as normalizeSqliteError, t as sqliteDriverDescriptorMeta } from \"./descriptor-meta-vjJkUDsn.mjs\";\nimport { DatabaseSync } from \"node:sqlite\";\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 toSqliteParams(params) {\n\treturn params ?? [];\n}\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);\n\t}\n}\nvar SqliteConnectionImpl = class {\n\t#db;\n\tconstructor(db) {\n\t\tthis.#db = db;\n\t}\n\tasync *execute(request) {\n\t\ttry {\n\t\t\tconst stmt = this.#db.prepare(request.sql);\n\t\t\tfor (const row of stmt.iterate(...toSqliteParams(request.params))) yield row;\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\texecutePrepared(request) {\n\t\treturn this.execute({\n\t\t\tsql: request.sql,\n\t\t\tparams: request.params\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(...toSqliteParams(request.params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: this.#db.prepare(sql).all(...toSqliteParams(params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync beginTransaction() {\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);\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\tthis.#db.close();\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n};\nvar SqliteTransactionImpl = class {\n\t#db;\n\tconstructor(db) {\n\t\tthis.#db = db;\n\t}\n\tasync *execute(request) {\n\t\ttry {\n\t\t\tconst stmt = this.#db.prepare(request.sql);\n\t\t\tfor (const row of stmt.iterate(...toSqliteParams(request.params))) yield row;\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\texecutePrepared(request) {\n\t\treturn this.execute({\n\t\t\tsql: request.sql,\n\t\t\tparams: request.params\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(...toSqliteParams(request.params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync query(sql, params) {\n\t\ttry {\n\t\t\treturn { rows: this.#db.prepare(sql).all(...toSqliteParams(params)) };\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\n\t\t}\n\t}\n\tasync commit() {\n\t\ttry {\n\t\t\tthis.#db.exec(\"COMMIT\");\n\t\t} catch (error) {\n\t\t\tthrow normalizeSqliteError(error);\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);\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\texecute(request) {\n\t\tif (this.#state.kind !== \"connected\") return { [Symbol.asyncIterator]() {\n\t\t\treturn { async next() {\n\t\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\t\t} };\n\t\t} };\n\t\treturn this.#state.conn.execute(request);\n\t}\n\texecutePrepared(request) {\n\t\tif (this.#state.kind !== \"connected\") return { [Symbol.asyncIterator]() {\n\t\t\treturn { async next() {\n\t\t\t\tthrow driverError(\"DRIVER.NOT_CONNECTED\", NOT_CONNECTED_MESSAGE);\n\t\t\t} };\n\t\t} };\n\t\treturn this.#state.conn.executePrepared(request);\n\t}\n\tasync explain(request) {\n\t\treturn this.#requireConnected().conn.explain(request);\n\t}\n\tasync query(sql, params) {\n\t\treturn this.#requireConnected().conn.query(sql, params);\n\t}\n};\n//#endregion\n//#region src/core/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":"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"}
@@ -0,0 +1,38 @@
1
+ import { structuredError } from "@prisma/orm-framework/utils/structured-error";
2
+ import { CliStructuredError } from "@prisma/orm-framework/errors/control";
3
+ //#region ../../../3-targets/3-targets/sqlite/dist/errors-CKsaaSnD.mjs
4
+ function sqliteError(code, message, options) {
5
+ return structuredError(code, message, options);
6
+ }
7
+ /**
8
+ * A `SqliteMigration` operation that needs the materialized control adapter
9
+ * — named by `operation` (e.g. `createTable`, `dropColumn`, `recreateTable`) —
10
+ * was invoked, but the migration was constructed without a `ControlStack`.
11
+ * Concrete authoring usage always goes through the migration CLI entrypoint,
12
+ * which assembles a stack from the loaded `prisma-next.config.ts`; reaching this
13
+ * error means a test fixture or ad-hoc consumer instantiated `SqliteMigration`
14
+ * with the no-arg form (legal for `operations` / `describe` introspection only).
15
+ *
16
+ * The `operation` argument is required so every throw site names the operation
17
+ * that actually failed; a new operation cannot inherit a misattributed message.
18
+ *
19
+ * Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)
20
+ * because the missing input is the stack itself, not the per-operation
21
+ * contract.
22
+ *
23
+ * Lives in `@internal/target-sqlite/errors` rather than the shared
24
+ * framework migration errors module because the failure is target-specific:
25
+ * the contract it talks about (`SqliteMigration`, the SQLite control
26
+ * adapter, the SQLite-target stack) only exists in this package.
27
+ */
28
+ function errorSqliteMigrationStackMissing(operation) {
29
+ return new CliStructuredError("MIGRATION.SQLITE_CONTROL_STACK_MISSING", `SqliteMigration.${operation} requires a control adapter`, {
30
+ why: `SqliteMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its DDL node.`,
31
+ fix: "Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.",
32
+ meta: { operation }
33
+ });
34
+ }
35
+ //#endregion
36
+ export { sqliteError as n, errorSqliteMigrationStackMissing as t };
37
+
38
+ //# sourceMappingURL=errors-CKsaaSnD-BeB4JS8h.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors-CKsaaSnD-BeB4JS8h.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/errors-CKsaaSnD.mjs"],"sourcesContent":["import { structuredError } from \"@internal/utils/structured-error\";\nimport { CliStructuredError } from \"@internal/errors/control\";\n//#region src/core/errors.ts\nfunction sqliteError(code, message, options) {\n\treturn structuredError(code, message, options);\n}\n/**\n* A `SqliteMigration` operation that needs the materialized control adapter\n* — named by `operation` (e.g. `createTable`, `dropColumn`, `recreateTable`) —\n* was invoked, but the migration was constructed without a `ControlStack`.\n* Concrete authoring usage always goes through the migration CLI entrypoint,\n* which assembles a stack from the loaded `prisma-next.config.ts`; reaching this\n* error means a test fixture or ad-hoc consumer instantiated `SqliteMigration`\n* with the no-arg form (legal for `operations` / `describe` introspection only).\n*\n* The `operation` argument is required so every throw site names the operation\n* that actually failed; a new operation cannot inherit a misattributed message.\n*\n* Distinct from `MIGRATION.UNFILLED_PLACEHOLDER` (placeholder not filled)\n* because the missing input is the stack itself, not the per-operation\n* contract.\n*\n* Lives in `@internal/target-sqlite/errors` rather than the shared\n* framework migration errors module because the failure is target-specific:\n* the contract it talks about (`SqliteMigration`, the SQLite control\n* adapter, the SQLite-target stack) only exists in this package.\n*/\nfunction errorSqliteMigrationStackMissing(operation) {\n\treturn new CliStructuredError(\"MIGRATION.SQLITE_CONTROL_STACK_MISSING\", `SqliteMigration.${operation} requires a control adapter`, {\n\t\twhy: `SqliteMigration.${operation} was invoked on an instance constructed without a ControlStack, so the stored controlAdapter is undefined and the operation cannot lower its DDL node.`,\n\t\tfix: \"Construct the migration via the migration CLI entrypoint (which assembles a ControlStack from the loaded prisma-next.config.ts), or pass a ControlStack containing a SQLite adapter to the migration constructor in test fixtures.\",\n\t\tmeta: { operation }\n\t});\n}\n//#endregion\nexport { sqliteError as n, errorSqliteMigrationStackMissing as t };\n\n//# sourceMappingURL=errors-CKsaaSnD.mjs.map"],"mappings":";;;AAGA,SAAS,YAAY,MAAM,SAAS,SAAS;CAC5C,OAAO,gBAAgB,MAAM,SAAS,OAAO;AAC9C;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,iCAAiC,WAAW;CACpD,OAAO,IAAI,mBAAmB,0CAA0C,mBAAmB,UAAU,8BAA8B;EAClI,KAAK,mBAAmB,UAAU;EAClC,KAAK;EACL,MAAM,EAAE,UAAU;CACnB,CAAC;AACF"}
@@ -0,0 +1,47 @@
1
+ import { t as buildTargetDetails } from "./planner-target-details-CIQ789Gc-C5U4yVY9.mjs";
2
+ import { h as step } from "./op-factory-call-C_or6163-B_LDzC37.mjs";
3
+ import { col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
4
+ import { placeholder } from "@prisma/orm-framework/errors/migration";
5
+ import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
6
+ //#region ../../../3-targets/3-targets/sqlite/dist/migration.mjs
7
+ /**
8
+ * User-facing `dataTransform` factory for the SQLite migration authoring
9
+ * surface. Invoked directly inside a `migration.ts` file to supply a
10
+ * user-authored SQL statement that runs with operation class `'data'`.
11
+ *
12
+ * Typical use: the planner emits a `DataTransformCall` stub when a NOT NULL
13
+ * tightening requires a backfill. The rendered `migration.ts` exposes the
14
+ * backfill as a `placeholder("…")` slot the user fills in with an
15
+ * `UPDATE … WHERE col IS NULL` statement. The filled-in `dataTransform(...)`
16
+ * invocation returns a runnable operation the runner executes before the
17
+ * subsequent recreate-table op copies data into the tightened schema.
18
+ */
19
+ function dataTransform(opts) {
20
+ return {
21
+ id: opts.id,
22
+ label: opts.label,
23
+ summary: opts.description,
24
+ operationClass: "data",
25
+ target: {
26
+ id: "sqlite",
27
+ details: buildTargetDetails("table", opts.table)
28
+ },
29
+ precheck: [],
30
+ execute: [step(opts.description, opts.run())],
31
+ postcheck: []
32
+ };
33
+ }
34
+ /**
35
+ * Identity factory for an already-materialized
36
+ * `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres
37
+ * `rawSql` factory: the planner uses this to carry ops produced by SQL-family
38
+ * paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured
39
+ * call IR without reverse-engineering their shape.
40
+ */
41
+ function rawSql(op) {
42
+ return op;
43
+ }
44
+ //#endregion
45
+ export { foreignKey as a, primaryKey as c, fn$1 as i, rawSql as l, col$1 as n, lit$1 as o, dataTransform as r, placeholder as s, MigrationCLI as t, unique as u };
46
+
47
+ //# sourceMappingURL=migration-jsmNRI_8.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-jsmNRI_8.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.mjs"],"sourcesContent":["import { f as step } from \"./op-factory-call-C_or6163.mjs\";\nimport { t as buildTargetDetails } from \"./planner-target-details-CIQ789Gc.mjs\";\nimport { t as SqliteMigration } from \"./sqlite-migration-CV6LIqhx.mjs\";\nimport { placeholder } from \"@internal/errors/migration\";\nimport { col, fn, foreignKey, lit, primaryKey, unique } from \"@internal/sql-relational-core/contract-free\";\nimport { MigrationCLI } from \"@internal/cli/migration-cli\";\n//#region src/core/migrations/operations/data-transform.ts\n/**\n* User-facing `dataTransform` factory for the SQLite migration authoring\n* surface. Invoked directly inside a `migration.ts` file to supply a\n* user-authored SQL statement that runs with operation class `'data'`.\n*\n* Typical use: the planner emits a `DataTransformCall` stub when a NOT NULL\n* tightening requires a backfill. The rendered `migration.ts` exposes the\n* backfill as a `placeholder(\"…\")` slot the user fills in with an\n* `UPDATE … WHERE col IS NULL` statement. The filled-in `dataTransform(...)`\n* invocation returns a runnable operation the runner executes before the\n* subsequent recreate-table op copies data into the tightened schema.\n*/\nfunction dataTransform(opts) {\n\treturn {\n\t\tid: opts.id,\n\t\tlabel: opts.label,\n\t\tsummary: opts.description,\n\t\toperationClass: \"data\",\n\t\ttarget: {\n\t\t\tid: \"sqlite\",\n\t\t\tdetails: buildTargetDetails(\"table\", opts.table)\n\t\t},\n\t\tprecheck: [],\n\t\texecute: [step(opts.description, opts.run())],\n\t\tpostcheck: []\n\t};\n}\n//#endregion\n//#region src/core/migrations/operations/raw.ts\n/**\n* Identity factory for an already-materialized\n* `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres\n* `rawSql` factory: the planner uses this to carry ops produced by SQL-family\n* paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured\n* call IR without reverse-engineering their shape.\n*/\nfunction rawSql(op) {\n\treturn op;\n}\n//#endregion\nexport { SqliteMigration as Migration, MigrationCLI, col, dataTransform, fn, foreignKey, lit, placeholder, primaryKey, rawSql, unique };\n\n//# sourceMappingURL=migration.mjs.map"],"mappings":";;;;;;;;;;;;;;;;;;AAmBA,SAAS,cAAc,MAAM;CAC5B,OAAO;EACN,IAAI,KAAK;EACT,OAAO,KAAK;EACZ,SAAS,KAAK;EACd,gBAAgB;EAChB,QAAQ;GACP,IAAI;GACJ,SAAS,mBAAmB,SAAS,KAAK,KAAK;EAChD;EACA,UAAU,CAAC;EACX,SAAS,CAAC,KAAK,KAAK,aAAa,KAAK,IAAI,CAAC,CAAC;EAC5C,WAAW,CAAC;CACb;AACD;;;;;;;;AAUA,SAAS,OAAO,IAAI;CACnB,OAAO;AACR"}
@@ -0,0 +1,43 @@
1
+ import { t as Op } from "./shared-BYAX0FaQ--VvRXVRC.mjs";
2
+ import "./sqlite-migration-o23JHwzY-CwNJcqwl.mjs";
3
+ import { col as col$1, fn as fn$1, foreignKey, lit as lit$1, primaryKey, unique } from "@prisma/orm-family-sql/relational-core/contract-free";
4
+ import { placeholder } from "@prisma/orm-framework/errors/migration";
5
+ import { MigrationCLI } from "@prisma/orm-toolchain/cli/migration-cli";
6
+ //#region ../../../3-targets/3-targets/sqlite/dist/migration.d.mts
7
+ //#region src/core/migrations/operations/data-transform.d.ts
8
+ interface DataTransformOptions {
9
+ /** Stable id used in the ledger / for runner idempotency tracking. */
10
+ readonly id: string;
11
+ /** Human-readable label surfaced in CLI output. */
12
+ readonly label: string;
13
+ /** Table the backfill targets; informs `target.details`. */
14
+ readonly table: string;
15
+ /**
16
+ * Short description of the step (shown by the runner on execute). The
17
+ * planner leaves this as `placeholder(...)` for users to replace.
18
+ */
19
+ readonly description: string;
20
+ /**
21
+ * Producer of the SQL string to execute. Invoked eagerly by
22
+ * `dataTransform(...)`, mirroring the Postgres factory — by the time the
23
+ * user calls this factory in `migration.ts`, the SQL is expected to be
24
+ * ready. Planner-emitted stubs that need to defer until the user fills
25
+ * in the SQL go through `DataTransformCall.renderTypeScript()` instead;
26
+ * this factory is only for the post-fill, runnable form.
27
+ */
28
+ readonly run: () => string;
29
+ }
30
+ declare function dataTransform(opts: DataTransformOptions): Op;
31
+ //#endregion
32
+ //#region src/core/migrations/operations/raw.d.ts
33
+ /**
34
+ * Identity factory for an already-materialized
35
+ * `SqlMigrationPlanOperation<SqlitePlanTargetDetails>`. Mirrors the Postgres
36
+ * `rawSql` factory: the planner uses this to carry ops produced by SQL-family
37
+ * paths (codec lifecycle hooks, raw-SQL escape hatches) alongside structured
38
+ * call IR without reverse-engineering their shape.
39
+ */
40
+ declare function rawSql(op: Op): Op;
41
+ //#endregion
42
+ export { fn$1 as a, placeholder as c, unique as d, dataTransform as i, primaryKey as l, MigrationCLI as n, foreignKey as o, col$1 as r, lit$1 as s, DataTransformOptions as t, rawSql as u };
43
+ //# sourceMappingURL=migration-uylRe5MP.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migration-uylRe5MP.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/migration.d.mts"],"mappings":";;;;;;;UAMU;;WAEC;;WAEA;;WAEA;;;;;WAKA;;;;;;;;;WASA;;iBAEM,cAAc,MAAM,uBAAuB;;;;;;;;;;iBAU3C,OAAO,IAAI,KAAK"}
@@ -0,0 +1,12 @@
1
+ //#region ../../../3-targets/3-targets/sqlite/dist/native-type-normalizer.d.mts
2
+ //#region src/core/native-type-normalizer.d.ts
3
+ /**
4
+ * Canonicalizes SQLite native-type tokens for verifier comparison.
5
+ * Lives target-side so the planner / runner / adapter all share the same
6
+ * normalization without crossing the `target-sqlite` ↔ `adapter-sqlite`
7
+ * boundary.
8
+ */
9
+ declare function normalizeSqliteNativeType(nativeType: string): string;
10
+ //#endregion
11
+ export { normalizeSqliteNativeType as t };
12
+ //# sourceMappingURL=native-type-normalizer-CO2wKGL6.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-type-normalizer-CO2wKGL6.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/native-type-normalizer.d.mts"],"mappings":";;;;;;;;iBAOiB,0BAA0B"}
@@ -0,0 +1,14 @@
1
+ //#region ../../../3-targets/3-targets/sqlite/dist/native-type-normalizer.mjs
2
+ /**
3
+ * Canonicalizes SQLite native-type tokens for verifier comparison.
4
+ * Lives target-side so the planner / runner / adapter all share the same
5
+ * normalization without crossing the `target-sqlite` ↔ `adapter-sqlite`
6
+ * boundary.
7
+ */
8
+ function normalizeSqliteNativeType(nativeType) {
9
+ return nativeType.trim().toLowerCase();
10
+ }
11
+ //#endregion
12
+ export { normalizeSqliteNativeType as t };
13
+
14
+ //# sourceMappingURL=native-type-normalizer-GpQMEyN5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-type-normalizer-GpQMEyN5.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/native-type-normalizer.mjs"],"sourcesContent":["//#region src/core/native-type-normalizer.ts\n/**\n* Canonicalizes SQLite native-type tokens for verifier comparison.\n* Lives target-side so the planner / runner / adapter all share the same\n* normalization without crossing the `target-sqlite` ↔ `adapter-sqlite`\n* boundary.\n*/\nfunction normalizeSqliteNativeType(nativeType) {\n\treturn nativeType.trim().toLowerCase();\n}\n//#endregion\nexport { normalizeSqliteNativeType };\n\n//# sourceMappingURL=native-type-normalizer.mjs.map"],"mappings":";;;;;;;AAOA,SAAS,0BAA0B,YAAY;CAC9C,OAAO,WAAW,KAAK,CAAC,CAAC,YAAY;AACtC"}
@@ -0,0 +1,29 @@
1
+ import { DdlColumn, DdlNode, DdlTableConstraint } from "@prisma/orm-family-sql/relational-core/ast";
2
+ //#region ../../../3-targets/3-targets/sqlite/dist/nodes-D8EC1yCx.d.mts
3
+ //#region src/core/ddl/nodes.d.ts
4
+ interface SqliteDdlVisitor<R> {
5
+ createTable(node: SqliteCreateTable): R;
6
+ }
7
+ declare abstract class SqliteDdlNode extends DdlNode {
8
+ abstract accept<R>(visitor: SqliteDdlVisitor<R>): R;
9
+ }
10
+ declare class SqliteCreateTable extends SqliteDdlNode {
11
+ readonly kind: "create-table";
12
+ readonly table: string;
13
+ readonly schema: string | undefined;
14
+ readonly ifNotExists: boolean | undefined;
15
+ readonly columns: ReadonlyArray<DdlColumn>;
16
+ readonly constraints: ReadonlyArray<DdlTableConstraint> | undefined;
17
+ constructor(options: {
18
+ readonly table: string;
19
+ readonly schema?: string;
20
+ readonly ifNotExists?: boolean;
21
+ readonly columns: readonly DdlColumn[];
22
+ readonly constraints?: readonly DdlTableConstraint[];
23
+ });
24
+ accept<R>(visitor: SqliteDdlVisitor<R>): R;
25
+ }
26
+ type AnySqliteDdlNode = SqliteCreateTable;
27
+ //#endregion
28
+ export { SqliteDdlVisitor as i, SqliteCreateTable as n, SqliteDdlNode as r, AnySqliteDdlNode as t };
29
+ //# sourceMappingURL=nodes-D8EC1yCx-rpfpuJ4T.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes-D8EC1yCx-rpfpuJ4T.d.mts","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/nodes-D8EC1yCx.d.mts"],"mappings":";;;UAEU,iBAAiB;EACzB,YAAY,MAAM,oBAAoB;;uBAEjB,sBAAsB;WAClC,OAAO,GAAG,SAAS,iBAAiB,KAAK;;cAEtC,0BAA0B;WAC7B;WACA;WACA;WACA;WACA,SAAS,cAAc;WACvB,aAAa,cAAc;EACpC,YAAY;aACD;aACA;aACA;aACA,kBAAkB;aAClB,uBAAuB;;EAElC,OAAO,GAAG,SAAS,iBAAiB,KAAK;;KAEtC,mBAAmB"}
@@ -0,0 +1,33 @@
1
+ import { DdlNode } from "@prisma/orm-family-sql/relational-core/ast";
2
+ //#region ../../../3-targets/3-targets/sqlite/dist/nodes-DUZSdX86.mjs
3
+ var SqliteDdlNode = class extends DdlNode {};
4
+ function freezeDdlColumns(columns) {
5
+ return Object.freeze([...columns]);
6
+ }
7
+ function freezeConstraints(constraints) {
8
+ return constraints ? Object.freeze([...constraints]) : void 0;
9
+ }
10
+ var SqliteCreateTable = class extends SqliteDdlNode {
11
+ kind = "create-table";
12
+ table;
13
+ schema;
14
+ ifNotExists;
15
+ columns;
16
+ constraints;
17
+ constructor(options) {
18
+ super();
19
+ this.table = options.table;
20
+ this.schema = options.schema;
21
+ this.ifNotExists = options.ifNotExists;
22
+ this.columns = freezeDdlColumns(options.columns);
23
+ this.constraints = freezeConstraints(options.constraints);
24
+ this.freeze();
25
+ }
26
+ accept(visitor) {
27
+ return visitor.createTable(this);
28
+ }
29
+ };
30
+ //#endregion
31
+ export { SqliteDdlNode as n, SqliteCreateTable as t };
32
+
33
+ //# sourceMappingURL=nodes-DUZSdX86-BBEEaxXY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes-DUZSdX86-BBEEaxXY.mjs","names":[],"sources":["../../../../3-targets/3-targets/sqlite/dist/nodes-DUZSdX86.mjs"],"sourcesContent":["import { DdlNode } from \"@internal/sql-relational-core/ast\";\n//#region src/core/ddl/nodes.ts\nvar SqliteDdlNode = class extends DdlNode {};\nfunction freezeDdlColumns(columns) {\n\treturn Object.freeze([...columns]);\n}\nfunction freezeConstraints(constraints) {\n\treturn constraints ? Object.freeze([...constraints]) : void 0;\n}\nvar SqliteCreateTable = class extends SqliteDdlNode {\n\tkind = \"create-table\";\n\ttable;\n\tschema;\n\tifNotExists;\n\tcolumns;\n\tconstraints;\n\tconstructor(options) {\n\t\tsuper();\n\t\tthis.table = options.table;\n\t\tthis.schema = options.schema;\n\t\tthis.ifNotExists = options.ifNotExists;\n\t\tthis.columns = freezeDdlColumns(options.columns);\n\t\tthis.constraints = freezeConstraints(options.constraints);\n\t\tthis.freeze();\n\t}\n\taccept(visitor) {\n\t\treturn visitor.createTable(this);\n\t}\n};\n//#endregion\nexport { SqliteDdlNode as n, SqliteCreateTable as t };\n\n//# sourceMappingURL=nodes-DUZSdX86.mjs.map"],"mappings":";;AAEA,IAAI,gBAAgB,cAAc,QAAQ,CAAC;AAC3C,SAAS,iBAAiB,SAAS;CAClC,OAAO,OAAO,OAAO,CAAC,GAAG,OAAO,CAAC;AAClC;AACA,SAAS,kBAAkB,aAAa;CACvC,OAAO,cAAc,OAAO,OAAO,CAAC,GAAG,WAAW,CAAC,IAAI,KAAK;AAC7D;AACA,IAAI,oBAAoB,cAAc,cAAc;CACnD,OAAO;CACP;CACA;CACA;CACA;CACA;CACA,YAAY,SAAS;EACpB,MAAM;EACN,KAAK,QAAQ,QAAQ;EACrB,KAAK,SAAS,QAAQ;EACtB,KAAK,cAAc,QAAQ;EAC3B,KAAK,UAAU,iBAAiB,QAAQ,OAAO;EAC/C,KAAK,cAAc,kBAAkB,QAAQ,WAAW;EACxD,KAAK,OAAO;CACb;CACA,OAAO,SAAS;EACf,OAAO,QAAQ,YAAY,IAAI;CAChC;AACD"}