drizzle-orm 0.39.3 → 0.40.0-53e792e

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 (1015) hide show
  1. package/_relations.cjs +328 -0
  2. package/_relations.cjs.map +1 -0
  3. package/_relations.d.cts +215 -0
  4. package/_relations.d.ts +215 -0
  5. package/_relations.js +316 -0
  6. package/_relations.js.map +1 -0
  7. package/alias.cjs.map +1 -1
  8. package/alias.d.cts +3 -3
  9. package/alias.d.ts +3 -3
  10. package/alias.js.map +1 -1
  11. package/aws-data-api/pg/driver.cjs +19 -5
  12. package/aws-data-api/pg/driver.cjs.map +1 -1
  13. package/aws-data-api/pg/driver.d.cts +9 -8
  14. package/aws-data-api/pg/driver.d.ts +9 -8
  15. package/aws-data-api/pg/driver.js +9 -8
  16. package/aws-data-api/pg/driver.js.map +1 -1
  17. package/aws-data-api/pg/migrator.cjs.map +1 -1
  18. package/aws-data-api/pg/migrator.d.cts +2 -1
  19. package/aws-data-api/pg/migrator.d.ts +2 -1
  20. package/aws-data-api/pg/migrator.js.map +1 -1
  21. package/aws-data-api/pg/session.cjs +67 -4
  22. package/aws-data-api/pg/session.cjs.map +1 -1
  23. package/aws-data-api/pg/session.d.cts +13 -8
  24. package/aws-data-api/pg/session.d.ts +13 -8
  25. package/aws-data-api/pg/session.js +67 -4
  26. package/aws-data-api/pg/session.js.map +1 -1
  27. package/better-sqlite3/driver.cjs +12 -5
  28. package/better-sqlite3/driver.cjs.map +1 -1
  29. package/better-sqlite3/driver.d.cts +7 -6
  30. package/better-sqlite3/driver.d.ts +7 -6
  31. package/better-sqlite3/driver.js +12 -8
  32. package/better-sqlite3/driver.js.map +1 -1
  33. package/better-sqlite3/migrator.cjs.map +1 -1
  34. package/better-sqlite3/migrator.d.cts +2 -1
  35. package/better-sqlite3/migrator.d.ts +2 -1
  36. package/better-sqlite3/migrator.js.map +1 -1
  37. package/better-sqlite3/session.cjs +49 -4
  38. package/better-sqlite3/session.cjs.map +1 -1
  39. package/better-sqlite3/session.d.cts +14 -8
  40. package/better-sqlite3/session.d.ts +14 -8
  41. package/better-sqlite3/session.js +49 -4
  42. package/better-sqlite3/session.js.map +1 -1
  43. package/bun-sql/driver.cjs +16 -5
  44. package/bun-sql/driver.cjs.map +1 -1
  45. package/bun-sql/driver.d.cts +7 -6
  46. package/bun-sql/driver.d.ts +7 -6
  47. package/bun-sql/driver.js +6 -8
  48. package/bun-sql/driver.js.map +1 -1
  49. package/bun-sql/migrator.cjs.map +1 -1
  50. package/bun-sql/migrator.d.cts +2 -1
  51. package/bun-sql/migrator.d.ts +2 -1
  52. package/bun-sql/migrator.js.map +1 -1
  53. package/bun-sql/session.cjs +50 -6
  54. package/bun-sql/session.cjs.map +1 -1
  55. package/bun-sql/session.d.cts +14 -9
  56. package/bun-sql/session.d.ts +14 -9
  57. package/bun-sql/session.js +50 -6
  58. package/bun-sql/session.js.map +1 -1
  59. package/bun-sqlite/driver.cjs +22 -5
  60. package/bun-sqlite/driver.cjs.map +1 -1
  61. package/bun-sqlite/driver.d.cts +7 -6
  62. package/bun-sqlite/driver.d.ts +7 -6
  63. package/bun-sqlite/driver.js +12 -8
  64. package/bun-sqlite/driver.js.map +1 -1
  65. package/bun-sqlite/migrator.cjs.map +1 -1
  66. package/bun-sqlite/migrator.d.cts +2 -1
  67. package/bun-sqlite/migrator.d.ts +2 -1
  68. package/bun-sqlite/migrator.js.map +1 -1
  69. package/bun-sqlite/session.cjs +49 -4
  70. package/bun-sqlite/session.cjs.map +1 -1
  71. package/bun-sqlite/session.d.cts +14 -8
  72. package/bun-sqlite/session.d.ts +14 -8
  73. package/bun-sqlite/session.js +49 -4
  74. package/bun-sqlite/session.js.map +1 -1
  75. package/casing.cjs +3 -0
  76. package/casing.cjs.map +1 -1
  77. package/casing.d.cts +1 -1
  78. package/casing.d.ts +1 -1
  79. package/casing.js +4 -1
  80. package/casing.js.map +1 -1
  81. package/column-builder.cjs.map +1 -1
  82. package/column-builder.d.cts +6 -5
  83. package/column-builder.d.ts +6 -5
  84. package/column-builder.js.map +1 -1
  85. package/d1/driver.cjs +22 -5
  86. package/d1/driver.cjs.map +1 -1
  87. package/d1/driver.d.cts +3 -2
  88. package/d1/driver.d.ts +3 -2
  89. package/d1/driver.js +12 -8
  90. package/d1/driver.js.map +1 -1
  91. package/d1/migrator.cjs.map +1 -1
  92. package/d1/migrator.d.cts +2 -1
  93. package/d1/migrator.d.ts +2 -1
  94. package/d1/migrator.js.map +1 -1
  95. package/d1/session.cjs +50 -8
  96. package/d1/session.cjs.map +1 -1
  97. package/d1/session.d.cts +15 -8
  98. package/d1/session.d.ts +15 -8
  99. package/d1/session.js +50 -8
  100. package/d1/session.js.map +1 -1
  101. package/durable-sqlite/driver.cjs +16 -5
  102. package/durable-sqlite/driver.cjs.map +1 -1
  103. package/durable-sqlite/driver.d.cts +3 -2
  104. package/durable-sqlite/driver.d.ts +3 -2
  105. package/durable-sqlite/driver.js +6 -8
  106. package/durable-sqlite/driver.js.map +1 -1
  107. package/durable-sqlite/migrator.cjs.map +1 -1
  108. package/durable-sqlite/migrator.d.cts +2 -1
  109. package/durable-sqlite/migrator.d.ts +2 -1
  110. package/durable-sqlite/migrator.js.map +1 -1
  111. package/durable-sqlite/session.cjs +46 -4
  112. package/durable-sqlite/session.cjs.map +1 -1
  113. package/durable-sqlite/session.d.cts +14 -8
  114. package/durable-sqlite/session.d.ts +14 -8
  115. package/durable-sqlite/session.js +46 -4
  116. package/durable-sqlite/session.js.map +1 -1
  117. package/expo-sqlite/driver.cjs +22 -5
  118. package/expo-sqlite/driver.cjs.map +1 -1
  119. package/expo-sqlite/driver.d.cts +3 -2
  120. package/expo-sqlite/driver.d.ts +3 -2
  121. package/expo-sqlite/driver.js +12 -8
  122. package/expo-sqlite/driver.js.map +1 -1
  123. package/expo-sqlite/migrator.cjs.map +1 -1
  124. package/expo-sqlite/migrator.d.cts +3 -2
  125. package/expo-sqlite/migrator.d.ts +3 -2
  126. package/expo-sqlite/migrator.js.map +1 -1
  127. package/expo-sqlite/query.cjs +13 -2
  128. package/expo-sqlite/query.cjs.map +1 -1
  129. package/expo-sqlite/query.d.cts +2 -1
  130. package/expo-sqlite/query.d.ts +2 -1
  131. package/expo-sqlite/query.js +3 -2
  132. package/expo-sqlite/query.js.map +1 -1
  133. package/expo-sqlite/session.cjs +47 -4
  134. package/expo-sqlite/session.cjs.map +1 -1
  135. package/expo-sqlite/session.d.cts +14 -8
  136. package/expo-sqlite/session.d.ts +14 -8
  137. package/expo-sqlite/session.js +47 -4
  138. package/expo-sqlite/session.js.map +1 -1
  139. package/gel/driver.cjs +108 -0
  140. package/gel/driver.cjs.map +1 -0
  141. package/gel/driver.d.cts +39 -0
  142. package/gel/driver.d.ts +39 -0
  143. package/gel/driver.js +72 -0
  144. package/gel/driver.js.map +1 -0
  145. package/gel/index.cjs +25 -0
  146. package/gel/index.cjs.map +1 -0
  147. package/gel/index.d.cts +2 -0
  148. package/gel/index.d.ts +2 -0
  149. package/gel/index.js +3 -0
  150. package/gel/index.js.map +1 -0
  151. package/gel/migrator.cjs +5 -0
  152. package/gel/migrator.cjs.map +1 -0
  153. package/gel/migrator.d.cts +1 -0
  154. package/gel/migrator.d.ts +1 -0
  155. package/gel/migrator.js +4 -0
  156. package/gel/migrator.js.map +1 -0
  157. package/gel/session.cjs +181 -0
  158. package/gel/session.cjs.map +1 -0
  159. package/gel/session.d.cts +52 -0
  160. package/gel/session.d.ts +52 -0
  161. package/gel/session.js +155 -0
  162. package/gel/session.js.map +1 -0
  163. package/gel-core/alias.cjs +32 -0
  164. package/gel-core/alias.cjs.map +1 -0
  165. package/gel-core/alias.d.cts +4 -0
  166. package/gel-core/alias.d.ts +4 -0
  167. package/gel-core/alias.js +8 -0
  168. package/gel-core/alias.js.map +1 -0
  169. package/gel-core/checks.cjs +58 -0
  170. package/gel-core/checks.cjs.map +1 -0
  171. package/gel-core/checks.d.cts +18 -0
  172. package/gel-core/checks.d.ts +18 -0
  173. package/gel-core/checks.js +32 -0
  174. package/gel-core/checks.js.map +1 -0
  175. package/gel-core/columns/all.cjs +72 -0
  176. package/gel-core/columns/all.cjs.map +1 -0
  177. package/gel-core/columns/all.d.cts +43 -0
  178. package/gel-core/columns/all.d.ts +43 -0
  179. package/gel-core/columns/all.js +48 -0
  180. package/gel-core/columns/all.js.map +1 -0
  181. package/gel-core/columns/bigint.cjs +54 -0
  182. package/gel-core/columns/bigint.cjs.map +1 -0
  183. package/gel-core/columns/bigint.d.cts +23 -0
  184. package/gel-core/columns/bigint.d.ts +23 -0
  185. package/gel-core/columns/bigint.js +28 -0
  186. package/gel-core/columns/bigint.js.map +1 -0
  187. package/gel-core/columns/bigintT.cjs +60 -0
  188. package/gel-core/columns/bigintT.cjs.map +1 -0
  189. package/gel-core/columns/bigintT.d.cts +24 -0
  190. package/gel-core/columns/bigintT.d.ts +24 -0
  191. package/gel-core/columns/bigintT.js +34 -0
  192. package/gel-core/columns/bigintT.js.map +1 -0
  193. package/gel-core/columns/boolean.cjs +53 -0
  194. package/gel-core/columns/boolean.cjs.map +1 -0
  195. package/gel-core/columns/boolean.d.cts +22 -0
  196. package/gel-core/columns/boolean.d.ts +22 -0
  197. package/gel-core/columns/boolean.js +27 -0
  198. package/gel-core/columns/boolean.js.map +1 -0
  199. package/gel-core/columns/bytes.cjs +56 -0
  200. package/gel-core/columns/bytes.cjs.map +1 -0
  201. package/gel-core/columns/bytes.d.cts +22 -0
  202. package/gel-core/columns/bytes.d.ts +22 -0
  203. package/gel-core/columns/bytes.js +30 -0
  204. package/gel-core/columns/bytes.js.map +1 -0
  205. package/gel-core/columns/common.cjs +213 -0
  206. package/gel-core/columns/common.cjs.map +1 -0
  207. package/gel-core/columns/common.d.cts +147 -0
  208. package/gel-core/columns/common.d.ts +147 -0
  209. package/gel-core/columns/common.js +184 -0
  210. package/gel-core/columns/common.js.map +1 -0
  211. package/gel-core/columns/custom.cjs +77 -0
  212. package/gel-core/columns/custom.cjs.map +1 -0
  213. package/gel-core/columns/custom.d.cts +155 -0
  214. package/gel-core/columns/custom.d.ts +155 -0
  215. package/gel-core/columns/custom.js +51 -0
  216. package/gel-core/columns/custom.js.map +1 -0
  217. package/gel-core/columns/date-duration.cjs +56 -0
  218. package/gel-core/columns/date-duration.cjs.map +1 -0
  219. package/gel-core/columns/date-duration.d.cts +23 -0
  220. package/gel-core/columns/date-duration.d.ts +23 -0
  221. package/gel-core/columns/date-duration.js +30 -0
  222. package/gel-core/columns/date-duration.js.map +1 -0
  223. package/gel-core/columns/date.common.cjs +37 -0
  224. package/gel-core/columns/date.common.cjs.map +1 -0
  225. package/gel-core/columns/date.common.d.cts +7 -0
  226. package/gel-core/columns/date.common.d.ts +7 -0
  227. package/gel-core/columns/date.common.js +13 -0
  228. package/gel-core/columns/date.common.js.map +1 -0
  229. package/gel-core/columns/decimal.cjs +56 -0
  230. package/gel-core/columns/decimal.cjs.map +1 -0
  231. package/gel-core/columns/decimal.d.cts +26 -0
  232. package/gel-core/columns/decimal.d.ts +26 -0
  233. package/gel-core/columns/decimal.js +30 -0
  234. package/gel-core/columns/decimal.js.map +1 -0
  235. package/gel-core/columns/double-precision.cjs +62 -0
  236. package/gel-core/columns/double-precision.cjs.map +1 -0
  237. package/gel-core/columns/double-precision.d.cts +23 -0
  238. package/gel-core/columns/double-precision.d.ts +23 -0
  239. package/gel-core/columns/double-precision.js +36 -0
  240. package/gel-core/columns/double-precision.js.map +1 -0
  241. package/gel-core/columns/duration.cjs +53 -0
  242. package/gel-core/columns/duration.cjs.map +1 -0
  243. package/gel-core/columns/duration.d.cts +23 -0
  244. package/gel-core/columns/duration.d.ts +23 -0
  245. package/gel-core/columns/duration.js +27 -0
  246. package/gel-core/columns/duration.js.map +1 -0
  247. package/gel-core/columns/index.cjs +65 -0
  248. package/gel-core/columns/index.cjs.map +1 -0
  249. package/gel-core/columns/index.d.cts +22 -0
  250. package/gel-core/columns/index.d.ts +22 -0
  251. package/gel-core/columns/index.js +23 -0
  252. package/gel-core/columns/index.js.map +1 -0
  253. package/gel-core/columns/int.common.cjs +67 -0
  254. package/gel-core/columns/int.common.cjs.map +1 -0
  255. package/gel-core/columns/int.common.d.cts +15 -0
  256. package/gel-core/columns/int.common.d.ts +15 -0
  257. package/gel-core/columns/int.common.js +43 -0
  258. package/gel-core/columns/int.common.js.map +1 -0
  259. package/gel-core/columns/integer.cjs +54 -0
  260. package/gel-core/columns/integer.cjs.map +1 -0
  261. package/gel-core/columns/integer.d.cts +23 -0
  262. package/gel-core/columns/integer.d.ts +23 -0
  263. package/gel-core/columns/integer.js +28 -0
  264. package/gel-core/columns/integer.js.map +1 -0
  265. package/gel-core/columns/json.cjs +56 -0
  266. package/gel-core/columns/json.cjs.map +1 -0
  267. package/gel-core/columns/json.d.cts +26 -0
  268. package/gel-core/columns/json.d.ts +26 -0
  269. package/gel-core/columns/json.js +30 -0
  270. package/gel-core/columns/json.js.map +1 -0
  271. package/gel-core/columns/localdate.cjs +57 -0
  272. package/gel-core/columns/localdate.cjs.map +1 -0
  273. package/gel-core/columns/localdate.d.cts +24 -0
  274. package/gel-core/columns/localdate.d.ts +24 -0
  275. package/gel-core/columns/localdate.js +31 -0
  276. package/gel-core/columns/localdate.js.map +1 -0
  277. package/gel-core/columns/localtime.cjs +57 -0
  278. package/gel-core/columns/localtime.cjs.map +1 -0
  279. package/gel-core/columns/localtime.d.cts +24 -0
  280. package/gel-core/columns/localtime.d.ts +24 -0
  281. package/gel-core/columns/localtime.js +31 -0
  282. package/gel-core/columns/localtime.js.map +1 -0
  283. package/gel-core/columns/real.cjs +57 -0
  284. package/gel-core/columns/real.cjs.map +1 -0
  285. package/gel-core/columns/real.d.cts +28 -0
  286. package/gel-core/columns/real.d.ts +28 -0
  287. package/gel-core/columns/real.js +31 -0
  288. package/gel-core/columns/real.js.map +1 -0
  289. package/gel-core/columns/relative-duration.cjs +56 -0
  290. package/gel-core/columns/relative-duration.cjs.map +1 -0
  291. package/gel-core/columns/relative-duration.d.cts +23 -0
  292. package/gel-core/columns/relative-duration.d.ts +23 -0
  293. package/gel-core/columns/relative-duration.js +30 -0
  294. package/gel-core/columns/relative-duration.js.map +1 -0
  295. package/gel-core/columns/smallint.cjs +54 -0
  296. package/gel-core/columns/smallint.cjs.map +1 -0
  297. package/gel-core/columns/smallint.d.cts +23 -0
  298. package/gel-core/columns/smallint.d.ts +23 -0
  299. package/gel-core/columns/smallint.js +28 -0
  300. package/gel-core/columns/smallint.js.map +1 -0
  301. package/gel-core/columns/text.cjs +54 -0
  302. package/gel-core/columns/text.cjs.map +1 -0
  303. package/gel-core/columns/text.d.cts +26 -0
  304. package/gel-core/columns/text.d.ts +26 -0
  305. package/gel-core/columns/text.js +28 -0
  306. package/gel-core/columns/text.js.map +1 -0
  307. package/gel-core/columns/timestamp.cjs +60 -0
  308. package/gel-core/columns/timestamp.cjs.map +1 -0
  309. package/gel-core/columns/timestamp.d.cts +28 -0
  310. package/gel-core/columns/timestamp.d.ts +28 -0
  311. package/gel-core/columns/timestamp.js +34 -0
  312. package/gel-core/columns/timestamp.js.map +1 -0
  313. package/gel-core/columns/timestamptz.cjs +65 -0
  314. package/gel-core/columns/timestamptz.cjs.map +1 -0
  315. package/gel-core/columns/timestamptz.d.cts +28 -0
  316. package/gel-core/columns/timestamptz.d.ts +28 -0
  317. package/gel-core/columns/timestamptz.js +39 -0
  318. package/gel-core/columns/timestamptz.js.map +1 -0
  319. package/gel-core/columns/uuid.cjs +53 -0
  320. package/gel-core/columns/uuid.cjs.map +1 -0
  321. package/gel-core/columns/uuid.d.cts +22 -0
  322. package/gel-core/columns/uuid.d.ts +22 -0
  323. package/gel-core/columns/uuid.js +27 -0
  324. package/gel-core/columns/uuid.js.map +1 -0
  325. package/gel-core/db.cjs +362 -0
  326. package/gel-core/db.cjs.map +1 -0
  327. package/gel-core/db.d.cts +288 -0
  328. package/gel-core/db.d.ts +288 -0
  329. package/gel-core/db.js +343 -0
  330. package/gel-core/db.js.map +1 -0
  331. package/gel-core/dialect.cjs +826 -0
  332. package/gel-core/dialect.cjs.map +1 -0
  333. package/gel-core/dialect.d.cts +80 -0
  334. package/gel-core/dialect.d.ts +80 -0
  335. package/gel-core/dialect.js +803 -0
  336. package/gel-core/dialect.js.map +1 -0
  337. package/gel-core/expressions.cjs +49 -0
  338. package/gel-core/expressions.cjs.map +1 -0
  339. package/gel-core/expressions.d.cts +8 -0
  340. package/gel-core/expressions.d.ts +8 -0
  341. package/gel-core/expressions.js +22 -0
  342. package/gel-core/expressions.js.map +1 -0
  343. package/gel-core/foreign-keys.cjs +100 -0
  344. package/gel-core/foreign-keys.cjs.map +1 -0
  345. package/gel-core/foreign-keys.d.cts +48 -0
  346. package/gel-core/foreign-keys.d.ts +48 -0
  347. package/gel-core/foreign-keys.js +74 -0
  348. package/gel-core/foreign-keys.js.map +1 -0
  349. package/gel-core/index.cjs +61 -0
  350. package/gel-core/index.cjs.map +1 -0
  351. package/gel-core/index.d.cts +20 -0
  352. package/gel-core/index.d.ts +20 -0
  353. package/gel-core/index.js +21 -0
  354. package/gel-core/index.js.map +1 -0
  355. package/gel-core/indexes.cjs +149 -0
  356. package/gel-core/indexes.cjs.map +1 -0
  357. package/gel-core/indexes.d.cts +79 -0
  358. package/gel-core/indexes.d.ts +79 -0
  359. package/gel-core/indexes.js +121 -0
  360. package/gel-core/indexes.js.map +1 -0
  361. package/gel-core/policies.cjs +58 -0
  362. package/gel-core/policies.cjs.map +1 -0
  363. package/gel-core/policies.d.cts +24 -0
  364. package/gel-core/policies.d.ts +24 -0
  365. package/gel-core/policies.js +33 -0
  366. package/gel-core/policies.js.map +1 -0
  367. package/gel-core/primary-keys.cjs +68 -0
  368. package/gel-core/primary-keys.cjs.map +1 -0
  369. package/gel-core/primary-keys.d.cts +30 -0
  370. package/gel-core/primary-keys.d.ts +30 -0
  371. package/gel-core/primary-keys.js +42 -0
  372. package/gel-core/primary-keys.js.map +1 -0
  373. package/gel-core/query-builders/_query.cjs +149 -0
  374. package/gel-core/query-builders/_query.cjs.map +1 -0
  375. package/gel-core/query-builders/_query.d.cts +46 -0
  376. package/gel-core/query-builders/_query.d.ts +46 -0
  377. package/gel-core/query-builders/_query.js +114 -0
  378. package/gel-core/query-builders/_query.js.map +1 -0
  379. package/gel-core/query-builders/count.cjs +73 -0
  380. package/gel-core/query-builders/count.cjs.map +1 -0
  381. package/gel-core/query-builders/count.d.cts +25 -0
  382. package/gel-core/query-builders/count.d.ts +25 -0
  383. package/gel-core/query-builders/count.js +49 -0
  384. package/gel-core/query-builders/count.js.map +1 -0
  385. package/gel-core/query-builders/delete.cjs +105 -0
  386. package/gel-core/query-builders/delete.cjs.map +1 -0
  387. package/gel-core/query-builders/delete.d.cts +99 -0
  388. package/gel-core/query-builders/delete.d.ts +99 -0
  389. package/gel-core/query-builders/delete.js +81 -0
  390. package/gel-core/query-builders/delete.js.map +1 -0
  391. package/gel-core/query-builders/index.cjs +35 -0
  392. package/gel-core/query-builders/index.cjs.map +1 -0
  393. package/gel-core/query-builders/index.d.cts +7 -0
  394. package/gel-core/query-builders/index.d.ts +7 -0
  395. package/gel-core/query-builders/index.js +8 -0
  396. package/gel-core/query-builders/index.js.map +1 -0
  397. package/gel-core/query-builders/insert.cjs +218 -0
  398. package/gel-core/query-builders/insert.cjs.map +1 -0
  399. package/gel-core/query-builders/insert.d.cts +116 -0
  400. package/gel-core/query-builders/insert.d.ts +116 -0
  401. package/gel-core/query-builders/insert.js +193 -0
  402. package/gel-core/query-builders/insert.js.map +1 -0
  403. package/gel-core/query-builders/query-builder.cjs +114 -0
  404. package/gel-core/query-builders/query-builder.cjs.map +1 -0
  405. package/gel-core/query-builders/query-builder.d.cts +40 -0
  406. package/gel-core/query-builders/query-builder.d.ts +40 -0
  407. package/gel-core/query-builders/query-builder.js +90 -0
  408. package/gel-core/query-builders/query-builder.js.map +1 -0
  409. package/gel-core/query-builders/query.cjs +142 -0
  410. package/gel-core/query-builders/query.cjs.map +1 -0
  411. package/gel-core/query-builders/query.d.cts +47 -0
  412. package/gel-core/query-builders/query.d.ts +47 -0
  413. package/gel-core/query-builders/query.js +119 -0
  414. package/gel-core/query-builders/query.js.map +1 -0
  415. package/gel-core/query-builders/raw.cjs +57 -0
  416. package/gel-core/query-builders/raw.cjs.map +1 -0
  417. package/gel-core/query-builders/raw.d.cts +22 -0
  418. package/gel-core/query-builders/raw.d.ts +22 -0
  419. package/gel-core/query-builders/raw.js +33 -0
  420. package/gel-core/query-builders/raw.js.map +1 -0
  421. package/gel-core/query-builders/refresh-materialized-view.cjs +77 -0
  422. package/gel-core/query-builders/refresh-materialized-view.cjs.map +1 -0
  423. package/gel-core/query-builders/refresh-materialized-view.d.cts +27 -0
  424. package/gel-core/query-builders/refresh-materialized-view.d.ts +27 -0
  425. package/gel-core/query-builders/refresh-materialized-view.js +53 -0
  426. package/gel-core/query-builders/refresh-materialized-view.js.map +1 -0
  427. package/gel-core/query-builders/select.cjs +775 -0
  428. package/gel-core/query-builders/select.cjs.map +1 -0
  429. package/gel-core/query-builders/select.d.cts +721 -0
  430. package/gel-core/query-builders/select.d.ts +721 -0
  431. package/gel-core/query-builders/select.js +748 -0
  432. package/gel-core/query-builders/select.js.map +1 -0
  433. package/gel-core/query-builders/select.types.cjs +17 -0
  434. package/gel-core/query-builders/select.types.cjs.map +1 -0
  435. package/gel-core/query-builders/select.types.d.cts +138 -0
  436. package/gel-core/query-builders/select.types.d.ts +138 -0
  437. package/gel-core/query-builders/select.types.js +1 -0
  438. package/gel-core/query-builders/select.types.js.map +1 -0
  439. package/gel-core/query-builders/update.cjs +226 -0
  440. package/gel-core/query-builders/update.cjs.map +1 -0
  441. package/gel-core/query-builders/update.d.cts +166 -0
  442. package/gel-core/query-builders/update.d.ts +166 -0
  443. package/gel-core/query-builders/update.js +205 -0
  444. package/gel-core/query-builders/update.js.map +1 -0
  445. package/gel-core/roles.cjs +57 -0
  446. package/gel-core/roles.cjs.map +1 -0
  447. package/gel-core/roles.d.cts +13 -0
  448. package/gel-core/roles.d.ts +13 -0
  449. package/gel-core/roles.js +32 -0
  450. package/gel-core/roles.js.map +1 -0
  451. package/gel-core/schema.cjs +74 -0
  452. package/gel-core/schema.cjs.map +1 -0
  453. package/gel-core/schema.d.cts +15 -0
  454. package/gel-core/schema.d.ts +15 -0
  455. package/gel-core/schema.js +48 -0
  456. package/gel-core/schema.js.map +1 -0
  457. package/gel-core/sequence.cjs +52 -0
  458. package/gel-core/sequence.cjs.map +1 -0
  459. package/gel-core/sequence.d.cts +18 -0
  460. package/gel-core/sequence.d.ts +18 -0
  461. package/gel-core/sequence.js +25 -0
  462. package/gel-core/sequence.js.map +1 -0
  463. package/gel-core/session.cjs +95 -0
  464. package/gel-core/session.cjs.map +1 -0
  465. package/gel-core/session.d.cts +59 -0
  466. package/gel-core/session.d.ts +59 -0
  467. package/gel-core/session.js +69 -0
  468. package/gel-core/session.js.map +1 -0
  469. package/gel-core/subquery.cjs +17 -0
  470. package/gel-core/subquery.cjs.map +1 -0
  471. package/gel-core/subquery.d.cts +5 -0
  472. package/gel-core/subquery.d.ts +5 -0
  473. package/gel-core/subquery.js +1 -0
  474. package/gel-core/subquery.js.map +1 -0
  475. package/gel-core/table.cjs +100 -0
  476. package/gel-core/table.cjs.map +1 -0
  477. package/gel-core/table.d.cts +95 -0
  478. package/gel-core/table.d.ts +95 -0
  479. package/gel-core/table.js +71 -0
  480. package/gel-core/table.js.map +1 -0
  481. package/gel-core/unique-constraint.cjs +89 -0
  482. package/gel-core/unique-constraint.cjs.map +1 -0
  483. package/gel-core/unique-constraint.d.cts +25 -0
  484. package/gel-core/unique-constraint.d.ts +25 -0
  485. package/gel-core/unique-constraint.js +61 -0
  486. package/gel-core/unique-constraint.js.map +1 -0
  487. package/gel-core/utils.cjs +100 -0
  488. package/gel-core/utils.cjs.map +1 -0
  489. package/gel-core/utils.d.cts +51 -0
  490. package/gel-core/utils.d.ts +51 -0
  491. package/gel-core/utils.js +74 -0
  492. package/gel-core/utils.js.map +1 -0
  493. package/gel-core/view-base.cjs +33 -0
  494. package/gel-core/view-base.cjs.map +1 -0
  495. package/gel-core/view-base.d.cts +8 -0
  496. package/gel-core/view-base.d.ts +8 -0
  497. package/gel-core/view-base.js +9 -0
  498. package/gel-core/view-base.js.map +1 -0
  499. package/gel-core/view-common.cjs +29 -0
  500. package/gel-core/view-common.cjs.map +1 -0
  501. package/gel-core/view-common.d.cts +1 -0
  502. package/gel-core/view-common.d.ts +1 -0
  503. package/gel-core/view-common.js +5 -0
  504. package/gel-core/view-common.js.map +1 -0
  505. package/gel-core/view.cjs +302 -0
  506. package/gel-core/view.cjs.map +1 -0
  507. package/gel-core/view.d.cts +150 -0
  508. package/gel-core/view.d.ts +150 -0
  509. package/gel-core/view.js +268 -0
  510. package/gel-core/view.js.map +1 -0
  511. package/libsql/driver-core.cjs +22 -5
  512. package/libsql/driver-core.cjs.map +1 -1
  513. package/libsql/driver-core.d.cts +2 -1
  514. package/libsql/driver-core.d.ts +2 -1
  515. package/libsql/driver-core.js +12 -8
  516. package/libsql/driver-core.js.map +1 -1
  517. package/libsql/driver.cjs.map +1 -1
  518. package/libsql/driver.d.cts +6 -5
  519. package/libsql/driver.d.ts +6 -5
  520. package/libsql/driver.js.map +1 -1
  521. package/libsql/http/index.cjs.map +1 -1
  522. package/libsql/http/index.d.cts +6 -5
  523. package/libsql/http/index.d.ts +6 -5
  524. package/libsql/http/index.js.map +1 -1
  525. package/libsql/migrator.cjs.map +1 -1
  526. package/libsql/migrator.d.cts +2 -1
  527. package/libsql/migrator.d.ts +2 -1
  528. package/libsql/migrator.js.map +1 -1
  529. package/libsql/node/index.cjs.map +1 -1
  530. package/libsql/node/index.d.cts +6 -5
  531. package/libsql/node/index.d.ts +6 -5
  532. package/libsql/node/index.js.map +1 -1
  533. package/libsql/session.cjs +56 -4
  534. package/libsql/session.cjs.map +1 -1
  535. package/libsql/session.d.cts +15 -9
  536. package/libsql/session.d.ts +15 -9
  537. package/libsql/session.js +56 -4
  538. package/libsql/session.js.map +1 -1
  539. package/libsql/sqlite3/index.cjs.map +1 -1
  540. package/libsql/sqlite3/index.d.cts +6 -5
  541. package/libsql/sqlite3/index.d.ts +6 -5
  542. package/libsql/sqlite3/index.js.map +1 -1
  543. package/libsql/wasm/index.cjs.map +1 -1
  544. package/libsql/wasm/index.d.cts +6 -5
  545. package/libsql/wasm/index.d.ts +6 -5
  546. package/libsql/wasm/index.js.map +1 -1
  547. package/libsql/web/index.cjs.map +1 -1
  548. package/libsql/web/index.d.cts +6 -5
  549. package/libsql/web/index.d.ts +6 -5
  550. package/libsql/web/index.js.map +1 -1
  551. package/libsql/ws/index.cjs.map +1 -1
  552. package/libsql/ws/index.d.cts +6 -5
  553. package/libsql/ws/index.d.ts +6 -5
  554. package/libsql/ws/index.js.map +1 -1
  555. package/mysql-core/db.cjs +30 -6
  556. package/mysql-core/db.cjs.map +1 -1
  557. package/mysql-core/db.d.cts +15 -8
  558. package/mysql-core/db.d.ts +15 -8
  559. package/mysql-core/db.js +29 -5
  560. package/mysql-core/db.js.map +1 -1
  561. package/mysql-core/dialect.cjs +198 -15
  562. package/mysql-core/dialect.cjs.map +1 -1
  563. package/mysql-core/dialect.d.cts +36 -13
  564. package/mysql-core/dialect.d.ts +36 -13
  565. package/mysql-core/dialect.js +196 -22
  566. package/mysql-core/dialect.js.map +1 -1
  567. package/mysql-core/query-builders/_query.cjs +149 -0
  568. package/mysql-core/query-builders/_query.cjs.map +1 -0
  569. package/mysql-core/query-builders/_query.d.cts +44 -0
  570. package/mysql-core/query-builders/_query.d.ts +44 -0
  571. package/mysql-core/query-builders/_query.js +114 -0
  572. package/mysql-core/query-builders/_query.js.map +1 -0
  573. package/mysql-core/query-builders/count.cjs.map +1 -1
  574. package/mysql-core/query-builders/count.d.cts +1 -1
  575. package/mysql-core/query-builders/count.d.ts +1 -1
  576. package/mysql-core/query-builders/count.js.map +1 -1
  577. package/mysql-core/query-builders/query.cjs +18 -31
  578. package/mysql-core/query-builders/query.cjs.map +1 -1
  579. package/mysql-core/query-builders/query.d.cts +8 -10
  580. package/mysql-core/query-builders/query.d.ts +8 -10
  581. package/mysql-core/query-builders/query.js +18 -31
  582. package/mysql-core/query-builders/query.js.map +1 -1
  583. package/mysql-core/session.cjs +3 -2
  584. package/mysql-core/session.cjs.map +1 -1
  585. package/mysql-core/session.d.cts +10 -7
  586. package/mysql-core/session.d.ts +10 -7
  587. package/mysql-core/session.js +3 -2
  588. package/mysql-core/session.js.map +1 -1
  589. package/mysql-proxy/driver.cjs +22 -5
  590. package/mysql-proxy/driver.cjs.map +1 -1
  591. package/mysql-proxy/driver.d.cts +3 -2
  592. package/mysql-proxy/driver.d.ts +3 -2
  593. package/mysql-proxy/driver.js +12 -8
  594. package/mysql-proxy/driver.js.map +1 -1
  595. package/mysql-proxy/migrator.cjs.map +1 -1
  596. package/mysql-proxy/migrator.d.cts +2 -1
  597. package/mysql-proxy/migrator.d.ts +2 -1
  598. package/mysql-proxy/migrator.js.map +1 -1
  599. package/mysql-proxy/session.cjs +27 -2
  600. package/mysql-proxy/session.cjs.map +1 -1
  601. package/mysql-proxy/session.d.cts +13 -8
  602. package/mysql-proxy/session.d.ts +13 -8
  603. package/mysql-proxy/session.js +27 -2
  604. package/mysql-proxy/session.js.map +1 -1
  605. package/mysql2/driver.cjs +24 -7
  606. package/mysql2/driver.cjs.map +1 -1
  607. package/mysql2/driver.d.cts +10 -9
  608. package/mysql2/driver.d.ts +10 -9
  609. package/mysql2/driver.js +14 -10
  610. package/mysql2/driver.js.map +1 -1
  611. package/mysql2/migrator.cjs.map +1 -1
  612. package/mysql2/migrator.d.cts +2 -1
  613. package/mysql2/migrator.d.ts +2 -1
  614. package/mysql2/migrator.js.map +1 -1
  615. package/mysql2/session.cjs +30 -2
  616. package/mysql2/session.cjs.map +1 -1
  617. package/mysql2/session.d.cts +13 -8
  618. package/mysql2/session.d.ts +13 -8
  619. package/mysql2/session.js +30 -2
  620. package/mysql2/session.js.map +1 -1
  621. package/neon-http/driver.cjs +21 -7
  622. package/neon-http/driver.cjs.map +1 -1
  623. package/neon-http/driver.d.cts +10 -9
  624. package/neon-http/driver.d.ts +10 -9
  625. package/neon-http/driver.js +11 -7
  626. package/neon-http/driver.js.map +1 -1
  627. package/neon-http/migrator.cjs.map +1 -1
  628. package/neon-http/migrator.d.cts +2 -1
  629. package/neon-http/migrator.d.ts +2 -1
  630. package/neon-http/migrator.js.map +1 -1
  631. package/neon-http/session.cjs +32 -2
  632. package/neon-http/session.cjs.map +1 -1
  633. package/neon-http/session.d.cts +13 -8
  634. package/neon-http/session.d.ts +13 -8
  635. package/neon-http/session.js +32 -2
  636. package/neon-http/session.js.map +1 -1
  637. package/neon-serverless/driver.cjs +18 -7
  638. package/neon-serverless/driver.cjs.map +1 -1
  639. package/neon-serverless/driver.d.cts +9 -8
  640. package/neon-serverless/driver.d.ts +9 -8
  641. package/neon-serverless/driver.js +8 -10
  642. package/neon-serverless/driver.js.map +1 -1
  643. package/neon-serverless/migrator.cjs.map +1 -1
  644. package/neon-serverless/migrator.d.cts +2 -1
  645. package/neon-serverless/migrator.d.ts +2 -1
  646. package/neon-serverless/migrator.js.map +1 -1
  647. package/neon-serverless/session.cjs +40 -5
  648. package/neon-serverless/session.cjs.map +1 -1
  649. package/neon-serverless/session.d.cts +13 -8
  650. package/neon-serverless/session.d.ts +13 -8
  651. package/neon-serverless/session.js +40 -5
  652. package/neon-serverless/session.js.map +1 -1
  653. package/node-postgres/driver.cjs +13 -7
  654. package/node-postgres/driver.cjs.map +1 -1
  655. package/node-postgres/driver.d.cts +9 -8
  656. package/node-postgres/driver.d.ts +9 -8
  657. package/node-postgres/driver.js +13 -10
  658. package/node-postgres/driver.js.map +1 -1
  659. package/node-postgres/migrator.cjs.map +1 -1
  660. package/node-postgres/migrator.d.cts +2 -1
  661. package/node-postgres/migrator.d.ts +2 -1
  662. package/node-postgres/migrator.js.map +1 -1
  663. package/node-postgres/session.cjs +45 -4
  664. package/node-postgres/session.cjs.map +1 -1
  665. package/node-postgres/session.d.cts +13 -8
  666. package/node-postgres/session.d.ts +13 -8
  667. package/node-postgres/session.js +45 -4
  668. package/node-postgres/session.js.map +1 -1
  669. package/op-sqlite/driver.cjs +22 -5
  670. package/op-sqlite/driver.cjs.map +1 -1
  671. package/op-sqlite/driver.d.cts +3 -2
  672. package/op-sqlite/driver.d.ts +3 -2
  673. package/op-sqlite/driver.js +12 -8
  674. package/op-sqlite/driver.js.map +1 -1
  675. package/op-sqlite/migrator.cjs.map +1 -1
  676. package/op-sqlite/migrator.d.cts +3 -2
  677. package/op-sqlite/migrator.d.ts +3 -2
  678. package/op-sqlite/migrator.js.map +1 -1
  679. package/op-sqlite/session.cjs +47 -4
  680. package/op-sqlite/session.cjs.map +1 -1
  681. package/op-sqlite/session.d.cts +14 -8
  682. package/op-sqlite/session.d.ts +14 -8
  683. package/op-sqlite/session.js +47 -4
  684. package/op-sqlite/session.js.map +1 -1
  685. package/package.json +801 -4
  686. package/pg-core/db.cjs +32 -5
  687. package/pg-core/db.cjs.map +1 -1
  688. package/pg-core/db.d.cts +16 -9
  689. package/pg-core/db.d.ts +16 -9
  690. package/pg-core/db.js +31 -4
  691. package/pg-core/db.js.map +1 -1
  692. package/pg-core/dialect.cjs +176 -488
  693. package/pg-core/dialect.cjs.map +1 -1
  694. package/pg-core/dialect.d.cts +27 -8
  695. package/pg-core/dialect.d.ts +27 -8
  696. package/pg-core/dialect.js +174 -495
  697. package/pg-core/dialect.js.map +1 -1
  698. package/pg-core/query-builders/_query.cjs +155 -0
  699. package/pg-core/query-builders/_query.cjs.map +1 -0
  700. package/pg-core/query-builders/_query.d.cts +47 -0
  701. package/pg-core/query-builders/_query.d.ts +47 -0
  702. package/pg-core/query-builders/_query.js +120 -0
  703. package/pg-core/query-builders/_query.js.map +1 -0
  704. package/pg-core/query-builders/count.cjs.map +1 -1
  705. package/pg-core/query-builders/count.d.cts +1 -1
  706. package/pg-core/query-builders/count.d.ts +1 -1
  707. package/pg-core/query-builders/count.js.map +1 -1
  708. package/pg-core/query-builders/query.cjs +15 -18
  709. package/pg-core/query-builders/query.cjs.map +1 -1
  710. package/pg-core/query-builders/query.d.cts +6 -6
  711. package/pg-core/query-builders/query.d.ts +6 -6
  712. package/pg-core/query-builders/query.js +15 -18
  713. package/pg-core/query-builders/query.js.map +1 -1
  714. package/pg-core/session.cjs +3 -2
  715. package/pg-core/session.cjs.map +1 -1
  716. package/pg-core/session.d.cts +9 -6
  717. package/pg-core/session.d.ts +9 -6
  718. package/pg-core/session.js +3 -2
  719. package/pg-core/session.js.map +1 -1
  720. package/pg-core/table.cjs +2 -0
  721. package/pg-core/table.cjs.map +1 -1
  722. package/pg-core/table.js +2 -0
  723. package/pg-core/table.js.map +1 -1
  724. package/pg-proxy/driver.cjs +21 -5
  725. package/pg-proxy/driver.cjs.map +1 -1
  726. package/pg-proxy/driver.d.cts +3 -2
  727. package/pg-proxy/driver.d.ts +3 -2
  728. package/pg-proxy/driver.js +11 -8
  729. package/pg-proxy/driver.js.map +1 -1
  730. package/pg-proxy/migrator.cjs.map +1 -1
  731. package/pg-proxy/migrator.d.cts +2 -1
  732. package/pg-proxy/migrator.d.ts +2 -1
  733. package/pg-proxy/migrator.js.map +1 -1
  734. package/pg-proxy/session.cjs +37 -2
  735. package/pg-proxy/session.cjs.map +1 -1
  736. package/pg-proxy/session.d.cts +13 -8
  737. package/pg-proxy/session.d.ts +13 -8
  738. package/pg-proxy/session.js +37 -2
  739. package/pg-proxy/session.js.map +1 -1
  740. package/pglite/driver.cjs +23 -7
  741. package/pglite/driver.cjs.map +1 -1
  742. package/pglite/driver.d.cts +9 -8
  743. package/pglite/driver.d.ts +9 -8
  744. package/pglite/driver.js +13 -10
  745. package/pglite/driver.js.map +1 -1
  746. package/pglite/migrator.cjs.map +1 -1
  747. package/pglite/migrator.d.cts +2 -1
  748. package/pglite/migrator.d.ts +2 -1
  749. package/pglite/migrator.js.map +1 -1
  750. package/pglite/session.cjs +34 -3
  751. package/pglite/session.cjs.map +1 -1
  752. package/pglite/session.d.cts +13 -8
  753. package/pglite/session.d.ts +13 -8
  754. package/pglite/session.js +34 -3
  755. package/pglite/session.js.map +1 -1
  756. package/planetscale-serverless/driver.cjs +22 -5
  757. package/planetscale-serverless/driver.cjs.map +1 -1
  758. package/planetscale-serverless/driver.d.cts +7 -6
  759. package/planetscale-serverless/driver.d.ts +7 -6
  760. package/planetscale-serverless/driver.js +12 -8
  761. package/planetscale-serverless/driver.js.map +1 -1
  762. package/planetscale-serverless/migrator.cjs.map +1 -1
  763. package/planetscale-serverless/migrator.d.cts +2 -1
  764. package/planetscale-serverless/migrator.d.ts +2 -1
  765. package/planetscale-serverless/migrator.js.map +1 -1
  766. package/planetscale-serverless/session.cjs +45 -5
  767. package/planetscale-serverless/session.cjs.map +1 -1
  768. package/planetscale-serverless/session.d.cts +14 -9
  769. package/planetscale-serverless/session.d.ts +14 -9
  770. package/planetscale-serverless/session.js +45 -5
  771. package/planetscale-serverless/session.js.map +1 -1
  772. package/postgres-js/driver.cjs +6 -5
  773. package/postgres-js/driver.cjs.map +1 -1
  774. package/postgres-js/driver.d.cts +7 -6
  775. package/postgres-js/driver.d.ts +7 -6
  776. package/postgres-js/driver.js +6 -8
  777. package/postgres-js/driver.js.map +1 -1
  778. package/postgres-js/migrator.cjs.map +1 -1
  779. package/postgres-js/migrator.d.cts +2 -1
  780. package/postgres-js/migrator.d.ts +2 -1
  781. package/postgres-js/migrator.js.map +1 -1
  782. package/postgres-js/session.cjs +51 -6
  783. package/postgres-js/session.cjs.map +1 -1
  784. package/postgres-js/session.d.cts +15 -9
  785. package/postgres-js/session.d.ts +15 -9
  786. package/postgres-js/session.js +51 -6
  787. package/postgres-js/session.js.map +1 -1
  788. package/prisma/mysql/driver.cjs +1 -1
  789. package/prisma/mysql/driver.cjs.map +1 -1
  790. package/prisma/mysql/driver.js +1 -1
  791. package/prisma/mysql/driver.js.map +1 -1
  792. package/prisma/mysql/session.cjs +3 -0
  793. package/prisma/mysql/session.cjs.map +1 -1
  794. package/prisma/mysql/session.d.cts +3 -1
  795. package/prisma/mysql/session.d.ts +3 -1
  796. package/prisma/mysql/session.js +3 -0
  797. package/prisma/mysql/session.js.map +1 -1
  798. package/prisma/pg/driver.cjs +1 -1
  799. package/prisma/pg/driver.cjs.map +1 -1
  800. package/prisma/pg/driver.js +1 -1
  801. package/prisma/pg/driver.js.map +1 -1
  802. package/prisma/pg/session.cjs +3 -0
  803. package/prisma/pg/session.cjs.map +1 -1
  804. package/prisma/pg/session.d.cts +3 -1
  805. package/prisma/pg/session.d.ts +3 -1
  806. package/prisma/pg/session.js +3 -0
  807. package/prisma/pg/session.js.map +1 -1
  808. package/prisma/sqlite/driver.cjs +1 -1
  809. package/prisma/sqlite/driver.cjs.map +1 -1
  810. package/prisma/sqlite/driver.js +1 -1
  811. package/prisma/sqlite/driver.js.map +1 -1
  812. package/prisma/sqlite/session.cjs +3 -0
  813. package/prisma/sqlite/session.cjs.map +1 -1
  814. package/prisma/sqlite/session.d.cts +4 -2
  815. package/prisma/sqlite/session.d.ts +4 -2
  816. package/prisma/sqlite/session.js +3 -0
  817. package/prisma/sqlite/session.js.map +1 -1
  818. package/relations.cjs +657 -245
  819. package/relations.cjs.map +1 -1
  820. package/relations.d.cts +339 -140
  821. package/relations.d.ts +339 -140
  822. package/relations.js +643 -240
  823. package/relations.js.map +1 -1
  824. package/singlestore/driver.cjs +1 -1
  825. package/singlestore/driver.cjs.map +1 -1
  826. package/singlestore/driver.d.cts +1 -1
  827. package/singlestore/driver.d.ts +1 -1
  828. package/singlestore/driver.js +3 -3
  829. package/singlestore/driver.js.map +1 -1
  830. package/singlestore/session.cjs.map +1 -1
  831. package/singlestore/session.d.cts +4 -4
  832. package/singlestore/session.d.ts +4 -4
  833. package/singlestore/session.js.map +1 -1
  834. package/singlestore-core/db.cjs.map +1 -1
  835. package/singlestore-core/db.d.cts +3 -3
  836. package/singlestore-core/db.d.ts +3 -3
  837. package/singlestore-core/db.js.map +1 -1
  838. package/singlestore-core/dialect.cjs +16 -6
  839. package/singlestore-core/dialect.cjs.map +1 -1
  840. package/singlestore-core/dialect.d.cts +6 -6
  841. package/singlestore-core/dialect.d.ts +6 -6
  842. package/singlestore-core/dialect.js +6 -12
  843. package/singlestore-core/dialect.js.map +1 -1
  844. package/singlestore-core/query-builders/query.cjs +12 -2
  845. package/singlestore-core/query-builders/query.cjs.map +1 -1
  846. package/singlestore-core/query-builders/query.d.cts +6 -6
  847. package/singlestore-core/query-builders/query.d.ts +6 -6
  848. package/singlestore-core/query-builders/query.js +2 -4
  849. package/singlestore-core/query-builders/query.js.map +1 -1
  850. package/singlestore-core/session.cjs.map +1 -1
  851. package/singlestore-core/session.d.cts +5 -5
  852. package/singlestore-core/session.d.ts +5 -5
  853. package/singlestore-core/session.js.map +1 -1
  854. package/singlestore-proxy/driver.cjs +1 -1
  855. package/singlestore-proxy/driver.cjs.map +1 -1
  856. package/singlestore-proxy/driver.js +3 -3
  857. package/singlestore-proxy/driver.js.map +1 -1
  858. package/singlestore-proxy/session.cjs.map +1 -1
  859. package/singlestore-proxy/session.d.cts +4 -4
  860. package/singlestore-proxy/session.d.ts +4 -4
  861. package/singlestore-proxy/session.js.map +1 -1
  862. package/sql/expressions/conditions.cjs.map +1 -1
  863. package/sql/expressions/conditions.d.cts +4 -4
  864. package/sql/expressions/conditions.d.ts +4 -4
  865. package/sql/expressions/conditions.js.map +1 -1
  866. package/sql/sql.cjs +21 -0
  867. package/sql/sql.cjs.map +1 -1
  868. package/sql/sql.d.cts +8 -8
  869. package/sql/sql.d.ts +8 -8
  870. package/sql/sql.js +22 -1
  871. package/sql/sql.js.map +1 -1
  872. package/sql-js/driver.cjs +16 -5
  873. package/sql-js/driver.cjs.map +1 -1
  874. package/sql-js/driver.d.cts +3 -2
  875. package/sql-js/driver.d.ts +3 -2
  876. package/sql-js/driver.js +6 -8
  877. package/sql-js/driver.js.map +1 -1
  878. package/sql-js/migrator.cjs.map +1 -1
  879. package/sql-js/migrator.d.cts +2 -1
  880. package/sql-js/migrator.d.ts +2 -1
  881. package/sql-js/migrator.js.map +1 -1
  882. package/sql-js/session.cjs +71 -36
  883. package/sql-js/session.cjs.map +1 -1
  884. package/sql-js/session.d.cts +16 -13
  885. package/sql-js/session.d.ts +16 -13
  886. package/sql-js/session.js +71 -36
  887. package/sql-js/session.js.map +1 -1
  888. package/sqlite-core/db.cjs +39 -12
  889. package/sqlite-core/db.cjs.map +1 -1
  890. package/sqlite-core/db.d.cts +16 -8
  891. package/sqlite-core/db.d.ts +16 -8
  892. package/sqlite-core/db.js +38 -11
  893. package/sqlite-core/db.js.map +1 -1
  894. package/sqlite-core/dialect.cjs +187 -7
  895. package/sqlite-core/dialect.cjs.map +1 -1
  896. package/sqlite-core/dialect.d.cts +31 -9
  897. package/sqlite-core/dialect.d.ts +31 -9
  898. package/sqlite-core/dialect.js +185 -14
  899. package/sqlite-core/dialect.js.map +1 -1
  900. package/sqlite-core/query-builders/_query.cjs +187 -0
  901. package/sqlite-core/query-builders/_query.cjs.map +1 -0
  902. package/sqlite-core/query-builders/_query.d.cts +55 -0
  903. package/sqlite-core/query-builders/_query.d.ts +55 -0
  904. package/sqlite-core/query-builders/_query.js +151 -0
  905. package/sqlite-core/query-builders/_query.js.map +1 -0
  906. package/sqlite-core/query-builders/count.cjs.map +1 -1
  907. package/sqlite-core/query-builders/count.d.cts +1 -1
  908. package/sqlite-core/query-builders/count.d.ts +1 -1
  909. package/sqlite-core/query-builders/count.js.map +1 -1
  910. package/sqlite-core/query-builders/delete.cjs.map +1 -1
  911. package/sqlite-core/query-builders/delete.d.cts +1 -1
  912. package/sqlite-core/query-builders/delete.d.ts +1 -1
  913. package/sqlite-core/query-builders/delete.js.map +1 -1
  914. package/sqlite-core/query-builders/insert.cjs.map +1 -1
  915. package/sqlite-core/query-builders/insert.d.cts +3 -3
  916. package/sqlite-core/query-builders/insert.d.ts +3 -3
  917. package/sqlite-core/query-builders/insert.js.map +1 -1
  918. package/sqlite-core/query-builders/query.cjs +56 -35
  919. package/sqlite-core/query-builders/query.cjs.map +1 -1
  920. package/sqlite-core/query-builders/query.d.cts +18 -17
  921. package/sqlite-core/query-builders/query.d.ts +18 -17
  922. package/sqlite-core/query-builders/query.js +56 -35
  923. package/sqlite-core/query-builders/query.js.map +1 -1
  924. package/sqlite-core/query-builders/select.cjs.map +1 -1
  925. package/sqlite-core/query-builders/select.d.cts +3 -3
  926. package/sqlite-core/query-builders/select.d.ts +3 -3
  927. package/sqlite-core/query-builders/select.js.map +1 -1
  928. package/sqlite-core/query-builders/update.cjs.map +1 -1
  929. package/sqlite-core/query-builders/update.d.cts +3 -3
  930. package/sqlite-core/query-builders/update.d.ts +3 -3
  931. package/sqlite-core/query-builders/update.js.map +1 -1
  932. package/sqlite-core/session.cjs +6 -2
  933. package/sqlite-core/session.cjs.map +1 -1
  934. package/sqlite-core/session.d.cts +15 -7
  935. package/sqlite-core/session.d.ts +15 -7
  936. package/sqlite-core/session.js +6 -2
  937. package/sqlite-core/session.js.map +1 -1
  938. package/sqlite-proxy/driver.cjs +23 -5
  939. package/sqlite-proxy/driver.cjs.map +1 -1
  940. package/sqlite-proxy/driver.d.cts +4 -3
  941. package/sqlite-proxy/driver.d.ts +4 -3
  942. package/sqlite-proxy/driver.js +13 -5
  943. package/sqlite-proxy/driver.js.map +1 -1
  944. package/sqlite-proxy/migrator.cjs.map +1 -1
  945. package/sqlite-proxy/migrator.d.cts +2 -1
  946. package/sqlite-proxy/migrator.d.ts +2 -1
  947. package/sqlite-proxy/migrator.js.map +1 -1
  948. package/sqlite-proxy/session.cjs +50 -6
  949. package/sqlite-proxy/session.cjs.map +1 -1
  950. package/sqlite-proxy/session.d.cts +14 -8
  951. package/sqlite-proxy/session.d.ts +14 -8
  952. package/sqlite-proxy/session.js +50 -6
  953. package/sqlite-proxy/session.js.map +1 -1
  954. package/table.cjs.map +1 -1
  955. package/table.d.cts +2 -2
  956. package/table.d.ts +2 -2
  957. package/table.js.map +1 -1
  958. package/tidb-serverless/driver.cjs +22 -5
  959. package/tidb-serverless/driver.cjs.map +1 -1
  960. package/tidb-serverless/driver.d.cts +7 -6
  961. package/tidb-serverless/driver.d.ts +7 -6
  962. package/tidb-serverless/driver.js +12 -8
  963. package/tidb-serverless/driver.js.map +1 -1
  964. package/tidb-serverless/migrator.cjs.map +1 -1
  965. package/tidb-serverless/migrator.d.cts +2 -1
  966. package/tidb-serverless/migrator.d.ts +2 -1
  967. package/tidb-serverless/migrator.js.map +1 -1
  968. package/tidb-serverless/session.cjs +62 -5
  969. package/tidb-serverless/session.cjs.map +1 -1
  970. package/tidb-serverless/session.d.cts +14 -9
  971. package/tidb-serverless/session.d.ts +14 -9
  972. package/tidb-serverless/session.js +62 -5
  973. package/tidb-serverless/session.js.map +1 -1
  974. package/utils.cjs +2 -2
  975. package/utils.cjs.map +1 -1
  976. package/utils.d.cts +3 -1
  977. package/utils.d.ts +3 -1
  978. package/utils.js +2 -2
  979. package/utils.js.map +1 -1
  980. package/vercel-postgres/driver.cjs +23 -7
  981. package/vercel-postgres/driver.cjs.map +1 -1
  982. package/vercel-postgres/driver.d.cts +9 -8
  983. package/vercel-postgres/driver.d.ts +9 -8
  984. package/vercel-postgres/driver.js +13 -10
  985. package/vercel-postgres/driver.js.map +1 -1
  986. package/vercel-postgres/migrator.cjs.map +1 -1
  987. package/vercel-postgres/migrator.d.cts +2 -1
  988. package/vercel-postgres/migrator.d.ts +2 -1
  989. package/vercel-postgres/migrator.js.map +1 -1
  990. package/vercel-postgres/session.cjs +34 -4
  991. package/vercel-postgres/session.cjs.map +1 -1
  992. package/vercel-postgres/session.d.cts +13 -8
  993. package/vercel-postgres/session.d.ts +13 -8
  994. package/vercel-postgres/session.js +34 -4
  995. package/vercel-postgres/session.js.map +1 -1
  996. package/version.cjs +1 -1
  997. package/version.d.cts +1 -1
  998. package/version.d.ts +1 -1
  999. package/version.js +1 -1
  1000. package/xata-http/driver.cjs +17 -5
  1001. package/xata-http/driver.cjs.map +1 -1
  1002. package/xata-http/driver.d.cts +5 -4
  1003. package/xata-http/driver.d.ts +5 -4
  1004. package/xata-http/driver.js +7 -5
  1005. package/xata-http/driver.js.map +1 -1
  1006. package/xata-http/migrator.cjs.map +1 -1
  1007. package/xata-http/migrator.d.cts +2 -1
  1008. package/xata-http/migrator.d.ts +2 -1
  1009. package/xata-http/migrator.js.map +1 -1
  1010. package/xata-http/session.cjs +30 -2
  1011. package/xata-http/session.cjs.map +1 -1
  1012. package/xata-http/session.d.cts +13 -8
  1013. package/xata-http/session.d.ts +13 -8
  1014. package/xata-http/session.js +30 -2
  1015. package/xata-http/session.js.map +1 -1
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,12 +17,21 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var dialect_exports = {};
20
30
  __export(dialect_exports, {
21
31
  PgDialect: () => PgDialect
22
32
  });
23
33
  module.exports = __toCommonJS(dialect_exports);
34
+ var V1 = __toESM(require("../_relations.cjs"), 1);
24
35
  var import_alias = require("../alias.cjs");
25
36
  var import_casing = require("../casing.cjs");
26
37
  var import_column = require("../column.cjs");
@@ -426,488 +437,8 @@ class PgDialect {
426
437
  invokeSource
427
438
  });
428
439
  }
429
- // buildRelationalQueryWithPK({
430
- // fullSchema,
431
- // schema,
432
- // tableNamesMap,
433
- // table,
434
- // tableConfig,
435
- // queryConfig: config,
436
- // tableAlias,
437
- // isRoot = false,
438
- // joinOn,
439
- // }: {
440
- // fullSchema: Record<string, unknown>;
441
- // schema: TablesRelationalConfig;
442
- // tableNamesMap: Record<string, string>;
443
- // table: PgTable;
444
- // tableConfig: TableRelationalConfig;
445
- // queryConfig: true | DBQueryConfig<'many', true>;
446
- // tableAlias: string;
447
- // isRoot?: boolean;
448
- // joinOn?: SQL;
449
- // }): BuildRelationalQueryResult<PgTable, PgColumn> {
450
- // // For { "<relation>": true }, return a table with selection of all columns
451
- // if (config === true) {
452
- // const selectionEntries = Object.entries(tableConfig.columns);
453
- // const selection: BuildRelationalQueryResult<PgTable, PgColumn>['selection'] = selectionEntries.map((
454
- // [key, value],
455
- // ) => ({
456
- // dbKey: value.name,
457
- // tsKey: key,
458
- // field: value as PgColumn,
459
- // relationTableTsKey: undefined,
460
- // isJson: false,
461
- // selection: [],
462
- // }));
463
- // return {
464
- // tableTsKey: tableConfig.tsName,
465
- // sql: table,
466
- // selection,
467
- // };
468
- // }
469
- // // let selection: BuildRelationalQueryResult<PgTable, PgColumn>['selection'] = [];
470
- // // let selectionForBuild = selection;
471
- // const aliasedColumns = Object.fromEntries(
472
- // Object.entries(tableConfig.columns).map(([key, value]) => [key, aliasedTableColumn(value, tableAlias)]),
473
- // );
474
- // const aliasedRelations = Object.fromEntries(
475
- // Object.entries(tableConfig.relations).map(([key, value]) => [key, aliasedRelation(value, tableAlias)]),
476
- // );
477
- // const aliasedFields = Object.assign({}, aliasedColumns, aliasedRelations);
478
- // let where, hasUserDefinedWhere;
479
- // if (config.where) {
480
- // const whereSql = typeof config.where === 'function' ? config.where(aliasedFields, operators) : config.where;
481
- // where = whereSql && mapColumnsInSQLToAlias(whereSql, tableAlias);
482
- // hasUserDefinedWhere = !!where;
483
- // }
484
- // where = and(joinOn, where);
485
- // // const fieldsSelection: { tsKey: string; value: PgColumn | SQL.Aliased; isExtra?: boolean }[] = [];
486
- // let joins: Join[] = [];
487
- // let selectedColumns: string[] = [];
488
- // // Figure out which columns to select
489
- // if (config.columns) {
490
- // let isIncludeMode = false;
491
- // for (const [field, value] of Object.entries(config.columns)) {
492
- // if (value === undefined) {
493
- // continue;
494
- // }
495
- // if (field in tableConfig.columns) {
496
- // if (!isIncludeMode && value === true) {
497
- // isIncludeMode = true;
498
- // }
499
- // selectedColumns.push(field);
500
- // }
501
- // }
502
- // if (selectedColumns.length > 0) {
503
- // selectedColumns = isIncludeMode
504
- // ? selectedColumns.filter((c) => config.columns?.[c] === true)
505
- // : Object.keys(tableConfig.columns).filter((key) => !selectedColumns.includes(key));
506
- // }
507
- // } else {
508
- // // Select all columns if selection is not specified
509
- // selectedColumns = Object.keys(tableConfig.columns);
510
- // }
511
- // // for (const field of selectedColumns) {
512
- // // const column = tableConfig.columns[field]! as PgColumn;
513
- // // fieldsSelection.push({ tsKey: field, value: column });
514
- // // }
515
- // let initiallySelectedRelations: {
516
- // tsKey: string;
517
- // queryConfig: true | DBQueryConfig<'many', false>;
518
- // relation: Relation;
519
- // }[] = [];
520
- // // let selectedRelations: BuildRelationalQueryResult<PgTable, PgColumn>['selection'] = [];
521
- // // Figure out which relations to select
522
- // if (config.with) {
523
- // initiallySelectedRelations = Object.entries(config.with)
524
- // .filter((entry): entry is [typeof entry[0], NonNullable<typeof entry[1]>] => !!entry[1])
525
- // .map(([tsKey, queryConfig]) => ({ tsKey, queryConfig, relation: tableConfig.relations[tsKey]! }));
526
- // }
527
- // const manyRelations = initiallySelectedRelations.filter((r) =>
528
- // is(r.relation, Many)
529
- // && (schema[tableNamesMap[r.relation.referencedTable[Table.Symbol.Name]]!]?.primaryKey.length ?? 0) > 0
530
- // );
531
- // // If this is the last Many relation (or there are no Many relations), we are on the innermost subquery level
532
- // const isInnermostQuery = manyRelations.length < 2;
533
- // const selectedExtras: {
534
- // tsKey: string;
535
- // value: SQL.Aliased;
536
- // }[] = [];
537
- // // Figure out which extras to select
538
- // if (isInnermostQuery && config.extras) {
539
- // const extras = typeof config.extras === 'function'
540
- // ? config.extras(aliasedFields, { sql })
541
- // : config.extras;
542
- // for (const [tsKey, value] of Object.entries(extras)) {
543
- // selectedExtras.push({
544
- // tsKey,
545
- // value: mapColumnsInAliasedSQLToAlias(value, tableAlias),
546
- // });
547
- // }
548
- // }
549
- // // Transform `fieldsSelection` into `selection`
550
- // // `fieldsSelection` shouldn't be used after this point
551
- // // for (const { tsKey, value, isExtra } of fieldsSelection) {
552
- // // selection.push({
553
- // // dbKey: is(value, SQL.Aliased) ? value.fieldAlias : tableConfig.columns[tsKey]!.name,
554
- // // tsKey,
555
- // // field: is(value, Column) ? aliasedTableColumn(value, tableAlias) : value,
556
- // // relationTableTsKey: undefined,
557
- // // isJson: false,
558
- // // isExtra,
559
- // // selection: [],
560
- // // });
561
- // // }
562
- // let orderByOrig = typeof config.orderBy === 'function'
563
- // ? config.orderBy(aliasedFields, orderByOperators)
564
- // : config.orderBy ?? [];
565
- // if (!Array.isArray(orderByOrig)) {
566
- // orderByOrig = [orderByOrig];
567
- // }
568
- // const orderBy = orderByOrig.map((orderByValue) => {
569
- // if (is(orderByValue, Column)) {
570
- // return aliasedTableColumn(orderByValue, tableAlias) as PgColumn;
571
- // }
572
- // return mapColumnsInSQLToAlias(orderByValue, tableAlias);
573
- // });
574
- // const limit = isInnermostQuery ? config.limit : undefined;
575
- // const offset = isInnermostQuery ? config.offset : undefined;
576
- // // For non-root queries without additional config except columns, return a table with selection
577
- // if (
578
- // !isRoot
579
- // && initiallySelectedRelations.length === 0
580
- // && selectedExtras.length === 0
581
- // && !where
582
- // && orderBy.length === 0
583
- // && limit === undefined
584
- // && offset === undefined
585
- // ) {
586
- // return {
587
- // tableTsKey: tableConfig.tsName,
588
- // sql: table,
589
- // selection: selectedColumns.map((key) => ({
590
- // dbKey: tableConfig.columns[key]!.name,
591
- // tsKey: key,
592
- // field: tableConfig.columns[key] as PgColumn,
593
- // relationTableTsKey: undefined,
594
- // isJson: false,
595
- // selection: [],
596
- // })),
597
- // };
598
- // }
599
- // const selectedRelationsWithoutPK:
600
- // // Process all relations without primary keys, because they need to be joined differently and will all be on the same query level
601
- // for (
602
- // const {
603
- // tsKey: selectedRelationTsKey,
604
- // queryConfig: selectedRelationConfigValue,
605
- // relation,
606
- // } of initiallySelectedRelations
607
- // ) {
608
- // const normalizedRelation = normalizeRelation(schema, tableNamesMap, relation);
609
- // const relationTableName = relation.referencedTable[Table.Symbol.Name];
610
- // const relationTableTsName = tableNamesMap[relationTableName]!;
611
- // const relationTable = schema[relationTableTsName]!;
612
- // if (relationTable.primaryKey.length > 0) {
613
- // continue;
614
- // }
615
- // const relationTableAlias = `${tableAlias}_${selectedRelationTsKey}`;
616
- // const joinOn = and(
617
- // ...normalizedRelation.fields.map((field, i) =>
618
- // eq(
619
- // aliasedTableColumn(normalizedRelation.references[i]!, relationTableAlias),
620
- // aliasedTableColumn(field, tableAlias),
621
- // )
622
- // ),
623
- // );
624
- // const builtRelation = this.buildRelationalQueryWithoutPK({
625
- // fullSchema,
626
- // schema,
627
- // tableNamesMap,
628
- // table: fullSchema[relationTableTsName] as PgTable,
629
- // tableConfig: schema[relationTableTsName]!,
630
- // queryConfig: selectedRelationConfigValue,
631
- // tableAlias: relationTableAlias,
632
- // joinOn,
633
- // nestedQueryRelation: relation,
634
- // });
635
- // const field = sql`${sql.identifier(relationTableAlias)}.${sql.identifier('data')}`.as(selectedRelationTsKey);
636
- // joins.push({
637
- // on: sql`true`,
638
- // table: new Subquery(builtRelation.sql as SQL, {}, relationTableAlias),
639
- // alias: relationTableAlias,
640
- // joinType: 'left',
641
- // lateral: true,
642
- // });
643
- // selectedRelations.push({
644
- // dbKey: selectedRelationTsKey,
645
- // tsKey: selectedRelationTsKey,
646
- // field,
647
- // relationTableTsKey: relationTableTsName,
648
- // isJson: true,
649
- // selection: builtRelation.selection,
650
- // });
651
- // }
652
- // const oneRelations = initiallySelectedRelations.filter((r): r is typeof r & { relation: One } =>
653
- // is(r.relation, One)
654
- // );
655
- // // Process all One relations with PKs, because they can all be joined on the same level
656
- // for (
657
- // const {
658
- // tsKey: selectedRelationTsKey,
659
- // queryConfig: selectedRelationConfigValue,
660
- // relation,
661
- // } of oneRelations
662
- // ) {
663
- // const normalizedRelation = normalizeRelation(schema, tableNamesMap, relation);
664
- // const relationTableName = relation.referencedTable[Table.Symbol.Name];
665
- // const relationTableTsName = tableNamesMap[relationTableName]!;
666
- // const relationTableAlias = `${tableAlias}_${selectedRelationTsKey}`;
667
- // const relationTable = schema[relationTableTsName]!;
668
- // if (relationTable.primaryKey.length === 0) {
669
- // continue;
670
- // }
671
- // const joinOn = and(
672
- // ...normalizedRelation.fields.map((field, i) =>
673
- // eq(
674
- // aliasedTableColumn(normalizedRelation.references[i]!, relationTableAlias),
675
- // aliasedTableColumn(field, tableAlias),
676
- // )
677
- // ),
678
- // );
679
- // const builtRelation = this.buildRelationalQueryWithPK({
680
- // fullSchema,
681
- // schema,
682
- // tableNamesMap,
683
- // table: fullSchema[relationTableTsName] as PgTable,
684
- // tableConfig: schema[relationTableTsName]!,
685
- // queryConfig: selectedRelationConfigValue,
686
- // tableAlias: relationTableAlias,
687
- // joinOn,
688
- // });
689
- // const field = sql`case when ${sql.identifier(relationTableAlias)} is null then null else json_build_array(${
690
- // sql.join(
691
- // builtRelation.selection.map(({ field }) =>
692
- // is(field, SQL.Aliased)
693
- // ? sql`${sql.identifier(relationTableAlias)}.${sql.identifier(field.fieldAlias)}`
694
- // : is(field, Column)
695
- // ? aliasedTableColumn(field, relationTableAlias)
696
- // : field
697
- // ),
698
- // sql`, `,
699
- // )
700
- // }) end`.as(selectedRelationTsKey);
701
- // const isLateralJoin = is(builtRelation.sql, SQL);
702
- // joins.push({
703
- // on: isLateralJoin ? sql`true` : joinOn,
704
- // table: is(builtRelation.sql, SQL)
705
- // ? new Subquery(builtRelation.sql, {}, relationTableAlias)
706
- // : aliasedTable(builtRelation.sql, relationTableAlias),
707
- // alias: relationTableAlias,
708
- // joinType: 'left',
709
- // lateral: is(builtRelation.sql, SQL),
710
- // });
711
- // selectedRelations.push({
712
- // dbKey: selectedRelationTsKey,
713
- // tsKey: selectedRelationTsKey,
714
- // field,
715
- // relationTableTsKey: relationTableTsName,
716
- // isJson: true,
717
- // selection: builtRelation.selection,
718
- // });
719
- // }
720
- // let distinct: PgSelectConfig['distinct'];
721
- // let tableFrom: PgTable | Subquery = table;
722
- // // Process first Many relation - each one requires a nested subquery
723
- // const manyRelation = manyRelations[0];
724
- // if (manyRelation) {
725
- // const {
726
- // tsKey: selectedRelationTsKey,
727
- // queryConfig: selectedRelationQueryConfig,
728
- // relation,
729
- // } = manyRelation;
730
- // distinct = {
731
- // on: tableConfig.primaryKey.map((c) => aliasedTableColumn(c as PgColumn, tableAlias)),
732
- // };
733
- // const normalizedRelation = normalizeRelation(schema, tableNamesMap, relation);
734
- // const relationTableName = relation.referencedTable[Table.Symbol.Name];
735
- // const relationTableTsName = tableNamesMap[relationTableName]!;
736
- // const relationTableAlias = `${tableAlias}_${selectedRelationTsKey}`;
737
- // const joinOn = and(
738
- // ...normalizedRelation.fields.map((field, i) =>
739
- // eq(
740
- // aliasedTableColumn(normalizedRelation.references[i]!, relationTableAlias),
741
- // aliasedTableColumn(field, tableAlias),
742
- // )
743
- // ),
744
- // );
745
- // const builtRelationJoin = this.buildRelationalQueryWithPK({
746
- // fullSchema,
747
- // schema,
748
- // tableNamesMap,
749
- // table: fullSchema[relationTableTsName] as PgTable,
750
- // tableConfig: schema[relationTableTsName]!,
751
- // queryConfig: selectedRelationQueryConfig,
752
- // tableAlias: relationTableAlias,
753
- // joinOn,
754
- // });
755
- // const builtRelationSelectionField = sql`case when ${
756
- // sql.identifier(relationTableAlias)
757
- // } is null then '[]' else json_agg(json_build_array(${
758
- // sql.join(
759
- // builtRelationJoin.selection.map(({ field }) =>
760
- // is(field, SQL.Aliased)
761
- // ? sql`${sql.identifier(relationTableAlias)}.${sql.identifier(field.fieldAlias)}`
762
- // : is(field, Column)
763
- // ? aliasedTableColumn(field, relationTableAlias)
764
- // : field
765
- // ),
766
- // sql`, `,
767
- // )
768
- // })) over (partition by ${sql.join(distinct.on, sql`, `)}) end`.as(selectedRelationTsKey);
769
- // const isLateralJoin = is(builtRelationJoin.sql, SQL);
770
- // joins.push({
771
- // on: isLateralJoin ? sql`true` : joinOn,
772
- // table: isLateralJoin
773
- // ? new Subquery(builtRelationJoin.sql as SQL, {}, relationTableAlias)
774
- // : aliasedTable(builtRelationJoin.sql as PgTable, relationTableAlias),
775
- // alias: relationTableAlias,
776
- // joinType: 'left',
777
- // lateral: isLateralJoin,
778
- // });
779
- // // Build the "from" subquery with the remaining Many relations
780
- // const builtTableFrom = this.buildRelationalQueryWithPK({
781
- // fullSchema,
782
- // schema,
783
- // tableNamesMap,
784
- // table,
785
- // tableConfig,
786
- // queryConfig: {
787
- // ...config,
788
- // where: undefined,
789
- // orderBy: undefined,
790
- // limit: undefined,
791
- // offset: undefined,
792
- // with: manyRelations.slice(1).reduce<NonNullable<typeof config['with']>>(
793
- // (result, { tsKey, queryConfig: configValue }) => {
794
- // result[tsKey] = configValue;
795
- // return result;
796
- // },
797
- // {},
798
- // ),
799
- // },
800
- // tableAlias,
801
- // });
802
- // selectedRelations.push({
803
- // dbKey: selectedRelationTsKey,
804
- // tsKey: selectedRelationTsKey,
805
- // field: builtRelationSelectionField,
806
- // relationTableTsKey: relationTableTsName,
807
- // isJson: true,
808
- // selection: builtRelationJoin.selection,
809
- // });
810
- // // selection = builtTableFrom.selection.map((item) =>
811
- // // is(item.field, SQL.Aliased)
812
- // // ? { ...item, field: sql`${sql.identifier(tableAlias)}.${sql.identifier(item.field.fieldAlias)}` }
813
- // // : item
814
- // // );
815
- // // selectionForBuild = [{
816
- // // dbKey: '*',
817
- // // tsKey: '*',
818
- // // field: sql`${sql.identifier(tableAlias)}.*`,
819
- // // selection: [],
820
- // // isJson: false,
821
- // // relationTableTsKey: undefined,
822
- // // }];
823
- // // const newSelectionItem: (typeof selection)[number] = {
824
- // // dbKey: selectedRelationTsKey,
825
- // // tsKey: selectedRelationTsKey,
826
- // // field,
827
- // // relationTableTsKey: relationTableTsName,
828
- // // isJson: true,
829
- // // selection: builtRelationJoin.selection,
830
- // // };
831
- // // selection.push(newSelectionItem);
832
- // // selectionForBuild.push(newSelectionItem);
833
- // tableFrom = is(builtTableFrom.sql, PgTable)
834
- // ? builtTableFrom.sql
835
- // : new Subquery(builtTableFrom.sql, {}, tableAlias);
836
- // }
837
- // if (selectedColumns.length === 0 && selectedRelations.length === 0 && selectedExtras.length === 0) {
838
- // throw new DrizzleError(`No fields selected for table "${tableConfig.tsName}" ("${tableAlias}")`);
839
- // }
840
- // let selection: BuildRelationalQueryResult<PgTable, PgColumn>['selection'];
841
- // function prepareSelectedColumns() {
842
- // return selectedColumns.map((key) => ({
843
- // dbKey: tableConfig.columns[key]!.name,
844
- // tsKey: key,
845
- // field: tableConfig.columns[key] as PgColumn,
846
- // relationTableTsKey: undefined,
847
- // isJson: false,
848
- // selection: [],
849
- // }));
850
- // }
851
- // function prepareSelectedExtras() {
852
- // return selectedExtras.map((item) => ({
853
- // dbKey: item.value.fieldAlias,
854
- // tsKey: item.tsKey,
855
- // field: item.value,
856
- // relationTableTsKey: undefined,
857
- // isJson: false,
858
- // selection: [],
859
- // }));
860
- // }
861
- // if (isRoot) {
862
- // selection = [
863
- // ...prepareSelectedColumns(),
864
- // ...prepareSelectedExtras(),
865
- // ];
866
- // }
867
- // if (hasUserDefinedWhere || orderBy.length > 0) {
868
- // tableFrom = new Subquery(
869
- // this.buildSelectQuery({
870
- // table: is(tableFrom, PgTable) ? aliasedTable(tableFrom, tableAlias) : tableFrom,
871
- // fields: {},
872
- // fieldsFlat: selectionForBuild.map(({ field }) => ({
873
- // path: [],
874
- // field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field,
875
- // })),
876
- // joins,
877
- // distinct,
878
- // }),
879
- // {},
880
- // tableAlias,
881
- // );
882
- // selectionForBuild = selection.map((item) =>
883
- // is(item.field, SQL.Aliased)
884
- // ? { ...item, field: sql`${sql.identifier(tableAlias)}.${sql.identifier(item.field.fieldAlias)}` }
885
- // : item
886
- // );
887
- // joins = [];
888
- // distinct = undefined;
889
- // }
890
- // const result = this.buildSelectQuery({
891
- // table: is(tableFrom, PgTable) ? aliasedTable(tableFrom, tableAlias) : tableFrom,
892
- // fields: {},
893
- // fieldsFlat: selectionForBuild.map(({ field }) => ({
894
- // path: [],
895
- // field: is(field, Column) ? aliasedTableColumn(field, tableAlias) : field,
896
- // })),
897
- // where,
898
- // limit,
899
- // offset,
900
- // joins,
901
- // orderBy,
902
- // distinct,
903
- // });
904
- // return {
905
- // tableTsKey: tableConfig.tsName,
906
- // sql: result,
907
- // selection,
908
- // };
909
- // }
910
- buildRelationalQueryWithoutPK({
440
+ /** @deprecated */
441
+ _buildRelationalQuery({
911
442
  fullSchema,
912
443
  schema,
913
444
  tableNamesMap,
@@ -936,7 +467,7 @@ class PgDialect {
936
467
  Object.entries(tableConfig.columns).map(([key, value]) => [key, (0, import_alias.aliasedTableColumn)(value, tableAlias)])
937
468
  );
938
469
  if (config.where) {
939
- const whereSql = typeof config.where === "function" ? config.where(aliasedColumns, (0, import_relations.getOperators)()) : config.where;
470
+ const whereSql = typeof config.where === "function" ? config.where(aliasedColumns, V1.getOperators()) : config.where;
940
471
  where = whereSql && (0, import_alias.mapColumnsInSQLToAlias)(whereSql, tableAlias);
941
472
  }
942
473
  const fieldsSelection = [];
@@ -988,7 +519,7 @@ class PgDialect {
988
519
  selection: []
989
520
  });
990
521
  }
991
- let orderByOrig = typeof config.orderBy === "function" ? config.orderBy(aliasedColumns, (0, import_relations.getOrderByOperators)()) : config.orderBy ?? [];
522
+ let orderByOrig = typeof config.orderBy === "function" ? config.orderBy(aliasedColumns, V1.getOrderByOperators()) : config.orderBy ?? [];
992
523
  if (!Array.isArray(orderByOrig)) {
993
524
  orderByOrig = [orderByOrig];
994
525
  }
@@ -1005,7 +536,7 @@ class PgDialect {
1005
536
  queryConfig: selectedRelationConfigValue,
1006
537
  relation
1007
538
  } of selectedRelations) {
1008
- const normalizedRelation = (0, import_relations.normalizeRelation)(schema, tableNamesMap, relation);
539
+ const normalizedRelation = V1.normalizeRelation(schema, tableNamesMap, relation);
1009
540
  const relationTableName = (0, import_table2.getTableUniqueName)(relation.referencedTable);
1010
541
  const relationTableTsName = tableNamesMap[relationTableName];
1011
542
  const relationTableAlias = `${tableAlias}_${selectedRelationTsKey}`;
@@ -1017,13 +548,13 @@ class PgDialect {
1017
548
  )
1018
549
  )
1019
550
  );
1020
- const builtRelation = this.buildRelationalQueryWithoutPK({
551
+ const builtRelation = this._buildRelationalQuery({
1021
552
  fullSchema,
1022
553
  schema,
1023
554
  tableNamesMap,
1024
555
  table: fullSchema[relationTableTsName],
1025
556
  tableConfig: schema[relationTableTsName],
1026
- queryConfig: (0, import_entity.is)(relation, import_relations.One) ? selectedRelationConfigValue === true ? { limit: 1 } : { ...selectedRelationConfigValue, limit: 1 } : selectedRelationConfigValue,
557
+ queryConfig: (0, import_entity.is)(relation, V1.One) ? selectedRelationConfigValue === true ? { limit: 1 } : { ...selectedRelationConfigValue, limit: 1 } : selectedRelationConfigValue,
1027
558
  tableAlias: relationTableAlias,
1028
559
  joinOn: joinOn2,
1029
560
  nestedQueryRelation: relation
@@ -1058,7 +589,7 @@ class PgDialect {
1058
589
  ),
1059
590
  import_sql2.sql`, `
1060
591
  )})`;
1061
- if ((0, import_entity.is)(nestedQueryRelation, import_relations.Many)) {
592
+ if ((0, import_entity.is)(nestedQueryRelation, V1.Many)) {
1062
593
  field = import_sql2.sql`coalesce(json_agg(${field}${orderBy.length > 0 ? import_sql2.sql` order by ${import_sql2.sql.join(orderBy, import_sql2.sql`, `)}` : void 0}), '[]'::json)`;
1063
594
  }
1064
595
  const nestedSelection = [{
@@ -1127,6 +658,163 @@ class PgDialect {
1127
658
  selection
1128
659
  };
1129
660
  }
661
+ nestedSelectionerror() {
662
+ throw new import_errors.DrizzleError({
663
+ message: `Views with nested selections are not supported by the relational query builder`
664
+ });
665
+ }
666
+ buildRqbColumn(table, column, key) {
667
+ if ((0, import_entity.is)(column, import_column.Column)) {
668
+ switch (column.columnType) {
669
+ case "PgBigInt64": {
670
+ return import_sql2.sql`${table}.${import_sql2.sql.identifier(this.casing.getColumnCasing(column))}::text as ${import_sql2.sql.identifier(key)}`;
671
+ }
672
+ default: {
673
+ return import_sql2.sql`${table}.${import_sql2.sql.identifier(this.casing.getColumnCasing(column))} as ${import_sql2.sql.identifier(key)}`;
674
+ }
675
+ }
676
+ }
677
+ return import_sql2.sql`${table}.${(0, import_entity.is)(column, import_sql2.SQL.Aliased) ? import_sql2.sql.identifier(column.fieldAlias) : (0, import_sql.isSQLWrapper)(column) ? import_sql2.sql.identifier(key) : this.nestedSelectionerror()} as ${import_sql2.sql.identifier(key)}`;
678
+ }
679
+ unwrapAllColumns = (table, selection) => {
680
+ return import_sql2.sql.join(
681
+ Object.entries(table[import_table2.Columns]).map(([k, v]) => {
682
+ selection.push({
683
+ key: k,
684
+ field: v
685
+ });
686
+ return this.buildRqbColumn(table, v, k);
687
+ }),
688
+ import_sql2.sql`, `
689
+ );
690
+ };
691
+ buildColumns = (table, selection, config) => config?.columns ? (() => {
692
+ const entries = Object.entries(config.columns);
693
+ const columnContainer = table[import_table2.Columns];
694
+ const columnIdentifiers = [];
695
+ let colSelectionMode;
696
+ for (const [k, v] of entries) {
697
+ if (v === void 0)
698
+ continue;
699
+ colSelectionMode = colSelectionMode || v;
700
+ if (v) {
701
+ const column = columnContainer[k];
702
+ columnIdentifiers.push(
703
+ this.buildRqbColumn(table, column, k)
704
+ );
705
+ selection.push({
706
+ key: k,
707
+ field: column
708
+ });
709
+ }
710
+ }
711
+ if (colSelectionMode === false) {
712
+ for (const [k, v] of Object.entries(columnContainer)) {
713
+ if (config.columns[k] === false)
714
+ continue;
715
+ columnIdentifiers.push(this.buildRqbColumn(table, v, k));
716
+ selection.push({
717
+ key: k,
718
+ field: v
719
+ });
720
+ }
721
+ }
722
+ return columnIdentifiers.length ? import_sql2.sql.join(columnIdentifiers, import_sql2.sql`, `) : void 0;
723
+ })() : this.unwrapAllColumns(table, selection);
724
+ buildRelationalQuery({
725
+ tables,
726
+ schema,
727
+ tableNamesMap,
728
+ table,
729
+ tableConfig,
730
+ queryConfig: config,
731
+ relationWhere,
732
+ mode,
733
+ errorPath,
734
+ depth,
735
+ throughJoin
736
+ }) {
737
+ const selection = [];
738
+ const isSingle = mode === "first";
739
+ const params = config === true ? void 0 : config;
740
+ const currentPath = errorPath ?? "";
741
+ const currentDepth = depth ?? 0;
742
+ if (!currentDepth)
743
+ table = (0, import_alias.aliasedTable)(table, `d${currentDepth}`);
744
+ const limit = isSingle ? 1 : params?.limit;
745
+ const offset = params?.offset;
746
+ const where = params?.where && relationWhere ? (0, import_sql.and)(
747
+ (0, import_relations.relationsFilterToSQL)(table, params.where, tableConfig.relations, schema, tableNamesMap, this.casing),
748
+ relationWhere
749
+ ) : params?.where ? (0, import_relations.relationsFilterToSQL)(table, params.where, tableConfig.relations, schema, tableNamesMap, this.casing) : relationWhere;
750
+ const order = params?.orderBy ? (0, import_relations.relationsOrderToSQL)(table, params.orderBy) : void 0;
751
+ const columns = this.buildColumns(table, selection, params);
752
+ const extras = params?.extras ? (0, import_relations.relationExtrasToSQL)(table, params.extras) : void 0;
753
+ if (extras)
754
+ selection.push(...extras.selection);
755
+ const selectionArr = columns ? [columns] : [];
756
+ const joins = params ? (() => {
757
+ const { with: joins2 } = params;
758
+ if (!joins2)
759
+ return;
760
+ const withEntries = Object.entries(joins2).filter(([_, v]) => v);
761
+ if (!withEntries.length)
762
+ return;
763
+ return import_sql2.sql.join(
764
+ withEntries.map(([k, join]) => {
765
+ const relation = tableConfig.relations[k];
766
+ const isSingle2 = (0, import_entity.is)(relation, import_relations.One);
767
+ const targetTable = (0, import_alias.aliasedTable)(relation.targetTable, `d${currentDepth + 1}`);
768
+ const throughTable = relation.throughTable ? (0, import_alias.aliasedTable)(relation.throughTable, `tr${currentDepth}`) : void 0;
769
+ const { filter, joinCondition } = (0, import_relations.relationToSQL)(
770
+ this.casing,
771
+ relation,
772
+ table,
773
+ targetTable,
774
+ throughTable
775
+ );
776
+ selectionArr.push(import_sql2.sql`${import_sql2.sql.identifier(k)}.${import_sql2.sql.identifier("r")} as ${import_sql2.sql.identifier(k)}`);
777
+ const throughJoin2 = throughTable ? import_sql2.sql` inner join ${(0, import_relations.getTableAsAliasSQL)(throughTable)} on ${joinCondition}` : void 0;
778
+ const innerQuery = this.buildRelationalQuery({
779
+ table: targetTable,
780
+ mode: isSingle2 ? "first" : "many",
781
+ schema,
782
+ queryConfig: join,
783
+ tableConfig: schema[tableNamesMap[(0, import_table2.getTableUniqueName)(relation.targetTable)]],
784
+ tableNamesMap,
785
+ tables,
786
+ relationWhere: filter,
787
+ errorPath: `${currentPath.length ? `${currentPath}.` : ""}${k}`,
788
+ depth: currentDepth + 1,
789
+ throughJoin: throughJoin2
790
+ });
791
+ selection.push({
792
+ field: targetTable,
793
+ key: k,
794
+ selection: innerQuery.selection,
795
+ isArray: !isSingle2,
796
+ isOptional: (relation.optional ?? false) || join !== true && !!join.where
797
+ });
798
+ const joinQuery = import_sql2.sql`left join lateral(select ${isSingle2 ? import_sql2.sql`row_to_json(${import_sql2.sql.identifier("t")}.*) ${import_sql2.sql.identifier("r")}` : import_sql2.sql`coalesce(json_agg(row_to_json(${import_sql2.sql.identifier("t")}.*)), '[]') as ${import_sql2.sql.identifier("r")}`} from (${innerQuery.sql}) as ${import_sql2.sql.identifier("t")}) as ${import_sql2.sql.identifier(k)} on true`;
799
+ return joinQuery;
800
+ }),
801
+ import_sql2.sql` `
802
+ );
803
+ })() : void 0;
804
+ if (extras?.sql)
805
+ selectionArr.push(extras.sql);
806
+ if (!selectionArr.length) {
807
+ throw new import_errors.DrizzleError({
808
+ message: `No fields selected for table "${tableConfig.tsName}"${currentPath ? ` ("${currentPath}")` : ""}`
809
+ });
810
+ }
811
+ const selectionSet = import_sql2.sql.join(selectionArr.filter((e) => e !== void 0), import_sql2.sql`, `);
812
+ const query = import_sql2.sql`select ${selectionSet} from ${(0, import_relations.getTableAsAliasSQL)(table)}${throughJoin}${import_sql2.sql` ${joins}`.if(joins)}${import_sql2.sql` where ${where}`.if(where)}${import_sql2.sql` order by ${order}`.if(order)}${import_sql2.sql` limit ${limit}`.if(limit !== void 0)}${import_sql2.sql` offset ${offset}`.if(offset !== void 0)}`;
813
+ return {
814
+ sql: query,
815
+ selection
816
+ };
817
+ }
1130
818
  }
1131
819
  // Annotate the CommonJS export names for ESM import in node:
1132
820
  0 && (module.exports = {