kysely 0.27.6 → 0.28.1

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 (363) hide show
  1. package/README.md +169 -1
  2. package/deno.check.d.ts +7 -0
  3. package/dist/cjs/dialect/mssql/mssql-dialect-config.d.ts +26 -16
  4. package/dist/cjs/dialect/mssql/mssql-driver.d.ts +6 -3
  5. package/dist/cjs/dialect/mssql/mssql-driver.js +33 -19
  6. package/dist/cjs/dialect/mssql/mssql-query-compiler.d.ts +2 -0
  7. package/dist/cjs/dialect/mssql/mssql-query-compiler.js +11 -0
  8. package/dist/cjs/dialect/mysql/mysql-driver.d.ts +4 -0
  9. package/dist/cjs/dialect/mysql/mysql-driver.js +27 -12
  10. package/dist/cjs/dialect/postgres/postgres-driver.d.ts +4 -0
  11. package/dist/cjs/dialect/postgres/postgres-driver.js +28 -18
  12. package/dist/cjs/dialect/postgres/postgres-introspector.js +7 -17
  13. package/dist/cjs/dialect/sqlite/sqlite-driver.d.ts +4 -0
  14. package/dist/cjs/dialect/sqlite/sqlite-driver.js +19 -13
  15. package/dist/cjs/dialect/sqlite/sqlite-query-compiler.d.ts +2 -0
  16. package/dist/cjs/dialect/sqlite/sqlite-query-compiler.js +4 -0
  17. package/dist/cjs/driver/database-connection.d.ts +0 -4
  18. package/dist/cjs/driver/driver.d.ts +17 -0
  19. package/dist/cjs/driver/driver.js +13 -1
  20. package/dist/cjs/driver/dummy-driver.d.ts +3 -0
  21. package/dist/cjs/driver/dummy-driver.js +9 -0
  22. package/dist/cjs/driver/runtime-driver.d.ts +4 -0
  23. package/dist/cjs/driver/runtime-driver.js +43 -3
  24. package/dist/cjs/expression/expression-builder.d.ts +7 -10
  25. package/dist/cjs/helpers/postgres.d.ts +48 -0
  26. package/dist/cjs/helpers/postgres.js +50 -0
  27. package/dist/cjs/index.d.ts +13 -2
  28. package/dist/cjs/index.js +13 -2
  29. package/dist/cjs/kysely.d.ts +339 -2
  30. package/dist/cjs/kysely.js +465 -11
  31. package/dist/cjs/migration/migrator.d.ts +8 -0
  32. package/dist/cjs/migration/migrator.js +1 -1
  33. package/dist/cjs/operation-node/aggregate-function-node.d.ts +2 -1
  34. package/dist/cjs/operation-node/aggregate-function-node.js +4 -3
  35. package/dist/cjs/operation-node/alter-table-node.d.ts +3 -1
  36. package/dist/cjs/operation-node/collate-node.d.ts +13 -0
  37. package/dist/cjs/operation-node/collate-node.js +19 -0
  38. package/dist/cjs/operation-node/constraint-node.d.ts +1 -1
  39. package/dist/cjs/operation-node/create-type-node.d.ts +1 -1
  40. package/dist/cjs/operation-node/create-type-node.js +1 -1
  41. package/dist/cjs/operation-node/delete-query-node.d.ts +8 -2
  42. package/dist/cjs/operation-node/delete-query-node.js +11 -15
  43. package/dist/cjs/operation-node/foreign-key-constraint-node.d.ts +4 -0
  44. package/dist/cjs/operation-node/insert-query-node.d.ts +3 -0
  45. package/dist/cjs/operation-node/join-node.d.ts +1 -1
  46. package/dist/cjs/operation-node/merge-query-node.d.ts +2 -0
  47. package/dist/cjs/operation-node/operation-node-transformer.d.ts +106 -97
  48. package/dist/cjs/operation-node/operation-node-transformer.js +352 -312
  49. package/dist/cjs/operation-node/operation-node-visitor.d.ts +9 -1
  50. package/dist/cjs/operation-node/operation-node-visitor.js +4 -0
  51. package/dist/cjs/operation-node/operation-node.d.ts +1 -1
  52. package/dist/cjs/operation-node/or-action-node.d.ts +12 -0
  53. package/dist/cjs/operation-node/or-action-node.js +18 -0
  54. package/dist/cjs/operation-node/order-by-item-node.d.ts +5 -0
  55. package/dist/cjs/operation-node/order-by-item-node.js +6 -0
  56. package/dist/cjs/operation-node/primary-key-constraint-node.d.ts +29 -0
  57. package/dist/cjs/operation-node/{primary-constraint-node.js → primary-key-constraint-node.js} +11 -2
  58. package/dist/cjs/operation-node/query-node.d.ts +7 -0
  59. package/dist/cjs/operation-node/query-node.js +15 -0
  60. package/dist/cjs/operation-node/refresh-materialized-view-node.d.ts +17 -0
  61. package/dist/cjs/operation-node/refresh-materialized-view-node.js +25 -0
  62. package/dist/cjs/operation-node/rename-constraint-node.d.ts +14 -0
  63. package/dist/cjs/operation-node/rename-constraint-node.js +20 -0
  64. package/dist/cjs/operation-node/select-query-node.d.ts +8 -2
  65. package/dist/cjs/operation-node/select-query-node.js +11 -15
  66. package/dist/cjs/operation-node/unique-constraint-node.d.ts +2 -0
  67. package/dist/cjs/operation-node/update-query-node.d.ts +3 -4
  68. package/dist/cjs/operation-node/update-query-node.js +5 -2
  69. package/dist/cjs/parser/collate-parser.d.ts +1 -0
  70. package/dist/cjs/parser/collate-parser.js +2 -0
  71. package/dist/cjs/parser/delete-from-parser.d.ts +5 -0
  72. package/dist/cjs/parser/delete-from-parser.js +2 -0
  73. package/dist/cjs/parser/join-parser.d.ts +1 -1
  74. package/dist/cjs/parser/join-parser.js +7 -1
  75. package/dist/cjs/parser/merge-into-parser.d.ts +5 -0
  76. package/dist/cjs/parser/merge-into-parser.js +2 -0
  77. package/dist/cjs/parser/order-by-parser.d.ts +18 -5
  78. package/dist/cjs/parser/order-by-parser.js +24 -14
  79. package/dist/cjs/parser/savepoint-parser.d.ts +4 -0
  80. package/dist/cjs/parser/savepoint-parser.js +11 -0
  81. package/dist/cjs/parser/select-from-parser.d.ts +4 -0
  82. package/dist/cjs/parser/select-from-parser.js +2 -0
  83. package/dist/cjs/parser/table-parser.d.ts +2 -5
  84. package/dist/cjs/parser/update-parser.d.ts +5 -0
  85. package/dist/cjs/parser/update-parser.js +2 -0
  86. package/dist/cjs/parser/update-set-parser.d.ts +7 -4
  87. package/dist/cjs/plugin/camel-case/camel-case-plugin.js +1 -1
  88. package/dist/cjs/plugin/camel-case/camel-case-transformer.d.ts +2 -1
  89. package/dist/cjs/plugin/camel-case/camel-case-transformer.js +2 -2
  90. package/dist/cjs/plugin/deduplicate-joins/deduplicate-joins-plugin.js +1 -1
  91. package/dist/cjs/plugin/deduplicate-joins/deduplicate-joins-transformer.d.ts +4 -3
  92. package/dist/cjs/plugin/deduplicate-joins/deduplicate-joins-transformer.js +6 -6
  93. package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.d.ts +211 -0
  94. package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.js +162 -0
  95. package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.d.ts +8 -0
  96. package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.js +29 -0
  97. package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists.d.ts +44 -0
  98. package/dist/cjs/plugin/handle-empty-in-lists/handle-empty-in-lists.js +66 -0
  99. package/dist/cjs/plugin/immediate-value/immediate-value-plugin.js +1 -1
  100. package/dist/cjs/plugin/immediate-value/immediate-value-transformer.d.ts +2 -0
  101. package/dist/cjs/plugin/immediate-value/immediate-value-transformer.js +6 -4
  102. package/dist/cjs/plugin/with-schema/with-schema-plugin.js +1 -1
  103. package/dist/cjs/plugin/with-schema/with-schema-transformer.d.ts +6 -5
  104. package/dist/cjs/plugin/with-schema/with-schema-transformer.js +29 -24
  105. package/dist/cjs/query-builder/aggregate-function-builder.d.ts +83 -5
  106. package/dist/cjs/query-builder/aggregate-function-builder.js +15 -27
  107. package/dist/cjs/query-builder/cte-builder.js +0 -2
  108. package/dist/cjs/query-builder/delete-query-builder.d.ts +36 -47
  109. package/dist/cjs/query-builder/delete-query-builder.js +12 -78
  110. package/dist/cjs/query-builder/function-module.d.ts +31 -4
  111. package/dist/cjs/query-builder/insert-query-builder.d.ts +161 -6
  112. package/dist/cjs/query-builder/insert-query-builder.js +197 -10
  113. package/dist/cjs/query-builder/join-builder.js +0 -2
  114. package/dist/cjs/query-builder/merge-query-builder.d.ts +145 -3
  115. package/dist/cjs/query-builder/merge-query-builder.js +28 -7
  116. package/dist/cjs/query-builder/on-conflict-builder.js +0 -4
  117. package/dist/cjs/query-builder/order-by-interface.d.ts +176 -0
  118. package/dist/cjs/query-builder/order-by-interface.js +2 -0
  119. package/dist/cjs/query-builder/order-by-item-builder.d.ts +43 -0
  120. package/dist/cjs/query-builder/order-by-item-builder.js +75 -0
  121. package/dist/cjs/query-builder/over-builder.d.ts +43 -6
  122. package/dist/cjs/query-builder/over-builder.js +8 -25
  123. package/dist/cjs/query-builder/returning-interface.d.ts +20 -3
  124. package/dist/cjs/query-builder/select-query-builder.d.ts +279 -98
  125. package/dist/cjs/query-builder/select-query-builder.js +26 -26
  126. package/dist/cjs/query-builder/update-query-builder.d.ts +88 -9
  127. package/dist/cjs/query-builder/update-query-builder.js +17 -15
  128. package/dist/cjs/query-compiler/compiled-query.d.ts +2 -0
  129. package/dist/cjs/query-compiler/compiled-query.js +2 -0
  130. package/dist/cjs/query-compiler/default-query-compiler.d.ts +17 -2
  131. package/dist/cjs/query-compiler/default-query-compiler.js +97 -2
  132. package/dist/cjs/query-compiler/query-compiler.d.ts +4 -2
  133. package/dist/cjs/query-creator.d.ts +23 -25
  134. package/dist/cjs/query-creator.js +280 -8
  135. package/dist/cjs/query-executor/default-query-executor.d.ts +2 -1
  136. package/dist/cjs/query-executor/default-query-executor.js +2 -2
  137. package/dist/cjs/query-executor/query-executor-base.js +7 -25
  138. package/dist/cjs/raw-builder/raw-builder.js +0 -3
  139. package/dist/cjs/raw-builder/sql.d.ts +3 -3
  140. package/dist/cjs/raw-builder/sql.js +1 -1
  141. package/dist/cjs/schema/alter-column-builder.js +0 -3
  142. package/dist/cjs/schema/alter-table-add-foreign-key-constraint-builder.d.ts +4 -0
  143. package/dist/cjs/schema/alter-table-add-foreign-key-constraint-builder.js +24 -2
  144. package/dist/cjs/schema/alter-table-add-index-builder.js +0 -2
  145. package/dist/cjs/schema/alter-table-builder.d.ts +7 -3
  146. package/dist/cjs/schema/alter-table-builder.js +21 -10
  147. package/dist/cjs/schema/alter-table-drop-constraint-builder.js +0 -2
  148. package/dist/cjs/schema/alter-table-executor.js +0 -2
  149. package/dist/cjs/schema/check-constraint-builder.d.ts +13 -0
  150. package/dist/cjs/schema/check-constraint-builder.js +20 -0
  151. package/dist/cjs/schema/column-definition-builder.js +0 -2
  152. package/dist/cjs/schema/create-index-builder.js +1 -3
  153. package/dist/cjs/schema/create-schema-builder.js +0 -2
  154. package/dist/cjs/schema/create-table-builder.d.ts +5 -4
  155. package/dist/cjs/schema/create-table-builder.js +9 -7
  156. package/dist/cjs/schema/create-type-builder.d.ts +1 -1
  157. package/dist/cjs/schema/create-type-builder.js +0 -2
  158. package/dist/cjs/schema/create-view-builder.js +0 -2
  159. package/dist/cjs/schema/drop-index-builder.js +0 -2
  160. package/dist/cjs/schema/drop-schema-builder.js +0 -2
  161. package/dist/cjs/schema/drop-table-builder.js +0 -2
  162. package/dist/cjs/schema/drop-type-builder.js +0 -2
  163. package/dist/cjs/schema/drop-view-builder.js +0 -2
  164. package/dist/cjs/schema/foreign-key-constraint-builder.d.ts +9 -0
  165. package/dist/cjs/schema/foreign-key-constraint-builder.js +16 -2
  166. package/dist/cjs/schema/primary-key-constraint-builder.d.ts +17 -0
  167. package/dist/cjs/schema/primary-key-constraint-builder.js +37 -0
  168. package/dist/cjs/schema/refresh-materialized-view-builder.d.ts +47 -0
  169. package/dist/cjs/schema/refresh-materialized-view-builder.js +75 -0
  170. package/dist/cjs/schema/schema.d.ts +14 -0
  171. package/dist/cjs/schema/schema.js +21 -0
  172. package/dist/cjs/schema/unique-constraint-builder.d.ts +10 -1
  173. package/dist/cjs/schema/unique-constraint-builder.js +26 -5
  174. package/dist/cjs/util/infer-result.d.ts +1 -1
  175. package/dist/cjs/util/log.d.ts +1 -0
  176. package/dist/cjs/util/log.js +3 -2
  177. package/dist/cjs/util/provide-controlled-connection.d.ts +7 -0
  178. package/dist/cjs/util/provide-controlled-connection.js +24 -0
  179. package/dist/esm/dialect/mssql/mssql-dialect-config.d.ts +26 -16
  180. package/dist/esm/dialect/mssql/mssql-driver.d.ts +6 -3
  181. package/dist/esm/dialect/mssql/mssql-driver.js +33 -19
  182. package/dist/esm/dialect/mssql/mssql-query-compiler.d.ts +2 -0
  183. package/dist/esm/dialect/mssql/mssql-query-compiler.js +11 -0
  184. package/dist/esm/dialect/mysql/mysql-driver.d.ts +4 -0
  185. package/dist/esm/dialect/mysql/mysql-driver.js +27 -12
  186. package/dist/esm/dialect/postgres/postgres-driver.d.ts +4 -0
  187. package/dist/esm/dialect/postgres/postgres-driver.js +28 -18
  188. package/dist/esm/dialect/postgres/postgres-introspector.js +7 -17
  189. package/dist/esm/dialect/sqlite/sqlite-driver.d.ts +4 -0
  190. package/dist/esm/dialect/sqlite/sqlite-driver.js +19 -13
  191. package/dist/esm/dialect/sqlite/sqlite-query-compiler.d.ts +2 -0
  192. package/dist/esm/dialect/sqlite/sqlite-query-compiler.js +4 -0
  193. package/dist/esm/driver/database-connection.d.ts +0 -4
  194. package/dist/esm/driver/driver.d.ts +17 -0
  195. package/dist/esm/driver/driver.js +11 -0
  196. package/dist/esm/driver/dummy-driver.d.ts +3 -0
  197. package/dist/esm/driver/dummy-driver.js +9 -0
  198. package/dist/esm/driver/runtime-driver.d.ts +4 -0
  199. package/dist/esm/driver/runtime-driver.js +43 -3
  200. package/dist/esm/expression/expression-builder.d.ts +7 -10
  201. package/dist/esm/helpers/postgres.d.ts +48 -0
  202. package/dist/esm/helpers/postgres.js +49 -0
  203. package/dist/esm/index.d.ts +13 -2
  204. package/dist/esm/index.js +11 -1
  205. package/dist/esm/kysely.d.ts +339 -2
  206. package/dist/esm/kysely.js +461 -10
  207. package/dist/esm/migration/migrator.d.ts +8 -0
  208. package/dist/esm/migration/migrator.js +1 -1
  209. package/dist/esm/operation-node/aggregate-function-node.d.ts +2 -1
  210. package/dist/esm/operation-node/aggregate-function-node.js +4 -3
  211. package/dist/esm/operation-node/alter-table-node.d.ts +3 -1
  212. package/dist/esm/operation-node/collate-node.d.ts +13 -0
  213. package/dist/esm/operation-node/collate-node.js +17 -0
  214. package/dist/esm/operation-node/constraint-node.d.ts +1 -1
  215. package/dist/esm/operation-node/create-type-node.d.ts +1 -1
  216. package/dist/esm/operation-node/create-type-node.js +1 -1
  217. package/dist/esm/operation-node/delete-query-node.d.ts +8 -2
  218. package/dist/esm/operation-node/delete-query-node.js +11 -15
  219. package/dist/esm/operation-node/foreign-key-constraint-node.d.ts +4 -0
  220. package/dist/esm/operation-node/insert-query-node.d.ts +3 -0
  221. package/dist/esm/operation-node/join-node.d.ts +1 -1
  222. package/dist/esm/operation-node/merge-query-node.d.ts +2 -0
  223. package/dist/esm/operation-node/operation-node-transformer.d.ts +106 -97
  224. package/dist/esm/operation-node/operation-node-transformer.js +352 -312
  225. package/dist/esm/operation-node/operation-node-visitor.d.ts +9 -1
  226. package/dist/esm/operation-node/operation-node-visitor.js +4 -0
  227. package/dist/esm/operation-node/operation-node.d.ts +1 -1
  228. package/dist/esm/operation-node/or-action-node.d.ts +12 -0
  229. package/dist/esm/operation-node/or-action-node.js +16 -0
  230. package/dist/esm/operation-node/order-by-item-node.d.ts +5 -0
  231. package/dist/esm/operation-node/order-by-item-node.js +6 -0
  232. package/dist/esm/operation-node/primary-key-constraint-node.d.ts +29 -0
  233. package/dist/esm/operation-node/{primary-constraint-node.js → primary-key-constraint-node.js} +11 -2
  234. package/dist/esm/operation-node/query-node.d.ts +7 -0
  235. package/dist/esm/operation-node/query-node.js +15 -0
  236. package/dist/esm/operation-node/refresh-materialized-view-node.d.ts +17 -0
  237. package/dist/esm/operation-node/refresh-materialized-view-node.js +23 -0
  238. package/dist/esm/operation-node/rename-constraint-node.d.ts +14 -0
  239. package/dist/esm/operation-node/rename-constraint-node.js +18 -0
  240. package/dist/esm/operation-node/select-query-node.d.ts +8 -2
  241. package/dist/esm/operation-node/select-query-node.js +11 -15
  242. package/dist/esm/operation-node/unique-constraint-node.d.ts +2 -0
  243. package/dist/esm/operation-node/update-query-node.d.ts +3 -4
  244. package/dist/esm/operation-node/update-query-node.js +5 -2
  245. package/dist/esm/parser/collate-parser.d.ts +1 -0
  246. package/dist/esm/parser/collate-parser.js +2 -0
  247. package/dist/esm/parser/delete-from-parser.d.ts +5 -0
  248. package/dist/esm/parser/delete-from-parser.js +2 -0
  249. package/dist/esm/parser/join-parser.d.ts +1 -1
  250. package/dist/esm/parser/join-parser.js +7 -1
  251. package/dist/esm/parser/merge-into-parser.d.ts +5 -0
  252. package/dist/esm/parser/merge-into-parser.js +2 -0
  253. package/dist/esm/parser/order-by-parser.d.ts +18 -5
  254. package/dist/esm/parser/order-by-parser.js +27 -17
  255. package/dist/esm/parser/savepoint-parser.d.ts +4 -0
  256. package/dist/esm/parser/savepoint-parser.js +9 -0
  257. package/dist/esm/parser/select-from-parser.d.ts +4 -0
  258. package/dist/esm/parser/select-from-parser.js +2 -0
  259. package/dist/esm/parser/table-parser.d.ts +2 -5
  260. package/dist/esm/parser/update-parser.d.ts +5 -0
  261. package/dist/esm/parser/update-parser.js +2 -0
  262. package/dist/esm/parser/update-set-parser.d.ts +7 -4
  263. package/dist/esm/plugin/camel-case/camel-case-plugin.js +1 -1
  264. package/dist/esm/plugin/camel-case/camel-case-transformer.d.ts +2 -1
  265. package/dist/esm/plugin/camel-case/camel-case-transformer.js +2 -2
  266. package/dist/esm/plugin/deduplicate-joins/deduplicate-joins-plugin.js +1 -1
  267. package/dist/esm/plugin/deduplicate-joins/deduplicate-joins-transformer.d.ts +4 -3
  268. package/dist/esm/plugin/deduplicate-joins/deduplicate-joins-transformer.js +6 -6
  269. package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.d.ts +211 -0
  270. package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-plugin.js +159 -0
  271. package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.d.ts +8 -0
  272. package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists-transformer.js +26 -0
  273. package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists.d.ts +44 -0
  274. package/dist/esm/plugin/handle-empty-in-lists/handle-empty-in-lists.js +63 -0
  275. package/dist/esm/plugin/immediate-value/immediate-value-plugin.js +1 -1
  276. package/dist/esm/plugin/immediate-value/immediate-value-transformer.d.ts +2 -0
  277. package/dist/esm/plugin/immediate-value/immediate-value-transformer.js +6 -4
  278. package/dist/esm/plugin/with-schema/with-schema-plugin.js +1 -1
  279. package/dist/esm/plugin/with-schema/with-schema-transformer.d.ts +6 -5
  280. package/dist/esm/plugin/with-schema/with-schema-transformer.js +29 -24
  281. package/dist/esm/query-builder/aggregate-function-builder.d.ts +83 -5
  282. package/dist/esm/query-builder/aggregate-function-builder.js +15 -27
  283. package/dist/esm/query-builder/cte-builder.js +0 -2
  284. package/dist/esm/query-builder/delete-query-builder.d.ts +36 -47
  285. package/dist/esm/query-builder/delete-query-builder.js +12 -78
  286. package/dist/esm/query-builder/function-module.d.ts +31 -4
  287. package/dist/esm/query-builder/insert-query-builder.d.ts +161 -6
  288. package/dist/esm/query-builder/insert-query-builder.js +197 -10
  289. package/dist/esm/query-builder/join-builder.js +0 -2
  290. package/dist/esm/query-builder/merge-query-builder.d.ts +145 -3
  291. package/dist/esm/query-builder/merge-query-builder.js +29 -8
  292. package/dist/esm/query-builder/on-conflict-builder.js +0 -4
  293. package/dist/esm/query-builder/order-by-interface.d.ts +176 -0
  294. package/dist/esm/query-builder/order-by-interface.js +2 -0
  295. package/dist/esm/query-builder/order-by-item-builder.d.ts +43 -0
  296. package/dist/esm/query-builder/order-by-item-builder.js +72 -0
  297. package/dist/esm/query-builder/over-builder.d.ts +43 -6
  298. package/dist/esm/query-builder/over-builder.js +8 -25
  299. package/dist/esm/query-builder/returning-interface.d.ts +20 -3
  300. package/dist/esm/query-builder/select-query-builder.d.ts +279 -98
  301. package/dist/esm/query-builder/select-query-builder.js +26 -26
  302. package/dist/esm/query-builder/update-query-builder.d.ts +88 -9
  303. package/dist/esm/query-builder/update-query-builder.js +17 -15
  304. package/dist/esm/query-compiler/compiled-query.d.ts +2 -0
  305. package/dist/esm/query-compiler/compiled-query.js +2 -0
  306. package/dist/esm/query-compiler/default-query-compiler.d.ts +17 -2
  307. package/dist/esm/query-compiler/default-query-compiler.js +97 -2
  308. package/dist/esm/query-compiler/query-compiler.d.ts +4 -2
  309. package/dist/esm/query-creator.d.ts +23 -25
  310. package/dist/esm/query-creator.js +281 -9
  311. package/dist/esm/query-executor/default-query-executor.d.ts +2 -1
  312. package/dist/esm/query-executor/default-query-executor.js +2 -2
  313. package/dist/esm/query-executor/query-executor-base.js +7 -25
  314. package/dist/esm/raw-builder/raw-builder.js +0 -3
  315. package/dist/esm/raw-builder/sql.d.ts +3 -3
  316. package/dist/esm/raw-builder/sql.js +1 -1
  317. package/dist/esm/schema/alter-column-builder.js +0 -3
  318. package/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.d.ts +4 -0
  319. package/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.js +24 -2
  320. package/dist/esm/schema/alter-table-add-index-builder.js +0 -2
  321. package/dist/esm/schema/alter-table-builder.d.ts +7 -3
  322. package/dist/esm/schema/alter-table-builder.js +22 -11
  323. package/dist/esm/schema/alter-table-drop-constraint-builder.js +0 -2
  324. package/dist/esm/schema/alter-table-executor.js +0 -2
  325. package/dist/esm/schema/check-constraint-builder.d.ts +13 -0
  326. package/dist/esm/schema/check-constraint-builder.js +17 -0
  327. package/dist/esm/schema/column-definition-builder.js +0 -2
  328. package/dist/esm/schema/create-index-builder.js +1 -3
  329. package/dist/esm/schema/create-schema-builder.js +0 -2
  330. package/dist/esm/schema/create-table-builder.d.ts +5 -4
  331. package/dist/esm/schema/create-table-builder.js +10 -8
  332. package/dist/esm/schema/create-type-builder.d.ts +1 -1
  333. package/dist/esm/schema/create-type-builder.js +0 -2
  334. package/dist/esm/schema/create-view-builder.js +0 -2
  335. package/dist/esm/schema/drop-index-builder.js +0 -2
  336. package/dist/esm/schema/drop-schema-builder.js +0 -2
  337. package/dist/esm/schema/drop-table-builder.js +0 -2
  338. package/dist/esm/schema/drop-type-builder.js +0 -2
  339. package/dist/esm/schema/drop-view-builder.js +0 -2
  340. package/dist/esm/schema/foreign-key-constraint-builder.d.ts +9 -0
  341. package/dist/esm/schema/foreign-key-constraint-builder.js +16 -2
  342. package/dist/esm/schema/primary-key-constraint-builder.d.ts +17 -0
  343. package/dist/esm/schema/primary-key-constraint-builder.js +34 -0
  344. package/dist/esm/schema/refresh-materialized-view-builder.d.ts +47 -0
  345. package/dist/esm/schema/refresh-materialized-view-builder.js +72 -0
  346. package/dist/esm/schema/schema.d.ts +14 -0
  347. package/dist/esm/schema/schema.js +21 -0
  348. package/dist/esm/schema/unique-constraint-builder.d.ts +10 -1
  349. package/dist/esm/schema/unique-constraint-builder.js +26 -5
  350. package/dist/esm/util/infer-result.d.ts +1 -1
  351. package/dist/esm/util/log.d.ts +1 -0
  352. package/dist/esm/util/log.js +3 -2
  353. package/dist/esm/util/provide-controlled-connection.d.ts +7 -0
  354. package/dist/esm/util/provide-controlled-connection.js +22 -0
  355. package/outdated-typescript.d.ts +5 -0
  356. package/package.json +16 -2
  357. package/CONTRIBUTING.md +0 -168
  358. package/dist/cjs/operation-node/primary-constraint-node.d.ts +0 -15
  359. package/dist/cjs/util/prevent-await.d.ts +0 -1
  360. package/dist/cjs/util/prevent-await.js +0 -13
  361. package/dist/esm/operation-node/primary-constraint-node.d.ts +0 -15
  362. package/dist/esm/util/prevent-await.d.ts +0 -1
  363. package/dist/esm/util/prevent-await.js +0 -11
@@ -0,0 +1,47 @@
1
+ import { OperationNodeSource } from '../operation-node/operation-node-source.js';
2
+ import { CompiledQuery } from '../query-compiler/compiled-query.js';
3
+ import { Compilable } from '../util/compilable.js';
4
+ import { QueryExecutor } from '../query-executor/query-executor.js';
5
+ import { QueryId } from '../util/query-id.js';
6
+ import { RefreshMaterializedViewNode } from '../operation-node/refresh-materialized-view-node.js';
7
+ export declare class RefreshMaterializedViewBuilder implements OperationNodeSource, Compilable {
8
+ #private;
9
+ constructor(props: RefreshMaterializedViewBuilderProps);
10
+ /**
11
+ * Adds the "concurrently" modifier.
12
+ *
13
+ * Use this to refresh the view without locking out concurrent selects on the materialized view.
14
+ *
15
+ * WARNING!
16
+ * This cannot be used with the "with no data" modifier.
17
+ */
18
+ concurrently(): RefreshMaterializedViewBuilder;
19
+ /**
20
+ * Adds the "with data" modifier.
21
+ *
22
+ * If specified (or defaults) the backing query is executed to provide the new data, and the materialized view is left in a scannable state
23
+ */
24
+ withData(): RefreshMaterializedViewBuilder;
25
+ /**
26
+ * Adds the "with no data" modifier.
27
+ *
28
+ * If specified, no new data is generated and the materialized view is left in an unscannable state.
29
+ *
30
+ * WARNING!
31
+ * This cannot be used with the "concurrently" modifier.
32
+ */
33
+ withNoData(): RefreshMaterializedViewBuilder;
34
+ /**
35
+ * Simply calls the provided function passing `this` as the only argument. `$call` returns
36
+ * what the provided function returns.
37
+ */
38
+ $call<T>(func: (qb: this) => T): T;
39
+ toOperationNode(): RefreshMaterializedViewNode;
40
+ compile(): CompiledQuery;
41
+ execute(): Promise<void>;
42
+ }
43
+ export interface RefreshMaterializedViewBuilderProps {
44
+ readonly queryId: QueryId;
45
+ readonly executor: QueryExecutor;
46
+ readonly node: RefreshMaterializedViewNode;
47
+ }
@@ -0,0 +1,72 @@
1
+ /// <reference types="./refresh-materialized-view-builder.d.ts" />
2
+ import { freeze } from '../util/object-utils.js';
3
+ import { RefreshMaterializedViewNode } from '../operation-node/refresh-materialized-view-node.js';
4
+ export class RefreshMaterializedViewBuilder {
5
+ #props;
6
+ constructor(props) {
7
+ this.#props = freeze(props);
8
+ }
9
+ /**
10
+ * Adds the "concurrently" modifier.
11
+ *
12
+ * Use this to refresh the view without locking out concurrent selects on the materialized view.
13
+ *
14
+ * WARNING!
15
+ * This cannot be used with the "with no data" modifier.
16
+ */
17
+ concurrently() {
18
+ return new RefreshMaterializedViewBuilder({
19
+ ...this.#props,
20
+ node: RefreshMaterializedViewNode.cloneWith(this.#props.node, {
21
+ concurrently: true,
22
+ withNoData: false,
23
+ }),
24
+ });
25
+ }
26
+ /**
27
+ * Adds the "with data" modifier.
28
+ *
29
+ * If specified (or defaults) the backing query is executed to provide the new data, and the materialized view is left in a scannable state
30
+ */
31
+ withData() {
32
+ return new RefreshMaterializedViewBuilder({
33
+ ...this.#props,
34
+ node: RefreshMaterializedViewNode.cloneWith(this.#props.node, {
35
+ withNoData: false,
36
+ }),
37
+ });
38
+ }
39
+ /**
40
+ * Adds the "with no data" modifier.
41
+ *
42
+ * If specified, no new data is generated and the materialized view is left in an unscannable state.
43
+ *
44
+ * WARNING!
45
+ * This cannot be used with the "concurrently" modifier.
46
+ */
47
+ withNoData() {
48
+ return new RefreshMaterializedViewBuilder({
49
+ ...this.#props,
50
+ node: RefreshMaterializedViewNode.cloneWith(this.#props.node, {
51
+ withNoData: true,
52
+ concurrently: false,
53
+ }),
54
+ });
55
+ }
56
+ /**
57
+ * Simply calls the provided function passing `this` as the only argument. `$call` returns
58
+ * what the provided function returns.
59
+ */
60
+ $call(func) {
61
+ return func(this);
62
+ }
63
+ toOperationNode() {
64
+ return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
65
+ }
66
+ compile() {
67
+ return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
68
+ }
69
+ async execute() {
70
+ await this.#props.executor.executeQuery(this.compile(), this.#props.queryId);
71
+ }
72
+ }
@@ -11,6 +11,7 @@ import { DropViewBuilder } from './drop-view-builder.js';
11
11
  import { KyselyPlugin } from '../plugin/kysely-plugin.js';
12
12
  import { CreateTypeBuilder } from './create-type-builder.js';
13
13
  import { DropTypeBuilder } from './drop-type-builder.js';
14
+ import { RefreshMaterializedViewBuilder } from './refresh-materialized-view-builder.js';
14
15
  /**
15
16
  * Provides methods for building database schema.
16
17
  */
@@ -158,6 +159,19 @@ export declare class SchemaModule {
158
159
  * ```
159
160
  */
160
161
  createView(viewName: string): CreateViewBuilder;
162
+ /**
163
+ * Refresh a materialized view.
164
+ *
165
+ * ### Examples
166
+ *
167
+ * ```ts
168
+ * await db.schema
169
+ * .refreshMaterializedView('my_view')
170
+ * .concurrently()
171
+ * .execute()
172
+ * ```
173
+ */
174
+ refreshMaterializedView(viewName: string): RefreshMaterializedViewBuilder;
161
175
  /**
162
176
  * Drop a view.
163
177
  *
@@ -25,6 +25,8 @@ import { DropTypeBuilder } from './drop-type-builder.js';
25
25
  import { CreateTypeNode } from '../operation-node/create-type-node.js';
26
26
  import { DropTypeNode } from '../operation-node/drop-type-node.js';
27
27
  import { parseSchemableIdentifier } from '../parser/identifier-parser.js';
28
+ import { RefreshMaterializedViewBuilder } from './refresh-materialized-view-builder.js';
29
+ import { RefreshMaterializedViewNode } from '../operation-node/refresh-materialized-view-node.js';
28
30
  /**
29
31
  * Provides methods for building database schema.
30
32
  */
@@ -222,6 +224,25 @@ export class SchemaModule {
222
224
  node: CreateViewNode.create(viewName),
223
225
  });
224
226
  }
227
+ /**
228
+ * Refresh a materialized view.
229
+ *
230
+ * ### Examples
231
+ *
232
+ * ```ts
233
+ * await db.schema
234
+ * .refreshMaterializedView('my_view')
235
+ * .concurrently()
236
+ * .execute()
237
+ * ```
238
+ */
239
+ refreshMaterializedView(viewName) {
240
+ return new RefreshMaterializedViewBuilder({
241
+ queryId: createQueryId(),
242
+ executor: this.#executor,
243
+ node: RefreshMaterializedViewNode.create(viewName),
244
+ });
245
+ }
225
246
  /**
226
247
  * Drop a view.
227
248
  *
@@ -3,12 +3,21 @@ import { UniqueConstraintNode } from '../operation-node/unique-constraint-node.j
3
3
  export declare class UniqueConstraintNodeBuilder implements OperationNodeSource {
4
4
  #private;
5
5
  constructor(node: UniqueConstraintNode);
6
- toOperationNode(): UniqueConstraintNode;
7
6
  /**
8
7
  * Adds `nulls not distinct` to the unique constraint definition
9
8
  *
10
9
  * Supported by PostgreSQL dialect only
11
10
  */
12
11
  nullsNotDistinct(): UniqueConstraintNodeBuilder;
12
+ deferrable(): UniqueConstraintNodeBuilder;
13
+ notDeferrable(): UniqueConstraintNodeBuilder;
14
+ initiallyDeferred(): UniqueConstraintNodeBuilder;
15
+ initiallyImmediate(): UniqueConstraintNodeBuilder;
16
+ /**
17
+ * Simply calls the provided function passing `this` as the only argument. `$call` returns
18
+ * what the provided function returns.
19
+ */
20
+ $call<T>(func: (qb: this) => T): T;
21
+ toOperationNode(): UniqueConstraintNode;
13
22
  }
14
23
  export type UniqueConstraintNodeBuilderCallback = (builder: UniqueConstraintNodeBuilder) => UniqueConstraintNodeBuilder;
@@ -1,14 +1,10 @@
1
1
  /// <reference types="./unique-constraint-builder.d.ts" />
2
2
  import { UniqueConstraintNode } from '../operation-node/unique-constraint-node.js';
3
- import { preventAwait } from '../util/prevent-await.js';
4
3
  export class UniqueConstraintNodeBuilder {
5
4
  #node;
6
5
  constructor(node) {
7
6
  this.#node = node;
8
7
  }
9
- toOperationNode() {
10
- return this.#node;
11
- }
12
8
  /**
13
9
  * Adds `nulls not distinct` to the unique constraint definition
14
10
  *
@@ -17,5 +13,30 @@ export class UniqueConstraintNodeBuilder {
17
13
  nullsNotDistinct() {
18
14
  return new UniqueConstraintNodeBuilder(UniqueConstraintNode.cloneWith(this.#node, { nullsNotDistinct: true }));
19
15
  }
16
+ deferrable() {
17
+ return new UniqueConstraintNodeBuilder(UniqueConstraintNode.cloneWith(this.#node, { deferrable: true }));
18
+ }
19
+ notDeferrable() {
20
+ return new UniqueConstraintNodeBuilder(UniqueConstraintNode.cloneWith(this.#node, { deferrable: false }));
21
+ }
22
+ initiallyDeferred() {
23
+ return new UniqueConstraintNodeBuilder(UniqueConstraintNode.cloneWith(this.#node, {
24
+ initiallyDeferred: true,
25
+ }));
26
+ }
27
+ initiallyImmediate() {
28
+ return new UniqueConstraintNodeBuilder(UniqueConstraintNode.cloneWith(this.#node, {
29
+ initiallyDeferred: false,
30
+ }));
31
+ }
32
+ /**
33
+ * Simply calls the provided function passing `this` as the only argument. `$call` returns
34
+ * what the provided function returns.
35
+ */
36
+ $call(func) {
37
+ return func(this);
38
+ }
39
+ toOperationNode() {
40
+ return this.#node;
41
+ }
20
42
  }
21
- preventAwait(UniqueConstraintNodeBuilder, "don't await UniqueConstraintNodeBuilder instances directly.");
@@ -44,5 +44,5 @@ import { Simplify } from './type-utils.js';
44
44
  * ```
45
45
  */
46
46
  export type InferResult<C extends Compilable<any> | CompiledQuery<any>> = C extends Compilable<infer O> ? ResolveResult<O> : C extends CompiledQuery<infer O> ? ResolveResult<O> : never;
47
- type ResolveResult<O> = O extends InsertResult | UpdateResult | DeleteResult | MergeResult ? O : Simplify<O>[];
47
+ type ResolveResult<O> = O extends InsertResult | UpdateResult | DeleteResult | MergeResult ? O[] : Simplify<O>[];
48
48
  export {};
@@ -4,6 +4,7 @@ export declare const LOG_LEVELS: readonly ["query", "error"];
4
4
  export type LogLevel = ArrayItemType<typeof LOG_LEVELS>;
5
5
  export interface QueryLogEvent {
6
6
  readonly level: 'query';
7
+ readonly isStream?: boolean;
7
8
  readonly query: CompiledQuery;
8
9
  readonly queryDurationMillis: number;
9
10
  }
@@ -36,8 +36,9 @@ export class Log {
36
36
  }
37
37
  function defaultLogger(event) {
38
38
  if (event.level === 'query') {
39
- console.log(`kysely:query: ${event.query.sql}`);
40
- console.log(`kysely:query: duration: ${event.queryDurationMillis.toFixed(1)}ms`);
39
+ const prefix = `kysely:query:${event.isStream ? 'stream:' : ''}`;
40
+ console.log(`${prefix} ${event.query.sql}`);
41
+ console.log(`${prefix} duration: ${event.queryDurationMillis.toFixed(1)}ms`);
41
42
  }
42
43
  else if (event.level === 'error') {
43
44
  if (event.error instanceof Error) {
@@ -0,0 +1,7 @@
1
+ import { ConnectionProvider } from '../driver/connection-provider.js';
2
+ import { DatabaseConnection } from '../driver/database-connection.js';
3
+ export interface ControlledConnection {
4
+ readonly connection: DatabaseConnection;
5
+ readonly release: () => void;
6
+ }
7
+ export declare function provideControlledConnection(connectionProvider: ConnectionProvider): Promise<ControlledConnection>;
@@ -0,0 +1,22 @@
1
+ /// <reference types="./provide-controlled-connection.d.ts" />
2
+ import { Deferred } from './deferred.js';
3
+ import { freeze } from './object-utils.js';
4
+ export async function provideControlledConnection(connectionProvider) {
5
+ const connectionDefer = new Deferred();
6
+ const connectionReleaseDefer = new Deferred();
7
+ connectionProvider
8
+ .provideConnection(async (connection) => {
9
+ connectionDefer.resolve(connection);
10
+ return await connectionReleaseDefer.promise;
11
+ })
12
+ .catch((ex) => connectionDefer.reject(ex));
13
+ // Create composite of the connection and the release method instead of
14
+ // modifying the connection or creating a new nesting `DatabaseConnection`.
15
+ // This way we don't accidentally override any methods of 3rd party
16
+ // connections and don't return wrapped connections to drivers that
17
+ // expect a certain specific connection class.
18
+ return freeze({
19
+ connection: await connectionDefer.promise,
20
+ release: connectionReleaseDefer.resolve,
21
+ });
22
+ }
@@ -0,0 +1,5 @@
1
+ import type { KyselyTypeError } from './dist/cjs/util/type-error'
2
+
3
+ declare const Kysely: KyselyTypeError<'The installed TypeScript version is outdated and cannot guarantee type-safety with Kysely. Please upgrade to version 4.6 or newer.'>
4
+ declare const RawBuilder: KyselyTypeError<'The installed TypeScript version is outdated and cannot guarantee type-safety with Kysely. Please upgrade to version 4.6 or newer.'>
5
+ declare const sql: KyselyTypeError<'The installed TypeScript version is outdated and cannot guarantee type-safety with Kysely. Please upgrade to version 4.6 or newer.'>
package/package.json CHANGED
@@ -1,16 +1,23 @@
1
1
  {
2
2
  "name": "kysely",
3
- "version": "0.27.6",
3
+ "version": "0.28.1",
4
4
  "description": "Type safe SQL query builder",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git://github.com/kysely-org/kysely.git"
8
8
  },
9
9
  "engines": {
10
- "node": ">=14.0.0"
10
+ "node": ">=18.0.0"
11
11
  },
12
12
  "main": "dist/cjs/index.js",
13
13
  "module": "dist/esm/index.js",
14
+ "typesVersions": {
15
+ "<4.6": {
16
+ "*": [
17
+ "outdated-typescript.d.ts"
18
+ ]
19
+ }
20
+ },
14
21
  "exports": {
15
22
  ".": {
16
23
  "import": "./dist/esm/index.js",
@@ -40,6 +47,7 @@
40
47
  },
41
48
  "scripts": {
42
49
  "clean": "rm -rf dist & rm -rf test/node/dist & rm -rf test/browser/bundle.js & rm -rf helpers",
50
+ "bench:ts": "npm run build && cd ./test/ts-benchmarks && tsx ./index.ts",
43
51
  "test": "npm run build && npm run test:node:build && npm run test:node:run && npm run test:typings && npm run test:esmimports && npm run test:exports",
44
52
  "test:node:build": "tsc -p test/node",
45
53
  "test:node": "npm run build && npm run test:node:build && npm run test:node:run",
@@ -54,6 +62,7 @@
54
62
  "test:esbuild": "esbuild --bundle --platform=node --external:pg-native dist/esm/index.js --outfile=/dev/null",
55
63
  "test:exports": "attw --pack . && node scripts/check-exports.js",
56
64
  "test:jsdocs": "deno check --doc-only --no-lock --unstable-sloppy-imports --config=\"deno.check.json\" ./src",
65
+ "test:outdatedts": "npm run build && cd test/outdated-ts && npm ci && npm test",
57
66
  "prettier": "prettier --write 'src/**/*.ts' 'test/**/*.ts'",
58
67
  "build": "npm run clean && (npm run build:esm & npm run build:cjs) && npm run script:module-fixup && npm run script:copy-interface-doc",
59
68
  "build:esm": "tsc -p tsconfig.json && npm run script:add-deno-type-references",
@@ -74,6 +83,7 @@
74
83
  ],
75
84
  "devDependencies": {
76
85
  "@arethetypeswrong/cli": "^0.17.0",
86
+ "@ark/attest": "^0.36.0",
77
87
  "@types/better-sqlite3": "^7.6.11",
78
88
  "@types/chai": "^4.3.17",
79
89
  "@types/chai-as-promised": "^7.1.8",
@@ -82,6 +92,7 @@
82
92
  "@types/node": "^22.5.0",
83
93
  "@types/pg": "^8.11.6",
84
94
  "@types/pg-cursor": "^2.7.2",
95
+ "@types/semver": "^7.5.8",
85
96
  "@types/sinon": "^17.0.2",
86
97
  "@types/tedious": "^4.0.9",
87
98
  "better-sqlite3": "^11.2.1",
@@ -92,15 +103,18 @@
92
103
  "lodash": "^4.17.21",
93
104
  "mocha": "^10.7.3",
94
105
  "mysql2": "^3.11.0",
106
+ "pathe": "^1.1.2",
95
107
  "pg": "^8.12.0",
96
108
  "pg-cursor": "^2.11.0",
97
109
  "pkg-pr-new": "^0.0.30",
98
110
  "playwright": "^1.46.1",
99
111
  "prettier": "^3.3.3",
112
+ "semver": "^7.6.3",
100
113
  "sinon": "^19.0.2",
101
114
  "tarn": "^3.0.2",
102
115
  "tedious": "^19.0.0",
103
116
  "tsd": "^0.31.1",
117
+ "tsx": "^4.19.1",
104
118
  "typescript": "^5.6.3"
105
119
  }
106
120
  }
package/CONTRIBUTING.md DELETED
@@ -1,168 +0,0 @@
1
- # Contribution Guidelines
2
-
3
- Wanna contribute to Kysely or other libraries within the [kysely-org](https://github.com/kysely-org) organization?
4
-
5
- You're awesome! 🤗
6
-
7
- ## 😕 How Can I Contribute?
8
-
9
- ## 📢 By Spreading the Word
10
-
11
- If you like what we're building here, please:
12
-
13
- 1. Tell your friends, co-workers, family, neighbors, followers, etc.
14
- 1. Speak about it in meetups and conferences. (if you need help with the presentation, please ask on Discord!).
15
-
16
- There is no company behind this organization and project. We do this in our free time and cannot advertise it
17
- all by ourselves. Companies have dedicated devrel teams doing all that work, other projects might have community
18
- managers or full-time developers with the capacity to also handle social media and meetups with higher frequency.
19
-
20
- More people using Kysely eventually means:
21
-
22
- 1. less bugs left unreported and unsolved.
23
- 1. high chance people share workarounds.
24
- 1. more data points for innovation.
25
- 1. more people who might contribute and push this thing even further.
26
- 1. it becomes a standard part of the Node.js/Bun/Deno developer's toolbox so you'll happily stumble upon it
27
- in future codebases you'll join, or it'll be easier to get buy-in from co-workers/leadership.
28
-
29
- ## 🤝 By Helping People in Issues or on Discord
30
-
31
- We need all the help we can get with supporting the community, answering questions, triaging!
32
-
33
- If you've been using the library for a while, or know a thing or two about SQL, and specific databases, don't
34
- be shy about it!
35
-
36
- ## 🐛 By Submitting Issues (Bugs, Enhancement Ideas, Questions) or Opening threads on Discord
37
-
38
- Please use search and make sure an existing **open** issue or thread doesn't exist before submitting. If an existing
39
- issue is only somewhat relevant, please submit a new issue and reference the old one instead of commenting
40
- on the existing one. Let us label your new issue as `duplicate` if it is the same thing - it's fine! If it's not
41
- the same thing and you commented on another issue, it makes it harder to track on our end.
42
-
43
- If possible/relevant, please provide a [playground link](https://kyse.link), Stackblitz OR a public git repository that
44
- reproduces the issue.
45
-
46
- Please provide the exact error/warning texts you're getting. "this doesn't work" or "this throws an error"
47
- are not helping us help you.
48
-
49
- Don't be an asshole. Don't demand support/service from us.
50
-
51
- ## ⌨️ With Code!
52
-
53
- ### 📘 Documentation Code Contributions
54
-
55
- Pull requests are always welcome!
56
-
57
- The [kysely.dev](https://kysely.dev) application is located @ [/site](https://github.com/kysely-org/kysely/tree/master/site).
58
-
59
- It is a pretty standard [docusaurus](https://docusaurus.io/) application.
60
-
61
- The code examples are extracted, using a custom script (see `"script:generate-site-examples"` @ [package.json](https://github.com/kysely-org/kysely/blob/master/package.json)),
62
- and custom annotations, from [JSDocs](https://jsdoc.app/) comments in the source code @ [/src](https://github.com/kysely-org/kysely/tree/master/src).
63
- If you need to change an existing code example, please do so in the source code AND then run the script.
64
- _TODO: explain how to add a new code example._
65
-
66
- If it is a big change (lots of lines of code OR files involved), please get a conversation going on an issue or on
67
- Discord before starting work on it.
68
-
69
- ### 🧙 Implementation Code Contributions (Bugfixes, Enhancements [Existing or New Features])
70
-
71
- Pull requests (PRs) are welcome, BUT since:
72
-
73
- 1. Our time and capacity as maintainers are limited.
74
- 1. Your time is limited.
75
- 1. Your motivation and morale is important to us.
76
- 1. Onboarding in a new highly opinionated open-source project can be challenging.
77
-
78
- We need a process in place:
79
-
80
- 1. To make sure only things that have a good chance of being accepted are worked on. We hate saying "no".
81
- 1. To make sure that things that are being worked on don't result in too much back-and-forth between authors and maintainers.
82
- We hate seeing these things drag on for a long time, and we know how frustrating it is on your end.
83
- 1. To make sure there's no pressure on you when you take on a task.
84
- 1. To make sure there's a clear understanding of who is working on what to avoid redundancies and conflicts.
85
-
86
- #### The Process
87
-
88
- Here is the gist of it:
89
-
90
- 1. If an issue on the subject **doesn't exist** yet, **submit** one. If you want to work on it, **ask** to be **assigned**
91
- to it in the issue **description**, in the **comments**, OR on **Discord**.
92
- 1. If an issue on the subject **exists** and is labeled with `bug` OR (`enhancement` AND `greenlit`\* OR even `good first issue`\**):
93
- 1. If there is a pull request (**PR**) **linked** to it:
94
- 1. If the **PR** is **stale** (a few months without new commits or comments from the PR author OR Kysely maintainers),
95
- **ask** to be **assigned** to it and continue work on the PR.
96
- 1. If the **PR** is **not stale**, you can still offer some review comments, or **ask** to **pair** up with the PR author.
97
- 1. If there is **no PR linked** to it and a person is **already assigned** to it:
98
- 1. If the assignment is stale (a few weeks without a PR opened after the person was assigned to the issue), ask
99
- to be assigned to the issue in the comments OR on Discord.
100
- 1. If the assignment is not stale, it's OK to ask the assignee if they'll be willing to pair up.
101
- 1. If there is no PR linked to it and no assignee, ask to be assigned to it in the comments OR on Discord.
102
-
103
- _\* an issue that was reviewed by the maintainers and would be nice to get a pull request for from the community._
104
-
105
- _\** an issue that was reviewed by the maintainers and would be a nice opportunity to onboard an open-source newbie
106
- into the codebase._
107
-
108
- Once you're assigned to an issue, you can start working on your code changes. It's best to ask questions
109
- in the issue or on Discord as early as possible, and even share your progress with the maintainers and community via a
110
- draft (WIP) pull request.
111
-
112
- #### Style/Design Philosophy
113
-
114
- * Kysely should have zero dependencies.
115
-
116
- * Kysely should work in all JavaScript environments (node.js, deno & modern browsers),
117
- even though the main focus is node.js.
118
-
119
- * Everything is immutable.
120
-
121
- * The API should be as close to writing raw SQL as possible while still providing
122
- type safety.
123
-
124
- * Everything outside of dialect implementations is dialect-agnostic.
125
-
126
- * Everything is tested.
127
-
128
- * Functionality - No mocks. Everything is tested against real database instances.
129
- No partial testing. If a sql "thing" is supported by some databases, test it
130
- against all of them.
131
-
132
- * Types - We're a type-safe package, you get the idea.
133
-
134
- * Everything consumer-facing should be documented.
135
-
136
- * Everything is type-safe. Things that cannot be implemented in a way that is safe
137
- for all cases, are best left for consumers to implement.
138
-
139
- * Most features should have escape hatches.
140
-
141
- #### Getting Started
142
-
143
- 1. fork kysely.
144
-
145
- 1. clone your fork.
146
-
147
- 1. install node.js (preferably the latest even-numbered version).
148
-
149
- 1. run `npm i` in your terminal to install dependencies.
150
-
151
- 1. create a branch (we don't care about naming).
152
-
153
- 1. create a draft pull request. link the relevant issue by referring to it in the
154
- PR's description. E.g. `closes #123` will link the PR to issue/pull request #123.
155
-
156
- 1. implement your changes.
157
-
158
- #### Testing
159
-
160
- 1. write functionality tests @ [/test/node](https://github.com/kysely-org/kysely/tree/master/test/node).
161
-
162
- 1. write typings tests @ [/test/typings](https://github.com/kysely-org/kysely/tree/master/test/typings)
163
-
164
- 1. install docker.
165
-
166
- 1. run `docker compose up` in your terminal to spin up database instances.
167
-
168
- 1. run `npm test` in another terminal to run tests.
@@ -1,15 +0,0 @@
1
- import { ColumnNode } from './column-node.js';
2
- import { IdentifierNode } from './identifier-node.js';
3
- import { OperationNode } from './operation-node.js';
4
- export interface PrimaryKeyConstraintNode extends OperationNode {
5
- readonly kind: 'PrimaryKeyConstraintNode';
6
- readonly columns: ReadonlyArray<ColumnNode>;
7
- readonly name?: IdentifierNode;
8
- }
9
- /**
10
- * @internal
11
- */
12
- export declare const PrimaryConstraintNode: Readonly<{
13
- is(node: OperationNode): node is PrimaryKeyConstraintNode;
14
- create(columns: string[], constraintName?: string): PrimaryKeyConstraintNode;
15
- }>;
@@ -1 +0,0 @@
1
- export declare function preventAwait(clazz: Function, message: string): void;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.preventAwait = preventAwait;
4
- function preventAwait(clazz, message) {
5
- Object.defineProperties(clazz.prototype, {
6
- then: {
7
- enumerable: false,
8
- value: () => {
9
- throw new Error(message);
10
- },
11
- },
12
- });
13
- }
@@ -1,15 +0,0 @@
1
- import { ColumnNode } from './column-node.js';
2
- import { IdentifierNode } from './identifier-node.js';
3
- import { OperationNode } from './operation-node.js';
4
- export interface PrimaryKeyConstraintNode extends OperationNode {
5
- readonly kind: 'PrimaryKeyConstraintNode';
6
- readonly columns: ReadonlyArray<ColumnNode>;
7
- readonly name?: IdentifierNode;
8
- }
9
- /**
10
- * @internal
11
- */
12
- export declare const PrimaryConstraintNode: Readonly<{
13
- is(node: OperationNode): node is PrimaryKeyConstraintNode;
14
- create(columns: string[], constraintName?: string): PrimaryKeyConstraintNode;
15
- }>;
@@ -1 +0,0 @@
1
- export declare function preventAwait(clazz: Function, message: string): void;
@@ -1,11 +0,0 @@
1
- /// <reference types="./prevent-await.d.ts" />
2
- export function preventAwait(clazz, message) {
3
- Object.defineProperties(clazz.prototype, {
4
- then: {
5
- enumerable: false,
6
- value: () => {
7
- throw new Error(message);
8
- },
9
- },
10
- });
11
- }