@uql/core 1.0.12 → 3.1.0

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 (464) hide show
  1. package/CHANGELOG.md +254 -0
  2. package/LICENSE.md +2 -2
  3. package/dist/browser/http/bus.d.ts +3 -0
  4. package/dist/browser/http/bus.js +14 -0
  5. package/dist/browser/http/http.d.ts +6 -0
  6. package/dist/browser/http/http.js +45 -0
  7. package/dist/browser/http/index.d.ts +2 -0
  8. package/dist/browser/http/index.js +3 -0
  9. package/dist/browser/index.d.ts +4 -0
  10. package/dist/browser/index.js +5 -0
  11. package/dist/browser/options.d.ts +4 -0
  12. package/dist/browser/options.js +14 -0
  13. package/dist/browser/querier/genericClientRepository.d.ts +17 -0
  14. package/dist/browser/querier/genericClientRepository.js +39 -0
  15. package/dist/browser/querier/httpQuerier.d.ts +20 -0
  16. package/dist/browser/querier/httpQuerier.js +71 -0
  17. package/dist/browser/querier/index.d.ts +3 -0
  18. package/dist/browser/querier/index.js +4 -0
  19. package/dist/browser/querier/querier.util.d.ts +2 -0
  20. package/dist/browser/querier/querier.util.js +17 -0
  21. package/dist/browser/type/clientQuerier.d.ts +16 -0
  22. package/dist/browser/type/clientQuerier.js +2 -0
  23. package/dist/browser/type/clientQuerierPool.d.ts +4 -0
  24. package/dist/browser/type/clientQuerierPool.js +2 -0
  25. package/dist/browser/type/clientRepository.d.ts +13 -0
  26. package/dist/browser/type/clientRepository.js +2 -0
  27. package/dist/browser/type/index.d.ts +4 -0
  28. package/dist/browser/type/index.js +5 -0
  29. package/dist/browser/type/request.d.ts +28 -0
  30. package/dist/browser/type/request.js +2 -0
  31. package/dist/browser/uql-browser.min.js +2150 -0
  32. package/dist/browser/uql-browser.min.js.map +1 -0
  33. package/dist/dialect/abstractDialect.d.ts +16 -0
  34. package/dist/dialect/abstractDialect.js +28 -0
  35. package/dist/dialect/abstractSqlDialect.d.ts +47 -0
  36. package/dist/dialect/abstractSqlDialect.js +650 -0
  37. package/dist/dialect/index.d.ts +3 -0
  38. package/dist/dialect/index.js +4 -0
  39. package/dist/dialect/queryContext.d.ts +48 -0
  40. package/dist/dialect/queryContext.js +65 -0
  41. package/{entity → dist/entity}/decorator/definition.d.ts +3 -3
  42. package/dist/entity/decorator/definition.js +214 -0
  43. package/{entity → dist/entity}/decorator/entity.d.ts +1 -1
  44. package/dist/entity/decorator/entity.js +7 -0
  45. package/{entity → dist/entity}/decorator/field.d.ts +1 -1
  46. package/dist/entity/decorator/field.js +8 -0
  47. package/{entity → dist/entity}/decorator/id.d.ts +1 -1
  48. package/dist/entity/decorator/id.js +8 -0
  49. package/dist/entity/decorator/index.d.ts +5 -0
  50. package/dist/entity/decorator/index.js +6 -0
  51. package/{entity → dist/entity}/decorator/relation.d.ts +1 -1
  52. package/dist/entity/decorator/relation.js +20 -0
  53. package/dist/entity/index.d.ts +1 -0
  54. package/dist/entity/index.js +2 -0
  55. package/dist/express/index.d.ts +2 -0
  56. package/dist/express/index.js +3 -0
  57. package/dist/express/querierMiddleware.d.ts +26 -0
  58. package/dist/express/querierMiddleware.js +190 -0
  59. package/dist/express/query.util.d.ts +2 -0
  60. package/dist/express/query.util.js +19 -0
  61. package/dist/index.d.ts +9 -0
  62. package/dist/index.js +10 -0
  63. package/dist/maria/index.d.ts +3 -0
  64. package/dist/maria/index.js +4 -0
  65. package/dist/maria/mariaDialect.d.ts +8 -0
  66. package/dist/maria/mariaDialect.js +38 -0
  67. package/dist/maria/mariaQuerierPool.test.d.ts +5 -0
  68. package/dist/maria/mariaQuerierPool.test.js +19 -0
  69. package/dist/maria/mariadbQuerier.d.ts +17 -0
  70. package/dist/maria/mariadbQuerier.js +39 -0
  71. package/dist/maria/mariadbQuerier.test.d.ts +4 -0
  72. package/dist/maria/mariadbQuerier.test.js +19 -0
  73. package/dist/maria/mariadbQuerierPool.d.ts +10 -0
  74. package/dist/maria/mariadbQuerierPool.js +17 -0
  75. package/dist/migrate/cli.d.ts +2 -0
  76. package/dist/migrate/cli.js +254 -0
  77. package/dist/migrate/generator/index.d.ts +4 -0
  78. package/dist/migrate/generator/index.js +5 -0
  79. package/dist/migrate/generator/mongoSchemaGenerator.d.ts +12 -0
  80. package/dist/migrate/generator/mongoSchemaGenerator.js +100 -0
  81. package/dist/migrate/generator/mysqlSchemaGenerator.d.ts +14 -0
  82. package/dist/migrate/generator/mysqlSchemaGenerator.js +81 -0
  83. package/dist/migrate/generator/postgresSchemaGenerator.d.ts +18 -0
  84. package/dist/migrate/generator/postgresSchemaGenerator.js +111 -0
  85. package/dist/migrate/generator/sqliteSchemaGenerator.d.ts +14 -0
  86. package/dist/migrate/generator/sqliteSchemaGenerator.js +68 -0
  87. package/dist/migrate/index.d.ts +12 -0
  88. package/dist/migrate/index.js +17 -0
  89. package/dist/migrate/introspection/index.d.ts +4 -0
  90. package/dist/migrate/introspection/index.js +5 -0
  91. package/dist/migrate/introspection/mongoIntrospector.d.ts +8 -0
  92. package/dist/migrate/introspection/mongoIntrospector.js +46 -0
  93. package/dist/migrate/introspection/mysqlIntrospector.d.ts +25 -0
  94. package/dist/migrate/introspection/mysqlIntrospector.js +220 -0
  95. package/dist/migrate/introspection/postgresIntrospector.d.ts +21 -0
  96. package/dist/migrate/introspection/postgresIntrospector.js +269 -0
  97. package/dist/migrate/introspection/sqliteIntrospector.d.ts +23 -0
  98. package/dist/migrate/introspection/sqliteIntrospector.js +212 -0
  99. package/dist/migrate/migrator-mongo.test.d.ts +1 -0
  100. package/dist/migrate/migrator-mongo.test.js +54 -0
  101. package/dist/migrate/migrator.d.ts +133 -0
  102. package/dist/migrate/migrator.js +600 -0
  103. package/dist/migrate/migrator.test.d.ts +1 -0
  104. package/dist/migrate/migrator.test.js +106 -0
  105. package/dist/migrate/schemaGenerator.d.ts +78 -0
  106. package/dist/migrate/schemaGenerator.js +363 -0
  107. package/dist/migrate/storage/databaseStorage.d.ts +24 -0
  108. package/dist/migrate/storage/databaseStorage.js +77 -0
  109. package/dist/migrate/storage/index.d.ts +2 -0
  110. package/dist/migrate/storage/index.js +3 -0
  111. package/dist/migrate/storage/jsonStorage.d.ts +15 -0
  112. package/dist/migrate/storage/jsonStorage.js +51 -0
  113. package/dist/migrate/type.d.ts +1 -0
  114. package/dist/migrate/type.js +2 -0
  115. package/dist/mongo/index.d.ts +3 -0
  116. package/dist/mongo/index.js +4 -0
  117. package/dist/mongo/mongoDialect.d.ts +34 -0
  118. package/dist/mongo/mongoDialect.js +163 -0
  119. package/dist/mongo/mongodbQuerier.d.ts +28 -0
  120. package/dist/mongo/mongodbQuerier.js +204 -0
  121. package/dist/mongo/mongodbQuerier.test.d.ts +1 -0
  122. package/dist/mongo/mongodbQuerier.test.js +36 -0
  123. package/dist/mongo/mongodbQuerierPool.d.ts +10 -0
  124. package/dist/mongo/mongodbQuerierPool.js +20 -0
  125. package/dist/mongo/mongodbQuerierPool.test.d.ts +1 -0
  126. package/dist/mongo/mongodbQuerierPool.test.js +21 -0
  127. package/dist/mysql/index.d.ts +3 -0
  128. package/dist/mysql/index.js +4 -0
  129. package/dist/mysql/mysql2Querier.d.ts +17 -0
  130. package/dist/mysql/mysql2Querier.js +43 -0
  131. package/dist/mysql/mysql2Querier.test.d.ts +4 -0
  132. package/dist/mysql/mysql2Querier.test.js +16 -0
  133. package/dist/mysql/mysql2QuerierPool.d.ts +10 -0
  134. package/dist/mysql/mysql2QuerierPool.js +17 -0
  135. package/dist/mysql/mysql2QuerierPool.test.d.ts +5 -0
  136. package/dist/mysql/mysql2QuerierPool.test.js +16 -0
  137. package/dist/mysql/mysqlDialect.d.ts +5 -0
  138. package/dist/mysql/mysqlDialect.js +15 -0
  139. package/dist/namingStrategy/defaultNamingStrategy.d.ts +9 -0
  140. package/dist/namingStrategy/defaultNamingStrategy.js +15 -0
  141. package/dist/namingStrategy/index.d.ts +2 -0
  142. package/dist/namingStrategy/index.js +3 -0
  143. package/dist/namingStrategy/snakeCaseNamingStrategy.d.ts +8 -0
  144. package/dist/namingStrategy/snakeCaseNamingStrategy.js +14 -0
  145. package/{options.d.ts → dist/options.d.ts} +1 -1
  146. package/dist/options.js +14 -0
  147. package/dist/package.json +131 -0
  148. package/dist/postgres/index.d.ts +3 -0
  149. package/dist/postgres/index.js +4 -0
  150. package/dist/postgres/pgQuerier.d.ts +17 -0
  151. package/dist/postgres/pgQuerier.js +39 -0
  152. package/dist/postgres/pgQuerier.test.d.ts +4 -0
  153. package/dist/postgres/pgQuerier.test.js +20 -0
  154. package/dist/postgres/pgQuerierPool.d.ts +10 -0
  155. package/dist/postgres/pgQuerierPool.js +17 -0
  156. package/dist/postgres/pgQuerierPool.test.d.ts +5 -0
  157. package/dist/postgres/pgQuerierPool.test.js +23 -0
  158. package/dist/postgres/postgresDialect.d.ts +13 -0
  159. package/dist/postgres/postgresDialect.js +110 -0
  160. package/dist/querier/abstractQuerier-test.d.ts +45 -0
  161. package/dist/querier/abstractQuerier-test.js +461 -0
  162. package/dist/querier/abstractQuerier.d.ts +50 -0
  163. package/dist/querier/abstractQuerier.js +278 -0
  164. package/dist/querier/abstractQuerierPool-test.d.ts +9 -0
  165. package/dist/querier/abstractQuerierPool-test.js +18 -0
  166. package/dist/querier/abstractQuerierPool.d.ts +14 -0
  167. package/dist/querier/abstractQuerierPool.js +9 -0
  168. package/dist/querier/abstractSqlQuerier-test.d.ts +9 -0
  169. package/dist/querier/abstractSqlQuerier-test.js +16 -0
  170. package/dist/querier/abstractSqlQuerier.d.ts +28 -0
  171. package/dist/querier/abstractSqlQuerier.js +133 -0
  172. package/dist/querier/decorator/index.d.ts +3 -0
  173. package/dist/querier/decorator/index.js +4 -0
  174. package/dist/querier/decorator/injectQuerier.d.ts +3 -0
  175. package/dist/querier/decorator/injectQuerier.js +33 -0
  176. package/dist/querier/decorator/serialized.d.ts +6 -0
  177. package/dist/querier/decorator/serialized.js +14 -0
  178. package/{querier → dist/querier}/decorator/transactional.d.ts +1 -1
  179. package/dist/querier/decorator/transactional.js +48 -0
  180. package/dist/querier/index.d.ts +4 -0
  181. package/dist/querier/index.js +5 -0
  182. package/dist/repository/genericRepository.d.ts +20 -0
  183. package/dist/repository/genericRepository.js +51 -0
  184. package/dist/repository/index.d.ts +1 -0
  185. package/dist/repository/index.js +2 -0
  186. package/dist/sqlite/index.d.ts +3 -0
  187. package/dist/sqlite/index.js +4 -0
  188. package/dist/sqlite/sqliteDialect.d.ts +10 -0
  189. package/dist/sqlite/sqliteDialect.js +48 -0
  190. package/dist/sqlite/sqliteQuerier.d.ts +15 -0
  191. package/dist/sqlite/sqliteQuerier.js +33 -0
  192. package/dist/sqlite/sqliteQuerier.test.d.ts +5 -0
  193. package/dist/sqlite/sqliteQuerier.test.js +19 -0
  194. package/dist/sqlite/sqliteQuerierPool.d.ts +14 -0
  195. package/dist/sqlite/sqliteQuerierPool.js +34 -0
  196. package/dist/sqlite/sqliteQuerierPool.test.d.ts +5 -0
  197. package/dist/sqlite/sqliteQuerierPool.test.js +10 -0
  198. package/dist/test/entityMock.d.ts +164 -0
  199. package/dist/test/entityMock.js +554 -0
  200. package/dist/test/index.d.ts +3 -0
  201. package/dist/test/index.js +4 -0
  202. package/dist/test/it.util.d.ts +4 -0
  203. package/dist/test/it.util.js +55 -0
  204. package/dist/test/spec.util.d.ts +14 -0
  205. package/dist/test/spec.util.js +50 -0
  206. package/{type → dist/type}/entity.d.ts +97 -4
  207. package/dist/type/entity.js +5 -0
  208. package/dist/type/index.d.ts +9 -0
  209. package/dist/type/index.js +10 -0
  210. package/dist/type/migration.d.ts +213 -0
  211. package/dist/type/migration.js +2 -0
  212. package/dist/type/namingStrategy.d.ts +17 -0
  213. package/dist/type/namingStrategy.js +2 -0
  214. package/dist/type/querier.d.ts +96 -0
  215. package/dist/type/querier.js +11 -0
  216. package/{type → dist/type}/querierPool.d.ts +7 -3
  217. package/dist/type/querierPool.js +2 -0
  218. package/{type → dist/type}/query.d.ts +170 -108
  219. package/dist/type/query.js +9 -0
  220. package/{type → dist/type}/repository.d.ts +42 -35
  221. package/dist/type/repository.js +2 -0
  222. package/{type → dist/type}/universalQuerier.d.ts +50 -28
  223. package/dist/type/universalQuerier.js +2 -0
  224. package/dist/type/utility.d.ts +13 -0
  225. package/dist/type/utility.js +2 -0
  226. package/dist/util/dialect.util.d.ts +12 -0
  227. package/dist/util/dialect.util.js +93 -0
  228. package/dist/util/index.d.ts +5 -0
  229. package/dist/util/index.js +6 -0
  230. package/dist/util/object.util.d.ts +7 -0
  231. package/dist/util/object.util.js +19 -0
  232. package/dist/util/raw.d.ts +8 -0
  233. package/dist/util/raw.js +11 -0
  234. package/dist/util/sql.util.d.ts +13 -0
  235. package/dist/util/sql.util.js +78 -0
  236. package/{util → dist/util}/string.util.d.ts +1 -0
  237. package/dist/util/string.util.js +34 -0
  238. package/package.json +85 -17
  239. package/src/@types/index.d.ts +1 -0
  240. package/src/@types/jest.d.ts +6 -0
  241. package/src/browser/http/bus.spec.ts +22 -0
  242. package/src/browser/http/bus.ts +17 -0
  243. package/src/browser/http/http.spec.ts +70 -0
  244. package/src/browser/http/http.ts +55 -0
  245. package/src/browser/http/index.ts +2 -0
  246. package/src/browser/index.ts +4 -0
  247. package/src/browser/options.spec.ts +37 -0
  248. package/src/browser/options.ts +18 -0
  249. package/src/browser/querier/genericClientRepository.spec.ts +105 -0
  250. package/src/browser/querier/genericClientRepository.ts +49 -0
  251. package/src/browser/querier/httpQuerier.ts +82 -0
  252. package/src/browser/querier/index.ts +3 -0
  253. package/src/browser/querier/querier.util.spec.ts +35 -0
  254. package/src/browser/querier/querier.util.ts +18 -0
  255. package/src/browser/type/clientQuerier.ts +45 -0
  256. package/src/browser/type/clientQuerierPool.ts +5 -0
  257. package/src/browser/type/clientRepository.ts +22 -0
  258. package/src/browser/type/index.ts +4 -0
  259. package/src/browser/type/request.ts +25 -0
  260. package/src/dialect/abstractDialect.ts +28 -0
  261. package/src/dialect/abstractSqlDialect-spec.ts +1309 -0
  262. package/src/dialect/abstractSqlDialect.ts +805 -0
  263. package/src/dialect/index.ts +3 -0
  264. package/src/dialect/namingStrategy.spec.ts +52 -0
  265. package/src/dialect/queryContext.ts +69 -0
  266. package/src/entity/decorator/definition.spec.ts +736 -0
  267. package/src/entity/decorator/definition.ts +265 -0
  268. package/src/entity/decorator/entity.ts +8 -0
  269. package/src/entity/decorator/field.ts +9 -0
  270. package/src/entity/decorator/id.ts +9 -0
  271. package/src/entity/decorator/index.ts +5 -0
  272. package/src/entity/decorator/relation.spec.ts +41 -0
  273. package/src/entity/decorator/relation.ts +34 -0
  274. package/src/entity/index.ts +1 -0
  275. package/src/express/@types/express.d.ts +8 -0
  276. package/src/express/@types/index.d.ts +1 -0
  277. package/src/express/index.ts +2 -0
  278. package/src/express/querierMiddleware.ts +217 -0
  279. package/src/express/query.util.spec.ts +40 -0
  280. package/src/express/query.util.ts +21 -0
  281. package/src/index.ts +9 -0
  282. package/src/maria/index.ts +3 -0
  283. package/src/maria/mariaDialect.spec.ts +207 -0
  284. package/src/maria/mariaDialect.ts +42 -0
  285. package/src/maria/mariaQuerierPool.test.ts +23 -0
  286. package/src/maria/mariadbQuerier.test.ts +23 -0
  287. package/src/maria/mariadbQuerier.ts +45 -0
  288. package/src/maria/mariadbQuerierPool.ts +21 -0
  289. package/src/migrate/cli.ts +301 -0
  290. package/src/migrate/generator/index.ts +4 -0
  291. package/src/migrate/generator/mongoSchemaGenerator.spec.ts +112 -0
  292. package/src/migrate/generator/mongoSchemaGenerator.ts +115 -0
  293. package/src/migrate/generator/mysqlSchemaGenerator.spec.ts +34 -0
  294. package/src/migrate/generator/mysqlSchemaGenerator.ts +92 -0
  295. package/src/migrate/generator/postgresSchemaGenerator.spec.ts +44 -0
  296. package/src/migrate/generator/postgresSchemaGenerator.ts +127 -0
  297. package/src/migrate/generator/sqliteSchemaGenerator.spec.ts +33 -0
  298. package/src/migrate/generator/sqliteSchemaGenerator.ts +81 -0
  299. package/src/migrate/index.ts +41 -0
  300. package/src/migrate/introspection/index.ts +4 -0
  301. package/src/migrate/introspection/mongoIntrospector.spec.ts +75 -0
  302. package/src/migrate/introspection/mongoIntrospector.ts +47 -0
  303. package/src/migrate/introspection/mysqlIntrospector.spec.ts +113 -0
  304. package/src/migrate/introspection/mysqlIntrospector.ts +278 -0
  305. package/src/migrate/introspection/postgresIntrospector.spec.ts +112 -0
  306. package/src/migrate/introspection/postgresIntrospector.ts +329 -0
  307. package/src/migrate/introspection/sqliteIntrospector.spec.ts +112 -0
  308. package/src/migrate/introspection/sqliteIntrospector.ts +296 -0
  309. package/src/migrate/migrator-mongo.test.ts +54 -0
  310. package/src/migrate/migrator.spec.ts +255 -0
  311. package/src/migrate/migrator.test.ts +94 -0
  312. package/src/migrate/migrator.ts +719 -0
  313. package/src/migrate/namingStrategy.spec.ts +22 -0
  314. package/src/migrate/schemaGenerator-advanced.spec.ts +138 -0
  315. package/src/migrate/schemaGenerator.spec.ts +190 -0
  316. package/src/migrate/schemaGenerator.ts +478 -0
  317. package/src/migrate/storage/databaseStorage.spec.ts +69 -0
  318. package/src/migrate/storage/databaseStorage.ts +100 -0
  319. package/src/migrate/storage/index.ts +2 -0
  320. package/src/migrate/storage/jsonStorage.ts +58 -0
  321. package/src/migrate/type.ts +1 -0
  322. package/src/mongo/index.ts +3 -0
  323. package/src/mongo/mongoDialect.spec.ts +251 -0
  324. package/src/mongo/mongoDialect.ts +238 -0
  325. package/src/mongo/mongodbQuerier.test.ts +45 -0
  326. package/src/mongo/mongodbQuerier.ts +256 -0
  327. package/src/mongo/mongodbQuerierPool.test.ts +25 -0
  328. package/src/mongo/mongodbQuerierPool.ts +24 -0
  329. package/src/mysql/index.ts +3 -0
  330. package/src/mysql/mysql2Querier.test.ts +20 -0
  331. package/src/mysql/mysql2Querier.ts +49 -0
  332. package/src/mysql/mysql2QuerierPool.test.ts +20 -0
  333. package/src/mysql/mysql2QuerierPool.ts +21 -0
  334. package/src/mysql/mysqlDialect.spec.ts +20 -0
  335. package/src/mysql/mysqlDialect.ts +16 -0
  336. package/src/namingStrategy/defaultNamingStrategy.ts +18 -0
  337. package/src/namingStrategy/index.spec.ts +36 -0
  338. package/src/namingStrategy/index.ts +2 -0
  339. package/src/namingStrategy/snakeCaseNamingStrategy.ts +15 -0
  340. package/src/options.spec.ts +41 -0
  341. package/src/options.ts +18 -0
  342. package/src/postgres/index.ts +3 -0
  343. package/src/postgres/manual-types.d.ts +4 -0
  344. package/src/postgres/pgQuerier.test.ts +25 -0
  345. package/src/postgres/pgQuerier.ts +45 -0
  346. package/src/postgres/pgQuerierPool.test.ts +28 -0
  347. package/src/postgres/pgQuerierPool.ts +21 -0
  348. package/src/postgres/postgresDialect.spec.ts +428 -0
  349. package/src/postgres/postgresDialect.ts +144 -0
  350. package/src/querier/abstractQuerier-test.ts +584 -0
  351. package/src/querier/abstractQuerier.ts +353 -0
  352. package/src/querier/abstractQuerierPool-test.ts +20 -0
  353. package/src/querier/abstractQuerierPool.ts +18 -0
  354. package/src/querier/abstractSqlQuerier-spec.ts +979 -0
  355. package/src/querier/abstractSqlQuerier-test.ts +21 -0
  356. package/src/querier/abstractSqlQuerier.ts +138 -0
  357. package/src/querier/decorator/index.ts +3 -0
  358. package/src/querier/decorator/injectQuerier.spec.ts +74 -0
  359. package/src/querier/decorator/injectQuerier.ts +45 -0
  360. package/src/querier/decorator/serialized.spec.ts +98 -0
  361. package/src/querier/decorator/serialized.ts +13 -0
  362. package/src/querier/decorator/transactional.spec.ts +240 -0
  363. package/src/querier/decorator/transactional.ts +56 -0
  364. package/src/querier/index.ts +4 -0
  365. package/src/repository/genericRepository.spec.ts +111 -0
  366. package/src/repository/genericRepository.ts +74 -0
  367. package/src/repository/index.ts +1 -0
  368. package/src/sqlite/index.ts +3 -0
  369. package/src/sqlite/manual-types.d.ts +4 -0
  370. package/src/sqlite/sqliteDialect.spec.ts +155 -0
  371. package/src/sqlite/sqliteDialect.ts +76 -0
  372. package/src/sqlite/sqliteQuerier.spec.ts +36 -0
  373. package/src/sqlite/sqliteQuerier.test.ts +21 -0
  374. package/src/sqlite/sqliteQuerier.ts +37 -0
  375. package/src/sqlite/sqliteQuerierPool.test.ts +12 -0
  376. package/src/sqlite/sqliteQuerierPool.ts +38 -0
  377. package/src/test/entityMock.ts +375 -0
  378. package/src/test/index.ts +3 -0
  379. package/src/test/it.util.ts +69 -0
  380. package/src/test/spec.util.ts +57 -0
  381. package/src/type/entity.ts +218 -0
  382. package/src/type/index.ts +9 -0
  383. package/src/type/migration.ts +241 -0
  384. package/src/type/namingStrategy.ts +17 -0
  385. package/src/type/querier.ts +143 -0
  386. package/src/type/querierPool.ts +26 -0
  387. package/src/type/query.ts +506 -0
  388. package/src/type/repository.ts +142 -0
  389. package/src/type/universalQuerier.ts +133 -0
  390. package/src/type/utility.ts +21 -0
  391. package/src/util/dialect.util-extra.spec.ts +96 -0
  392. package/src/util/dialect.util.spec.ts +23 -0
  393. package/src/util/dialect.util.ts +134 -0
  394. package/src/util/index.ts +5 -0
  395. package/src/util/object.util.spec.ts +29 -0
  396. package/src/util/object.util.ts +27 -0
  397. package/src/util/raw.ts +11 -0
  398. package/src/util/sql.util-extra.spec.ts +17 -0
  399. package/src/util/sql.util.spec.ts +208 -0
  400. package/src/util/sql.util.ts +104 -0
  401. package/src/util/string.util.spec.ts +46 -0
  402. package/src/util/string.util.ts +35 -0
  403. package/tsconfig.build.json +5 -0
  404. package/tsconfig.json +8 -0
  405. package/README.md +0 -177
  406. package/dialect/abstractSqlDialect.d.ts +0 -30
  407. package/dialect/abstractSqlDialect.js +0 -365
  408. package/dialect/index.d.ts +0 -4
  409. package/dialect/index.js +0 -8
  410. package/dialect/mysqlDialect.d.ts +0 -6
  411. package/dialect/mysqlDialect.js +0 -21
  412. package/dialect/postgresDialect.d.ts +0 -8
  413. package/dialect/postgresDialect.js +0 -44
  414. package/dialect/sqliteDialect.d.ts +0 -4
  415. package/dialect/sqliteDialect.js +0 -11
  416. package/entity/decorator/definition.js +0 -223
  417. package/entity/decorator/entity.js +0 -11
  418. package/entity/decorator/field.js +0 -12
  419. package/entity/decorator/id.js +0 -12
  420. package/entity/decorator/index.d.ts +0 -5
  421. package/entity/decorator/index.js +0 -12
  422. package/entity/decorator/relation.js +0 -27
  423. package/entity/index.d.ts +0 -1
  424. package/entity/index.js +0 -5
  425. package/index.d.ts +0 -1
  426. package/index.js +0 -5
  427. package/options.js +0 -20
  428. package/querier/abstractQuerier.d.ts +0 -30
  429. package/querier/abstractQuerier.js +0 -230
  430. package/querier/abstractSqlQuerier.d.ts +0 -27
  431. package/querier/abstractSqlQuerier.js +0 -88
  432. package/querier/decorator/index.d.ts +0 -2
  433. package/querier/decorator/index.js +0 -6
  434. package/querier/decorator/injectQuerier.d.ts +0 -3
  435. package/querier/decorator/injectQuerier.js +0 -39
  436. package/querier/decorator/transactional.js +0 -52
  437. package/querier/index.d.ts +0 -3
  438. package/querier/index.js +0 -7
  439. package/repository/genericRepository.d.ts +0 -19
  440. package/repository/genericRepository.js +0 -52
  441. package/repository/index.d.ts +0 -1
  442. package/repository/index.js +0 -5
  443. package/type/entity.js +0 -5
  444. package/type/index.d.ts +0 -7
  445. package/type/index.js +0 -11
  446. package/type/querier.d.ts +0 -53
  447. package/type/querier.js +0 -3
  448. package/type/querierPool.js +0 -3
  449. package/type/query.js +0 -13
  450. package/type/repository.js +0 -3
  451. package/type/universalQuerier.js +0 -3
  452. package/type/utility.d.ts +0 -12
  453. package/type/utility.js +0 -3
  454. package/util/dialect.util.d.ts +0 -17
  455. package/util/dialect.util.js +0 -114
  456. package/util/index.d.ts +0 -5
  457. package/util/index.js +0 -9
  458. package/util/object.util.d.ts +0 -3
  459. package/util/object.util.js +0 -22
  460. package/util/raw.d.ts +0 -2
  461. package/util/raw.js +0 -9
  462. package/util/sql.util.d.ts +0 -2
  463. package/util/sql.util.js +0 -55
  464. package/util/string.util.js +0 -20
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcmllclBvb2wuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZS9xdWVyaWVyUG9vbC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHR5cGUgeyBEaWFsZWN0LCBFeHRyYU9wdGlvbnMsIFF1ZXJpZXIgfSBmcm9tICcuL3F1ZXJpZXIuanMnO1xuXG4vKipcbiAqIHF1ZXJpZXIgcG9vbC5cbiAqL1xuZXhwb3J0IHR5cGUgUXVlcmllclBvb2w8USBleHRlbmRzIFF1ZXJpZXIgPSBRdWVyaWVyPiA9IHtcbiAgLyoqXG4gICAqIHRoZSBkYXRhYmFzZSBkaWFsZWN0LlxuICAgKi9cbiAgcmVhZG9ubHkgZGlhbGVjdDogRGlhbGVjdDtcblxuICAvKipcbiAgICogZXh0cmEgb3B0aW9uc1xuICAgKi9cbiAgcmVhZG9ubHkgZXh0cmE/OiBFeHRyYU9wdGlvbnM7XG5cbiAgLyoqXG4gICAqIGdldCBhIHF1ZXJpZXIgZnJvbSB0aGUgcG9vbC5cbiAgICovXG4gIGdldFF1ZXJpZXI6ICgpID0+IFByb21pc2U8UT47XG5cbiAgLyoqXG4gICAqIGVuZCB0aGUgcG9vbC5cbiAgICovXG4gIGVuZCgpOiBQcm9taXNlPHZvaWQ+O1xufTtcbiJdfQ==
@@ -1,60 +1,68 @@
1
- import { FieldKey, IdValue, Key, RelationKey } from './entity';
2
- import { BooleanLike, ExpandScalar, Scalar, Type, Unpacked } from './utility';
1
+ import type { FieldKey, IdValue, Key, RelationKey } from './entity.js';
2
+ import type { BooleanLike, ExpandScalar, Scalar, Type, Unpacked } from './utility.js';
3
3
  export type QueryOptions = {
4
4
  /**
5
5
  * use or omit `softDelete` attribute.
6
6
  */
7
- readonly softDelete?: boolean;
7
+ softDelete?: boolean;
8
8
  /**
9
9
  * prefix the query with this.
10
10
  */
11
- readonly prefix?: string;
11
+ prefix?: string;
12
12
  /**
13
13
  * automatically infer the prefix for the query.
14
14
  */
15
- readonly autoPrefix?: boolean;
15
+ autoPrefix?: boolean;
16
16
  };
17
- export type QueryProjectOptions = {
17
+ export type QuerySelectOptions = {
18
18
  /**
19
19
  * prefix the query with this.
20
20
  */
21
- readonly prefix?: string;
21
+ prefix?: string;
22
22
  /**
23
23
  * automatically add the prefix for the alias.
24
24
  */
25
- readonly autoPrefixAlias?: boolean;
25
+ autoPrefixAlias?: boolean;
26
26
  };
27
27
  /**
28
- * query projection as an array.
28
+ * query selection as an array.
29
29
  */
30
- export type QueryProjectArray<E> = readonly (Key<E> | QueryRaw)[];
30
+ export type QuerySelectArray<E> = (Key<E> | QueryRaw)[];
31
31
  /**
32
- * query projection as a map.
32
+ * query selection as a map.
33
33
  */
34
- export type QueryProjectMap<E> = QueryProjectFieldMap<E> | QueryProjectRelationMap<E>;
34
+ export type QuerySelectMap<E> = QuerySelectFieldMap<E> | QuerySelectRelationMap<E>;
35
35
  /**
36
- * query projection.
36
+ * query selection.
37
37
  */
38
- export type QueryProject<E> = QueryProjectArray<E> | QueryProjectMap<E>;
38
+ export type QuerySelect<E> = QuerySelectArray<E> | QuerySelectMap<E>;
39
39
  /**
40
- * query projection of fields as a map.
40
+ * query selection of fields as a map.
41
41
  */
42
- export type QueryProjectFieldMap<E> = {
42
+ export type QuerySelectFieldMap<E> = {
43
43
  [K in FieldKey<E>]?: BooleanLike;
44
- } | {
45
- [K: string]: QueryRaw;
46
44
  };
47
45
  /**
48
- * query projection of relations as a map.
46
+ * query conflict paths map.
49
47
  */
50
- export type QueryProjectRelationMap<E> = {
51
- [K in RelationKey<E>]?: BooleanLike | readonly Key<Unpacked<E[K]>>[] | QueryProjectRelationOptions<E[K]>;
48
+ export type QueryConflictPathsMap<E> = {
49
+ [K in FieldKey<E>]?: true;
52
50
  };
53
51
  /**
54
- * options to project a relation.
52
+ * query conflict paths.
55
53
  */
56
- export type QueryProjectRelationOptions<E> = (E extends any[] ? Query<Unpacked<E>> : QueryUnique<Unpacked<E>>) & {
57
- readonly $required?: boolean;
54
+ export type QueryConflictPaths<E> = QueryConflictPathsMap<E>;
55
+ /**
56
+ * query selection of relations as a map.
57
+ */
58
+ export type QuerySelectRelationMap<E> = {
59
+ [K in RelationKey<E>]?: BooleanLike | Key<Unpacked<E[K]>>[] | QuerySelectRelationOptions<E[K]>;
60
+ };
61
+ /**
62
+ * options to select a relation.
63
+ */
64
+ export type QuerySelectRelationOptions<E> = (E extends unknown[] ? Query<Unpacked<E>> : QueryUnique<Unpacked<E>>) & {
65
+ $required?: boolean;
58
66
  };
59
67
  /**
60
68
  * options for full-text-search operator.
@@ -63,137 +71,142 @@ export type QueryTextSearchOptions<E> = {
63
71
  /**
64
72
  * text to search for.
65
73
  */
66
- readonly $value: string;
74
+ $value: string;
67
75
  /**
68
76
  * list of fields to search on.
69
77
  */
70
- readonly $fields?: readonly FieldKey<E>[];
78
+ $fields?: FieldKey<E>[];
71
79
  };
72
- /**
73
- * value for a logical filtering.
74
- */
75
- export type QueryFilterLogical<E> = readonly QueryFilter<E>[];
76
80
  /**
77
81
  * comparison by fields.
78
82
  */
79
- export type QueryFilterFieldMap<E> = {
80
- readonly [K in FieldKey<E>]?: QueryFilterFieldValue<E[K]>;
83
+ export type QueryWhereFieldMap<E> = {
84
+ [K in FieldKey<E>]?: QueryWhereFieldValue<E[K]>;
81
85
  };
82
86
  /**
83
87
  * complex operators.
84
88
  */
85
- export type QueryFilterMap<E> = QueryFilterFieldMap<E> & {
89
+ export type QueryWhereMap<E> = QueryWhereFieldMap<E> & QueryWhereRootOperator<E>;
90
+ export type QueryWhereRootOperator<E> = {
86
91
  /**
87
92
  * joins query clauses with a logical `AND`, returns records that match all the clauses.
88
93
  */
89
- readonly $and?: QueryFilterLogical<E>;
94
+ $and?: QueryWhereArray<E>;
90
95
  /**
91
96
  * joins query clauses with a logical `OR`, returns records that match any of the clauses.
92
97
  */
93
- readonly $or?: QueryFilterLogical<E>;
98
+ $or?: QueryWhereArray<E>;
94
99
  /**
95
100
  * joins query clauses with a logical `AND`, returns records that do not match all the clauses.
96
101
  */
97
- readonly $not?: QueryFilterLogical<E>;
102
+ $not?: QueryWhereArray<E>;
98
103
  /**
99
104
  * joins query clauses with a logical `OR`, returns records that do not match any of the clauses.
100
105
  */
101
- readonly $nor?: QueryFilterLogical<E>;
106
+ $nor?: QueryWhereArray<E>;
102
107
  /**
103
108
  * whether the specified fields match against a full-text search of the given string.
104
109
  */
105
- readonly $text?: QueryTextSearchOptions<E>;
110
+ $text?: QueryTextSearchOptions<E>;
106
111
  /**
107
112
  * whether the record exists in the given sub-query.
108
113
  */
109
- readonly $exists?: QueryRaw;
114
+ $exists?: QueryRaw;
110
115
  /**
111
116
  * whether the record does not exists in the given sub-query.
112
117
  */
113
- readonly $nexists?: QueryRaw;
118
+ $nexists?: QueryRaw;
114
119
  };
115
- export type QueryFilterFieldOperatorMap<T> = {
120
+ export type QueryWhereFieldOperatorMap<T> = {
116
121
  /**
117
122
  * whether a value is equal to the given value.
118
123
  */
119
- readonly $eq?: ExpandScalar<T>;
124
+ $eq?: ExpandScalar<T>;
120
125
  /**
121
126
  * whether a value is not equal to the given value.
122
127
  */
123
- readonly $ne?: ExpandScalar<T>;
128
+ $ne?: ExpandScalar<T>;
124
129
  /**
125
130
  * negates the given comparison.
126
131
  */
127
- readonly $not?: QueryFilterFieldValue<T>;
132
+ $not?: QueryWhereFieldValue<T>;
128
133
  /**
129
134
  * whether a value is less than the given value.
130
135
  */
131
- readonly $lt?: ExpandScalar<T>;
136
+ $lt?: ExpandScalar<T>;
132
137
  /**
133
138
  * whether a value is less than or equal to the given value.
134
139
  */
135
- readonly $lte?: ExpandScalar<T>;
140
+ $lte?: ExpandScalar<T>;
136
141
  /**
137
142
  * whether a value is greater than the given value.
138
143
  */
139
- readonly $gt?: ExpandScalar<T>;
144
+ $gt?: ExpandScalar<T>;
140
145
  /**
141
146
  * whether a value is greater than or equal to the given value.
142
147
  */
143
- readonly $gte?: ExpandScalar<T>;
148
+ $gte?: ExpandScalar<T>;
144
149
  /**
145
150
  * whether a string begins with the given string (case sensitive).
146
151
  */
147
- readonly $startsWith?: string;
152
+ $startsWith?: string;
148
153
  /**
149
154
  * whether a string begins with the given string (case insensitive).
150
155
  */
151
- readonly $istartsWith?: string;
156
+ $istartsWith?: string;
152
157
  /**
153
158
  * whether a string ends with the given string (case sensitive).
154
159
  */
155
- readonly $endsWith?: string;
160
+ $endsWith?: string;
156
161
  /**
157
162
  * whether a string ends with the given string (case insensitive).
158
163
  */
159
- readonly $iendsWith?: string;
164
+ $iendsWith?: string;
160
165
  /**
161
166
  * whether a string is contained within the given string (case sensitive).
162
167
  */
163
- readonly $includes?: string;
168
+ $includes?: string;
164
169
  /**
165
170
  * whether a string is contained within the given string (case insensitive).
166
171
  */
167
- readonly $iincludes?: string;
172
+ $iincludes?: string;
168
173
  /**
169
174
  * whether a string fulfills the given pattern (case sensitive).
170
175
  */
171
- readonly $like?: string;
176
+ $like?: string;
172
177
  /**
173
178
  * whether a string fulfills the given pattern (case insensitive).
174
179
  */
175
- readonly $ilike?: string;
180
+ $ilike?: string;
176
181
  /**
177
182
  * whether a string matches the given regular expression.
178
183
  */
179
- readonly $regex?: string;
184
+ $regex?: string;
180
185
  /**
181
186
  * whether a value matches any of the given values.
182
187
  */
183
- readonly $in?: readonly ExpandScalar<T>[];
188
+ $in?: ExpandScalar<T>[];
184
189
  /**
185
190
  * whether a value does not match any of the given values.
186
191
  */
187
- readonly $nin?: readonly ExpandScalar<T>[];
192
+ $nin?: ExpandScalar<T>[];
188
193
  };
189
194
  /**
190
195
  * Value for a field comparison.
191
196
  */
192
- export type QueryFilterFieldValue<T> = T | readonly T[] | QueryFilterFieldOperatorMap<T> | QueryRaw;
197
+ export type QueryWhereFieldValue<T> = T | T[] | QueryWhereFieldOperatorMap<T> | QueryRaw;
198
+ /**
199
+ * query single filter.
200
+ */
201
+ export type QueryWhereSingle<E> = IdValue<E> | IdValue<E>[] | QueryWhereMap<E> | QueryRaw;
202
+ /**
203
+ * query filter array.
204
+ */
205
+ export type QueryWhereArray<E> = QueryWhereSingle<E>[];
193
206
  /**
194
207
  * query filter.
195
208
  */
196
- export type QueryFilter<E> = IdValue<E> | readonly IdValue<E>[] | QueryRaw | QueryFilterMap<E>;
209
+ export type QueryWhere<E> = QueryWhereSingle<E> | QueryWhereArray<E>;
197
210
  /**
198
211
  * direction for the sort.
199
212
  */
@@ -201,13 +214,13 @@ export type QuerySortDirection = -1 | 1 | 'asc' | 'desc';
201
214
  /**
202
215
  * sort by tuples
203
216
  */
204
- export type QuerySortTuples<E> = readonly [FieldKey<E>, QuerySortDirection][];
217
+ export type QuerySortTuples<E> = [FieldKey<E>, QuerySortDirection][];
205
218
  /**
206
219
  * sort by objects.
207
220
  */
208
- export type QuerySortObjects<E> = readonly {
209
- readonly field: FieldKey<E>;
210
- readonly sort: QuerySortDirection;
221
+ export type QuerySortObjects<E> = {
222
+ field: FieldKey<E>;
223
+ sort: QuerySortDirection;
211
224
  }[];
212
225
  /**
213
226
  * sort by fields.
@@ -233,7 +246,13 @@ export type QuerySort<E> = QuerySortMap<E> | QuerySortTuples<E> | QuerySortObjec
233
246
  * pager options.
234
247
  */
235
248
  export type QueryPager = {
249
+ /**
250
+ * Index from where start the search
251
+ */
236
252
  $skip?: number;
253
+ /**
254
+ * Max number of records to retrieve
255
+ */
237
256
  $limit?: number;
238
257
  };
239
258
  /**
@@ -243,34 +262,25 @@ export type QuerySearch<E> = {
243
262
  /**
244
263
  * filtering options.
245
264
  */
246
- $filter?: QueryFilter<E>;
247
- /**
248
- * list of fields to group.
249
- */
250
- $group?: readonly FieldKey<E>[];
251
- /**
252
- * having options.
253
- */
254
- $having?: QueryFilter<E>;
255
- };
256
- /**
257
- * criteria options.
258
- */
259
- export type QueryCriteria<E> = QuerySearch<E> & {
265
+ $where?: QueryWhere<E>;
260
266
  /**
261
267
  * sorting options.
262
268
  */
263
269
  $sort?: QuerySort<E>;
264
270
  } & QueryPager;
271
+ /**
272
+ * criteria one options.
273
+ */
274
+ export type QuerySearchOne<E> = Omit<QuerySearch<E>, '$limit'>;
265
275
  /**
266
276
  * query options.
267
277
  */
268
278
  export type Query<E> = {
269
279
  /**
270
- * projection options.
280
+ * selection options.
271
281
  */
272
- $project?: QueryProject<E>;
273
- } & QueryCriteria<E>;
282
+ $select?: QuerySelect<E>;
283
+ } & QuerySearch<E>;
274
284
  /**
275
285
  * options to get a single record.
276
286
  */
@@ -278,25 +288,29 @@ export type QueryOne<E> = Omit<Query<E>, '$limit'>;
278
288
  /**
279
289
  * options to get an unique record.
280
290
  */
281
- export type QueryUnique<E> = Pick<Query<E>, '$project' | '$filter'>;
291
+ export type QueryUnique<E> = Pick<QueryOne<E>, '$select' | '$where'>;
282
292
  /**
283
293
  * stringified query.
284
294
  */
285
295
  export type QueryStringified = {
286
- readonly [K in keyof Query<any>]?: string;
296
+ [K in keyof Query<unknown>]?: string;
287
297
  };
288
298
  /**
289
299
  * result of an update operation.
290
300
  */
291
301
  export type QueryUpdateResult = {
292
302
  /**
293
- * number of changes.
303
+ * number of affected records.
294
304
  */
295
- readonly changes?: number;
305
+ changes?: number;
306
+ /**
307
+ * the inserted IDs.
308
+ */
309
+ ids?: number[] | string[];
296
310
  /**
297
311
  * first inserted ID.
298
312
  */
299
- readonly firstId?: number;
313
+ firstId?: number | string;
300
314
  };
301
315
  /**
302
316
  * options for the `raw` function.
@@ -305,20 +319,24 @@ export type QueryRawFnOptions = {
305
319
  /**
306
320
  * the current dialect.
307
321
  */
308
- readonly dialect: QueryDialect;
322
+ dialect?: QueryDialect;
309
323
  /**
310
324
  * the prefix.
311
325
  */
312
- readonly prefix?: string;
326
+ prefix?: string;
313
327
  /**
314
328
  * the escaped prefix.
315
329
  */
316
- readonly escapedPrefix?: string;
330
+ escapedPrefix?: string;
331
+ /**
332
+ * the query context.
333
+ */
334
+ ctx?: QueryContext;
317
335
  };
318
336
  /**
319
337
  * a `raw` function
320
338
  */
321
- export type QueryRawFn = (opts?: QueryRawFnOptions) => string;
339
+ export type QueryRawFn = (opts?: QueryRawFnOptions) => void | Scalar;
322
340
  export declare class QueryRaw {
323
341
  readonly value: Scalar | QueryRawFn;
324
342
  readonly alias?: string;
@@ -331,54 +349,74 @@ export type QueryComparisonOptions = QueryOptions & {
331
349
  /**
332
350
  * use precedence for the comparison or not.
333
351
  */
334
- readonly usePrecedence?: boolean;
352
+ usePrecedence?: boolean;
335
353
  };
336
354
  /**
337
355
  * query filter options.
338
356
  */
339
- export type QueryFilterOptions = QueryComparisonOptions & {
357
+ export type QueryWhereOptions = QueryComparisonOptions & {
340
358
  /**
341
359
  * clause to be used in the filter.
342
360
  */
343
- readonly clause?: 'WHERE' | 'HAVING' | false;
361
+ clause?: 'WHERE' | false;
344
362
  };
363
+ export interface QueryContext {
364
+ append(sql: string): this;
365
+ addValue(value: unknown): this;
366
+ pushValue(value: unknown): this;
367
+ readonly sql: string;
368
+ readonly values: unknown[];
369
+ }
345
370
  export interface QueryDialect {
346
371
  /**
347
- * counts the number of records matching the given search parameters.
372
+ * obtains the records matching the given search parameters.
373
+ * @param ctx the query context
348
374
  * @param entity the target entity
349
- * @param qm the criteria options
375
+ * @param q the criteria options
350
376
  * @param opts the query options
351
377
  */
352
- count<E>(entity: Type<E>, qm: QuerySearch<E>, opts?: QueryOptions): string;
378
+ find<E>(ctx: QueryContext, entity: Type<E>, q: Query<E>, opts?: QueryOptions): void;
353
379
  /**
354
- * obtains the records matching the given search parameters.
380
+ * counts the number of records matching the given search parameters.
381
+ * @param ctx the query context
355
382
  * @param entity the target entity
356
- * @param qm the criteria options
383
+ * @param q the criteria options
357
384
  * @param opts the query options
358
385
  */
359
- find<E>(entity: Type<E>, qm: Query<E>, opts?: QueryOptions): string;
386
+ count<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions): void;
360
387
  /**
361
- * inser records.
388
+ * insert records.
389
+ * @param ctx the query context
362
390
  * @param entity the target entity
363
- * @param qm the criteria options
391
+ * @param payload the payload
364
392
  * @param opts the query options
365
393
  */
366
- insert<E>(entity: Type<E>, payload: E | readonly E[], opts?: QueryOptions): string;
394
+ insert<E>(ctx: QueryContext, entity: Type<E>, payload: E | E[], opts?: QueryOptions): void;
367
395
  /**
368
396
  * update records.
397
+ * @param ctx the query context
369
398
  * @param entity the target entity
370
- * @param qm the criteria options
399
+ * @param q the criteria options
371
400
  * @param payload
372
401
  * @param opts the query options
373
402
  */
374
- update<E>(entity: Type<E>, qm: QueryCriteria<E>, payload: E, opts?: QueryOptions): string;
403
+ update<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, payload: E, opts?: QueryOptions): void;
404
+ /**
405
+ * upsert records.
406
+ * @param ctx the query context
407
+ * @param entity the target entity
408
+ * @param conflictPaths the conflict paths
409
+ * @param payload
410
+ */
411
+ upsert<E>(ctx: QueryContext, entity: Type<E>, conflictPaths: QueryConflictPaths<E>, payload: E): void;
375
412
  /**
376
413
  * delete records.
414
+ * @param ctx the query context
377
415
  * @param entity the target entity
378
- * @param qm the criteria options
416
+ * @param q the criteria options
379
417
  * @param opts the query options
380
418
  */
381
- delete<E>(entity: Type<E>, qm: QueryCriteria<E>, opts?: QueryOptions): string;
419
+ delete<E>(ctx: QueryContext, entity: Type<E>, q: QuerySearch<E>, opts?: QueryOptions): void;
382
420
  /**
383
421
  * escape an identifier.
384
422
  * @param val the value to be escaped
@@ -390,5 +428,29 @@ export interface QueryDialect {
390
428
  * escape a value.
391
429
  * @param val the value to escape
392
430
  */
393
- escape(val: any): Scalar;
431
+ escape(val: unknown): string;
432
+ /**
433
+ * add a value to the query.
434
+ * @param values the values array
435
+ * @param value the value to add
436
+ */
437
+ addValue(values: unknown[], value: unknown): string;
438
+ /**
439
+ * create a new query context.
440
+ */
441
+ createContext(): QueryContext;
442
+ }
443
+ /**
444
+ * Minimal dialect interface exposing escapeIdChar for SQL operations
445
+ */
446
+ export interface SqlQueryDialect extends QueryDialect {
447
+ /**
448
+ * the escape character for identifiers.
449
+ */
450
+ readonly escapeIdChar: '"' | '`';
451
+ /**
452
+ * Get the placeholder for a parameter at the given index (1-based).
453
+ * Default: '?' for MySQL/MariaDB/SQLite, '$n' for PostgreSQL.
454
+ */
455
+ placeholder(index: number): string;
394
456
  }
@@ -0,0 +1,9 @@
1
+ export class QueryRaw {
2
+ value;
3
+ alias;
4
+ constructor(value, alias) {
5
+ this.value = value;
6
+ this.alias = alias;
7
+ }
8
+ }
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicXVlcnkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZS9xdWVyeS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFxWEEsTUFBTSxPQUFPLFFBQVE7SUFFUjtJQUNBO0lBRlgsWUFDVyxLQUEwQixFQUMxQixLQUFjO1FBRGQsVUFBSyxHQUFMLEtBQUssQ0FBcUI7UUFDMUIsVUFBSyxHQUFMLEtBQUssQ0FBUztJQUN0QixDQUFDO0NBQ0wiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgdHlwZSB7IEZpZWxkS2V5LCBJZFZhbHVlLCBLZXksIFJlbGF0aW9uS2V5IH0gZnJvbSAnLi9lbnRpdHkuanMnO1xuaW1wb3J0IHR5cGUgeyBCb29sZWFuTGlrZSwgRXhwYW5kU2NhbGFyLCBTY2FsYXIsIFR5cGUsIFVucGFja2VkIH0gZnJvbSAnLi91dGlsaXR5LmpzJztcblxuZXhwb3J0IHR5cGUgUXVlcnlPcHRpb25zID0ge1xuICAvKipcbiAgICogdXNlIG9yIG9taXQgYHNvZnREZWxldGVgIGF0dHJpYnV0ZS5cbiAgICovXG4gIHNvZnREZWxldGU/OiBib29sZWFuO1xuICAvKipcbiAgICogcHJlZml4IHRoZSBxdWVyeSB3aXRoIHRoaXMuXG4gICAqL1xuICBwcmVmaXg/OiBzdHJpbmc7XG4gIC8qKlxuICAgKiBhdXRvbWF0aWNhbGx5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