@warlock.js/cascade 4.0.157 → 4.0.158

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 (689) hide show
  1. package/package.json +4 -4
  2. package/cjs/context/database-data-source-context.d.ts +0 -29
  3. package/cjs/context/database-data-source-context.d.ts.map +0 -1
  4. package/cjs/context/database-data-source-context.js +0 -28
  5. package/cjs/context/database-data-source-context.js.map +0 -1
  6. package/cjs/context/database-transaction-context.d.ts +0 -35
  7. package/cjs/context/database-transaction-context.d.ts.map +0 -1
  8. package/cjs/context/database-transaction-context.js +0 -40
  9. package/cjs/context/database-transaction-context.js.map +0 -1
  10. package/cjs/contracts/database-driver.contract.d.ts +0 -450
  11. package/cjs/contracts/database-driver.contract.d.ts.map +0 -1
  12. package/cjs/contracts/database-id-generator.contract.d.ts +0 -109
  13. package/cjs/contracts/database-id-generator.contract.d.ts.map +0 -1
  14. package/cjs/contracts/database-remover.contract.d.ts +0 -104
  15. package/cjs/contracts/database-remover.contract.d.ts.map +0 -1
  16. package/cjs/contracts/database-restorer.contract.d.ts +0 -143
  17. package/cjs/contracts/database-restorer.contract.d.ts.map +0 -1
  18. package/cjs/contracts/database-writer.contract.d.ts +0 -119
  19. package/cjs/contracts/database-writer.contract.d.ts.map +0 -1
  20. package/cjs/contracts/driver-blueprint.contract.d.ts +0 -49
  21. package/cjs/contracts/driver-blueprint.contract.d.ts.map +0 -1
  22. package/cjs/contracts/index.d.ts +0 -10
  23. package/cjs/contracts/index.d.ts.map +0 -1
  24. package/cjs/contracts/migration-driver.contract.d.ts +0 -522
  25. package/cjs/contracts/migration-driver.contract.d.ts.map +0 -1
  26. package/cjs/contracts/query-builder.contract.d.ts +0 -1609
  27. package/cjs/contracts/query-builder.contract.d.ts.map +0 -1
  28. package/cjs/contracts/sync-adapter.contract.d.ts +0 -58
  29. package/cjs/contracts/sync-adapter.contract.d.ts.map +0 -1
  30. package/cjs/data-source/data-source-registry.d.ts +0 -108
  31. package/cjs/data-source/data-source-registry.d.ts.map +0 -1
  32. package/cjs/data-source/data-source-registry.js +0 -145
  33. package/cjs/data-source/data-source-registry.js.map +0 -1
  34. package/cjs/data-source/data-source.d.ts +0 -147
  35. package/cjs/data-source/data-source.d.ts.map +0 -1
  36. package/cjs/data-source/data-source.js +0 -83
  37. package/cjs/data-source/data-source.js.map +0 -1
  38. package/cjs/database-dirty-tracker.d.ts +0 -252
  39. package/cjs/database-dirty-tracker.d.ts.map +0 -1
  40. package/cjs/database-dirty-tracker.js +0 -386
  41. package/cjs/database-dirty-tracker.js.map +0 -1
  42. package/cjs/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
  43. package/cjs/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
  44. package/cjs/drivers/mongodb/mongodb-blueprint.js +0 -51
  45. package/cjs/drivers/mongodb/mongodb-blueprint.js.map +0 -1
  46. package/cjs/drivers/mongodb/mongodb-driver.d.ts +0 -324
  47. package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
  48. package/cjs/drivers/mongodb/mongodb-driver.js +0 -799
  49. package/cjs/drivers/mongodb/mongodb-driver.js.map +0 -1
  50. package/cjs/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
  51. package/cjs/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
  52. package/cjs/drivers/mongodb/mongodb-id-generator.js +0 -149
  53. package/cjs/drivers/mongodb/mongodb-id-generator.js.map +0 -1
  54. package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
  55. package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
  56. package/cjs/drivers/mongodb/mongodb-migration-driver.js +0 -666
  57. package/cjs/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
  58. package/cjs/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
  59. package/cjs/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
  60. package/cjs/drivers/mongodb/mongodb-query-builder.js +0 -1988
  61. package/cjs/drivers/mongodb/mongodb-query-builder.js.map +0 -1
  62. package/cjs/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
  63. package/cjs/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
  64. package/cjs/drivers/mongodb/mongodb-query-operations.js +0 -270
  65. package/cjs/drivers/mongodb/mongodb-query-operations.js.map +0 -1
  66. package/cjs/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
  67. package/cjs/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
  68. package/cjs/drivers/mongodb/mongodb-query-parser.js +0 -1351
  69. package/cjs/drivers/mongodb/mongodb-query-parser.js.map +0 -1
  70. package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
  71. package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
  72. package/cjs/drivers/mongodb/mongodb-sync-adapter.js +0 -146
  73. package/cjs/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
  74. package/cjs/drivers/mongodb/types.d.ts +0 -43
  75. package/cjs/drivers/mongodb/types.d.ts.map +0 -1
  76. package/cjs/drivers/postgres/index.d.ts +0 -16
  77. package/cjs/drivers/postgres/index.d.ts.map +0 -1
  78. package/cjs/drivers/postgres/postgres-blueprint.d.ts +0 -64
  79. package/cjs/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
  80. package/cjs/drivers/postgres/postgres-blueprint.js +0 -121
  81. package/cjs/drivers/postgres/postgres-blueprint.js.map +0 -1
  82. package/cjs/drivers/postgres/postgres-dialect.d.ts +0 -136
  83. package/cjs/drivers/postgres/postgres-dialect.d.ts.map +0 -1
  84. package/cjs/drivers/postgres/postgres-dialect.js +0 -268
  85. package/cjs/drivers/postgres/postgres-dialect.js.map +0 -1
  86. package/cjs/drivers/postgres/postgres-driver.d.ts +0 -432
  87. package/cjs/drivers/postgres/postgres-driver.d.ts.map +0 -1
  88. package/cjs/drivers/postgres/postgres-driver.js +0 -965
  89. package/cjs/drivers/postgres/postgres-driver.js.map +0 -1
  90. package/cjs/drivers/postgres/postgres-migration-driver.d.ts +0 -397
  91. package/cjs/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
  92. package/cjs/drivers/postgres/postgres-migration-driver.js +0 -900
  93. package/cjs/drivers/postgres/postgres-migration-driver.js.map +0 -1
  94. package/cjs/drivers/postgres/postgres-query-builder.d.ts +0 -254
  95. package/cjs/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
  96. package/cjs/drivers/postgres/postgres-query-builder.js +0 -933
  97. package/cjs/drivers/postgres/postgres-query-builder.js.map +0 -1
  98. package/cjs/drivers/postgres/postgres-query-parser.d.ts +0 -328
  99. package/cjs/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
  100. package/cjs/drivers/postgres/postgres-query-parser.js +0 -864
  101. package/cjs/drivers/postgres/postgres-query-parser.js.map +0 -1
  102. package/cjs/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
  103. package/cjs/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
  104. package/cjs/drivers/postgres/postgres-sql-serializer.js +0 -400
  105. package/cjs/drivers/postgres/postgres-sql-serializer.js.map +0 -1
  106. package/cjs/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
  107. package/cjs/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
  108. package/cjs/drivers/postgres/postgres-sync-adapter.js +0 -197
  109. package/cjs/drivers/postgres/postgres-sync-adapter.js.map +0 -1
  110. package/cjs/drivers/postgres/types.d.ts +0 -142
  111. package/cjs/drivers/postgres/types.d.ts.map +0 -1
  112. package/cjs/drivers/sql/index.d.ts +0 -10
  113. package/cjs/drivers/sql/index.d.ts.map +0 -1
  114. package/cjs/drivers/sql/sql-dialect.contract.d.ts +0 -204
  115. package/cjs/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
  116. package/cjs/drivers/sql/sql-types.d.ts +0 -202
  117. package/cjs/drivers/sql/sql-types.d.ts.map +0 -1
  118. package/cjs/errors/missing-data-source.error.d.ts +0 -22
  119. package/cjs/errors/missing-data-source.error.d.ts.map +0 -1
  120. package/cjs/errors/missing-data-source.error.js +0 -29
  121. package/cjs/errors/missing-data-source.error.js.map +0 -1
  122. package/cjs/errors/transaction-rollback.error.d.ts +0 -20
  123. package/cjs/errors/transaction-rollback.error.d.ts.map +0 -1
  124. package/cjs/errors/transaction-rollback.error.js +0 -27
  125. package/cjs/errors/transaction-rollback.error.js.map +0 -1
  126. package/cjs/events/model-events.d.ts +0 -231
  127. package/cjs/events/model-events.d.ts.map +0 -1
  128. package/cjs/events/model-events.js +0 -259
  129. package/cjs/events/model-events.js.map +0 -1
  130. package/cjs/expressions/aggregate-expressions.d.ts +0 -215
  131. package/cjs/expressions/aggregate-expressions.d.ts.map +0 -1
  132. package/cjs/expressions/aggregate-expressions.js +0 -221
  133. package/cjs/expressions/aggregate-expressions.js.map +0 -1
  134. package/cjs/expressions/index.d.ts +0 -2
  135. package/cjs/expressions/index.d.ts.map +0 -1
  136. package/cjs/index.d.ts +0 -45
  137. package/cjs/index.d.ts.map +0 -1
  138. package/cjs/index.js +0 -1
  139. package/cjs/index.js.map +0 -1
  140. package/cjs/migration/column-builder.d.ts +0 -417
  141. package/cjs/migration/column-builder.d.ts.map +0 -1
  142. package/cjs/migration/column-builder.js +0 -586
  143. package/cjs/migration/column-builder.js.map +0 -1
  144. package/cjs/migration/column-helpers.d.ts +0 -275
  145. package/cjs/migration/column-helpers.d.ts.map +0 -1
  146. package/cjs/migration/column-helpers.js +0 -389
  147. package/cjs/migration/column-helpers.js.map +0 -1
  148. package/cjs/migration/foreign-key-builder.d.ts +0 -103
  149. package/cjs/migration/foreign-key-builder.d.ts.map +0 -1
  150. package/cjs/migration/foreign-key-builder.js +0 -121
  151. package/cjs/migration/foreign-key-builder.js.map +0 -1
  152. package/cjs/migration/index.d.ts +0 -7
  153. package/cjs/migration/index.d.ts.map +0 -1
  154. package/cjs/migration/migration-runner.d.ts +0 -278
  155. package/cjs/migration/migration-runner.d.ts.map +0 -1
  156. package/cjs/migration/migration-runner.js +0 -815
  157. package/cjs/migration/migration-runner.js.map +0 -1
  158. package/cjs/migration/migration.d.ts +0 -1992
  159. package/cjs/migration/migration.d.ts.map +0 -1
  160. package/cjs/migration/migration.js +0 -2162
  161. package/cjs/migration/migration.js.map +0 -1
  162. package/cjs/migration/sql-grammar.d.ts +0 -61
  163. package/cjs/migration/sql-grammar.d.ts.map +0 -1
  164. package/cjs/migration/sql-grammar.js +0 -164
  165. package/cjs/migration/sql-grammar.js.map +0 -1
  166. package/cjs/migration/sql-serializer.d.ts +0 -22
  167. package/cjs/migration/sql-serializer.d.ts.map +0 -1
  168. package/cjs/migration/sql-serializer.js +0 -26
  169. package/cjs/migration/sql-serializer.js.map +0 -1
  170. package/cjs/migration/types.d.ts +0 -155
  171. package/cjs/migration/types.d.ts.map +0 -1
  172. package/cjs/model/methods/accessor-methods.d.ts +0 -13
  173. package/cjs/model/methods/accessor-methods.d.ts.map +0 -1
  174. package/cjs/model/methods/accessor-methods.js +0 -51
  175. package/cjs/model/methods/accessor-methods.js.map +0 -1
  176. package/cjs/model/methods/delete-methods.d.ts +0 -10
  177. package/cjs/model/methods/delete-methods.d.ts.map +0 -1
  178. package/cjs/model/methods/delete-methods.js +0 -10
  179. package/cjs/model/methods/delete-methods.js.map +0 -1
  180. package/cjs/model/methods/dirty-methods.d.ts +0 -10
  181. package/cjs/model/methods/dirty-methods.d.ts.map +0 -1
  182. package/cjs/model/methods/dirty-methods.js +0 -15
  183. package/cjs/model/methods/dirty-methods.js.map +0 -1
  184. package/cjs/model/methods/hydration-methods.d.ts +0 -10
  185. package/cjs/model/methods/hydration-methods.d.ts.map +0 -1
  186. package/cjs/model/methods/hydration-methods.js +0 -57
  187. package/cjs/model/methods/hydration-methods.js.map +0 -1
  188. package/cjs/model/methods/instance-event-methods.d.ts +0 -7
  189. package/cjs/model/methods/instance-event-methods.d.ts.map +0 -1
  190. package/cjs/model/methods/instance-event-methods.js +0 -15
  191. package/cjs/model/methods/instance-event-methods.js.map +0 -1
  192. package/cjs/model/methods/meta-methods.d.ts +0 -7
  193. package/cjs/model/methods/meta-methods.d.ts.map +0 -1
  194. package/cjs/model/methods/meta-methods.js +0 -78
  195. package/cjs/model/methods/meta-methods.js.map +0 -1
  196. package/cjs/model/methods/query-methods.d.ts +0 -24
  197. package/cjs/model/methods/query-methods.d.ts.map +0 -1
  198. package/cjs/model/methods/query-methods.js +0 -161
  199. package/cjs/model/methods/query-methods.js.map +0 -1
  200. package/cjs/model/methods/restore-methods.d.ts +0 -10
  201. package/cjs/model/methods/restore-methods.d.ts.map +0 -1
  202. package/cjs/model/methods/restore-methods.js +0 -13
  203. package/cjs/model/methods/restore-methods.js.map +0 -1
  204. package/cjs/model/methods/scope-methods.d.ts +0 -7
  205. package/cjs/model/methods/scope-methods.d.ts.map +0 -1
  206. package/cjs/model/methods/scope-methods.js +0 -15
  207. package/cjs/model/methods/scope-methods.js.map +0 -1
  208. package/cjs/model/methods/serialization-methods.d.ts +0 -3
  209. package/cjs/model/methods/serialization-methods.d.ts.map +0 -1
  210. package/cjs/model/methods/serialization-methods.js +0 -27
  211. package/cjs/model/methods/serialization-methods.js.map +0 -1
  212. package/cjs/model/methods/static-event-methods.d.ts +0 -9
  213. package/cjs/model/methods/static-event-methods.d.ts.map +0 -1
  214. package/cjs/model/methods/static-event-methods.js +0 -29
  215. package/cjs/model/methods/static-event-methods.js.map +0 -1
  216. package/cjs/model/methods/write-methods.d.ts +0 -10
  217. package/cjs/model/methods/write-methods.d.ts.map +0 -1
  218. package/cjs/model/methods/write-methods.js +0 -52
  219. package/cjs/model/methods/write-methods.js.map +0 -1
  220. package/cjs/model/model.d.ts +0 -1650
  221. package/cjs/model/model.d.ts.map +0 -1
  222. package/cjs/model/model.js +0 -1657
  223. package/cjs/model/model.js.map +0 -1
  224. package/cjs/model/model.types.d.ts +0 -44
  225. package/cjs/model/model.types.d.ts.map +0 -1
  226. package/cjs/model/register-model.d.ts +0 -81
  227. package/cjs/model/register-model.d.ts.map +0 -1
  228. package/cjs/model/register-model.js +0 -94
  229. package/cjs/model/register-model.js.map +0 -1
  230. package/cjs/query-builder/query-builder.d.ts +0 -556
  231. package/cjs/query-builder/query-builder.d.ts.map +0 -1
  232. package/cjs/query-builder/query-builder.js +0 -1070
  233. package/cjs/query-builder/query-builder.js.map +0 -1
  234. package/cjs/relations/helpers.d.ts +0 -156
  235. package/cjs/relations/helpers.d.ts.map +0 -1
  236. package/cjs/relations/helpers.js +0 -201
  237. package/cjs/relations/helpers.js.map +0 -1
  238. package/cjs/relations/index.d.ts +0 -35
  239. package/cjs/relations/index.d.ts.map +0 -1
  240. package/cjs/relations/pivot-operations.d.ts +0 -160
  241. package/cjs/relations/pivot-operations.d.ts.map +0 -1
  242. package/cjs/relations/pivot-operations.js +0 -293
  243. package/cjs/relations/pivot-operations.js.map +0 -1
  244. package/cjs/relations/relation-hydrator.d.ts +0 -68
  245. package/cjs/relations/relation-hydrator.d.ts.map +0 -1
  246. package/cjs/relations/relation-hydrator.js +0 -81
  247. package/cjs/relations/relation-hydrator.js.map +0 -1
  248. package/cjs/relations/relation-loader.d.ts +0 -194
  249. package/cjs/relations/relation-loader.d.ts.map +0 -1
  250. package/cjs/relations/relation-loader.js +0 -466
  251. package/cjs/relations/relation-loader.js.map +0 -1
  252. package/cjs/relations/types.d.ts +0 -306
  253. package/cjs/relations/types.d.ts.map +0 -1
  254. package/cjs/remover/database-remover.d.ts +0 -100
  255. package/cjs/remover/database-remover.d.ts.map +0 -1
  256. package/cjs/remover/database-remover.js +0 -214
  257. package/cjs/remover/database-remover.js.map +0 -1
  258. package/cjs/restorer/database-restorer.d.ts +0 -131
  259. package/cjs/restorer/database-restorer.d.ts.map +0 -1
  260. package/cjs/restorer/database-restorer.js +0 -434
  261. package/cjs/restorer/database-restorer.js.map +0 -1
  262. package/cjs/sql-database-dirty-tracker.d.ts +0 -13
  263. package/cjs/sql-database-dirty-tracker.d.ts.map +0 -1
  264. package/cjs/sql-database-dirty-tracker.js +0 -14
  265. package/cjs/sql-database-dirty-tracker.js.map +0 -1
  266. package/cjs/sync/index.d.ts +0 -12
  267. package/cjs/sync/index.d.ts.map +0 -1
  268. package/cjs/sync/model-events.d.ts +0 -62
  269. package/cjs/sync/model-events.d.ts.map +0 -1
  270. package/cjs/sync/model-events.js +0 -49
  271. package/cjs/sync/model-events.js.map +0 -1
  272. package/cjs/sync/model-sync-operation.d.ts +0 -163
  273. package/cjs/sync/model-sync-operation.d.ts.map +0 -1
  274. package/cjs/sync/model-sync-operation.js +0 -292
  275. package/cjs/sync/model-sync-operation.js.map +0 -1
  276. package/cjs/sync/model-sync.d.ts +0 -130
  277. package/cjs/sync/model-sync.d.ts.map +0 -1
  278. package/cjs/sync/model-sync.js +0 -178
  279. package/cjs/sync/model-sync.js.map +0 -1
  280. package/cjs/sync/sync-context.d.ts +0 -70
  281. package/cjs/sync/sync-context.d.ts.map +0 -1
  282. package/cjs/sync/sync-context.js +0 -101
  283. package/cjs/sync/sync-context.js.map +0 -1
  284. package/cjs/sync/sync-manager.d.ts +0 -213
  285. package/cjs/sync/sync-manager.d.ts.map +0 -1
  286. package/cjs/sync/sync-manager.js +0 -689
  287. package/cjs/sync/sync-manager.js.map +0 -1
  288. package/cjs/sync/types.d.ts +0 -289
  289. package/cjs/sync/types.d.ts.map +0 -1
  290. package/cjs/test-migrations/test-enhanced-features.migration.d.ts +0 -15
  291. package/cjs/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
  292. package/cjs/types.d.ts +0 -371
  293. package/cjs/types.d.ts.map +0 -1
  294. package/cjs/utils/connect-to-database.d.ts +0 -300
  295. package/cjs/utils/connect-to-database.d.ts.map +0 -1
  296. package/cjs/utils/connect-to-database.js +0 -128
  297. package/cjs/utils/connect-to-database.js.map +0 -1
  298. package/cjs/utils/database-writer.utils.d.ts +0 -15
  299. package/cjs/utils/database-writer.utils.d.ts.map +0 -1
  300. package/cjs/utils/database-writer.utils.js +0 -14
  301. package/cjs/utils/database-writer.utils.js.map +0 -1
  302. package/cjs/utils/define-model.js +0 -100
  303. package/cjs/utils/define-model.js.map +0 -1
  304. package/cjs/utils/is-valid-date-value.d.ts +0 -5
  305. package/cjs/utils/is-valid-date-value.d.ts.map +0 -1
  306. package/cjs/utils/is-valid-date-value.js +0 -25
  307. package/cjs/utils/is-valid-date-value.js.map +0 -1
  308. package/cjs/utils/once-connected.d.ts +0 -146
  309. package/cjs/utils/once-connected.d.ts.map +0 -1
  310. package/cjs/utils/once-connected.js +0 -251
  311. package/cjs/utils/once-connected.js.map +0 -1
  312. package/cjs/validation/database-seal-plugins.d.ts +0 -12
  313. package/cjs/validation/database-seal-plugins.d.ts.map +0 -1
  314. package/cjs/validation/database-seal-plugins.js +0 -1
  315. package/cjs/validation/database-seal-plugins.js.map +0 -1
  316. package/cjs/validation/database-writer-validation-error.d.ts +0 -97
  317. package/cjs/validation/database-writer-validation-error.d.ts.map +0 -1
  318. package/cjs/validation/database-writer-validation-error.js +0 -160
  319. package/cjs/validation/database-writer-validation-error.js.map +0 -1
  320. package/cjs/validation/index.d.ts +0 -3
  321. package/cjs/validation/index.d.ts.map +0 -1
  322. package/cjs/validation/mutators/embed-mutator.d.ts +0 -9
  323. package/cjs/validation/mutators/embed-mutator.d.ts.map +0 -1
  324. package/cjs/validation/mutators/embed-mutator.js +0 -33
  325. package/cjs/validation/mutators/embed-mutator.js.map +0 -1
  326. package/cjs/validation/plugins/embed-validator-plugin.d.ts +0 -24
  327. package/cjs/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
  328. package/cjs/validation/plugins/embed-validator-plugin.js +0 -18
  329. package/cjs/validation/plugins/embed-validator-plugin.js.map +0 -1
  330. package/cjs/validation/rules/database-model-rule.d.ts +0 -7
  331. package/cjs/validation/rules/database-model-rule.d.ts.map +0 -1
  332. package/cjs/validation/rules/database-model-rule.js +0 -27
  333. package/cjs/validation/rules/database-model-rule.js.map +0 -1
  334. package/cjs/validation/transformers/embed-model-transformer.d.ts +0 -3
  335. package/cjs/validation/transformers/embed-model-transformer.d.ts.map +0 -1
  336. package/cjs/validation/transformers/embed-model-transformer.js +0 -18
  337. package/cjs/validation/transformers/embed-model-transformer.js.map +0 -1
  338. package/cjs/validation/validators/embed-validator.d.ts +0 -21
  339. package/cjs/validation/validators/embed-validator.d.ts.map +0 -1
  340. package/cjs/validation/validators/embed-validator.js +0 -43
  341. package/cjs/validation/validators/embed-validator.js.map +0 -1
  342. package/cjs/writer/database-writer.d.ts +0 -181
  343. package/cjs/writer/database-writer.d.ts.map +0 -1
  344. package/cjs/writer/database-writer.js +0 -407
  345. package/cjs/writer/database-writer.js.map +0 -1
  346. package/esm/context/database-data-source-context.d.ts +0 -29
  347. package/esm/context/database-data-source-context.d.ts.map +0 -1
  348. package/esm/context/database-data-source-context.js +0 -28
  349. package/esm/context/database-data-source-context.js.map +0 -1
  350. package/esm/context/database-transaction-context.d.ts +0 -35
  351. package/esm/context/database-transaction-context.d.ts.map +0 -1
  352. package/esm/context/database-transaction-context.js +0 -40
  353. package/esm/context/database-transaction-context.js.map +0 -1
  354. package/esm/contracts/database-driver.contract.d.ts +0 -450
  355. package/esm/contracts/database-driver.contract.d.ts.map +0 -1
  356. package/esm/contracts/database-id-generator.contract.d.ts +0 -109
  357. package/esm/contracts/database-id-generator.contract.d.ts.map +0 -1
  358. package/esm/contracts/database-remover.contract.d.ts +0 -104
  359. package/esm/contracts/database-remover.contract.d.ts.map +0 -1
  360. package/esm/contracts/database-restorer.contract.d.ts +0 -143
  361. package/esm/contracts/database-restorer.contract.d.ts.map +0 -1
  362. package/esm/contracts/database-writer.contract.d.ts +0 -119
  363. package/esm/contracts/database-writer.contract.d.ts.map +0 -1
  364. package/esm/contracts/driver-blueprint.contract.d.ts +0 -49
  365. package/esm/contracts/driver-blueprint.contract.d.ts.map +0 -1
  366. package/esm/contracts/index.d.ts +0 -10
  367. package/esm/contracts/index.d.ts.map +0 -1
  368. package/esm/contracts/migration-driver.contract.d.ts +0 -522
  369. package/esm/contracts/migration-driver.contract.d.ts.map +0 -1
  370. package/esm/contracts/query-builder.contract.d.ts +0 -1609
  371. package/esm/contracts/query-builder.contract.d.ts.map +0 -1
  372. package/esm/contracts/sync-adapter.contract.d.ts +0 -58
  373. package/esm/contracts/sync-adapter.contract.d.ts.map +0 -1
  374. package/esm/data-source/data-source-registry.d.ts +0 -108
  375. package/esm/data-source/data-source-registry.d.ts.map +0 -1
  376. package/esm/data-source/data-source-registry.js +0 -145
  377. package/esm/data-source/data-source-registry.js.map +0 -1
  378. package/esm/data-source/data-source.d.ts +0 -147
  379. package/esm/data-source/data-source.d.ts.map +0 -1
  380. package/esm/data-source/data-source.js +0 -83
  381. package/esm/data-source/data-source.js.map +0 -1
  382. package/esm/database-dirty-tracker.d.ts +0 -252
  383. package/esm/database-dirty-tracker.d.ts.map +0 -1
  384. package/esm/database-dirty-tracker.js +0 -386
  385. package/esm/database-dirty-tracker.js.map +0 -1
  386. package/esm/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
  387. package/esm/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
  388. package/esm/drivers/mongodb/mongodb-blueprint.js +0 -51
  389. package/esm/drivers/mongodb/mongodb-blueprint.js.map +0 -1
  390. package/esm/drivers/mongodb/mongodb-driver.d.ts +0 -324
  391. package/esm/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
  392. package/esm/drivers/mongodb/mongodb-driver.js +0 -799
  393. package/esm/drivers/mongodb/mongodb-driver.js.map +0 -1
  394. package/esm/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
  395. package/esm/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
  396. package/esm/drivers/mongodb/mongodb-id-generator.js +0 -149
  397. package/esm/drivers/mongodb/mongodb-id-generator.js.map +0 -1
  398. package/esm/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
  399. package/esm/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
  400. package/esm/drivers/mongodb/mongodb-migration-driver.js +0 -666
  401. package/esm/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
  402. package/esm/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
  403. package/esm/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
  404. package/esm/drivers/mongodb/mongodb-query-builder.js +0 -1988
  405. package/esm/drivers/mongodb/mongodb-query-builder.js.map +0 -1
  406. package/esm/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
  407. package/esm/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
  408. package/esm/drivers/mongodb/mongodb-query-operations.js +0 -270
  409. package/esm/drivers/mongodb/mongodb-query-operations.js.map +0 -1
  410. package/esm/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
  411. package/esm/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
  412. package/esm/drivers/mongodb/mongodb-query-parser.js +0 -1351
  413. package/esm/drivers/mongodb/mongodb-query-parser.js.map +0 -1
  414. package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
  415. package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
  416. package/esm/drivers/mongodb/mongodb-sync-adapter.js +0 -146
  417. package/esm/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
  418. package/esm/drivers/mongodb/types.d.ts +0 -43
  419. package/esm/drivers/mongodb/types.d.ts.map +0 -1
  420. package/esm/drivers/postgres/index.d.ts +0 -16
  421. package/esm/drivers/postgres/index.d.ts.map +0 -1
  422. package/esm/drivers/postgres/postgres-blueprint.d.ts +0 -64
  423. package/esm/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
  424. package/esm/drivers/postgres/postgres-blueprint.js +0 -121
  425. package/esm/drivers/postgres/postgres-blueprint.js.map +0 -1
  426. package/esm/drivers/postgres/postgres-dialect.d.ts +0 -136
  427. package/esm/drivers/postgres/postgres-dialect.d.ts.map +0 -1
  428. package/esm/drivers/postgres/postgres-dialect.js +0 -268
  429. package/esm/drivers/postgres/postgres-dialect.js.map +0 -1
  430. package/esm/drivers/postgres/postgres-driver.d.ts +0 -432
  431. package/esm/drivers/postgres/postgres-driver.d.ts.map +0 -1
  432. package/esm/drivers/postgres/postgres-driver.js +0 -965
  433. package/esm/drivers/postgres/postgres-driver.js.map +0 -1
  434. package/esm/drivers/postgres/postgres-migration-driver.d.ts +0 -397
  435. package/esm/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
  436. package/esm/drivers/postgres/postgres-migration-driver.js +0 -900
  437. package/esm/drivers/postgres/postgres-migration-driver.js.map +0 -1
  438. package/esm/drivers/postgres/postgres-query-builder.d.ts +0 -254
  439. package/esm/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
  440. package/esm/drivers/postgres/postgres-query-builder.js +0 -933
  441. package/esm/drivers/postgres/postgres-query-builder.js.map +0 -1
  442. package/esm/drivers/postgres/postgres-query-parser.d.ts +0 -328
  443. package/esm/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
  444. package/esm/drivers/postgres/postgres-query-parser.js +0 -864
  445. package/esm/drivers/postgres/postgres-query-parser.js.map +0 -1
  446. package/esm/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
  447. package/esm/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
  448. package/esm/drivers/postgres/postgres-sql-serializer.js +0 -400
  449. package/esm/drivers/postgres/postgres-sql-serializer.js.map +0 -1
  450. package/esm/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
  451. package/esm/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
  452. package/esm/drivers/postgres/postgres-sync-adapter.js +0 -197
  453. package/esm/drivers/postgres/postgres-sync-adapter.js.map +0 -1
  454. package/esm/drivers/postgres/types.d.ts +0 -142
  455. package/esm/drivers/postgres/types.d.ts.map +0 -1
  456. package/esm/drivers/sql/index.d.ts +0 -10
  457. package/esm/drivers/sql/index.d.ts.map +0 -1
  458. package/esm/drivers/sql/sql-dialect.contract.d.ts +0 -204
  459. package/esm/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
  460. package/esm/drivers/sql/sql-types.d.ts +0 -202
  461. package/esm/drivers/sql/sql-types.d.ts.map +0 -1
  462. package/esm/errors/missing-data-source.error.d.ts +0 -22
  463. package/esm/errors/missing-data-source.error.d.ts.map +0 -1
  464. package/esm/errors/missing-data-source.error.js +0 -29
  465. package/esm/errors/missing-data-source.error.js.map +0 -1
  466. package/esm/errors/transaction-rollback.error.d.ts +0 -20
  467. package/esm/errors/transaction-rollback.error.d.ts.map +0 -1
  468. package/esm/errors/transaction-rollback.error.js +0 -27
  469. package/esm/errors/transaction-rollback.error.js.map +0 -1
  470. package/esm/events/model-events.d.ts +0 -231
  471. package/esm/events/model-events.d.ts.map +0 -1
  472. package/esm/events/model-events.js +0 -259
  473. package/esm/events/model-events.js.map +0 -1
  474. package/esm/expressions/aggregate-expressions.d.ts +0 -215
  475. package/esm/expressions/aggregate-expressions.d.ts.map +0 -1
  476. package/esm/expressions/aggregate-expressions.js +0 -221
  477. package/esm/expressions/aggregate-expressions.js.map +0 -1
  478. package/esm/expressions/index.d.ts +0 -2
  479. package/esm/expressions/index.d.ts.map +0 -1
  480. package/esm/index.d.ts +0 -45
  481. package/esm/index.d.ts.map +0 -1
  482. package/esm/index.js +0 -1
  483. package/esm/index.js.map +0 -1
  484. package/esm/migration/column-builder.d.ts +0 -417
  485. package/esm/migration/column-builder.d.ts.map +0 -1
  486. package/esm/migration/column-builder.js +0 -586
  487. package/esm/migration/column-builder.js.map +0 -1
  488. package/esm/migration/column-helpers.d.ts +0 -275
  489. package/esm/migration/column-helpers.d.ts.map +0 -1
  490. package/esm/migration/column-helpers.js +0 -389
  491. package/esm/migration/column-helpers.js.map +0 -1
  492. package/esm/migration/foreign-key-builder.d.ts +0 -103
  493. package/esm/migration/foreign-key-builder.d.ts.map +0 -1
  494. package/esm/migration/foreign-key-builder.js +0 -121
  495. package/esm/migration/foreign-key-builder.js.map +0 -1
  496. package/esm/migration/index.d.ts +0 -7
  497. package/esm/migration/index.d.ts.map +0 -1
  498. package/esm/migration/migration-runner.d.ts +0 -278
  499. package/esm/migration/migration-runner.d.ts.map +0 -1
  500. package/esm/migration/migration-runner.js +0 -815
  501. package/esm/migration/migration-runner.js.map +0 -1
  502. package/esm/migration/migration.d.ts +0 -1992
  503. package/esm/migration/migration.d.ts.map +0 -1
  504. package/esm/migration/migration.js +0 -2162
  505. package/esm/migration/migration.js.map +0 -1
  506. package/esm/migration/sql-grammar.d.ts +0 -61
  507. package/esm/migration/sql-grammar.d.ts.map +0 -1
  508. package/esm/migration/sql-grammar.js +0 -164
  509. package/esm/migration/sql-grammar.js.map +0 -1
  510. package/esm/migration/sql-serializer.d.ts +0 -22
  511. package/esm/migration/sql-serializer.d.ts.map +0 -1
  512. package/esm/migration/sql-serializer.js +0 -26
  513. package/esm/migration/sql-serializer.js.map +0 -1
  514. package/esm/migration/types.d.ts +0 -155
  515. package/esm/migration/types.d.ts.map +0 -1
  516. package/esm/model/methods/accessor-methods.d.ts +0 -13
  517. package/esm/model/methods/accessor-methods.d.ts.map +0 -1
  518. package/esm/model/methods/accessor-methods.js +0 -51
  519. package/esm/model/methods/accessor-methods.js.map +0 -1
  520. package/esm/model/methods/delete-methods.d.ts +0 -10
  521. package/esm/model/methods/delete-methods.d.ts.map +0 -1
  522. package/esm/model/methods/delete-methods.js +0 -10
  523. package/esm/model/methods/delete-methods.js.map +0 -1
  524. package/esm/model/methods/dirty-methods.d.ts +0 -10
  525. package/esm/model/methods/dirty-methods.d.ts.map +0 -1
  526. package/esm/model/methods/dirty-methods.js +0 -15
  527. package/esm/model/methods/dirty-methods.js.map +0 -1
  528. package/esm/model/methods/hydration-methods.d.ts +0 -10
  529. package/esm/model/methods/hydration-methods.d.ts.map +0 -1
  530. package/esm/model/methods/hydration-methods.js +0 -57
  531. package/esm/model/methods/hydration-methods.js.map +0 -1
  532. package/esm/model/methods/instance-event-methods.d.ts +0 -7
  533. package/esm/model/methods/instance-event-methods.d.ts.map +0 -1
  534. package/esm/model/methods/instance-event-methods.js +0 -15
  535. package/esm/model/methods/instance-event-methods.js.map +0 -1
  536. package/esm/model/methods/meta-methods.d.ts +0 -7
  537. package/esm/model/methods/meta-methods.d.ts.map +0 -1
  538. package/esm/model/methods/meta-methods.js +0 -78
  539. package/esm/model/methods/meta-methods.js.map +0 -1
  540. package/esm/model/methods/query-methods.d.ts +0 -24
  541. package/esm/model/methods/query-methods.d.ts.map +0 -1
  542. package/esm/model/methods/query-methods.js +0 -161
  543. package/esm/model/methods/query-methods.js.map +0 -1
  544. package/esm/model/methods/restore-methods.d.ts +0 -10
  545. package/esm/model/methods/restore-methods.d.ts.map +0 -1
  546. package/esm/model/methods/restore-methods.js +0 -13
  547. package/esm/model/methods/restore-methods.js.map +0 -1
  548. package/esm/model/methods/scope-methods.d.ts +0 -7
  549. package/esm/model/methods/scope-methods.d.ts.map +0 -1
  550. package/esm/model/methods/scope-methods.js +0 -15
  551. package/esm/model/methods/scope-methods.js.map +0 -1
  552. package/esm/model/methods/serialization-methods.d.ts +0 -3
  553. package/esm/model/methods/serialization-methods.d.ts.map +0 -1
  554. package/esm/model/methods/serialization-methods.js +0 -27
  555. package/esm/model/methods/serialization-methods.js.map +0 -1
  556. package/esm/model/methods/static-event-methods.d.ts +0 -9
  557. package/esm/model/methods/static-event-methods.d.ts.map +0 -1
  558. package/esm/model/methods/static-event-methods.js +0 -29
  559. package/esm/model/methods/static-event-methods.js.map +0 -1
  560. package/esm/model/methods/write-methods.d.ts +0 -10
  561. package/esm/model/methods/write-methods.d.ts.map +0 -1
  562. package/esm/model/methods/write-methods.js +0 -52
  563. package/esm/model/methods/write-methods.js.map +0 -1
  564. package/esm/model/model.d.ts +0 -1650
  565. package/esm/model/model.d.ts.map +0 -1
  566. package/esm/model/model.js +0 -1657
  567. package/esm/model/model.js.map +0 -1
  568. package/esm/model/model.types.d.ts +0 -44
  569. package/esm/model/model.types.d.ts.map +0 -1
  570. package/esm/model/register-model.d.ts +0 -81
  571. package/esm/model/register-model.d.ts.map +0 -1
  572. package/esm/model/register-model.js +0 -94
  573. package/esm/model/register-model.js.map +0 -1
  574. package/esm/query-builder/query-builder.d.ts +0 -556
  575. package/esm/query-builder/query-builder.d.ts.map +0 -1
  576. package/esm/query-builder/query-builder.js +0 -1070
  577. package/esm/query-builder/query-builder.js.map +0 -1
  578. package/esm/relations/helpers.d.ts +0 -156
  579. package/esm/relations/helpers.d.ts.map +0 -1
  580. package/esm/relations/helpers.js +0 -201
  581. package/esm/relations/helpers.js.map +0 -1
  582. package/esm/relations/index.d.ts +0 -35
  583. package/esm/relations/index.d.ts.map +0 -1
  584. package/esm/relations/pivot-operations.d.ts +0 -160
  585. package/esm/relations/pivot-operations.d.ts.map +0 -1
  586. package/esm/relations/pivot-operations.js +0 -293
  587. package/esm/relations/pivot-operations.js.map +0 -1
  588. package/esm/relations/relation-hydrator.d.ts +0 -68
  589. package/esm/relations/relation-hydrator.d.ts.map +0 -1
  590. package/esm/relations/relation-hydrator.js +0 -81
  591. package/esm/relations/relation-hydrator.js.map +0 -1
  592. package/esm/relations/relation-loader.d.ts +0 -194
  593. package/esm/relations/relation-loader.d.ts.map +0 -1
  594. package/esm/relations/relation-loader.js +0 -466
  595. package/esm/relations/relation-loader.js.map +0 -1
  596. package/esm/relations/types.d.ts +0 -306
  597. package/esm/relations/types.d.ts.map +0 -1
  598. package/esm/remover/database-remover.d.ts +0 -100
  599. package/esm/remover/database-remover.d.ts.map +0 -1
  600. package/esm/remover/database-remover.js +0 -214
  601. package/esm/remover/database-remover.js.map +0 -1
  602. package/esm/restorer/database-restorer.d.ts +0 -131
  603. package/esm/restorer/database-restorer.d.ts.map +0 -1
  604. package/esm/restorer/database-restorer.js +0 -434
  605. package/esm/restorer/database-restorer.js.map +0 -1
  606. package/esm/sql-database-dirty-tracker.d.ts +0 -13
  607. package/esm/sql-database-dirty-tracker.d.ts.map +0 -1
  608. package/esm/sql-database-dirty-tracker.js +0 -14
  609. package/esm/sql-database-dirty-tracker.js.map +0 -1
  610. package/esm/sync/index.d.ts +0 -12
  611. package/esm/sync/index.d.ts.map +0 -1
  612. package/esm/sync/model-events.d.ts +0 -62
  613. package/esm/sync/model-events.d.ts.map +0 -1
  614. package/esm/sync/model-events.js +0 -49
  615. package/esm/sync/model-events.js.map +0 -1
  616. package/esm/sync/model-sync-operation.d.ts +0 -163
  617. package/esm/sync/model-sync-operation.d.ts.map +0 -1
  618. package/esm/sync/model-sync-operation.js +0 -292
  619. package/esm/sync/model-sync-operation.js.map +0 -1
  620. package/esm/sync/model-sync.d.ts +0 -130
  621. package/esm/sync/model-sync.d.ts.map +0 -1
  622. package/esm/sync/model-sync.js +0 -178
  623. package/esm/sync/model-sync.js.map +0 -1
  624. package/esm/sync/sync-context.d.ts +0 -70
  625. package/esm/sync/sync-context.d.ts.map +0 -1
  626. package/esm/sync/sync-context.js +0 -101
  627. package/esm/sync/sync-context.js.map +0 -1
  628. package/esm/sync/sync-manager.d.ts +0 -213
  629. package/esm/sync/sync-manager.d.ts.map +0 -1
  630. package/esm/sync/sync-manager.js +0 -689
  631. package/esm/sync/sync-manager.js.map +0 -1
  632. package/esm/sync/types.d.ts +0 -289
  633. package/esm/sync/types.d.ts.map +0 -1
  634. package/esm/test-migrations/test-enhanced-features.migration.d.ts +0 -15
  635. package/esm/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
  636. package/esm/types.d.ts +0 -371
  637. package/esm/types.d.ts.map +0 -1
  638. package/esm/utils/connect-to-database.d.ts +0 -300
  639. package/esm/utils/connect-to-database.d.ts.map +0 -1
  640. package/esm/utils/connect-to-database.js +0 -128
  641. package/esm/utils/connect-to-database.js.map +0 -1
  642. package/esm/utils/database-writer.utils.d.ts +0 -15
  643. package/esm/utils/database-writer.utils.d.ts.map +0 -1
  644. package/esm/utils/database-writer.utils.js +0 -14
  645. package/esm/utils/database-writer.utils.js.map +0 -1
  646. package/esm/utils/define-model.js +0 -100
  647. package/esm/utils/define-model.js.map +0 -1
  648. package/esm/utils/is-valid-date-value.d.ts +0 -5
  649. package/esm/utils/is-valid-date-value.d.ts.map +0 -1
  650. package/esm/utils/is-valid-date-value.js +0 -25
  651. package/esm/utils/is-valid-date-value.js.map +0 -1
  652. package/esm/utils/once-connected.d.ts +0 -146
  653. package/esm/utils/once-connected.d.ts.map +0 -1
  654. package/esm/utils/once-connected.js +0 -251
  655. package/esm/utils/once-connected.js.map +0 -1
  656. package/esm/validation/database-seal-plugins.d.ts +0 -12
  657. package/esm/validation/database-seal-plugins.d.ts.map +0 -1
  658. package/esm/validation/database-seal-plugins.js +0 -1
  659. package/esm/validation/database-seal-plugins.js.map +0 -1
  660. package/esm/validation/database-writer-validation-error.d.ts +0 -97
  661. package/esm/validation/database-writer-validation-error.d.ts.map +0 -1
  662. package/esm/validation/database-writer-validation-error.js +0 -160
  663. package/esm/validation/database-writer-validation-error.js.map +0 -1
  664. package/esm/validation/index.d.ts +0 -3
  665. package/esm/validation/index.d.ts.map +0 -1
  666. package/esm/validation/mutators/embed-mutator.d.ts +0 -9
  667. package/esm/validation/mutators/embed-mutator.d.ts.map +0 -1
  668. package/esm/validation/mutators/embed-mutator.js +0 -33
  669. package/esm/validation/mutators/embed-mutator.js.map +0 -1
  670. package/esm/validation/plugins/embed-validator-plugin.d.ts +0 -24
  671. package/esm/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
  672. package/esm/validation/plugins/embed-validator-plugin.js +0 -18
  673. package/esm/validation/plugins/embed-validator-plugin.js.map +0 -1
  674. package/esm/validation/rules/database-model-rule.d.ts +0 -7
  675. package/esm/validation/rules/database-model-rule.d.ts.map +0 -1
  676. package/esm/validation/rules/database-model-rule.js +0 -27
  677. package/esm/validation/rules/database-model-rule.js.map +0 -1
  678. package/esm/validation/transformers/embed-model-transformer.d.ts +0 -3
  679. package/esm/validation/transformers/embed-model-transformer.d.ts.map +0 -1
  680. package/esm/validation/transformers/embed-model-transformer.js +0 -18
  681. package/esm/validation/transformers/embed-model-transformer.js.map +0 -1
  682. package/esm/validation/validators/embed-validator.d.ts +0 -21
  683. package/esm/validation/validators/embed-validator.d.ts.map +0 -1
  684. package/esm/validation/validators/embed-validator.js +0 -43
  685. package/esm/validation/validators/embed-validator.js.map +0 -1
  686. package/esm/writer/database-writer.d.ts +0 -181
  687. package/esm/writer/database-writer.d.ts.map +0 -1
  688. package/esm/writer/database-writer.js +0 -407
  689. package/esm/writer/database-writer.js.map +0 -1
@@ -1,1609 +0,0 @@
1
- /**
2
- * Ordering direction supported by query builders.
3
- */
4
- export type OrderDirection = "asc" | "desc";
5
- /**
6
- * Options describing a relationship join.
7
- */
8
- export type JoinOptions = {
9
- /** Target table or collection. */
10
- table: string;
11
- /** Local field used in the join condition. */
12
- localField?: string;
13
- /** Operator used in the join condition (defaults to equality). */
14
- operator?: string;
15
- /** Foreign field used in the join condition. */
16
- foreignField?: string;
17
- /** Join type. */
18
- type?: "inner" | "left" | "right" | "full" | "cross";
19
- /** Optional alias for the joined relation. */
20
- alias?: string;
21
- /** Driver-specific options (e.g. Mongo pipeline). */
22
- options?: Record<string, unknown>;
23
- /** Projection overrides for the joined relation. */
24
- select?: string[];
25
- /** Extra join conditions expressed as key/value pairs. */
26
- conditions?: Record<string, unknown>;
27
- /** Driver specific pipeline/clauses for advanced joins. */
28
- pipeline?: unknown[];
29
- };
30
- /**
31
- * Pagination result returned by paginate helpers.
32
- */
33
- export type PaginationResult<T> = {
34
- data: T[];
35
- pagination: {
36
- total: number;
37
- page: number;
38
- limit: number;
39
- pages: number;
40
- };
41
- };
42
- /**
43
- * Cursor pagination result.
44
- */
45
- export type CursorPaginationResult<T> = {
46
- data: T[];
47
- pagination: {
48
- hasMore: boolean;
49
- hasPrev?: boolean;
50
- nextCursor?: unknown;
51
- prevCursor?: unknown;
52
- };
53
- };
54
- /**
55
- * Chunk callback signature.
56
- */
57
- export type ChunkCallback<T> = (rows: T[], chunkIndex: number) => Promise<boolean | void> | boolean | void;
58
- /**
59
- * Cursor pagination options.
60
- */
61
- export type CursorPaginationOptions = {
62
- cursor?: unknown;
63
- direction?: "next" | "prev";
64
- limit: number;
65
- column?: string;
66
- };
67
- /**
68
- * Standard pagination options.
69
- */
70
- export type PaginationOptions = {
71
- page?: number;
72
- limit?: number;
73
- };
74
- /**
75
- * Supported comparison operators.
76
- */
77
- export type WhereOperator = "=" | "!=" | ">" | ">=" | "<" | "<=" | "in" | "notIn" | "between" | "notBetween" | "like" | "notLike" | "startsWith" | "notStartsWith" | "endsWith" | "notEndsWith" | "exists" | string;
78
- /**
79
- * Object-based predicate definition.
80
- */
81
- import type { GlobalScopeDefinition, LocalScopeCallback } from "../model/model";
82
- export type WhereObject = Record<string, unknown>;
83
- /**
84
- * Callback-based predicate definition.
85
- */
86
- export type WhereCallback<T> = (builder: QueryBuilderContract<T>) => unknown;
87
- /**
88
- * Group-by payload supporting strings, arrays, or driver specific objects.
89
- */
90
- export type GroupByInput = string | string[] | Record<string, unknown> | Array<Record<string, unknown>>;
91
- /**
92
- * Having clause payload.
93
- */
94
- export type HavingInput = Record<string, unknown> | [field: string, value: unknown] | [field: string, operator: WhereOperator, value: unknown];
95
- /**
96
- * Raw expression payload for projection/order/group extensions.
97
- */
98
- export type RawExpression = string | Record<string, unknown> | unknown;
99
- /**
100
- * Driver-agnostic representation of a parsed query.
101
- *
102
- * Each driver populates only the fields it understands:
103
- *
104
- * - **SQL/CQL/Cypher** drivers → `query` + `bindings`
105
- * - **MongoDB** → `pipeline`
106
- * - **Elasticsearch** → `pipeline` (JSON DSL body)
107
- * - **DynamoDB / Redis / custom** → `native`
108
- *
109
- * @example
110
- * // PostgreSQL result:
111
- * { query: "SELECT * FROM users WHERE id = $1", bindings: [42] }
112
- *
113
- * // MongoDB result:
114
- * { pipeline: [{ $match: { status: "active" } }, { $limit: 10 }] }
115
- */
116
- export type DriverQuery = {
117
- /** Text-based query string: SQL, CQL, Cypher, etc. */
118
- query?: string;
119
- /** Positional or named parameter bindings for the text query. */
120
- bindings?: unknown[];
121
- /** Document pipeline: MongoDB aggregation stages, Elasticsearch DSL body, etc. */
122
- pipeline?: unknown[];
123
- /** Full escape hatch for drivers that don't fit any shape above. */
124
- native?: unknown;
125
- };
126
- /**
127
- * Contract that all query builders must implement for building queries in a
128
- * database-agnostic way. This interface provides a fluent, chainable API
129
- * for constructing complex database queries.
130
- *
131
- * @template T - The type of records returned by the query
132
- */
133
- export interface QueryBuilderContract<T = unknown> {
134
- /**
135
- * Table name
136
- */
137
- table: string;
138
- /**
139
- * Hydrate records after fetching is done successfully
140
- * Add hydrate callback function
141
- */
142
- hydrate(callback: (data: any, index: number) => any): this;
143
- /**
144
- * Register a callback to be invoked before query execution.
145
- * Allows modification of the query before it runs.
146
- * @returns Unsubscribe function to remove the callback
147
- */
148
- onFetching(callback: (query: this) => void | Promise<void>): () => void;
149
- /**
150
- * Register a callback to be invoked after records are fetched but before hydration.
151
- * Receives raw records from the database.
152
- * @returns Unsubscribe function to remove the callback
153
- */
154
- onHydrating(callback: (records: any[], context: any) => void | Promise<void>): () => void;
155
- /**
156
- * Register a callback to be invoked after records are fetched and hydrated.
157
- * Receives hydrated model instances.
158
- * @returns Unsubscribe function to remove the callback
159
- */
160
- onFetched(callback: (records: any[], context: any) => void | Promise<void>): () => void;
161
- /**
162
- * Pending global scopes to be applied before query execution.
163
- * Passed from Model.query() and applied in execute().
164
- */
165
- pendingGlobalScopes?: Map<string, GlobalScopeDefinition>;
166
- /**
167
- * Available local scopes that can be manually applied.
168
- * Passed from Model.query() for opt-in usage.
169
- */
170
- availableLocalScopes?: Map<string, LocalScopeCallback>;
171
- /**
172
- * Set of global scope names that have been disabled.
173
- */
174
- disabledGlobalScopes?: Set<string>;
175
- /**
176
- * Flag indicating whether scopes have been applied.
177
- */
178
- scopesApplied?: boolean;
179
- /**
180
- * Map of relations to eagerly load.
181
- * Keys are relation names, values are either:
182
- * - `true` for simple loading
183
- * - A callback to customize the related query
184
- */
185
- eagerLoadRelations?: Map<string, boolean | ((query: QueryBuilderContract) => void)>;
186
- /**
187
- * Array of relation names to count.
188
- */
189
- countRelations?: string[];
190
- /**
191
- * Map of relations to load via JOIN (single query).
192
- * Keys are relation names, values contain join configuration.
193
- */
194
- joinRelations?: Map<string, {
195
- alias: string;
196
- type: "belongsTo" | "hasOne" | "hasMany";
197
- model?: any;
198
- localKey?: string;
199
- foreignKey?: string;
200
- ownerKey?: string;
201
- parentPath?: string | null;
202
- relationName?: string;
203
- parentModel?: any;
204
- select?: string[];
205
- }>;
206
- /**
207
- * Relation definitions from the model class.
208
- * Used by joinWith() to determine how to join tables.
209
- */
210
- relationDefinitions?: Record<string, any>;
211
- /**
212
- * Model class reference for resolving related models.
213
- */
214
- modelClass?: any;
215
- /**
216
- * Load relations using database JOINs in a single query.
217
- *
218
- * Unlike `with()` which uses separate queries, `joinWith()` uses
219
- * LEFT JOIN (SQL) or $lookup (MongoDB) to fetch related data
220
- * in a single query. The related data is hydrated into proper
221
- * model instances and attached to the main model.
222
- *
223
- * Best for: belongsTo and hasOne relations where you need
224
- * efficient single-query loading.
225
- *
226
- * @param relation - Relation name to load via JOIN
227
- * @returns Query builder for chaining
228
- *
229
- * @example
230
- * ```typescript
231
- * // Single relation
232
- * const post = await Post.joinWith("author").first();
233
- * console.log(post.author); // User model instance
234
- * console.log(post.data); // { id, title, authorId } - no author data
235
- *
236
- * // Multiple relations
237
- * const post = await Post.joinWith("author", "category").first();
238
- * ```
239
- */
240
- joinWith(...relations: string[]): this;
241
- /**
242
- * Disable one or more global scopes for this query.
243
- *
244
- * @param scopeNames - Names of scopes to disable
245
- * @returns Query builder for chaining
246
- *
247
- * @example
248
- * ```typescript
249
- * // Disable tenant scope for admin queries
250
- * await User.query().withoutGlobalScope('tenant').get();
251
- *
252
- * // Disable multiple scopes
253
- * await User.query().withoutGlobalScope('tenant', 'softDelete').get();
254
- * ```
255
- */
256
- withoutGlobalScope(...scopeNames: string[]): this;
257
- /**
258
- * Disable all global scopes for this query.
259
- *
260
- * @returns Query builder for chaining
261
- *
262
- * @example
263
- * ```typescript
264
- * // Get all users including soft-deleted and from all tenants
265
- * await User.query().withoutGlobalScopes().get();
266
- * ```
267
- */
268
- withoutGlobalScopes(): this;
269
- /**
270
- * Apply a local scope to this query.
271
- *
272
- * @param scopeName - Name of the scope to apply
273
- * @returns Query builder for chaining
274
- * @throws Error if scope not found
275
- *
276
- * @example
277
- * ```typescript
278
- * // Apply 'active' scope
279
- * await User.query().scope('active').get();
280
- *
281
- * // Chain multiple scopes
282
- * await User.query().scope('active').scope('admins').get();
283
- * ```
284
- */
285
- scope(scopeName: string, ...args: any[]): this;
286
- /**
287
- * Add a where clause to the query.
288
- *
289
- * @example
290
- * // Simple equality
291
- * query.where('age', 18)
292
- *
293
- * // With operator
294
- * query.where('age', '>', 18)
295
- *
296
- * // Object-based
297
- * query.where({ age: 18, isActive: true })
298
- *
299
- * // Callback-based
300
- * query.where(q => q.where('age', '>', 18).orWhere('role', 'admin'))
301
- */
302
- where(field: string, value: unknown): this;
303
- where(field: string, operator: WhereOperator, value: unknown): this;
304
- where(conditions: WhereObject): this;
305
- where(callback: WhereCallback<T>): this;
306
- /**
307
- * Add a raw where clause expressed in the native query language.
308
- *
309
- * @example
310
- * query.whereRaw({ $expr: { $gt: ["$stock", "$reserved"] } })
311
- * query.whereRaw("this.age > ?", [30])
312
- */
313
- whereRaw(expression: RawExpression, bindings?: unknown[]): this;
314
- /**
315
- * Add a raw OR where clause expressed in the native query language.
316
- *
317
- * @example
318
- * query.orWhereRaw({ $where: "this.isAdmin === true" })
319
- */
320
- orWhereRaw(expression: RawExpression, bindings?: unknown[]): this;
321
- /**
322
- * Compare two columns/fields directly.
323
- *
324
- * @example
325
- * query.whereColumn('stock', '>', 'reserved')
326
- */
327
- whereColumn(first: string, operator: WhereOperator, second: string): this;
328
- /**
329
- * Compare two columns/fields directly using OR logic.
330
- *
331
- * @example
332
- * query.orWhereColumn('startDate', '<', 'endDate')
333
- */
334
- orWhereColumn(first: string, operator: WhereOperator, second: string): this;
335
- /**
336
- * Compare multiple column pairs at once.
337
- *
338
- * @example
339
- * query.whereColumns([
340
- * ['price', '>', 'discountPrice'],
341
- * ['stock', '>=', 'reserved'],
342
- * ])
343
- */
344
- whereColumns(comparisons: Array<[left: string, operator: WhereOperator, right: string]>): this;
345
- /**
346
- * Ensure a value falls between two other column values.
347
- *
348
- * @example
349
- * query.whereBetweenColumns('age', 'minAge', 'maxAge')
350
- */
351
- whereBetweenColumns(field: string, lowerColumn: string, upperColumn: string): this;
352
- /**
353
- * Constrain a field to a specific date (time portion ignored).
354
- *
355
- * @example
356
- * query.whereDate('createdAt', '2024-05-01')
357
- */
358
- whereDate(field: string, value: Date | string): this;
359
- /**
360
- * Require a field to match a given date exactly.
361
- */
362
- whereDateEquals(field: string, value: Date | string): this;
363
- /**
364
- * Require a field to be before the given date.
365
- */
366
- whereDateBefore(field: string, value: Date | string): this;
367
- /**
368
- * Require a field to be after the given date.
369
- */
370
- whereDateAfter(field: string, value: Date | string): this;
371
- /**
372
- * Constrain a field to match a specific time.
373
- *
374
- * @example
375
- * query.whereTime('opensAt', '08:00')
376
- */
377
- whereTime(field: string, value: string): this;
378
- /**
379
- * Constrain the day-of-month extracted from a date field.
380
- */
381
- whereDay(field: string, value: number): this;
382
- /**
383
- * Constrain the month extracted from a date field.
384
- */
385
- whereMonth(field: string, value: number): this;
386
- /**
387
- * Constrain the year extracted from a date field.
388
- */
389
- whereYear(field: string, value: number): this;
390
- /**
391
- * Ensure a JSON/array path contains the given value.
392
- */
393
- whereJsonContains(path: string, value: unknown): this;
394
- /**
395
- * Ensure a JSON/array path does not contain the given value.
396
- */
397
- whereJsonDoesntContain(path: string, value: unknown): this;
398
- /**
399
- * Ensure a JSON/array path exists.
400
- */
401
- whereJsonContainsKey(path: string): this;
402
- /**
403
- * Constrain the length of a JSON/array path.
404
- *
405
- * @example
406
- * query.whereJsonLength('tags', '>', 3)
407
- */
408
- whereJsonLength(path: string, operator: WhereOperator, value: number): this;
409
- /**
410
- * Ensure a JSON path resolves to an array.
411
- */
412
- whereJsonIsArray(path: string): this;
413
- /**
414
- * Ensure a JSON path resolves to an object.
415
- */
416
- whereJsonIsObject(path: string): this;
417
- /**
418
- * Constrain the length of an array field.
419
- *
420
- * @example
421
- * query.whereArrayLength('roles', '>=', 2)
422
- */
423
- whereArrayLength(field: string, operator: WhereOperator, value: number): this;
424
- /**
425
- * Shortcut for filtering by the primary key.
426
- */
427
- whereId(value: string | number): this;
428
- /**
429
- * Shortcut for filtering by multiple primary keys.
430
- */
431
- whereIds(values: Array<string | number>): this;
432
- /**
433
- * Shortcut for UUID-based identifiers.
434
- */
435
- whereUuid(value: string): this;
436
- /**
437
- * Shortcut for ULID-based identifiers.
438
- */
439
- whereUlid(value: string): this;
440
- /**
441
- * Perform a full-text search across the specified fields.
442
- */
443
- whereFullText(fields: string | string[], query: string): this;
444
- /**
445
- * Apply a full-text OR clause.
446
- */
447
- orWhereFullText(fields: string | string[], query: string): this;
448
- /**
449
- * Convenience alias for simple text searches.
450
- */
451
- whereSearch(field: string, query: string): this;
452
- /**
453
- * Negate a nested callback block.
454
- */
455
- whereNot(callback: WhereCallback<T>): this;
456
- /**
457
- * Negate a nested callback block with OR logic.
458
- */
459
- orWhereNot(callback: WhereCallback<T>): this;
460
- /**
461
- * Apply a nested existence check.
462
- *
463
- * @example
464
- * query.whereExists(q => q.where('status', 'active'))
465
- * query.whereExists('optionalField')
466
- */
467
- whereExists(callback: WhereCallback<T>): this;
468
- /**
469
- * Apply a nested non-existence check.
470
- *
471
- * @example
472
- * query.whereNotExists(q => q.where('status', 'inactive'))
473
- * query.whereNotExists('deletedAt')
474
- */
475
- whereNotExists(callback: WhereCallback<T>): this;
476
- /**
477
- * Add an OR where clause to the query.
478
- *
479
- * @example
480
- * query.where('role', 'admin').orWhere('role', 'moderator')
481
- */
482
- orWhere(field: string, value: unknown): this;
483
- orWhere(field: string, operator: WhereOperator, value: unknown): this;
484
- orWhere(conditions: WhereObject): this;
485
- orWhere(callback: WhereCallback<T>): this;
486
- /**
487
- * Add a where IN clause to the query.
488
- *
489
- * @example
490
- * query.whereIn('status', ['active', 'pending'])
491
- */
492
- whereIn(field: string, values: unknown[]): this;
493
- /**
494
- * Add a where NOT IN clause to the query.
495
- *
496
- * @example
497
- * query.whereNotIn('status', ['deleted', 'archived'])
498
- */
499
- whereNotIn(field: string, values: unknown[]): this;
500
- /**
501
- * Constrain the field to be NULL.
502
- *
503
- * @example
504
- * query.whereNull('deletedAt')
505
- */
506
- whereNull(field: string): this;
507
- /**
508
- * Constrain the field to be NOT NULL.
509
- *
510
- * @example
511
- * query.whereNotNull('email')
512
- */
513
- whereNotNull(field: string): this;
514
- /**
515
- * Constrain the field to be between the given range (inclusive).
516
- *
517
- * @example
518
- * query.whereBetween('age', [18, 65])
519
- */
520
- whereBetween(field: string, range: [unknown, unknown]): this;
521
- /**
522
- * Constrain the field to be outside the given range.
523
- *
524
- * @example
525
- * query.whereNotBetween('age', [18, 65])
526
- */
527
- whereNotBetween(field: string, range: [unknown, unknown]): this;
528
- /**
529
- * Apply pattern matching (case-insensitive) for the given field.
530
- *
531
- * @example
532
- * query.whereLike('name', '%john%')
533
- */
534
- whereLike(field: string, pattern: RegExp | string): this;
535
- /**
536
- * Apply pattern exclusion (case-insensitive) for the given field.
537
- *
538
- * @example
539
- * query.whereNotLike('email', '%@spam.com')
540
- */
541
- whereNotLike(field: string, pattern: string): this;
542
- /**
543
- * Constrain the field to start with the given value.
544
- *
545
- * @example
546
- * query.whereStartsWith('name', 'John')
547
- */
548
- whereStartsWith(field: string, value: string | number): this;
549
- /**
550
- * Constrain the field to not start with the given value.
551
- *
552
- * @example
553
- * query.whereNotStartsWith('name', 'Admin')
554
- */
555
- whereNotStartsWith(field: string, value: string | number): this;
556
- /**
557
- * Constrain the field to end with the given value.
558
- *
559
- * @example
560
- * query.whereEndsWith('email', '@example.com')
561
- */
562
- whereEndsWith(field: string, value: string | number): this;
563
- /**
564
- * Constrain the field to not end with the given value.
565
- *
566
- * @example
567
- * query.whereNotEndsWith('email', '@spam.com')
568
- */
569
- whereNotEndsWith(field: string, value: string | number): this;
570
- /**
571
- * Constrain the date field to be between the given range.
572
- *
573
- * @example
574
- * query.whereDateBetween('createdAt', [startDate, endDate])
575
- */
576
- whereDateBetween(field: string, range: [Date, Date]): this;
577
- /**
578
- * Constrain the date field to not be between the given range.
579
- *
580
- * @example
581
- * query.whereDateNotBetween('createdAt', [startDate, endDate])
582
- */
583
- whereDateNotBetween(field: string, range: [Date, Date]): this;
584
- /**
585
- * Check that a field exists (MongoDB-specific).
586
- *
587
- * @example
588
- * query.whereExists('optionalField')
589
- */
590
- whereExists(field: string): this;
591
- /**
592
- * Check that a field does not exist (MongoDB-specific).
593
- *
594
- * @example
595
- * query.whereNotExists('optionalField')
596
- */
597
- whereNotExists(field: string): this;
598
- /**
599
- * Constrain an array/collection field by size.
600
- *
601
- * @example
602
- * // Exact size
603
- * query.whereSize('tags', 3)
604
- *
605
- * // With operator
606
- * query.whereSize('tags', '>', 0)
607
- */
608
- whereSize(field: string, size: number): this;
609
- whereSize(field: string, operator: ">" | ">=" | "=" | "<" | "<=", size: number): this;
610
- /**
611
- * Perform a full-text search (driver-specific implementation).
612
- *
613
- * @example
614
- * query.textSearch('javascript tutorial', { language: 'en' })
615
- */
616
- textSearch(query: string, filters?: WhereObject): this;
617
- /**
618
- * Constrain an array field to contain the given value.
619
- * Optionally match by a specific key within array of objects.
620
- *
621
- * @example
622
- * // Simple array
623
- * query.whereArrayContains('tags', 'javascript')
624
- *
625
- * // Array of objects
626
- * query.whereArrayContains('items', 'laptop', 'name')
627
- */
628
- whereArrayContains(field: string, value: unknown, key?: string): this;
629
- /**
630
- * Constrain an array field to not contain the given value.
631
- *
632
- * @example
633
- * query.whereArrayNotContains('tags', 'deprecated')
634
- */
635
- whereArrayNotContains(field: string, value: unknown, key?: string): this;
636
- /**
637
- * Constrain an array field to contain the value OR be empty.
638
- *
639
- * @example
640
- * query.whereArrayHasOrEmpty('permissions', 'admin')
641
- */
642
- whereArrayHasOrEmpty(field: string, value: unknown, key?: string): this;
643
- /**
644
- * Constrain an array field to not contain the value OR be empty.
645
- *
646
- * @example
647
- * query.whereArrayNotHaveOrEmpty('blockedUsers', userId)
648
- */
649
- whereArrayNotHaveOrEmpty(field: string, value: unknown, key?: string): this;
650
- /**
651
- * Specify the columns/fields to be selected.
652
- *
653
- * @example
654
- * query.select(['name', 'email', 'age'])
655
- */
656
- select(fields: string[]): this;
657
- select(fields: Record<string, 0 | 1 | boolean>): this;
658
- select(...fields: Array<string | string[]>): this;
659
- select(...args: Array<string | string[]>): this;
660
- /**
661
- * Select a field with an alias.
662
- *
663
- * @example
664
- * query.selectAs('name', 'fullName')
665
- */
666
- selectAs(field: string, alias: string): this;
667
- /**
668
- * Add a raw selection/projection expression.
669
- *
670
- * @example
671
- * query.selectRaw({ total: { $sum: "$items.price" } })
672
- */
673
- selectRaw(expression: RawExpression, bindings?: unknown[]): this;
674
- /**
675
- * Add multiple raw selections at once.
676
- *
677
- * @example
678
- * query.selectRawMany([
679
- * { alias: "firstName", expression: "$profile.name.first" },
680
- * { alias: "isAdult", expression: { $gte: ["$age", 18] } },
681
- * ])
682
- */
683
- selectRawMany(definitions: Array<{
684
- alias: string;
685
- expression: RawExpression;
686
- bindings?: unknown[];
687
- }>): this;
688
- /**
689
- * Inject a sub-select expression under the given alias.
690
- *
691
- * @example
692
- * query.selectSub({ $sum: "$items.price" }, "itemsTotal")
693
- */
694
- selectSub(expression: RawExpression, alias: string): this;
695
- /**
696
- * Add a sub-select expression without clearing previous selects.
697
- */
698
- addSelectSub(expression: RawExpression, alias: string): this;
699
- /**
700
- * Add a simple aggregate expression to the projection.
701
- *
702
- * @example
703
- * query.selectAggregate("items.price", "sum", "itemsTotal")
704
- */
705
- selectAggregate(field: string, aggregate: "sum" | "avg" | "min" | "max" | "count" | "first" | "last", alias: string): this;
706
- /**
707
- * Project whether the given field exists.
708
- *
709
- * @example
710
- * query.selectExists("deletedAt", "isDeleted")
711
- */
712
- selectExists(field: string, alias: string): this;
713
- /**
714
- * Project the number of items in an array field.
715
- *
716
- * @example
717
- * query.selectCount("permissions", "permissionsCount")
718
- */
719
- selectCount(field: string, alias: string): this;
720
- /**
721
- * Build CASE / switch like conditions in the projection.
722
- *
723
- * @example
724
- * query.selectCase(
725
- * [
726
- * { when: { $eq: ["$status", "active"] }, then: "Active" },
727
- * { when: { $eq: ["$status", "pending"] }, then: "Pending" },
728
- * ],
729
- * "Unknown",
730
- * "statusLabel",
731
- * )
732
- */
733
- selectCase(cases: Array<{
734
- when: RawExpression;
735
- then: RawExpression | unknown;
736
- }>, otherwise: RawExpression | unknown, alias: string): this;
737
- /**
738
- * Convenience helper for single condition CASE statements.
739
- *
740
- * @example
741
- * query.selectWhen({ $gt: ["$age", 18] }, "Adult", "Minor", "ageLabel")
742
- */
743
- selectWhen(condition: RawExpression, thenValue: RawExpression | unknown, elseValue: RawExpression | unknown, alias: string): this;
744
- /**
745
- * Allow direct access to the driver projection object for advanced cases.
746
- *
747
- * @example
748
- * query.selectDriverProjection(projection => {
749
- * projection.score = { $meta: "textScore" };
750
- * })
751
- */
752
- selectDriverProjection(callback: (projection: Record<string, unknown>) => void): this;
753
- /**
754
- * Project a nested JSON path under a new alias.
755
- *
756
- * @example
757
- * query.selectJson("settings->theme", "theme")
758
- */
759
- selectJson(path: string, alias?: string): this;
760
- /**
761
- * Apply a raw expression to a JSON path.
762
- *
763
- * @example
764
- * query.selectJsonRaw("stats->views", { $ifNull: ["$stats.views", 0] }, "views")
765
- */
766
- selectJsonRaw(path: string, expression: RawExpression, alias: string): this;
767
- /**
768
- * Exclude a nested JSON path from the projection.
769
- */
770
- deselectJson(path: string): this;
771
- /**
772
- * Compute concatenated string fields.
773
- *
774
- * @example
775
- * query.selectConcat(["$firstName", " ", "$lastName"], "fullName")
776
- */
777
- selectConcat(fields: Array<string | RawExpression>, alias: string): this;
778
- /**
779
- * Coalesce a list of values, returning the first non-null entry.
780
- *
781
- * @example
782
- * query.selectCoalesce(["$nickname", "$name"], "displayName")
783
- */
784
- selectCoalesce(fields: Array<string | RawExpression>, alias: string): this;
785
- /**
786
- * Attach window function output to the projection.
787
- *
788
- * @example
789
- * query.selectWindow({
790
- * partitionBy: "$category",
791
- * sortBy: { createdAt: 1 },
792
- * output: { rank: { $denseRank: {} } },
793
- * })
794
- */
795
- selectWindow(spec: RawExpression): this;
796
- /**
797
- * Exclude the given fields from the projection.
798
- *
799
- * @example
800
- * query.deselect(['password', 'token'])
801
- */
802
- deselect(fields: string[]): this;
803
- /**
804
- * Reset the projection to its default state.
805
- */
806
- clearSelect(): this;
807
- /**
808
- * Alias for clearSelect() - keeps all fields.
809
- */
810
- selectAll(): this;
811
- /**
812
- * Restore the default projection (all columns).
813
- */
814
- selectDefault(): this;
815
- /**
816
- * Mark the query as distinct values for the given fields.
817
- *
818
- * @example
819
- * query.distinctValues('category')
820
- * query.distinctValues(['category', 'status'])
821
- */
822
- distinctValues(fields?: string | string[]): this;
823
- /**
824
- * Add additional select fields to the existing projection.
825
- *
826
- * @example
827
- * query.select(['name', 'email']).addSelect(['age'])
828
- */
829
- addSelect(fields: string[]): this;
830
- /**
831
- * Add a join clause to the query.
832
- *
833
- * Performs an INNER JOIN by default. Use leftJoin/rightJoin for outer joins.
834
- *
835
- * - **SQL**: Translates to `INNER JOIN table ON localField = foreignField`
836
- * - **MongoDB**: Translates to `$lookup` aggregation stage
837
- *
838
- * @param table - The table/collection to join
839
- * @param localField - The field from the current table
840
- * @param foreignField - The field from the joined table
841
- * @returns Query builder for chaining
842
- *
843
- * @example
844
- * ```typescript
845
- * // Simple join
846
- * query.join('profiles', 'id', 'userId');
847
- *
848
- * // With options
849
- * query.join({
850
- * table: 'profiles',
851
- * localField: 'id',
852
- * foreignField: 'userId',
853
- * alias: 'profile',
854
- * select: ['bio', 'avatar']
855
- * });
856
- * ```
857
- */
858
- join(table: string, localField: string, foreignField: string): this;
859
- join(options: JoinOptions): this;
860
- /**
861
- * Add a LEFT JOIN clause to the query.
862
- *
863
- * Returns all records from the left table, and matched records from the right.
864
- * If no match, NULL values are returned for right table columns.
865
- *
866
- * - **SQL**: Translates to `LEFT JOIN table ON localField = foreignField`
867
- * - **MongoDB**: Translates to `$lookup` (always behaves like LEFT JOIN)
868
- *
869
- * @param table - The table/collection to join
870
- * @param localField - The field from the current table
871
- * @param foreignField - The field from the joined table
872
- * @returns Query builder for chaining
873
- *
874
- * @example
875
- * ```typescript
876
- * // Get users with their optional profiles
877
- * query.leftJoin('profiles', 'id', 'userId');
878
- * ```
879
- */
880
- leftJoin(table: string, localField: string, foreignField: string): this;
881
- leftJoin(options: JoinOptions): this;
882
- /**
883
- * Add a RIGHT JOIN clause to the query.
884
- *
885
- * Returns all records from the right table, and matched records from the left.
886
- * If no match, NULL values are returned for left table columns.
887
- *
888
- * - **SQL**: Translates to `RIGHT JOIN table ON localField = foreignField`
889
- * - **MongoDB**: Not directly supported; may throw or emulate
890
- *
891
- * @param table - The table/collection to join
892
- * @param localField - The field from the current table
893
- * @param foreignField - The field from the joined table
894
- * @returns Query builder for chaining
895
- *
896
- * @example
897
- * ```typescript
898
- * // Get all profiles with their users (if any)
899
- * query.rightJoin('profiles', 'id', 'userId');
900
- * ```
901
- */
902
- rightJoin(table: string, localField: string, foreignField: string): this;
903
- rightJoin(options: JoinOptions): this;
904
- /**
905
- * Add an INNER JOIN clause to the query.
906
- *
907
- * Returns only records that have matching values in both tables.
908
- * Alias for join() with explicit intent.
909
- *
910
- * - **SQL**: Translates to `INNER JOIN table ON localField = foreignField`
911
- * - **MongoDB**: Translates to `$lookup` + `$match` to filter unmatched
912
- *
913
- * @param table - The table/collection to join
914
- * @param localField - The field from the current table
915
- * @param foreignField - The field from the joined table
916
- * @returns Query builder for chaining
917
- *
918
- * @example
919
- * ```typescript
920
- * // Get only users that have profiles
921
- * query.innerJoin('profiles', 'id', 'userId');
922
- * ```
923
- */
924
- innerJoin(table: string, localField: string, foreignField: string): this;
925
- innerJoin(options: JoinOptions): this;
926
- /**
927
- * Add a FULL OUTER JOIN clause to the query.
928
- *
929
- * Returns all records when there is a match in either table.
930
- * NULL values for non-matching rows on either side.
931
- *
932
- * - **SQL**: Translates to `FULL OUTER JOIN table ON localField = foreignField`
933
- * - **MongoDB**: Not supported; throws error
934
- *
935
- * @param table - The table/collection to join
936
- * @param localField - The field from the current table
937
- * @param foreignField - The field from the joined table
938
- * @returns Query builder for chaining
939
- *
940
- * @example
941
- * ```typescript
942
- * query.fullJoin('profiles', 'id', 'userId');
943
- * ```
944
- */
945
- fullJoin(table: string, localField: string, foreignField: string): this;
946
- fullJoin(options: JoinOptions): this;
947
- /**
948
- * Add a CROSS JOIN clause to the query.
949
- *
950
- * Returns the Cartesian product of both tables (every combination).
951
- * Use with caution as this can produce very large result sets.
952
- *
953
- * - **SQL**: Translates to `CROSS JOIN table`
954
- * - **MongoDB**: Not supported; throws error
955
- *
956
- * @param table - The table/collection to cross join
957
- * @returns Query builder for chaining
958
- *
959
- * @example
960
- * ```typescript
961
- * // Get all combinations of products and colors
962
- * query.crossJoin('colors');
963
- * ```
964
- */
965
- crossJoin(table: string): this;
966
- /**
967
- * Add a raw JOIN clause using native query syntax.
968
- *
969
- * Allows full control over the JOIN expression for complex scenarios.
970
- *
971
- * - **SQL**: Passed directly to the query
972
- * - **MongoDB**: Passed as raw `$lookup` pipeline stage
973
- *
974
- * @param expression - Raw JOIN expression in driver's native syntax
975
- * @param bindings - Optional parameter bindings for SQL placeholders
976
- * @returns Query builder for chaining
977
- *
978
- * @example
979
- * ```typescript
980
- * // SQL raw join
981
- * query.joinRaw('LEFT JOIN profiles ON profiles.user_id = users.id AND profiles.active = $1', [true]);
982
- *
983
- * // MongoDB raw $lookup
984
- * query.joinRaw({
985
- * $lookup: {
986
- * from: 'profiles',
987
- * let: { userId: '$_id' },
988
- * pipeline: [{ $match: { $expr: { $eq: ['$userId', '$$userId'] } } }],
989
- * as: 'profile'
990
- * }
991
- * });
992
- * ```
993
- */
994
- joinRaw(expression: RawExpression, bindings?: unknown[]): this;
995
- /**
996
- * Eagerly load one or more relations with the query results.
997
- *
998
- * Relations are loaded in separate optimized queries to prevent N+1 problems.
999
- * The loaded relations are attached to each model instance.
1000
- *
1001
- * @param relation - Single relation name to load
1002
- * @returns Query builder for chaining
1003
- *
1004
- * @example
1005
- * ```typescript
1006
- * // Load single relation
1007
- * const user = await User.query().with("posts").find(1);
1008
- * console.log(user.posts); // Post[]
1009
- *
1010
- * // Load multiple relations
1011
- * const user = await User.query().with("posts", "organization").find(1);
1012
- *
1013
- * // Load nested relations
1014
- * const user = await User.query().with("posts.comments.author").find(1);
1015
- * ```
1016
- */
1017
- with(relation: string): this;
1018
- /**
1019
- * Eagerly load multiple relations.
1020
- *
1021
- * @param relations - Relation names to load
1022
- * @returns Query builder for chaining
1023
- */
1024
- with(...relations: string[]): this;
1025
- /**
1026
- * Eagerly load a relation with a constraint callback.
1027
- *
1028
- * The callback receives the relation query builder, allowing you to
1029
- * add conditions, ordering, or limits to the related query.
1030
- *
1031
- * @param relation - Relation name to load
1032
- * @param constraint - Callback to configure the relation query
1033
- * @returns Query builder for chaining
1034
- *
1035
- * @example
1036
- * ```typescript
1037
- * const user = await User.query()
1038
- * .with("posts", (query) => {
1039
- * query.where("isPublished", true)
1040
- * .orderBy("createdAt", "desc")
1041
- * .limit(5);
1042
- * })
1043
- * .find(1);
1044
- * ```
1045
- */
1046
- with(relation: string, constraint: (query: QueryBuilderContract) => void): this;
1047
- /**
1048
- * Eagerly load multiple relations with constraints.
1049
- *
1050
- * Pass an object where keys are relation names and values are either:
1051
- * - `true` to load without constraints
1052
- * - A callback function to configure the relation query
1053
- *
1054
- * @param relations - Object mapping relation names to constraints
1055
- * @returns Query builder for chaining
1056
- *
1057
- * @example
1058
- * ```typescript
1059
- * const user = await User.query()
1060
- * .with({
1061
- * posts: (query) => query.where("isPublished", true),
1062
- * organization: true,
1063
- * roles: (query) => query.orderBy("priority"),
1064
- * })
1065
- * .find(1);
1066
- * ```
1067
- */
1068
- with(relations: Record<string, boolean | ((query: QueryBuilderContract) => void)>): this;
1069
- /**
1070
- * Add a count of related models as a virtual field.
1071
- *
1072
- * The count is added as `{relationName}Count` on each result.
1073
- *
1074
- * @param relation - Single relation name to count
1075
- * @returns Query builder for chaining
1076
- *
1077
- * @example
1078
- * ```typescript
1079
- * const users = await User.query().withCount("posts").get();
1080
- * console.log(users[0].postsCount); // number
1081
- * ```
1082
- */
1083
- withCount(relation: string): this;
1084
- /**
1085
- * Add counts of multiple related models as virtual fields.
1086
- *
1087
- * @param relations - Relation names to count
1088
- * @returns Query builder for chaining
1089
- *
1090
- * @example
1091
- * ```typescript
1092
- * const users = await User.query()
1093
- * .withCount("posts", "comments", "followers")
1094
- * .get();
1095
- * ```
1096
- */
1097
- withCount(...relations: string[]): this;
1098
- /**
1099
- * Filter results to only those that have related models.
1100
- *
1101
- * @param relation - Relation name to check
1102
- * @returns Query builder for chaining
1103
- *
1104
- * @example
1105
- * ```typescript
1106
- * // Get users who have at least one post
1107
- * const usersWithPosts = await User.query().has("posts").get();
1108
- * ```
1109
- */
1110
- has(relation: string): this;
1111
- /**
1112
- * Filter results based on the count of related models.
1113
- *
1114
- * @param relation - Relation name to check
1115
- * @param operator - Comparison operator
1116
- * @param count - Number to compare against
1117
- * @returns Query builder for chaining
1118
- *
1119
- * @example
1120
- * ```typescript
1121
- * // Get users with at least 5 posts
1122
- * const prolificUsers = await User.query().has("posts", ">=", 5).get();
1123
- *
1124
- * // Get users with exactly 3 roles
1125
- * const users = await User.query().has("roles", "=", 3).get();
1126
- * ```
1127
- */
1128
- has(relation: string, operator: string, count: number): this;
1129
- /**
1130
- * Filter results that have related models matching specific conditions.
1131
- *
1132
- * @param relation - Relation name to check
1133
- * @param callback - Callback to define conditions on the related query
1134
- * @returns Query builder for chaining
1135
- *
1136
- * @example
1137
- * ```typescript
1138
- * // Get users with published posts
1139
- * const users = await User.query()
1140
- * .whereHas("posts", (query) => {
1141
- * query.where("isPublished", true);
1142
- * })
1143
- * .get();
1144
- *
1145
- * // Get users with posts in a specific category
1146
- * const users = await User.query()
1147
- * .whereHas("posts", (query) => {
1148
- * query.where("categoryId", categoryId);
1149
- * })
1150
- * .get();
1151
- * ```
1152
- */
1153
- whereHas(relation: string, callback: (query: QueryBuilderContract) => void): this;
1154
- /**
1155
- * Filter results that don't have any related models.
1156
- *
1157
- * @param relation - Relation name to check
1158
- * @returns Query builder for chaining
1159
- *
1160
- * @example
1161
- * ```typescript
1162
- * // Get users without any posts
1163
- * const usersWithoutPosts = await User.query().doesntHave("posts").get();
1164
- * ```
1165
- */
1166
- doesntHave(relation: string): this;
1167
- /**
1168
- * Filter results that don't have related models matching specific conditions.
1169
- *
1170
- * @param relation - Relation name to check
1171
- * @param callback - Callback to define conditions on the related query
1172
- * @returns Query builder for chaining
1173
- *
1174
- * @example
1175
- * ```typescript
1176
- * // Get users without any published posts
1177
- * const users = await User.query()
1178
- * .whereDoesntHave("posts", (query) => {
1179
- * query.where("isPublished", true);
1180
- * })
1181
- * .get();
1182
- * ```
1183
- */
1184
- whereDoesntHave(relation: string, callback: (query: QueryBuilderContract) => void): this;
1185
- /**
1186
- * Order results by the specified field and direction.
1187
- *
1188
- * @example
1189
- * query.orderBy('createdAt', 'desc')
1190
- * query.orderBy({ id: 'asc', age: 'desc' })
1191
- */
1192
- orderBy(field: string, direction?: OrderDirection): this;
1193
- orderBy(fields: Record<string, OrderDirection>): this;
1194
- /**
1195
- * Order results descending by the specified field (shortcut).
1196
- *
1197
- * @example
1198
- * query.orderByDesc('createdAt')
1199
- */
1200
- orderByDesc(field: string): this;
1201
- /**
1202
- * Order results using a raw expression.
1203
- *
1204
- * @example
1205
- * query.orderByRaw('RANDOM()')
1206
- */
1207
- orderByRaw(expression: RawExpression, bindings?: unknown[]): this;
1208
- /**
1209
- * Order results randomly.
1210
- *
1211
- * @example
1212
- * query.orderByRandom(100)
1213
- */
1214
- orderByRandom(limit: number): this;
1215
- /**
1216
- * Order by the latest records using a timestamp column (descending).
1217
- * Defaults to 'createdAt'.
1218
- *
1219
- * @example
1220
- * query.latest() // orderBy('createdAt', 'desc')
1221
- * query.latest('updatedAt') // orderBy('updatedAt', 'desc')
1222
- */
1223
- latest(column?: string): Promise<T[]>;
1224
- /**
1225
- * Order by the oldest records using a timestamp column (ascending).
1226
- * Defaults to 'createdAt'.
1227
- *
1228
- * @example
1229
- * query.oldest() // orderBy('createdAt', 'asc')
1230
- */
1231
- oldest(column?: string): this;
1232
- /**
1233
- * Limit the number of results.
1234
- *
1235
- * @example
1236
- * query.limit(10)
1237
- */
1238
- limit(value: number): this;
1239
- /**
1240
- * Skip the specified number of results (alias for offset).
1241
- *
1242
- * @example
1243
- * query.skip(20)
1244
- */
1245
- skip(value: number): this;
1246
- /**
1247
- * Skip the specified number of results.
1248
- *
1249
- * @example
1250
- * query.offset(20)
1251
- */
1252
- offset(value: number): this;
1253
- /**
1254
- * Alias for limit() - take the first N results.
1255
- *
1256
- * @example
1257
- * query.take(5)
1258
- */
1259
- take(value: number): this;
1260
- /**
1261
- * Apply cursor pagination hints.
1262
- *
1263
- * @example
1264
- * query.cursor({ after: lastId })
1265
- */
1266
- cursor(after?: unknown, before?: unknown): this;
1267
- /**
1268
- * Group results by the given fields.
1269
- *
1270
- * @example
1271
- * query.groupBy('category')
1272
- * query.groupBy(['category', 'status'])
1273
- */
1274
- groupBy(fields: GroupByInput): this;
1275
- /**
1276
- * Group results by the given fields with aggregate operations.
1277
- *
1278
- * This method allows you to group documents and compute aggregates in a single
1279
- * operation. It accepts abstract aggregate expressions (from $agg helpers) or
1280
- * raw database-specific expressions.
1281
- *
1282
- * @param fields - Field(s) to group by
1283
- * @param aggregates - Aggregate operations to perform
1284
- *
1285
- * @example
1286
- * ```typescript
1287
- * import { $agg } from '@warlock.js/cascade';
1288
- *
1289
- * // Using abstract expressions (works for all databases)
1290
- * query.groupBy("type", {
1291
- * count: $agg.count(),
1292
- * total: $agg.sum("duration"),
1293
- * avg: $agg.avg("rating")
1294
- * });
1295
- *
1296
- * // Using raw expressions (database-specific)
1297
- * // MongoDB:
1298
- * query.groupBy("type", {
1299
- * count: { $sum: 1 },
1300
- * total: { $sum: "$duration" }
1301
- * });
1302
- *
1303
- * // SQL (future):
1304
- * query.groupBy("type", {
1305
- * count: "COUNT(*)",
1306
- * total: "SUM(duration)"
1307
- * });
1308
- * ```
1309
- */
1310
- groupBy(fields: GroupByInput, aggregates: Record<string, RawExpression>): this;
1311
- /**
1312
- * Apply raw grouping expressions.
1313
- *
1314
- * @example
1315
- * query.groupByRaw('DATE(createdAt)')
1316
- */
1317
- groupByRaw(expression: RawExpression, bindings?: unknown[]): this;
1318
- /**
1319
- * Apply having clause to aggregated results.
1320
- *
1321
- * @example
1322
- * query.groupBy('category').having('count', '>', 10)
1323
- */
1324
- having(field: string, value: unknown): this;
1325
- having(field: string, operator: WhereOperator, value: unknown): this;
1326
- having(condition: HavingInput): this;
1327
- /**
1328
- * Apply raw having clause to aggregated results.
1329
- *
1330
- * @example
1331
- * query.havingRaw('COUNT(*) > ?', [10])
1332
- */
1333
- havingRaw(expression: RawExpression, bindings?: unknown[]): this;
1334
- /**
1335
- * Join another table/collection using a structured payload.
1336
- *
1337
- * @example
1338
- * query.join({
1339
- * table: 'posts',
1340
- * localField: 'userId',
1341
- * foreignField: 'authorId',
1342
- * type: 'left'
1343
- * })
1344
- */
1345
- join(options: JoinOptions): this;
1346
- /**
1347
- * Add driver-specific raw modifications to the query.
1348
- *
1349
- * @example
1350
- * query.raw(nativeQuery => {
1351
- * // Modify native query object
1352
- * return nativeQuery;
1353
- * })
1354
- */
1355
- raw(builder: (native: unknown) => unknown): this;
1356
- /**
1357
- * Extend the query builder with driver-specific extensions.
1358
- *
1359
- * @example
1360
- * query.extend('mongoAggregation', { $match: { ... } })
1361
- */
1362
- extend<R>(extension: string, ...args: unknown[]): R;
1363
- /**
1364
- * Clone the current query builder instance.
1365
- *
1366
- * @example
1367
- * const baseQuery = User.query().where('isActive', true);
1368
- * const adminQuery = baseQuery.clone().where('role', 'admin');
1369
- */
1370
- clone(): this;
1371
- /**
1372
- * Tap into the query builder for debugging or side effects without
1373
- * breaking the fluent chain.
1374
- *
1375
- * @example
1376
- * query.where('age', '>', 18).tap(q => console.log(q.parse())).get()
1377
- */
1378
- tap(callback: (builder: this) => void): this;
1379
- /**
1380
- * Conditionally apply a callback to the query.
1381
- *
1382
- * @example
1383
- * query.when(searchTerm, (q, term) => q.whereLike('name', term))
1384
- */
1385
- when<V>(condition: V | boolean | (() => boolean), callback: (builder: this, value: V) => void, otherwise?: (builder: this) => void): this;
1386
- /**
1387
- * Execute the query and return all matching records.
1388
- *
1389
- * @example
1390
- * const users = await User.query().where('isActive', true).get();
1391
- */
1392
- get<Output = T>(): Promise<Output[]>;
1393
- /**
1394
- * Execute the query and return the first matching record.
1395
- *
1396
- * @example
1397
- * const user = await User.query().where('email', 'john@example.com').first();
1398
- */
1399
- first<Output = T>(): Promise<Output | null>;
1400
- /**
1401
- * Execute the query and return the first matching record or throw an error.
1402
- *
1403
- * @throws {Error} If no record is found
1404
- * @example
1405
- * const user = await User.query().where('id', 123).firstOrFail();
1406
- */
1407
- firstOrFail<Output = T>(): Promise<Output>;
1408
- /**
1409
- * Configure query to retrieve the last record.
1410
- *
1411
- * @example
1412
- * const lastUser = await User.query().last().first();
1413
- */
1414
- last<Output = T>(field?: string): Promise<Output | null>;
1415
- /**
1416
- * Count the records matching the query.
1417
- *
1418
- * @example
1419
- * const total = await User.query().where('isActive', true).count();
1420
- */
1421
- count(): Promise<number>;
1422
- /**
1423
- * Aggregate sum for the given field.
1424
- *
1425
- * @example
1426
- * const total = await Order.query().sum('amount');
1427
- */
1428
- sum(field: string): Promise<number>;
1429
- /**
1430
- * Aggregate average for the given field.
1431
- *
1432
- * @example
1433
- * const avgAge = await User.query().avg('age');
1434
- */
1435
- avg(field: string): Promise<number>;
1436
- /**
1437
- * Aggregate minimum for the given field.
1438
- *
1439
- * @example
1440
- * const minPrice = await Product.query().min('price');
1441
- */
1442
- min(field: string): Promise<number>;
1443
- /**
1444
- * Aggregate maximum for the given field.
1445
- *
1446
- * @example
1447
- * const maxPrice = await Product.query().max('price');
1448
- */
1449
- max(field: string): Promise<number>;
1450
- /**
1451
- * Retrieve distinct values for a field.
1452
- * @param field - The field to get distinct values from
1453
- * @returns an array of distinct values
1454
- *
1455
- * @example
1456
- * const categories = await Product.query().distinct('category');
1457
- */
1458
- distinct<T = unknown>(field: string): Promise<T[]>;
1459
- /**
1460
- * Retrieve a list of values for the given field.
1461
- *
1462
- * @example
1463
- * const names = await User.query().pluck('name');
1464
- */
1465
- pluck(field: string): Promise<unknown[]>;
1466
- /**
1467
- * Retrieve a single scalar value for the given field from the first record.
1468
- *
1469
- * @example
1470
- * const email = await User.query().where('id', 123).value('email');
1471
- */
1472
- value<T = unknown>(field: string): Promise<T | null>;
1473
- /**
1474
- * Determine if any record matches the current query.
1475
- *
1476
- * @example
1477
- * const hasActiveUsers = await User.query().where('isActive', true).exists();
1478
- */
1479
- exists(): Promise<boolean>;
1480
- /**
1481
- * Determine if no records match the current query.
1482
- *
1483
- * @example
1484
- * const noAdmins = await User.query().where('role', 'admin').doesntExist();
1485
- */
1486
- notExists(): Promise<boolean>;
1487
- /**
1488
- * Count distinct values for the given field.
1489
- *
1490
- * @example
1491
- * const uniqueCategories = await Product.query().countDistinct('category');
1492
- */
1493
- countDistinct(field: string): Promise<number>;
1494
- /**
1495
- * Increment a field's value by the given amount.
1496
- *
1497
- * @returns the new value
1498
- * @example
1499
- * await User.query().where('id', 123).increment('loginCount', 1);
1500
- */
1501
- increment(field: string, amount?: number): Promise<number>;
1502
- /**
1503
- * Decrement a field's value by the given amount.
1504
- *
1505
- * @returns the new value
1506
- * @example
1507
- * await Product.query().where('id', 456).decrement('stock', 5);
1508
- */
1509
- decrement(field: string, amount?: number): Promise<number>;
1510
- /**
1511
- * Increment a field's value by the given amount for all matching documents.
1512
- * @param field - The field to increment
1513
- * @param amount - The amount to increment by (default: 1)
1514
- * @returns the number of documents modified
1515
- */
1516
- incrementMany(field: string, amount?: number): Promise<number>;
1517
- /**
1518
- * Decrement a field's value by the given amount for all matching documents.
1519
- * @param field - The field to decrement
1520
- * @param amount - The amount to decrement by (default: 1)
1521
- * @returns the number of documents modified
1522
- */
1523
- decrementMany(field: string, amount?: number): Promise<number>;
1524
- /**
1525
- * Iterate through results in chunks, executing the callback for each chunk.
1526
- * Return false from the callback to stop iteration.
1527
- *
1528
- * @example
1529
- * await User.query().chunk(100, async (users, index) => {
1530
- * await processUsers(users);
1531
- * // Return false to stop
1532
- * });
1533
- */
1534
- chunk(size: number, callback: ChunkCallback<T>): Promise<void>;
1535
- /**
1536
- * Paginate the results with standard page/limit pagination.
1537
- *
1538
- * @example
1539
- * const result = await User.query().paginate({ page: 1, limit: 10 });
1540
- * // { data: [...], total: 100, page: 1, limit: 10, pages: 10 }
1541
- */
1542
- paginate(options: PaginationOptions): Promise<PaginationResult<T>>;
1543
- /**
1544
- * Paginate using cursor-based strategy for better performance.
1545
- *
1546
- * @example
1547
- * const result = await User.query().cursorPaginate({ limit: 10, cursor: lastId });
1548
- * // { data: [...], hasMore: true, nextCursor: '...' }
1549
- */
1550
- cursorPaginate(options: CursorPaginationOptions): Promise<CursorPaginationResult<T>>;
1551
- /**
1552
- * Return the driver-native query representation without executing it.
1553
- * SQL drivers populate `query` + `bindings`; MongoDB populates `pipeline`;
1554
- * exotic drivers use `native`.
1555
- *
1556
- * @example
1557
- * // PostgreSQL:
1558
- * const { query, bindings } = builder.parse();
1559
- * console.log(query, bindings);
1560
- *
1561
- * // MongoDB:
1562
- * const { pipeline } = builder.parse();
1563
- * console.log(pipeline); // [{ $match: { age: { $gt: 18 } } }, ...]
1564
- */
1565
- parse(): DriverQuery;
1566
- /**
1567
- * Returns a formatted string representation of the query pipeline | SQL string.
1568
- * @returns A formatted string representation of the pipeline|SQL string
1569
- */
1570
- pretty(): string;
1571
- /**
1572
- * Ask the underlying driver to explain the query execution plan.
1573
- *
1574
- * @example
1575
- * const plan = await query.explain();
1576
- */
1577
- explain(): Promise<unknown>;
1578
- /**
1579
- * Nearest-neighbour vector similarity search.
1580
- *
1581
- * Simultaneously:
1582
- * 1. Adds `1 - (column <=> $n::vector) AS score` to the SELECT clause
1583
- * so the similarity value is available on every returned row.
1584
- * 2. Adds `ORDER BY column <=> $n::vector` so the database can use
1585
- * the vector index (IVFFlat / HNSW) rather than doing a sequential scan.
1586
- *
1587
- * The two expressions MUST reference the same embedding literal so pgvector
1588
- * plans the nearest-neighbour scan correctly. Calling `.orderBy()` on the
1589
- * alias afterwards would break index usage.
1590
- *
1591
- * Drivers that do not support vector search (e.g. MongoDB without Atlas)
1592
- * should throw an `UnsupportedOperationError`.
1593
- *
1594
- * @param column - Name of the vector column (e.g. `"embedding"`)
1595
- * @param embedding - Query embedding as a plain number array
1596
- * @param alias - Alias for the similarity score column (default: `"score"`)
1597
- *
1598
- * @example
1599
- * ```typescript
1600
- * const results = await Vector.query()
1601
- * .where({ organization_id: "org-123", content_type: "summary" })
1602
- * .nearestTo("embedding", queryEmbedding)
1603
- * .limit(5)
1604
- * .get<VectorRow & { score: number }>();
1605
- * ```
1606
- */
1607
- nearestTo(column: string, embedding: number[], alias?: string): this;
1608
- }
1609
- //# sourceMappingURL=query-builder.contract.d.ts.map