drizzle-orm 0.38.3-7db411e → 0.38.3-8e428d1

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 (631) hide show
  1. package/alias.cjs.map +1 -1
  2. package/alias.d.cts +3 -3
  3. package/alias.d.ts +3 -3
  4. package/alias.js.map +1 -1
  5. package/aws-data-api/pg/driver.cjs +5 -19
  6. package/aws-data-api/pg/driver.cjs.map +1 -1
  7. package/aws-data-api/pg/driver.d.cts +8 -9
  8. package/aws-data-api/pg/driver.d.ts +8 -9
  9. package/aws-data-api/pg/driver.js +8 -9
  10. package/aws-data-api/pg/driver.js.map +1 -1
  11. package/aws-data-api/pg/migrator.cjs.map +1 -1
  12. package/aws-data-api/pg/migrator.d.cts +1 -2
  13. package/aws-data-api/pg/migrator.d.ts +1 -2
  14. package/aws-data-api/pg/migrator.js.map +1 -1
  15. package/aws-data-api/pg/session.cjs +4 -67
  16. package/aws-data-api/pg/session.cjs.map +1 -1
  17. package/aws-data-api/pg/session.d.cts +8 -13
  18. package/aws-data-api/pg/session.d.ts +8 -13
  19. package/aws-data-api/pg/session.js +4 -67
  20. package/aws-data-api/pg/session.js.map +1 -1
  21. package/better-sqlite3/driver.cjs +5 -12
  22. package/better-sqlite3/driver.cjs.map +1 -1
  23. package/better-sqlite3/driver.d.cts +6 -7
  24. package/better-sqlite3/driver.d.ts +6 -7
  25. package/better-sqlite3/driver.js +8 -12
  26. package/better-sqlite3/driver.js.map +1 -1
  27. package/better-sqlite3/migrator.cjs.map +1 -1
  28. package/better-sqlite3/migrator.d.cts +1 -2
  29. package/better-sqlite3/migrator.d.ts +1 -2
  30. package/better-sqlite3/migrator.js.map +1 -1
  31. package/better-sqlite3/session.cjs +4 -49
  32. package/better-sqlite3/session.cjs.map +1 -1
  33. package/better-sqlite3/session.d.cts +8 -14
  34. package/better-sqlite3/session.d.ts +8 -14
  35. package/better-sqlite3/session.js +4 -49
  36. package/better-sqlite3/session.js.map +1 -1
  37. package/bun-sqlite/driver.cjs +5 -22
  38. package/bun-sqlite/driver.cjs.map +1 -1
  39. package/bun-sqlite/driver.d.cts +6 -7
  40. package/bun-sqlite/driver.d.ts +6 -7
  41. package/bun-sqlite/driver.js +8 -12
  42. package/bun-sqlite/driver.js.map +1 -1
  43. package/bun-sqlite/migrator.cjs.map +1 -1
  44. package/bun-sqlite/migrator.d.cts +1 -2
  45. package/bun-sqlite/migrator.d.ts +1 -2
  46. package/bun-sqlite/migrator.js.map +1 -1
  47. package/bun-sqlite/session.cjs +4 -49
  48. package/bun-sqlite/session.cjs.map +1 -1
  49. package/bun-sqlite/session.d.cts +8 -14
  50. package/bun-sqlite/session.d.ts +8 -14
  51. package/bun-sqlite/session.js +4 -49
  52. package/bun-sqlite/session.js.map +1 -1
  53. package/d1/driver.cjs +5 -22
  54. package/d1/driver.cjs.map +1 -1
  55. package/d1/driver.d.cts +2 -3
  56. package/d1/driver.d.ts +2 -3
  57. package/d1/driver.js +8 -12
  58. package/d1/driver.js.map +1 -1
  59. package/d1/migrator.cjs.map +1 -1
  60. package/d1/migrator.d.cts +1 -2
  61. package/d1/migrator.d.ts +1 -2
  62. package/d1/migrator.js.map +1 -1
  63. package/d1/session.cjs +6 -48
  64. package/d1/session.cjs.map +1 -1
  65. package/d1/session.d.cts +8 -15
  66. package/d1/session.d.ts +8 -15
  67. package/d1/session.js +6 -48
  68. package/d1/session.js.map +1 -1
  69. package/durable-sqlite/driver.cjs +5 -16
  70. package/durable-sqlite/driver.cjs.map +1 -1
  71. package/durable-sqlite/driver.d.cts +2 -3
  72. package/durable-sqlite/driver.d.ts +2 -3
  73. package/durable-sqlite/driver.js +8 -6
  74. package/durable-sqlite/driver.js.map +1 -1
  75. package/durable-sqlite/migrator.cjs.map +1 -1
  76. package/durable-sqlite/migrator.d.cts +1 -2
  77. package/durable-sqlite/migrator.d.ts +1 -2
  78. package/durable-sqlite/migrator.js.map +1 -1
  79. package/durable-sqlite/session.cjs +4 -46
  80. package/durable-sqlite/session.cjs.map +1 -1
  81. package/durable-sqlite/session.d.cts +8 -14
  82. package/durable-sqlite/session.d.ts +8 -14
  83. package/durable-sqlite/session.js +4 -46
  84. package/durable-sqlite/session.js.map +1 -1
  85. package/expo-sqlite/driver.cjs +5 -22
  86. package/expo-sqlite/driver.cjs.map +1 -1
  87. package/expo-sqlite/driver.d.cts +2 -3
  88. package/expo-sqlite/driver.d.ts +2 -3
  89. package/expo-sqlite/driver.js +8 -12
  90. package/expo-sqlite/driver.js.map +1 -1
  91. package/expo-sqlite/migrator.cjs.map +1 -1
  92. package/expo-sqlite/migrator.d.cts +2 -3
  93. package/expo-sqlite/migrator.d.ts +2 -3
  94. package/expo-sqlite/migrator.js.map +1 -1
  95. package/expo-sqlite/query.cjs +2 -13
  96. package/expo-sqlite/query.cjs.map +1 -1
  97. package/expo-sqlite/query.d.cts +1 -2
  98. package/expo-sqlite/query.d.ts +1 -2
  99. package/expo-sqlite/query.js +2 -3
  100. package/expo-sqlite/query.js.map +1 -1
  101. package/expo-sqlite/session.cjs +4 -47
  102. package/expo-sqlite/session.cjs.map +1 -1
  103. package/expo-sqlite/session.d.cts +8 -14
  104. package/expo-sqlite/session.d.ts +8 -14
  105. package/expo-sqlite/session.js +4 -47
  106. package/expo-sqlite/session.js.map +1 -1
  107. package/libsql/driver-core.cjs +5 -22
  108. package/libsql/driver-core.cjs.map +1 -1
  109. package/libsql/driver-core.d.cts +1 -2
  110. package/libsql/driver-core.d.ts +1 -2
  111. package/libsql/driver-core.js +8 -12
  112. package/libsql/driver-core.js.map +1 -1
  113. package/libsql/driver.cjs.map +1 -1
  114. package/libsql/driver.d.cts +5 -6
  115. package/libsql/driver.d.ts +5 -6
  116. package/libsql/driver.js.map +1 -1
  117. package/libsql/http/index.cjs.map +1 -1
  118. package/libsql/http/index.d.cts +5 -6
  119. package/libsql/http/index.d.ts +5 -6
  120. package/libsql/http/index.js.map +1 -1
  121. package/libsql/migrator.cjs.map +1 -1
  122. package/libsql/migrator.d.cts +1 -2
  123. package/libsql/migrator.d.ts +1 -2
  124. package/libsql/migrator.js.map +1 -1
  125. package/libsql/node/index.cjs.map +1 -1
  126. package/libsql/node/index.d.cts +5 -6
  127. package/libsql/node/index.d.ts +5 -6
  128. package/libsql/node/index.js.map +1 -1
  129. package/libsql/session.cjs +4 -60
  130. package/libsql/session.cjs.map +1 -1
  131. package/libsql/session.d.cts +9 -15
  132. package/libsql/session.d.ts +9 -15
  133. package/libsql/session.js +4 -60
  134. package/libsql/session.js.map +1 -1
  135. package/libsql/sqlite3/index.cjs.map +1 -1
  136. package/libsql/sqlite3/index.d.cts +5 -6
  137. package/libsql/sqlite3/index.d.ts +5 -6
  138. package/libsql/sqlite3/index.js.map +1 -1
  139. package/libsql/wasm/index.cjs.map +1 -1
  140. package/libsql/wasm/index.d.cts +5 -6
  141. package/libsql/wasm/index.d.ts +5 -6
  142. package/libsql/wasm/index.js.map +1 -1
  143. package/libsql/web/index.cjs.map +1 -1
  144. package/libsql/web/index.d.cts +5 -6
  145. package/libsql/web/index.d.ts +5 -6
  146. package/libsql/web/index.js.map +1 -1
  147. package/libsql/ws/index.cjs.map +1 -1
  148. package/libsql/ws/index.d.cts +5 -6
  149. package/libsql/ws/index.d.ts +5 -6
  150. package/libsql/ws/index.js.map +1 -1
  151. package/mysql-core/db.cjs +8 -29
  152. package/mysql-core/db.cjs.map +1 -1
  153. package/mysql-core/db.d.cts +8 -15
  154. package/mysql-core/db.d.ts +8 -15
  155. package/mysql-core/db.js +7 -28
  156. package/mysql-core/db.js.map +1 -1
  157. package/mysql-core/dialect.cjs +15 -176
  158. package/mysql-core/dialect.cjs.map +1 -1
  159. package/mysql-core/dialect.d.cts +13 -31
  160. package/mysql-core/dialect.d.ts +13 -31
  161. package/mysql-core/dialect.js +21 -173
  162. package/mysql-core/dialect.js.map +1 -1
  163. package/mysql-core/query-builders/count.cjs.map +1 -1
  164. package/mysql-core/query-builders/count.d.cts +1 -1
  165. package/mysql-core/query-builders/count.d.ts +1 -1
  166. package/mysql-core/query-builders/count.js.map +1 -1
  167. package/mysql-core/query-builders/query.cjs +31 -18
  168. package/mysql-core/query-builders/query.cjs.map +1 -1
  169. package/mysql-core/query-builders/query.d.cts +10 -8
  170. package/mysql-core/query-builders/query.d.ts +10 -8
  171. package/mysql-core/query-builders/query.js +31 -18
  172. package/mysql-core/query-builders/query.js.map +1 -1
  173. package/mysql-core/session.cjs +2 -3
  174. package/mysql-core/session.cjs.map +1 -1
  175. package/mysql-core/session.d.cts +7 -10
  176. package/mysql-core/session.d.ts +7 -10
  177. package/mysql-core/session.js +2 -3
  178. package/mysql-core/session.js.map +1 -1
  179. package/mysql-proxy/driver.cjs +5 -22
  180. package/mysql-proxy/driver.cjs.map +1 -1
  181. package/mysql-proxy/driver.d.cts +2 -3
  182. package/mysql-proxy/driver.d.ts +2 -3
  183. package/mysql-proxy/driver.js +8 -12
  184. package/mysql-proxy/driver.js.map +1 -1
  185. package/mysql-proxy/migrator.cjs.map +1 -1
  186. package/mysql-proxy/migrator.d.cts +1 -2
  187. package/mysql-proxy/migrator.d.ts +1 -2
  188. package/mysql-proxy/migrator.js.map +1 -1
  189. package/mysql-proxy/session.cjs +2 -47
  190. package/mysql-proxy/session.cjs.map +1 -1
  191. package/mysql-proxy/session.d.cts +8 -13
  192. package/mysql-proxy/session.d.ts +8 -13
  193. package/mysql-proxy/session.js +2 -47
  194. package/mysql-proxy/session.js.map +1 -1
  195. package/mysql2/driver.cjs +7 -24
  196. package/mysql2/driver.cjs.map +1 -1
  197. package/mysql2/driver.d.cts +9 -10
  198. package/mysql2/driver.d.ts +9 -10
  199. package/mysql2/driver.js +10 -14
  200. package/mysql2/driver.js.map +1 -1
  201. package/mysql2/migrator.cjs.map +1 -1
  202. package/mysql2/migrator.d.cts +1 -2
  203. package/mysql2/migrator.d.ts +1 -2
  204. package/mysql2/migrator.js.map +1 -1
  205. package/mysql2/session.cjs +2 -51
  206. package/mysql2/session.cjs.map +1 -1
  207. package/mysql2/session.d.cts +8 -13
  208. package/mysql2/session.d.ts +8 -13
  209. package/mysql2/session.js +2 -51
  210. package/mysql2/session.js.map +1 -1
  211. package/neon-http/driver.cjs +7 -21
  212. package/neon-http/driver.cjs.map +1 -1
  213. package/neon-http/driver.d.cts +9 -10
  214. package/neon-http/driver.d.ts +9 -10
  215. package/neon-http/driver.js +7 -11
  216. package/neon-http/driver.js.map +1 -1
  217. package/neon-http/migrator.cjs.map +1 -1
  218. package/neon-http/migrator.d.cts +1 -2
  219. package/neon-http/migrator.d.ts +1 -2
  220. package/neon-http/migrator.js.map +1 -1
  221. package/neon-http/session.cjs +2 -32
  222. package/neon-http/session.cjs.map +1 -1
  223. package/neon-http/session.d.cts +8 -13
  224. package/neon-http/session.d.ts +8 -13
  225. package/neon-http/session.js +2 -32
  226. package/neon-http/session.js.map +1 -1
  227. package/neon-serverless/driver.cjs +7 -18
  228. package/neon-serverless/driver.cjs.map +1 -1
  229. package/neon-serverless/driver.d.cts +8 -9
  230. package/neon-serverless/driver.d.ts +8 -9
  231. package/neon-serverless/driver.js +10 -8
  232. package/neon-serverless/driver.js.map +1 -1
  233. package/neon-serverless/migrator.cjs.map +1 -1
  234. package/neon-serverless/migrator.d.cts +1 -2
  235. package/neon-serverless/migrator.d.ts +1 -2
  236. package/neon-serverless/migrator.js.map +1 -1
  237. package/neon-serverless/session.cjs +5 -40
  238. package/neon-serverless/session.cjs.map +1 -1
  239. package/neon-serverless/session.d.cts +8 -13
  240. package/neon-serverless/session.d.ts +8 -13
  241. package/neon-serverless/session.js +5 -40
  242. package/neon-serverless/session.js.map +1 -1
  243. package/node-postgres/driver.cjs +7 -13
  244. package/node-postgres/driver.cjs.map +1 -1
  245. package/node-postgres/driver.d.cts +8 -9
  246. package/node-postgres/driver.d.ts +8 -9
  247. package/node-postgres/driver.js +10 -13
  248. package/node-postgres/driver.js.map +1 -1
  249. package/node-postgres/migrator.cjs.map +1 -1
  250. package/node-postgres/migrator.d.cts +1 -2
  251. package/node-postgres/migrator.d.ts +1 -2
  252. package/node-postgres/migrator.js.map +1 -1
  253. package/node-postgres/session.cjs +4 -45
  254. package/node-postgres/session.cjs.map +1 -1
  255. package/node-postgres/session.d.cts +8 -13
  256. package/node-postgres/session.d.ts +8 -13
  257. package/node-postgres/session.js +4 -45
  258. package/node-postgres/session.js.map +1 -1
  259. package/op-sqlite/driver.cjs +5 -22
  260. package/op-sqlite/driver.cjs.map +1 -1
  261. package/op-sqlite/driver.d.cts +2 -3
  262. package/op-sqlite/driver.d.ts +2 -3
  263. package/op-sqlite/driver.js +8 -12
  264. package/op-sqlite/driver.js.map +1 -1
  265. package/op-sqlite/migrator.cjs.map +1 -1
  266. package/op-sqlite/migrator.d.cts +2 -3
  267. package/op-sqlite/migrator.d.ts +2 -3
  268. package/op-sqlite/migrator.js.map +1 -1
  269. package/op-sqlite/session.cjs +4 -47
  270. package/op-sqlite/session.cjs.map +1 -1
  271. package/op-sqlite/session.d.cts +8 -14
  272. package/op-sqlite/session.d.ts +8 -14
  273. package/op-sqlite/session.js +4 -47
  274. package/op-sqlite/session.js.map +1 -1
  275. package/package.json +63 -99
  276. package/pg-core/db.cjs +7 -31
  277. package/pg-core/db.cjs.map +1 -1
  278. package/pg-core/db.d.cts +9 -16
  279. package/pg-core/db.d.ts +9 -16
  280. package/pg-core/db.js +6 -30
  281. package/pg-core/db.js.map +1 -1
  282. package/pg-core/dialect.cjs +488 -152
  283. package/pg-core/dialect.cjs.map +1 -1
  284. package/pg-core/dialect.d.cts +7 -23
  285. package/pg-core/dialect.d.ts +7 -23
  286. package/pg-core/dialect.js +494 -149
  287. package/pg-core/dialect.js.map +1 -1
  288. package/pg-core/query-builders/count.cjs.map +1 -1
  289. package/pg-core/query-builders/count.d.cts +1 -1
  290. package/pg-core/query-builders/count.d.ts +1 -1
  291. package/pg-core/query-builders/count.js.map +1 -1
  292. package/pg-core/query-builders/query.cjs +18 -15
  293. package/pg-core/query-builders/query.cjs.map +1 -1
  294. package/pg-core/query-builders/query.d.cts +6 -6
  295. package/pg-core/query-builders/query.d.ts +6 -6
  296. package/pg-core/query-builders/query.js +18 -15
  297. package/pg-core/query-builders/query.js.map +1 -1
  298. package/pg-core/session.cjs +2 -3
  299. package/pg-core/session.cjs.map +1 -1
  300. package/pg-core/session.d.cts +6 -9
  301. package/pg-core/session.d.ts +6 -9
  302. package/pg-core/session.js +2 -3
  303. package/pg-core/session.js.map +1 -1
  304. package/pg-proxy/driver.cjs +5 -21
  305. package/pg-proxy/driver.cjs.map +1 -1
  306. package/pg-proxy/driver.d.cts +2 -3
  307. package/pg-proxy/driver.d.ts +2 -3
  308. package/pg-proxy/driver.js +8 -11
  309. package/pg-proxy/driver.js.map +1 -1
  310. package/pg-proxy/migrator.cjs.map +1 -1
  311. package/pg-proxy/migrator.d.cts +1 -2
  312. package/pg-proxy/migrator.d.ts +1 -2
  313. package/pg-proxy/migrator.js.map +1 -1
  314. package/pg-proxy/session.cjs +2 -37
  315. package/pg-proxy/session.cjs.map +1 -1
  316. package/pg-proxy/session.d.cts +8 -13
  317. package/pg-proxy/session.d.ts +8 -13
  318. package/pg-proxy/session.js +2 -37
  319. package/pg-proxy/session.js.map +1 -1
  320. package/pglite/driver.cjs +7 -23
  321. package/pglite/driver.cjs.map +1 -1
  322. package/pglite/driver.d.cts +8 -9
  323. package/pglite/driver.d.ts +8 -9
  324. package/pglite/driver.js +10 -13
  325. package/pglite/driver.js.map +1 -1
  326. package/pglite/migrator.cjs.map +1 -1
  327. package/pglite/migrator.d.cts +1 -2
  328. package/pglite/migrator.d.ts +1 -2
  329. package/pglite/migrator.js.map +1 -1
  330. package/pglite/session.cjs +3 -34
  331. package/pglite/session.cjs.map +1 -1
  332. package/pglite/session.d.cts +8 -13
  333. package/pglite/session.d.ts +8 -13
  334. package/pglite/session.js +3 -34
  335. package/pglite/session.js.map +1 -1
  336. package/planetscale-serverless/driver.cjs +5 -22
  337. package/planetscale-serverless/driver.cjs.map +1 -1
  338. package/planetscale-serverless/driver.d.cts +6 -7
  339. package/planetscale-serverless/driver.d.ts +6 -7
  340. package/planetscale-serverless/driver.js +8 -12
  341. package/planetscale-serverless/driver.js.map +1 -1
  342. package/planetscale-serverless/migrator.cjs.map +1 -1
  343. package/planetscale-serverless/migrator.d.cts +1 -2
  344. package/planetscale-serverless/migrator.d.ts +1 -2
  345. package/planetscale-serverless/migrator.js.map +1 -1
  346. package/planetscale-serverless/session.cjs +5 -68
  347. package/planetscale-serverless/session.cjs.map +1 -1
  348. package/planetscale-serverless/session.d.cts +9 -14
  349. package/planetscale-serverless/session.d.ts +9 -14
  350. package/planetscale-serverless/session.js +5 -68
  351. package/planetscale-serverless/session.js.map +1 -1
  352. package/postgres-js/driver.cjs +5 -6
  353. package/postgres-js/driver.cjs.map +1 -1
  354. package/postgres-js/driver.d.cts +6 -7
  355. package/postgres-js/driver.d.ts +6 -7
  356. package/postgres-js/driver.js +8 -6
  357. package/postgres-js/driver.js.map +1 -1
  358. package/postgres-js/migrator.cjs.map +1 -1
  359. package/postgres-js/migrator.d.cts +1 -2
  360. package/postgres-js/migrator.d.ts +1 -2
  361. package/postgres-js/migrator.js.map +1 -1
  362. package/postgres-js/session.cjs +6 -51
  363. package/postgres-js/session.cjs.map +1 -1
  364. package/postgres-js/session.d.cts +9 -15
  365. package/postgres-js/session.d.ts +9 -15
  366. package/postgres-js/session.js +6 -51
  367. package/postgres-js/session.js.map +1 -1
  368. package/prisma/mysql/driver.cjs +1 -1
  369. package/prisma/mysql/driver.cjs.map +1 -1
  370. package/prisma/mysql/driver.js +1 -1
  371. package/prisma/mysql/driver.js.map +1 -1
  372. package/prisma/mysql/session.cjs +0 -3
  373. package/prisma/mysql/session.cjs.map +1 -1
  374. package/prisma/mysql/session.d.cts +1 -3
  375. package/prisma/mysql/session.d.ts +1 -3
  376. package/prisma/mysql/session.js +0 -3
  377. package/prisma/mysql/session.js.map +1 -1
  378. package/prisma/pg/driver.cjs +1 -1
  379. package/prisma/pg/driver.cjs.map +1 -1
  380. package/prisma/pg/driver.js +1 -1
  381. package/prisma/pg/driver.js.map +1 -1
  382. package/prisma/pg/session.cjs +0 -3
  383. package/prisma/pg/session.cjs.map +1 -1
  384. package/prisma/pg/session.d.cts +1 -3
  385. package/prisma/pg/session.d.ts +1 -3
  386. package/prisma/pg/session.js +0 -3
  387. package/prisma/pg/session.js.map +1 -1
  388. package/prisma/sqlite/driver.cjs +1 -1
  389. package/prisma/sqlite/driver.cjs.map +1 -1
  390. package/prisma/sqlite/driver.js +1 -1
  391. package/prisma/sqlite/driver.js.map +1 -1
  392. package/prisma/sqlite/session.cjs +0 -3
  393. package/prisma/sqlite/session.cjs.map +1 -1
  394. package/prisma/sqlite/session.d.cts +2 -4
  395. package/prisma/sqlite/session.d.ts +2 -4
  396. package/prisma/sqlite/session.js +0 -3
  397. package/prisma/sqlite/session.js.map +1 -1
  398. package/relations.cjs +246 -477
  399. package/relations.cjs.map +1 -1
  400. package/relations.d.cts +131 -263
  401. package/relations.d.ts +131 -263
  402. package/relations.js +241 -466
  403. package/relations.js.map +1 -1
  404. package/singlestore/driver.cjs +1 -1
  405. package/singlestore/driver.cjs.map +1 -1
  406. package/singlestore/driver.d.cts +1 -1
  407. package/singlestore/driver.d.ts +1 -1
  408. package/singlestore/driver.js +3 -3
  409. package/singlestore/driver.js.map +1 -1
  410. package/singlestore/session.cjs.map +1 -1
  411. package/singlestore/session.d.cts +4 -4
  412. package/singlestore/session.d.ts +4 -4
  413. package/singlestore/session.js.map +1 -1
  414. package/singlestore-core/columns/all.cjs +2 -0
  415. package/singlestore-core/columns/all.cjs.map +1 -1
  416. package/singlestore-core/columns/all.d.cts +2 -0
  417. package/singlestore-core/columns/all.d.ts +2 -0
  418. package/singlestore-core/columns/all.js +2 -0
  419. package/singlestore-core/columns/all.js.map +1 -1
  420. package/singlestore-core/columns/index.cjs +2 -0
  421. package/singlestore-core/columns/index.cjs.map +1 -1
  422. package/singlestore-core/columns/index.d.cts +1 -0
  423. package/singlestore-core/columns/index.d.ts +1 -0
  424. package/singlestore-core/columns/index.js +1 -0
  425. package/singlestore-core/columns/index.js.map +1 -1
  426. package/singlestore-core/columns/vector.cjs +72 -0
  427. package/singlestore-core/columns/vector.cjs.map +1 -0
  428. package/singlestore-core/columns/vector.d.cts +32 -0
  429. package/singlestore-core/columns/vector.d.ts +32 -0
  430. package/singlestore-core/columns/vector.js +46 -0
  431. package/singlestore-core/columns/vector.js.map +1 -0
  432. package/singlestore-core/db.cjs.map +1 -1
  433. package/singlestore-core/db.d.cts +3 -3
  434. package/singlestore-core/db.d.ts +3 -3
  435. package/singlestore-core/db.js.map +1 -1
  436. package/singlestore-core/dialect.cjs +6 -16
  437. package/singlestore-core/dialect.cjs.map +1 -1
  438. package/singlestore-core/dialect.d.cts +6 -6
  439. package/singlestore-core/dialect.d.ts +6 -6
  440. package/singlestore-core/dialect.js +12 -6
  441. package/singlestore-core/dialect.js.map +1 -1
  442. package/singlestore-core/expressions.cjs +10 -0
  443. package/singlestore-core/expressions.cjs.map +1 -1
  444. package/singlestore-core/expressions.d.cts +2 -0
  445. package/singlestore-core/expressions.d.ts +2 -0
  446. package/singlestore-core/expressions.js +8 -0
  447. package/singlestore-core/expressions.js.map +1 -1
  448. package/singlestore-core/query-builders/query.cjs +2 -12
  449. package/singlestore-core/query-builders/query.cjs.map +1 -1
  450. package/singlestore-core/query-builders/query.d.cts +6 -6
  451. package/singlestore-core/query-builders/query.d.ts +6 -6
  452. package/singlestore-core/query-builders/query.js +4 -2
  453. package/singlestore-core/query-builders/query.js.map +1 -1
  454. package/singlestore-core/session.cjs.map +1 -1
  455. package/singlestore-core/session.d.cts +5 -5
  456. package/singlestore-core/session.d.ts +5 -5
  457. package/singlestore-core/session.js.map +1 -1
  458. package/singlestore-proxy/driver.cjs +1 -1
  459. package/singlestore-proxy/driver.cjs.map +1 -1
  460. package/singlestore-proxy/driver.js +3 -3
  461. package/singlestore-proxy/driver.js.map +1 -1
  462. package/singlestore-proxy/session.cjs.map +1 -1
  463. package/singlestore-proxy/session.d.cts +4 -4
  464. package/singlestore-proxy/session.d.ts +4 -4
  465. package/singlestore-proxy/session.js.map +1 -1
  466. package/sql/sql.cjs.map +1 -1
  467. package/sql/sql.d.cts +8 -8
  468. package/sql/sql.d.ts +8 -8
  469. package/sql/sql.js.map +1 -1
  470. package/sql-js/driver.cjs +5 -16
  471. package/sql-js/driver.cjs.map +1 -1
  472. package/sql-js/driver.d.cts +2 -3
  473. package/sql-js/driver.d.ts +2 -3
  474. package/sql-js/driver.js +8 -6
  475. package/sql-js/driver.js.map +1 -1
  476. package/sql-js/migrator.cjs.map +1 -1
  477. package/sql-js/migrator.d.cts +1 -2
  478. package/sql-js/migrator.d.ts +1 -2
  479. package/sql-js/migrator.js.map +1 -1
  480. package/sql-js/session.cjs +4 -58
  481. package/sql-js/session.cjs.map +1 -1
  482. package/sql-js/session.d.cts +8 -14
  483. package/sql-js/session.d.ts +8 -14
  484. package/sql-js/session.js +4 -58
  485. package/sql-js/session.js.map +1 -1
  486. package/sqlite-core/db.cjs +14 -36
  487. package/sqlite-core/db.cjs.map +1 -1
  488. package/sqlite-core/db.d.cts +8 -15
  489. package/sqlite-core/db.d.ts +8 -15
  490. package/sqlite-core/db.js +13 -35
  491. package/sqlite-core/db.js.map +1 -1
  492. package/sqlite-core/dialect.cjs +7 -171
  493. package/sqlite-core/dialect.cjs.map +1 -1
  494. package/sqlite-core/dialect.d.cts +9 -27
  495. package/sqlite-core/dialect.d.ts +9 -27
  496. package/sqlite-core/dialect.js +13 -168
  497. package/sqlite-core/dialect.js.map +1 -1
  498. package/sqlite-core/query-builders/count.cjs.map +1 -1
  499. package/sqlite-core/query-builders/count.d.cts +1 -1
  500. package/sqlite-core/query-builders/count.d.ts +1 -1
  501. package/sqlite-core/query-builders/count.js.map +1 -1
  502. package/sqlite-core/query-builders/delete.cjs.map +1 -1
  503. package/sqlite-core/query-builders/delete.d.cts +1 -1
  504. package/sqlite-core/query-builders/delete.d.ts +1 -1
  505. package/sqlite-core/query-builders/delete.js.map +1 -1
  506. package/sqlite-core/query-builders/insert.cjs.map +1 -1
  507. package/sqlite-core/query-builders/insert.d.cts +3 -3
  508. package/sqlite-core/query-builders/insert.d.ts +3 -3
  509. package/sqlite-core/query-builders/insert.js.map +1 -1
  510. package/sqlite-core/query-builders/query.cjs +29 -32
  511. package/sqlite-core/query-builders/query.cjs.map +1 -1
  512. package/sqlite-core/query-builders/query.d.cts +16 -15
  513. package/sqlite-core/query-builders/query.d.ts +16 -15
  514. package/sqlite-core/query-builders/query.js +29 -32
  515. package/sqlite-core/query-builders/query.js.map +1 -1
  516. package/sqlite-core/query-builders/select.cjs.map +1 -1
  517. package/sqlite-core/query-builders/select.d.cts +3 -3
  518. package/sqlite-core/query-builders/select.d.ts +3 -3
  519. package/sqlite-core/query-builders/select.js.map +1 -1
  520. package/sqlite-core/query-builders/update.cjs.map +1 -1
  521. package/sqlite-core/query-builders/update.d.cts +3 -3
  522. package/sqlite-core/query-builders/update.d.ts +3 -3
  523. package/sqlite-core/query-builders/update.js.map +1 -1
  524. package/sqlite-core/session.cjs +2 -6
  525. package/sqlite-core/session.cjs.map +1 -1
  526. package/sqlite-core/session.d.cts +6 -14
  527. package/sqlite-core/session.d.ts +6 -14
  528. package/sqlite-core/session.js +2 -6
  529. package/sqlite-core/session.js.map +1 -1
  530. package/sqlite-proxy/driver.cjs +5 -22
  531. package/sqlite-proxy/driver.cjs.map +1 -1
  532. package/sqlite-proxy/driver.d.cts +3 -4
  533. package/sqlite-proxy/driver.d.ts +3 -4
  534. package/sqlite-proxy/driver.js +5 -12
  535. package/sqlite-proxy/driver.js.map +1 -1
  536. package/sqlite-proxy/migrator.cjs.map +1 -1
  537. package/sqlite-proxy/migrator.d.cts +1 -2
  538. package/sqlite-proxy/migrator.d.ts +1 -2
  539. package/sqlite-proxy/migrator.js.map +1 -1
  540. package/sqlite-proxy/session.cjs +4 -47
  541. package/sqlite-proxy/session.cjs.map +1 -1
  542. package/sqlite-proxy/session.d.cts +8 -14
  543. package/sqlite-proxy/session.d.ts +8 -14
  544. package/sqlite-proxy/session.js +4 -47
  545. package/sqlite-proxy/session.js.map +1 -1
  546. package/table.cjs.map +1 -1
  547. package/table.d.cts +1 -1
  548. package/table.d.ts +1 -1
  549. package/table.js.map +1 -1
  550. package/tidb-serverless/driver.cjs +5 -22
  551. package/tidb-serverless/driver.cjs.map +1 -1
  552. package/tidb-serverless/driver.d.cts +6 -7
  553. package/tidb-serverless/driver.d.ts +6 -7
  554. package/tidb-serverless/driver.js +8 -12
  555. package/tidb-serverless/driver.js.map +1 -1
  556. package/tidb-serverless/migrator.cjs.map +1 -1
  557. package/tidb-serverless/migrator.d.cts +1 -2
  558. package/tidb-serverless/migrator.d.ts +1 -2
  559. package/tidb-serverless/migrator.js.map +1 -1
  560. package/tidb-serverless/session.cjs +5 -62
  561. package/tidb-serverless/session.cjs.map +1 -1
  562. package/tidb-serverless/session.d.cts +9 -14
  563. package/tidb-serverless/session.d.ts +9 -14
  564. package/tidb-serverless/session.js +5 -62
  565. package/tidb-serverless/session.js.map +1 -1
  566. package/utils.cjs +2 -2
  567. package/utils.cjs.map +1 -1
  568. package/utils.d.cts +1 -3
  569. package/utils.d.ts +1 -3
  570. package/utils.js +2 -2
  571. package/utils.js.map +1 -1
  572. package/vercel-postgres/driver.cjs +7 -23
  573. package/vercel-postgres/driver.cjs.map +1 -1
  574. package/vercel-postgres/driver.d.cts +8 -9
  575. package/vercel-postgres/driver.d.ts +8 -9
  576. package/vercel-postgres/driver.js +10 -13
  577. package/vercel-postgres/driver.js.map +1 -1
  578. package/vercel-postgres/migrator.cjs.map +1 -1
  579. package/vercel-postgres/migrator.d.cts +1 -2
  580. package/vercel-postgres/migrator.d.ts +1 -2
  581. package/vercel-postgres/migrator.js.map +1 -1
  582. package/vercel-postgres/session.cjs +4 -34
  583. package/vercel-postgres/session.cjs.map +1 -1
  584. package/vercel-postgres/session.d.cts +8 -13
  585. package/vercel-postgres/session.d.ts +8 -13
  586. package/vercel-postgres/session.js +4 -34
  587. package/vercel-postgres/session.js.map +1 -1
  588. package/version.cjs +1 -1
  589. package/version.d.cts +1 -1
  590. package/version.d.ts +1 -1
  591. package/version.js +1 -1
  592. package/xata-http/driver.cjs +5 -17
  593. package/xata-http/driver.cjs.map +1 -1
  594. package/xata-http/driver.d.cts +4 -5
  595. package/xata-http/driver.d.ts +4 -5
  596. package/xata-http/driver.js +5 -7
  597. package/xata-http/driver.js.map +1 -1
  598. package/xata-http/migrator.cjs.map +1 -1
  599. package/xata-http/migrator.d.cts +1 -2
  600. package/xata-http/migrator.d.ts +1 -2
  601. package/xata-http/migrator.js.map +1 -1
  602. package/xata-http/session.cjs +2 -30
  603. package/xata-http/session.cjs.map +1 -1
  604. package/xata-http/session.d.cts +8 -13
  605. package/xata-http/session.d.ts +8 -13
  606. package/xata-http/session.js +2 -30
  607. package/xata-http/session.js.map +1 -1
  608. package/_relations.cjs +0 -328
  609. package/_relations.cjs.map +0 -1
  610. package/_relations.d.cts +0 -215
  611. package/_relations.d.ts +0 -215
  612. package/_relations.js +0 -316
  613. package/_relations.js.map +0 -1
  614. package/mysql-core/query-builders/_query.cjs +0 -149
  615. package/mysql-core/query-builders/_query.cjs.map +0 -1
  616. package/mysql-core/query-builders/_query.d.cts +0 -44
  617. package/mysql-core/query-builders/_query.d.ts +0 -44
  618. package/mysql-core/query-builders/_query.js +0 -114
  619. package/mysql-core/query-builders/_query.js.map +0 -1
  620. package/pg-core/query-builders/_query.cjs +0 -155
  621. package/pg-core/query-builders/_query.cjs.map +0 -1
  622. package/pg-core/query-builders/_query.d.cts +0 -47
  623. package/pg-core/query-builders/_query.d.ts +0 -47
  624. package/pg-core/query-builders/_query.js +0 -120
  625. package/pg-core/query-builders/_query.js.map +0 -1
  626. package/sqlite-core/query-builders/_query.cjs +0 -187
  627. package/sqlite-core/query-builders/_query.cjs.map +0 -1
  628. package/sqlite-core/query-builders/_query.d.cts +0 -55
  629. package/sqlite-core/query-builders/_query.d.ts +0 -55
  630. package/sqlite-core/query-builders/_query.js +0 -151
  631. package/sqlite-core/query-builders/_query.js.map +0 -1
@@ -21,6 +21,7 @@ import { timestamp } from "./timestamp.cjs";
21
21
  import { tinyint } from "./tinyint.cjs";
22
22
  import { varbinary } from "./varbinary.cjs";
23
23
  import { varchar } from "./varchar.cjs";
24
+ import { vector } from "./vector.cjs";
24
25
  import { year } from "./year.cjs";
25
26
  export declare function getSingleStoreColumnBuilders(): {
26
27
  bigint: typeof bigint;
@@ -49,6 +50,7 @@ export declare function getSingleStoreColumnBuilders(): {
49
50
  tinyint: typeof tinyint;
50
51
  varbinary: typeof varbinary;
51
52
  varchar: typeof varchar;
53
+ vector: typeof vector;
52
54
  year: typeof year;
53
55
  };
54
56
  export type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;
@@ -21,6 +21,7 @@ import { timestamp } from "./timestamp.js";
21
21
  import { tinyint } from "./tinyint.js";
22
22
  import { varbinary } from "./varbinary.js";
23
23
  import { varchar } from "./varchar.js";
24
+ import { vector } from "./vector.js";
24
25
  import { year } from "./year.js";
25
26
  export declare function getSingleStoreColumnBuilders(): {
26
27
  bigint: typeof bigint;
@@ -49,6 +50,7 @@ export declare function getSingleStoreColumnBuilders(): {
49
50
  tinyint: typeof tinyint;
50
51
  varbinary: typeof varbinary;
51
52
  varchar: typeof varchar;
53
+ vector: typeof vector;
52
54
  year: typeof year;
53
55
  };
54
56
  export type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;
@@ -21,6 +21,7 @@ import { timestamp } from "./timestamp.js";
21
21
  import { tinyint } from "./tinyint.js";
22
22
  import { varbinary } from "./varbinary.js";
23
23
  import { varchar } from "./varchar.js";
24
+ import { vector } from "./vector.js";
24
25
  import { year } from "./year.js";
25
26
  function getSingleStoreColumnBuilders() {
26
27
  return {
@@ -50,6 +51,7 @@ function getSingleStoreColumnBuilders() {
50
51
  tinyint,
51
52
  varbinary,
52
53
  varchar,
54
+ vector,
53
55
  year
54
56
  };
55
57
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/singlestore-core/columns/all.ts"],"sourcesContent":["import { bigint } from './bigint.ts';\nimport { binary } from './binary.ts';\nimport { boolean } from './boolean.ts';\nimport { char } from './char.ts';\nimport { customType } from './custom.ts';\nimport { date } from './date.ts';\nimport { datetime } from './datetime.ts';\nimport { decimal } from './decimal.ts';\nimport { double } from './double.ts';\nimport { singlestoreEnum } from './enum.ts';\nimport { float } from './float.ts';\nimport { int } from './int.ts';\nimport { json } from './json.ts';\nimport { mediumint } from './mediumint.ts';\nimport { real } from './real.ts';\nimport { serial } from './serial.ts';\nimport { smallint } from './smallint.ts';\nimport { longtext, mediumtext, text, tinytext } from './text.ts';\nimport { time } from './time.ts';\nimport { timestamp } from './timestamp.ts';\nimport { tinyint } from './tinyint.ts';\nimport { varbinary } from './varbinary.ts';\nimport { varchar } from './varchar.ts';\nimport { year } from './year.ts';\n\nexport function getSingleStoreColumnBuilders() {\n\treturn {\n\t\tbigint,\n\t\tbinary,\n\t\tboolean,\n\t\tchar,\n\t\tcustomType,\n\t\tdate,\n\t\tdatetime,\n\t\tdecimal,\n\t\tdouble,\n\t\tsinglestoreEnum,\n\t\tfloat,\n\t\tint,\n\t\tjson,\n\t\tmediumint,\n\t\treal,\n\t\tserial,\n\t\tsmallint,\n\t\tlongtext,\n\t\tmediumtext,\n\t\ttext,\n\t\ttinytext,\n\t\ttime,\n\t\ttimestamp,\n\t\ttinyint,\n\t\tvarbinary,\n\t\tvarchar,\n\t\tyear,\n\t};\n}\n\nexport type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,UAAU,YAAY,MAAM,gBAAgB;AACrD,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,YAAY;AAEd,SAAS,+BAA+B;AAC9C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../../src/singlestore-core/columns/all.ts"],"sourcesContent":["import { bigint } from './bigint.ts';\nimport { binary } from './binary.ts';\nimport { boolean } from './boolean.ts';\nimport { char } from './char.ts';\nimport { customType } from './custom.ts';\nimport { date } from './date.ts';\nimport { datetime } from './datetime.ts';\nimport { decimal } from './decimal.ts';\nimport { double } from './double.ts';\nimport { singlestoreEnum } from './enum.ts';\nimport { float } from './float.ts';\nimport { int } from './int.ts';\nimport { json } from './json.ts';\nimport { mediumint } from './mediumint.ts';\nimport { real } from './real.ts';\nimport { serial } from './serial.ts';\nimport { smallint } from './smallint.ts';\nimport { longtext, mediumtext, text, tinytext } from './text.ts';\nimport { time } from './time.ts';\nimport { timestamp } from './timestamp.ts';\nimport { tinyint } from './tinyint.ts';\nimport { varbinary } from './varbinary.ts';\nimport { varchar } from './varchar.ts';\nimport { vector } from './vector.ts';\nimport { year } from './year.ts';\n\nexport function getSingleStoreColumnBuilders() {\n\treturn {\n\t\tbigint,\n\t\tbinary,\n\t\tboolean,\n\t\tchar,\n\t\tcustomType,\n\t\tdate,\n\t\tdatetime,\n\t\tdecimal,\n\t\tdouble,\n\t\tsinglestoreEnum,\n\t\tfloat,\n\t\tint,\n\t\tjson,\n\t\tmediumint,\n\t\treal,\n\t\tserial,\n\t\tsmallint,\n\t\tlongtext,\n\t\tmediumtext,\n\t\ttext,\n\t\ttinytext,\n\t\ttime,\n\t\ttimestamp,\n\t\ttinyint,\n\t\tvarbinary,\n\t\tvarchar,\n\t\tvector,\n\t\tyear,\n\t};\n}\n\nexport type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,UAAU,YAAY,MAAM,gBAAgB;AACrD,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,YAAY;AAEd,SAAS,+BAA+B;AAC9C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}
@@ -39,6 +39,7 @@ __reExport(columns_exports, require("./timestamp.cjs"), module.exports);
39
39
  __reExport(columns_exports, require("./tinyint.cjs"), module.exports);
40
40
  __reExport(columns_exports, require("./varbinary.cjs"), module.exports);
41
41
  __reExport(columns_exports, require("./varchar.cjs"), module.exports);
42
+ __reExport(columns_exports, require("./vector.cjs"), module.exports);
42
43
  __reExport(columns_exports, require("./year.cjs"), module.exports);
43
44
  // Annotate the CommonJS export names for ESM import in node:
44
45
  0 && (module.exports = {
@@ -66,6 +67,7 @@ __reExport(columns_exports, require("./year.cjs"), module.exports);
66
67
  ...require("./tinyint.cjs"),
67
68
  ...require("./varbinary.cjs"),
68
69
  ...require("./varchar.cjs"),
70
+ ...require("./vector.cjs"),
69
71
  ...require("./year.cjs")
70
72
  });
71
73
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/singlestore-core/columns/index.ts"],"sourcesContent":["export * from './bigint.ts';\nexport * from './binary.ts';\nexport * from './boolean.ts';\nexport * from './char.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './date.ts';\nexport * from './datetime.ts';\nexport * from './decimal.ts';\nexport * from './double.ts';\nexport * from './enum.ts';\nexport * from './float.ts';\nexport * from './int.ts';\nexport * from './json.ts';\nexport * from './mediumint.ts';\nexport * from './real.ts';\nexport * from './serial.ts';\nexport * from './smallint.ts';\nexport * from './text.ts';\nexport * from './time.ts';\nexport * from './timestamp.ts';\nexport * from './tinyint.ts';\nexport * from './varbinary.ts';\nexport * from './varchar.ts';\nexport * from './year.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,wBAAd;AACA,4BAAc,wBADd;AAEA,4BAAc,yBAFd;AAGA,4BAAc,sBAHd;AAIA,4BAAc,wBAJd;AAKA,4BAAc,wBALd;AAMA,4BAAc,sBANd;AAOA,4BAAc,0BAPd;AAQA,4BAAc,yBARd;AASA,4BAAc,wBATd;AAUA,4BAAc,sBAVd;AAWA,4BAAc,uBAXd;AAYA,4BAAc,qBAZd;AAaA,4BAAc,sBAbd;AAcA,4BAAc,2BAdd;AAeA,4BAAc,sBAfd;AAgBA,4BAAc,wBAhBd;AAiBA,4BAAc,0BAjBd;AAkBA,4BAAc,sBAlBd;AAmBA,4BAAc,sBAnBd;AAoBA,4BAAc,2BApBd;AAqBA,4BAAc,yBArBd;AAsBA,4BAAc,2BAtBd;AAuBA,4BAAc,yBAvBd;AAwBA,4BAAc,sBAxBd;","names":[]}
1
+ {"version":3,"sources":["../../../src/singlestore-core/columns/index.ts"],"sourcesContent":["export * from './bigint.ts';\nexport * from './binary.ts';\nexport * from './boolean.ts';\nexport * from './char.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './date.ts';\nexport * from './datetime.ts';\nexport * from './decimal.ts';\nexport * from './double.ts';\nexport * from './enum.ts';\nexport * from './float.ts';\nexport * from './int.ts';\nexport * from './json.ts';\nexport * from './mediumint.ts';\nexport * from './real.ts';\nexport * from './serial.ts';\nexport * from './smallint.ts';\nexport * from './text.ts';\nexport * from './time.ts';\nexport * from './timestamp.ts';\nexport * from './tinyint.ts';\nexport * from './varbinary.ts';\nexport * from './varchar.ts';\nexport * from './vector.ts';\nexport * from './year.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,wBAAd;AACA,4BAAc,wBADd;AAEA,4BAAc,yBAFd;AAGA,4BAAc,sBAHd;AAIA,4BAAc,wBAJd;AAKA,4BAAc,wBALd;AAMA,4BAAc,sBANd;AAOA,4BAAc,0BAPd;AAQA,4BAAc,yBARd;AASA,4BAAc,wBATd;AAUA,4BAAc,sBAVd;AAWA,4BAAc,uBAXd;AAYA,4BAAc,qBAZd;AAaA,4BAAc,sBAbd;AAcA,4BAAc,2BAdd;AAeA,4BAAc,sBAfd;AAgBA,4BAAc,wBAhBd;AAiBA,4BAAc,0BAjBd;AAkBA,4BAAc,sBAlBd;AAmBA,4BAAc,sBAnBd;AAoBA,4BAAc,2BApBd;AAqBA,4BAAc,yBArBd;AAsBA,4BAAc,2BAtBd;AAuBA,4BAAc,yBAvBd;AAwBA,4BAAc,wBAxBd;AAyBA,4BAAc,sBAzBd;","names":[]}
@@ -22,4 +22,5 @@ export * from "./timestamp.cjs";
22
22
  export * from "./tinyint.cjs";
23
23
  export * from "./varbinary.cjs";
24
24
  export * from "./varchar.cjs";
25
+ export * from "./vector.cjs";
25
26
  export * from "./year.cjs";
@@ -22,4 +22,5 @@ export * from "./timestamp.js";
22
22
  export * from "./tinyint.js";
23
23
  export * from "./varbinary.js";
24
24
  export * from "./varchar.js";
25
+ export * from "./vector.js";
25
26
  export * from "./year.js";
@@ -22,5 +22,6 @@ export * from "./timestamp.js";
22
22
  export * from "./tinyint.js";
23
23
  export * from "./varbinary.js";
24
24
  export * from "./varchar.js";
25
+ export * from "./vector.js";
25
26
  export * from "./year.js";
26
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/singlestore-core/columns/index.ts"],"sourcesContent":["export * from './bigint.ts';\nexport * from './binary.ts';\nexport * from './boolean.ts';\nexport * from './char.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './date.ts';\nexport * from './datetime.ts';\nexport * from './decimal.ts';\nexport * from './double.ts';\nexport * from './enum.ts';\nexport * from './float.ts';\nexport * from './int.ts';\nexport * from './json.ts';\nexport * from './mediumint.ts';\nexport * from './real.ts';\nexport * from './serial.ts';\nexport * from './smallint.ts';\nexport * from './text.ts';\nexport * from './time.ts';\nexport * from './timestamp.ts';\nexport * from './tinyint.ts';\nexport * from './varbinary.ts';\nexport * from './varchar.ts';\nexport * from './year.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
1
+ {"version":3,"sources":["../../../src/singlestore-core/columns/index.ts"],"sourcesContent":["export * from './bigint.ts';\nexport * from './binary.ts';\nexport * from './boolean.ts';\nexport * from './char.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './date.ts';\nexport * from './datetime.ts';\nexport * from './decimal.ts';\nexport * from './double.ts';\nexport * from './enum.ts';\nexport * from './float.ts';\nexport * from './int.ts';\nexport * from './json.ts';\nexport * from './mediumint.ts';\nexport * from './real.ts';\nexport * from './serial.ts';\nexport * from './smallint.ts';\nexport * from './text.ts';\nexport * from './time.ts';\nexport * from './timestamp.ts';\nexport * from './tinyint.ts';\nexport * from './varbinary.ts';\nexport * from './varchar.ts';\nexport * from './vector.ts';\nexport * from './year.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var vector_exports = {};
20
+ __export(vector_exports, {
21
+ SingleStoreVector: () => SingleStoreVector,
22
+ SingleStoreVectorBuilder: () => SingleStoreVectorBuilder,
23
+ vector: () => vector
24
+ });
25
+ module.exports = __toCommonJS(vector_exports);
26
+ var import_entity = require("../../entity.cjs");
27
+ var import_utils = require("../../utils.cjs");
28
+ var import_common = require("./common.cjs");
29
+ class SingleStoreVectorBuilder extends import_common.SingleStoreColumnBuilder {
30
+ static [import_entity.entityKind] = "SingleStoreVectorBuilder";
31
+ constructor(name, config) {
32
+ super(name, "array", "SingleStoreVector");
33
+ this.config.dimensions = config.dimensions;
34
+ this.config.elementType = config.elementType;
35
+ }
36
+ /** @internal */
37
+ build(table) {
38
+ return new SingleStoreVector(
39
+ table,
40
+ this.config
41
+ );
42
+ }
43
+ /** @internal */
44
+ generatedAlwaysAs(as, config) {
45
+ throw new Error("not implemented");
46
+ }
47
+ }
48
+ class SingleStoreVector extends import_common.SingleStoreColumn {
49
+ static [import_entity.entityKind] = "SingleStoreVector";
50
+ dimensions = this.config.dimensions;
51
+ elementType = this.config.elementType;
52
+ getSQLType() {
53
+ return `vector(${this.dimensions}, ${this.elementType || "F32"})`;
54
+ }
55
+ mapToDriverValue(value) {
56
+ return JSON.stringify(value);
57
+ }
58
+ mapFromDriverValue(value) {
59
+ return JSON.parse(value);
60
+ }
61
+ }
62
+ function vector(a, b) {
63
+ const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
64
+ return new SingleStoreVectorBuilder(name, config);
65
+ }
66
+ // Annotate the CommonJS export names for ESM import in node:
67
+ 0 && (module.exports = {
68
+ SingleStoreVector,
69
+ SingleStoreVectorBuilder,
70
+ vector
71
+ });
72
+ //# sourceMappingURL=vector.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/singlestore-core/columns/vector.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { SQL } from '~/sql/index.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder, SingleStoreGeneratedColumnConfig } from './common.ts';\n\nexport type SingleStoreVectorBuilderInitial<TName extends string> = SingleStoreVectorBuilder<{\n\tname: TName;\n\tdataType: 'array';\n\tcolumnType: 'SingleStoreVector';\n\tdata: Array<number>;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class SingleStoreVectorBuilder<T extends ColumnBuilderBaseConfig<'array', 'SingleStoreVector'>>\n\textends SingleStoreColumnBuilder<T, SingleStoreVectorConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreVectorBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreVectorConfig) {\n\t\tsuper(name, 'array', 'SingleStoreVector');\n\t\tthis.config.dimensions = config.dimensions;\n\t\tthis.config.elementType = config.elementType;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreVector<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreVector<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n\n\t/** @internal */\n\toverride generatedAlwaysAs(as: SQL<unknown> | (() => SQL) | T['data'], config?: SingleStoreGeneratedColumnConfig) {\n\t\tthrow new Error('not implemented');\n\t}\n}\n\nexport class SingleStoreVector<T extends ColumnBaseConfig<'array', 'SingleStoreVector'>>\n\textends SingleStoreColumn<T, SingleStoreVectorConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreVector';\n\n\tdimensions: number = this.config.dimensions;\n\telementType: ElementType | undefined = this.config.elementType;\n\n\tgetSQLType(): string {\n\t\treturn `vector(${this.dimensions}, ${this.elementType || 'F32'})`;\n\t}\n\n\toverride mapToDriverValue(value: Array<number>) {\n\t\treturn JSON.stringify(value);\n\t}\n\n\toverride mapFromDriverValue(value: string): Array<number> {\n\t\treturn JSON.parse(value);\n\t}\n}\n\ntype ElementType = 'I8' | 'I16' | 'I32' | 'I64' | 'F32' | 'F64';\n\nexport interface SingleStoreVectorConfig {\n\tdimensions: number;\n\telementType?: ElementType;\n}\n\nexport function vector(\n\tconfig: SingleStoreVectorConfig,\n): SingleStoreVectorBuilderInitial<''>;\nexport function vector<TName extends string>(\n\tname: TName,\n\tconfig: SingleStoreVectorConfig,\n): SingleStoreVectorBuilderInitial<TName>;\nexport function vector(a: string | SingleStoreVectorConfig, b?: SingleStoreVectorConfig) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreVectorConfig>(a, b);\n\treturn new SingleStoreVectorBuilder(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAG3B,mBAAuC;AACvC,oBAA8F;AAWvF,MAAM,iCACJ,uCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAiC;AAC7D,UAAM,MAAM,SAAS,mBAAmB;AACxC,SAAK,OAAO,aAAa,OAAO;AAChC,SAAK,OAAO,cAAc,OAAO;AAAA,EAClC;AAAA;AAAA,EAGS,MACR,OACqD;AACrD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AAAA;AAAA,EAGS,kBAAkB,IAA4C,QAA2C;AACjH,UAAM,IAAI,MAAM,iBAAiB;AAAA,EAClC;AACD;AAEO,MAAM,0BACJ,gCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAqB,KAAK,OAAO;AAAA,EACjC,cAAuC,KAAK,OAAO;AAAA,EAEnD,aAAqB;AACpB,WAAO,UAAU,KAAK,UAAU,KAAK,KAAK,eAAe,KAAK;AAAA,EAC/D;AAAA,EAES,iBAAiB,OAAsB;AAC/C,WAAO,KAAK,UAAU,KAAK;AAAA,EAC5B;AAAA,EAES,mBAAmB,OAA8B;AACzD,WAAO,KAAK,MAAM,KAAK;AAAA,EACxB;AACD;AAgBO,SAAS,OAAO,GAAqC,GAA6B;AACxF,QAAM,EAAE,MAAM,OAAO,QAAI,qCAAgD,GAAG,CAAC;AAC7E,SAAO,IAAI,yBAAyB,MAAM,MAAM;AACjD;","names":[]}
@@ -0,0 +1,32 @@
1
+ import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
2
+ import type { ColumnBaseConfig } from "../../column.cjs";
3
+ import { entityKind } from "../../entity.cjs";
4
+ import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
5
+ export type SingleStoreVectorBuilderInitial<TName extends string> = SingleStoreVectorBuilder<{
6
+ name: TName;
7
+ dataType: 'array';
8
+ columnType: 'SingleStoreVector';
9
+ data: Array<number>;
10
+ driverParam: string;
11
+ enumValues: undefined;
12
+ }>;
13
+ export declare class SingleStoreVectorBuilder<T extends ColumnBuilderBaseConfig<'array', 'SingleStoreVector'>> extends SingleStoreColumnBuilder<T, SingleStoreVectorConfig> {
14
+ static readonly [entityKind]: string;
15
+ constructor(name: T['name'], config: SingleStoreVectorConfig);
16
+ }
17
+ export declare class SingleStoreVector<T extends ColumnBaseConfig<'array', 'SingleStoreVector'>> extends SingleStoreColumn<T, SingleStoreVectorConfig> {
18
+ static readonly [entityKind]: string;
19
+ dimensions: number;
20
+ elementType: ElementType | undefined;
21
+ getSQLType(): string;
22
+ mapToDriverValue(value: Array<number>): string;
23
+ mapFromDriverValue(value: string): Array<number>;
24
+ }
25
+ type ElementType = 'I8' | 'I16' | 'I32' | 'I64' | 'F32' | 'F64';
26
+ export interface SingleStoreVectorConfig {
27
+ dimensions: number;
28
+ elementType?: ElementType;
29
+ }
30
+ export declare function vector(config: SingleStoreVectorConfig): SingleStoreVectorBuilderInitial<''>;
31
+ export declare function vector<TName extends string>(name: TName, config: SingleStoreVectorConfig): SingleStoreVectorBuilderInitial<TName>;
32
+ export {};
@@ -0,0 +1,32 @@
1
+ import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
2
+ import type { ColumnBaseConfig } from "../../column.js";
3
+ import { entityKind } from "../../entity.js";
4
+ import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
5
+ export type SingleStoreVectorBuilderInitial<TName extends string> = SingleStoreVectorBuilder<{
6
+ name: TName;
7
+ dataType: 'array';
8
+ columnType: 'SingleStoreVector';
9
+ data: Array<number>;
10
+ driverParam: string;
11
+ enumValues: undefined;
12
+ }>;
13
+ export declare class SingleStoreVectorBuilder<T extends ColumnBuilderBaseConfig<'array', 'SingleStoreVector'>> extends SingleStoreColumnBuilder<T, SingleStoreVectorConfig> {
14
+ static readonly [entityKind]: string;
15
+ constructor(name: T['name'], config: SingleStoreVectorConfig);
16
+ }
17
+ export declare class SingleStoreVector<T extends ColumnBaseConfig<'array', 'SingleStoreVector'>> extends SingleStoreColumn<T, SingleStoreVectorConfig> {
18
+ static readonly [entityKind]: string;
19
+ dimensions: number;
20
+ elementType: ElementType | undefined;
21
+ getSQLType(): string;
22
+ mapToDriverValue(value: Array<number>): string;
23
+ mapFromDriverValue(value: string): Array<number>;
24
+ }
25
+ type ElementType = 'I8' | 'I16' | 'I32' | 'I64' | 'F32' | 'F64';
26
+ export interface SingleStoreVectorConfig {
27
+ dimensions: number;
28
+ elementType?: ElementType;
29
+ }
30
+ export declare function vector(config: SingleStoreVectorConfig): SingleStoreVectorBuilderInitial<''>;
31
+ export declare function vector<TName extends string>(name: TName, config: SingleStoreVectorConfig): SingleStoreVectorBuilderInitial<TName>;
32
+ export {};
@@ -0,0 +1,46 @@
1
+ import { entityKind } from "../../entity.js";
2
+ import { getColumnNameAndConfig } from "../../utils.js";
3
+ import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
4
+ class SingleStoreVectorBuilder extends SingleStoreColumnBuilder {
5
+ static [entityKind] = "SingleStoreVectorBuilder";
6
+ constructor(name, config) {
7
+ super(name, "array", "SingleStoreVector");
8
+ this.config.dimensions = config.dimensions;
9
+ this.config.elementType = config.elementType;
10
+ }
11
+ /** @internal */
12
+ build(table) {
13
+ return new SingleStoreVector(
14
+ table,
15
+ this.config
16
+ );
17
+ }
18
+ /** @internal */
19
+ generatedAlwaysAs(as, config) {
20
+ throw new Error("not implemented");
21
+ }
22
+ }
23
+ class SingleStoreVector extends SingleStoreColumn {
24
+ static [entityKind] = "SingleStoreVector";
25
+ dimensions = this.config.dimensions;
26
+ elementType = this.config.elementType;
27
+ getSQLType() {
28
+ return `vector(${this.dimensions}, ${this.elementType || "F32"})`;
29
+ }
30
+ mapToDriverValue(value) {
31
+ return JSON.stringify(value);
32
+ }
33
+ mapFromDriverValue(value) {
34
+ return JSON.parse(value);
35
+ }
36
+ }
37
+ function vector(a, b) {
38
+ const { name, config } = getColumnNameAndConfig(a, b);
39
+ return new SingleStoreVectorBuilder(name, config);
40
+ }
41
+ export {
42
+ SingleStoreVector,
43
+ SingleStoreVectorBuilder,
44
+ vector
45
+ };
46
+ //# sourceMappingURL=vector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/singlestore-core/columns/vector.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { SQL } from '~/sql/index.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder, SingleStoreGeneratedColumnConfig } from './common.ts';\n\nexport type SingleStoreVectorBuilderInitial<TName extends string> = SingleStoreVectorBuilder<{\n\tname: TName;\n\tdataType: 'array';\n\tcolumnType: 'SingleStoreVector';\n\tdata: Array<number>;\n\tdriverParam: string;\n\tenumValues: undefined;\n}>;\n\nexport class SingleStoreVectorBuilder<T extends ColumnBuilderBaseConfig<'array', 'SingleStoreVector'>>\n\textends SingleStoreColumnBuilder<T, SingleStoreVectorConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreVectorBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreVectorConfig) {\n\t\tsuper(name, 'array', 'SingleStoreVector');\n\t\tthis.config.dimensions = config.dimensions;\n\t\tthis.config.elementType = config.elementType;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreVector<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreVector<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n\n\t/** @internal */\n\toverride generatedAlwaysAs(as: SQL<unknown> | (() => SQL) | T['data'], config?: SingleStoreGeneratedColumnConfig) {\n\t\tthrow new Error('not implemented');\n\t}\n}\n\nexport class SingleStoreVector<T extends ColumnBaseConfig<'array', 'SingleStoreVector'>>\n\textends SingleStoreColumn<T, SingleStoreVectorConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreVector';\n\n\tdimensions: number = this.config.dimensions;\n\telementType: ElementType | undefined = this.config.elementType;\n\n\tgetSQLType(): string {\n\t\treturn `vector(${this.dimensions}, ${this.elementType || 'F32'})`;\n\t}\n\n\toverride mapToDriverValue(value: Array<number>) {\n\t\treturn JSON.stringify(value);\n\t}\n\n\toverride mapFromDriverValue(value: string): Array<number> {\n\t\treturn JSON.parse(value);\n\t}\n}\n\ntype ElementType = 'I8' | 'I16' | 'I32' | 'I64' | 'F32' | 'F64';\n\nexport interface SingleStoreVectorConfig {\n\tdimensions: number;\n\telementType?: ElementType;\n}\n\nexport function vector(\n\tconfig: SingleStoreVectorConfig,\n): SingleStoreVectorBuilderInitial<''>;\nexport function vector<TName extends string>(\n\tname: TName,\n\tconfig: SingleStoreVectorConfig,\n): SingleStoreVectorBuilderInitial<TName>;\nexport function vector(a: string | SingleStoreVectorConfig, b?: SingleStoreVectorConfig) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreVectorConfig>(a, b);\n\treturn new SingleStoreVectorBuilder(name, config);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAG3B,SAAS,8BAA8B;AACvC,SAAS,mBAAmB,gCAAkE;AAWvF,MAAM,iCACJ,yBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAiC;AAC7D,UAAM,MAAM,SAAS,mBAAmB;AACxC,SAAK,OAAO,aAAa,OAAO;AAChC,SAAK,OAAO,cAAc,OAAO;AAAA,EAClC;AAAA;AAAA,EAGS,MACR,OACqD;AACrD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AAAA;AAAA,EAGS,kBAAkB,IAA4C,QAA2C;AACjH,UAAM,IAAI,MAAM,iBAAiB;AAAA,EAClC;AACD;AAEO,MAAM,0BACJ,kBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAqB,KAAK,OAAO;AAAA,EACjC,cAAuC,KAAK,OAAO;AAAA,EAEnD,aAAqB;AACpB,WAAO,UAAU,KAAK,UAAU,KAAK,KAAK,eAAe,KAAK;AAAA,EAC/D;AAAA,EAES,iBAAiB,OAAsB;AAC/C,WAAO,KAAK,UAAU,KAAK;AAAA,EAC5B;AAAA,EAES,mBAAmB,OAA8B;AACzD,WAAO,KAAK,MAAM,KAAK;AAAA,EACxB;AACD;AAgBO,SAAS,OAAO,GAAqC,GAA6B;AACxF,QAAM,EAAE,MAAM,OAAO,IAAI,uBAAgD,GAAG,CAAC;AAC7E,SAAO,IAAI,yBAAyB,MAAM,MAAM;AACjD;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/singlestore-core/db.ts"],"sourcesContent":["import type { ResultSetHeader } from 'mysql2/promise';\nimport type * as V1 from '~/_relations.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport type { SingleStoreDriverDatabase } from '~/singlestore/driver.ts';\nimport { type ColumnsSelection, type SQL, sql, type SQLWrapper } from '~/sql/sql.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport type { SingleStoreDialect } from './dialect.ts';\nimport { SingleStoreCountBuilder } from './query-builders/count.ts';\nimport {\n\tQueryBuilder,\n\tSingleStoreDeleteBase,\n\tSingleStoreInsertBuilder,\n\tSingleStoreSelectBuilder,\n\tSingleStoreUpdateBuilder,\n} from './query-builders/index.ts';\nimport type { SelectedFields } from './query-builders/select.types.ts';\nimport type {\n\tPreparedQueryHKTBase,\n\tSingleStoreQueryResultHKT,\n\tSingleStoreQueryResultKind,\n\tSingleStoreSession,\n\tSingleStoreTransaction,\n\tSingleStoreTransactionConfig,\n} from './session.ts';\nimport type { WithSubqueryWithSelection } from './subquery.ts';\nimport type { SingleStoreTable } from './table.ts';\n\nexport class SingleStoreDatabase<\n\tTQueryResult extends SingleStoreQueryResultHKT,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n\tTFullSchema extends Record<string, unknown> = {},\n\tTSchema extends V1.TablesRelationalConfig = V1.ExtractTablesWithRelations<TFullSchema>,\n> {\n\tstatic readonly [entityKind]: string = 'SingleStoreDatabase';\n\n\tdeclare readonly _: {\n\t\treadonly schema: TSchema | undefined;\n\t\treadonly fullSchema: TFullSchema;\n\t\treadonly tableNamesMap: Record<string, string>;\n\t};\n\n\t// We are waiting for SingleStore support for `json_array` function\n\t/**@inrernal */\n\tquery: unknown;\n\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly dialect: SingleStoreDialect,\n\t\t/** @internal */\n\t\treadonly session: SingleStoreSession<any, any, any, any>,\n\t\tschema: V1.RelationalSchemaConfig<TSchema> | undefined,\n\t) {\n\t\tthis._ = schema\n\t\t\t? {\n\t\t\t\tschema: schema.schema,\n\t\t\t\tfullSchema: schema.fullSchema as TFullSchema,\n\t\t\t\ttableNamesMap: schema.tableNamesMap,\n\t\t\t}\n\t\t\t: {\n\t\t\t\tschema: undefined,\n\t\t\t\tfullSchema: {} as TFullSchema,\n\t\t\t\ttableNamesMap: {},\n\t\t\t};\n\t\tthis.query = {} as typeof this['query'];\n\t\t// this.queryNotSupported = true;\n\t\t// if (this._.schema) {\n\t\t// \tfor (const [tableName, columns] of Object.entries(this._.schema)) {\n\t\t// \t\t(this.query as SingleStoreDatabase<TQueryResult, TPreparedQueryHKT, Record<string, any>>['query'])[tableName] =\n\t\t// \t\t\tnew RelationalQueryBuilder(\n\t\t// \t\t\t\tschema!.fullSchema,\n\t\t// \t\t\t\tthis._.schema,\n\t\t// \t\t\t\tthis._.tableNamesMap,\n\t\t// \t\t\t\tschema!.fullSchema[tableName] as SingleStoreTable,\n\t\t// \t\t\t\tcolumns,\n\t\t// \t\t\t\tdialect,\n\t\t// \t\t\t\tsession,\n\t\t// \t\t\t);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t/**\n\t * Creates a subquery that defines a temporary named result set as a CTE.\n\t *\n\t * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param alias The alias for the subquery.\n\t *\n\t * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Create a subquery with alias 'sq' and use it in the select query\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t *\n\t * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them:\n\t *\n\t * ```ts\n\t * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query\n\t * const sq = db.$with('sq').as(db.select({\n\t * name: sql<string>`upper(${users.name})`.as('name'),\n\t * })\n\t * .from(users));\n\t *\n\t * const result = await db.with(sq).select({ name: sq.name }).from(sq);\n\t * ```\n\t */\n\t$with<TAlias extends string>(alias: TAlias) {\n\t\tconst self = this;\n\t\treturn {\n\t\t\tas<TSelection extends ColumnsSelection>(\n\t\t\t\tqb: TypedQueryBuilder<TSelection> | ((qb: QueryBuilder) => TypedQueryBuilder<TSelection>),\n\t\t\t): WithSubqueryWithSelection<TSelection, TAlias> {\n\t\t\t\tif (typeof qb === 'function') {\n\t\t\t\t\tqb = qb(new QueryBuilder(self.dialect));\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy(\n\t\t\t\t\tnew WithSubquery(qb.getSQL(), qb.getSelectedFields() as SelectedFields, alias, true),\n\t\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t\t) as WithSubqueryWithSelection<TSelection, TAlias>;\n\t\t\t},\n\t\t};\n\t}\n\n\t$count(\n\t\tsource: SingleStoreTable | SQL | SQLWrapper, // SingleStoreViewBase |\n\t\tfilters?: SQL<unknown>,\n\t) {\n\t\treturn new SingleStoreCountBuilder({ source, filters, session: this.session });\n\t}\n\n\t/**\n\t * Incorporates a previously defined CTE (using `$with`) into the main query.\n\t *\n\t * This method allows the main query to reference a temporary named result set.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param queries The CTEs to incorporate into the main query.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Define a subquery 'sq' as a CTE using $with\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * // Incorporate the CTE 'sq' into the main query and select from it\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t */\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\t/**\n\t\t * Creates a select query.\n\t\t *\n\t\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all columns and all rows from the 'cars' table\n\t\t * const allCars: Car[] = await db.select().from(cars);\n\t\t *\n\t\t * // Select specific columns and all rows from the 'cars' table\n\t\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * brand: cars.brand\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t *\n\t\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t\t *\n\t\t * ```ts\n\t\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t */\n\t\tfunction select(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction select(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct` expression to the select query.\n\t\t *\n\t\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select all unique rows from the 'cars' table\n\t\t * await db.selectDistinct()\n\t\t * .from(cars)\n\t\t * .orderBy(cars.id, cars.brand, cars.color);\n\t\t *\n\t\t * // Select all unique brands from the 'cars' table\n\t\t * await db.selectDistinct({ brand: cars.brand })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction selectDistinct(\n\t\t\tfields?: SelectedFields,\n\t\t): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Creates an update query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t\t *\n\t\t * Use `.set()` method to specify which values to update.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t\t *\n\t\t * @param table The table to update.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Update all rows in the 'cars' table\n\t\t * await db.update(cars).set({ color: 'red' });\n\t\t *\n\t\t * // Update rows with filters and conditions\n\t\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t\t * ```\n\t\t */\n\t\tfunction update<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreUpdateBuilder(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\t/**\n\t\t * Creates a delete query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t\t *\n\t\t * @param table The table to delete from.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Delete all rows in the 'cars' table\n\t\t * await db.delete(cars);\n\t\t *\n\t\t * // Delete rows with filters and conditions\n\t\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t\t * ```\n\t\t */\n\t\tfunction delete_<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreDeleteBase(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\treturn { select, selectDistinct, update, delete: delete_ };\n\t}\n\n\t/**\n\t * Creates a select query.\n\t *\n\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all columns and all rows from the 'cars' table\n\t * const allCars: Car[] = await db.select().from(cars);\n\t *\n\t * // Select specific columns and all rows from the 'cars' table\n\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t * id: cars.id,\n\t * brand: cars.brand\n\t * })\n\t * .from(cars);\n\t * ```\n\t *\n\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t *\n\t * ```ts\n\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t * id: cars.id,\n\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t * })\n\t * .from(cars);\n\t * ```\n\t */\n\tselect(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselect<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselect(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({ fields: fields ?? undefined, session: this.session, dialect: this.dialect });\n\t}\n\n\t/**\n\t * Adds `distinct` expression to the select query.\n\t *\n\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select all unique rows from the 'cars' table\n\t * await db.selectDistinct()\n\t * .from(cars)\n\t * .orderBy(cars.id, cars.brand, cars.color);\n\t *\n\t * // Select all unique brands from the 'cars' table\n\t * await db.selectDistinct({ brand: cars.brand })\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t * ```\n\t */\n\tselectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselectDistinct<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselectDistinct(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t/**\n\t * Creates an update query.\n\t *\n\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t *\n\t * Use `.set()` method to specify which values to update.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param table The table to update.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Update all rows in the 'cars' table\n\t * await db.update(cars).set({ color: 'red' });\n\t *\n\t * // Update rows with filters and conditions\n\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t * ```\n\t */\n\tupdate<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreUpdateBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates an insert query.\n\t *\n\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t *\n\t * @param table The table to insert into.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Insert one row\n\t * await db.insert(cars).values({ brand: 'BMW' });\n\t *\n\t * // Insert multiple rows\n\t * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t * ```\n\t */\n\tinsert<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreInsertBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreInsertBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates a delete query.\n\t *\n\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param table The table to delete from.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Delete all rows in the 'cars' table\n\t * await db.delete(cars);\n\t *\n\t * // Delete rows with filters and conditions\n\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t * ```\n\t */\n\tdelete<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreDeleteBase(table, this.session, this.dialect);\n\t}\n\n\texecute<T extends { [column: string]: any } = ResultSetHeader>(\n\t\tquery: SQLWrapper | string,\n\t): Promise<SingleStoreQueryResultKind<TQueryResult, T>> {\n\t\treturn this.session.execute(typeof query === 'string' ? sql.raw(query) : query.getSQL());\n\t}\n\n\ttransaction<T>(\n\t\ttransaction: (\n\t\t\ttx: SingleStoreTransaction<TQueryResult, TPreparedQueryHKT, TFullSchema, TSchema>,\n\t\t\tconfig?: SingleStoreTransactionConfig,\n\t\t) => Promise<T>,\n\t\tconfig?: SingleStoreTransactionConfig,\n\t): Promise<T> {\n\t\treturn this.session.transaction(transaction, config);\n\t}\n}\n\nexport type SingleStoreWithReplicas<Q> = Q & { $primary: Q };\n\nexport const withReplicas = <\n\tQ extends SingleStoreDriverDatabase,\n>(\n\tprimary: Q,\n\treplicas: [Q, ...Q[]],\n\tgetReplica: (replicas: Q[]) => Q = () => replicas[Math.floor(Math.random() * replicas.length)]!,\n): SingleStoreWithReplicas<Q> => {\n\tconst select: Q['select'] = (...args: []) => getReplica(replicas).select(...args);\n\tconst selectDistinct: Q['selectDistinct'] = (...args: []) => getReplica(replicas).selectDistinct(...args);\n\tconst $with: Q['with'] = (...args: []) => getReplica(replicas).with(...args);\n\n\tconst update: Q['update'] = (...args: [any]) => primary.update(...args);\n\tconst insert: Q['insert'] = (...args: [any]) => primary.insert(...args);\n\tconst $delete: Q['delete'] = (...args: [any]) => primary.delete(...args);\n\tconst execute: Q['execute'] = (...args: [any]) => primary.execute(...args);\n\tconst transaction: Q['transaction'] = (...args: [any, any]) => primary.transaction(...args);\n\n\treturn {\n\t\t...primary,\n\t\tupdate,\n\t\tinsert,\n\t\tdelete: $delete,\n\t\texecute,\n\t\ttransaction,\n\t\t$primary: primary,\n\t\tselect,\n\t\tselectDistinct,\n\t\twith: $with,\n\t\tget query() {\n\t\t\treturn getReplica(replicas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;AACzE,QAAM,cAAgC,IAAI,SAAqB,QAAQ,YAAY,GAAG,IAAI;AAE1F,SAAO;AAAA,IACN,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,IAAI,QAAQ;AACX,aAAO,WAAW,QAAQ,EAAE;AAAA,IAC7B;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../src/singlestore-core/db.ts"],"sourcesContent":["import type { ResultSetHeader } from 'mysql2/promise';\nimport { entityKind } from '~/entity.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport type { SingleStoreDriverDatabase } from '~/singlestore/driver.ts';\nimport { type ColumnsSelection, type SQL, sql, type SQLWrapper } from '~/sql/sql.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport type { SingleStoreDialect } from './dialect.ts';\nimport { SingleStoreCountBuilder } from './query-builders/count.ts';\nimport {\n\tQueryBuilder,\n\tSingleStoreDeleteBase,\n\tSingleStoreInsertBuilder,\n\tSingleStoreSelectBuilder,\n\tSingleStoreUpdateBuilder,\n} from './query-builders/index.ts';\nimport type { SelectedFields } from './query-builders/select.types.ts';\nimport type {\n\tPreparedQueryHKTBase,\n\tSingleStoreQueryResultHKT,\n\tSingleStoreQueryResultKind,\n\tSingleStoreSession,\n\tSingleStoreTransaction,\n\tSingleStoreTransactionConfig,\n} from './session.ts';\nimport type { WithSubqueryWithSelection } from './subquery.ts';\nimport type { SingleStoreTable } from './table.ts';\n\nexport class SingleStoreDatabase<\n\tTQueryResult extends SingleStoreQueryResultHKT,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n\tTFullSchema extends Record<string, unknown> = {},\n\tTSchema extends TablesRelationalConfig = ExtractTablesWithRelations<TFullSchema>,\n> {\n\tstatic readonly [entityKind]: string = 'SingleStoreDatabase';\n\n\tdeclare readonly _: {\n\t\treadonly schema: TSchema | undefined;\n\t\treadonly fullSchema: TFullSchema;\n\t\treadonly tableNamesMap: Record<string, string>;\n\t};\n\n\t// We are waiting for SingleStore support for `json_array` function\n\t/**@inrernal */\n\tquery: unknown;\n\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly dialect: SingleStoreDialect,\n\t\t/** @internal */\n\t\treadonly session: SingleStoreSession<any, any, any, any>,\n\t\tschema: RelationalSchemaConfig<TSchema> | undefined,\n\t) {\n\t\tthis._ = schema\n\t\t\t? {\n\t\t\t\tschema: schema.schema,\n\t\t\t\tfullSchema: schema.fullSchema as TFullSchema,\n\t\t\t\ttableNamesMap: schema.tableNamesMap,\n\t\t\t}\n\t\t\t: {\n\t\t\t\tschema: undefined,\n\t\t\t\tfullSchema: {} as TFullSchema,\n\t\t\t\ttableNamesMap: {},\n\t\t\t};\n\t\tthis.query = {} as typeof this['query'];\n\t\t// this.queryNotSupported = true;\n\t\t// if (this._.schema) {\n\t\t// \tfor (const [tableName, columns] of Object.entries(this._.schema)) {\n\t\t// \t\t(this.query as SingleStoreDatabase<TQueryResult, TPreparedQueryHKT, Record<string, any>>['query'])[tableName] =\n\t\t// \t\t\tnew RelationalQueryBuilder(\n\t\t// \t\t\t\tschema!.fullSchema,\n\t\t// \t\t\t\tthis._.schema,\n\t\t// \t\t\t\tthis._.tableNamesMap,\n\t\t// \t\t\t\tschema!.fullSchema[tableName] as SingleStoreTable,\n\t\t// \t\t\t\tcolumns,\n\t\t// \t\t\t\tdialect,\n\t\t// \t\t\t\tsession,\n\t\t// \t\t\t);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t/**\n\t * Creates a subquery that defines a temporary named result set as a CTE.\n\t *\n\t * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param alias The alias for the subquery.\n\t *\n\t * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Create a subquery with alias 'sq' and use it in the select query\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t *\n\t * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them:\n\t *\n\t * ```ts\n\t * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query\n\t * const sq = db.$with('sq').as(db.select({\n\t * name: sql<string>`upper(${users.name})`.as('name'),\n\t * })\n\t * .from(users));\n\t *\n\t * const result = await db.with(sq).select({ name: sq.name }).from(sq);\n\t * ```\n\t */\n\t$with<TAlias extends string>(alias: TAlias) {\n\t\tconst self = this;\n\t\treturn {\n\t\t\tas<TSelection extends ColumnsSelection>(\n\t\t\t\tqb: TypedQueryBuilder<TSelection> | ((qb: QueryBuilder) => TypedQueryBuilder<TSelection>),\n\t\t\t): WithSubqueryWithSelection<TSelection, TAlias> {\n\t\t\t\tif (typeof qb === 'function') {\n\t\t\t\t\tqb = qb(new QueryBuilder(self.dialect));\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy(\n\t\t\t\t\tnew WithSubquery(qb.getSQL(), qb.getSelectedFields() as SelectedFields, alias, true),\n\t\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t\t) as WithSubqueryWithSelection<TSelection, TAlias>;\n\t\t\t},\n\t\t};\n\t}\n\n\t$count(\n\t\tsource: SingleStoreTable | SQL | SQLWrapper, // SingleStoreViewBase |\n\t\tfilters?: SQL<unknown>,\n\t) {\n\t\treturn new SingleStoreCountBuilder({ source, filters, session: this.session });\n\t}\n\n\t/**\n\t * Incorporates a previously defined CTE (using `$with`) into the main query.\n\t *\n\t * This method allows the main query to reference a temporary named result set.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param queries The CTEs to incorporate into the main query.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Define a subquery 'sq' as a CTE using $with\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * // Incorporate the CTE 'sq' into the main query and select from it\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t */\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\t/**\n\t\t * Creates a select query.\n\t\t *\n\t\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all columns and all rows from the 'cars' table\n\t\t * const allCars: Car[] = await db.select().from(cars);\n\t\t *\n\t\t * // Select specific columns and all rows from the 'cars' table\n\t\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * brand: cars.brand\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t *\n\t\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t\t *\n\t\t * ```ts\n\t\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t */\n\t\tfunction select(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction select(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct` expression to the select query.\n\t\t *\n\t\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select all unique rows from the 'cars' table\n\t\t * await db.selectDistinct()\n\t\t * .from(cars)\n\t\t * .orderBy(cars.id, cars.brand, cars.color);\n\t\t *\n\t\t * // Select all unique brands from the 'cars' table\n\t\t * await db.selectDistinct({ brand: cars.brand })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction selectDistinct(\n\t\t\tfields?: SelectedFields,\n\t\t): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Creates an update query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t\t *\n\t\t * Use `.set()` method to specify which values to update.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t\t *\n\t\t * @param table The table to update.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Update all rows in the 'cars' table\n\t\t * await db.update(cars).set({ color: 'red' });\n\t\t *\n\t\t * // Update rows with filters and conditions\n\t\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t\t * ```\n\t\t */\n\t\tfunction update<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreUpdateBuilder(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\t/**\n\t\t * Creates a delete query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t\t *\n\t\t * @param table The table to delete from.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Delete all rows in the 'cars' table\n\t\t * await db.delete(cars);\n\t\t *\n\t\t * // Delete rows with filters and conditions\n\t\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t\t * ```\n\t\t */\n\t\tfunction delete_<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreDeleteBase(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\treturn { select, selectDistinct, update, delete: delete_ };\n\t}\n\n\t/**\n\t * Creates a select query.\n\t *\n\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all columns and all rows from the 'cars' table\n\t * const allCars: Car[] = await db.select().from(cars);\n\t *\n\t * // Select specific columns and all rows from the 'cars' table\n\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t * id: cars.id,\n\t * brand: cars.brand\n\t * })\n\t * .from(cars);\n\t * ```\n\t *\n\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t *\n\t * ```ts\n\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t * id: cars.id,\n\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t * })\n\t * .from(cars);\n\t * ```\n\t */\n\tselect(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselect<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselect(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({ fields: fields ?? undefined, session: this.session, dialect: this.dialect });\n\t}\n\n\t/**\n\t * Adds `distinct` expression to the select query.\n\t *\n\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select all unique rows from the 'cars' table\n\t * await db.selectDistinct()\n\t * .from(cars)\n\t * .orderBy(cars.id, cars.brand, cars.color);\n\t *\n\t * // Select all unique brands from the 'cars' table\n\t * await db.selectDistinct({ brand: cars.brand })\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t * ```\n\t */\n\tselectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselectDistinct<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselectDistinct(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t/**\n\t * Creates an update query.\n\t *\n\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t *\n\t * Use `.set()` method to specify which values to update.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param table The table to update.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Update all rows in the 'cars' table\n\t * await db.update(cars).set({ color: 'red' });\n\t *\n\t * // Update rows with filters and conditions\n\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t * ```\n\t */\n\tupdate<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreUpdateBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates an insert query.\n\t *\n\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t *\n\t * @param table The table to insert into.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Insert one row\n\t * await db.insert(cars).values({ brand: 'BMW' });\n\t *\n\t * // Insert multiple rows\n\t * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t * ```\n\t */\n\tinsert<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreInsertBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreInsertBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates a delete query.\n\t *\n\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param table The table to delete from.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Delete all rows in the 'cars' table\n\t * await db.delete(cars);\n\t *\n\t * // Delete rows with filters and conditions\n\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t * ```\n\t */\n\tdelete<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreDeleteBase(table, this.session, this.dialect);\n\t}\n\n\texecute<T extends { [column: string]: any } = ResultSetHeader>(\n\t\tquery: SQLWrapper | string,\n\t): Promise<SingleStoreQueryResultKind<TQueryResult, T>> {\n\t\treturn this.session.execute(typeof query === 'string' ? sql.raw(query) : query.getSQL());\n\t}\n\n\ttransaction<T>(\n\t\ttransaction: (\n\t\t\ttx: SingleStoreTransaction<TQueryResult, TPreparedQueryHKT, TFullSchema, TSchema>,\n\t\t\tconfig?: SingleStoreTransactionConfig,\n\t\t) => Promise<T>,\n\t\tconfig?: SingleStoreTransactionConfig,\n\t): Promise<T> {\n\t\treturn this.session.transaction(transaction, config);\n\t}\n}\n\nexport type SingleStoreWithReplicas<Q> = Q & { $primary: Q };\n\nexport const withReplicas = <\n\tQ extends SingleStoreDriverDatabase,\n>(\n\tprimary: Q,\n\treplicas: [Q, ...Q[]],\n\tgetReplica: (replicas: Q[]) => Q = () => replicas[Math.floor(Math.random() * replicas.length)]!,\n): SingleStoreWithReplicas<Q> => {\n\tconst select: Q['select'] = (...args: []) => getReplica(replicas).select(...args);\n\tconst selectDistinct: Q['selectDistinct'] = (...args: []) => getReplica(replicas).selectDistinct(...args);\n\tconst $with: Q['with'] = (...args: []) => getReplica(replicas).with(...args);\n\n\tconst update: Q['update'] = (...args: [any]) => primary.update(...args);\n\tconst insert: Q['insert'] = (...args: [any]) => primary.insert(...args);\n\tconst $delete: Q['delete'] = (...args: [any]) => primary.delete(...args);\n\tconst execute: Q['execute'] = (...args: [any]) => primary.execute(...args);\n\tconst transaction: Q['transaction'] = (...args: [any, any]) => primary.transaction(...args);\n\n\treturn {\n\t\t...primary,\n\t\tupdate,\n\t\tinsert,\n\t\tdelete: $delete,\n\t\texecute,\n\t\ttransaction,\n\t\t$primary: primary,\n\t\tselect,\n\t\tselectDistinct,\n\t\twith: $with,\n\t\tget query() {\n\t\t\treturn getReplica(replicas).query;\n\t\t},\n\t};\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,oBAA2B;AAG3B,6BAAsC;AAEtC,iBAAsE;AACtE,sBAA6B;AAE7B,mBAAwC;AACxC,4BAMO;AAaA,MAAM,oBAKX;AAAA,EAaD,YAEU,SAEA,SACT,QACC;AAJQ;AAEA;AAGT,SAAK,IAAI,SACN;AAAA,MACD,QAAQ,OAAO;AAAA,MACf,YAAY,OAAO;AAAA,MACnB,eAAe,OAAO;AAAA,IACvB,IACE;AAAA,MACD,QAAQ;AAAA,MACR,YAAY,CAAC;AAAA,MACb,eAAe,CAAC;AAAA,IACjB;AACD,SAAK,QAAQ,CAAC;AAAA,EAgBf;AAAA,EA9CA,QAAiB,wBAAU,IAAY;AAAA;AAAA;AAAA,EAUvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsEA,MAA6B,OAAe;AAC3C,UAAM,OAAO;AACb,WAAO;AAAA,MACN,GACC,IACgD;AAChD,YAAI,OAAO,OAAO,YAAY;AAC7B,eAAK,GAAG,IAAI,mCAAa,KAAK,OAAO,CAAC;AAAA,QACvC;AAEA,eAAO,IAAI;AAAA,UACV,IAAI,6BAAa,GAAG,OAAO,GAAG,GAAG,kBAAkB,GAAqB,OAAO,IAAI;AAAA,UACnF,IAAI,6CAAsB,EAAE,OA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IAAI,SAAgB,QAAQ,OAAO,GAAG,IAAI;AACtE,QAAM,SAAsB,IAAI,SAAgB,QAAQ,OAAO,GAAG,IAAI;AACtE,QAAM,UAAuB,IAAI,SAAgB,QAAQ,OAAO,GAAG,IAAI;AACvE,QAAM,UAAwB,IAAI,SAAgB,QAAQ,QAAQ,GAAG,IAAI;AACzE,QAAM,cAAgC,IAAI,SAAqB,QAAQ,YAAY,GAAG,IAAI;AAE1F,SAAO;AAAA,IACN,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,IAAI,QAAQ;AACX,aAAO,WAAW,QAAQ,EAAE;AAAA,IAC7B;AAAA,EACD;AACD;","names":[]}
@@ -1,7 +1,7 @@
1
1
  import type { ResultSetHeader } from 'mysql2/promise';
2
- import type * as V1 from "../_relations.cjs";
3
2
  import { entityKind } from "../entity.cjs";
4
3
  import type { TypedQueryBuilder } from "../query-builders/query-builder.cjs";
4
+ import type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
5
5
  import type { SingleStoreDriverDatabase } from "../singlestore/driver.cjs";
6
6
  import { type ColumnsSelection, type SQL, type SQLWrapper } from "../sql/sql.cjs";
7
7
  import { WithSubquery } from "../subquery.cjs";
@@ -12,7 +12,7 @@ import type { SelectedFields } from "./query-builders/select.types.cjs";
12
12
  import type { PreparedQueryHKTBase, SingleStoreQueryResultHKT, SingleStoreQueryResultKind, SingleStoreSession, SingleStoreTransaction, SingleStoreTransactionConfig } from "./session.cjs";
13
13
  import type { WithSubqueryWithSelection } from "./subquery.cjs";
14
14
  import type { SingleStoreTable } from "./table.cjs";
15
- export declare class SingleStoreDatabase<TQueryResult extends SingleStoreQueryResultHKT, TPreparedQueryHKT extends PreparedQueryHKTBase, TFullSchema extends Record<string, unknown> = {}, TSchema extends V1.TablesRelationalConfig = V1.ExtractTablesWithRelations<TFullSchema>> {
15
+ export declare class SingleStoreDatabase<TQueryResult extends SingleStoreQueryResultHKT, TPreparedQueryHKT extends PreparedQueryHKTBase, TFullSchema extends Record<string, unknown> = {}, TSchema extends TablesRelationalConfig = ExtractTablesWithRelations<TFullSchema>> {
16
16
  static readonly [entityKind]: string;
17
17
  readonly _: {
18
18
  readonly schema: TSchema | undefined;
@@ -25,7 +25,7 @@ export declare class SingleStoreDatabase<TQueryResult extends SingleStoreQueryRe
25
25
  /** @internal */
26
26
  dialect: SingleStoreDialect,
27
27
  /** @internal */
28
- session: SingleStoreSession<any, any, any, any>, schema: V1.RelationalSchemaConfig<TSchema> | undefined);
28
+ session: SingleStoreSession<any, any, any, any>, schema: RelationalSchemaConfig<TSchema> | undefined);
29
29
  /**
30
30
  * Creates a subquery that defines a temporary named result set as a CTE.
31
31
  *
@@ -1,7 +1,7 @@
1
1
  import type { ResultSetHeader } from 'mysql2/promise';
2
- import type * as V1 from "../_relations.js";
3
2
  import { entityKind } from "../entity.js";
4
3
  import type { TypedQueryBuilder } from "../query-builders/query-builder.js";
4
+ import type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
5
5
  import type { SingleStoreDriverDatabase } from "../singlestore/driver.js";
6
6
  import { type ColumnsSelection, type SQL, type SQLWrapper } from "../sql/sql.js";
7
7
  import { WithSubquery } from "../subquery.js";
@@ -12,7 +12,7 @@ import type { SelectedFields } from "./query-builders/select.types.js";
12
12
  import type { PreparedQueryHKTBase, SingleStoreQueryResultHKT, SingleStoreQueryResultKind, SingleStoreSession, SingleStoreTransaction, SingleStoreTransactionConfig } from "./session.js";
13
13
  import type { WithSubqueryWithSelection } from "./subquery.js";
14
14
  import type { SingleStoreTable } from "./table.js";
15
- export declare class SingleStoreDatabase<TQueryResult extends SingleStoreQueryResultHKT, TPreparedQueryHKT extends PreparedQueryHKTBase, TFullSchema extends Record<string, unknown> = {}, TSchema extends V1.TablesRelationalConfig = V1.ExtractTablesWithRelations<TFullSchema>> {
15
+ export declare class SingleStoreDatabase<TQueryResult extends SingleStoreQueryResultHKT, TPreparedQueryHKT extends PreparedQueryHKTBase, TFullSchema extends Record<string, unknown> = {}, TSchema extends TablesRelationalConfig = ExtractTablesWithRelations<TFullSchema>> {
16
16
  static readonly [entityKind]: string;
17
17
  readonly _: {
18
18
  readonly schema: TSchema | undefined;
@@ -25,7 +25,7 @@ export declare class SingleStoreDatabase<TQueryResult extends SingleStoreQueryRe
25
25
  /** @internal */
26
26
  dialect: SingleStoreDialect,
27
27
  /** @internal */
28
- session: SingleStoreSession<any, any, any, any>, schema: V1.RelationalSchemaConfig<TSchema> | undefined);
28
+ session: SingleStoreSession<any, any, any, any>, schema: RelationalSchemaConfig<TSchema> | undefined);
29
29
  /**
30
30
  * Creates a subquery that defines a temporary named result set as a CTE.
31
31
  *
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/singlestore-core/db.ts"],"sourcesContent":["import type { ResultSetHeader } from 'mysql2/promise';\nimport type * as V1 from '~/_relations.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport type { SingleStoreDriverDatabase } from '~/singlestore/driver.ts';\nimport { type ColumnsSelection, type SQL, sql, type SQLWrapper } from '~/sql/sql.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport type { SingleStoreDialect } from './dialect.ts';\nimport { SingleStoreCountBuilder } from './query-builders/count.ts';\nimport {\n\tQueryBuilder,\n\tSingleStoreDeleteBase,\n\tSingleStoreInsertBuilder,\n\tSingleStoreSelectBuilder,\n\tSingleStoreUpdateBuilder,\n} from './query-builders/index.ts';\nimport type { SelectedFields } from './query-builders/select.types.ts';\nimport type {\n\tPreparedQueryHKTBase,\n\tSingleStoreQueryResultHKT,\n\tSingleStoreQueryResultKind,\n\tSingleStoreSession,\n\tSingleStoreTransaction,\n\tSingleStoreTransactionConfig,\n} from './session.ts';\nimport type { WithSubqueryWithSelection } from './subquery.ts';\nimport type { SingleStoreTable } from './table.ts';\n\nexport class SingleStoreDatabase<\n\tTQueryResult extends SingleStoreQueryResultHKT,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n\tTFullSchema extends Record<string, unknown> = {},\n\tTSchema extends V1.TablesRelationalConfig = V1.ExtractTablesWithRelations<TFullSchema>,\n> {\n\tstatic readonly [entityKind]: string = 'SingleStoreDatabase';\n\n\tdeclare readonly _: {\n\t\treadonly schema: TSchema | undefined;\n\t\treadonly fullSchema: TFullSchema;\n\t\treadonly tableNamesMap: Record<string, string>;\n\t};\n\n\t// We are waiting for SingleStore support for `json_array` function\n\t/**@inrernal */\n\tquery: unknown;\n\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly dialect: SingleStoreDialect,\n\t\t/** @internal */\n\t\treadonly session: SingleStoreSession<any, any, any, any>,\n\t\tschema: V1.RelationalSchemaConfig<TSchema> | undefined,\n\t) {\n\t\tthis._ = schema\n\t\t\t? {\n\t\t\t\tschema: schema.schema,\n\t\t\t\tfullSchema: schema.fullSchema as TFullSchema,\n\t\t\t\ttableNamesMap: schema.tableNamesMap,\n\t\t\t}\n\t\t\t: {\n\t\t\t\tschema: undefined,\n\t\t\t\tfullSchema: {} as TFullSchema,\n\t\t\t\ttableNamesMap: {},\n\t\t\t};\n\t\tthis.query = {} as typeof this['query'];\n\t\t// this.queryNotSupported = true;\n\t\t// if (this._.schema) {\n\t\t// \tfor (const [tableName, columns] of Object.entries(this._.schema)) {\n\t\t// \t\t(this.query as SingleStoreDatabase<TQueryResult, TPreparedQueryHKT, Record<string, any>>['query'])[tableName] =\n\t\t// \t\t\tnew RelationalQueryBuilder(\n\t\t// \t\t\t\tschema!.fullSchema,\n\t\t// \t\t\t\tthis._.schema,\n\t\t// \t\t\t\tthis._.tableNamesMap,\n\t\t// \t\t\t\tschema!.fullSchema[tableName] as SingleStoreTable,\n\t\t// \t\t\t\tcolumns,\n\t\t// \t\t\t\tdialect,\n\t\t// \t\t\t\tsession,\n\t\t// \t\t\t);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t/**\n\t * Creates a subquery that defines a temporary named result set as a CTE.\n\t *\n\t * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param alias The alias for the subquery.\n\t *\n\t * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Create a subquery with alias 'sq' and use it in the select query\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t *\n\t * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them:\n\t *\n\t * ```ts\n\t * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query\n\t * const sq = db.$with('sq').as(db.select({\n\t * name: sql<string>`upper(${users.name})`.as('name'),\n\t * })\n\t * .from(users));\n\t *\n\t * const result = await db.with(sq).select({ name: sq.name }).from(sq);\n\t * ```\n\t */\n\t$with<TAlias extends string>(alias: TAlias) {\n\t\tconst self = this;\n\t\treturn {\n\t\t\tas<TSelection extends ColumnsSelection>(\n\t\t\t\tqb: TypedQueryBuilder<TSelection> | ((qb: QueryBuilder) => TypedQueryBuilder<TSelection>),\n\t\t\t): WithSubqueryWithSelection<TSelection, TAlias> {\n\t\t\t\tif (typeof qb === 'function') {\n\t\t\t\t\tqb = qb(new QueryBuilder(self.dialect));\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy(\n\t\t\t\t\tnew WithSubquery(qb.getSQL(), qb.getSelectedFields() as SelectedFields, alias, true),\n\t\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t\t) as WithSubqueryWithSelection<TSelection, TAlias>;\n\t\t\t},\n\t\t};\n\t}\n\n\t$count(\n\t\tsource: SingleStoreTable | SQL | SQLWrapper, // SingleStoreViewBase |\n\t\tfilters?: SQL<unknown>,\n\t) {\n\t\treturn new SingleStoreCountBuilder({ source, filters, session: this.session });\n\t}\n\n\t/**\n\t * Incorporates a previously defined CTE (using `$with`) into the main query.\n\t *\n\t * This method allows the main query to reference a temporary named result set.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param queries The CTEs to incorporate into the main query.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Define a subquery 'sq' as a CTE using $with\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * // Incorporate the CTE 'sq' into the main query and select from it\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t */\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\t/**\n\t\t * Creates a select query.\n\t\t *\n\t\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all columns and all rows from the 'cars' table\n\t\t * const allCars: Car[] = await db.select().from(cars);\n\t\t *\n\t\t * // Select specific columns and all rows from the 'cars' table\n\t\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * brand: cars.brand\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t *\n\t\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t\t *\n\t\t * ```ts\n\t\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t */\n\t\tfunction select(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction select(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct` expression to the select query.\n\t\t *\n\t\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select all unique rows from the 'cars' table\n\t\t * await db.selectDistinct()\n\t\t * .from(cars)\n\t\t * .orderBy(cars.id, cars.brand, cars.color);\n\t\t *\n\t\t * // Select all unique brands from the 'cars' table\n\t\t * await db.selectDistinct({ brand: cars.brand })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction selectDistinct(\n\t\t\tfields?: SelectedFields,\n\t\t): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Creates an update query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t\t *\n\t\t * Use `.set()` method to specify which values to update.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t\t *\n\t\t * @param table The table to update.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Update all rows in the 'cars' table\n\t\t * await db.update(cars).set({ color: 'red' });\n\t\t *\n\t\t * // Update rows with filters and conditions\n\t\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t\t * ```\n\t\t */\n\t\tfunction update<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreUpdateBuilder(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\t/**\n\t\t * Creates a delete query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t\t *\n\t\t * @param table The table to delete from.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Delete all rows in the 'cars' table\n\t\t * await db.delete(cars);\n\t\t *\n\t\t * // Delete rows with filters and conditions\n\t\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t\t * ```\n\t\t */\n\t\tfunction delete_<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreDeleteBase(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\treturn { select, selectDistinct, update, delete: delete_ };\n\t}\n\n\t/**\n\t * Creates a select query.\n\t *\n\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all columns and all rows from the 'cars' table\n\t * const allCars: Car[] = await db.select().from(cars);\n\t *\n\t * // Select specific columns and all rows from the 'cars' table\n\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t * id: cars.id,\n\t * brand: cars.brand\n\t * })\n\t * .from(cars);\n\t * ```\n\t *\n\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t *\n\t * ```ts\n\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t * id: cars.id,\n\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t * })\n\t * .from(cars);\n\t * ```\n\t */\n\tselect(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselect<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselect(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({ fields: fields ?? undefined, session: this.session, dialect: this.dialect });\n\t}\n\n\t/**\n\t * Adds `distinct` expression to the select query.\n\t *\n\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select all unique rows from the 'cars' table\n\t * await db.selectDistinct()\n\t * .from(cars)\n\t * .orderBy(cars.id, cars.brand, cars.color);\n\t *\n\t * // Select all unique brands from the 'cars' table\n\t * await db.selectDistinct({ brand: cars.brand })\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t * ```\n\t */\n\tselectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselectDistinct<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselectDistinct(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t/**\n\t * Creates an update query.\n\t *\n\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t *\n\t * Use `.set()` method to specify which values to update.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param table The table to update.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Update all rows in the 'cars' table\n\t * await db.update(cars).set({ color: 'red' });\n\t *\n\t * // Update rows with filters and conditions\n\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t * ```\n\t */\n\tupdate<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreUpdateBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates an insert query.\n\t *\n\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t *\n\t * @param table The table to insert into.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Insert one row\n\t * await db.insert(cars).values({ brand: 'BMW' });\n\t *\n\t * // Insert multiple rows\n\t * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t * ```\n\t */\n\tinsert<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreInsertBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreInsertBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates a delete query.\n\t *\n\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param table The table to delete from.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Delete all rows in the 'cars' table\n\t * await db.delete(cars);\n\t *\n\t * // Delete rows with filters and conditions\n\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t * ```\n\t */\n\tdelete<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreDeleteBase(table, this.session, this.dialect);\n\t}\n\n\texecute<T extends { [column: string]: any } = ResultSetHeader>(\n\t\tquery: SQLWrapper | string,\n\t): Promise<SingleStoreQueryResultKind<TQueryResult, T>> {\n\t\treturn this.session.execute(typeof query === 'string' ? sql.raw(query) : query.getSQL());\n\t}\n\n\ttransaction<T>(\n\t\ttransaction: (\n\t\t\ttx: SingleStoreTransaction<TQueryResult, TPreparedQueryHKT, TFullSchema, TSchema>,\n\t\t\tconfig?: SingleStoreTransactionConfig,\n\t\t) => Promise<T>,\n\t\tconfig?: SingleStoreTransactionConfig,\n\t): Promise<T> {\n\t\treturn this.session.transaction(transaction, config);\n\t}\n}\n\nexport type SingleStoreWithReplicas<Q> = Q & { $primary: Q };\n\nexport const withReplicas = <\n\tQ extends SingleStoreDriverDatabase,\n>(\n\tprimary: Q,\n\treplicas: [Q, ...Q[]],\n\tgetReplica: (replicas: Q[]) => Q = () => replicas[Math.floor(Math.random() * replicas.length)]!,\n): SingleStoreWithReplicas<Q> => {\n\tconst select: Q['select'] = (...args: []) => getReplica(replicas).select(...args);\n\tconst selectDistinct: Q['selectDistinct'] = (...args: []) => getReplica(replicas).selectDistinct(...args);\n\tconst $with: Q['with'] = (...args: []) => getReplica(replicas).with(...args);\n\n\tconst update: Q['update'] = (...args: [any]) => primary.update(...args);\n\tconst insert: Q['insert'] = (...args: [any]) => primary.insert(...args);\n\tconst $delete: Q['delete'] = (...args: [any]) => primary.delete(...args);\n\tconst execute: Q['execute'] = (...args: [any]) => primary.execute(...args);\n\tconst transaction: Q['transaction'] = (...args: [any, any]) => primary.transaction(...args);\n\n\treturn {\n\t\t...primary,\n\t\tupdate,\n\t\tinsert,\n\t\tdelete: $delete,\n\t\texecute,\n\t\ttransaction,\n\t\t$primary: primary,\n\t\tselect,\n\t\tselectDistinct,\n\t\twith: $with,\n\t\tget query() {\n\t\t\treturn getReplica(replicas).query;\n\t\t},\n\t};\n};\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,6BAA6B;AAEtC,SAA0C,WAA4B;AACtE,SAAS,oBAAoB;AAE7B,SAAS,+BAA+B;AACxC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAaA,MAAM,oBAKX;AAAA,EAaD,YAEU,SAEA,SACT,QACC;AAJQ;AAEA;AAGT,SAAK,IAAI,SACN;AAAA,MACD,QAAQ,OAAO;AAAA,MACf,YAAY,OAAO;AAAA,MACnB,eAAe,OAAO;AAAA,IACvB,IACE;AAAA,MACD,QAAQ;AAAA,MACR,YAAY,CAAC;AAAA,MACb,eAAe,CAAC;AAAA,IACjB;AACD,SAAK,QAAQ,CAAC;AAAA,EAgBf;AAAA,EA9CA,QAAiB,UAAU,IAAY;AAAA;AAAA;AAAA,EAUvC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAsEA,MAA6B,OAAe;AAC3C,UAAM,OAAO;AAC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S,MAAM,CAAC,MAC7D;AAChC,QAAM,SAAsB,IAAI,SAAa,WAAW,QAAQ,EAAE,OAAO,GAAG,IAAI;AAChF,QAAM,iBAAsC,IAAI,SAAa,WAAW,QAAQ,EAAE,eAAe,GAAG,IAAI;AACxG,QAAM,QAAmB,IAAI,SAAa,WAAW,QAAQ,EAAE,KAAK,GAAG,IAAI;AAE3E,QAAM,SAAsB,IAAI,SAAgB,QAAQ,OAAO,GAAG,IAAI;AACtE,QAAM,SAAsB,IAAI,SAAgB,QAAQ,OAAO,GAAG,IAAI;AACtE,QAAM,UAAuB,IAAI,SAAgB,QAAQ,OAAO,GAAG,IAAI;AACvE,QAAM,UAAwB,IAAI,SAAgB,QAAQ,QAAQ,GAAG,IAAI;AACzE,QAAM,cAAgC,IAAI,SAAqB,QAAQ,YAAY,GAAG,IAAI;AAE1F,SAAO;AAAA,IACN,GAAG;AAAA,IACH;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,IAAI,QAAQ;AACX,aAAO,WAAW,QAAQ,EAAE;AAAA,IAC7B;AAAA,EACD;AACD;","names":[]}
1
+ {"version":3,"sources":["../../src/singlestore-core/db.ts"],"sourcesContent":["import type { ResultSetHeader } from 'mysql2/promise';\nimport { entityKind } from '~/entity.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type { ExtractTablesWithRelations, RelationalSchemaConfig, TablesRelationalConfig } from '~/relations.ts';\nimport { SelectionProxyHandler } from '~/selection-proxy.ts';\nimport type { SingleStoreDriverDatabase } from '~/singlestore/driver.ts';\nimport { type ColumnsSelection, type SQL, sql, type SQLWrapper } from '~/sql/sql.ts';\nimport { WithSubquery } from '~/subquery.ts';\nimport type { SingleStoreDialect } from './dialect.ts';\nimport { SingleStoreCountBuilder } from './query-builders/count.ts';\nimport {\n\tQueryBuilder,\n\tSingleStoreDeleteBase,\n\tSingleStoreInsertBuilder,\n\tSingleStoreSelectBuilder,\n\tSingleStoreUpdateBuilder,\n} from './query-builders/index.ts';\nimport type { SelectedFields } from './query-builders/select.types.ts';\nimport type {\n\tPreparedQueryHKTBase,\n\tSingleStoreQueryResultHKT,\n\tSingleStoreQueryResultKind,\n\tSingleStoreSession,\n\tSingleStoreTransaction,\n\tSingleStoreTransactionConfig,\n} from './session.ts';\nimport type { WithSubqueryWithSelection } from './subquery.ts';\nimport type { SingleStoreTable } from './table.ts';\n\nexport class SingleStoreDatabase<\n\tTQueryResult extends SingleStoreQueryResultHKT,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n\tTFullSchema extends Record<string, unknown> = {},\n\tTSchema extends TablesRelationalConfig = ExtractTablesWithRelations<TFullSchema>,\n> {\n\tstatic readonly [entityKind]: string = 'SingleStoreDatabase';\n\n\tdeclare readonly _: {\n\t\treadonly schema: TSchema | undefined;\n\t\treadonly fullSchema: TFullSchema;\n\t\treadonly tableNamesMap: Record<string, string>;\n\t};\n\n\t// We are waiting for SingleStore support for `json_array` function\n\t/**@inrernal */\n\tquery: unknown;\n\n\tconstructor(\n\t\t/** @internal */\n\t\treadonly dialect: SingleStoreDialect,\n\t\t/** @internal */\n\t\treadonly session: SingleStoreSession<any, any, any, any>,\n\t\tschema: RelationalSchemaConfig<TSchema> | undefined,\n\t) {\n\t\tthis._ = schema\n\t\t\t? {\n\t\t\t\tschema: schema.schema,\n\t\t\t\tfullSchema: schema.fullSchema as TFullSchema,\n\t\t\t\ttableNamesMap: schema.tableNamesMap,\n\t\t\t}\n\t\t\t: {\n\t\t\t\tschema: undefined,\n\t\t\t\tfullSchema: {} as TFullSchema,\n\t\t\t\ttableNamesMap: {},\n\t\t\t};\n\t\tthis.query = {} as typeof this['query'];\n\t\t// this.queryNotSupported = true;\n\t\t// if (this._.schema) {\n\t\t// \tfor (const [tableName, columns] of Object.entries(this._.schema)) {\n\t\t// \t\t(this.query as SingleStoreDatabase<TQueryResult, TPreparedQueryHKT, Record<string, any>>['query'])[tableName] =\n\t\t// \t\t\tnew RelationalQueryBuilder(\n\t\t// \t\t\t\tschema!.fullSchema,\n\t\t// \t\t\t\tthis._.schema,\n\t\t// \t\t\t\tthis._.tableNamesMap,\n\t\t// \t\t\t\tschema!.fullSchema[tableName] as SingleStoreTable,\n\t\t// \t\t\t\tcolumns,\n\t\t// \t\t\t\tdialect,\n\t\t// \t\t\t\tsession,\n\t\t// \t\t\t);\n\t\t// \t}\n\t\t// }\n\t}\n\n\t/**\n\t * Creates a subquery that defines a temporary named result set as a CTE.\n\t *\n\t * It is useful for breaking down complex queries into simpler parts and for reusing the result set in subsequent parts of the query.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param alias The alias for the subquery.\n\t *\n\t * Failure to provide an alias will result in a DrizzleTypeError, preventing the subquery from being referenced in other queries.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Create a subquery with alias 'sq' and use it in the select query\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t *\n\t * To select arbitrary SQL values as fields in a CTE and reference them in other CTEs or in the main query, you need to add aliases to them:\n\t *\n\t * ```ts\n\t * // Select an arbitrary SQL value as a field in a CTE and reference it in the main query\n\t * const sq = db.$with('sq').as(db.select({\n\t * name: sql<string>`upper(${users.name})`.as('name'),\n\t * })\n\t * .from(users));\n\t *\n\t * const result = await db.with(sq).select({ name: sq.name }).from(sq);\n\t * ```\n\t */\n\t$with<TAlias extends string>(alias: TAlias) {\n\t\tconst self = this;\n\t\treturn {\n\t\t\tas<TSelection extends ColumnsSelection>(\n\t\t\t\tqb: TypedQueryBuilder<TSelection> | ((qb: QueryBuilder) => TypedQueryBuilder<TSelection>),\n\t\t\t): WithSubqueryWithSelection<TSelection, TAlias> {\n\t\t\t\tif (typeof qb === 'function') {\n\t\t\t\t\tqb = qb(new QueryBuilder(self.dialect));\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy(\n\t\t\t\t\tnew WithSubquery(qb.getSQL(), qb.getSelectedFields() as SelectedFields, alias, true),\n\t\t\t\t\tnew SelectionProxyHandler({ alias, sqlAliasedBehavior: 'alias', sqlBehavior: 'error' }),\n\t\t\t\t) as WithSubqueryWithSelection<TSelection, TAlias>;\n\t\t\t},\n\t\t};\n\t}\n\n\t$count(\n\t\tsource: SingleStoreTable | SQL | SQLWrapper, // SingleStoreViewBase |\n\t\tfilters?: SQL<unknown>,\n\t) {\n\t\treturn new SingleStoreCountBuilder({ source, filters, session: this.session });\n\t}\n\n\t/**\n\t * Incorporates a previously defined CTE (using `$with`) into the main query.\n\t *\n\t * This method allows the main query to reference a temporary named result set.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#with-clause}\n\t *\n\t * @param queries The CTEs to incorporate into the main query.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Define a subquery 'sq' as a CTE using $with\n\t * const sq = db.$with('sq').as(db.select().from(users).where(eq(users.id, 42)));\n\t *\n\t * // Incorporate the CTE 'sq' into the main query and select from it\n\t * const result = await db.with(sq).select().from(sq);\n\t * ```\n\t */\n\twith(...queries: WithSubquery[]) {\n\t\tconst self = this;\n\n\t\t/**\n\t\t * Creates a select query.\n\t\t *\n\t\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Select all columns and all rows from the 'cars' table\n\t\t * const allCars: Car[] = await db.select().from(cars);\n\t\t *\n\t\t * // Select specific columns and all rows from the 'cars' table\n\t\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * brand: cars.brand\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t *\n\t\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t\t *\n\t\t * ```ts\n\t\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t\t * id: cars.id,\n\t\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t\t * })\n\t\t * .from(cars);\n\t\t * ```\n\t\t */\n\t\tfunction select(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction select<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction select(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Adds `distinct` expression to the select query.\n\t\t *\n\t\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t\t *\n\t\t * Use `.from()` method to specify which table to select from.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t\t *\n\t\t * @param fields The selection object.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * // Select all unique rows from the 'cars' table\n\t\t * await db.selectDistinct()\n\t\t * .from(cars)\n\t\t * .orderBy(cars.id, cars.brand, cars.color);\n\t\t *\n\t\t * // Select all unique brands from the 'cars' table\n\t\t * await db.selectDistinct({ brand: cars.brand })\n\t\t * .from(cars)\n\t\t * .orderBy(cars.brand);\n\t\t * ```\n\t\t */\n\t\tfunction selectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\t\tfunction selectDistinct<TSelection extends SelectedFields>(\n\t\t\tfields: TSelection,\n\t\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\t\tfunction selectDistinct(\n\t\t\tfields?: SelectedFields,\n\t\t): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreSelectBuilder({\n\t\t\t\tfields: fields ?? undefined,\n\t\t\t\tsession: self.session,\n\t\t\t\tdialect: self.dialect,\n\t\t\t\twithList: queries,\n\t\t\t\tdistinct: true,\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Creates an update query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t\t *\n\t\t * Use `.set()` method to specify which values to update.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t\t *\n\t\t * @param table The table to update.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Update all rows in the 'cars' table\n\t\t * await db.update(cars).set({ color: 'red' });\n\t\t *\n\t\t * // Update rows with filters and conditions\n\t\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t\t * ```\n\t\t */\n\t\tfunction update<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreUpdateBuilder(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\t/**\n\t\t * Creates a delete query.\n\t\t *\n\t\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t\t *\n\t\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t\t *\n\t\t * @param table The table to delete from.\n\t\t *\n\t\t * @example\n\t\t *\n\t\t * ```ts\n\t\t * // Delete all rows in the 'cars' table\n\t\t * await db.delete(cars);\n\t\t *\n\t\t * // Delete rows with filters and conditions\n\t\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t\t * ```\n\t\t */\n\t\tfunction delete_<TTable extends SingleStoreTable>(\n\t\t\ttable: TTable,\n\t\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\t\treturn new SingleStoreDeleteBase(table, self.session, self.dialect, queries);\n\t\t}\n\n\t\treturn { select, selectDistinct, update, delete: delete_ };\n\t}\n\n\t/**\n\t * Creates a select query.\n\t *\n\t * Calling this method with no arguments will select all columns from the table. Pass a selection object to specify the columns you want to select.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Select all columns and all rows from the 'cars' table\n\t * const allCars: Car[] = await db.select().from(cars);\n\t *\n\t * // Select specific columns and all rows from the 'cars' table\n\t * const carsIdsAndBrands: { id: number; brand: string }[] = await db.select({\n\t * id: cars.id,\n\t * brand: cars.brand\n\t * })\n\t * .from(cars);\n\t * ```\n\t *\n\t * Like in SQL, you can use arbitrary expressions as selection fields, not just table columns:\n\t *\n\t * ```ts\n\t * // Select specific columns along with expression and all rows from the 'cars' table\n\t * const carsIdsAndLowerNames: { id: number; lowerBrand: string }[] = await db.select({\n\t * id: cars.id,\n\t * lowerBrand: sql<string>`lower(${cars.brand})`,\n\t * })\n\t * .from(cars);\n\t * ```\n\t */\n\tselect(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselect<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselect(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({ fields: fields ?? undefined, session: this.session, dialect: this.dialect });\n\t}\n\n\t/**\n\t * Adds `distinct` expression to the select query.\n\t *\n\t * Calling this method will return only unique values. When multiple columns are selected, it returns rows with unique combinations of values in these columns.\n\t *\n\t * Use `.from()` method to specify which table to select from.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/select#distinct}\n\t *\n\t * @param fields The selection object.\n\t *\n\t * @example\n\t * ```ts\n\t * // Select all unique rows from the 'cars' table\n\t * await db.selectDistinct()\n\t * .from(cars)\n\t * .orderBy(cars.id, cars.brand, cars.color);\n\t *\n\t * // Select all unique brands from the 'cars' table\n\t * await db.selectDistinct({ brand: cars.brand })\n\t * .from(cars)\n\t * .orderBy(cars.brand);\n\t * ```\n\t */\n\tselectDistinct(): SingleStoreSelectBuilder<undefined, TPreparedQueryHKT>;\n\tselectDistinct<TSelection extends SelectedFields>(\n\t\tfields: TSelection,\n\t): SingleStoreSelectBuilder<TSelection, TPreparedQueryHKT>;\n\tselectDistinct(fields?: SelectedFields): SingleStoreSelectBuilder<SelectedFields | undefined, TPreparedQueryHKT> {\n\t\treturn new SingleStoreSelectBuilder({\n\t\t\tfields: fields ?? undefined,\n\t\t\tsession: this.session,\n\t\t\tdialect: this.dialect,\n\t\t\tdistinct: true,\n\t\t});\n\t}\n\n\t/**\n\t * Creates an update query.\n\t *\n\t * Calling this method without `.where()` clause will update all rows in a table. The `.where()` clause specifies which rows should be updated.\n\t *\n\t * Use `.set()` method to specify which values to update.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/update}\n\t *\n\t * @param table The table to update.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Update all rows in the 'cars' table\n\t * await db.update(cars).set({ color: 'red' });\n\t *\n\t * // Update rows with filters and conditions\n\t * await db.update(cars).set({ color: 'red' }).where(eq(cars.brand, 'BMW'));\n\t * ```\n\t */\n\tupdate<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreUpdateBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreUpdateBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates an insert query.\n\t *\n\t * Calling this method will create new rows in a table. Use `.values()` method to specify which values to insert.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/insert}\n\t *\n\t * @param table The table to insert into.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Insert one row\n\t * await db.insert(cars).values({ brand: 'BMW' });\n\t *\n\t * // Insert multiple rows\n\t * await db.insert(cars).values([{ brand: 'BMW' }, { brand: 'Porsche' }]);\n\t * ```\n\t */\n\tinsert<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreInsertBuilder<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreInsertBuilder(table, this.session, this.dialect);\n\t}\n\n\t/**\n\t * Creates a delete query.\n\t *\n\t * Calling this method without `.where()` clause will delete all rows in a table. The `.where()` clause specifies which rows should be deleted.\n\t *\n\t * See docs: {@link https://orm.drizzle.team/docs/delete}\n\t *\n\t * @param table The table to delete from.\n\t *\n\t * @example\n\t *\n\t * ```ts\n\t * // Delete all rows in the 'cars' table\n\t * await db.delete(cars);\n\t *\n\t * // Delete rows with filters and conditions\n\t * await db.delete(cars).where(eq(cars.color, 'green'));\n\t * ```\n\t */\n\tdelete<TTable extends SingleStoreTable>(\n\t\ttable: TTable,\n\t): SingleStoreDeleteBase<TTable, TQueryResult, TPreparedQueryHKT> {\n\t\treturn new SingleStoreDeleteBase(table, this.session, this.dialect);\n\t}\n\n\texecute<T extends { [column: string]: any } = ResultSetHeader>(\n\t\tquery: SQLWrapper | string,\n\t): Promise<SingleStoreQueryResultKind<TQueryResult, T>> {\n\t\treturn this.session.execute(typeof query === 'string' ? sql.raw(query) : query.getSQL());\n\t}\n\n\ttransaction<T>(\n\t\ttransaction: (\n\t\t\ttx: SingleStoreTransaction<TQueryResult, TPreparedQueryHKT, TFullSchema, TSchema>,\n\t\t\tconfig?: SingleStoreTransactionConfig,\n\t\t) => Promise<T>,\n\t\tconfig?: SingleStoreTransactionConfig,\n\t): Promise<T> {\n\t\treturn this.session.transaction(transaction, config);\n\t}\n}\n\nexport type SingleStoreWithReplicas<Q> = Q & { $primary: Q };\n\nexport const withReplicas = <\n\tQ extends SingleStoreDriverDatabase,\n>(\n\tprimary: Q,\n\treplicas: [Q, ...Q[]],\n\tgetReplica: (replicas: Q[]) => Q = () => replicas[Math.floor(Math.random() * replicas.length)]!,\n): SingleStoreWithReplicas<Q> => {\n\tconst select: Q['select'] = (...args: []) => getReplica(replicas).select(...args);\n\tconst selectDistinct: Q['selectDistinct'] = (...args: []) => getReplica(replicas).selectDistinct(...args);\n\tconst $with: Q['with'] = (...args: []) => getReplica(replicas).with(...args);\n\n\tconst update: Q['update'] = (...args: [any]) => primary.update(...args);\n\tconst insert: Q['insert'] = (...args: [any]) => primary.insert(...args);\n\tconst $delete: Q['delete'] = (...args: [any]) => primary.delete(...args);\n\tconst execute: Q['execute'] = (...args: [any]) => primary.execute(...args);\n\tconst transaction: Q['transaction'] = (...args: [any, any]) => primary.transaction(...args);\n\n\treturn {\n\t\t...primary,\n\t\tupdate,\n\t\tinsert,\n\t\tdelete: $delete,\n\t\texecute,\n\t\ttransaction,\n\t\t$primary: primary,\n\t\tselect,\n\t\tselectDistinct,\n\t\twith: $with,\n\t\tget query() {\n\t\t\treturn getReplica(replicas).query;\n\t\t},\n\t};\n};\n"],"mappings":"AACA,SAAS,kBAAkB;AAG3B,SAAS,6BAA6B;AAEtC,SAA0C,WAA4B;AACtE,SAAS,oBAAoB;AAE7B,SAAS,+BAA+B;AACxC;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AAaA,MAAM,oBAKX;AAAA,EAaD,YAEU,SAEA,SACT,QACC;AAJQ;AAEA;AAGT,SAAK,IAAI,SACN;AAAA,MACD,QAAQ,OAAO;AAAA,MACf,YAAY,OAAO;AAAA,MACnB,eAAe,OAAO;AAAA,IACvB,IACE;AAAA,MACD,QAAQ;AAAA,MACR,YAAY,CAAC;AAAA,MACb,eAAe,CAAC;AAAA,IACjB;AACD,SAAK,QAAQ,CAAC;AAAA,EAgBf;AAAA,EA9CA,QAAiB,UAAU,IAAY;AAAA;AAAA;AAAA,EAUvC;A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