@warlock.js/cascade 4.0.171 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1050) hide show
  1. package/README.md +6 -5
  2. package/bin/cascadejs +3 -0
  3. package/esm/cli/commands/migrate-export-sql.mjs +48 -0
  4. package/esm/cli/commands/migrate-export-sql.mjs.map +1 -0
  5. package/esm/cli/commands/migrate-list.mjs +26 -0
  6. package/esm/cli/commands/migrate-list.mjs.map +1 -0
  7. package/esm/cli/commands/migrate-rollback.mjs +50 -0
  8. package/esm/cli/commands/migrate-rollback.mjs.map +1 -0
  9. package/esm/cli/commands/migrate.mjs +65 -0
  10. package/esm/cli/commands/migrate.mjs.map +1 -0
  11. package/esm/cli/connection-from-env.mjs +181 -0
  12. package/esm/cli/connection-from-env.mjs.map +1 -0
  13. package/esm/cli/index.mjs +31 -0
  14. package/esm/cli/index.mjs.map +1 -0
  15. package/esm/cli/load-migrations.mjs +78 -0
  16. package/esm/cli/load-migrations.mjs.map +1 -0
  17. package/esm/cli/printers.mjs +57 -0
  18. package/esm/cli/printers.mjs.map +1 -0
  19. package/esm/cli/setup-logger.mjs +30 -0
  20. package/esm/cli/setup-logger.mjs.map +1 -0
  21. package/esm/cli/with-cli-connection.mjs +39 -0
  22. package/esm/cli/with-cli-connection.mjs.map +1 -0
  23. package/esm/cli.d.mts +1 -0
  24. package/esm/cli.mjs +26 -0
  25. package/esm/cli.mjs.map +1 -0
  26. package/esm/context/database-data-source-context.d.mts +32 -0
  27. package/esm/context/database-data-source-context.d.mts.map +1 -0
  28. package/esm/context/database-data-source-context.mjs +35 -0
  29. package/esm/context/database-data-source-context.mjs.map +1 -0
  30. package/esm/context/database-transaction-context.d.mts +38 -0
  31. package/esm/context/database-transaction-context.d.mts.map +1 -0
  32. package/esm/context/database-transaction-context.mjs +47 -0
  33. package/esm/context/database-transaction-context.mjs.map +1 -0
  34. package/esm/contracts/database-driver.contract.d.mts +443 -0
  35. package/esm/contracts/database-driver.contract.d.mts.map +1 -0
  36. package/esm/contracts/database-id-generator.contract.d.mts +109 -0
  37. package/esm/contracts/database-id-generator.contract.d.mts.map +1 -0
  38. package/esm/contracts/database-remover.contract.d.mts +108 -0
  39. package/esm/contracts/database-remover.contract.d.mts.map +1 -0
  40. package/esm/contracts/database-restorer.contract.d.mts +145 -0
  41. package/esm/contracts/database-restorer.contract.d.mts.map +1 -0
  42. package/esm/contracts/database-writer.contract.d.mts +123 -0
  43. package/esm/contracts/database-writer.contract.d.mts.map +1 -0
  44. package/esm/contracts/driver-blueprint.contract.d.mts +52 -0
  45. package/esm/contracts/driver-blueprint.contract.d.mts.map +1 -0
  46. package/esm/contracts/index.d.mts +9 -0
  47. package/esm/contracts/migration-driver.contract.d.mts +476 -0
  48. package/esm/contracts/migration-driver.contract.d.mts.map +1 -0
  49. package/esm/contracts/query-builder.contract.d.mts +1663 -0
  50. package/esm/contracts/query-builder.contract.d.mts.map +1 -0
  51. package/esm/contracts/sync-adapter.contract.d.mts +49 -0
  52. package/esm/contracts/sync-adapter.contract.d.mts.map +1 -0
  53. package/esm/data-source/data-source-registry.d.mts +111 -0
  54. package/esm/data-source/data-source-registry.d.mts.map +1 -0
  55. package/esm/data-source/data-source-registry.mjs +142 -0
  56. package/esm/data-source/data-source-registry.mjs.map +1 -0
  57. package/esm/data-source/data-source.d.mts +160 -0
  58. package/esm/data-source/data-source.d.mts.map +1 -0
  59. package/esm/data-source/data-source.mjs +87 -0
  60. package/esm/data-source/data-source.mjs.map +1 -0
  61. package/esm/database-dirty-tracker.d.mts +254 -0
  62. package/esm/database-dirty-tracker.d.mts.map +1 -0
  63. package/esm/database-dirty-tracker.mjs +356 -0
  64. package/esm/database-dirty-tracker.mjs.map +1 -0
  65. package/esm/drivers/mongodb/mongodb-blueprint.mjs +54 -0
  66. package/esm/drivers/mongodb/mongodb-blueprint.mjs.map +1 -0
  67. package/esm/drivers/mongodb/mongodb-driver.d.mts +334 -0
  68. package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -0
  69. package/esm/drivers/mongodb/mongodb-driver.mjs +716 -0
  70. package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -0
  71. package/esm/drivers/mongodb/mongodb-id-generator.d.mts +120 -0
  72. package/esm/drivers/mongodb/mongodb-id-generator.d.mts.map +1 -0
  73. package/esm/drivers/mongodb/mongodb-id-generator.mjs +141 -0
  74. package/esm/drivers/mongodb/mongodb-id-generator.mjs.map +1 -0
  75. package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +322 -0
  76. package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -0
  77. package/esm/drivers/mongodb/mongodb-migration-driver.mjs +531 -0
  78. package/esm/drivers/mongodb/mongodb-migration-driver.mjs.map +1 -0
  79. package/esm/drivers/mongodb/mongodb-query-builder.d.mts +1117 -0
  80. package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -0
  81. package/esm/drivers/mongodb/mongodb-query-builder.mjs +1828 -0
  82. package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -0
  83. package/esm/drivers/mongodb/mongodb-query-operations.d.mts +230 -0
  84. package/esm/drivers/mongodb/mongodb-query-operations.d.mts.map +1 -0
  85. package/esm/drivers/mongodb/mongodb-query-operations.mjs +275 -0
  86. package/esm/drivers/mongodb/mongodb-query-operations.mjs.map +1 -0
  87. package/esm/drivers/mongodb/mongodb-query-parser.d.mts +263 -0
  88. package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -0
  89. package/esm/drivers/mongodb/mongodb-query-parser.mjs +965 -0
  90. package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -0
  91. package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts +78 -0
  92. package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts.map +1 -0
  93. package/esm/drivers/mongodb/mongodb-sync-adapter.mjs +118 -0
  94. package/esm/drivers/mongodb/mongodb-sync-adapter.mjs.map +1 -0
  95. package/esm/drivers/mongodb/types.d.mts +43 -0
  96. package/esm/drivers/mongodb/types.d.mts.map +1 -0
  97. package/esm/drivers/postgres/index.d.mts +8 -0
  98. package/esm/drivers/postgres/index.mjs +9 -0
  99. package/esm/drivers/postgres/postgres-blueprint.d.mts +60 -0
  100. package/esm/drivers/postgres/postgres-blueprint.d.mts.map +1 -0
  101. package/esm/drivers/postgres/postgres-blueprint.mjs +105 -0
  102. package/esm/drivers/postgres/postgres-blueprint.mjs.map +1 -0
  103. package/esm/drivers/postgres/postgres-dialect.d.mts +144 -0
  104. package/esm/drivers/postgres/postgres-dialect.d.mts.map +1 -0
  105. package/esm/drivers/postgres/postgres-dialect.mjs +227 -0
  106. package/esm/drivers/postgres/postgres-dialect.mjs.map +1 -0
  107. package/esm/drivers/postgres/postgres-driver.d.mts +424 -0
  108. package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -0
  109. package/esm/drivers/postgres/postgres-driver.mjs +845 -0
  110. package/esm/drivers/postgres/postgres-driver.mjs.map +1 -0
  111. package/esm/drivers/postgres/postgres-migration-driver.d.mts +393 -0
  112. package/esm/drivers/postgres/postgres-migration-driver.d.mts.map +1 -0
  113. package/esm/drivers/postgres/postgres-migration-driver.mjs +760 -0
  114. package/esm/drivers/postgres/postgres-migration-driver.mjs.map +1 -0
  115. package/esm/drivers/postgres/postgres-query-builder.d.mts +399 -0
  116. package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -0
  117. package/esm/drivers/postgres/postgres-query-builder.mjs +1105 -0
  118. package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -0
  119. package/esm/drivers/postgres/postgres-query-parser.d.mts +351 -0
  120. package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -0
  121. package/esm/drivers/postgres/postgres-query-parser.mjs +796 -0
  122. package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -0
  123. package/esm/drivers/postgres/postgres-sql-serializer.mjs +260 -0
  124. package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -0
  125. package/esm/drivers/postgres/postgres-sync-adapter.d.mts +79 -0
  126. package/esm/drivers/postgres/postgres-sync-adapter.d.mts.map +1 -0
  127. package/esm/drivers/postgres/postgres-sync-adapter.mjs +162 -0
  128. package/esm/drivers/postgres/postgres-sync-adapter.mjs.map +1 -0
  129. package/esm/drivers/postgres/types.d.mts +105 -0
  130. package/esm/drivers/postgres/types.d.mts.map +1 -0
  131. package/esm/drivers/sql/sql-dialect.contract.d.mts +221 -0
  132. package/esm/drivers/sql/sql-dialect.contract.d.mts.map +1 -0
  133. package/esm/drivers/sql/sql-types.d.mts +150 -0
  134. package/esm/drivers/sql/sql-types.d.mts.map +1 -0
  135. package/esm/errors/missing-data-source.error.d.mts +25 -0
  136. package/esm/errors/missing-data-source.error.d.mts.map +1 -0
  137. package/esm/errors/missing-data-source.error.mjs +31 -0
  138. package/esm/errors/missing-data-source.error.mjs.map +1 -0
  139. package/esm/errors/transaction-rollback.error.d.mts +23 -0
  140. package/esm/errors/transaction-rollback.error.d.mts.map +1 -0
  141. package/esm/errors/transaction-rollback.error.mjs +29 -0
  142. package/esm/errors/transaction-rollback.error.mjs.map +1 -0
  143. package/esm/events/model-events.d.mts +234 -0
  144. package/esm/events/model-events.d.mts.map +1 -0
  145. package/esm/events/model-events.mjs +254 -0
  146. package/esm/events/model-events.mjs.map +1 -0
  147. package/esm/expressions/aggregate-expressions.d.mts +224 -0
  148. package/esm/expressions/aggregate-expressions.d.mts.map +1 -0
  149. package/esm/expressions/aggregate-expressions.mjs +232 -0
  150. package/esm/expressions/aggregate-expressions.mjs.map +1 -0
  151. package/esm/index.d.mts +67 -0
  152. package/esm/index.mjs +53 -0
  153. package/esm/migration/column-builder.d.mts +420 -0
  154. package/esm/migration/column-builder.d.mts.map +1 -0
  155. package/esm/migration/column-builder.mjs +532 -0
  156. package/esm/migration/column-builder.mjs.map +1 -0
  157. package/esm/migration/column-helpers.d.mts +280 -0
  158. package/esm/migration/column-helpers.d.mts.map +1 -0
  159. package/esm/migration/column-helpers.mjs +376 -0
  160. package/esm/migration/column-helpers.mjs.map +1 -0
  161. package/esm/migration/foreign-key-builder.d.mts +106 -0
  162. package/esm/migration/foreign-key-builder.d.mts.map +1 -0
  163. package/esm/migration/foreign-key-builder.mjs +126 -0
  164. package/esm/migration/foreign-key-builder.mjs.map +1 -0
  165. package/esm/migration/index.d.mts +6 -0
  166. package/esm/migration/index.mjs +7 -0
  167. package/esm/migration/migration-runner.d.mts +279 -0
  168. package/esm/migration/migration-runner.d.mts.map +1 -0
  169. package/esm/migration/migration-runner.mjs +662 -0
  170. package/esm/migration/migration-runner.mjs.map +1 -0
  171. package/esm/migration/migration.d.mts +2035 -0
  172. package/esm/migration/migration.d.mts.map +1 -0
  173. package/esm/migration/migration.mjs +2083 -0
  174. package/esm/migration/migration.mjs.map +1 -0
  175. package/esm/migration/sql-grammar.mjs +115 -0
  176. package/esm/migration/sql-grammar.mjs.map +1 -0
  177. package/esm/migration/sql-serializer.d.mts +26 -0
  178. package/esm/migration/sql-serializer.d.mts.map +1 -0
  179. package/esm/migration/sql-serializer.mjs +26 -0
  180. package/esm/migration/sql-serializer.mjs.map +1 -0
  181. package/esm/migration/types.d.mts +136 -0
  182. package/esm/migration/types.d.mts.map +1 -0
  183. package/esm/model/methods/accessor-methods.mjs +54 -0
  184. package/esm/model/methods/accessor-methods.mjs.map +1 -0
  185. package/esm/model/methods/delete-methods.mjs +16 -0
  186. package/esm/model/methods/delete-methods.mjs.map +1 -0
  187. package/esm/model/methods/dirty-methods.mjs +20 -0
  188. package/esm/model/methods/dirty-methods.mjs.map +1 -0
  189. package/esm/model/methods/hydration-methods.mjs +51 -0
  190. package/esm/model/methods/hydration-methods.mjs.map +1 -0
  191. package/esm/model/methods/instance-event-methods.mjs +22 -0
  192. package/esm/model/methods/instance-event-methods.mjs.map +1 -0
  193. package/esm/model/methods/meta-methods.mjs +36 -0
  194. package/esm/model/methods/meta-methods.mjs.map +1 -0
  195. package/esm/model/methods/pivot-methods.mjs +48 -0
  196. package/esm/model/methods/pivot-methods.mjs.map +1 -0
  197. package/esm/model/methods/query-methods.mjs +121 -0
  198. package/esm/model/methods/query-methods.mjs.map +1 -0
  199. package/esm/model/methods/restore-methods.mjs +16 -0
  200. package/esm/model/methods/restore-methods.mjs.map +1 -0
  201. package/esm/model/methods/scope-methods.mjs +20 -0
  202. package/esm/model/methods/scope-methods.mjs.map +1 -0
  203. package/esm/model/methods/serialization-methods.mjs +20 -0
  204. package/esm/model/methods/serialization-methods.mjs.map +1 -0
  205. package/esm/model/methods/static-event-methods.mjs +37 -0
  206. package/esm/model/methods/static-event-methods.mjs.map +1 -0
  207. package/esm/model/methods/write-methods.mjs +69 -0
  208. package/esm/model/methods/write-methods.mjs.map +1 -0
  209. package/esm/model/model.d.mts +1778 -0
  210. package/esm/model/model.d.mts.map +1 -0
  211. package/esm/model/model.mjs +1762 -0
  212. package/esm/model/model.mjs.map +1 -0
  213. package/esm/model/model.types.d.mts +47 -0
  214. package/esm/model/model.types.d.mts.map +1 -0
  215. package/esm/model/register-model.d.mts +140 -0
  216. package/esm/model/register-model.d.mts.map +1 -0
  217. package/esm/model/register-model.mjs +175 -0
  218. package/esm/model/register-model.mjs.map +1 -0
  219. package/esm/model/relation-decorators.d.mts +88 -0
  220. package/esm/model/relation-decorators.d.mts.map +1 -0
  221. package/esm/model/relation-decorators.mjs +191 -0
  222. package/esm/model/relation-decorators.mjs.map +1 -0
  223. package/esm/operations/database.d.mts +46 -0
  224. package/esm/operations/database.d.mts.map +1 -0
  225. package/esm/operations/database.mjs +40 -0
  226. package/esm/operations/database.mjs.map +1 -0
  227. package/esm/operations/index.d.mts +2 -0
  228. package/esm/operations/index.mjs +4 -0
  229. package/esm/operations/migrations.d.mts +71 -0
  230. package/esm/operations/migrations.d.mts.map +1 -0
  231. package/esm/operations/migrations.mjs +70 -0
  232. package/esm/operations/migrations.mjs.map +1 -0
  233. package/esm/query-builder/query-builder.d.mts +564 -0
  234. package/esm/query-builder/query-builder.d.mts.map +1 -0
  235. package/esm/query-builder/query-builder.mjs +1097 -0
  236. package/esm/query-builder/query-builder.mjs.map +1 -0
  237. package/esm/relations/index.d.mts +4 -0
  238. package/esm/relations/index.mjs +5 -0
  239. package/esm/relations/key-conventions.mjs +119 -0
  240. package/esm/relations/key-conventions.mjs.map +1 -0
  241. package/esm/relations/pivot-operations.d.mts +155 -0
  242. package/esm/relations/pivot-operations.d.mts.map +1 -0
  243. package/esm/relations/pivot-operations.mjs +232 -0
  244. package/esm/relations/pivot-operations.mjs.map +1 -0
  245. package/esm/relations/relation-hydrator.d.mts +55 -0
  246. package/esm/relations/relation-hydrator.d.mts.map +1 -0
  247. package/esm/relations/relation-hydrator.mjs +52 -0
  248. package/esm/relations/relation-hydrator.mjs.map +1 -0
  249. package/esm/relations/relation-loader.d.mts +190 -0
  250. package/esm/relations/relation-loader.d.mts.map +1 -0
  251. package/esm/relations/relation-loader.mjs +416 -0
  252. package/esm/relations/relation-loader.mjs.map +1 -0
  253. package/esm/relations/types.d.mts +317 -0
  254. package/esm/relations/types.d.mts.map +1 -0
  255. package/esm/remover/database-remover.d.mts +104 -0
  256. package/esm/remover/database-remover.d.mts.map +1 -0
  257. package/esm/remover/database-remover.mjs +174 -0
  258. package/esm/remover/database-remover.mjs.map +1 -0
  259. package/esm/restorer/database-restorer.d.mts +135 -0
  260. package/esm/restorer/database-restorer.d.mts.map +1 -0
  261. package/esm/restorer/database-restorer.mjs +316 -0
  262. package/esm/restorer/database-restorer.mjs.map +1 -0
  263. package/esm/sql-database-dirty-tracker.d.mts +17 -0
  264. package/esm/sql-database-dirty-tracker.d.mts.map +1 -0
  265. package/esm/sql-database-dirty-tracker.mjs +20 -0
  266. package/esm/sql-database-dirty-tracker.mjs.map +1 -0
  267. package/esm/sync/model-events.mjs +46 -0
  268. package/esm/sync/model-events.mjs.map +1 -0
  269. package/esm/sync/model-sync-operation.d.mts +159 -0
  270. package/esm/sync/model-sync-operation.d.mts.map +1 -0
  271. package/esm/sync/model-sync-operation.mjs +257 -0
  272. package/esm/sync/model-sync-operation.mjs.map +1 -0
  273. package/esm/sync/model-sync.d.mts +126 -0
  274. package/esm/sync/model-sync.d.mts.map +1 -0
  275. package/esm/sync/model-sync.mjs +157 -0
  276. package/esm/sync/model-sync.mjs.map +1 -0
  277. package/esm/sync/sync-context.d.mts +69 -0
  278. package/esm/sync/sync-context.d.mts.map +1 -0
  279. package/esm/sync/sync-context.mjs +95 -0
  280. package/esm/sync/sync-context.mjs.map +1 -0
  281. package/esm/sync/sync-manager.d.mts +213 -0
  282. package/esm/sync/sync-manager.d.mts.map +1 -0
  283. package/esm/sync/sync-manager.mjs +597 -0
  284. package/esm/sync/sync-manager.mjs.map +1 -0
  285. package/esm/sync/types.d.mts +215 -0
  286. package/esm/sync/types.d.mts.map +1 -0
  287. package/esm/types.d.mts +423 -0
  288. package/esm/types.d.mts.map +1 -0
  289. package/esm/utils/connect-to-database.d.mts +328 -0
  290. package/esm/utils/connect-to-database.d.mts.map +1 -0
  291. package/esm/utils/connect-to-database.mjs +130 -0
  292. package/esm/utils/connect-to-database.mjs.map +1 -0
  293. package/esm/utils/database-writer.utils.d.mts +18 -0
  294. package/esm/utils/database-writer.utils.d.mts.map +1 -0
  295. package/esm/utils/database-writer.utils.mjs +25 -0
  296. package/esm/utils/database-writer.utils.mjs.map +1 -0
  297. package/esm/utils/define-model.d.mts +185 -0
  298. package/esm/utils/define-model.d.mts.map +1 -0
  299. package/esm/utils/define-model.mjs +105 -0
  300. package/esm/utils/define-model.mjs.map +1 -0
  301. package/esm/utils/is-valid-date-value.mjs +22 -0
  302. package/esm/utils/is-valid-date-value.mjs.map +1 -0
  303. package/esm/utils/once-connected.d.mts +150 -0
  304. package/esm/utils/once-connected.d.mts.map +1 -0
  305. package/esm/utils/once-connected.mjs +203 -0
  306. package/esm/utils/once-connected.mjs.map +1 -0
  307. package/esm/validation/database-seal-plugins.d.mts +1 -0
  308. package/esm/validation/database-seal-plugins.mjs +11 -0
  309. package/esm/validation/database-seal-plugins.mjs.map +1 -0
  310. package/esm/validation/database-writer-validation-error.d.mts +101 -0
  311. package/esm/validation/database-writer-validation-error.d.mts.map +1 -0
  312. package/esm/validation/database-writer-validation-error.mjs +153 -0
  313. package/esm/validation/database-writer-validation-error.mjs.map +1 -0
  314. package/esm/validation/index.d.mts +2 -0
  315. package/esm/validation/index.mjs +4 -0
  316. package/esm/validation/mutators/embed-mutator.mjs +26 -0
  317. package/esm/validation/mutators/embed-mutator.mjs.map +1 -0
  318. package/esm/validation/plugins/database-rules-plugin.d.mts +28 -0
  319. package/esm/validation/plugins/database-rules-plugin.d.mts.map +1 -0
  320. package/esm/validation/plugins/database-rules-plugin.mjs +43 -0
  321. package/esm/validation/plugins/database-rules-plugin.mjs.map +1 -0
  322. package/esm/validation/plugins/embed-validator-plugin.d.mts +17 -0
  323. package/esm/validation/plugins/embed-validator-plugin.d.mts.map +1 -0
  324. package/esm/validation/plugins/embed-validator-plugin.mjs +20 -0
  325. package/esm/validation/plugins/embed-validator-plugin.mjs.map +1 -0
  326. package/esm/validation/rules/database-model-rule.mjs +32 -0
  327. package/esm/validation/rules/database-model-rule.mjs.map +1 -0
  328. package/esm/validation/rules/exists-rule.mjs +29 -0
  329. package/esm/validation/rules/exists-rule.mjs.map +1 -0
  330. package/esm/validation/rules/unique-rule.mjs +43 -0
  331. package/esm/validation/rules/unique-rule.mjs.map +1 -0
  332. package/esm/validation/transformers/embed-model-transformer.mjs +17 -0
  333. package/esm/validation/transformers/embed-model-transformer.mjs.map +1 -0
  334. package/esm/validation/types.d.mts +43 -0
  335. package/esm/validation/types.d.mts.map +1 -0
  336. package/esm/validation/validators/embed-validator.d.mts +25 -0
  337. package/esm/validation/validators/embed-validator.d.mts.map +1 -0
  338. package/esm/validation/validators/embed-validator.mjs +42 -0
  339. package/esm/validation/validators/embed-validator.mjs.map +1 -0
  340. package/esm/writer/database-writer.d.mts +178 -0
  341. package/esm/writer/database-writer.d.mts.map +1 -0
  342. package/esm/writer/database-writer.mjs +317 -0
  343. package/esm/writer/database-writer.mjs.map +1 -0
  344. package/llms-full.txt +2027 -0
  345. package/llms.txt +23 -0
  346. package/package.json +60 -51
  347. package/skills/README.md +65 -0
  348. package/skills/aggregate-data/SKILL.md +102 -0
  349. package/skills/cascade-basics/SKILL.md +93 -0
  350. package/skills/configure-delete-strategy/SKILL.md +126 -0
  351. package/skills/define-model/SKILL.md +170 -0
  352. package/skills/define-relations/SKILL.md +171 -0
  353. package/skills/manage-data-sources/SKILL.md +140 -0
  354. package/skills/manage-transactions/SKILL.md +118 -0
  355. package/skills/paginate-results/SKILL.md +122 -0
  356. package/skills/perform-atomic-ops/SKILL.md +98 -0
  357. package/skills/query-data/SKILL.md +168 -0
  358. package/skills/run-cascade-cli/SKILL.md +125 -0
  359. package/skills/search-by-vector/SKILL.md +127 -0
  360. package/skills/subscribe-to-model-events/SKILL.md +148 -0
  361. package/skills/track-changes/SKILL.md +109 -0
  362. package/skills/write-migration/SKILL.md +144 -0
  363. package/cjs/context/database-data-source-context.d.ts +0 -29
  364. package/cjs/context/database-data-source-context.d.ts.map +0 -1
  365. package/cjs/context/database-data-source-context.js +0 -28
  366. package/cjs/context/database-data-source-context.js.map +0 -1
  367. package/cjs/context/database-transaction-context.d.ts +0 -35
  368. package/cjs/context/database-transaction-context.d.ts.map +0 -1
  369. package/cjs/context/database-transaction-context.js +0 -40
  370. package/cjs/context/database-transaction-context.js.map +0 -1
  371. package/cjs/contracts/database-driver.contract.d.ts +0 -450
  372. package/cjs/contracts/database-driver.contract.d.ts.map +0 -1
  373. package/cjs/contracts/database-id-generator.contract.d.ts +0 -109
  374. package/cjs/contracts/database-id-generator.contract.d.ts.map +0 -1
  375. package/cjs/contracts/database-remover.contract.d.ts +0 -104
  376. package/cjs/contracts/database-remover.contract.d.ts.map +0 -1
  377. package/cjs/contracts/database-restorer.contract.d.ts +0 -143
  378. package/cjs/contracts/database-restorer.contract.d.ts.map +0 -1
  379. package/cjs/contracts/database-writer.contract.d.ts +0 -119
  380. package/cjs/contracts/database-writer.contract.d.ts.map +0 -1
  381. package/cjs/contracts/driver-blueprint.contract.d.ts +0 -49
  382. package/cjs/contracts/driver-blueprint.contract.d.ts.map +0 -1
  383. package/cjs/contracts/index.d.ts +0 -10
  384. package/cjs/contracts/index.d.ts.map +0 -1
  385. package/cjs/contracts/migration-driver.contract.d.ts +0 -522
  386. package/cjs/contracts/migration-driver.contract.d.ts.map +0 -1
  387. package/cjs/contracts/query-builder.contract.d.ts +0 -1609
  388. package/cjs/contracts/query-builder.contract.d.ts.map +0 -1
  389. package/cjs/contracts/sync-adapter.contract.d.ts +0 -58
  390. package/cjs/contracts/sync-adapter.contract.d.ts.map +0 -1
  391. package/cjs/data-source/data-source-registry.d.ts +0 -108
  392. package/cjs/data-source/data-source-registry.d.ts.map +0 -1
  393. package/cjs/data-source/data-source-registry.js +0 -145
  394. package/cjs/data-source/data-source-registry.js.map +0 -1
  395. package/cjs/data-source/data-source.d.ts +0 -147
  396. package/cjs/data-source/data-source.d.ts.map +0 -1
  397. package/cjs/data-source/data-source.js +0 -83
  398. package/cjs/data-source/data-source.js.map +0 -1
  399. package/cjs/database-dirty-tracker.d.ts +0 -252
  400. package/cjs/database-dirty-tracker.d.ts.map +0 -1
  401. package/cjs/database-dirty-tracker.js +0 -386
  402. package/cjs/database-dirty-tracker.js.map +0 -1
  403. package/cjs/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
  404. package/cjs/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
  405. package/cjs/drivers/mongodb/mongodb-blueprint.js +0 -51
  406. package/cjs/drivers/mongodb/mongodb-blueprint.js.map +0 -1
  407. package/cjs/drivers/mongodb/mongodb-driver.d.ts +0 -325
  408. package/cjs/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
  409. package/cjs/drivers/mongodb/mongodb-driver.js +0 -845
  410. package/cjs/drivers/mongodb/mongodb-driver.js.map +0 -1
  411. package/cjs/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
  412. package/cjs/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
  413. package/cjs/drivers/mongodb/mongodb-id-generator.js +0 -149
  414. package/cjs/drivers/mongodb/mongodb-id-generator.js.map +0 -1
  415. package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
  416. package/cjs/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
  417. package/cjs/drivers/mongodb/mongodb-migration-driver.js +0 -666
  418. package/cjs/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
  419. package/cjs/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
  420. package/cjs/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
  421. package/cjs/drivers/mongodb/mongodb-query-builder.js +0 -1988
  422. package/cjs/drivers/mongodb/mongodb-query-builder.js.map +0 -1
  423. package/cjs/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
  424. package/cjs/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
  425. package/cjs/drivers/mongodb/mongodb-query-operations.js +0 -270
  426. package/cjs/drivers/mongodb/mongodb-query-operations.js.map +0 -1
  427. package/cjs/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
  428. package/cjs/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
  429. package/cjs/drivers/mongodb/mongodb-query-parser.js +0 -1351
  430. package/cjs/drivers/mongodb/mongodb-query-parser.js.map +0 -1
  431. package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
  432. package/cjs/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
  433. package/cjs/drivers/mongodb/mongodb-sync-adapter.js +0 -146
  434. package/cjs/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
  435. package/cjs/drivers/mongodb/types.d.ts +0 -43
  436. package/cjs/drivers/mongodb/types.d.ts.map +0 -1
  437. package/cjs/drivers/postgres/index.d.ts +0 -16
  438. package/cjs/drivers/postgres/index.d.ts.map +0 -1
  439. package/cjs/drivers/postgres/postgres-blueprint.d.ts +0 -64
  440. package/cjs/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
  441. package/cjs/drivers/postgres/postgres-blueprint.js +0 -121
  442. package/cjs/drivers/postgres/postgres-blueprint.js.map +0 -1
  443. package/cjs/drivers/postgres/postgres-dialect.d.ts +0 -136
  444. package/cjs/drivers/postgres/postgres-dialect.d.ts.map +0 -1
  445. package/cjs/drivers/postgres/postgres-dialect.js +0 -268
  446. package/cjs/drivers/postgres/postgres-dialect.js.map +0 -1
  447. package/cjs/drivers/postgres/postgres-driver.d.ts +0 -432
  448. package/cjs/drivers/postgres/postgres-driver.d.ts.map +0 -1
  449. package/cjs/drivers/postgres/postgres-driver.js +0 -1008
  450. package/cjs/drivers/postgres/postgres-driver.js.map +0 -1
  451. package/cjs/drivers/postgres/postgres-migration-driver.d.ts +0 -397
  452. package/cjs/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
  453. package/cjs/drivers/postgres/postgres-migration-driver.js +0 -900
  454. package/cjs/drivers/postgres/postgres-migration-driver.js.map +0 -1
  455. package/cjs/drivers/postgres/postgres-query-builder.d.ts +0 -254
  456. package/cjs/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
  457. package/cjs/drivers/postgres/postgres-query-builder.js +0 -933
  458. package/cjs/drivers/postgres/postgres-query-builder.js.map +0 -1
  459. package/cjs/drivers/postgres/postgres-query-parser.d.ts +0 -328
  460. package/cjs/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
  461. package/cjs/drivers/postgres/postgres-query-parser.js +0 -868
  462. package/cjs/drivers/postgres/postgres-query-parser.js.map +0 -1
  463. package/cjs/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
  464. package/cjs/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
  465. package/cjs/drivers/postgres/postgres-sql-serializer.js +0 -400
  466. package/cjs/drivers/postgres/postgres-sql-serializer.js.map +0 -1
  467. package/cjs/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
  468. package/cjs/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
  469. package/cjs/drivers/postgres/postgres-sync-adapter.js +0 -204
  470. package/cjs/drivers/postgres/postgres-sync-adapter.js.map +0 -1
  471. package/cjs/drivers/postgres/types.d.ts +0 -144
  472. package/cjs/drivers/postgres/types.d.ts.map +0 -1
  473. package/cjs/drivers/sql/index.d.ts +0 -10
  474. package/cjs/drivers/sql/index.d.ts.map +0 -1
  475. package/cjs/drivers/sql/sql-dialect.contract.d.ts +0 -204
  476. package/cjs/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
  477. package/cjs/drivers/sql/sql-types.d.ts +0 -202
  478. package/cjs/drivers/sql/sql-types.d.ts.map +0 -1
  479. package/cjs/errors/missing-data-source.error.d.ts +0 -22
  480. package/cjs/errors/missing-data-source.error.d.ts.map +0 -1
  481. package/cjs/errors/missing-data-source.error.js +0 -29
  482. package/cjs/errors/missing-data-source.error.js.map +0 -1
  483. package/cjs/errors/transaction-rollback.error.d.ts +0 -20
  484. package/cjs/errors/transaction-rollback.error.d.ts.map +0 -1
  485. package/cjs/errors/transaction-rollback.error.js +0 -27
  486. package/cjs/errors/transaction-rollback.error.js.map +0 -1
  487. package/cjs/events/model-events.d.ts +0 -231
  488. package/cjs/events/model-events.d.ts.map +0 -1
  489. package/cjs/events/model-events.js +0 -259
  490. package/cjs/events/model-events.js.map +0 -1
  491. package/cjs/expressions/aggregate-expressions.d.ts +0 -215
  492. package/cjs/expressions/aggregate-expressions.d.ts.map +0 -1
  493. package/cjs/expressions/aggregate-expressions.js +0 -221
  494. package/cjs/expressions/aggregate-expressions.js.map +0 -1
  495. package/cjs/expressions/index.d.ts +0 -2
  496. package/cjs/expressions/index.d.ts.map +0 -1
  497. package/cjs/index.d.ts +0 -45
  498. package/cjs/index.d.ts.map +0 -1
  499. package/cjs/index.js +0 -1
  500. package/cjs/index.js.map +0 -1
  501. package/cjs/migration/column-builder.d.ts +0 -417
  502. package/cjs/migration/column-builder.d.ts.map +0 -1
  503. package/cjs/migration/column-builder.js +0 -586
  504. package/cjs/migration/column-builder.js.map +0 -1
  505. package/cjs/migration/column-helpers.d.ts +0 -275
  506. package/cjs/migration/column-helpers.d.ts.map +0 -1
  507. package/cjs/migration/column-helpers.js +0 -389
  508. package/cjs/migration/column-helpers.js.map +0 -1
  509. package/cjs/migration/foreign-key-builder.d.ts +0 -103
  510. package/cjs/migration/foreign-key-builder.d.ts.map +0 -1
  511. package/cjs/migration/foreign-key-builder.js +0 -121
  512. package/cjs/migration/foreign-key-builder.js.map +0 -1
  513. package/cjs/migration/index.d.ts +0 -7
  514. package/cjs/migration/index.d.ts.map +0 -1
  515. package/cjs/migration/migration-runner.d.ts +0 -278
  516. package/cjs/migration/migration-runner.d.ts.map +0 -1
  517. package/cjs/migration/migration-runner.js +0 -815
  518. package/cjs/migration/migration-runner.js.map +0 -1
  519. package/cjs/migration/migration.d.ts +0 -1988
  520. package/cjs/migration/migration.d.ts.map +0 -1
  521. package/cjs/migration/migration.js +0 -2162
  522. package/cjs/migration/migration.js.map +0 -1
  523. package/cjs/migration/sql-grammar.d.ts +0 -61
  524. package/cjs/migration/sql-grammar.d.ts.map +0 -1
  525. package/cjs/migration/sql-grammar.js +0 -164
  526. package/cjs/migration/sql-grammar.js.map +0 -1
  527. package/cjs/migration/sql-serializer.d.ts +0 -22
  528. package/cjs/migration/sql-serializer.d.ts.map +0 -1
  529. package/cjs/migration/sql-serializer.js +0 -26
  530. package/cjs/migration/sql-serializer.js.map +0 -1
  531. package/cjs/migration/types.d.ts +0 -155
  532. package/cjs/migration/types.d.ts.map +0 -1
  533. package/cjs/model/methods/accessor-methods.d.ts +0 -13
  534. package/cjs/model/methods/accessor-methods.d.ts.map +0 -1
  535. package/cjs/model/methods/accessor-methods.js +0 -51
  536. package/cjs/model/methods/accessor-methods.js.map +0 -1
  537. package/cjs/model/methods/delete-methods.d.ts +0 -10
  538. package/cjs/model/methods/delete-methods.d.ts.map +0 -1
  539. package/cjs/model/methods/delete-methods.js +0 -10
  540. package/cjs/model/methods/delete-methods.js.map +0 -1
  541. package/cjs/model/methods/dirty-methods.d.ts +0 -10
  542. package/cjs/model/methods/dirty-methods.d.ts.map +0 -1
  543. package/cjs/model/methods/dirty-methods.js +0 -15
  544. package/cjs/model/methods/dirty-methods.js.map +0 -1
  545. package/cjs/model/methods/hydration-methods.d.ts +0 -10
  546. package/cjs/model/methods/hydration-methods.d.ts.map +0 -1
  547. package/cjs/model/methods/hydration-methods.js +0 -57
  548. package/cjs/model/methods/hydration-methods.js.map +0 -1
  549. package/cjs/model/methods/instance-event-methods.d.ts +0 -7
  550. package/cjs/model/methods/instance-event-methods.d.ts.map +0 -1
  551. package/cjs/model/methods/instance-event-methods.js +0 -15
  552. package/cjs/model/methods/instance-event-methods.js.map +0 -1
  553. package/cjs/model/methods/meta-methods.d.ts +0 -7
  554. package/cjs/model/methods/meta-methods.d.ts.map +0 -1
  555. package/cjs/model/methods/meta-methods.js +0 -78
  556. package/cjs/model/methods/meta-methods.js.map +0 -1
  557. package/cjs/model/methods/query-methods.d.ts +0 -24
  558. package/cjs/model/methods/query-methods.d.ts.map +0 -1
  559. package/cjs/model/methods/query-methods.js +0 -164
  560. package/cjs/model/methods/query-methods.js.map +0 -1
  561. package/cjs/model/methods/restore-methods.d.ts +0 -10
  562. package/cjs/model/methods/restore-methods.d.ts.map +0 -1
  563. package/cjs/model/methods/restore-methods.js +0 -13
  564. package/cjs/model/methods/restore-methods.js.map +0 -1
  565. package/cjs/model/methods/scope-methods.d.ts +0 -7
  566. package/cjs/model/methods/scope-methods.d.ts.map +0 -1
  567. package/cjs/model/methods/scope-methods.js +0 -15
  568. package/cjs/model/methods/scope-methods.js.map +0 -1
  569. package/cjs/model/methods/serialization-methods.d.ts +0 -3
  570. package/cjs/model/methods/serialization-methods.d.ts.map +0 -1
  571. package/cjs/model/methods/serialization-methods.js +0 -27
  572. package/cjs/model/methods/serialization-methods.js.map +0 -1
  573. package/cjs/model/methods/static-event-methods.d.ts +0 -9
  574. package/cjs/model/methods/static-event-methods.d.ts.map +0 -1
  575. package/cjs/model/methods/static-event-methods.js +0 -29
  576. package/cjs/model/methods/static-event-methods.js.map +0 -1
  577. package/cjs/model/methods/write-methods.d.ts +0 -10
  578. package/cjs/model/methods/write-methods.d.ts.map +0 -1
  579. package/cjs/model/methods/write-methods.js +0 -52
  580. package/cjs/model/methods/write-methods.js.map +0 -1
  581. package/cjs/model/model.d.ts +0 -1647
  582. package/cjs/model/model.d.ts.map +0 -1
  583. package/cjs/model/model.js +0 -1657
  584. package/cjs/model/model.js.map +0 -1
  585. package/cjs/model/model.types.d.ts +0 -44
  586. package/cjs/model/model.types.d.ts.map +0 -1
  587. package/cjs/model/register-model.d.ts +0 -81
  588. package/cjs/model/register-model.d.ts.map +0 -1
  589. package/cjs/model/register-model.js +0 -94
  590. package/cjs/model/register-model.js.map +0 -1
  591. package/cjs/query-builder/query-builder.d.ts +0 -556
  592. package/cjs/query-builder/query-builder.d.ts.map +0 -1
  593. package/cjs/query-builder/query-builder.js +0 -1070
  594. package/cjs/query-builder/query-builder.js.map +0 -1
  595. package/cjs/relations/helpers.d.ts +0 -156
  596. package/cjs/relations/helpers.d.ts.map +0 -1
  597. package/cjs/relations/helpers.js +0 -202
  598. package/cjs/relations/helpers.js.map +0 -1
  599. package/cjs/relations/index.d.ts +0 -35
  600. package/cjs/relations/index.d.ts.map +0 -1
  601. package/cjs/relations/pivot-operations.d.ts +0 -160
  602. package/cjs/relations/pivot-operations.d.ts.map +0 -1
  603. package/cjs/relations/pivot-operations.js +0 -293
  604. package/cjs/relations/pivot-operations.js.map +0 -1
  605. package/cjs/relations/relation-hydrator.d.ts +0 -68
  606. package/cjs/relations/relation-hydrator.d.ts.map +0 -1
  607. package/cjs/relations/relation-hydrator.js +0 -81
  608. package/cjs/relations/relation-hydrator.js.map +0 -1
  609. package/cjs/relations/relation-loader.d.ts +0 -194
  610. package/cjs/relations/relation-loader.d.ts.map +0 -1
  611. package/cjs/relations/relation-loader.js +0 -466
  612. package/cjs/relations/relation-loader.js.map +0 -1
  613. package/cjs/relations/types.d.ts +0 -306
  614. package/cjs/relations/types.d.ts.map +0 -1
  615. package/cjs/remover/database-remover.d.ts +0 -100
  616. package/cjs/remover/database-remover.d.ts.map +0 -1
  617. package/cjs/remover/database-remover.js +0 -214
  618. package/cjs/remover/database-remover.js.map +0 -1
  619. package/cjs/restorer/database-restorer.d.ts +0 -131
  620. package/cjs/restorer/database-restorer.d.ts.map +0 -1
  621. package/cjs/restorer/database-restorer.js +0 -434
  622. package/cjs/restorer/database-restorer.js.map +0 -1
  623. package/cjs/sql-database-dirty-tracker.d.ts +0 -13
  624. package/cjs/sql-database-dirty-tracker.d.ts.map +0 -1
  625. package/cjs/sql-database-dirty-tracker.js +0 -14
  626. package/cjs/sql-database-dirty-tracker.js.map +0 -1
  627. package/cjs/sync/index.d.ts +0 -12
  628. package/cjs/sync/index.d.ts.map +0 -1
  629. package/cjs/sync/model-events.d.ts +0 -62
  630. package/cjs/sync/model-events.d.ts.map +0 -1
  631. package/cjs/sync/model-events.js +0 -49
  632. package/cjs/sync/model-events.js.map +0 -1
  633. package/cjs/sync/model-sync-operation.d.ts +0 -163
  634. package/cjs/sync/model-sync-operation.d.ts.map +0 -1
  635. package/cjs/sync/model-sync-operation.js +0 -292
  636. package/cjs/sync/model-sync-operation.js.map +0 -1
  637. package/cjs/sync/model-sync.d.ts +0 -130
  638. package/cjs/sync/model-sync.d.ts.map +0 -1
  639. package/cjs/sync/model-sync.js +0 -178
  640. package/cjs/sync/model-sync.js.map +0 -1
  641. package/cjs/sync/sync-context.d.ts +0 -70
  642. package/cjs/sync/sync-context.d.ts.map +0 -1
  643. package/cjs/sync/sync-context.js +0 -101
  644. package/cjs/sync/sync-context.js.map +0 -1
  645. package/cjs/sync/sync-manager.d.ts +0 -213
  646. package/cjs/sync/sync-manager.d.ts.map +0 -1
  647. package/cjs/sync/sync-manager.js +0 -689
  648. package/cjs/sync/sync-manager.js.map +0 -1
  649. package/cjs/sync/types.d.ts +0 -289
  650. package/cjs/sync/types.d.ts.map +0 -1
  651. package/cjs/test-migrations/test-enhanced-features.migration.d.ts +0 -15
  652. package/cjs/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
  653. package/cjs/types.d.ts +0 -371
  654. package/cjs/types.d.ts.map +0 -1
  655. package/cjs/utils/connect-to-database.d.ts +0 -307
  656. package/cjs/utils/connect-to-database.d.ts.map +0 -1
  657. package/cjs/utils/connect-to-database.js +0 -130
  658. package/cjs/utils/connect-to-database.js.map +0 -1
  659. package/cjs/utils/database-writer.utils.d.ts +0 -15
  660. package/cjs/utils/database-writer.utils.d.ts.map +0 -1
  661. package/cjs/utils/database-writer.utils.js +0 -14
  662. package/cjs/utils/database-writer.utils.js.map +0 -1
  663. package/cjs/utils/define-model.js +0 -100
  664. package/cjs/utils/define-model.js.map +0 -1
  665. package/cjs/utils/is-valid-date-value.d.ts +0 -5
  666. package/cjs/utils/is-valid-date-value.d.ts.map +0 -1
  667. package/cjs/utils/is-valid-date-value.js +0 -25
  668. package/cjs/utils/is-valid-date-value.js.map +0 -1
  669. package/cjs/utils/once-connected.d.ts +0 -146
  670. package/cjs/utils/once-connected.d.ts.map +0 -1
  671. package/cjs/utils/once-connected.js +0 -251
  672. package/cjs/utils/once-connected.js.map +0 -1
  673. package/cjs/validation/database-seal-plugins.d.ts +0 -12
  674. package/cjs/validation/database-seal-plugins.d.ts.map +0 -1
  675. package/cjs/validation/database-seal-plugins.js +0 -1
  676. package/cjs/validation/database-seal-plugins.js.map +0 -1
  677. package/cjs/validation/database-writer-validation-error.d.ts +0 -97
  678. package/cjs/validation/database-writer-validation-error.d.ts.map +0 -1
  679. package/cjs/validation/database-writer-validation-error.js +0 -160
  680. package/cjs/validation/database-writer-validation-error.js.map +0 -1
  681. package/cjs/validation/index.d.ts +0 -3
  682. package/cjs/validation/index.d.ts.map +0 -1
  683. package/cjs/validation/mutators/embed-mutator.d.ts +0 -9
  684. package/cjs/validation/mutators/embed-mutator.d.ts.map +0 -1
  685. package/cjs/validation/mutators/embed-mutator.js +0 -33
  686. package/cjs/validation/mutators/embed-mutator.js.map +0 -1
  687. package/cjs/validation/plugins/embed-validator-plugin.d.ts +0 -24
  688. package/cjs/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
  689. package/cjs/validation/plugins/embed-validator-plugin.js +0 -18
  690. package/cjs/validation/plugins/embed-validator-plugin.js.map +0 -1
  691. package/cjs/validation/rules/database-model-rule.d.ts +0 -7
  692. package/cjs/validation/rules/database-model-rule.d.ts.map +0 -1
  693. package/cjs/validation/rules/database-model-rule.js +0 -27
  694. package/cjs/validation/rules/database-model-rule.js.map +0 -1
  695. package/cjs/validation/transformers/embed-model-transformer.d.ts +0 -3
  696. package/cjs/validation/transformers/embed-model-transformer.d.ts.map +0 -1
  697. package/cjs/validation/transformers/embed-model-transformer.js +0 -18
  698. package/cjs/validation/transformers/embed-model-transformer.js.map +0 -1
  699. package/cjs/validation/validators/embed-validator.d.ts +0 -21
  700. package/cjs/validation/validators/embed-validator.d.ts.map +0 -1
  701. package/cjs/validation/validators/embed-validator.js +0 -43
  702. package/cjs/validation/validators/embed-validator.js.map +0 -1
  703. package/cjs/writer/database-writer.d.ts +0 -174
  704. package/cjs/writer/database-writer.d.ts.map +0 -1
  705. package/cjs/writer/database-writer.js +0 -400
  706. package/cjs/writer/database-writer.js.map +0 -1
  707. package/esm/context/database-data-source-context.d.ts +0 -29
  708. package/esm/context/database-data-source-context.d.ts.map +0 -1
  709. package/esm/context/database-data-source-context.js +0 -28
  710. package/esm/context/database-data-source-context.js.map +0 -1
  711. package/esm/context/database-transaction-context.d.ts +0 -35
  712. package/esm/context/database-transaction-context.d.ts.map +0 -1
  713. package/esm/context/database-transaction-context.js +0 -40
  714. package/esm/context/database-transaction-context.js.map +0 -1
  715. package/esm/contracts/database-driver.contract.d.ts +0 -450
  716. package/esm/contracts/database-driver.contract.d.ts.map +0 -1
  717. package/esm/contracts/database-id-generator.contract.d.ts +0 -109
  718. package/esm/contracts/database-id-generator.contract.d.ts.map +0 -1
  719. package/esm/contracts/database-remover.contract.d.ts +0 -104
  720. package/esm/contracts/database-remover.contract.d.ts.map +0 -1
  721. package/esm/contracts/database-restorer.contract.d.ts +0 -143
  722. package/esm/contracts/database-restorer.contract.d.ts.map +0 -1
  723. package/esm/contracts/database-writer.contract.d.ts +0 -119
  724. package/esm/contracts/database-writer.contract.d.ts.map +0 -1
  725. package/esm/contracts/driver-blueprint.contract.d.ts +0 -49
  726. package/esm/contracts/driver-blueprint.contract.d.ts.map +0 -1
  727. package/esm/contracts/index.d.ts +0 -10
  728. package/esm/contracts/index.d.ts.map +0 -1
  729. package/esm/contracts/migration-driver.contract.d.ts +0 -522
  730. package/esm/contracts/migration-driver.contract.d.ts.map +0 -1
  731. package/esm/contracts/query-builder.contract.d.ts +0 -1609
  732. package/esm/contracts/query-builder.contract.d.ts.map +0 -1
  733. package/esm/contracts/sync-adapter.contract.d.ts +0 -58
  734. package/esm/contracts/sync-adapter.contract.d.ts.map +0 -1
  735. package/esm/data-source/data-source-registry.d.ts +0 -108
  736. package/esm/data-source/data-source-registry.d.ts.map +0 -1
  737. package/esm/data-source/data-source-registry.js +0 -145
  738. package/esm/data-source/data-source-registry.js.map +0 -1
  739. package/esm/data-source/data-source.d.ts +0 -147
  740. package/esm/data-source/data-source.d.ts.map +0 -1
  741. package/esm/data-source/data-source.js +0 -83
  742. package/esm/data-source/data-source.js.map +0 -1
  743. package/esm/database-dirty-tracker.d.ts +0 -252
  744. package/esm/database-dirty-tracker.d.ts.map +0 -1
  745. package/esm/database-dirty-tracker.js +0 -386
  746. package/esm/database-dirty-tracker.js.map +0 -1
  747. package/esm/drivers/mongodb/mongodb-blueprint.d.ts +0 -30
  748. package/esm/drivers/mongodb/mongodb-blueprint.d.ts.map +0 -1
  749. package/esm/drivers/mongodb/mongodb-blueprint.js +0 -51
  750. package/esm/drivers/mongodb/mongodb-blueprint.js.map +0 -1
  751. package/esm/drivers/mongodb/mongodb-driver.d.ts +0 -325
  752. package/esm/drivers/mongodb/mongodb-driver.d.ts.map +0 -1
  753. package/esm/drivers/mongodb/mongodb-driver.js +0 -845
  754. package/esm/drivers/mongodb/mongodb-driver.js.map +0 -1
  755. package/esm/drivers/mongodb/mongodb-id-generator.d.ts +0 -116
  756. package/esm/drivers/mongodb/mongodb-id-generator.d.ts.map +0 -1
  757. package/esm/drivers/mongodb/mongodb-id-generator.js +0 -149
  758. package/esm/drivers/mongodb/mongodb-id-generator.js.map +0 -1
  759. package/esm/drivers/mongodb/mongodb-migration-driver.d.ts +0 -317
  760. package/esm/drivers/mongodb/mongodb-migration-driver.d.ts.map +0 -1
  761. package/esm/drivers/mongodb/mongodb-migration-driver.js +0 -666
  762. package/esm/drivers/mongodb/mongodb-migration-driver.js.map +0 -1
  763. package/esm/drivers/mongodb/mongodb-query-builder.d.ts +0 -1122
  764. package/esm/drivers/mongodb/mongodb-query-builder.d.ts.map +0 -1
  765. package/esm/drivers/mongodb/mongodb-query-builder.js +0 -1988
  766. package/esm/drivers/mongodb/mongodb-query-builder.js.map +0 -1
  767. package/esm/drivers/mongodb/mongodb-query-operations.d.ts +0 -226
  768. package/esm/drivers/mongodb/mongodb-query-operations.d.ts.map +0 -1
  769. package/esm/drivers/mongodb/mongodb-query-operations.js +0 -270
  770. package/esm/drivers/mongodb/mongodb-query-operations.js.map +0 -1
  771. package/esm/drivers/mongodb/mongodb-query-parser.d.ts +0 -262
  772. package/esm/drivers/mongodb/mongodb-query-parser.d.ts.map +0 -1
  773. package/esm/drivers/mongodb/mongodb-query-parser.js +0 -1351
  774. package/esm/drivers/mongodb/mongodb-query-parser.js.map +0 -1
  775. package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts +0 -79
  776. package/esm/drivers/mongodb/mongodb-sync-adapter.d.ts.map +0 -1
  777. package/esm/drivers/mongodb/mongodb-sync-adapter.js +0 -146
  778. package/esm/drivers/mongodb/mongodb-sync-adapter.js.map +0 -1
  779. package/esm/drivers/mongodb/types.d.ts +0 -43
  780. package/esm/drivers/mongodb/types.d.ts.map +0 -1
  781. package/esm/drivers/postgres/index.d.ts +0 -16
  782. package/esm/drivers/postgres/index.d.ts.map +0 -1
  783. package/esm/drivers/postgres/postgres-blueprint.d.ts +0 -64
  784. package/esm/drivers/postgres/postgres-blueprint.d.ts.map +0 -1
  785. package/esm/drivers/postgres/postgres-blueprint.js +0 -121
  786. package/esm/drivers/postgres/postgres-blueprint.js.map +0 -1
  787. package/esm/drivers/postgres/postgres-dialect.d.ts +0 -136
  788. package/esm/drivers/postgres/postgres-dialect.d.ts.map +0 -1
  789. package/esm/drivers/postgres/postgres-dialect.js +0 -268
  790. package/esm/drivers/postgres/postgres-dialect.js.map +0 -1
  791. package/esm/drivers/postgres/postgres-driver.d.ts +0 -432
  792. package/esm/drivers/postgres/postgres-driver.d.ts.map +0 -1
  793. package/esm/drivers/postgres/postgres-driver.js +0 -1008
  794. package/esm/drivers/postgres/postgres-driver.js.map +0 -1
  795. package/esm/drivers/postgres/postgres-migration-driver.d.ts +0 -397
  796. package/esm/drivers/postgres/postgres-migration-driver.d.ts.map +0 -1
  797. package/esm/drivers/postgres/postgres-migration-driver.js +0 -900
  798. package/esm/drivers/postgres/postgres-migration-driver.js.map +0 -1
  799. package/esm/drivers/postgres/postgres-query-builder.d.ts +0 -254
  800. package/esm/drivers/postgres/postgres-query-builder.d.ts.map +0 -1
  801. package/esm/drivers/postgres/postgres-query-builder.js +0 -933
  802. package/esm/drivers/postgres/postgres-query-builder.js.map +0 -1
  803. package/esm/drivers/postgres/postgres-query-parser.d.ts +0 -328
  804. package/esm/drivers/postgres/postgres-query-parser.d.ts.map +0 -1
  805. package/esm/drivers/postgres/postgres-query-parser.js +0 -868
  806. package/esm/drivers/postgres/postgres-query-parser.js.map +0 -1
  807. package/esm/drivers/postgres/postgres-sql-serializer.d.ts +0 -37
  808. package/esm/drivers/postgres/postgres-sql-serializer.d.ts.map +0 -1
  809. package/esm/drivers/postgres/postgres-sql-serializer.js +0 -400
  810. package/esm/drivers/postgres/postgres-sql-serializer.js.map +0 -1
  811. package/esm/drivers/postgres/postgres-sync-adapter.d.ts +0 -83
  812. package/esm/drivers/postgres/postgres-sync-adapter.d.ts.map +0 -1
  813. package/esm/drivers/postgres/postgres-sync-adapter.js +0 -204
  814. package/esm/drivers/postgres/postgres-sync-adapter.js.map +0 -1
  815. package/esm/drivers/postgres/types.d.ts +0 -144
  816. package/esm/drivers/postgres/types.d.ts.map +0 -1
  817. package/esm/drivers/sql/index.d.ts +0 -10
  818. package/esm/drivers/sql/index.d.ts.map +0 -1
  819. package/esm/drivers/sql/sql-dialect.contract.d.ts +0 -204
  820. package/esm/drivers/sql/sql-dialect.contract.d.ts.map +0 -1
  821. package/esm/drivers/sql/sql-types.d.ts +0 -202
  822. package/esm/drivers/sql/sql-types.d.ts.map +0 -1
  823. package/esm/errors/missing-data-source.error.d.ts +0 -22
  824. package/esm/errors/missing-data-source.error.d.ts.map +0 -1
  825. package/esm/errors/missing-data-source.error.js +0 -29
  826. package/esm/errors/missing-data-source.error.js.map +0 -1
  827. package/esm/errors/transaction-rollback.error.d.ts +0 -20
  828. package/esm/errors/transaction-rollback.error.d.ts.map +0 -1
  829. package/esm/errors/transaction-rollback.error.js +0 -27
  830. package/esm/errors/transaction-rollback.error.js.map +0 -1
  831. package/esm/events/model-events.d.ts +0 -231
  832. package/esm/events/model-events.d.ts.map +0 -1
  833. package/esm/events/model-events.js +0 -259
  834. package/esm/events/model-events.js.map +0 -1
  835. package/esm/expressions/aggregate-expressions.d.ts +0 -215
  836. package/esm/expressions/aggregate-expressions.d.ts.map +0 -1
  837. package/esm/expressions/aggregate-expressions.js +0 -221
  838. package/esm/expressions/aggregate-expressions.js.map +0 -1
  839. package/esm/expressions/index.d.ts +0 -2
  840. package/esm/expressions/index.d.ts.map +0 -1
  841. package/esm/index.d.ts +0 -45
  842. package/esm/index.d.ts.map +0 -1
  843. package/esm/index.js +0 -1
  844. package/esm/index.js.map +0 -1
  845. package/esm/migration/column-builder.d.ts +0 -417
  846. package/esm/migration/column-builder.d.ts.map +0 -1
  847. package/esm/migration/column-builder.js +0 -586
  848. package/esm/migration/column-builder.js.map +0 -1
  849. package/esm/migration/column-helpers.d.ts +0 -275
  850. package/esm/migration/column-helpers.d.ts.map +0 -1
  851. package/esm/migration/column-helpers.js +0 -389
  852. package/esm/migration/column-helpers.js.map +0 -1
  853. package/esm/migration/foreign-key-builder.d.ts +0 -103
  854. package/esm/migration/foreign-key-builder.d.ts.map +0 -1
  855. package/esm/migration/foreign-key-builder.js +0 -121
  856. package/esm/migration/foreign-key-builder.js.map +0 -1
  857. package/esm/migration/index.d.ts +0 -7
  858. package/esm/migration/index.d.ts.map +0 -1
  859. package/esm/migration/migration-runner.d.ts +0 -278
  860. package/esm/migration/migration-runner.d.ts.map +0 -1
  861. package/esm/migration/migration-runner.js +0 -815
  862. package/esm/migration/migration-runner.js.map +0 -1
  863. package/esm/migration/migration.d.ts +0 -1988
  864. package/esm/migration/migration.d.ts.map +0 -1
  865. package/esm/migration/migration.js +0 -2162
  866. package/esm/migration/migration.js.map +0 -1
  867. package/esm/migration/sql-grammar.d.ts +0 -61
  868. package/esm/migration/sql-grammar.d.ts.map +0 -1
  869. package/esm/migration/sql-grammar.js +0 -164
  870. package/esm/migration/sql-grammar.js.map +0 -1
  871. package/esm/migration/sql-serializer.d.ts +0 -22
  872. package/esm/migration/sql-serializer.d.ts.map +0 -1
  873. package/esm/migration/sql-serializer.js +0 -26
  874. package/esm/migration/sql-serializer.js.map +0 -1
  875. package/esm/migration/types.d.ts +0 -155
  876. package/esm/migration/types.d.ts.map +0 -1
  877. package/esm/model/methods/accessor-methods.d.ts +0 -13
  878. package/esm/model/methods/accessor-methods.d.ts.map +0 -1
  879. package/esm/model/methods/accessor-methods.js +0 -51
  880. package/esm/model/methods/accessor-methods.js.map +0 -1
  881. package/esm/model/methods/delete-methods.d.ts +0 -10
  882. package/esm/model/methods/delete-methods.d.ts.map +0 -1
  883. package/esm/model/methods/delete-methods.js +0 -10
  884. package/esm/model/methods/delete-methods.js.map +0 -1
  885. package/esm/model/methods/dirty-methods.d.ts +0 -10
  886. package/esm/model/methods/dirty-methods.d.ts.map +0 -1
  887. package/esm/model/methods/dirty-methods.js +0 -15
  888. package/esm/model/methods/dirty-methods.js.map +0 -1
  889. package/esm/model/methods/hydration-methods.d.ts +0 -10
  890. package/esm/model/methods/hydration-methods.d.ts.map +0 -1
  891. package/esm/model/methods/hydration-methods.js +0 -57
  892. package/esm/model/methods/hydration-methods.js.map +0 -1
  893. package/esm/model/methods/instance-event-methods.d.ts +0 -7
  894. package/esm/model/methods/instance-event-methods.d.ts.map +0 -1
  895. package/esm/model/methods/instance-event-methods.js +0 -15
  896. package/esm/model/methods/instance-event-methods.js.map +0 -1
  897. package/esm/model/methods/meta-methods.d.ts +0 -7
  898. package/esm/model/methods/meta-methods.d.ts.map +0 -1
  899. package/esm/model/methods/meta-methods.js +0 -78
  900. package/esm/model/methods/meta-methods.js.map +0 -1
  901. package/esm/model/methods/query-methods.d.ts +0 -24
  902. package/esm/model/methods/query-methods.d.ts.map +0 -1
  903. package/esm/model/methods/query-methods.js +0 -164
  904. package/esm/model/methods/query-methods.js.map +0 -1
  905. package/esm/model/methods/restore-methods.d.ts +0 -10
  906. package/esm/model/methods/restore-methods.d.ts.map +0 -1
  907. package/esm/model/methods/restore-methods.js +0 -13
  908. package/esm/model/methods/restore-methods.js.map +0 -1
  909. package/esm/model/methods/scope-methods.d.ts +0 -7
  910. package/esm/model/methods/scope-methods.d.ts.map +0 -1
  911. package/esm/model/methods/scope-methods.js +0 -15
  912. package/esm/model/methods/scope-methods.js.map +0 -1
  913. package/esm/model/methods/serialization-methods.d.ts +0 -3
  914. package/esm/model/methods/serialization-methods.d.ts.map +0 -1
  915. package/esm/model/methods/serialization-methods.js +0 -27
  916. package/esm/model/methods/serialization-methods.js.map +0 -1
  917. package/esm/model/methods/static-event-methods.d.ts +0 -9
  918. package/esm/model/methods/static-event-methods.d.ts.map +0 -1
  919. package/esm/model/methods/static-event-methods.js +0 -29
  920. package/esm/model/methods/static-event-methods.js.map +0 -1
  921. package/esm/model/methods/write-methods.d.ts +0 -10
  922. package/esm/model/methods/write-methods.d.ts.map +0 -1
  923. package/esm/model/methods/write-methods.js +0 -52
  924. package/esm/model/methods/write-methods.js.map +0 -1
  925. package/esm/model/model.d.ts +0 -1647
  926. package/esm/model/model.d.ts.map +0 -1
  927. package/esm/model/model.js +0 -1657
  928. package/esm/model/model.js.map +0 -1
  929. package/esm/model/model.types.d.ts +0 -44
  930. package/esm/model/model.types.d.ts.map +0 -1
  931. package/esm/model/register-model.d.ts +0 -81
  932. package/esm/model/register-model.d.ts.map +0 -1
  933. package/esm/model/register-model.js +0 -94
  934. package/esm/model/register-model.js.map +0 -1
  935. package/esm/query-builder/query-builder.d.ts +0 -556
  936. package/esm/query-builder/query-builder.d.ts.map +0 -1
  937. package/esm/query-builder/query-builder.js +0 -1070
  938. package/esm/query-builder/query-builder.js.map +0 -1
  939. package/esm/relations/helpers.d.ts +0 -156
  940. package/esm/relations/helpers.d.ts.map +0 -1
  941. package/esm/relations/helpers.js +0 -202
  942. package/esm/relations/helpers.js.map +0 -1
  943. package/esm/relations/index.d.ts +0 -35
  944. package/esm/relations/index.d.ts.map +0 -1
  945. package/esm/relations/pivot-operations.d.ts +0 -160
  946. package/esm/relations/pivot-operations.d.ts.map +0 -1
  947. package/esm/relations/pivot-operations.js +0 -293
  948. package/esm/relations/pivot-operations.js.map +0 -1
  949. package/esm/relations/relation-hydrator.d.ts +0 -68
  950. package/esm/relations/relation-hydrator.d.ts.map +0 -1
  951. package/esm/relations/relation-hydrator.js +0 -81
  952. package/esm/relations/relation-hydrator.js.map +0 -1
  953. package/esm/relations/relation-loader.d.ts +0 -194
  954. package/esm/relations/relation-loader.d.ts.map +0 -1
  955. package/esm/relations/relation-loader.js +0 -466
  956. package/esm/relations/relation-loader.js.map +0 -1
  957. package/esm/relations/types.d.ts +0 -306
  958. package/esm/relations/types.d.ts.map +0 -1
  959. package/esm/remover/database-remover.d.ts +0 -100
  960. package/esm/remover/database-remover.d.ts.map +0 -1
  961. package/esm/remover/database-remover.js +0 -214
  962. package/esm/remover/database-remover.js.map +0 -1
  963. package/esm/restorer/database-restorer.d.ts +0 -131
  964. package/esm/restorer/database-restorer.d.ts.map +0 -1
  965. package/esm/restorer/database-restorer.js +0 -434
  966. package/esm/restorer/database-restorer.js.map +0 -1
  967. package/esm/sql-database-dirty-tracker.d.ts +0 -13
  968. package/esm/sql-database-dirty-tracker.d.ts.map +0 -1
  969. package/esm/sql-database-dirty-tracker.js +0 -14
  970. package/esm/sql-database-dirty-tracker.js.map +0 -1
  971. package/esm/sync/index.d.ts +0 -12
  972. package/esm/sync/index.d.ts.map +0 -1
  973. package/esm/sync/model-events.d.ts +0 -62
  974. package/esm/sync/model-events.d.ts.map +0 -1
  975. package/esm/sync/model-events.js +0 -49
  976. package/esm/sync/model-events.js.map +0 -1
  977. package/esm/sync/model-sync-operation.d.ts +0 -163
  978. package/esm/sync/model-sync-operation.d.ts.map +0 -1
  979. package/esm/sync/model-sync-operation.js +0 -292
  980. package/esm/sync/model-sync-operation.js.map +0 -1
  981. package/esm/sync/model-sync.d.ts +0 -130
  982. package/esm/sync/model-sync.d.ts.map +0 -1
  983. package/esm/sync/model-sync.js +0 -178
  984. package/esm/sync/model-sync.js.map +0 -1
  985. package/esm/sync/sync-context.d.ts +0 -70
  986. package/esm/sync/sync-context.d.ts.map +0 -1
  987. package/esm/sync/sync-context.js +0 -101
  988. package/esm/sync/sync-context.js.map +0 -1
  989. package/esm/sync/sync-manager.d.ts +0 -213
  990. package/esm/sync/sync-manager.d.ts.map +0 -1
  991. package/esm/sync/sync-manager.js +0 -689
  992. package/esm/sync/sync-manager.js.map +0 -1
  993. package/esm/sync/types.d.ts +0 -289
  994. package/esm/sync/types.d.ts.map +0 -1
  995. package/esm/test-migrations/test-enhanced-features.migration.d.ts +0 -15
  996. package/esm/test-migrations/test-enhanced-features.migration.d.ts.map +0 -1
  997. package/esm/types.d.ts +0 -371
  998. package/esm/types.d.ts.map +0 -1
  999. package/esm/utils/connect-to-database.d.ts +0 -307
  1000. package/esm/utils/connect-to-database.d.ts.map +0 -1
  1001. package/esm/utils/connect-to-database.js +0 -130
  1002. package/esm/utils/connect-to-database.js.map +0 -1
  1003. package/esm/utils/database-writer.utils.d.ts +0 -15
  1004. package/esm/utils/database-writer.utils.d.ts.map +0 -1
  1005. package/esm/utils/database-writer.utils.js +0 -14
  1006. package/esm/utils/database-writer.utils.js.map +0 -1
  1007. package/esm/utils/define-model.js +0 -100
  1008. package/esm/utils/define-model.js.map +0 -1
  1009. package/esm/utils/is-valid-date-value.d.ts +0 -5
  1010. package/esm/utils/is-valid-date-value.d.ts.map +0 -1
  1011. package/esm/utils/is-valid-date-value.js +0 -25
  1012. package/esm/utils/is-valid-date-value.js.map +0 -1
  1013. package/esm/utils/once-connected.d.ts +0 -146
  1014. package/esm/utils/once-connected.d.ts.map +0 -1
  1015. package/esm/utils/once-connected.js +0 -251
  1016. package/esm/utils/once-connected.js.map +0 -1
  1017. package/esm/validation/database-seal-plugins.d.ts +0 -12
  1018. package/esm/validation/database-seal-plugins.d.ts.map +0 -1
  1019. package/esm/validation/database-seal-plugins.js +0 -1
  1020. package/esm/validation/database-seal-plugins.js.map +0 -1
  1021. package/esm/validation/database-writer-validation-error.d.ts +0 -97
  1022. package/esm/validation/database-writer-validation-error.d.ts.map +0 -1
  1023. package/esm/validation/database-writer-validation-error.js +0 -160
  1024. package/esm/validation/database-writer-validation-error.js.map +0 -1
  1025. package/esm/validation/index.d.ts +0 -3
  1026. package/esm/validation/index.d.ts.map +0 -1
  1027. package/esm/validation/mutators/embed-mutator.d.ts +0 -9
  1028. package/esm/validation/mutators/embed-mutator.d.ts.map +0 -1
  1029. package/esm/validation/mutators/embed-mutator.js +0 -33
  1030. package/esm/validation/mutators/embed-mutator.js.map +0 -1
  1031. package/esm/validation/plugins/embed-validator-plugin.d.ts +0 -24
  1032. package/esm/validation/plugins/embed-validator-plugin.d.ts.map +0 -1
  1033. package/esm/validation/plugins/embed-validator-plugin.js +0 -18
  1034. package/esm/validation/plugins/embed-validator-plugin.js.map +0 -1
  1035. package/esm/validation/rules/database-model-rule.d.ts +0 -7
  1036. package/esm/validation/rules/database-model-rule.d.ts.map +0 -1
  1037. package/esm/validation/rules/database-model-rule.js +0 -27
  1038. package/esm/validation/rules/database-model-rule.js.map +0 -1
  1039. package/esm/validation/transformers/embed-model-transformer.d.ts +0 -3
  1040. package/esm/validation/transformers/embed-model-transformer.d.ts.map +0 -1
  1041. package/esm/validation/transformers/embed-model-transformer.js +0 -18
  1042. package/esm/validation/transformers/embed-model-transformer.js.map +0 -1
  1043. package/esm/validation/validators/embed-validator.d.ts +0 -21
  1044. package/esm/validation/validators/embed-validator.d.ts.map +0 -1
  1045. package/esm/validation/validators/embed-validator.js +0 -43
  1046. package/esm/validation/validators/embed-validator.js.map +0 -1
  1047. package/esm/writer/database-writer.d.ts +0 -174
  1048. package/esm/writer/database-writer.d.ts.map +0 -1
  1049. package/esm/writer/database-writer.js +0 -400
  1050. package/esm/writer/database-writer.js.map +0 -1
@@ -0,0 +1,2083 @@
1
+ import { ColumnBuilder } from "./column-builder.mjs";
2
+ import { ForeignKeyBuilder } from "./foreign-key-builder.mjs";
3
+
4
+ //#region ../../@warlock.js/cascade/src/migration/migration.ts
5
+ /**
6
+ * Base class for all database migrations.
7
+ *
8
+ * Provides a fluent API for defining schema changes that work across
9
+ * both SQL and NoSQL databases. The migration driver handles translating
10
+ * operations to native database commands.
11
+ *
12
+ * Migrations are executed in order based on their `createdAt` timestamp,
13
+ * which is typically extracted from the filename (e.g., `2024-01-15_create-users`).
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Using Migration.for() to bind to a model
18
+ * export default class extends Migration.for(User) {
19
+ * public up(): void {
20
+ * this.string("email").unique();
21
+ * this.integer("age").nullable();
22
+ * this.geoIndex("location");
23
+ * }
24
+ *
25
+ * public down(): void {
26
+ * this.dropColumn("email");
27
+ * this.dropColumn("age");
28
+ * this.dropGeoIndex("location");
29
+ * }
30
+ * }
31
+ * ```
32
+ *
33
+ * @example
34
+ * ```typescript
35
+ * // Manual table migration (without model binding)
36
+ * export default class CreateUsersTable extends Migration {
37
+ * public readonly table = "users";
38
+ *
39
+ * public up(): void {
40
+ * this.createTable();
41
+ * this.id();
42
+ * this.string("name");
43
+ * this.string("email").unique();
44
+ * this.timestamps();
45
+ * }
46
+ *
47
+ * public down(): void {
48
+ * this.dropTable();
49
+ * }
50
+ * }
51
+ * ```
52
+ */
53
+ var Migration = class {
54
+ /**
55
+ * Migration name that will be labeled with
56
+ * If record is enabled in migration, it will be stored as migration name
57
+ * in database
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * "2024-01-15_create-users";
62
+ * ```
63
+ */
64
+ static migrationName;
65
+ /**
66
+ * Table/collection name for this migration.
67
+ *
68
+ * Must be defined by each migration class (either directly or via `Migration.for()`).
69
+ */
70
+ table;
71
+ /**
72
+ * Sort order
73
+ * If not provided, it will be ordered alphabetically
74
+ */
75
+ static order;
76
+ /**
77
+ * Optional data source override.
78
+ *
79
+ * If specified, this migration will use a specific data source
80
+ * instead of the default one. Can be a string name or DataSource instance.
81
+ */
82
+ dataSource;
83
+ /**
84
+ * Optional timestamp override.
85
+ *
86
+ * By default, the migration runner extracts this from the filename.
87
+ * Set explicitly to override the execution order.
88
+ *
89
+ * Format: ISO 8601 or any parseable date string.
90
+ */
91
+ static createdAt;
92
+ /**
93
+ * Whether to wrap migration in a transaction.
94
+ *
95
+ * Defaults to `true` for SQL databases that support DDL transactions.
96
+ * Set to `false` for operations that cannot be transactional.
97
+ *
98
+ * Note: MongoDB does not support transactions for most DDL operations.
99
+ */
100
+ transactional;
101
+ /**
102
+ * Migration driver instance (injected by the runner).
103
+ */
104
+ driver;
105
+ /**
106
+ * Migration defaults from the resolved DataSource.
107
+ * @internal
108
+ */
109
+ /** @internal — readable by factory-generated subclasses */
110
+ _migrationDefaults;
111
+ /**
112
+ * Queued operations to execute.
113
+ */
114
+ pendingOperations = [];
115
+ /**
116
+ * Create a migration class bound to a specific model.
117
+ *
118
+ * Automatically inherits the model's table name and data source,
119
+ * reducing boilerplate and ensuring consistency.
120
+ *
121
+ * @param model - Model class to bind
122
+ * @returns Abstract migration class bound to the model
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * export default class extends Migration.for(User) {
127
+ * public up(): void {
128
+ * this.string("avatar").nullable();
129
+ * }
130
+ *
131
+ * public down(): void {
132
+ * this.dropColumn("avatar");
133
+ * }
134
+ * }
135
+ * ```
136
+ */
137
+ static for(model) {
138
+ class BoundMigration extends Migration {
139
+ table = model.table;
140
+ dataSource = model.dataSource;
141
+ }
142
+ return BoundMigration;
143
+ }
144
+ /**
145
+ * Create a migration that executes raw SQL statements.
146
+ *
147
+ * Intended for external packages that ship engine-specific DDL — typically a
148
+ * one-shot `CREATE TABLE` bundle whose `up` is the only direction that matters.
149
+ * The `down` direction is optional; when omitted, rollback is a recorded no-op.
150
+ *
151
+ * Raw SQL is engine-locked by definition. This factory is rejected on MongoDB
152
+ * data sources at execute time — use the fluent builder for cross-engine work.
153
+ *
154
+ * @param options - Migration name, SQL statements, and optional overrides
155
+ * @returns Migration constructor ready to register with the runner
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * export const createAuthTables = Migration.rawSql({
160
+ * name: "create_auth_tables",
161
+ * up: [
162
+ * `CREATE TABLE users (id UUID PRIMARY KEY, email TEXT UNIQUE NOT NULL)`,
163
+ * `CREATE TABLE sessions (id UUID PRIMARY KEY, user_id UUID REFERENCES users(id))`,
164
+ * ],
165
+ * });
166
+ * ```
167
+ */
168
+ static rawSql(options) {
169
+ const { name, up, down, dataSource, transactional } = options;
170
+ const toStatements = (input) => Array.isArray(input) ? input : [input];
171
+ class RawSqlMigration extends Migration {
172
+ table = "";
173
+ dataSource = dataSource;
174
+ transactional = transactional;
175
+ up() {
176
+ this.guardEngine();
177
+ for (const sql of toStatements(up)) this.raw(sql);
178
+ }
179
+ down() {
180
+ if (down === void 0) return;
181
+ this.guardEngine();
182
+ for (const sql of toStatements(down)) this.raw(sql);
183
+ }
184
+ guardEngine() {
185
+ if (this.databaseEngine === "mongodb") throw new Error(`Migration.rawSql ("${name}") is not supported on mongodb data sources — use the fluent builder instead.`);
186
+ }
187
+ }
188
+ RawSqlMigration.migrationName = name;
189
+ return RawSqlMigration;
190
+ }
191
+ /**
192
+ * Set the migration driver.
193
+ *
194
+ * Called by the migration runner before executing up/down.
195
+ *
196
+ * @param driver - Migration driver instance
197
+ * @internal
198
+ */
199
+ setDriver(driver) {
200
+ this.driver = driver;
201
+ }
202
+ /**
203
+ * Set migration defaults from the resolved DataSource.
204
+ *
205
+ * @param defaults - Migration defaults (UUID strategy, etc.)
206
+ * @internal
207
+ */
208
+ setMigrationDefaults(defaults) {
209
+ this._migrationDefaults = defaults;
210
+ }
211
+ /**
212
+ * Get the migration driver.
213
+ *
214
+ * @returns The migration driver instance
215
+ */
216
+ getDriver() {
217
+ return this.driver;
218
+ }
219
+ /**
220
+ * Get database engine (MongoDB, Postgress...etc)
221
+ */
222
+ get databaseEngine() {
223
+ return this.driver.driver.name;
224
+ }
225
+ /**
226
+ * Execute all pending operations.
227
+ *
228
+ * @deprecated Use toSQL() instead — migrations now generate SQL rather than
229
+ * executing DDL directly through the driver.
230
+ * @internal
231
+ */
232
+ async execute() {
233
+ for (const op of this.pendingOperations) await this.executeOperation(op);
234
+ this.pendingOperations.length = 0;
235
+ }
236
+ /**
237
+ * Serialize all queued pending operations into a flat list of SQL strings.
238
+ *
239
+ * Call this AFTER invoking `up()` or `down()` to extract the SQL for the
240
+ * operations that were queued during that call. The pending queue is cleared
241
+ * after serializing so the instance is safe to reuse.
242
+ *
243
+ * @example
244
+ * ```typescript
245
+ * const migration = new CreateUsersTable();
246
+ * migration.setDriver(driver);
247
+ *
248
+ * // Up SQL
249
+ * await migration.up();
250
+ * const upSQL = migration.toSQL();
251
+ *
252
+ * // Down SQL — reuse the same instance
253
+ * await migration.down();
254
+ * const downSQL = migration.toSQL();
255
+ * ```
256
+ */
257
+ toSQL() {
258
+ const statements = this.driver.driver.getSQLSerializer().serializeAll(this.pendingOperations, this.table);
259
+ this.pendingOperations.length = 0;
260
+ return statements;
261
+ }
262
+ /**
263
+ * Execute a single pending operation.
264
+ */
265
+ async executeOperation(op) {
266
+ switch (op.type) {
267
+ case "addColumn": {
268
+ const column = op.payload;
269
+ await this.driver.addColumn(this.table, column);
270
+ if (column.checkConstraint) await this.driver.addCheck(this.table, column.checkConstraint.name, column.checkConstraint.expression);
271
+ break;
272
+ }
273
+ case "dropColumn":
274
+ await this.driver.dropColumn(this.table, op.payload);
275
+ break;
276
+ case "dropColumns":
277
+ await this.driver.dropColumns(this.table, op.payload);
278
+ break;
279
+ case "renameColumn": {
280
+ const { from, to } = op.payload;
281
+ await this.driver.renameColumn(this.table, from, to);
282
+ break;
283
+ }
284
+ case "modifyColumn":
285
+ await this.driver.modifyColumn(this.table, op.payload);
286
+ break;
287
+ case "createIndex":
288
+ await this.driver.createIndex(this.table, op.payload);
289
+ break;
290
+ case "dropIndex":
291
+ await this.driver.dropIndex(this.table, op.payload);
292
+ break;
293
+ case "createUniqueIndex": {
294
+ const { columns, name } = op.payload;
295
+ await this.driver.createUniqueIndex(this.table, columns, name);
296
+ break;
297
+ }
298
+ case "dropUniqueIndex":
299
+ await this.driver.dropUniqueIndex(this.table, op.payload);
300
+ break;
301
+ case "createFullTextIndex": {
302
+ const { columns, options } = op.payload;
303
+ await this.driver.createFullTextIndex(this.table, columns, options);
304
+ break;
305
+ }
306
+ case "dropFullTextIndex":
307
+ await this.driver.dropFullTextIndex(this.table, op.payload);
308
+ break;
309
+ case "createGeoIndex": {
310
+ const { column, options } = op.payload;
311
+ await this.driver.createGeoIndex(this.table, column, options);
312
+ break;
313
+ }
314
+ case "dropGeoIndex":
315
+ await this.driver.dropGeoIndex(this.table, op.payload);
316
+ break;
317
+ case "createVectorIndex": {
318
+ const { column, options } = op.payload;
319
+ await this.driver.createVectorIndex(this.table, column, options);
320
+ break;
321
+ }
322
+ case "dropVectorIndex":
323
+ await this.driver.dropVectorIndex(this.table, op.payload);
324
+ break;
325
+ case "createTTLIndex": {
326
+ const { column, seconds } = op.payload;
327
+ await this.driver.createTTLIndex(this.table, column, seconds);
328
+ break;
329
+ }
330
+ case "dropTTLIndex":
331
+ await this.driver.dropTTLIndex(this.table, op.payload);
332
+ break;
333
+ case "addForeignKey":
334
+ await this.driver.addForeignKey(this.table, op.payload);
335
+ break;
336
+ case "dropForeignKey":
337
+ await this.driver.dropForeignKey(this.table, op.payload);
338
+ break;
339
+ case "addPrimaryKey":
340
+ await this.driver.addPrimaryKey(this.table, op.payload);
341
+ break;
342
+ case "dropPrimaryKey":
343
+ await this.driver.dropPrimaryKey(this.table);
344
+ break;
345
+ case "addCheck": {
346
+ const { name, expression } = op.payload;
347
+ await this.driver.addCheck(this.table, name, expression);
348
+ break;
349
+ }
350
+ case "dropCheck":
351
+ await this.driver.dropCheck(this.table, op.payload);
352
+ break;
353
+ case "createTable":
354
+ await this.driver.createTable(this.table);
355
+ break;
356
+ case "createTableIfNotExists":
357
+ await this.driver.createTableIfNotExists(this.table);
358
+ break;
359
+ case "dropTable":
360
+ await this.driver.dropTable(this.table);
361
+ break;
362
+ case "dropTableIfExists":
363
+ await this.driver.dropTableIfExists(this.table);
364
+ break;
365
+ case "renameTable":
366
+ await this.driver.renameTable(this.table, op.payload);
367
+ break;
368
+ case "truncateTable":
369
+ await this.driver.truncateTable(this.table);
370
+ break;
371
+ case "createTimestamps":
372
+ await this.driver.createTimestampColumns(this.table);
373
+ break;
374
+ case "rawStatement":
375
+ await this.driver.raw(async (client) => {
376
+ const sql = op.payload;
377
+ if (typeof client.query === "function") await client.query(sql);
378
+ else if (typeof client.command === "function") await client.command({ $eval: sql });
379
+ else throw new Error("Unsupported database driver for statement execution");
380
+ });
381
+ break;
382
+ case "setSchemaValidation":
383
+ await this.driver.setSchemaValidation(this.table, op.payload);
384
+ break;
385
+ case "removeSchemaValidation":
386
+ await this.driver.removeSchemaValidation(this.table);
387
+ break;
388
+ }
389
+ }
390
+ /**
391
+ * Check if a table exists.
392
+ *
393
+ * Useful for conditional migrations and idempotent operations.
394
+ *
395
+ * @param tableName - Table name to check
396
+ * @returns Promise resolving to true if table exists
397
+ *
398
+ * @example
399
+ * ```typescript
400
+ * public async up() {
401
+ * if (await this.hasTable("users_backup")) {
402
+ * this.dropTable("users_backup");
403
+ * }
404
+ * // ... rest of migration
405
+ * }
406
+ * ```
407
+ */
408
+ async hasTable(tableName) {
409
+ return this.driver.tableExists(tableName);
410
+ }
411
+ /**
412
+ * Check if a column exists in the current table.
413
+ *
414
+ * @param columnName - Column name to check
415
+ * @returns Promise resolving to true if column exists
416
+ *
417
+ * @example
418
+ * ```typescript
419
+ * public async up() {
420
+ * if (!(await this.hasColumn("email"))) {
421
+ * this.string("email").unique();
422
+ * }
423
+ * }
424
+ * ```
425
+ */
426
+ async hasColumn(columnName) {
427
+ return (await this.getColumns()).some((col) => col.name === columnName);
428
+ }
429
+ /**
430
+ * Get all columns in the current table.
431
+ *
432
+ * @returns Promise resolving to array of column definitions
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * const columns = await this.getColumns();
437
+ * if (columns.find(col => col.type === "string" && !col.length)) {
438
+ * // migrate all unbounded strings
439
+ * }
440
+ * ```
441
+ */
442
+ async getColumns() {
443
+ return this.driver.listColumns(this.table);
444
+ }
445
+ /**
446
+ * List all tables in the current database/connection.
447
+ *
448
+ * @returns Promise resolving to array of table names
449
+ *
450
+ * @example
451
+ * ```typescript
452
+ * const tables = await this.listTables();
453
+ * for (const table of tables) {
454
+ * // process each table
455
+ * }
456
+ * ```
457
+ */
458
+ async listTables() {
459
+ return this.driver.listTables();
460
+ }
461
+ /**
462
+ * Get all indexes on the current table.
463
+ */
464
+ async getIndexes() {
465
+ return this.driver.listIndexes(this.table);
466
+ }
467
+ /**
468
+ * Check if a named index exists on the current table.
469
+ */
470
+ async hasIndex(indexName) {
471
+ return (await this.getIndexes()).some((idx) => idx.name === indexName);
472
+ }
473
+ /**
474
+ * Add a pending index definition.
475
+ *
476
+ * Called by ColumnBuilder when .unique() or .index() is chained.
477
+ * Routes into pendingOperations so indexes execute in definition order
478
+ * alongside columns and constraints.
479
+ *
480
+ * @param index - Index definition
481
+ * @internal
482
+ */
483
+ addPendingIndex(index) {
484
+ if (index.unique) this.pendingOperations.push({
485
+ type: "createUniqueIndex",
486
+ payload: {
487
+ columns: index.columns,
488
+ name: index.name
489
+ }
490
+ });
491
+ else this.pendingOperations.push({
492
+ type: "createIndex",
493
+ payload: index
494
+ });
495
+ }
496
+ /**
497
+ * Add a foreign key operation.
498
+ *
499
+ * Called by ForeignKeyBuilder or ColumnBuilder when .references() is called.
500
+ *
501
+ * @param fk - Foreign key definition
502
+ * @internal
503
+ */
504
+ addForeignKeyOperation(fk) {
505
+ this.pendingOperations.push({
506
+ type: "addForeignKey",
507
+ payload: fk
508
+ });
509
+ }
510
+ /**
511
+ * Create the table/collection.
512
+ *
513
+ * For SQL, this creates an empty table.
514
+ * For MongoDB, this creates the collection.
515
+ *
516
+ * @returns This migration for chaining
517
+ */
518
+ createTable() {
519
+ this.pendingOperations.push({
520
+ type: "createTable",
521
+ payload: null
522
+ });
523
+ return this;
524
+ }
525
+ /**
526
+ * Create table if not exists
527
+ */
528
+ createTableIfNotExists() {
529
+ this.pendingOperations.push({
530
+ type: "createTableIfNotExists",
531
+ payload: null
532
+ });
533
+ return this;
534
+ }
535
+ /**
536
+ * Drop the table/collection.
537
+ *
538
+ * @returns This migration for chaining
539
+ */
540
+ dropTable() {
541
+ this.pendingOperations.push({
542
+ type: "dropTable",
543
+ payload: null
544
+ });
545
+ return this;
546
+ }
547
+ /**
548
+ * Drop the table/collection if it exists.
549
+ *
550
+ * No error is thrown if the table doesn't exist.
551
+ *
552
+ * @returns This migration for chaining
553
+ */
554
+ dropTableIfExists() {
555
+ this.pendingOperations.push({
556
+ type: "dropTableIfExists",
557
+ payload: null
558
+ });
559
+ return this;
560
+ }
561
+ /**
562
+ * Rename the table/collection.
563
+ *
564
+ * @param newName - New table name
565
+ * @returns This migration for chaining
566
+ */
567
+ renameTableTo(newName) {
568
+ this.pendingOperations.push({
569
+ type: "renameTable",
570
+ payload: newName
571
+ });
572
+ return this;
573
+ }
574
+ /**
575
+ * Truncate the table — remove all rows without logging or firing triggers.
576
+ *
577
+ * Faster than DELETE with no WHERE clause. Resets auto-increment counters
578
+ * on most databases.
579
+ *
580
+ * @returns This migration for chaining
581
+ */
582
+ truncateTable() {
583
+ this.pendingOperations.push({
584
+ type: "truncateTable",
585
+ payload: null
586
+ });
587
+ return this;
588
+ }
589
+ /**
590
+ * Add a string/varchar column.
591
+ *
592
+ * @param column - Column name
593
+ * @param length - Max length (default: 255)
594
+ * @returns Column builder for chaining modifiers
595
+ *
596
+ * @example
597
+ * ```typescript
598
+ * this.string("name"); // VARCHAR(255)
599
+ * this.string("code", 10); // VARCHAR(10)
600
+ * ```
601
+ */
602
+ string(column, length = 255) {
603
+ const builder = new ColumnBuilder(this, column, "string", { length });
604
+ this.pendingOperations.push({
605
+ type: "addColumn",
606
+ payload: builder.getDefinition()
607
+ });
608
+ return builder;
609
+ }
610
+ /**
611
+ * Add a fixed-length char column.
612
+ *
613
+ * @param column - Column name
614
+ * @param length - Exact length
615
+ * @returns Column builder for chaining modifiers
616
+ */
617
+ char(column, length) {
618
+ const builder = new ColumnBuilder(this, column, "char", { length });
619
+ this.pendingOperations.push({
620
+ type: "addColumn",
621
+ payload: builder.getDefinition()
622
+ });
623
+ return builder;
624
+ }
625
+ /**
626
+ * Add a text column (unlimited length).
627
+ *
628
+ * @param column - Column name
629
+ * @returns Column builder for chaining modifiers
630
+ */
631
+ text(column) {
632
+ const builder = new ColumnBuilder(this, column, "text");
633
+ this.pendingOperations.push({
634
+ type: "addColumn",
635
+ payload: builder.getDefinition()
636
+ });
637
+ return builder;
638
+ }
639
+ /**
640
+ * Add a medium text column.
641
+ *
642
+ * @param column - Column name
643
+ * @returns Column builder for chaining modifiers
644
+ */
645
+ mediumText(column) {
646
+ const builder = new ColumnBuilder(this, column, "mediumText");
647
+ this.pendingOperations.push({
648
+ type: "addColumn",
649
+ payload: builder.getDefinition()
650
+ });
651
+ return builder;
652
+ }
653
+ /**
654
+ * Add a long text column.
655
+ *
656
+ * @param column - Column name
657
+ * @returns Column builder for chaining modifiers
658
+ */
659
+ longText(column) {
660
+ const builder = new ColumnBuilder(this, column, "longText");
661
+ this.pendingOperations.push({
662
+ type: "addColumn",
663
+ payload: builder.getDefinition()
664
+ });
665
+ return builder;
666
+ }
667
+ /**
668
+ * Add an integer column.
669
+ *
670
+ * @param column - Column name
671
+ * @returns Column builder for chaining modifiers
672
+ */
673
+ integer(column) {
674
+ const builder = new ColumnBuilder(this, column, "integer");
675
+ this.pendingOperations.push({
676
+ type: "addColumn",
677
+ payload: builder.getDefinition()
678
+ });
679
+ return builder;
680
+ }
681
+ /**
682
+ * Alias for integer().
683
+ */
684
+ int(column) {
685
+ return this.integer(column);
686
+ }
687
+ /**
688
+ * Add a small integer column.
689
+ *
690
+ * @param column - Column name
691
+ * @returns Column builder for chaining modifiers
692
+ */
693
+ smallInteger(column) {
694
+ const builder = new ColumnBuilder(this, column, "smallInteger");
695
+ this.pendingOperations.push({
696
+ type: "addColumn",
697
+ payload: builder.getDefinition()
698
+ });
699
+ return builder;
700
+ }
701
+ /**
702
+ * Alias for smallInteger().
703
+ */
704
+ smallInt(column) {
705
+ return this.smallInteger(column);
706
+ }
707
+ /**
708
+ * Add a tiny integer column.
709
+ *
710
+ * @param column - Column name
711
+ * @returns Column builder for chaining modifiers
712
+ */
713
+ tinyInteger(column) {
714
+ const builder = new ColumnBuilder(this, column, "tinyInteger");
715
+ this.pendingOperations.push({
716
+ type: "addColumn",
717
+ payload: builder.getDefinition()
718
+ });
719
+ return builder;
720
+ }
721
+ /**
722
+ * Alias for tinyInteger().
723
+ */
724
+ tinyInt(column) {
725
+ return this.tinyInteger(column);
726
+ }
727
+ /**
728
+ * Add a big integer column.
729
+ *
730
+ * @param column - Column name
731
+ * @returns Column builder for chaining modifiers
732
+ */
733
+ bigInteger(column) {
734
+ const builder = new ColumnBuilder(this, column, "bigInteger");
735
+ this.pendingOperations.push({
736
+ type: "addColumn",
737
+ payload: builder.getDefinition()
738
+ });
739
+ return builder;
740
+ }
741
+ /**
742
+ * Alias for bigInteger().
743
+ */
744
+ bigInt(column) {
745
+ return this.bigInteger(column);
746
+ }
747
+ /**
748
+ * Add a float column.
749
+ *
750
+ * @param column - Column name
751
+ * @returns Column builder for chaining modifiers
752
+ */
753
+ float(column) {
754
+ const builder = new ColumnBuilder(this, column, "float");
755
+ this.pendingOperations.push({
756
+ type: "addColumn",
757
+ payload: builder.getDefinition()
758
+ });
759
+ return builder;
760
+ }
761
+ /**
762
+ * Add a double precision column.
763
+ *
764
+ * @param column - Column name
765
+ * @returns Column builder for chaining modifiers
766
+ */
767
+ double(column) {
768
+ const builder = new ColumnBuilder(this, column, "double");
769
+ this.pendingOperations.push({
770
+ type: "addColumn",
771
+ payload: builder.getDefinition()
772
+ });
773
+ return builder;
774
+ }
775
+ /**
776
+ * Add a decimal column with precision and scale.
777
+ *
778
+ * @param column - Column name
779
+ * @param precision - Total digits (default: 8)
780
+ * @param scale - Decimal places (default: 2)
781
+ * @returns Column builder for chaining modifiers
782
+ *
783
+ * @example
784
+ * ```typescript
785
+ * this.decimal("price", 10, 2); // DECIMAL(10,2) - up to 99999999.99
786
+ * ```
787
+ */
788
+ decimal(column, precision = 8, scale = 2) {
789
+ const builder = new ColumnBuilder(this, column, "decimal", {
790
+ precision,
791
+ scale
792
+ });
793
+ this.pendingOperations.push({
794
+ type: "addColumn",
795
+ payload: builder.getDefinition()
796
+ });
797
+ return builder;
798
+ }
799
+ /**
800
+ * Add a boolean column.
801
+ *
802
+ * @param column - Column name
803
+ * @returns Column builder for chaining modifiers
804
+ */
805
+ boolean(column) {
806
+ const builder = new ColumnBuilder(this, column, "boolean");
807
+ this.pendingOperations.push({
808
+ type: "addColumn",
809
+ payload: builder.getDefinition()
810
+ });
811
+ return builder;
812
+ }
813
+ /**
814
+ * Alias for boolean().
815
+ */
816
+ bool(column) {
817
+ return this.boolean(column);
818
+ }
819
+ /**
820
+ * Add a date column (date only, no time).
821
+ *
822
+ * @param column - Column name
823
+ * @returns Column builder for chaining modifiers
824
+ */
825
+ date(column) {
826
+ const builder = new ColumnBuilder(this, column, "date");
827
+ this.pendingOperations.push({
828
+ type: "addColumn",
829
+ payload: builder.getDefinition()
830
+ });
831
+ return builder;
832
+ }
833
+ /**
834
+ * Add a datetime column (date and time).
835
+ *
836
+ * @param column - Column name
837
+ * @returns Column builder for chaining modifiers
838
+ */
839
+ dateTime(column) {
840
+ const builder = new ColumnBuilder(this, column, "dateTime");
841
+ this.pendingOperations.push({
842
+ type: "addColumn",
843
+ payload: builder.getDefinition()
844
+ });
845
+ return builder;
846
+ }
847
+ /**
848
+ * Add a timestamp column.
849
+ *
850
+ * @param column - Column name
851
+ * @returns Column builder for chaining modifiers
852
+ */
853
+ timestamp(column) {
854
+ const builder = new ColumnBuilder(this, column, "timestamp");
855
+ this.pendingOperations.push({
856
+ type: "addColumn",
857
+ payload: builder.getDefinition()
858
+ });
859
+ return builder;
860
+ }
861
+ /**
862
+ * Add a time column (time only, no date).
863
+ *
864
+ * @param column - Column name
865
+ * @returns Column builder for chaining modifiers
866
+ */
867
+ time(column) {
868
+ const builder = new ColumnBuilder(this, column, "time");
869
+ this.pendingOperations.push({
870
+ type: "addColumn",
871
+ payload: builder.getDefinition()
872
+ });
873
+ return builder;
874
+ }
875
+ /**
876
+ * Add a year column.
877
+ *
878
+ * @param column - Column name
879
+ * @returns Column builder for chaining modifiers
880
+ */
881
+ year(column) {
882
+ const builder = new ColumnBuilder(this, column, "year");
883
+ this.pendingOperations.push({
884
+ type: "addColumn",
885
+ payload: builder.getDefinition()
886
+ });
887
+ return builder;
888
+ }
889
+ /**
890
+ * Add a JSON column.
891
+ *
892
+ * @param column - Column name
893
+ * @returns Column builder for chaining modifiers
894
+ */
895
+ json(column) {
896
+ const builder = new ColumnBuilder(this, column, "json");
897
+ this.pendingOperations.push({
898
+ type: "addColumn",
899
+ payload: builder.getDefinition()
900
+ });
901
+ return builder;
902
+ }
903
+ /**
904
+ * Alias for json().
905
+ */
906
+ object(column) {
907
+ return this.json(column);
908
+ }
909
+ /**
910
+ * Add a binary/blob column.
911
+ *
912
+ * @param column - Column name
913
+ * @returns Column builder for chaining modifiers
914
+ */
915
+ binary(column) {
916
+ const builder = new ColumnBuilder(this, column, "binary");
917
+ this.pendingOperations.push({
918
+ type: "addColumn",
919
+ payload: builder.getDefinition()
920
+ });
921
+ return builder;
922
+ }
923
+ /**
924
+ * Alias for binary().
925
+ */
926
+ blob(column) {
927
+ return this.binary(column);
928
+ }
929
+ /**
930
+ * Add a UUID column.
931
+ *
932
+ * @param column - Column name
933
+ * @returns Column builder for chaining modifiers
934
+ */
935
+ uuid(column) {
936
+ const builder = new ColumnBuilder(this, column, "uuid");
937
+ this.pendingOperations.push({
938
+ type: "addColumn",
939
+ payload: builder.getDefinition()
940
+ });
941
+ return builder;
942
+ }
943
+ /**
944
+ * Add a ULID column.
945
+ *
946
+ * @param column - Column name
947
+ * @returns Column builder for chaining modifiers
948
+ */
949
+ ulid(column) {
950
+ const builder = new ColumnBuilder(this, column, "ulid");
951
+ this.pendingOperations.push({
952
+ type: "addColumn",
953
+ payload: builder.getDefinition()
954
+ });
955
+ return builder;
956
+ }
957
+ /**
958
+ * Add an IP address column.
959
+ *
960
+ * @param column - Column name
961
+ * @returns Column builder for chaining modifiers
962
+ */
963
+ ipAddress(column) {
964
+ const builder = new ColumnBuilder(this, column, "ipAddress");
965
+ this.pendingOperations.push({
966
+ type: "addColumn",
967
+ payload: builder.getDefinition()
968
+ });
969
+ return builder;
970
+ }
971
+ /**
972
+ * Add a MAC address column.
973
+ *
974
+ * @param column - Column name
975
+ * @returns Column builder for chaining modifiers
976
+ */
977
+ macAddress(column) {
978
+ const builder = new ColumnBuilder(this, column, "macAddress");
979
+ this.pendingOperations.push({
980
+ type: "addColumn",
981
+ payload: builder.getDefinition()
982
+ });
983
+ return builder;
984
+ }
985
+ /**
986
+ * Add a geo point column.
987
+ *
988
+ * @param column - Column name
989
+ * @returns Column builder for chaining modifiers
990
+ */
991
+ point(column) {
992
+ const builder = new ColumnBuilder(this, column, "point");
993
+ this.pendingOperations.push({
994
+ type: "addColumn",
995
+ payload: builder.getDefinition()
996
+ });
997
+ return builder;
998
+ }
999
+ /**
1000
+ * Add a polygon column.
1001
+ *
1002
+ * @param column - Column name
1003
+ * @returns Column builder for chaining modifiers
1004
+ */
1005
+ polygon(column) {
1006
+ const builder = new ColumnBuilder(this, column, "polygon");
1007
+ this.pendingOperations.push({
1008
+ type: "addColumn",
1009
+ payload: builder.getDefinition()
1010
+ });
1011
+ return builder;
1012
+ }
1013
+ /**
1014
+ * Add a line string column.
1015
+ *
1016
+ * @param column - Column name
1017
+ * @returns Column builder for chaining modifiers
1018
+ */
1019
+ lineString(column) {
1020
+ const builder = new ColumnBuilder(this, column, "lineString");
1021
+ this.pendingOperations.push({
1022
+ type: "addColumn",
1023
+ payload: builder.getDefinition()
1024
+ });
1025
+ return builder;
1026
+ }
1027
+ /**
1028
+ * Add a generic geometry column.
1029
+ *
1030
+ * @param column - Column name
1031
+ * @returns Column builder for chaining modifiers
1032
+ */
1033
+ geometry(column) {
1034
+ const builder = new ColumnBuilder(this, column, "geometry");
1035
+ this.pendingOperations.push({
1036
+ type: "addColumn",
1037
+ payload: builder.getDefinition()
1038
+ });
1039
+ return builder;
1040
+ }
1041
+ /**
1042
+ * Add a vector column for AI embeddings.
1043
+ *
1044
+ * Used for storing and searching ML embeddings (e.g., OpenAI, Cohere).
1045
+ *
1046
+ * @param column - Column name
1047
+ * @param dimensions - Vector dimensions (e.g., 1536 for OpenAI ada-002)
1048
+ * @returns Column builder for chaining modifiers
1049
+ *
1050
+ * @example
1051
+ * ```typescript
1052
+ * this.vector("embedding", 1536); // OpenAI ada-002
1053
+ * this.vector("embedding", 384); // Sentence Transformers
1054
+ * ```
1055
+ */
1056
+ vector(column, dimensions) {
1057
+ const builder = new ColumnBuilder(this, column, "vector", { dimensions });
1058
+ this.pendingOperations.push({
1059
+ type: "addColumn",
1060
+ payload: builder.getDefinition()
1061
+ });
1062
+ return builder;
1063
+ }
1064
+ /**
1065
+ * Add an enum column with allowed values.
1066
+ *
1067
+ * @param column - Column name
1068
+ * @param values - Allowed enum values
1069
+ * @returns Column builder for chaining modifiers
1070
+ *
1071
+ * @example
1072
+ * ```typescript
1073
+ * this.enum("status", ["pending", "active", "archived"]);
1074
+ * ```
1075
+ */
1076
+ enum(column, values) {
1077
+ const builder = new ColumnBuilder(this, column, "enum", { values });
1078
+ this.pendingOperations.push({
1079
+ type: "addColumn",
1080
+ payload: builder.getDefinition()
1081
+ });
1082
+ return builder;
1083
+ }
1084
+ /**
1085
+ * Add a set column (multiple values from a set).
1086
+ *
1087
+ * @param column - Column name
1088
+ * @param values - Allowed set values
1089
+ * @returns Column builder for chaining modifiers
1090
+ */
1091
+ set(column, values) {
1092
+ const builder = new ColumnBuilder(this, column, "set", { values });
1093
+ this.pendingOperations.push({
1094
+ type: "addColumn",
1095
+ payload: builder.getDefinition()
1096
+ });
1097
+ return builder;
1098
+ }
1099
+ /**
1100
+ * Add an INTEGER[] column (array of integers).
1101
+ *
1102
+ * @example
1103
+ * ```typescript
1104
+ * this.arrayInt("scores"); // INTEGER[]
1105
+ * ```
1106
+ */
1107
+ arrayInt(column) {
1108
+ const builder = new ColumnBuilder(this, column, "arrayInt");
1109
+ this.pendingOperations.push({
1110
+ type: "addColumn",
1111
+ payload: builder.getDefinition()
1112
+ });
1113
+ return builder;
1114
+ }
1115
+ /**
1116
+ * Add a BIGINT[] column (array of big integers).
1117
+ *
1118
+ * @example
1119
+ * ```typescript
1120
+ * this.arrayBigInt("ids"); // BIGINT[]
1121
+ * ```
1122
+ */
1123
+ arrayBigInt(column) {
1124
+ const builder = new ColumnBuilder(this, column, "arrayBigInt");
1125
+ this.pendingOperations.push({
1126
+ type: "addColumn",
1127
+ payload: builder.getDefinition()
1128
+ });
1129
+ return builder;
1130
+ }
1131
+ /**
1132
+ * Add a REAL[] column (array of floats).
1133
+ *
1134
+ * @example
1135
+ * ```typescript
1136
+ * this.arrayFloat("weights"); // REAL[]
1137
+ * ```
1138
+ */
1139
+ arrayFloat(column) {
1140
+ const builder = new ColumnBuilder(this, column, "arrayFloat");
1141
+ this.pendingOperations.push({
1142
+ type: "addColumn",
1143
+ payload: builder.getDefinition()
1144
+ });
1145
+ return builder;
1146
+ }
1147
+ /**
1148
+ * Add a DECIMAL[] column (array of decimals).
1149
+ *
1150
+ * @param precision - Total digits
1151
+ * @param scale - Digits after decimal point
1152
+ *
1153
+ * @example
1154
+ * ```typescript
1155
+ * this.arrayDecimal("prices", 10, 2); // DECIMAL(10,2)[]
1156
+ * this.arrayDecimal("amounts"); // DECIMAL[]
1157
+ * ```
1158
+ */
1159
+ arrayDecimal(column, precision, scale) {
1160
+ const builder = new ColumnBuilder(this, column, "arrayDecimal", {
1161
+ precision,
1162
+ scale
1163
+ });
1164
+ this.pendingOperations.push({
1165
+ type: "addColumn",
1166
+ payload: builder.getDefinition()
1167
+ });
1168
+ return builder;
1169
+ }
1170
+ /**
1171
+ * Add a BOOLEAN[] column (array of booleans).
1172
+ *
1173
+ * @example
1174
+ * ```typescript
1175
+ * this.arrayBoolean("flags"); // BOOLEAN[]
1176
+ * ```
1177
+ */
1178
+ arrayBoolean(column) {
1179
+ const builder = new ColumnBuilder(this, column, "arrayBoolean");
1180
+ this.pendingOperations.push({
1181
+ type: "addColumn",
1182
+ payload: builder.getDefinition()
1183
+ });
1184
+ return builder;
1185
+ }
1186
+ /**
1187
+ * Add a TEXT[] column (array of text values).
1188
+ *
1189
+ * @example
1190
+ * ```typescript
1191
+ * this.arrayText("tags"); // TEXT[]
1192
+ * ```
1193
+ */
1194
+ arrayText(column) {
1195
+ const builder = new ColumnBuilder(this, column, "arrayText");
1196
+ this.pendingOperations.push({
1197
+ type: "addColumn",
1198
+ payload: builder.getDefinition()
1199
+ });
1200
+ return builder;
1201
+ }
1202
+ /**
1203
+ * Add a DATE[] column (array of dates).
1204
+ *
1205
+ * @example
1206
+ * ```typescript
1207
+ * this.arrayDate("holidays"); // DATE[]
1208
+ * ```
1209
+ */
1210
+ arrayDate(column) {
1211
+ const builder = new ColumnBuilder(this, column, "arrayDate");
1212
+ this.pendingOperations.push({
1213
+ type: "addColumn",
1214
+ payload: builder.getDefinition()
1215
+ });
1216
+ return builder;
1217
+ }
1218
+ /**
1219
+ * Add a TIMESTAMPTZ[] column (array of timestamps with time zone).
1220
+ *
1221
+ * @example
1222
+ * ```typescript
1223
+ * this.arrayTimestamp("events"); // TIMESTAMPTZ[]
1224
+ * ```
1225
+ */
1226
+ arrayTimestamp(column) {
1227
+ const builder = new ColumnBuilder(this, column, "arrayTimestamp");
1228
+ this.pendingOperations.push({
1229
+ type: "addColumn",
1230
+ payload: builder.getDefinition()
1231
+ });
1232
+ return builder;
1233
+ }
1234
+ /**
1235
+ * Add a UUID[] column (array of UUIDs).
1236
+ *
1237
+ * @example
1238
+ * ```typescript
1239
+ * this.arrayUuid("relatedIds"); // UUID[]
1240
+ * ```
1241
+ */
1242
+ arrayUuid(column) {
1243
+ const builder = new ColumnBuilder(this, column, "arrayUuid");
1244
+ this.pendingOperations.push({
1245
+ type: "addColumn",
1246
+ payload: builder.getDefinition()
1247
+ });
1248
+ return builder;
1249
+ }
1250
+ /**
1251
+ * Add a JSONB[] column — array of JSON objects.
1252
+ *
1253
+ * @example
1254
+ * ```typescript
1255
+ * this.arrayJson("metadata"); // JSONB[]
1256
+ * ```
1257
+ */
1258
+ arrayJson(column) {
1259
+ const builder = new ColumnBuilder(this, column, "arrayJson");
1260
+ this.pendingOperations.push({
1261
+ type: "addColumn",
1262
+ payload: builder.getDefinition()
1263
+ });
1264
+ return builder;
1265
+ }
1266
+ /**
1267
+ * Add an auto-increment primary key column.
1268
+ *
1269
+ * Creates an unsigned integer with primary key and auto-increment.
1270
+ *
1271
+ * @param name - Column name (default: "id")
1272
+ * @returns Column builder for chaining modifiers
1273
+ *
1274
+ * @example
1275
+ * ```typescript
1276
+ * this.id(); // Creates "id" column
1277
+ * this.id("userId"); // Creates "userId" column
1278
+ * ```
1279
+ */
1280
+ id(name = "id") {
1281
+ return this.integer(name).primary().autoIncrement().unsigned();
1282
+ }
1283
+ /**
1284
+ * Add a big integer auto-increment primary key column.
1285
+ *
1286
+ * @param name - Column name (default: "id")
1287
+ * @returns Column builder for chaining modifiers
1288
+ */
1289
+ bigId(name = "id") {
1290
+ return this.bigInteger(name).primary().autoIncrement().unsigned();
1291
+ }
1292
+ /**
1293
+ * Add a UUID primary key column.
1294
+ *
1295
+ * @param name - Column name (default: "id")
1296
+ * @returns Column builder for chaining modifiers
1297
+ */
1298
+ uuidId(name = "id") {
1299
+ return this.uuid(name).primary();
1300
+ }
1301
+ /**
1302
+ * Add a UUID primary key column with automatic generation.
1303
+ *
1304
+ * Delegates UUID expression to the migration driver, which resolves
1305
+ * the default based on `migrationDefaults` from the DataSource config.
1306
+ *
1307
+ * Resolution order:
1308
+ * 1. `migrationDefaults.uuidExpression` (raw escape hatch)
1309
+ * 2. `migrationDefaults.uuidStrategy` (mapped per driver)
1310
+ * 3. Driver default (PostgreSQL: `gen_random_uuid()`, MongoDB: undefined)
1311
+ *
1312
+ * @param name - Column name (default: "id")
1313
+ * @returns Column builder for chaining modifiers
1314
+ *
1315
+ * @example
1316
+ * ```typescript
1317
+ * this.primaryUuid(); // id UUID PRIMARY KEY DEFAULT gen_random_uuid()
1318
+ * this.primaryUuid("organization_id"); // Custom column name
1319
+ * ```
1320
+ */
1321
+ primaryUuid(name = "id") {
1322
+ const uuidDefault = this.driver.getUuidDefault(this._migrationDefaults);
1323
+ const builder = this.uuid(name).primary();
1324
+ if (uuidDefault) builder.default(uuidDefault);
1325
+ return builder;
1326
+ }
1327
+ /**
1328
+ * Add createdAt and updatedAt timestamp columns.
1329
+ *
1330
+ * Behavior varies by database driver:
1331
+ * - PostgreSQL: Creates TIMESTAMPTZ columns with NOW() defaults
1332
+ * - MongoDB: No-op (timestamps handled at application level)
1333
+ *
1334
+ * @returns This migration for chaining
1335
+ *
1336
+ * @example
1337
+ * ```typescript
1338
+ * this.timestamps(); // Driver-specific implementation
1339
+ * ```
1340
+ */
1341
+ timestamps() {
1342
+ this.pendingOperations.push({
1343
+ type: "createTimestamps",
1344
+ payload: null
1345
+ });
1346
+ return this;
1347
+ }
1348
+ /**
1349
+ * Add a deletedAt column for soft deletes.
1350
+ *
1351
+ * @param column - Column name (default: "deletedAt")
1352
+ * @returns Column builder for chaining modifiers
1353
+ */
1354
+ softDeletes(column = "deletedAt") {
1355
+ return this.dateTime(column).nullable();
1356
+ }
1357
+ /**
1358
+ * Drop a column.
1359
+ *
1360
+ * @param column - Column name to drop
1361
+ * @returns This migration for chaining
1362
+ */
1363
+ dropColumn(column) {
1364
+ this.pendingOperations.push({
1365
+ type: "dropColumn",
1366
+ payload: column
1367
+ });
1368
+ return this;
1369
+ }
1370
+ /**
1371
+ * Drop multiple columns.
1372
+ *
1373
+ * @param columns - Column names to drop
1374
+ * @returns This migration for chaining
1375
+ */
1376
+ dropColumns(...columns) {
1377
+ this.pendingOperations.push({
1378
+ type: "dropColumns",
1379
+ payload: columns
1380
+ });
1381
+ return this;
1382
+ }
1383
+ /**
1384
+ * Rename a column.
1385
+ *
1386
+ * @param from - Current column name
1387
+ * @param to - New column name
1388
+ * @returns This migration for chaining
1389
+ */
1390
+ renameColumn(from, to) {
1391
+ this.pendingOperations.push({
1392
+ type: "renameColumn",
1393
+ payload: {
1394
+ from,
1395
+ to
1396
+ }
1397
+ });
1398
+ return this;
1399
+ }
1400
+ /**
1401
+ * Create an index on one or more columns.
1402
+ *
1403
+ * @param columns - Column(s) to index
1404
+ * @param name - Optional index name
1405
+ * @param options - Optional index options (include, concurrently)
1406
+ * @returns This migration for chaining
1407
+ *
1408
+ * @example
1409
+ * ```typescript
1410
+ * this.index("email");
1411
+ * this.index(["firstName", "lastName"], "name_idx");
1412
+ * this.index("userId", "idx_user", { include: ["name", "email"] });
1413
+ * this.index("email", "idx_email", { concurrently: true });
1414
+ * ```
1415
+ */
1416
+ index(columns, name, options) {
1417
+ const cols = Array.isArray(columns) ? columns : [columns];
1418
+ this.pendingOperations.push({
1419
+ type: "createIndex",
1420
+ payload: {
1421
+ columns: cols,
1422
+ name,
1423
+ include: options?.include,
1424
+ concurrently: options?.concurrently
1425
+ }
1426
+ });
1427
+ return this;
1428
+ }
1429
+ /**
1430
+ * Drop an index by name or columns.
1431
+ *
1432
+ * @param nameOrColumns - Index name (string) or columns array
1433
+ * @returns This migration for chaining
1434
+ *
1435
+ * @example
1436
+ * ```typescript
1437
+ * this.dropIndex("email_idx"); // Drop by name
1438
+ * this.dropIndex(["firstName", "lastName"]); // Drop by columns
1439
+ * ```
1440
+ */
1441
+ dropIndex(nameOrColumns) {
1442
+ this.pendingOperations.push({
1443
+ type: "dropIndex",
1444
+ payload: nameOrColumns
1445
+ });
1446
+ return this;
1447
+ }
1448
+ /**
1449
+ * Create a unique constraint/index.
1450
+ *
1451
+ * @param columns - Column(s) to make unique
1452
+ * @param name - Optional constraint name
1453
+ * @param options - Optional index options (include, concurrently)
1454
+ * @returns This migration for chaining
1455
+ *
1456
+ * @example
1457
+ * ```typescript
1458
+ * this.unique("email");
1459
+ * this.unique(["userId", "roleId"], "unique_user_role");
1460
+ * this.unique("email", "unique_email", { include: ["name"] });
1461
+ * ```
1462
+ */
1463
+ unique(columns, name, options) {
1464
+ const cols = Array.isArray(columns) ? columns : [columns];
1465
+ this.pendingOperations.push({
1466
+ type: "createUniqueIndex",
1467
+ payload: {
1468
+ columns: cols,
1469
+ name,
1470
+ include: options?.include,
1471
+ concurrently: options?.concurrently
1472
+ }
1473
+ });
1474
+ return this;
1475
+ }
1476
+ /**
1477
+ * Drop a unique constraint/index.
1478
+ *
1479
+ * @param columns - Columns in the unique constraint
1480
+ * @returns This migration for chaining
1481
+ */
1482
+ dropUnique(columns) {
1483
+ const cols = Array.isArray(columns) ? columns : [columns];
1484
+ this.pendingOperations.push({
1485
+ type: "dropUniqueIndex",
1486
+ payload: cols
1487
+ });
1488
+ return this;
1489
+ }
1490
+ /**
1491
+ * Create an expression-based index.
1492
+ *
1493
+ * Allows indexing on SQL expressions rather than plain columns.
1494
+ * Useful for case-insensitive searches, computed values, etc.
1495
+ *
1496
+ * **Note**: PostgreSQL-specific feature. MongoDB will silently ignore this.
1497
+ *
1498
+ * @param expressions - SQL expression(s) to index
1499
+ * @param name - Optional index name
1500
+ * @param options - Optional index options (concurrently)
1501
+ * @returns This migration for chaining
1502
+ *
1503
+ * @example
1504
+ * ```typescript
1505
+ * // Case-insensitive email index
1506
+ * this.expressionIndex(['lower(email)'], 'idx_email_lower');
1507
+ *
1508
+ * // Multiple expressions
1509
+ * this.expressionIndex(['lower(firstName)', 'lower(lastName)'], 'idx_name_lower');
1510
+ *
1511
+ * // With concurrent creation (requires transactional = false)
1512
+ * this.expressionIndex(['lower(email)'], 'idx_email_lower', { concurrently: true });
1513
+ * ```
1514
+ */
1515
+ expressionIndex(expressions, name, options) {
1516
+ const exprs = Array.isArray(expressions) ? expressions : [expressions];
1517
+ this.pendingOperations.push({
1518
+ type: "createIndex",
1519
+ payload: {
1520
+ columns: [],
1521
+ expressions: exprs,
1522
+ name,
1523
+ concurrently: options?.concurrently
1524
+ }
1525
+ });
1526
+ return this;
1527
+ }
1528
+ /**
1529
+ * Create a full-text search index.
1530
+ *
1531
+ * @param columns - Column(s) to index
1532
+ * @param options - Full-text options
1533
+ * @returns This migration for chaining
1534
+ */
1535
+ fullText(columns, options) {
1536
+ const cols = Array.isArray(columns) ? columns : [columns];
1537
+ this.pendingOperations.push({
1538
+ type: "createFullTextIndex",
1539
+ payload: {
1540
+ columns: cols,
1541
+ options
1542
+ }
1543
+ });
1544
+ return this;
1545
+ }
1546
+ /**
1547
+ * Drop a full-text search index.
1548
+ *
1549
+ * @param name - Index name
1550
+ * @returns This migration for chaining
1551
+ */
1552
+ dropFullText(name) {
1553
+ this.pendingOperations.push({
1554
+ type: "dropFullTextIndex",
1555
+ payload: name
1556
+ });
1557
+ return this;
1558
+ }
1559
+ /**
1560
+ * Create a geo-spatial index.
1561
+ *
1562
+ * @param column - Geo column
1563
+ * @param options - Geo index options
1564
+ * @returns This migration for chaining
1565
+ *
1566
+ * @example
1567
+ * ```typescript
1568
+ * this.geoIndex("location"); // 2dsphere index
1569
+ * this.geoIndex("coordinates", { type: "2d" }); // 2d index
1570
+ * ```
1571
+ */
1572
+ geoIndex(column, options) {
1573
+ this.pendingOperations.push({
1574
+ type: "createGeoIndex",
1575
+ payload: {
1576
+ column,
1577
+ options
1578
+ }
1579
+ });
1580
+ return this;
1581
+ }
1582
+ /**
1583
+ * Drop a geo-spatial index.
1584
+ *
1585
+ * @param column - Geo column
1586
+ * @returns This migration for chaining
1587
+ */
1588
+ dropGeoIndex(column) {
1589
+ this.pendingOperations.push({
1590
+ type: "dropGeoIndex",
1591
+ payload: column
1592
+ });
1593
+ return this;
1594
+ }
1595
+ /**
1596
+ * Create a vector search index for AI embeddings.
1597
+ *
1598
+ * @param column - Vector column
1599
+ * @param options - Vector index options
1600
+ * @returns This migration for chaining
1601
+ *
1602
+ * @example
1603
+ * ```typescript
1604
+ * this.vectorIndex("embedding", {
1605
+ * dimensions: 1536,
1606
+ * similarity: "cosine",
1607
+ * });
1608
+ * ```
1609
+ */
1610
+ vectorIndex(column, options) {
1611
+ this.pendingOperations.push({
1612
+ type: "createVectorIndex",
1613
+ payload: {
1614
+ column,
1615
+ options
1616
+ }
1617
+ });
1618
+ return this;
1619
+ }
1620
+ /**
1621
+ * Drop a vector search index.
1622
+ *
1623
+ * @param column - Vector column
1624
+ * @returns This migration for chaining
1625
+ */
1626
+ dropVectorIndex(column) {
1627
+ this.pendingOperations.push({
1628
+ type: "dropVectorIndex",
1629
+ payload: column
1630
+ });
1631
+ return this;
1632
+ }
1633
+ /**
1634
+ * Create a TTL (time-to-live) index for automatic document expiration.
1635
+ *
1636
+ * Primarily for MongoDB. Documents are automatically deleted after the
1637
+ * specified time has passed since the date in the column.
1638
+ *
1639
+ * @param column - Date column to check for expiration
1640
+ * @param expireAfterSeconds - Seconds after which documents expire
1641
+ * @returns This migration for chaining
1642
+ *
1643
+ * @example
1644
+ * ```typescript
1645
+ * // Delete sessions 24 hours after createdAt
1646
+ * this.ttlIndex("createdAt", 86400);
1647
+ * ```
1648
+ */
1649
+ ttlIndex(column, expireAfterSeconds) {
1650
+ this.pendingOperations.push({
1651
+ type: "createTTLIndex",
1652
+ payload: {
1653
+ column,
1654
+ seconds: expireAfterSeconds
1655
+ }
1656
+ });
1657
+ return this;
1658
+ }
1659
+ /**
1660
+ * Drop a TTL index.
1661
+ *
1662
+ * @param column - Column with TTL
1663
+ * @returns This migration for chaining
1664
+ */
1665
+ dropTTLIndex(column) {
1666
+ this.pendingOperations.push({
1667
+ type: "dropTTLIndex",
1668
+ payload: column
1669
+ });
1670
+ return this;
1671
+ }
1672
+ /**
1673
+ * Add a composite primary key.
1674
+ *
1675
+ * @param columns - Columns to include in the primary key
1676
+ * @returns This migration for chaining
1677
+ */
1678
+ primaryKey(columns) {
1679
+ this.pendingOperations.push({
1680
+ type: "addPrimaryKey",
1681
+ payload: columns
1682
+ });
1683
+ return this;
1684
+ }
1685
+ /**
1686
+ * Drop the primary key constraint.
1687
+ *
1688
+ * @returns This migration for chaining
1689
+ */
1690
+ dropPrimaryKey() {
1691
+ this.pendingOperations.push({
1692
+ type: "dropPrimaryKey",
1693
+ payload: null
1694
+ });
1695
+ return this;
1696
+ }
1697
+ /**
1698
+ * Add a CHECK constraint to the table.
1699
+ *
1700
+ * SQL-only feature. PostgreSQL, MySQL 8.0+, SQLite support this.
1701
+ * Validates that rows satisfy the given SQL expression.
1702
+ *
1703
+ * @param name - Constraint name
1704
+ * @param expression - SQL CHECK expression
1705
+ * @returns This migration for chaining
1706
+ *
1707
+ * @example
1708
+ * ```typescript
1709
+ * this.check("age_positive", "age >= 0");
1710
+ * this.check("valid_email", "email LIKE '%@%'");
1711
+ * this.check("price_range", "price BETWEEN 0 AND 1000000");
1712
+ * ```
1713
+ */
1714
+ check(name, expression) {
1715
+ this.pendingOperations.push({
1716
+ type: "addCheck",
1717
+ payload: {
1718
+ name,
1719
+ expression
1720
+ }
1721
+ });
1722
+ return this;
1723
+ }
1724
+ /**
1725
+ * Drop a CHECK constraint by name.
1726
+ *
1727
+ * @param name - Constraint name
1728
+ * @returns This migration for chaining
1729
+ *
1730
+ * @example
1731
+ * ```typescript
1732
+ * this.dropCheck("age_positive");
1733
+ * ```
1734
+ */
1735
+ dropCheck(name) {
1736
+ this.pendingOperations.push({
1737
+ type: "dropCheck",
1738
+ payload: name
1739
+ });
1740
+ return this;
1741
+ }
1742
+ /**
1743
+ * Start building a foreign key constraint on an existing column.
1744
+ *
1745
+ * Use this when adding a foreign key to a column that was defined in a
1746
+ * previous migration. For new columns, prefer the inline form:
1747
+ * `this.integer("user_id").references("users").onDelete("cascade")`
1748
+ *
1749
+ * SQL-only feature; NoSQL drivers ignore foreign keys.
1750
+ *
1751
+ * @param column - Local column that references another table
1752
+ * @returns Foreign key builder for chaining
1753
+ *
1754
+ * @example
1755
+ * ```typescript
1756
+ * this.foreign("user_id")
1757
+ * .references("users", "id")
1758
+ * .onDelete("cascade");
1759
+ * ```
1760
+ */
1761
+ foreign(column) {
1762
+ return new ForeignKeyBuilder(this, column);
1763
+ }
1764
+ /**
1765
+ * Drop a foreign key constraint.
1766
+ *
1767
+ * Two calling forms:
1768
+ *
1769
+ * 1. Auto-compute the name (matches what `addForeignKey` generates):
1770
+ * ```typescript
1771
+ * this.dropForeign("unit_id", Unit.table);
1772
+ * // → drops: fk_{table}_unit_id_units
1773
+ * ```
1774
+ *
1775
+ * 2. Raw constraint name (use when the name was set explicitly):
1776
+ * ```typescript
1777
+ * this.dropForeign("my_custom_fk_name");
1778
+ * ```
1779
+ *
1780
+ * @param columnOrConstraint - Column name (auto mode) or raw constraint name (raw mode)
1781
+ * @param referencesTable - Referenced table name; triggers auto-name computation when provided
1782
+ * @returns This migration for chaining
1783
+ */
1784
+ dropForeign(columnOrConstraint, referencesTable) {
1785
+ const constraintName = referencesTable ? `fk_${this.table}_${columnOrConstraint}_${referencesTable}` : columnOrConstraint;
1786
+ this.pendingOperations.push({
1787
+ type: "dropForeignKey",
1788
+ payload: constraintName
1789
+ });
1790
+ return this;
1791
+ }
1792
+ /**
1793
+ * Set JSON schema validation rules on the collection.
1794
+ *
1795
+ * MongoDB-only feature. SQL databases ignore this.
1796
+ *
1797
+ * @param schema - JSON Schema object
1798
+ * @returns This migration for chaining
1799
+ *
1800
+ * @example
1801
+ * ```typescript
1802
+ * this.schemaValidation({
1803
+ * bsonType: "object",
1804
+ * required: ["name", "email"],
1805
+ * properties: {
1806
+ * name: { bsonType: "string" },
1807
+ * email: { bsonType: "string" },
1808
+ * },
1809
+ * });
1810
+ * ```
1811
+ */
1812
+ schemaValidation(schema) {
1813
+ this.pendingOperations.push({
1814
+ type: "setSchemaValidation",
1815
+ payload: schema
1816
+ });
1817
+ return this;
1818
+ }
1819
+ /**
1820
+ * Remove schema validation rules from the collection.
1821
+ *
1822
+ * @returns This migration for chaining
1823
+ */
1824
+ dropSchemaValidation() {
1825
+ this.pendingOperations.push({
1826
+ type: "removeSchemaValidation",
1827
+ payload: null
1828
+ });
1829
+ return this;
1830
+ }
1831
+ /**
1832
+ * Execute raw operations with direct driver/connection access.
1833
+ *
1834
+ * Use this when you need to bypass the migration API entirely and
1835
+ * interact with the native database driver directly.
1836
+ *
1837
+ * @param callback - Callback receiving the native connection
1838
+ * @returns Result from callback
1839
+ *
1840
+ * @example
1841
+ * ```typescript
1842
+ * await this.withConnection(async (db) => {
1843
+ * await db.collection("users").updateMany({}, { $set: { active: true } });
1844
+ * });
1845
+ * ```
1846
+ */
1847
+ async withConnection(callback) {
1848
+ return this.driver.raw(callback);
1849
+ }
1850
+ /**
1851
+ * Queue a raw SQL string for execution within the migration.
1852
+ *
1853
+ * The statement is queued and executed in order with other migration
1854
+ * operations, within the transaction context if the migration is transactional.
1855
+ *
1856
+ * Use `withConnection()` instead if you need direct driver access.
1857
+ *
1858
+ * Works with PostgreSQL, MySQL, etc. For MongoDB, uses $eval command.
1859
+ *
1860
+ * @param sql - SQL statement to execute
1861
+ * @returns This migration for chaining
1862
+ *
1863
+ * @example
1864
+ * ```typescript
1865
+ * // Enable PostgreSQL extension
1866
+ * this.raw('CREATE EXTENSION IF NOT EXISTS "uuid-ossp"');
1867
+ *
1868
+ * // Create custom type
1869
+ * this.raw('CREATE TYPE mood AS ENUM (\'happy\', \'sad\', \'neutral\')');
1870
+ * ```
1871
+ */
1872
+ raw(sql) {
1873
+ this.pendingOperations.push({
1874
+ type: "rawStatement",
1875
+ payload: sql
1876
+ });
1877
+ return this;
1878
+ }
1879
+ /**
1880
+ * Create a declarative initial-table migration.
1881
+ * Implemented and assigned below the class body.
1882
+ */
1883
+ static create;
1884
+ /**
1885
+ * Create a declarative alteration migration.
1886
+ * Implemented and assigned below the class body.
1887
+ */
1888
+ static alter;
1889
+ };
1890
+ function migrate(model, options) {
1891
+ return class AnonymousMigration extends Migration {
1892
+ static migrationName = options?.name;
1893
+ static createdAt = options?.createdAt;
1894
+ table = model.table;
1895
+ static transactional = options?.transactional;
1896
+ async up() {
1897
+ await options?.up?.call(this);
1898
+ }
1899
+ async down() {
1900
+ await options?.down?.call(this);
1901
+ }
1902
+ };
1903
+ }
1904
+ /**
1905
+ * Wire a `ColumnMap` onto an active migration instance.
1906
+ *
1907
+ * Fixes up the placeholder column name in each `DetachedColumnBuilder`,
1908
+ * pushes the `addColumn` operation, and transfers any pending FK / index
1909
+ * side effects from the detached sink to the real migration.
1910
+ *
1911
+ * @internal
1912
+ */
1913
+ function wireColumns(migration, columns) {
1914
+ for (const [columnName, detached] of Object.entries(columns)) {
1915
+ const definition = detached.getDefinition();
1916
+ definition.name = columnName;
1917
+ migration.pendingOperations.push({
1918
+ type: "addColumn",
1919
+ payload: definition
1920
+ });
1921
+ for (const idx of detached.sink.pendingIndexes) {
1922
+ idx.columns = idx.columns.map((col) => col === "__placeholder__" ? columnName : col);
1923
+ migration.addPendingIndex(idx);
1924
+ }
1925
+ for (const fk of detached.sink.pendingForeignKeys) {
1926
+ fk.column = columnName;
1927
+ migration.addForeignKeyOperation(fk);
1928
+ }
1929
+ if (detached.sink.pendingVectorIndexes) for (const vIdx of detached.sink.pendingVectorIndexes) {
1930
+ vIdx.column = columnName;
1931
+ migration.vectorIndex(vIdx.column, vIdx.options);
1932
+ }
1933
+ }
1934
+ }
1935
+ /**
1936
+ * Create a declarative initial-table migration.
1937
+ *
1938
+ * Automatically handles:
1939
+ * - `createTableIfNotExists()`
1940
+ * - Primary key (type resolved from `migrationDefaults.primaryKey` → options → `"int"`)
1941
+ * - `timestamps()`
1942
+ * - `down()` → `dropTableIfExists()`
1943
+ *
1944
+ * The class-based API remains available for complex migrations (raw SQL,
1945
+ * data backfills, conditional logic).
1946
+ *
1947
+ * @param model - Model class to bind (provides table name + data source)
1948
+ * @param columns - Column definitions keyed by column name
1949
+ * @param options - Optional overrides
1950
+ *
1951
+ * @example
1952
+ * ```typescript
1953
+ * import { Migration, uuid, text, timestamp } from "@warlock.js/cascade";
1954
+ * import { Organization } from "app/organizations/models/organization";
1955
+ * import { Chat } from "../chat.model";
1956
+ *
1957
+ * export default Migration.create(Chat, {
1958
+ * organization_id: uuid().references(Organization).onDelete("cascade"),
1959
+ * title: text(),
1960
+ * status: text(),
1961
+ * started_at: timestamp().default("NOW()"),
1962
+ * closed_at: timestamp().nullable(),
1963
+ * }, { order: 5 });
1964
+ * ```
1965
+ */
1966
+ Migration.create = function createMigration(model, columns, options = {}) {
1967
+ const { order = 0, createdAt, primaryKey: primaryKeyOverride, timestamps: withTimestamps = true, transactional } = options;
1968
+ return class DeclarativeMigration extends Migration {
1969
+ static order = order;
1970
+ static createdAt = createdAt;
1971
+ static transactional = transactional;
1972
+ table = model.table;
1973
+ dataSource = model.dataSource;
1974
+ async up() {
1975
+ this.createTableIfNotExists();
1976
+ const pkType = primaryKeyOverride !== void 0 ? primaryKeyOverride : this._migrationDefaults?.primaryKey ?? "int";
1977
+ if (pkType === "uuid") this.primaryUuid();
1978
+ else if (pkType === "bigInt") this.bigId();
1979
+ else if (pkType === "int") this.id();
1980
+ wireColumns(this, columns);
1981
+ if (withTimestamps) this.timestamps();
1982
+ if (options.index) for (const entry of options.index) this.index(entry.columns, entry.name, {
1983
+ include: entry.include,
1984
+ concurrently: entry.concurrently
1985
+ });
1986
+ if (options.unique) for (const entry of options.unique) this.unique(entry.columns, entry.name, {
1987
+ include: entry.include,
1988
+ concurrently: entry.concurrently
1989
+ });
1990
+ if (options.raw) {
1991
+ const rawQueries = Array.isArray(options.raw) ? options.raw : [options.raw];
1992
+ for (const query of rawQueries) this.raw(query);
1993
+ }
1994
+ if (options.up) await options.up.call(this);
1995
+ }
1996
+ async down() {
1997
+ if (options.down) await options.down.call(this);
1998
+ this.dropTableIfExists();
1999
+ }
2000
+ };
2001
+ };
2002
+ /**
2003
+ * Create a declarative alteration migration.
2004
+ *
2005
+ * @param model - Model class to bind
2006
+ * @param schema - What to add / drop / rename / modify
2007
+ * @param options - Optional overrides
2008
+ *
2009
+ * @example
2010
+ * ```typescript
2011
+ * import { Migration, text } from "@warlock.js/cascade";
2012
+ * import { User } from "../user.model";
2013
+ *
2014
+ * export default Migration.alter(User, {
2015
+ * add: {
2016
+ * phone: text().nullable(),
2017
+ * avatar: text().nullable(),
2018
+ * },
2019
+ * drop: ["legacy_field"],
2020
+ * rename: { old_name: "new_name" },
2021
+ * });
2022
+ * ```
2023
+ */
2024
+ Migration.alter = function alterMigration(model, schema, options = {}) {
2025
+ const { order = 0, createdAt, transactional } = options;
2026
+ return class AlterMigration extends Migration {
2027
+ static order = order;
2028
+ static createdAt = createdAt;
2029
+ static transactional = transactional;
2030
+ table = model.table;
2031
+ dataSource = model.dataSource;
2032
+ async up() {
2033
+ if (schema.add) wireColumns(this, schema.add);
2034
+ if (schema.drop) for (const col of schema.drop) this.dropColumn(col);
2035
+ if (schema.rename) for (const [from, to] of Object.entries(schema.rename)) this.renameColumn(from, to);
2036
+ if (schema.modify) for (const [columnName, detached] of Object.entries(schema.modify)) {
2037
+ const definition = detached.getDefinition();
2038
+ definition.name = columnName;
2039
+ this.pendingOperations.push({
2040
+ type: "modifyColumn",
2041
+ payload: definition
2042
+ });
2043
+ for (const fk of detached.sink.pendingForeignKeys) {
2044
+ fk.column = columnName;
2045
+ this.addForeignKeyOperation(fk);
2046
+ }
2047
+ }
2048
+ if (schema.addIndex) for (const { columns, name, options: opts } of schema.addIndex) this.index(columns, name, opts);
2049
+ if (schema.dropIndex) for (const target of schema.dropIndex) this.dropIndex(target);
2050
+ if (schema.addUnique) for (const { columns, name, options: opts } of schema.addUnique) this.unique(columns, name, opts);
2051
+ if (schema.dropUnique) for (const cols of schema.dropUnique) this.dropUnique(cols);
2052
+ if (schema.addExpressionIndex) for (const { expressions, name, options: opts } of schema.addExpressionIndex) this.expressionIndex(expressions, name, opts);
2053
+ if (schema.addFullText) for (const { columns, options: opts } of schema.addFullText) this.fullText(columns, opts);
2054
+ if (schema.dropFullText) for (const name of schema.dropFullText) this.dropFullText(name);
2055
+ if (schema.addGeoIndex) for (const { column, options: opts } of schema.addGeoIndex) this.geoIndex(column, opts);
2056
+ if (schema.dropGeoIndex) for (const column of schema.dropGeoIndex) this.dropGeoIndex(column);
2057
+ if (schema.addVectorIndex) for (const { column, options: opts } of schema.addVectorIndex) this.vectorIndex(column, opts);
2058
+ if (schema.dropVectorIndex) for (const column of schema.dropVectorIndex) this.dropVectorIndex(column);
2059
+ if (schema.addTTLIndex) for (const { column, expireAfterSeconds } of schema.addTTLIndex) this.ttlIndex(column, expireAfterSeconds);
2060
+ if (schema.dropTTLIndex) for (const column of schema.dropTTLIndex) this.dropTTLIndex(column);
2061
+ if (schema.addForeign) for (const fk of schema.addForeign) {
2062
+ const tableName = typeof fk.references === "string" ? fk.references : fk.references.table;
2063
+ this.foreign(fk.column).references(tableName, fk.on ?? "id").onDelete(fk.onDelete ?? "restrict").onUpdate(fk.onUpdate ?? "restrict");
2064
+ }
2065
+ if (schema.dropForeign) for (const { columnOrConstraint, referencesTable } of schema.dropForeign) this.dropForeign(columnOrConstraint, referencesTable);
2066
+ if (schema.addCheck) for (const { name, expression } of schema.addCheck) this.check(name, expression);
2067
+ if (schema.dropCheck) for (const name of schema.dropCheck) this.dropCheck(name);
2068
+ if (schema.raw) {
2069
+ const rawQueries = Array.isArray(schema.raw) ? schema.raw : [schema.raw];
2070
+ for (const query of rawQueries) this.raw(query);
2071
+ }
2072
+ if (options.up) await options.up.call(this);
2073
+ }
2074
+ async down() {
2075
+ if (options.down) await options.down.call(this);
2076
+ }
2077
+ };
2078
+ };
2079
+ Migration.__declarativeFactoriesAttached = true;
2080
+
2081
+ //#endregion
2082
+ export { Migration, migrate };
2083
+ //# sourceMappingURL=migration.mjs.map