@warlock.js/cascade 4.0.157 → 4.0.161

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,864 +0,0 @@
1
- import {PostgresDialect}from'./postgres-dialect.js';/**
2
- * PostgreSQL Query Parser
3
- *
4
- * Translates Cascade query operations into PostgreSQL SQL queries.
5
- * Mirrors the MongoQueryParser pattern but generates SQL instead
6
- * of MongoDB aggregation pipelines.
7
- *
8
- * @module cascade/drivers/postgres
9
- */
10
- /**
11
- * PostgreSQL Query Parser.
12
- *
13
- * Converts a list of query operations into a SQL query string with parameters.
14
- * Handles SELECT, WHERE, JOIN, ORDER BY, GROUP BY, LIMIT/OFFSET clauses.
15
- *
16
- * @example
17
- * ```typescript
18
- * const parser = new PostgresQueryParser({
19
- * table: 'users',
20
- * operations: [
21
- * { type: 'where', data: { field: 'name', operator: '=', value: 'Alice' } },
22
- * { type: 'orderBy', data: { field: 'createdAt', direction: 'desc' } },
23
- * { type: 'limit', data: { value: 10 } }
24
- * ]
25
- * });
26
- *
27
- * const { sql, params } = parser.parse();
28
- * // sql: 'SELECT * FROM "users" WHERE "name" = $1 ORDER BY "createdAt" DESC LIMIT 10'
29
- * // params: ['Alice']
30
- * ```
31
- */
32
- class PostgresQueryParser {
33
- /**
34
- * Target table name.
35
- */
36
- table;
37
- /**
38
- * Table alias.
39
- */
40
- alias;
41
- /**
42
- * Operations to process.
43
- */
44
- operations;
45
- /**
46
- * SQL dialect for syntax.
47
- */
48
- dialect;
49
- /**
50
- * Current parameter index (1-based for PostgreSQL).
51
- */
52
- paramIndex = 1;
53
- /**
54
- * Collected parameters.
55
- */
56
- params = [];
57
- /**
58
- * SELECT columns.
59
- */
60
- selectColumns = [];
61
- /**
62
- * Deselected (excluded) columns.
63
- */
64
- deselectColumns = [];
65
- /**
66
- * Raw SELECT expressions.
67
- */
68
- selectRaw = [];
69
- /**
70
- * WHERE clauses.
71
- */
72
- whereClauses = [];
73
- /**
74
- * JOIN clauses.
75
- */
76
- joinClauses = [];
77
- /**
78
- * ORDER BY clauses.
79
- */
80
- orderClauses = [];
81
- /**
82
- * GROUP BY columns.
83
- */
84
- groupColumns = [];
85
- /**
86
- * HAVING clauses.
87
- */
88
- havingClauses = [];
89
- /**
90
- * LIMIT value.
91
- */
92
- limitValue;
93
- /**
94
- * OFFSET value.
95
- */
96
- offsetValue;
97
- /**
98
- * DISTINCT flag.
99
- */
100
- isDistinct = false;
101
- /**
102
- * Whether the query has any JOIN operations (pre-scanned before processing).
103
- * Used by qualifyColumn() to decide whether to prefix columns with the main table.
104
- */
105
- hasJoins = false;
106
- /**
107
- * Tracked joined tables (for table reference detection).
108
- */
109
- joinedTables = new Set();
110
- /**
111
- * Create a new query parser.
112
- *
113
- * @param options - Parser configuration
114
- */
115
- constructor(options) {
116
- this.table = options.table;
117
- this.alias = options.alias;
118
- this.operations = options.operations;
119
- this.dialect = options.dialect ?? new PostgresDialect();
120
- }
121
- /**
122
- * Parse all operations and build the SQL query.
123
- *
124
- * @returns DriverQuery with `query` (SQL string) and `bindings` (parameter values)
125
- */
126
- parse() {
127
- // Pre-scan for any join operations so qualifyColumn() can prefix columns
128
- // correctly even when WHERE clauses appear before JOINs in the operations list.
129
- const JOIN_TYPES = new Set([
130
- "join",
131
- "leftJoin",
132
- "rightJoin",
133
- "innerJoin",
134
- "fullJoin",
135
- "crossJoin",
136
- "joinRaw",
137
- ]);
138
- this.hasJoins = false;
139
- // First pass: locate all joins and populate joinedTables for accurate JSON path detection
140
- for (const operation of this.operations) {
141
- if (JOIN_TYPES.has(operation.type)) {
142
- this.hasJoins = true;
143
- const data = operation.data;
144
- const joinTable = data.table;
145
- const alias = data.alias;
146
- if (joinTable)
147
- this.joinedTables.add(joinTable);
148
- if (alias)
149
- this.joinedTables.add(alias);
150
- }
151
- }
152
- // Process each operation
153
- for (const operation of this.operations) {
154
- this.processOperation(operation);
155
- }
156
- // Build the final SQL query
157
- const query = this.buildSql();
158
- return { query, bindings: this.params };
159
- }
160
- /**
161
- * Get a formatted string representation of the query.
162
- *
163
- * @returns Formatted SQL with bindings
164
- */
165
- toPrettyString() {
166
- const { query = "", bindings } = this.parse();
167
- return `${query}\n-- Bindings: ${JSON.stringify(bindings ?? [])}`;
168
- }
169
- /**
170
- * Process a single operation.
171
- *
172
- * @param operation - The operation to process
173
- */
174
- processOperation(operation) {
175
- const { type, data } = operation;
176
- switch (type) {
177
- // WHERE operations
178
- case "where":
179
- this.processWhere(data, "AND");
180
- break;
181
- case "orWhere":
182
- this.processWhere(data, "OR");
183
- break;
184
- case "whereRaw":
185
- this.processWhereRaw(data, "AND");
186
- break;
187
- case "orWhereRaw":
188
- this.processWhereRaw(data, "OR");
189
- break;
190
- case "whereIn":
191
- this.processWhereIn(data, false);
192
- break;
193
- case "whereNotIn":
194
- this.processWhereIn(data, true);
195
- break;
196
- case "whereNull":
197
- this.processWhereNull(data, false);
198
- break;
199
- case "whereNotNull":
200
- this.processWhereNull(data, true);
201
- break;
202
- case "whereBetween":
203
- this.processWhereBetween(data, false);
204
- break;
205
- case "whereNotBetween":
206
- this.processWhereBetween(data, true);
207
- break;
208
- case "whereLike":
209
- this.processWhereLike(data, false);
210
- break;
211
- case "whereNotLike":
212
- this.processWhereLike(data, true);
213
- break;
214
- case "whereColumn":
215
- this.processWhereColumn(data, "AND");
216
- break;
217
- case "orWhereColumn":
218
- this.processWhereColumn(data, "OR");
219
- break;
220
- case "whereJsonContains":
221
- this.processWhereJsonContains(data, false);
222
- break;
223
- case "whereJsonDoesntContain":
224
- this.processWhereJsonContains(data, true);
225
- break;
226
- case "whereFullText":
227
- this.processWhereFullText(data);
228
- break;
229
- // SELECT operations
230
- case "select":
231
- this.processSelect(data);
232
- break;
233
- case "selectRaw":
234
- this.processSelectRaw(data);
235
- break;
236
- case "deselect":
237
- this.processDeselect(data);
238
- break;
239
- // JOIN operations
240
- case "join":
241
- case "innerJoin":
242
- this.processJoin(data, "INNER");
243
- break;
244
- case "leftJoin":
245
- this.processJoin(data, "LEFT");
246
- break;
247
- case "rightJoin":
248
- this.processJoin(data, "RIGHT");
249
- break;
250
- case "fullJoin":
251
- this.processJoin(data, "FULL OUTER");
252
- break;
253
- case "crossJoin":
254
- this.processCrossJoin(data);
255
- break;
256
- case "joinRaw":
257
- this.processJoinRaw(data);
258
- break;
259
- // ORDER operations
260
- case "orderBy":
261
- this.processOrderBy(data);
262
- break;
263
- case "orderByRaw":
264
- this.processOrderByRaw(data);
265
- break;
266
- // GROUP operations
267
- case "groupBy":
268
- this.processGroupBy(data);
269
- break;
270
- case "having":
271
- this.processHaving(data);
272
- break;
273
- case "havingRaw":
274
- this.processHavingRaw(data);
275
- break;
276
- // LIMIT operations
277
- case "limit":
278
- this.limitValue = data.value;
279
- break;
280
- case "offset":
281
- this.offsetValue = data.value;
282
- break;
283
- // Other
284
- case "distinct":
285
- this.isDistinct = true;
286
- break;
287
- // joinWith select related columns
288
- case "selectRelatedColumns":
289
- this.processSelectRelatedColumns(data);
290
- break;
291
- }
292
- }
293
- /**
294
- * Build the final SQL query from collected clauses.
295
- *
296
- * @returns Complete SQL query string
297
- */
298
- buildSql() {
299
- const parts = [];
300
- // SELECT clause
301
- parts.push(this.buildSelectClause());
302
- // FROM clause
303
- const quotedTable = this.dialect.quoteIdentifier(this.table);
304
- const fromClause = this.alias
305
- ? `FROM ${quotedTable} AS ${this.dialect.quoteIdentifier(this.alias)}`
306
- : `FROM ${quotedTable}`;
307
- parts.push(fromClause);
308
- // JOIN clauses
309
- if (this.joinClauses.length > 0) {
310
- parts.push(this.joinClauses.join(" "));
311
- }
312
- // WHERE clause
313
- if (this.whereClauses.length > 0) {
314
- parts.push(`WHERE ${this.whereClauses.join(" ")}`);
315
- }
316
- // GROUP BY clause
317
- if (this.groupColumns.length > 0) {
318
- const quotedCols = this.groupColumns.map((c) => this.dialect.quoteIdentifier(c));
319
- parts.push(`GROUP BY ${quotedCols.join(", ")}`);
320
- }
321
- // HAVING clause
322
- if (this.havingClauses.length > 0) {
323
- parts.push(`HAVING ${this.havingClauses.join(" AND ")}`);
324
- }
325
- // ORDER BY clause
326
- if (this.orderClauses.length > 0) {
327
- parts.push(`ORDER BY ${this.orderClauses.join(", ")}`);
328
- }
329
- // LIMIT/OFFSET
330
- const limitOffset = this.dialect.limitOffset(this.limitValue, this.offsetValue);
331
- if (limitOffset) {
332
- parts.push(limitOffset);
333
- }
334
- return parts.join(" ");
335
- }
336
- /**
337
- * Build the SELECT clause.
338
- *
339
- * @returns SELECT clause string
340
- */
341
- buildSelectClause() {
342
- const distinct = this.isDistinct ? "DISTINCT " : "";
343
- // If no specific columns, select all — qualify with main table when joins present
344
- if (this.selectColumns.length === 0 && this.selectRaw.length === 0) {
345
- return this.hasJoins
346
- ? `SELECT ${distinct}${this.dialect.quoteIdentifier(this.table)}.*`
347
- : `SELECT ${distinct}*`;
348
- }
349
- const columns = [];
350
- // Add selected columns — prefix with main table when joins present to avoid ambiguity
351
- for (const col of this.selectColumns) {
352
- if (!this.deselectColumns.includes(col)) {
353
- columns.push(this.parseColumnIdentifier(col, this.table, this.alias));
354
- }
355
- }
356
- // Add raw expressions
357
- columns.push(...this.selectRaw);
358
- return `SELECT ${distinct}${columns.join(", ")}`;
359
- }
360
- /**
361
- * Add a placeholder and parameter.
362
- *
363
- * @param value - Parameter value
364
- * @returns Placeholder string ($1, $2, etc.)
365
- */
366
- addParam(value) {
367
- this.params.push(value);
368
- return this.dialect.placeholder(this.paramIndex++);
369
- }
370
- /**
371
- * Process a basic WHERE operation.
372
- *
373
- * Delegates to specialised processors for operators that require more than a
374
- * single placeholder (between, in, like-variants, exists, etc.).
375
- */
376
- processWhere(data, boolean) {
377
- const field = data.field;
378
- const operator = data.operator ?? "=";
379
- const value = data.value;
380
- // Delegate to specialised processors for operators that need it
381
- switch (operator) {
382
- case "between":
383
- return this.processWhereBetween({ field, range: value }, false);
384
- case "notBetween":
385
- return this.processWhereBetween({ field, range: value }, true);
386
- case "in":
387
- return this.processWhereIn({ field, values: value }, false);
388
- case "notIn":
389
- return this.processWhereIn({ field, values: value }, true);
390
- case "like":
391
- case "ilike":
392
- case "startsWith":
393
- case "endsWith":
394
- return this.processWhereLike({ field, pattern: value }, false);
395
- case "notLike":
396
- case "notStartsWith":
397
- case "notEndsWith":
398
- return this.processWhereLike({ field, pattern: value }, true);
399
- case "exists":
400
- // EXISTS expects value to be a raw sub-query string
401
- return this.addWhereClause(`EXISTS (${value})`, boolean);
402
- }
403
- // Simple single-value operator — fall through to generic path
404
- const quotedField = this.parseColumnIdentifier(field, this.table, this.alias);
405
- const placeholder = this.addParam(value);
406
- this.addWhereClause(`${quotedField} ${this.mapOperator(operator)} ${placeholder}`, boolean);
407
- }
408
- /**
409
- * Process a raw WHERE operation.
410
- */
411
- processWhereRaw(data, boolean) {
412
- const expression = data.expression;
413
- const bindings = data.bindings ?? [];
414
- // Replace ? placeholders with $n
415
- let processed = expression;
416
- for (const binding of bindings) {
417
- processed = processed.replace("?", this.addParam(binding));
418
- }
419
- this.addWhereClause(processed, boolean);
420
- }
421
- /**
422
- * Process WHERE IN / NOT IN.
423
- */
424
- processWhereIn(data, negate) {
425
- const field = data.field;
426
- const values = data.values;
427
- const quotedField = this.parseColumnIdentifier(field, this.table, this.alias);
428
- const operator = negate ? "!= ALL" : "= ANY";
429
- const placeholder = this.addParam(values);
430
- this.addWhereClause(`${quotedField} ${operator}(${placeholder})`, "AND");
431
- }
432
- /**
433
- * Process WHERE NULL / NOT NULL.
434
- */
435
- processWhereNull(data, negate) {
436
- const field = data.field;
437
- const quotedField = this.parseColumnIdentifier(field, this.table, this.alias);
438
- const clause = negate ? `${quotedField} IS NOT NULL` : `${quotedField} IS NULL`;
439
- this.addWhereClause(clause, "AND");
440
- }
441
- /**
442
- * Process WHERE BETWEEN / NOT BETWEEN.
443
- */
444
- processWhereBetween(data, negate) {
445
- const field = data.field;
446
- const range = data.range;
447
- const quotedField = this.parseColumnIdentifier(field, this.table, this.alias);
448
- const placeholder1 = this.addParam(range[0]);
449
- const placeholder2 = this.addParam(range[1]);
450
- const keyword = negate ? "NOT BETWEEN" : "BETWEEN";
451
- this.addWhereClause(`${quotedField} ${keyword} ${placeholder1} AND ${placeholder2}`, "AND");
452
- }
453
- /**
454
- * Process WHERE LIKE / NOT LIKE.
455
- */
456
- processWhereLike(data, negate) {
457
- const field = data.field;
458
- const pattern = data.pattern;
459
- const quotedField = this.parseColumnIdentifier(field, this.table, this.alias);
460
- const { operator } = this.dialect.likePattern(pattern, true);
461
- const placeholder = this.addParam(pattern);
462
- const keyword = negate ? `NOT ${operator}` : operator;
463
- this.addWhereClause(`${quotedField} ${keyword} ${placeholder}`, "AND");
464
- }
465
- /**
466
- * Process WHERE column comparison.
467
- */
468
- processWhereColumn(data, boolean) {
469
- const first = data.first;
470
- const operator = data.operator ?? "=";
471
- const second = data.second;
472
- // Both sides may need qualification if unambiguous table is unclear
473
- const quotedFirst = this.parseColumnIdentifier(first, this.table, this.alias);
474
- const quotedSecond = this.parseColumnIdentifier(second, this.table, this.alias);
475
- this.addWhereClause(`${quotedFirst} ${operator} ${quotedSecond}`, boolean);
476
- }
477
- /**
478
- * Process WHERE JSON contains.
479
- */
480
- processWhereJsonContains(data, negate) {
481
- const path = data.path;
482
- const value = data.value;
483
- const quotedPath = this.parseColumnIdentifier(path, this.table, this.alias);
484
- const jsonValue = JSON.stringify(value);
485
- const operator = negate ? "NOT @>" : "@>";
486
- this.addWhereClause(`${quotedPath} ${operator} '${jsonValue}'::jsonb`, "AND");
487
- }
488
- /**
489
- * Process full-text search WHERE.
490
- */
491
- processWhereFullText(data) {
492
- const fields = data.fields;
493
- const query = data.query;
494
- // Build tsvector from fields
495
- const tsVectors = fields
496
- .map((f) => `to_tsvector('english', ${this.dialect.quoteIdentifier(f)})`)
497
- .join(" || ");
498
- const placeholder = this.addParam(query);
499
- this.addWhereClause(`(${tsVectors}) @@ plainto_tsquery('english', ${placeholder})`, "AND");
500
- }
501
- /**
502
- * Process SELECT operation.
503
- */
504
- processSelect(data) {
505
- const fields = data.fields;
506
- if (Array.isArray(fields)) {
507
- this.selectColumns.push(...fields);
508
- }
509
- else {
510
- // Handle aliases: { field: 'alias' }
511
- for (const [field, alias] of Object.entries(fields)) {
512
- const quotedField = this.dialect.quoteIdentifier(field);
513
- const quotedAlias = this.dialect.quoteIdentifier(alias);
514
- this.selectRaw.push(`${quotedField} AS ${quotedAlias}`);
515
- }
516
- }
517
- }
518
- /**
519
- * Process raw SELECT expression.
520
- */
521
- processSelectRaw(data) {
522
- const expression = data.expression;
523
- const bindings = data.bindings ?? [];
524
- if (typeof expression === "string") {
525
- // Replace ? placeholders with $n positional params (same as processWhereRaw)
526
- let processed = expression;
527
- for (const binding of bindings) {
528
- processed = processed.replace("?", this.addParam(binding));
529
- }
530
- this.selectRaw.push(processed);
531
- }
532
- else {
533
- // Handle object expressions (for compatibility)
534
- for (const [alias, expr] of Object.entries(expression)) {
535
- this.selectRaw.push(`${expr} AS ${this.dialect.quoteIdentifier(alias)}`);
536
- }
537
- }
538
- }
539
- /**
540
- * Process DESELECT operation.
541
- */
542
- processDeselect(data) {
543
- const fields = data.fields;
544
- this.deselectColumns.push(...fields);
545
- }
546
- /**
547
- * Process SELECT for related columns (joinWith).
548
- *
549
- * - hasOne / belongsTo → LEFT JOIN + row_to_json (single object)
550
- * - hasMany → correlated subquery with json_agg (array, no row explosion)
551
- *
552
- * @example hasMany correlated subquery:
553
- * (SELECT json_agg(row_to_json(a.*))
554
- * FROM "chat_message_actions" a
555
- * WHERE a."chat_message_id" = "chat_messages"."id") AS "actions"
556
- *
557
- * @example hasOne/belongsTo row_to_json:
558
- * row_to_json("organizationAiModel".*) AS "organizationAiModel"
559
- */
560
- processSelectRelatedColumns(data) {
561
- const alias = data.alias;
562
- const select = data.select;
563
- const relationType = data.type;
564
- const constraintOps = data.constraintOps;
565
- const quotedAlias = this.dialect.quoteIdentifier(alias);
566
- const quotedTable = this.dialect.quoteIdentifier(this.table);
567
- if (relationType === "hasMany") {
568
- // Correlated subquery — no JOIN, no row explosion, returns a JSON array.
569
- const relatedTable = data.table;
570
- const foreignKey = data.foreignKey;
571
- const localKey = data.localKey;
572
- const quotedRelatedTable = this.dialect.quoteIdentifier(relatedTable);
573
- const quotedForeignKey = this.dialect.quoteIdentifier(foreignKey);
574
- const quotedLocalKey = this.dialect.quoteIdentifier(localKey);
575
- const quotedMainTable = this.dialect.quoteIdentifier(this.table);
576
- let innerSelect;
577
- if (select && select.length > 0) {
578
- // Pick specific columns: json_agg(json_build_object('id', a."id", ...))
579
- const fields = select
580
- .map((col) => `'${col}', a.${this.dialect.quoteIdentifier(col)}`)
581
- .join(", ");
582
- innerSelect = `json_agg(json_build_object(${fields}))`;
583
- }
584
- else {
585
- innerSelect = `json_agg(row_to_json(a.*))`;
586
- }
587
- // Build the base FK condition
588
- const fkCondition = `a.${quotedForeignKey} = ${quotedMainTable}.${quotedLocalKey}`;
589
- // Merge constraint ops (where / order / limit) from a sub-parser
590
- let extraWhere = "";
591
- let orderBy = "";
592
- let limitClause = "";
593
- if (constraintOps && constraintOps.length > 0) {
594
- const subParser = new PostgresQueryParser({
595
- table: relatedTable,
596
- alias: "a",
597
- operations: constraintOps,
598
- });
599
- subParser.parse();
600
- if (subParser.whereClauses.length > 0) {
601
- extraWhere = ` AND ${subParser.whereClauses.join(" ")}`;
602
- }
603
- if (subParser.orderClauses.length > 0) {
604
- orderBy = ` ORDER BY ${subParser.orderClauses.join(", ")}`;
605
- }
606
- if (subParser.limitValue !== undefined) {
607
- limitClause = ` LIMIT ${subParser.limitValue}`;
608
- }
609
- }
610
- // Wrap with ORDER/LIMIT only when constraints are present (json_agg ignores ORDER)
611
- orderBy || limitClause
612
- ? `SELECT row_to_json(sub.*) FROM (SELECT * FROM ${quotedRelatedTable} a WHERE ${fkCondition}${extraWhere}${orderBy}${limitClause}) sub`
613
- : `SELECT ${innerSelect.replace("json_agg(", "").replace(/\)$/, "")} FROM ${quotedRelatedTable} a WHERE ${fkCondition}${extraWhere}`;
614
- const aggregated = orderBy || limitClause
615
- ? `(SELECT json_agg(row_to_json(sub.*)) FROM (SELECT * FROM ${quotedRelatedTable} a WHERE ${fkCondition}${extraWhere}${orderBy}${limitClause}) sub) AS ${quotedAlias}`
616
- : `(SELECT ${innerSelect} FROM ${quotedRelatedTable} a WHERE ${fkCondition}${extraWhere}) AS ${quotedAlias}`;
617
- this.selectRaw.push(aggregated);
618
- }
619
- else {
620
- // hasOne / belongsTo — single object via LEFT JOIN + row_to_json.
621
- const hasExplicitSelect = this.selectColumns.length > 0;
622
- if (!hasExplicitSelect && !this.selectRaw.includes(`${quotedTable}.*`)) {
623
- this.selectRaw.unshift(`${quotedTable}.*`);
624
- }
625
- // If constraint provides an explicit select list, prefer it over data.select
626
- let effectiveSelect = select;
627
- if (constraintOps && constraintOps.length > 0) {
628
- const subParser = new PostgresQueryParser({
629
- table: data.table ?? alias,
630
- alias,
631
- operations: constraintOps,
632
- });
633
- subParser.parse();
634
- if (subParser.selectColumns.length > 0) {
635
- effectiveSelect = subParser.selectColumns;
636
- }
637
- }
638
- if (effectiveSelect && effectiveSelect.length > 0) {
639
- const selectedColumns = effectiveSelect
640
- .map((col) => `${quotedAlias}.${this.dialect.quoteIdentifier(col)}`)
641
- .join(", ");
642
- this.selectRaw.push(`row_to_json((SELECT d FROM (SELECT ${selectedColumns}) d)) AS ${quotedAlias}`);
643
- }
644
- else {
645
- this.selectRaw.push(`row_to_json(${quotedAlias}.*) AS ${quotedAlias}`);
646
- }
647
- }
648
- }
649
- /**
650
- * Process JOIN operation with smart field detection.
651
- *
652
- * Handles both regular columns and JSONB nested paths:
653
- * - "id" → "table"."id" (auto-prefixed)
654
- * - "users.id" → "users"."id" (explicit table)
655
- * - "createdBy.id" → "table"."createdBy"->>'id' (JSONB path)
656
- * - "posts.createdBy.id" → "posts"."createdBy"->>'id' (JSONB with table)
657
- */
658
- processJoin(data, type) {
659
- const options = data;
660
- const joinTable = "table" in options ? options.table : "";
661
- const localField = "localField" in options ? options.localField : "";
662
- const foreignField = "foreignField" in options ? options.foreignField : "";
663
- const alias = "alias" in options ? options.alias : undefined;
664
- const quotedTable = this.dialect.quoteIdentifier(joinTable);
665
- const tableRef = alias
666
- ? `${quotedTable} AS ${this.dialect.quoteIdentifier(alias)}`
667
- : quotedTable;
668
- const tableAlias = alias ?? joinTable;
669
- // Track the joined table for reference detection
670
- this.joinedTables.add(joinTable);
671
- if (alias) {
672
- this.joinedTables.add(alias);
673
- }
674
- // Parse local field (belongs to main table)
675
- const quotedLocal = this.parseColumnIdentifier(localField, this.table, this.alias);
676
- // Parse foreign field (belongs to join table)
677
- const quotedForeign = this.parseColumnIdentifier(foreignField, joinTable, tableAlias);
678
- this.joinClauses.push(`${type} JOIN ${tableRef} ON ${quotedLocal} = ${quotedForeign}`);
679
- }
680
- /**
681
- * Parse a column identifier with smart detection for table prefixes and JSONB paths.
682
- *
683
- * @param field - The field string (e.g., "id", "users.id", "createdBy.id")
684
- * @param defaultTable - Default table to use if no prefix
685
- * @param tableAlias - Table alias to use if provided
686
- * @returns Properly quoted SQL expression
687
- */
688
- parseColumnIdentifier(field, defaultTable, tableAlias) {
689
- if (!field)
690
- return "";
691
- const effectiveTable = tableAlias ?? defaultTable;
692
- const parts = field.split(".");
693
- // Single part: just a column name, prefix with default table
694
- if (parts.length === 1) {
695
- return `${this.dialect.quoteIdentifier(effectiveTable)}.${this.dialect.quoteIdentifier(field)}`;
696
- }
697
- // Two parts: could be "table.column" or "jsonbColumn.key"
698
- if (parts.length === 2) {
699
- const [first, second] = parts;
700
- // Check if first part is a known table (main table, join table, or alias)
701
- if (this.isTableReference(first)) {
702
- // It's table.column - regular column reference
703
- return `${this.dialect.quoteIdentifier(first)}.${this.dialect.quoteIdentifier(second)}`;
704
- }
705
- // It's jsonbColumn.key - JSONB path
706
- return this.buildJsonbPath(effectiveTable, first, [second]);
707
- }
708
- // Three or more parts: "table.jsonbColumn.key..." or "jsonbColumn.key1.key2..."
709
- const [first, second, ...rest] = parts;
710
- if (this.isTableReference(first)) {
711
- // First part is table: "posts.createdBy.id" → table is "posts", JSONB is "createdBy.id"
712
- return this.buildJsonbPath(first, second, rest);
713
- }
714
- // No table prefix: "createdBy.address.city" → use default table
715
- return this.buildJsonbPath(effectiveTable, first, [second, ...rest]);
716
- }
717
- /**
718
- * Check if a string is a table reference (main table or join table).
719
- */
720
- isTableReference(name) {
721
- if (name === this.table || name === this.alias) {
722
- return true;
723
- }
724
- if (this.joinedTables.has(name)) {
725
- return true;
726
- }
727
- return false;
728
- }
729
- /**
730
- * Build a JSONB path expression.
731
- *
732
- * @param table - Table name
733
- * @param column - JSONB column name
734
- * @param path - Array of nested keys
735
- * @returns PostgreSQL JSONB path expression
736
- *
737
- * @example
738
- * buildJsonbPath("posts", "createdBy", ["id"])
739
- * // Returns: ("posts"."createdBy"->>'id')::integer
740
- *
741
- * buildJsonbPath("posts", "createdBy", ["address", "city"])
742
- * // Returns: "posts"."createdBy"->'address'->>'city'
743
- */
744
- buildJsonbPath(table, column, path) {
745
- const quotedTable = this.dialect.quoteIdentifier(table);
746
- const quotedColumn = this.dialect.quoteIdentifier(column);
747
- if (path.length === 0) {
748
- return `${quotedTable}.${quotedColumn}`;
749
- }
750
- // Build JSONB path: use -> for intermediate keys, ->> for final key (returns text)
751
- let expression = `${quotedTable}.${quotedColumn}`;
752
- for (let i = 0; i < path.length; i++) {
753
- const isLast = i === path.length - 1;
754
- const operator = isLast ? "->>" : "->";
755
- expression += `${operator}'${path[i]}'`;
756
- }
757
- // Cast to integer if the path ends with 'id' (common pattern for foreign keys)
758
- const lastKey = path[path.length - 1].toLowerCase();
759
- if (lastKey === "id" || lastKey.endsWith("id")) {
760
- expression = `(${expression})::integer`;
761
- }
762
- return expression;
763
- }
764
- /**
765
- * Process CROSS JOIN operation.
766
- */
767
- processCrossJoin(data) {
768
- const table = data.table;
769
- const quotedTable = this.dialect.quoteIdentifier(table);
770
- this.joinClauses.push(`CROSS JOIN ${quotedTable}`);
771
- }
772
- /**
773
- * Process raw JOIN expression.
774
- */
775
- processJoinRaw(data) {
776
- const expression = data.expression;
777
- const bindings = data.bindings ?? [];
778
- let processed = expression;
779
- for (const binding of bindings) {
780
- processed = processed.replace("?", this.addParam(binding));
781
- }
782
- this.joinClauses.push(processed);
783
- }
784
- /**
785
- * Process ORDER BY operation.
786
- */
787
- processOrderBy(data) {
788
- const field = data.field;
789
- const direction = (data.direction ?? "asc").toUpperCase();
790
- const quotedField = this.parseColumnIdentifier(field, this.table, this.alias);
791
- this.orderClauses.push(`${quotedField} ${direction}`);
792
- }
793
- /**
794
- * Process raw ORDER BY expression.
795
- */
796
- processOrderByRaw(data) {
797
- const expression = data.expression;
798
- const bindings = data.bindings ?? [];
799
- // Replace ? placeholders with $n positional params (same as processWhereRaw)
800
- let processed = expression;
801
- for (const binding of bindings) {
802
- processed = processed.replace("?", this.addParam(binding));
803
- }
804
- this.orderClauses.push(processed);
805
- }
806
- /**
807
- * Process GROUP BY operation.
808
- */
809
- processGroupBy(data) {
810
- const fields = data.fields;
811
- const columns = Array.isArray(fields) ? fields : [fields];
812
- this.groupColumns.push(...columns);
813
- }
814
- /**
815
- * Process HAVING operation.
816
- */
817
- processHaving(data) {
818
- const field = data.field;
819
- const operator = data.operator ?? "=";
820
- const value = data.value;
821
- const quotedField = this.dialect.quoteIdentifier(field);
822
- const placeholder = this.addParam(value);
823
- this.havingClauses.push(`${quotedField} ${operator} ${placeholder}`);
824
- }
825
- /**
826
- * Process raw HAVING expression.
827
- */
828
- processHavingRaw(data) {
829
- const expression = data.expression;
830
- this.havingClauses.push(expression);
831
- }
832
- /**
833
- * Add a WHERE clause with boolean operator.
834
- */
835
- addWhereClause(clause, boolean) {
836
- if (this.whereClauses.length === 0) {
837
- this.whereClauses.push(clause);
838
- }
839
- else {
840
- this.whereClauses.push(`${boolean} ${clause}`);
841
- }
842
- }
843
- /**
844
- * Map simple Cascade operators to their SQL equivalents.
845
- *
846
- * Complex operators (between, in, like-variants, exists) are handled by
847
- * dedicated processors and should never reach this method.
848
- */
849
- mapOperator(operator) {
850
- const mapping = {
851
- "=": "=",
852
- "!=": "!=",
853
- "<>": "<>",
854
- ">": ">",
855
- ">=": ">=",
856
- "<": "<",
857
- "<=": "<=",
858
- like: "LIKE",
859
- notlike: "NOT LIKE",
860
- ilike: "ILIKE",
861
- };
862
- return mapping[operator.toLowerCase()] ?? operator;
863
- }
864
- }export{PostgresQueryParser};//# sourceMappingURL=postgres-query-parser.js.map