@warlock.js/cascade 5.30.0 → 5.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +1 -5
  3. package/cjs/index.cjs +104 -86
  4. package/cjs/index.cjs.map +1 -1
  5. package/esm/context/database-data-source-context.d.mts +2 -3
  6. package/esm/context/database-data-source-context.d.mts.map +1 -1
  7. package/esm/context/database-transaction-context.d.mts +2 -3
  8. package/esm/context/database-transaction-context.d.mts.map +1 -1
  9. package/esm/contracts/database-driver.contract.d.mts +56 -36
  10. package/esm/contracts/database-driver.contract.d.mts.map +1 -1
  11. package/esm/contracts/database-id-generator.contract.d.mts +7 -5
  12. package/esm/contracts/database-id-generator.contract.d.mts.map +1 -1
  13. package/esm/contracts/database-remover.contract.d.mts +3 -5
  14. package/esm/contracts/database-remover.contract.d.mts.map +1 -1
  15. package/esm/contracts/database-restorer.contract.d.mts +6 -6
  16. package/esm/contracts/database-restorer.contract.d.mts.map +1 -1
  17. package/esm/contracts/database-writer.contract.d.mts +4 -6
  18. package/esm/contracts/database-writer.contract.d.mts.map +1 -1
  19. package/esm/contracts/driver-blueprint.contract.d.mts +2 -3
  20. package/esm/contracts/driver-blueprint.contract.d.mts.map +1 -1
  21. package/esm/contracts/index.d.mts +2 -1
  22. package/esm/contracts/migration-driver.contract.d.mts +101 -53
  23. package/esm/contracts/migration-driver.contract.d.mts.map +1 -1
  24. package/esm/contracts/query-builder.contract.d.mts +51 -33
  25. package/esm/contracts/query-builder.contract.d.mts.map +1 -1
  26. package/esm/contracts/sync-adapter.contract.d.mts +25 -14
  27. package/esm/contracts/sync-adapter.contract.d.mts.map +1 -1
  28. package/esm/data-source/data-source-registry.d.mts +4 -5
  29. package/esm/data-source/data-source-registry.d.mts.map +1 -1
  30. package/esm/data-source/data-source-registry.mjs.map +1 -1
  31. package/esm/data-source/data-source.d.mts +8 -5
  32. package/esm/data-source/data-source.d.mts.map +1 -1
  33. package/esm/database-dirty-tracker.d.mts +2 -2
  34. package/esm/database-dirty-tracker.d.mts.map +1 -1
  35. package/esm/database-dirty-tracker.mjs +3 -2
  36. package/esm/database-dirty-tracker.mjs.map +1 -1
  37. package/esm/drivers/mongodb/mongodb-driver.d.mts +3 -4
  38. package/esm/drivers/mongodb/mongodb-driver.d.mts.map +1 -1
  39. package/esm/drivers/mongodb/mongodb-driver.mjs.map +1 -1
  40. package/esm/drivers/mongodb/mongodb-id-generator.d.mts +2 -3
  41. package/esm/drivers/mongodb/mongodb-id-generator.d.mts.map +1 -1
  42. package/esm/drivers/mongodb/mongodb-id-generator.mjs.map +1 -1
  43. package/esm/drivers/mongodb/mongodb-migration-driver.d.mts +1 -3
  44. package/esm/drivers/mongodb/mongodb-migration-driver.d.mts.map +1 -1
  45. package/esm/drivers/mongodb/mongodb-query-builder.d.mts +2 -3
  46. package/esm/drivers/mongodb/mongodb-query-builder.d.mts.map +1 -1
  47. package/esm/drivers/mongodb/mongodb-query-builder.mjs +8 -5
  48. package/esm/drivers/mongodb/mongodb-query-builder.mjs.map +1 -1
  49. package/esm/drivers/mongodb/mongodb-query-operations.d.mts +1 -3
  50. package/esm/drivers/mongodb/mongodb-query-operations.d.mts.map +1 -1
  51. package/esm/drivers/mongodb/mongodb-query-operations.mjs.map +1 -1
  52. package/esm/drivers/mongodb/mongodb-query-parser.d.mts +7 -6
  53. package/esm/drivers/mongodb/mongodb-query-parser.d.mts.map +1 -1
  54. package/esm/drivers/mongodb/mongodb-query-parser.mjs +2 -6
  55. package/esm/drivers/mongodb/mongodb-query-parser.mjs.map +1 -1
  56. package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts +1 -3
  57. package/esm/drivers/mongodb/mongodb-sync-adapter.d.mts.map +1 -1
  58. package/esm/drivers/mongodb/types.d.mts +11 -9
  59. package/esm/drivers/mongodb/types.d.mts.map +1 -1
  60. package/esm/drivers/postgres/index.d.mts +2 -1
  61. package/esm/drivers/postgres/index.mjs +1 -1
  62. package/esm/drivers/postgres/naming.mjs +1 -1
  63. package/esm/drivers/postgres/naming.mjs.map +1 -1
  64. package/esm/drivers/postgres/postgres-blueprint.d.mts +1 -3
  65. package/esm/drivers/postgres/postgres-blueprint.d.mts.map +1 -1
  66. package/esm/drivers/postgres/postgres-dialect.d.mts +4 -6
  67. package/esm/drivers/postgres/postgres-dialect.d.mts.map +1 -1
  68. package/esm/drivers/postgres/postgres-dialect.mjs.map +1 -1
  69. package/esm/drivers/postgres/postgres-driver.d.mts +4 -5
  70. package/esm/drivers/postgres/postgres-driver.d.mts.map +1 -1
  71. package/esm/drivers/postgres/postgres-driver.mjs.map +1 -1
  72. package/esm/drivers/postgres/postgres-migration-driver.d.mts +1 -3
  73. package/esm/drivers/postgres/postgres-migration-driver.d.mts.map +1 -1
  74. package/esm/drivers/postgres/postgres-migration-driver.mjs +13 -10
  75. package/esm/drivers/postgres/postgres-migration-driver.mjs.map +1 -1
  76. package/esm/drivers/postgres/postgres-query-builder.d.mts +4 -4
  77. package/esm/drivers/postgres/postgres-query-builder.d.mts.map +1 -1
  78. package/esm/drivers/postgres/postgres-query-builder.mjs +14 -10
  79. package/esm/drivers/postgres/postgres-query-builder.mjs.map +1 -1
  80. package/esm/drivers/postgres/postgres-query-parser.d.mts +16 -11
  81. package/esm/drivers/postgres/postgres-query-parser.d.mts.map +1 -1
  82. package/esm/drivers/postgres/postgres-query-parser.mjs +1 -2
  83. package/esm/drivers/postgres/postgres-query-parser.mjs.map +1 -1
  84. package/esm/drivers/postgres/postgres-sql-serializer.mjs +13 -10
  85. package/esm/drivers/postgres/postgres-sql-serializer.mjs.map +1 -1
  86. package/esm/drivers/postgres/postgres-ttl-purge.mjs +1 -1
  87. package/esm/drivers/postgres/postgres-ttl-purge.mjs.map +1 -1
  88. package/esm/drivers/postgres/postgres-type-converters.mjs +2 -2
  89. package/esm/drivers/postgres/postgres-type-converters.mjs.map +1 -1
  90. package/esm/drivers/postgres/postgres-update-validator.mjs +1 -1
  91. package/esm/drivers/postgres/postgres-update-validator.mjs.map +1 -1
  92. package/esm/drivers/postgres/types.d.mts +87 -45
  93. package/esm/drivers/postgres/types.d.mts.map +1 -1
  94. package/esm/drivers/sql/sql-dialect.contract.d.mts +1 -3
  95. package/esm/drivers/sql/sql-dialect.contract.d.mts.map +1 -1
  96. package/esm/drivers/sql/sql-types.d.mts +113 -59
  97. package/esm/drivers/sql/sql-types.d.mts.map +1 -1
  98. package/esm/errors/missing-data-source.error.d.mts +1 -2
  99. package/esm/errors/missing-data-source.error.d.mts.map +1 -1
  100. package/esm/errors/transaction-rollback.error.d.mts +1 -2
  101. package/esm/errors/transaction-rollback.error.d.mts.map +1 -1
  102. package/esm/errors/undefined-where-value.error.d.mts +1 -2
  103. package/esm/errors/undefined-where-value.error.d.mts.map +1 -1
  104. package/esm/errors/unsafe-filter.error.d.mts +1 -2
  105. package/esm/errors/unsafe-filter.error.d.mts.map +1 -1
  106. package/esm/errors/unsafe-raw-expression.error.d.mts +1 -2
  107. package/esm/errors/unsafe-raw-expression.error.d.mts.map +1 -1
  108. package/esm/errors/unsupported-lean-operation.error.d.mts +1 -2
  109. package/esm/errors/unsupported-lean-operation.error.d.mts.map +1 -1
  110. package/esm/errors/unsupported-lock-for-update.error.d.mts +1 -2
  111. package/esm/errors/unsupported-lock-for-update.error.d.mts.map +1 -1
  112. package/esm/errors/unsupported-query-operation.error.d.mts +1 -2
  113. package/esm/errors/unsupported-query-operation.error.d.mts.map +1 -1
  114. package/esm/errors/unsupported-query-operation.error.mjs.map +1 -1
  115. package/esm/errors/unsupported-update-operation.error.d.mts +1 -2
  116. package/esm/errors/unsupported-update-operation.error.d.mts.map +1 -1
  117. package/esm/events/model-events.d.mts +8 -6
  118. package/esm/events/model-events.d.mts.map +1 -1
  119. package/esm/expressions/aggregate-expressions.d.mts +7 -7
  120. package/esm/expressions/aggregate-expressions.d.mts.map +1 -1
  121. package/esm/expressions/column-expressions.d.mts +11 -11
  122. package/esm/expressions/column-expressions.d.mts.map +1 -1
  123. package/esm/expressions/column-expressions.mjs.map +1 -1
  124. package/esm/index.d.mts +7 -2
  125. package/esm/index.mjs +1 -1
  126. package/esm/migration/column-builder.d.mts +2 -3
  127. package/esm/migration/column-builder.d.mts.map +1 -1
  128. package/esm/migration/column-helpers.d.mts +49 -50
  129. package/esm/migration/column-helpers.d.mts.map +1 -1
  130. package/esm/migration/column-helpers.mjs +1 -1
  131. package/esm/migration/foreign-key-builder.d.mts +2 -3
  132. package/esm/migration/foreign-key-builder.d.mts.map +1 -1
  133. package/esm/migration/foreign-key-builder.mjs.map +1 -1
  134. package/esm/migration/index.d.mts +3 -2
  135. package/esm/migration/index.mjs +2 -2
  136. package/esm/migration/migration-runner.d.mts +7 -6
  137. package/esm/migration/migration-runner.d.mts.map +1 -1
  138. package/esm/migration/migration-runner.mjs +15 -11
  139. package/esm/migration/migration-runner.mjs.map +1 -1
  140. package/esm/migration/migration.d.mts +50 -32
  141. package/esm/migration/migration.d.mts.map +1 -1
  142. package/esm/migration/migration.mjs +1 -3
  143. package/esm/migration/migration.mjs.map +1 -1
  144. package/esm/migration/parse-created-at.mjs.map +1 -1
  145. package/esm/migration/sql-grammar.mjs.map +1 -1
  146. package/esm/migration/sql-serializer.d.mts +1 -3
  147. package/esm/migration/sql-serializer.d.mts.map +1 -1
  148. package/esm/migration/types.d.mts +7 -7
  149. package/esm/migration/types.d.mts.map +1 -1
  150. package/esm/model/generate-model-id.mjs.map +1 -1
  151. package/esm/model/methods/accessor-methods.mjs +1 -1
  152. package/esm/model/methods/accessor-methods.mjs.map +1 -1
  153. package/esm/model/methods/dirty-methods.mjs.map +1 -1
  154. package/esm/model/methods/hydration-methods.mjs.map +1 -1
  155. package/esm/model/methods/meta-methods.mjs +4 -2
  156. package/esm/model/methods/meta-methods.mjs.map +1 -1
  157. package/esm/model/methods/query-methods.mjs +1 -1
  158. package/esm/model/methods/query-methods.mjs.map +1 -1
  159. package/esm/model/methods/scope-methods.mjs.map +1 -1
  160. package/esm/model/methods/static-event-methods.mjs.map +1 -1
  161. package/esm/model/methods/write-methods.d.mts +3 -2
  162. package/esm/model/methods/write-methods.d.mts.map +1 -1
  163. package/esm/model/methods/write-methods.mjs +5 -2
  164. package/esm/model/methods/write-methods.mjs.map +1 -1
  165. package/esm/model/model.d.mts +9 -9
  166. package/esm/model/model.d.mts.map +1 -1
  167. package/esm/model/model.mjs.map +1 -1
  168. package/esm/model/model.types.d.mts +7 -7
  169. package/esm/model/model.types.d.mts.map +1 -1
  170. package/esm/model/register-model.d.mts +13 -15
  171. package/esm/model/register-model.d.mts.map +1 -1
  172. package/esm/model/register-model.mjs.map +1 -1
  173. package/esm/model/relation-decorators.d.mts +6 -8
  174. package/esm/model/relation-decorators.d.mts.map +1 -1
  175. package/esm/operations/database.d.mts +13 -8
  176. package/esm/operations/database.d.mts.map +1 -1
  177. package/esm/operations/index.d.mts +2 -1
  178. package/esm/operations/index.mjs +1 -1
  179. package/esm/operations/migrations.d.mts +18 -14
  180. package/esm/operations/migrations.d.mts.map +1 -1
  181. package/esm/operations/migrations.mjs.map +1 -1
  182. package/esm/query-builder/query-builder.d.mts +2 -4
  183. package/esm/query-builder/query-builder.d.mts.map +1 -1
  184. package/esm/query-builder/query-builder.mjs +12 -11
  185. package/esm/query-builder/query-builder.mjs.map +1 -1
  186. package/esm/relations/index.d.mts +2 -1
  187. package/esm/relations/index.mjs +1 -1
  188. package/esm/relations/key-conventions.mjs +2 -1
  189. package/esm/relations/key-conventions.mjs.map +1 -1
  190. package/esm/relations/pivot-operations.d.mts +3 -5
  191. package/esm/relations/pivot-operations.d.mts.map +1 -1
  192. package/esm/relations/pivot-operations.mjs.map +1 -1
  193. package/esm/relations/relation-hydrator.d.mts +3 -5
  194. package/esm/relations/relation-hydrator.d.mts.map +1 -1
  195. package/esm/relations/relation-loader.d.mts +2 -4
  196. package/esm/relations/relation-loader.d.mts.map +1 -1
  197. package/esm/relations/relation-loader.mjs +4 -5
  198. package/esm/relations/relation-loader.mjs.map +1 -1
  199. package/esm/relations/types.d.mts +14 -15
  200. package/esm/relations/types.d.mts.map +1 -1
  201. package/esm/remover/database-remover.d.mts +1 -3
  202. package/esm/remover/database-remover.d.mts.map +1 -1
  203. package/esm/remover/database-remover.mjs.map +1 -1
  204. package/esm/restorer/database-restorer.d.mts +1 -3
  205. package/esm/restorer/database-restorer.d.mts.map +1 -1
  206. package/esm/restorer/database-restorer.mjs +2 -1
  207. package/esm/restorer/database-restorer.mjs.map +1 -1
  208. package/esm/sql-database-dirty-tracker.d.mts +1 -3
  209. package/esm/sql-database-dirty-tracker.d.mts.map +1 -1
  210. package/esm/sync/model-events.mjs +1 -1
  211. package/esm/sync/model-sync-operation.d.mts +2 -4
  212. package/esm/sync/model-sync-operation.d.mts.map +1 -1
  213. package/esm/sync/model-sync.d.mts +3 -4
  214. package/esm/sync/model-sync.d.mts.map +1 -1
  215. package/esm/sync/sync-context.d.mts +2 -4
  216. package/esm/sync/sync-context.d.mts.map +1 -1
  217. package/esm/sync/sync-context.mjs.map +1 -1
  218. package/esm/sync/sync-fanout.mjs +1 -1
  219. package/esm/sync/sync-fanout.mjs.map +1 -1
  220. package/esm/sync/sync-manager.d.mts +2 -4
  221. package/esm/sync/sync-manager.d.mts.map +1 -1
  222. package/esm/sync/sync-manager.mjs.map +1 -1
  223. package/esm/sync/types.d.mts +121 -64
  224. package/esm/sync/types.d.mts.map +1 -1
  225. package/esm/transactions/after-commit.d.mts +2 -2
  226. package/esm/transactions/after-commit.d.mts.map +1 -1
  227. package/esm/types.d.mts +7 -8
  228. package/esm/types.d.mts.map +1 -1
  229. package/esm/utils/connect-to-database.d.mts +7 -8
  230. package/esm/utils/connect-to-database.d.mts.map +1 -1
  231. package/esm/utils/database-writer.utils.d.mts +3 -4
  232. package/esm/utils/database-writer.utils.d.mts.map +1 -1
  233. package/esm/utils/database-writer.utils.mjs.map +1 -1
  234. package/esm/utils/define-model.d.mts +3 -5
  235. package/esm/utils/define-model.d.mts.map +1 -1
  236. package/esm/utils/escape-regex.d.mts +3 -4
  237. package/esm/utils/escape-regex.d.mts.map +1 -1
  238. package/esm/utils/is-valid-date-value.mjs.map +1 -1
  239. package/esm/utils/once-connected.d.mts +2 -4
  240. package/esm/utils/once-connected.d.mts.map +1 -1
  241. package/esm/utils/sanitize-filter.d.mts +3 -4
  242. package/esm/utils/sanitize-filter.d.mts.map +1 -1
  243. package/esm/validation/database-seal-plugins.d.mts +2 -1
  244. package/esm/validation/database-writer-validation-error.d.mts +1 -3
  245. package/esm/validation/database-writer-validation-error.d.mts.map +1 -1
  246. package/esm/validation/index.d.mts +3 -1
  247. package/esm/validation/index.mjs +1 -1
  248. package/esm/validation/plugins/database-rules-plugin.d.mts +2 -3
  249. package/esm/validation/plugins/database-rules-plugin.d.mts.map +1 -1
  250. package/esm/validation/plugins/embed-validator-plugin.d.mts +4 -3
  251. package/esm/validation/plugins/embed-validator-plugin.d.mts.map +1 -1
  252. package/esm/validation/types.d.mts +14 -10
  253. package/esm/validation/types.d.mts.map +1 -1
  254. package/esm/validation/validators/embed-validator.d.mts +2 -3
  255. package/esm/validation/validators/embed-validator.d.mts.map +1 -1
  256. package/esm/writer/database-writer.d.mts +1 -3
  257. package/esm/writer/database-writer.d.mts.map +1 -1
  258. package/esm/writer/database-writer.mjs +1 -1
  259. package/esm/writer/database-writer.mjs.map +1 -1
  260. package/llms-full.txt +541 -434
  261. package/package.json +5 -5
  262. package/skills/aggregate-data/SKILL.md +28 -17
  263. package/skills/alter-migration/SKILL.md +325 -233
  264. package/skills/cascade-basics/SKILL.md +19 -19
  265. package/skills/configure-delete-strategy/SKILL.md +11 -11
  266. package/skills/define-model/SKILL.md +19 -17
  267. package/skills/define-relations/SKILL.md +13 -18
  268. package/skills/index.md +3 -0
  269. package/skills/manage-transactions/SKILL.md +18 -12
  270. package/skills/paginate-results/SKILL.md +6 -8
  271. package/skills/perform-atomic-ops/SKILL.md +26 -21
  272. package/skills/query-data/SKILL.md +27 -33
  273. package/skills/run-cascade-cli/SKILL.md +11 -10
  274. package/skills/search-by-vector/SKILL.md +8 -5
  275. package/skills/subscribe-to-model-events/SKILL.md +17 -17
  276. package/skills/track-changes/SKILL.md +9 -9
  277. package/skills/write-migration/SKILL.md +4 -4
@@ -39,17 +39,17 @@
39
39
  * ```
40
40
  */
41
41
  /** Discriminator tag identifying a node in the column-expression tree. */
42
- type ColumnExpressionType = "column" | "literal" | "add" | "subtract" | "multiply" | "divide" | "raw";
42
+ export type ColumnExpressionType = "column" | "literal" | "add" | "subtract" | "multiply" | "divide" | "raw";
43
43
  /**
44
44
  * A reference to a column/field. The driver is responsible for quoting the
45
45
  * name (SQL) or prefixing it with `$` (Mongo) — it is never interpolated raw.
46
46
  */
47
- type ColumnRefExpression = {
47
+ export type ColumnRefExpression = {
48
48
  readonly __expr: "column";
49
49
  readonly column: string;
50
50
  };
51
51
  /** A scalar literal value embedded directly in the expression. */
52
- type LiteralExpression = {
52
+ export type LiteralExpression = {
53
53
  readonly __expr: "literal";
54
54
  readonly value: number | boolean;
55
55
  };
@@ -59,7 +59,7 @@ type LiteralExpression = {
59
59
  * `add` / `multiply` are variadic; `subtract` / `divide` take exactly two
60
60
  * operands (left, right) since they are not associative.
61
61
  */
62
- type ArithmeticExpression = {
62
+ export type ArithmeticExpression = {
63
63
  readonly __expr: "add" | "subtract" | "multiply" | "divide";
64
64
  readonly operands: ColumnExpression[];
65
65
  };
@@ -68,7 +68,7 @@ type ArithmeticExpression = {
68
68
  * generated SQL — callers MUST NOT build it from untrusted input. This is the
69
69
  * documented boundary for anything the typed nodes above don't cover.
70
70
  */
71
- type RawColumnExpression = {
71
+ export type RawColumnExpression = {
72
72
  readonly __expr: "raw";
73
73
  readonly expression: string;
74
74
  };
@@ -77,16 +77,16 @@ type RawColumnExpression = {
77
77
  * valid expression input wherever this type is accepted — it is interpreted as
78
78
  * a column reference.
79
79
  */
80
- type ColumnExpression = ColumnRefExpression | LiteralExpression | ArithmeticExpression | RawColumnExpression;
80
+ export type ColumnExpression = ColumnRefExpression | LiteralExpression | ArithmeticExpression | RawColumnExpression;
81
81
  /** Input accepted by expression-aware helpers: a typed node or a column-name string. */
82
- type ColumnExpressionInput = ColumnExpression | string;
82
+ export type ColumnExpressionInput = ColumnExpression | string;
83
83
  /**
84
84
  * Type guard: is `value` one of the typed column-expression nodes?
85
85
  *
86
86
  * @param value - The value to test
87
87
  * @returns `true` when `value` is a `ColumnExpression` node
88
88
  */
89
- declare function isColumnExpression(value: unknown): value is ColumnExpression;
89
+ export declare function isColumnExpression(value: unknown): value is ColumnExpression;
90
90
  /**
91
91
  * Reference a column/field by name.
92
92
  *
@@ -151,7 +151,7 @@ declare function raw(expression: string): RawColumnExpression;
151
151
  * @param input - A typed expression node or a bare column-name string
152
152
  * @returns The corresponding `ColumnExpression` node
153
153
  */
154
- declare function toColumnExpression(input: ColumnExpressionInput): ColumnExpression;
154
+ export declare function toColumnExpression(input: ColumnExpressionInput): ColumnExpression;
155
155
  /**
156
156
  * Typed, database-agnostic column-expression builders.
157
157
  *
@@ -179,7 +179,7 @@ declare function toColumnExpression(input: ColumnExpressionInput): ColumnExpress
179
179
  * $agg.sum($expr.raw("price * quantity * (1 - discount)"));
180
180
  * ```
181
181
  */
182
- declare const $expr: {
182
+ export declare const $expr: {
183
183
  col: typeof col;
184
184
  lit: typeof lit;
185
185
  mul: typeof mul;
@@ -189,5 +189,5 @@ declare const $expr: {
189
189
  raw: typeof raw;
190
190
  };
191
191
  //#endregion
192
- export { $expr, ArithmeticExpression, ColumnExpression, ColumnExpressionInput, ColumnExpressionType, ColumnRefExpression, LiteralExpression, RawColumnExpression, isColumnExpression, toColumnExpression };
192
+ export {};
193
193
  //# sourceMappingURL=column-expressions.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"column-expressions.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/expressions/column-expressions.ts"],"mappings":";;AAyCA;;;;AAAgC;AAahC;;;;AAEiB;AAIjB;;;;AAEgB;AAShB;;;;;;;;AAEqC;AAQrC;;;;AAEqB;AAQrB;;;;;;;;;;KAlDY,oBAAA;;;;AAsDW;KAzCX,mBAAA;EAAA,SACD,MAAA;EAAA,SACA,MAAM;AAAA;AA0CmC;AAAA,KAtCxC,iBAAA;EAAA,SACD,MAAA;EAAA,SACA,KAAK;AAAA;;;;;AA4C6D;AAM5E;KAzCW,oBAAA;EAAA,SACD,MAAA;EAAA,SACA,QAAA,EAAU,gBAAgB;AAAA;AA+CY;;;;AAUO;AAVP,KAvCrC,mBAAA;EAAA,SACD,MAAA;EAAA,SACA,UAAU;AAAA;;;;;AAyDmD;KAjD5D,gBAAA,GACR,mBAAA,GACA,iBAAA,GACA,oBAAA,GACA,mBAAA;;KAGQ,qBAAA,GAAwB,gBAAgB;;;;;;AAoDoB;iBA5CxD,kBAAA,CAAmB,KAAA,YAAiB,KAAA,IAAS,gBAAgB;;;;;;;iBAcpE,GAAA,CAAI,MAAA,WAAiB,mBAAmB;;;;;;;iBAUxC,GAAA,CAAI,KAAA,qBAA0B,iBAAiB;AAkCjC;;;;;;AAAA,iBAxBd,GAAA,IAAO,QAAA,EAAU,qBAAA,KAA0B,oBAAoB;;;;;;;iBAU/D,GAAA,IAAO,QAAA,EAAU,qBAAA,KAA0B,oBAAoB;AA+BjD;AAAA;;;;AAkB8B;AAYrD;AA9BuB,iBApBd,GAAA,CACP,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,qBAAA,GACN,oBAAA;;;;;;;AA+C+E;iBAjCzE,GAAA,CACP,IAAA,EAAM,qBAAA,EACN,KAAA,EAAO,qBAAA,GACN,oBAAA;;;;;;;;;;;;iBAkBM,GAAA,CAAI,UAAA,WAAqB,mBAAmB;;;;;;;;;iBAYrC,kBAAA,CAAmB,KAAA,EAAO,qBAAA,GAAwB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+BrE,KAAA"}
1
+ {"version":3,"file":"column-expressions.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/expressions/column-expressions.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAyCY;;;;;YAaA;WACD;WACA;;;YAIC;WACD;WACA;;;;;;;;YASC;WACD;WACA,UAAU;;;;;;;YAQT;WACD;WACA;;;;;;;YAQC,mBACR,sBACA,oBACA,uBACA;;YAGQ,wBAAwB;;;;;;;wBAQpB,mBAAmB,iBAAiB,SAAS;;;;;;;iBAcpD,IAAI,iBAAiB;;;;;;;iBAUrB,IAAI,0BAA0B;;;;;;;iBAU9B,OAAO,UAAU,0BAA0B;;;;;;;iBAU3C,OAAO,UAAU,0BAA0B;;;;;;;;iBAW3C,IAAI,MAAM,uBAAuB,OAAO,wBAAwB;;;;;;;;iBAchE,IAAI,MAAM,uBAAuB,OAAO,wBAAwB;;;;;;;;;;;;iBAkBhE,IAAI,qBAAqB;;;;;;;;;wBAYlB,mBAAmB,OAAO,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBA+BrD"}
@@ -1 +1 @@
1
- {"version":3,"file":"column-expressions.mjs","names":[],"sources":["../../../../../../../../packages/cascade/src/expressions/column-expressions.ts"],"sourcesContent":["/**\n * Database-agnostic, **typed** column expressions for aggregate inputs.\n *\n * These let `$agg.sum(...)` (and any future expression-accepting aggregate)\n * operate on a composed arithmetic expression — e.g. `price * quantity` — not\n * just a bare column, while staying portable across drivers.\n *\n * The builders are grouped under a single `$expr` object (mirroring `$agg`),\n * so the package root exposes exactly two expression namespaces — `$agg` for\n * aggregates and `$expr` for the scalar arithmetic that feeds them — rather\n * than a handful of collision-prone bare verbs (`mul`, `add`, `col`, …).\n *\n * The expression tree is a small, closed union of safe nodes:\n *\n * - `$expr.col(\"price\")` — a column reference (driver quotes/escapes it)\n * - `$expr.lit(2)` — a numeric/boolean literal\n * - `$expr.mul(a, b, …)` / `$expr.add(…)` / `$expr.sub(a, b)` / `$expr.div(a, b)` — arithmetic\n * - `$expr.raw(\"price * 1.2\")` — an explicit escape hatch for a raw SQL fragment\n *\n * Only `$expr.raw` ever embeds an uninterpreted string, and it is opt-in by\n * name. Everything else is composed from typed nodes, so user-supplied column\n * names flow through the driver's identifier-quoting path rather than being\n * string-interpolated into SQL. This is the boundary the S2 task calls out: a\n * tiny typed DSL for the common safe ops, plus a clearly-named raw escape\n * hatch for everything beyond it.\n *\n * Bare strings are still accepted everywhere a `ColumnExpression` is — a plain\n * string is treated as a column reference (`\"price\"` === `$expr.col(\"price\")`),\n * so the existing `$agg.sum(\"amount\")` call site keeps working unchanged.\n *\n * @example\n * ```typescript\n * import { $agg, $expr } from \"@warlock.js/cascade\";\n *\n * query.groupByDate(\"created_at\", \"month\", {\n * revenue: $agg.sum($expr.mul(\"price\", \"quantity\")),\n * });\n * ```\n */\n\n/** Discriminator tag identifying a node in the column-expression tree. */\nexport type ColumnExpressionType =\n | \"column\"\n | \"literal\"\n | \"add\"\n | \"subtract\"\n | \"multiply\"\n | \"divide\"\n | \"raw\";\n\n/**\n * A reference to a column/field. The driver is responsible for quoting the\n * name (SQL) or prefixing it with `$` (Mongo) — it is never interpolated raw.\n */\nexport type ColumnRefExpression = {\n readonly __expr: \"column\";\n readonly column: string;\n};\n\n/** A scalar literal value embedded directly in the expression. */\nexport type LiteralExpression = {\n readonly __expr: \"literal\";\n readonly value: number | boolean;\n};\n\n/**\n * An arithmetic operation over one or more operands.\n *\n * `add` / `multiply` are variadic; `subtract` / `divide` take exactly two\n * operands (left, right) since they are not associative.\n */\nexport type ArithmeticExpression = {\n readonly __expr: \"add\" | \"subtract\" | \"multiply\" | \"divide\";\n readonly operands: ColumnExpression[];\n};\n\n/**\n * A raw expression escape hatch. The string is emitted verbatim into the\n * generated SQL — callers MUST NOT build it from untrusted input. This is the\n * documented boundary for anything the typed nodes above don't cover.\n */\nexport type RawColumnExpression = {\n readonly __expr: \"raw\";\n readonly expression: string;\n};\n\n/**\n * Any node in the typed column-expression tree. A bare `string` is also a\n * valid expression input wherever this type is accepted — it is interpreted as\n * a column reference.\n */\nexport type ColumnExpression =\n | ColumnRefExpression\n | LiteralExpression\n | ArithmeticExpression\n | RawColumnExpression;\n\n/** Input accepted by expression-aware helpers: a typed node or a column-name string. */\nexport type ColumnExpressionInput = ColumnExpression | string;\n\n/**\n * Type guard: is `value` one of the typed column-expression nodes?\n *\n * @param value - The value to test\n * @returns `true` when `value` is a `ColumnExpression` node\n */\nexport function isColumnExpression(value: unknown): value is ColumnExpression {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as ColumnExpression).__expr === \"string\"\n );\n}\n\n/**\n * Reference a column/field by name.\n *\n * @param column - The column/field name\n * @returns A column-reference expression node\n */\nfunction col(column: string): ColumnRefExpression {\n return { __expr: \"column\", column };\n}\n\n/**\n * A scalar literal (number or boolean) operand.\n *\n * @param value - The literal value\n * @returns A literal expression node\n */\nfunction lit(value: number | boolean): LiteralExpression {\n return { __expr: \"literal\", value };\n}\n\n/**\n * Multiply two or more operands.\n *\n * @param operands - Column names, literals, or nested expression nodes\n * @returns A multiply expression node\n */\nfunction mul(...operands: ColumnExpressionInput[]): ArithmeticExpression {\n return { __expr: \"multiply\", operands: operands.map(toColumnExpression) };\n}\n\n/**\n * Add two or more operands.\n *\n * @param operands - Column names, literals, or nested expression nodes\n * @returns An add expression node\n */\nfunction add(...operands: ColumnExpressionInput[]): ArithmeticExpression {\n return { __expr: \"add\", operands: operands.map(toColumnExpression) };\n}\n\n/**\n * Subtract `right` from `left`.\n *\n * @param left - The minuend\n * @param right - The subtrahend\n * @returns A subtract expression node\n */\nfunction sub(\n left: ColumnExpressionInput,\n right: ColumnExpressionInput,\n): ArithmeticExpression {\n return {\n __expr: \"subtract\",\n operands: [toColumnExpression(left), toColumnExpression(right)],\n };\n}\n\n/**\n * Divide `left` by `right`.\n *\n * @param left - The dividend\n * @param right - The divisor\n * @returns A divide expression node\n */\nfunction div(\n left: ColumnExpressionInput,\n right: ColumnExpressionInput,\n): ArithmeticExpression {\n return {\n __expr: \"divide\",\n operands: [toColumnExpression(left), toColumnExpression(right)],\n };\n}\n\n/**\n * Wrap a raw expression string as an escape hatch.\n *\n * The string is emitted verbatim — never build it from untrusted input. Use\n * this only when the typed `$expr.mul` / `$expr.add` / `$expr.sub` /\n * `$expr.div` / `$expr.col` / `$expr.lit` combinators can't express what you\n * need.\n *\n * @param expression - A raw, driver-native expression fragment\n * @returns A raw expression node\n */\nfunction raw(expression: string): RawColumnExpression {\n return { __expr: \"raw\", expression };\n}\n\n/**\n * Normalize an expression input to a `ColumnExpression` node. A bare string\n * becomes a `$expr.col(...)` reference; an existing node passes through\n * unchanged.\n *\n * @param input - A typed expression node or a bare column-name string\n * @returns The corresponding `ColumnExpression` node\n */\nexport function toColumnExpression(input: ColumnExpressionInput): ColumnExpression {\n return typeof input === \"string\" ? col(input) : input;\n}\n\n/**\n * Typed, database-agnostic column-expression builders.\n *\n * Grouped under one object (like `$agg`) so the scalar arithmetic that feeds\n * an aggregate reads as a single, discoverable namespace: `$agg.sum($expr.mul(\n * \"price\", \"quantity\"))`. Each builder returns a plain, closed `ColumnExpression`\n * node — the driver translates it to native SQL / a Mongo pipeline.\n *\n * @example\n * ```typescript\n * import { $agg, $expr } from \"@warlock.js/cascade\";\n *\n * // SUM(price * quantity)\n * query.groupBy(\"product_id\", { revenue: $agg.sum($expr.mul(\"price\", \"quantity\")) });\n *\n * // SUM((1 - discount) * price)\n * query.groupBy(\"product_id\", {\n * net: $agg.sum($expr.mul($expr.sub($expr.lit(1), \"discount\"), \"price\")),\n * });\n *\n * // price * 1.2 (e.g. tax)\n * $agg.sum($expr.mul(\"price\", $expr.lit(1.2)));\n *\n * // escape hatch (Postgres-only, emitted verbatim — never from user input)\n * $agg.sum($expr.raw(\"price * quantity * (1 - discount)\"));\n * ```\n */\nexport const $expr = {\n col,\n lit,\n mul,\n add,\n sub,\n div,\n raw,\n};\n"],"mappings":";;;;;;;AA0GA,SAAgB,mBAAmB,OAA2C;CAC5E,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA2B,WAAW;AAElD;;;;;;;AAQA,SAAS,IAAI,QAAqC;CAChD,OAAO;EAAE,QAAQ;EAAU;CAAO;AACpC;;;;;;;AAQA,SAAS,IAAI,OAA4C;CACvD,OAAO;EAAE,QAAQ;EAAW;CAAM;AACpC;;;;;;;AAQA,SAAS,IAAI,GAAG,UAAyD;CACvE,OAAO;EAAE,QAAQ;EAAY,UAAU,SAAS,IAAI,kBAAkB;CAAE;AAC1E;;;;;;;AAQA,SAAS,IAAI,GAAG,UAAyD;CACvE,OAAO;EAAE,QAAQ;EAAO,UAAU,SAAS,IAAI,kBAAkB;CAAE;AACrE;;;;;;;;AASA,SAAS,IACP,MACA,OACsB;CACtB,OAAO;EACL,QAAQ;EACR,UAAU,CAAC,mBAAmB,IAAI,GAAG,mBAAmB,KAAK,CAAC;CAChE;AACF;;;;;;;;AASA,SAAS,IACP,MACA,OACsB;CACtB,OAAO;EACL,QAAQ;EACR,UAAU,CAAC,mBAAmB,IAAI,GAAG,mBAAmB,KAAK,CAAC;CAChE;AACF;;;;;;;;;;;;AAaA,SAAS,IAAI,YAAyC;CACpD,OAAO;EAAE,QAAQ;EAAO;CAAW;AACrC;;;;;;;;;AAUA,SAAgB,mBAAmB,OAAgD;CACjF,OAAO,OAAO,UAAU,WAAW,IAAI,KAAK,IAAI;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,QAAQ;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
1
+ {"version":3,"file":"column-expressions.mjs","names":[],"sources":["../../../../../../../../packages/cascade/src/expressions/column-expressions.ts"],"sourcesContent":["/**\n * Database-agnostic, **typed** column expressions for aggregate inputs.\n *\n * These let `$agg.sum(...)` (and any future expression-accepting aggregate)\n * operate on a composed arithmetic expression — e.g. `price * quantity` — not\n * just a bare column, while staying portable across drivers.\n *\n * The builders are grouped under a single `$expr` object (mirroring `$agg`),\n * so the package root exposes exactly two expression namespaces — `$agg` for\n * aggregates and `$expr` for the scalar arithmetic that feeds them — rather\n * than a handful of collision-prone bare verbs (`mul`, `add`, `col`, …).\n *\n * The expression tree is a small, closed union of safe nodes:\n *\n * - `$expr.col(\"price\")` — a column reference (driver quotes/escapes it)\n * - `$expr.lit(2)` — a numeric/boolean literal\n * - `$expr.mul(a, b, …)` / `$expr.add(…)` / `$expr.sub(a, b)` / `$expr.div(a, b)` — arithmetic\n * - `$expr.raw(\"price * 1.2\")` — an explicit escape hatch for a raw SQL fragment\n *\n * Only `$expr.raw` ever embeds an uninterpreted string, and it is opt-in by\n * name. Everything else is composed from typed nodes, so user-supplied column\n * names flow through the driver's identifier-quoting path rather than being\n * string-interpolated into SQL. This is the boundary the S2 task calls out: a\n * tiny typed DSL for the common safe ops, plus a clearly-named raw escape\n * hatch for everything beyond it.\n *\n * Bare strings are still accepted everywhere a `ColumnExpression` is — a plain\n * string is treated as a column reference (`\"price\"` === `$expr.col(\"price\")`),\n * so the existing `$agg.sum(\"amount\")` call site keeps working unchanged.\n *\n * @example\n * ```typescript\n * import { $agg, $expr } from \"@warlock.js/cascade\";\n *\n * query.groupByDate(\"created_at\", \"month\", {\n * revenue: $agg.sum($expr.mul(\"price\", \"quantity\")),\n * });\n * ```\n */\n\n/** Discriminator tag identifying a node in the column-expression tree. */\nexport type ColumnExpressionType =\n | \"column\"\n | \"literal\"\n | \"add\"\n | \"subtract\"\n | \"multiply\"\n | \"divide\"\n | \"raw\";\n\n/**\n * A reference to a column/field. The driver is responsible for quoting the\n * name (SQL) or prefixing it with `$` (Mongo) — it is never interpolated raw.\n */\nexport type ColumnRefExpression = {\n readonly __expr: \"column\";\n readonly column: string;\n};\n\n/** A scalar literal value embedded directly in the expression. */\nexport type LiteralExpression = {\n readonly __expr: \"literal\";\n readonly value: number | boolean;\n};\n\n/**\n * An arithmetic operation over one or more operands.\n *\n * `add` / `multiply` are variadic; `subtract` / `divide` take exactly two\n * operands (left, right) since they are not associative.\n */\nexport type ArithmeticExpression = {\n readonly __expr: \"add\" | \"subtract\" | \"multiply\" | \"divide\";\n readonly operands: ColumnExpression[];\n};\n\n/**\n * A raw expression escape hatch. The string is emitted verbatim into the\n * generated SQL — callers MUST NOT build it from untrusted input. This is the\n * documented boundary for anything the typed nodes above don't cover.\n */\nexport type RawColumnExpression = {\n readonly __expr: \"raw\";\n readonly expression: string;\n};\n\n/**\n * Any node in the typed column-expression tree. A bare `string` is also a\n * valid expression input wherever this type is accepted — it is interpreted as\n * a column reference.\n */\nexport type ColumnExpression =\n | ColumnRefExpression\n | LiteralExpression\n | ArithmeticExpression\n | RawColumnExpression;\n\n/** Input accepted by expression-aware helpers: a typed node or a column-name string. */\nexport type ColumnExpressionInput = ColumnExpression | string;\n\n/**\n * Type guard: is `value` one of the typed column-expression nodes?\n *\n * @param value - The value to test\n * @returns `true` when `value` is a `ColumnExpression` node\n */\nexport function isColumnExpression(value: unknown): value is ColumnExpression {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as ColumnExpression).__expr === \"string\"\n );\n}\n\n/**\n * Reference a column/field by name.\n *\n * @param column - The column/field name\n * @returns A column-reference expression node\n */\nfunction col(column: string): ColumnRefExpression {\n return { __expr: \"column\", column };\n}\n\n/**\n * A scalar literal (number or boolean) operand.\n *\n * @param value - The literal value\n * @returns A literal expression node\n */\nfunction lit(value: number | boolean): LiteralExpression {\n return { __expr: \"literal\", value };\n}\n\n/**\n * Multiply two or more operands.\n *\n * @param operands - Column names, literals, or nested expression nodes\n * @returns A multiply expression node\n */\nfunction mul(...operands: ColumnExpressionInput[]): ArithmeticExpression {\n return { __expr: \"multiply\", operands: operands.map(toColumnExpression) };\n}\n\n/**\n * Add two or more operands.\n *\n * @param operands - Column names, literals, or nested expression nodes\n * @returns An add expression node\n */\nfunction add(...operands: ColumnExpressionInput[]): ArithmeticExpression {\n return { __expr: \"add\", operands: operands.map(toColumnExpression) };\n}\n\n/**\n * Subtract `right` from `left`.\n *\n * @param left - The minuend\n * @param right - The subtrahend\n * @returns A subtract expression node\n */\nfunction sub(left: ColumnExpressionInput, right: ColumnExpressionInput): ArithmeticExpression {\n return {\n __expr: \"subtract\",\n operands: [toColumnExpression(left), toColumnExpression(right)],\n };\n}\n\n/**\n * Divide `left` by `right`.\n *\n * @param left - The dividend\n * @param right - The divisor\n * @returns A divide expression node\n */\nfunction div(left: ColumnExpressionInput, right: ColumnExpressionInput): ArithmeticExpression {\n return {\n __expr: \"divide\",\n operands: [toColumnExpression(left), toColumnExpression(right)],\n };\n}\n\n/**\n * Wrap a raw expression string as an escape hatch.\n *\n * The string is emitted verbatim — never build it from untrusted input. Use\n * this only when the typed `$expr.mul` / `$expr.add` / `$expr.sub` /\n * `$expr.div` / `$expr.col` / `$expr.lit` combinators can't express what you\n * need.\n *\n * @param expression - A raw, driver-native expression fragment\n * @returns A raw expression node\n */\nfunction raw(expression: string): RawColumnExpression {\n return { __expr: \"raw\", expression };\n}\n\n/**\n * Normalize an expression input to a `ColumnExpression` node. A bare string\n * becomes a `$expr.col(...)` reference; an existing node passes through\n * unchanged.\n *\n * @param input - A typed expression node or a bare column-name string\n * @returns The corresponding `ColumnExpression` node\n */\nexport function toColumnExpression(input: ColumnExpressionInput): ColumnExpression {\n return typeof input === \"string\" ? col(input) : input;\n}\n\n/**\n * Typed, database-agnostic column-expression builders.\n *\n * Grouped under one object (like `$agg`) so the scalar arithmetic that feeds\n * an aggregate reads as a single, discoverable namespace: `$agg.sum($expr.mul(\n * \"price\", \"quantity\"))`. Each builder returns a plain, closed `ColumnExpression`\n * node — the driver translates it to native SQL / a Mongo pipeline.\n *\n * @example\n * ```typescript\n * import { $agg, $expr } from \"@warlock.js/cascade\";\n *\n * // SUM(price * quantity)\n * query.groupBy(\"product_id\", { revenue: $agg.sum($expr.mul(\"price\", \"quantity\")) });\n *\n * // SUM((1 - discount) * price)\n * query.groupBy(\"product_id\", {\n * net: $agg.sum($expr.mul($expr.sub($expr.lit(1), \"discount\"), \"price\")),\n * });\n *\n * // price * 1.2 (e.g. tax)\n * $agg.sum($expr.mul(\"price\", $expr.lit(1.2)));\n *\n * // escape hatch (Postgres-only, emitted verbatim — never from user input)\n * $agg.sum($expr.raw(\"price * quantity * (1 - discount)\"));\n * ```\n */\nexport const $expr = {\n col,\n lit,\n mul,\n add,\n sub,\n div,\n raw,\n};\n"],"mappings":";;;;;;;AA0GA,SAAgB,mBAAmB,OAA2C;CAC5E,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA2B,WAAW;AAElD;;;;;;;AAQA,SAAS,IAAI,QAAqC;CAChD,OAAO;EAAE,QAAQ;EAAU;CAAO;AACpC;;;;;;;AAQA,SAAS,IAAI,OAA4C;CACvD,OAAO;EAAE,QAAQ;EAAW;CAAM;AACpC;;;;;;;AAQA,SAAS,IAAI,GAAG,UAAyD;CACvE,OAAO;EAAE,QAAQ;EAAY,UAAU,SAAS,IAAI,kBAAkB;CAAE;AAC1E;;;;;;;AAQA,SAAS,IAAI,GAAG,UAAyD;CACvE,OAAO;EAAE,QAAQ;EAAO,UAAU,SAAS,IAAI,kBAAkB;CAAE;AACrE;;;;;;;;AASA,SAAS,IAAI,MAA6B,OAAoD;CAC5F,OAAO;EACL,QAAQ;EACR,UAAU,CAAC,mBAAmB,IAAI,GAAG,mBAAmB,KAAK,CAAC;CAChE;AACF;;;;;;;;AASA,SAAS,IAAI,MAA6B,OAAoD;CAC5F,OAAO;EACL,QAAQ;EACR,UAAU,CAAC,mBAAmB,IAAI,GAAG,mBAAmB,KAAK,CAAC;CAChE;AACF;;;;;;;;;;;;AAaA,SAAS,IAAI,YAAyC;CACpD,OAAO;EAAE,QAAQ;EAAO;CAAW;AACrC;;;;;;;;;AAUA,SAAgB,mBAAmB,OAAgD;CACjF,OAAO,OAAO,UAAU,WAAW,IAAI,KAAK,IAAI;AAClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,QAAQ;CACnB;CACA;CACA;CACA;CACA;CACA;CACA;AACF"}
package/esm/index.d.mts CHANGED
@@ -2,14 +2,14 @@ import { DeleteStrategy, MigrationDefaults, ModelDefaults, NamingConvention, Rel
2
2
  import { TableIndexInformation } from "./contracts/driver-blueprint.contract.mjs";
3
3
  import { ColumnDefinition, ColumnType, ForeignKeyDefinition, FullTextIndexOptions, GeoIndexOptions, IndexDefinition, MigrationDriverContract, MigrationDriverFactory, VectorIndexOptions } from "./contracts/migration-driver.contract.mjs";
4
4
  import { ColumnBuilder } from "./migration/column-builder.mjs";
5
- import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./migration/column-helpers.mjs";
5
+ import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, bool as boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./migration/column-helpers.mjs";
6
6
  import { DatabaseDirtyTracker } from "./database-dirty-tracker.mjs";
7
- import { ChildModel, GlobalScopeDefinition, GlobalScopeOptions, LocalScopeCallback, ModelSchema, ScopeTiming } from "./model/model.types.mjs";
8
7
  import { ModelEventListener, ModelEventName, ModelEvents, OnDeletedEventContext, globalModelEvents } from "./events/model-events.mjs";
9
8
  import { BelongsToManyOptions, BelongsToOptions, HasManyOptions, HasOneOptions, LoadedRelationResult, LoadedRelationsMap, PivotData, PivotIds, RelationConstraintCallback, RelationConstraints, RelationDefinition, RelationDefinitions, RelationType } from "./relations/types.mjs";
10
9
  import { PivotOperations, createPivotOperations } from "./relations/pivot-operations.mjs";
11
10
  import { ModelSnapshot, RelationHydrator, SerializedRelation } from "./relations/relation-hydrator.mjs";
12
11
  import { EmbedKey, ModelSyncConfig, ModelSyncContract, ModelSyncOperationContract, SyncConfig, SyncContext, SyncEventPayload, SyncInstruction, SyncInstructionOptions, SyncResult } from "./sync/types.mjs";
12
+ import { ChildModel, GlobalScopeDefinition, GlobalScopeOptions, LocalScopeCallback, ModelSchema, ScopeTiming } from "./model/model.types.mjs";
13
13
  import { Model } from "./model/model.mjs";
14
14
  import { ConnectionOptions, DatabaseDriver, ModelDefaultConfig, connectToDatabase, getDatabaseDriver, transaction } from "./utils/connect-to-database.mjs";
15
15
  import { ForeignKeyBuilder } from "./migration/foreign-key-builder.mjs";
@@ -41,8 +41,10 @@ import { DatabaseRemover } from "./remover/database-remover.mjs";
41
41
  import { DatabaseRestorer } from "./restorer/database-restorer.mjs";
42
42
  import { DatabaseWriterValidationError } from "./validation/database-writer-validation-error.mjs";
43
43
  import { BaseQueryRuleOptions, BaseUniqueRuleOptions, ExistsRuleOptions, UniqueRuleOptions } from "./validation/types.mjs";
44
+ import "./validation/index.mjs";
44
45
  import { DatabaseWriter } from "./writer/database-writer.mjs";
45
46
  import { RelationLoader } from "./relations/relation-loader.mjs";
47
+ import "./relations/index.mjs";
46
48
  import { $expr, ArithmeticExpression, ColumnExpression, ColumnExpressionInput, ColumnExpressionType, ColumnRefExpression, LiteralExpression, RawColumnExpression, isColumnExpression, toColumnExpression } from "./expressions/column-expressions.mjs";
47
49
  import { $agg, AggregateExpression, AggregateFunction, isAggregateExpression } from "./expressions/aggregate-expressions.mjs";
48
50
  import { MongoDriverOptions, Operation, PipelineStage } from "./drivers/mongodb/types.mjs";
@@ -61,8 +63,10 @@ import { DefineModelOptions, ModelType, defineModel } from "./utils/define-model
61
63
  import { onceConnected, onceDisconnected } from "./utils/once-connected.mjs";
62
64
  import { MigrationRecord, MigrationResult, MigrationRunnerOptions, MigrationStatus, RollbackOptions, RunMigrationsOptions } from "./migration/types.mjs";
63
65
  import { MigrationRunner, inferMigrationName, migrationRunner } from "./migration/migration-runner.mjs";
66
+ import "./migration/index.mjs";
64
67
  import { CreateDatabaseResult, DropAllTablesResult, createDatabase, dropAllTables } from "./operations/database.mjs";
65
68
  import { ExportMigrationsSQLOptions, PendingMigration, RollbackMigrationsOptions, exportMigrationsSQL, freshMigrate, listExecutedMigrations, listPendingMigrations, rollbackMigrations, runMigrations } from "./operations/migrations.mjs";
69
+ import "./operations/index.mjs";
66
70
  import { MongoMigrationDriver } from "./drivers/mongodb/mongodb-migration-driver.mjs";
67
71
  import { SqlDialectContract } from "./drivers/sql/sql-dialect.contract.mjs";
68
72
  import { SqlAggregateFunction, SqlDeleteOperation, SqlGroupClause, SqlHavingClause, SqlInsertOperation, SqlJoinClause, SqlJoinType, SqlOrderClause, SqlQueryConfig, SqlQueryResult, SqlSelectClause, SqlUpdateOperation, SqlWhereOperation, SqlWhereType } from "./drivers/sql/sql-types.mjs";
@@ -73,6 +77,7 @@ import { PostgresBlueprint } from "./drivers/postgres/postgres-blueprint.mjs";
73
77
  import { PostgresMigrationDriver } from "./drivers/postgres/postgres-migration-driver.mjs";
74
78
  import { PostgresQueryBuilder } from "./drivers/postgres/postgres-query-builder.mjs";
75
79
  import { PostgresOperationType, PostgresParserOperation, PostgresParserOptions, PostgresQueryParser } from "./drivers/postgres/postgres-query-parser.mjs";
80
+ import "./drivers/postgres/index.mjs";
76
81
  import { MongoClientOptions, TransactionOptions } from "mongodb";
77
82
  export { $agg, $expr, AggregateExpression, AggregateFunction, AlterSchema, ArithmeticExpression, AtomicUpdate, AtomicUpdateOptions, type BaseQueryRuleOptions, type BaseUniqueRuleOptions, BelongsTo, BelongsToMany, type BelongsToManyOptions, type BelongsToOptions, BuildUpdateOperationsResult, type ChildModel, ChunkCallback, ColumnBuilder, ColumnDefinition, ColumnExpression, ColumnExpressionInput, ColumnExpressionType, ColumnMap, ColumnRefExpression, ColumnType, ConnectionOptions, CreateDatabaseOptions, CreateDatabaseResult, CursorPaginationOptions, CursorPaginationResult, DEFAULT_MAX_SYNC_DEPTH, DataSource, DataSourceOptions, DataSourceRegistryEvent, DataSourceRegistryListener, DatabaseDirtyTracker, DatabaseDriver, DatabaseRemover, DatabaseRestorer, DatabaseWriter, DatabaseWriterValidationError, DefineModelOptions, DeleteStrategy, DetachedColumnBuilder, DriverAtomicUpdateOptions, DriverContract, DriverEvent, DriverEventListener, DriverQuery, DriverTransactionContract, DropAllTablesResult, DropDatabaseOptions, type EmbedKey, type ExistsRuleOptions, ExportMigrationsSQLOptions, FindOneAndUpdateOptions, ForeignKeyBuilder, ForeignKeyDefinition, FullTextIndexOptions, GenerateIdOptions, GeoIndexOptions, type GlobalScopeDefinition, type GlobalScopeOptions, GroupByInput, HasMany, type HasManyOptions, HasOne, type HasOneOptions, HavingInput, IdGeneratorContract, IndexDefinition, IndexEntry, InsertResult, JoinOptions, LeanDocument, LiteralExpression, type LoadedRelationResult, type LoadedRelationsMap, type LocalScopeCallback, LockForUpdateOptions, Migration, MigrationAlterOptions, MigrationConstructor, MigrationContract, MigrationCreateOptions, MigrationDefaults, MigrationDriverContract, MigrationDriverFactory, MigrationOrigin, type MigrationRecord, type MigrationResult, MigrationRunner, type MigrationRunnerOptions, type MigrationStatus, MigrationStep, MissingDataSourceError, Model, ModelDefaultConfig, ModelDefaults, ModelEventListener, ModelEventName, ModelEvents, ModelRef, type ModelSchema, type ModelSnapshot, type ModelSyncConfig, type ModelSyncContract, ModelSyncOperation, type ModelSyncOperationContract, ModelTransformCallback, ModelType, type MongoClientOptions, MongoDbDriver, MongoDriverOptions, MongoIdGenerator, MongoMigrationDriver, MongoQueryBuilder, MongoSyncAdapter, NamingConvention, OnDeletedEventContext, Operation, OperationType, OrderDirection, PaginationOptions, PaginationResult, PendingMigration, PendingOperation, PipelineStage, type PivotData, type PivotIds, PivotOperations, PostgresBlueprint, PostgresConnectionConfig, PostgresCopyOptions, PostgresDialect, PostgresDialectOptions, PostgresDriver, PostgresIsolationLevel, PostgresMigrationDriver, PostgresNaming, PostgresNotification, PostgresOperation, PostgresOperationType, PostgresParserOperation, PostgresParserOptions, PostgresPoolConfig, PostgresQueryBuilder, PostgresQueryParser, PostgresQueryResult, PostgresTransactionOptions, PostgresWhereClause, QueryBuilderContract, QueryEvent, RELATION_METADATA_KEY, RawColumnExpression, RawExpression, RawQueryResult, RegisterModel, RegisterModelOptions, type RelationConstraintCallback, type RelationConstraints, RelationDefaults, type RelationDefinition, type RelationDefinitions, RelationHydrator, RelationLoader, type RelationType, RemoverContract, RemoverOptions, RemoverResult, RestorerContract, RestorerOptions, RestorerResult, RollbackMigrationsOptions, type RollbackOptions, type RunMigrationsOptions, type ScopeTiming, type SerializedRelation, SqlAggregateFunction, SqlDeleteOperation, SqlDialectContract, SqlGroupClause, SqlHavingClause, SqlInsertOperation, SqlJoinClause, SqlJoinType, SqlOrderClause, SqlQueryConfig, SqlQueryResult, SqlSelectClause, SqlUpdateOperation, SqlWhereOperation, SqlWhereType, StrictMode, SyncAdapterContract, type SyncConfig, type SyncContext, SyncContextManager, type SyncEventPayload, SyncInstruction, type SyncInstructionOptions, SyncManager, type SyncResult, type TableIndexInformation, TransactionContext, type TransactionOptions, TransactionRollbackError, UndefinedWhereValueError, UniqueEntry, type UniqueRuleOptions, UnsafeFilterError, UnsafeRawExpressionError, UnsupportedLeanOperationError, UnsupportedLockForUpdateError, UnsupportedQueryOperationError, UnsupportedUpdateOperationError, UnwindOptions, UpdateOperations, UpdatePipeline, UpdateResult, UuidStrategy, VectorIndexOptions, WhereCallback, WhereObject, WhereOperator, WriterContract, WriterOptions, WriterResult, afterCommit, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, assertDefined, bigInt, bigInteger, binary, blobCol, boolCol as bool, boolCol, buildPostgresPoolConfig, char, cleanupModelsRegistery, connectToDatabase, createDatabase, createPivotOperations, dataSourceRegistry, databaseDataSourceContext, databaseTransactionContext, date, dateTime, decimal, defineModel, double, dropAllTables, enumCol, escapeRegex, escapeSqlLiteral, exportMigrationsSQL, float, freshMigrate, geometry, getAllModelsFromRegistry, getDatabaseDriver, getModelFromRegistry, globalModelEvents, inferMigrationName, int, integer, ipAddress, isAggregateExpression, isColumnExpression, isMongoDBDriverLoaded, json, likePatternToRegexSource, lineString, listExecutedMigrations, listPendingMigrations, longText, macAddress, mediumText, migrate, migrationRunner, modelSync, objectCol, onceConnected, onceDisconnected, parsePostgresInt8, point, polygon, registerModelInRegistry, removeModelFromRegistery, requireModelClass, resolveLikePattern, resolveModelClass, resolveModelName, rollbackMigrations, runMigrations, sanitizeFilter, sanitizeFilterValue, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, toColumnExpression, transaction, tryResolveModelClass, ulid, useModelTransformer, uuid, vector, verifyRegisteredRelations, year };
78
83
  import "./validation/plugins/database-rules-plugin.mjs";
package/esm/index.mjs CHANGED
@@ -52,7 +52,7 @@ import { defineModel } from "./utils/define-model.mjs";
52
52
  import { onceConnected, onceDisconnected } from "./utils/once-connected.mjs";
53
53
  import { ColumnBuilder } from "./migration/column-builder.mjs";
54
54
  import { ForeignKeyBuilder } from "./migration/foreign-key-builder.mjs";
55
- import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./migration/column-helpers.mjs";
55
+ import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, bool as boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./migration/column-helpers.mjs";
56
56
  import { Migration, migrate } from "./migration/migration.mjs";
57
57
  import { MigrationRunner, inferMigrationName, migrationRunner } from "./migration/migration-runner.mjs";
58
58
  import "./migration/index.mjs";
@@ -1,5 +1,4 @@
1
1
  import { ColumnDefinition, ColumnType, ForeignKeyDefinition, VectorIndexOptions } from "../contracts/migration-driver.contract.mjs";
2
-
3
2
  //#region ../../packages/cascade/src/migration/column-builder.d.ts
4
3
  /**
5
4
  * Reference to the Migration type to avoid circular imports.
@@ -35,7 +34,7 @@ type MigrationLike = {
35
34
  * .comment("User's age in years");
36
35
  * ```
37
36
  */
38
- declare class ColumnBuilder {
37
+ export declare class ColumnBuilder {
39
38
  private readonly migration;
40
39
  /** Mutable column definition being accumulated */
41
40
  private readonly definition;
@@ -416,5 +415,5 @@ declare class ColumnBuilder {
416
415
  getDefinition(): ColumnDefinition;
417
416
  }
418
417
  //#endregion
419
- export { ColumnBuilder };
418
+ export {};
420
419
  //# sourceMappingURL=column-builder.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"column-builder.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/migration/column-builder.ts"],"mappings":";;;;;AAKgD;;KAM3C,aAAA;EACH,eAAA,CAAgB,KAAA;IAAS,OAAA;IAAmB,MAAA;EAAA;EAC5C,sBAAA,CAAuB,EAAA,EAAI,oBAAA;EAC3B,qBAAA,EAAuB,MAAA,UAAgB,OAAA,EAAS,IAAA,CAAK,kBAAA;AAAA;;;;;;;;;;;;AAA6B;AAqCpF;;;;;;;;;;cAAa,aAAA;EAAA,iBAmBQ,SAAA;EAslBK;EAAA,iBAvmBP,UAAA;EAumBuB;EAAA,QApmBhC,YAAA;EAHS;EAAA,QAMT,mBAAA;EAAA;;;;;;;;cAWW,SAAA,EAAW,aAAA,EAC5B,IAAA,UACA,IAAA,EAAM,UAAA,EACN,OAAA,GAAS,OAAA,CACP,IAAA,CAAK,gBAAA;EAAA;;;;;;;;;;EAyBF,QAAA;EAuIA;;;;;;;EA3HA,WAAA;EAoOA;;;;;;;;;;;;;;;;;EA1MA,OAAA,CAAQ,KAAA;EA0WC;;;;;;;;;;;AAyKwB;;;;EA9fjC,aAAA,CAAc,KAAA;;;;;;;;;;;;;EAkBd,UAAA;;;;;;;;;;;;;EAiBA,kBAAA;;;;;;;;;;;;;EAqBA,MAAA;;;;;;;;;;;;;EAoBA,KAAA;;;;;;;;;;;;;;EAoBA,WAAA,CAAY,OAAA,GAAS,IAAA,CAAK,kBAAA;;;;;;;;;;;EAwB1B,OAAA;;;;;;;;;;;;;;EAkBA,aAAA;;;;;;;;;;;;;EAqBA,QAAA;;;;;;;;;;;;;;EAsBA,OAAA,CAAQ,IAAA;;;;;;;;EAgBR,KAAA,CAAM,UAAA,UAAoB,IAAA;;;;;;;;;;;;;;EAyB1B,KAAA,CAAM,UAAA;;;;;;;;;;;;;EAiBN,KAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCA,UAAA,CAAW,YAAA;IAAyB,KAAA;EAAA;;;;;;;;;;;;;;EA2BpC,EAAA,CAAG,MAAA;;;;;;;;;;;;;;EAoBH,QAAA,CAAS,MAAA,EAAQ,oBAAA;;;;;;;;;;;;;;EAoBjB,QAAA,CAAS,MAAA,EAAQ,oBAAA;;;;;;;;;;;;;EAmBjB,UAAA;;;;;;;;;;;;;;;;;;;;;EAgCA,MAAA;;;;EAsCA,MAAA;;;;;;;;;;;;;;;;;;;;;;;EA8BA,WAAA,CAAY,UAAA;;;;;;;;EAYZ,MAAA;;;;;;;;EAiBA,OAAA;;;;;;;;EAqBA,aAAA,IAAiB,gBAAA;AAAA"}
1
+ {"version":3,"file":"column-builder.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/migration/column-builder.ts"],"mappings":";;;;;;KAWK;EACH,gBAAgB;IAAS;IAAmB;;EAC5C,uBAAuB,IAAI;EAC3B,uBAAuB,gBAAgB,SAAS,KAAK;;;;;;;;;;;;;;;;;;;;;;;;qBAqC1C;mBAmBQ;;mBAjBF;;UAGT;;UAGA;;;;;;;;;EAUR,YACmB,WAAW,eAC5B,cACA,MAAM,YACN,UAAS,QACP,KAAK;;;;;;;;;;;EAyBF;;;;;;;;EAYA;;;;;;;;;;;;;;;;;;EA0BA,QAAQ;;;;;;;;;;;;;;;;EAqBR,cAAc;;;;;;;;;;;;;EAkBd;;;;;;;;;;;;;EAiBA;;;;;;;;;;;;;EAqBA;;;;;;;;;;;;;EAoBA;;;;;;;;;;;;;;EAoBA,YAAY,UAAS,KAAK;;;;;;;;;;;EAwB1B;;;;;;;;;;;;;;EAkBA;;;;;;;;;;;;;EAqBA;;;;;;;;;;;;;;EAsBA,QAAQ;;;;;;;;EAgBR,MAAM,oBAAoB;;;;;;;;;;;;;;EAyB1B,MAAM;;;;;;;;;;;;;EAiBN;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmCA,WAAW;IAAyB;;;;;;;;;;;;;;;EA2BpC,GAAG;;;;;;;;;;;;;;EAoBH,SAAS,QAAQ;;;;;;;;;;;;;;EAoBjB,SAAS,QAAQ;;;;;;;;;;;;;EAmBjB;;;;;;;;;;;;;;;;;;;;;EAgCA;;;;EAsCA;;;;;;;;;;;;;;;;;;;;;;;EA8BA,YAAY;;;;;;;;EAYZ;;;;;;;;EAiBA;;;;;;;;EAqBA,iBAAiB"}
@@ -1,6 +1,5 @@
1
1
  import { VectorIndexOptions } from "../contracts/migration-driver.contract.mjs";
2
2
  import { ColumnBuilder } from "./column-builder.mjs";
3
-
4
3
  //#region ../../packages/cascade/src/migration/column-helpers.d.ts
5
4
  /**
6
5
  * A no-op migration sink used by standalone column helpers.
@@ -37,7 +36,7 @@ declare class DetachedMigrationSink {
37
36
  * A `ColumnBuilder` that carries its own detached sink so it can be
38
37
  * constructed outside of a migration class and later merged in.
39
38
  */
40
- declare class DetachedColumnBuilder extends ColumnBuilder {
39
+ export declare class DetachedColumnBuilder extends ColumnBuilder {
41
40
  readonly sink: DetachedMigrationSink;
42
41
  constructor(type: ConstructorParameters<typeof ColumnBuilder>[2], name: string, options?: ConstructorParameters<typeof ColumnBuilder>[3]);
43
42
  }
@@ -53,7 +52,7 @@ declare class DetachedColumnBuilder extends ColumnBuilder {
53
52
  * });
54
53
  * ```
55
54
  */
56
- declare function string(length?: number): DetachedColumnBuilder;
55
+ export declare function string(length?: number): DetachedColumnBuilder;
57
56
  /**
58
57
  * Standalone column helper: fixed-length CHAR.
59
58
  *
@@ -62,7 +61,7 @@ declare function string(length?: number): DetachedColumnBuilder;
62
61
  * code: char(3) // CHAR(3)
63
62
  * ```
64
63
  */
65
- declare function char(length: number): DetachedColumnBuilder;
64
+ export declare function char(length: number): DetachedColumnBuilder;
66
65
  /**
67
66
  * Standalone column helper: TEXT (unlimited length).
68
67
  *
@@ -75,15 +74,15 @@ declare function char(length: number): DetachedColumnBuilder;
75
74
  * });
76
75
  * ```
77
76
  */
78
- declare function text(): DetachedColumnBuilder;
77
+ export declare function text(): DetachedColumnBuilder;
79
78
  /**
80
79
  * Standalone column helper: MEDIUMTEXT.
81
80
  */
82
- declare function mediumText(): DetachedColumnBuilder;
81
+ export declare function mediumText(): DetachedColumnBuilder;
83
82
  /**
84
83
  * Standalone column helper: LONGTEXT.
85
84
  */
86
- declare function longText(): DetachedColumnBuilder;
85
+ export declare function longText(): DetachedColumnBuilder;
87
86
  /**
88
87
  * Standalone column helper: INTEGER.
89
88
  *
@@ -92,35 +91,35 @@ declare function longText(): DetachedColumnBuilder;
92
91
  * age: integer().unsigned()
93
92
  * ```
94
93
  */
95
- declare function integer(): DetachedColumnBuilder;
94
+ export declare function integer(): DetachedColumnBuilder;
96
95
  /** Alias for `integer()`. */
97
- declare const int: typeof integer;
96
+ export declare const int: typeof integer;
98
97
  /**
99
98
  * Standalone column helper: SMALLINT.
100
99
  */
101
- declare function smallInteger(): DetachedColumnBuilder;
100
+ export declare function smallInteger(): DetachedColumnBuilder;
102
101
  /** Alias for `smallInteger()`. */
103
- declare const smallInt: typeof smallInteger;
102
+ export declare const smallInt: typeof smallInteger;
104
103
  /**
105
104
  * Standalone column helper: TINYINT.
106
105
  */
107
- declare function tinyInteger(): DetachedColumnBuilder;
106
+ export declare function tinyInteger(): DetachedColumnBuilder;
108
107
  /** Alias for `tinyInteger()`. */
109
- declare const tinyInt: typeof tinyInteger;
108
+ export declare const tinyInt: typeof tinyInteger;
110
109
  /**
111
110
  * Standalone column helper: BIGINT.
112
111
  */
113
- declare function bigInteger(): DetachedColumnBuilder;
112
+ export declare function bigInteger(): DetachedColumnBuilder;
114
113
  /** Alias for `bigInteger()`. */
115
- declare const bigInt: typeof bigInteger;
114
+ export declare const bigInt: typeof bigInteger;
116
115
  /**
117
116
  * Standalone column helper: FLOAT.
118
117
  */
119
- declare function float(): DetachedColumnBuilder;
118
+ export declare function float(): DetachedColumnBuilder;
120
119
  /**
121
120
  * Standalone column helper: DOUBLE.
122
121
  */
123
- declare function double(): DetachedColumnBuilder;
122
+ export declare function double(): DetachedColumnBuilder;
124
123
  /**
125
124
  * Standalone column helper: DECIMAL.
126
125
  *
@@ -129,7 +128,7 @@ declare function double(): DetachedColumnBuilder;
129
128
  * price: decimal(10, 2) // DECIMAL(10,2)
130
129
  * ```
131
130
  */
132
- declare function decimal(precision?: number, scale?: number): DetachedColumnBuilder;
131
+ export declare function decimal(precision?: number, scale?: number): DetachedColumnBuilder;
133
132
  /**
134
133
  * Standalone column helper: BOOLEAN.
135
134
  *
@@ -140,15 +139,15 @@ declare function decimal(precision?: number, scale?: number): DetachedColumnBuil
140
139
  * is_active: boolCol().default(true)
141
140
  * ```
142
141
  */
143
- declare function boolCol(): DetachedColumnBuilder;
142
+ export declare function boolCol(): DetachedColumnBuilder;
144
143
  /**
145
144
  * Standalone column helper: DATE.
146
145
  */
147
- declare function date(): DetachedColumnBuilder;
146
+ export declare function date(): DetachedColumnBuilder;
148
147
  /**
149
148
  * Standalone column helper: DATETIME.
150
149
  */
151
- declare function dateTime(): DetachedColumnBuilder;
150
+ export declare function dateTime(): DetachedColumnBuilder;
152
151
  /**
153
152
  * Standalone column helper: TIMESTAMP.
154
153
  *
@@ -157,15 +156,15 @@ declare function dateTime(): DetachedColumnBuilder;
157
156
  * started_at: timestamp().default("NOW()")
158
157
  * ```
159
158
  */
160
- declare function timestamp(): DetachedColumnBuilder;
159
+ export declare function timestamp(): DetachedColumnBuilder;
161
160
  /**
162
161
  * Standalone column helper: TIME.
163
162
  */
164
- declare function time(): DetachedColumnBuilder;
163
+ export declare function time(): DetachedColumnBuilder;
165
164
  /**
166
165
  * Standalone column helper: YEAR.
167
166
  */
168
- declare function year(): DetachedColumnBuilder;
167
+ export declare function year(): DetachedColumnBuilder;
169
168
  /**
170
169
  * Standalone column helper: JSON.
171
170
  *
@@ -177,19 +176,19 @@ declare function year(): DetachedColumnBuilder;
177
176
  * metadata: json().nullable()
178
177
  * ```
179
178
  */
180
- declare function json(): DetachedColumnBuilder;
179
+ export declare function json(): DetachedColumnBuilder;
181
180
  /**
182
181
  * Alias for `json()`. Named `objectCol` to avoid collision with TS `object` type.
183
182
  */
184
- declare function objectCol(): DetachedColumnBuilder;
183
+ export declare function objectCol(): DetachedColumnBuilder;
185
184
  /**
186
185
  * Standalone column helper: BINARY / BLOB.
187
186
  */
188
- declare function binary(): DetachedColumnBuilder;
187
+ export declare function binary(): DetachedColumnBuilder;
189
188
  /**
190
189
  * Alias for `binary()`. Named `blobCol` to avoid collision with the Web `Blob` API.
191
190
  */
192
- declare function blobCol(): DetachedColumnBuilder;
191
+ export declare function blobCol(): DetachedColumnBuilder;
193
192
  /**
194
193
  * Standalone column helper: UUID.
195
194
  *
@@ -202,35 +201,35 @@ declare function blobCol(): DetachedColumnBuilder;
202
201
  * });
203
202
  * ```
204
203
  */
205
- declare function uuid(): DetachedColumnBuilder;
204
+ export declare function uuid(): DetachedColumnBuilder;
206
205
  /**
207
206
  * Standalone column helper: ULID.
208
207
  */
209
- declare function ulid(): DetachedColumnBuilder;
208
+ export declare function ulid(): DetachedColumnBuilder;
210
209
  /**
211
210
  * Standalone column helper: IP address.
212
211
  */
213
- declare function ipAddress(): DetachedColumnBuilder;
212
+ export declare function ipAddress(): DetachedColumnBuilder;
214
213
  /**
215
214
  * Standalone column helper: MAC address.
216
215
  */
217
- declare function macAddress(): DetachedColumnBuilder;
216
+ export declare function macAddress(): DetachedColumnBuilder;
218
217
  /**
219
218
  * Standalone column helper: geo point.
220
219
  */
221
- declare function point(): DetachedColumnBuilder;
220
+ export declare function point(): DetachedColumnBuilder;
222
221
  /**
223
222
  * Standalone column helper: polygon.
224
223
  */
225
- declare function polygon(): DetachedColumnBuilder;
224
+ export declare function polygon(): DetachedColumnBuilder;
226
225
  /**
227
226
  * Standalone column helper: line string.
228
227
  */
229
- declare function lineString(): DetachedColumnBuilder;
228
+ export declare function lineString(): DetachedColumnBuilder;
230
229
  /**
231
230
  * Standalone column helper: generic geometry.
232
231
  */
233
- declare function geometry(): DetachedColumnBuilder;
232
+ export declare function geometry(): DetachedColumnBuilder;
234
233
  /**
235
234
  * Standalone column helper: vector (for AI embeddings).
236
235
  *
@@ -241,7 +240,7 @@ declare function geometry(): DetachedColumnBuilder;
241
240
  * embedding: vector(1536)
242
241
  * ```
243
242
  */
244
- declare function vector(dimensions: number): DetachedColumnBuilder;
243
+ export declare function vector(dimensions: number): DetachedColumnBuilder;
245
244
  /**
246
245
  * Standalone column helper: ENUM.
247
246
  *
@@ -250,31 +249,31 @@ declare function vector(dimensions: number): DetachedColumnBuilder;
250
249
  * status: enumCol(["active", "inactive", "pending"])
251
250
  * ```
252
251
  */
253
- declare function enumCol(values: string[]): DetachedColumnBuilder;
252
+ export declare function enumCol(values: string[]): DetachedColumnBuilder;
254
253
  /**
255
254
  * Standalone column helper: SET (multiple values).
256
255
  */
257
- declare function setCol(values: string[]): DetachedColumnBuilder;
256
+ export declare function setCol(values: string[]): DetachedColumnBuilder;
258
257
  /** Standalone helper: INTEGER[] */
259
- declare function arrayInt(): DetachedColumnBuilder;
258
+ export declare function arrayInt(): DetachedColumnBuilder;
260
259
  /** Standalone helper: BIGINT[] */
261
- declare function arrayBigInt(): DetachedColumnBuilder;
260
+ export declare function arrayBigInt(): DetachedColumnBuilder;
262
261
  /** Standalone helper: REAL[] */
263
- declare function arrayFloat(): DetachedColumnBuilder;
262
+ export declare function arrayFloat(): DetachedColumnBuilder;
264
263
  /** Standalone helper: DECIMAL[] */
265
- declare function arrayDecimal(precision?: number, scale?: number): DetachedColumnBuilder;
264
+ export declare function arrayDecimal(precision?: number, scale?: number): DetachedColumnBuilder;
266
265
  /** Standalone helper: BOOLEAN[] */
267
- declare function arrayBoolean(): DetachedColumnBuilder;
266
+ export declare function arrayBoolean(): DetachedColumnBuilder;
268
267
  /** Standalone helper: TEXT[] */
269
- declare function arrayText(): DetachedColumnBuilder;
268
+ export declare function arrayText(): DetachedColumnBuilder;
270
269
  /** Standalone helper: DATE[] */
271
- declare function arrayDate(): DetachedColumnBuilder;
270
+ export declare function arrayDate(): DetachedColumnBuilder;
272
271
  /** Standalone helper: TIMESTAMPTZ[] */
273
- declare function arrayTimestamp(): DetachedColumnBuilder;
272
+ export declare function arrayTimestamp(): DetachedColumnBuilder;
274
273
  /** Standalone helper: UUID[] */
275
- declare function arrayUuid(): DetachedColumnBuilder;
274
+ export declare function arrayUuid(): DetachedColumnBuilder;
276
275
  /** Standalone helper: JSONB[] */
277
- declare function arrayJson(): DetachedColumnBuilder;
276
+ export declare function arrayJson(): DetachedColumnBuilder;
278
277
  //#endregion
279
- export { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year };
278
+ export { boolCol as bool };
280
279
  //# sourceMappingURL=column-helpers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"column-helpers.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/migration/column-helpers.ts"],"mappings":";;;;;;;AAAiD;;;;;;;;cAa3C,qBAAA;EAE8B;EAAA,SAAlB,cAAA;IAAkB,OAAA;IAAmB,MAAA;EAAA;EAQnD;EAAA,SALc,kBAAA;EAQT;EAAA,SALS,oBAAA;IACd,MAAA;IACA,OAAA,EAVuB,kBAAA;EAAA;EAalB,eAAA,CAAgB,KAAA;IAAS,OAAA;IAAmB,MAAA;EAAA;EAI5C,sBAAA,CAAuB,EAAA;EAIvB,qBAAA,CACL,MAAA,UACA,OAAA,EAAS,IAAA,CAbmE,kBAAA;AAAA;AAagB;AAUhG;;;AAVgG,cAUnF,qBAAA,SAA8B,aAAA;EAAA,SACzB,IAAA,EAAM,qBAAA;cAGpB,IAAA,EAAM,qBAAA,QAA6B,aAAA,MACnC,IAAA,UACA,OAAA,GAAS,qBAAA,QAA6B,aAAA;AAAA;;;;;;;;;;;;;iBAwB1B,MAAA,CAAO,MAAA,YAAe,qBAAqB;;;;AAxBK;AAwBhE;;;;iBAYgB,IAAA,CAAK,MAAA,WAAiB,qBAAqB;AAA3D;;;;AAA2D;AAgB3D;;;;AAA6C;AAO7C;;AAvBA,iBAgBgB,IAAA,IAAQ,qBAAqB;;AAOM;AAOnD;iBAPgB,UAAA,IAAc,qBAAqB;;;AAOF;iBAAjC,QAAA,IAAY,qBAAqB;;;;AAgBD;AAKhD;;;;iBALgB,OAAA,IAAW,qBAAqB;AAUhD;AAAA,cALa,GAAA,SAAG,OAAU;;;AAK2B;iBAArC,YAAA,IAAgB,qBAAqB;;cAKxC,QAAA,SAAQ,YAAe;;AAAA;AAKpC;iBAAgB,WAAA,IAAe,qBAAqB;;cAKvC,OAAA,SAAO,WAAc;AALkB;AAKpD;;AALoD,iBAUpC,UAAA,IAAc,qBAAqB;;cAKtC,MAAA,SAAM,UAAa;AALhC;;;AAAA,iBAUgB,KAAA,IAAS,qBAAqB;AAVK;AAKnD;;AALmD,iBAiBnC,MAAA,IAAU,qBAAqB;;AAZf;AAKhC;;;;AAA8C;AAO9C;iBAYgB,OAAA,CAAQ,SAAA,WAAe,KAAA,YAAY,qBAAqB;;;AAZzB;AAY/C;;;;;;;iBAkBgB,OAAA,IAAW,qBAAqB;;;;iBAchC,IAAA,IAAQ,qBAAqB;AAA7C;;;AAAA,iBAOgB,QAAA,IAAY,qBAAqB;AAPJ;AAO7C;;;;AAAiD;AAYjD;;AAnB6C,iBAmB7B,SAAA,IAAa,qBAAqB;;AAAA;AAOlD;iBAAgB,IAAA,IAAQ,qBAAqB;;;AAAA;iBAO7B,IAAA,IAAQ,qBAAqB;;;;AAAA;AAmB7C;;;;AAA6C;AAO7C;;iBAPgB,IAAA,IAAQ,qBAAqB;;AAOK;AAOlD;iBAPgB,SAAA,IAAa,qBAAqB;;;AAOH;iBAA/B,MAAA,IAAU,qBAAqB;;;;iBAO/B,OAAA,IAAW,qBAAqB;AAoBhD;;;;AAA6C;AAO7C;;;;AAA6C;AAW7C;;AAlBA,iBAAgB,IAAA,IAAQ,qBAAqB;;AAkBK;AAOlD;iBAlBgB,IAAA,IAAQ,qBAAqB;;;AAkBM;iBAPnC,SAAA,IAAa,qBAAqB;;;;iBAOlC,UAAA,IAAc,qBAAqB;AAkBnD;;;AAAA,iBAPgB,KAAA,IAAS,qBAAqB;AAOE;AAOhD;;AAPgD,iBAAhC,OAAA,IAAW,qBAAqB;;AAOG;AAOnD;iBAPgB,UAAA,IAAc,qBAAqB;;;AAOF;iBAAjC,QAAA,IAAY,qBAAqB;;;;AAkBgB;AAgBjE;;;;AAAgE;AAOhE;iBAvBgB,MAAA,CAAO,UAAA,WAAqB,qBAAqB;;;AAuBF;AAS/D;;;;AAAiD;iBAhBjC,OAAA,CAAQ,MAAA,aAAmB,qBAAqB;;;;iBAOhD,MAAA,CAAO,MAAA,aAAmB,qBAAqB;AAmB/D;AAAA,iBAVgB,QAAA,IAAY,qBAAqB;;iBAKjC,WAAA,IAAe,qBAAqB;AAKD;AAAA,iBAAnC,UAAA,IAAc,qBAAqB;;iBAKnC,YAAA,CAAa,SAAA,WAAoB,KAAA,YAAiB,qBAAqB;;iBAKvE,YAAA,IAAgB,qBAAqB;;iBAKrC,SAAA,IAAa,qBAAqB;;iBAKlC,SAAA,IAAa,qBAAqB;AAVlD;AAAA,iBAegB,cAAA,IAAkB,qBAAqB;;iBAKvC,SAAA,IAAa,qBAAqB;AApBG;AAAA,iBAyBrC,SAAA,IAAa,qBAAqB"}
1
+ {"version":3,"file":"column-helpers.d.mts","names":["_$___contracts_migration_driver_contract0.VectorIndexOptions"],"sources":["../../../../../../../../packages/cascade/src/migration/column-helpers.ts"],"mappings":";;;;;;;;;;;;;;cAaM;;WAEY;IAAkB;IAAmB;;;WAGrC;;WAGA;IACd;IACA,SAVEA;;EAaG,gBAAgB;IAAS;IAAmB;;EAI5C,uBAAuB;EAIvB,sBACL,gBACA,SAAS,KAbiDA;;;;;;qBAuBjD,8BAA8B;WACzB,MAAM;EAEtB,YACE,MAAM,6BAA6B,mBACnC,cACA,UAAS,6BAA6B;;;;;;;;;;;;;;wBAwB1B,OAAO,kBAAe;;;;;;;;;wBAYtB,KAAK,iBAAiB;;;;;;;;;;;;;wBAgBtB,QAAQ;;;;wBAOR,cAAc;;;;wBAOd,YAAY;;;;;;;;;wBAgBZ,WAAW;;qBAKd,YAAG;;;;wBAKA,gBAAgB;;qBAKnB,iBAAQ;;;;wBAKL,eAAe;;qBAKlB,gBAAO;;;;wBAKJ,cAAc;;qBAKjB,eAAM;;;;wBAKH,SAAS;;;;wBAOT,UAAU;;;;;;;;;wBAYV,QAAQ,oBAAe,iBAAY;;;;;;;;;;;wBAkBnC,WAAW;;;;wBAcX,QAAQ;;;;wBAOR,YAAY;;;;;;;;;wBAYZ,aAAa;;;;wBAOb,QAAQ;;;;wBAOR,QAAQ;;;;;;;;;;;;wBAmBR,QAAQ;;;;wBAOR,aAAa;;;;wBAOb,UAAU;;;;wBAOV,WAAW;;;;;;;;;;;;;wBAoBX,QAAQ;;;;wBAOR,QAAQ;;;;wBAWR,aAAa;;;;wBAOb,cAAc;;;;wBAWd,SAAS;;;;wBAOT,WAAW;;;;wBAOX,cAAc;;;;wBAOd,YAAY;;;;;;;;;;;wBAkBZ,OAAO,qBAAqB;;;;;;;;;wBAgB5B,QAAQ,mBAAmB;;;;wBAO3B,OAAO,mBAAmB;;wBAS1B,YAAY;;wBAKZ,eAAe;;wBAKf,cAAc;;wBAKd,aAAa,oBAAoB,iBAAiB;;wBAKlD,gBAAgB;;wBAKhB,aAAa;;wBAKb,aAAa;;wBAKb,kBAAkB;;wBAKlB,aAAa;;wBAKb,aAAa"}
@@ -372,5 +372,5 @@ function arrayJson() {
372
372
  }
373
373
 
374
374
  //#endregion
375
- export { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year };
375
+ export { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol as bool, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year };
376
376
  //# sourceMappingURL=column-helpers.mjs.map
@@ -1,5 +1,4 @@
1
1
  import { ForeignKeyDefinition } from "../contracts/migration-driver.contract.mjs";
2
-
3
2
  //#region ../../packages/cascade/src/migration/foreign-key-builder.d.ts
4
3
  /**
5
4
  * Reference to the Migration type to avoid circular imports.
@@ -25,7 +24,7 @@ type MigrationLike = {
25
24
  * .onUpdate("cascade");
26
25
  * ```
27
26
  */
28
- declare class ForeignKeyBuilder {
27
+ export declare class ForeignKeyBuilder {
29
28
  private readonly migration;
30
29
  /** Mutable foreign key definition being accumulated */
31
30
  private readonly definition;
@@ -102,5 +101,5 @@ declare class ForeignKeyBuilder {
102
101
  cascadeAll(): this;
103
102
  }
104
103
  //#endregion
105
- export { ForeignKeyBuilder };
104
+ export {};
106
105
  //# sourceMappingURL=foreign-key-builder.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"foreign-key-builder.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/migration/foreign-key-builder.ts"],"mappings":";;;;;AAAmF;KAK9E,aAAA;EACH,sBAAA,CAAuB,EAAA,EAAI,oBAAoB;AAAA;;;;;AAAA;AAiCjD;;;;;;;;;;;;;cAAa,iBAAA;EAAA,iBAWQ,SAAA;EAkBP;EAAA,iBA3BK,UAAA;EAiDC;;;;;;cAxCC,SAAA,EAAW,aAAA,EAC5B,MAAA;EA6Ec;;;AAeC;;;EA3EV,IAAA,CAAK,IAAA;;;;;;;;;;;;;;;;;;EAsBL,UAAA,CAAW,KAAA,UAAe,MAAA;;;;;;;;;;;;;;EAoB1B,QAAA,CAAS,MAAA,EAAQ,oBAAA;;;;;;;;;;;;;;EAkBjB,QAAA,CAAS,MAAA,EAAQ,oBAAA;;;;;;;;;;;EAejB,UAAA;AAAA"}
1
+ {"version":3,"file":"foreign-key-builder.d.mts","names":[],"sources":["../../../../../../../../packages/cascade/src/migration/foreign-key-builder.ts"],"mappings":";;;;;KAKK;EACH,uBAAuB,IAAI;;;;;;;;;;;;;;;;;;;;qBAiChB;mBAWQ;;mBATF;;;;;;;EAQjB,YACmB,WAAW,eAC5B;;;;;;;EAiBK,KAAK;;;;;;;;;;;;;;;;;;EAsBL,WAAW,eAAe;;;;;;;;;;;;;;EAoB1B,SAAS,QAAQ;;;;;;;;;;;;;;EAkBjB,SAAS,QAAQ;;;;;;;;;;;EAejB"}
@@ -1 +1 @@
1
- {"version":3,"file":"foreign-key-builder.mjs","names":[],"sources":["../../../../../../../../packages/cascade/src/migration/foreign-key-builder.ts"],"sourcesContent":["import type { ForeignKeyDefinition } from \"../contracts/migration-driver.contract\";\n\n/**\n * Reference to the Migration type to avoid circular imports.\n */\ntype MigrationLike = {\n addForeignKeyOperation(fk: ForeignKeyDefinition): void;\n};\n\n/**\n * Mutable foreign key definition being built.\n */\ninterface MutableForeignKeyDefinition {\n name?: string;\n column: string;\n referencesTable: string;\n referencesColumn: string;\n onDelete: ForeignKeyDefinition[\"onDelete\"];\n onUpdate: ForeignKeyDefinition[\"onUpdate\"];\n}\n\n/**\n * Fluent builder for foreign key constraints.\n *\n * Allows building foreign key definitions with a chainable API.\n * SQL-only feature; NoSQL drivers ignore foreign keys.\n *\n * The operation is pushed when `.references()` is called using a mutable\n * reference — subsequent `.onDelete()` / `.onUpdate()` calls mutate the\n * same definition already queued in pendingOperations.\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\")\n * .references(\"users\", \"id\")\n * .onDelete(\"cascade\")\n * .onUpdate(\"cascade\");\n * ```\n */\nexport class ForeignKeyBuilder {\n /** Mutable foreign key definition being accumulated */\n private readonly definition: MutableForeignKeyDefinition;\n\n /**\n * Create a new foreign key builder.\n *\n * @param migration - Parent migration instance\n * @param column - Local column name that will reference another table\n */\n public constructor(\n private readonly migration: MigrationLike,\n column: string,\n ) {\n this.definition = {\n column,\n referencesTable: \"\",\n referencesColumn: \"id\",\n onDelete: \"restrict\",\n onUpdate: \"restrict\",\n };\n }\n\n /**\n * Set the constraint name.\n *\n * @param name - Constraint name (auto-generated if not provided)\n * @returns This builder for chaining\n */\n public name(name: string): this {\n this.definition.name = name;\n return this;\n }\n\n /**\n * Set the referenced table and column, and register the foreign key operation.\n *\n * Pushes the operation immediately using a mutable reference — any\n * `.onDelete()` / `.onUpdate()` calls after this will mutate the same\n * definition already queued in pendingOperations.\n *\n * @param table - Referenced table name\n * @param column - Referenced column name (default: \"id\")\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\").references(\"users\", \"id\");\n * this.foreign(\"category_id\").references(\"categories\"); // defaults to \"id\"\n * ```\n */\n public references(table: string, column = \"id\"): this {\n this.definition.referencesTable = table;\n this.definition.referencesColumn = column;\n this.migration.addForeignKeyOperation(this.definition as ForeignKeyDefinition);\n return this;\n }\n\n /**\n * Set the ON DELETE action.\n *\n * @param action - Action to take when referenced row is deleted\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\")\n * .references(\"users\")\n * .onDelete(\"cascade\"); // Delete child when parent is deleted\n * ```\n */\n public onDelete(action: ForeignKeyDefinition[\"onDelete\"]): this {\n this.definition.onDelete = action;\n return this;\n }\n\n /**\n * Set the ON UPDATE action.\n *\n * @param action - Action to take when referenced row's key is updated\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\")\n * .references(\"users\")\n * .onUpdate(\"cascade\"); // Update child when parent key changes\n * ```\n */\n public onUpdate(action: ForeignKeyDefinition[\"onUpdate\"]): this {\n this.definition.onUpdate = action;\n return this;\n }\n\n /**\n * Shorthand for `.onDelete(\"cascade\").onUpdate(\"cascade\")`.\n *\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\").references(\"users\").cascadeAll();\n * ```\n */\n public cascadeAll(): this {\n this.definition.onDelete = \"cascade\";\n this.definition.onUpdate = \"cascade\";\n return this;\n }\n\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,IAAa,oBAAb,MAA+B;CAWV;;CATnB,AAAiB;;;;;;;CAQjB,AAAO,YACL,AAAiB,WACjB,QACA;EAFiB;EAGjB,KAAK,aAAa;GAChB;GACA,iBAAiB;GACjB,kBAAkB;GAClB,UAAU;GACV,UAAU;EACZ;CACF;;;;;;;CAQA,AAAO,KAAK,MAAoB;EAC9B,KAAK,WAAW,OAAO;EACvB,OAAO;CACT;;;;;;;;;;;;;;;;;;CAmBA,AAAO,WAAW,OAAe,SAAS,MAAY;EACpD,KAAK,WAAW,kBAAkB;EAClC,KAAK,WAAW,mBAAmB;EACnC,KAAK,UAAU,uBAAuB,KAAK,UAAkC;EAC7E,OAAO;CACT;;;;;;;;;;;;;;CAeA,AAAO,SAAS,QAAgD;EAC9D,KAAK,WAAW,WAAW;EAC3B,OAAO;CACT;;;;;;;;;;;;;;CAeA,AAAO,SAAS,QAAgD;EAC9D,KAAK,WAAW,WAAW;EAC3B,OAAO;CACT;;;;;;;;;;;CAYA,AAAO,aAAmB;EACxB,KAAK,WAAW,WAAW;EAC3B,KAAK,WAAW,WAAW;EAC3B,OAAO;CACT;AAEF"}
1
+ {"version":3,"file":"foreign-key-builder.mjs","names":[],"sources":["../../../../../../../../packages/cascade/src/migration/foreign-key-builder.ts"],"sourcesContent":["import type { ForeignKeyDefinition } from \"../contracts/migration-driver.contract\";\n\n/**\n * Reference to the Migration type to avoid circular imports.\n */\ntype MigrationLike = {\n addForeignKeyOperation(fk: ForeignKeyDefinition): void;\n};\n\n/**\n * Mutable foreign key definition being built.\n */\ninterface MutableForeignKeyDefinition {\n name?: string;\n column: string;\n referencesTable: string;\n referencesColumn: string;\n onDelete: ForeignKeyDefinition[\"onDelete\"];\n onUpdate: ForeignKeyDefinition[\"onUpdate\"];\n}\n\n/**\n * Fluent builder for foreign key constraints.\n *\n * Allows building foreign key definitions with a chainable API.\n * SQL-only feature; NoSQL drivers ignore foreign keys.\n *\n * The operation is pushed when `.references()` is called using a mutable\n * reference — subsequent `.onDelete()` / `.onUpdate()` calls mutate the\n * same definition already queued in pendingOperations.\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\")\n * .references(\"users\", \"id\")\n * .onDelete(\"cascade\")\n * .onUpdate(\"cascade\");\n * ```\n */\nexport class ForeignKeyBuilder {\n /** Mutable foreign key definition being accumulated */\n private readonly definition: MutableForeignKeyDefinition;\n\n /**\n * Create a new foreign key builder.\n *\n * @param migration - Parent migration instance\n * @param column - Local column name that will reference another table\n */\n public constructor(\n private readonly migration: MigrationLike,\n column: string,\n ) {\n this.definition = {\n column,\n referencesTable: \"\",\n referencesColumn: \"id\",\n onDelete: \"restrict\",\n onUpdate: \"restrict\",\n };\n }\n\n /**\n * Set the constraint name.\n *\n * @param name - Constraint name (auto-generated if not provided)\n * @returns This builder for chaining\n */\n public name(name: string): this {\n this.definition.name = name;\n return this;\n }\n\n /**\n * Set the referenced table and column, and register the foreign key operation.\n *\n * Pushes the operation immediately using a mutable reference — any\n * `.onDelete()` / `.onUpdate()` calls after this will mutate the same\n * definition already queued in pendingOperations.\n *\n * @param table - Referenced table name\n * @param column - Referenced column name (default: \"id\")\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\").references(\"users\", \"id\");\n * this.foreign(\"category_id\").references(\"categories\"); // defaults to \"id\"\n * ```\n */\n public references(table: string, column = \"id\"): this {\n this.definition.referencesTable = table;\n this.definition.referencesColumn = column;\n this.migration.addForeignKeyOperation(this.definition as ForeignKeyDefinition);\n return this;\n }\n\n /**\n * Set the ON DELETE action.\n *\n * @param action - Action to take when referenced row is deleted\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\")\n * .references(\"users\")\n * .onDelete(\"cascade\"); // Delete child when parent is deleted\n * ```\n */\n public onDelete(action: ForeignKeyDefinition[\"onDelete\"]): this {\n this.definition.onDelete = action;\n return this;\n }\n\n /**\n * Set the ON UPDATE action.\n *\n * @param action - Action to take when referenced row's key is updated\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\")\n * .references(\"users\")\n * .onUpdate(\"cascade\"); // Update child when parent key changes\n * ```\n */\n public onUpdate(action: ForeignKeyDefinition[\"onUpdate\"]): this {\n this.definition.onUpdate = action;\n return this;\n }\n\n /**\n * Shorthand for `.onDelete(\"cascade\").onUpdate(\"cascade\")`.\n *\n * @returns This builder for chaining\n *\n * @example\n * ```typescript\n * this.foreign(\"user_id\").references(\"users\").cascadeAll();\n * ```\n */\n public cascadeAll(): this {\n this.definition.onDelete = \"cascade\";\n this.definition.onUpdate = \"cascade\";\n return this;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAuCA,IAAa,oBAAb,MAA+B;CAWV;;CATnB,AAAiB;;;;;;;CAQjB,AAAO,YACL,AAAiB,WACjB,QACA;EAFiB;EAGjB,KAAK,aAAa;GAChB;GACA,iBAAiB;GACjB,kBAAkB;GAClB,UAAU;GACV,UAAU;EACZ;CACF;;;;;;;CAQA,AAAO,KAAK,MAAoB;EAC9B,KAAK,WAAW,OAAO;EACvB,OAAO;CACT;;;;;;;;;;;;;;;;;;CAmBA,AAAO,WAAW,OAAe,SAAS,MAAY;EACpD,KAAK,WAAW,kBAAkB;EAClC,KAAK,WAAW,mBAAmB;EACnC,KAAK,UAAU,uBAAuB,KAAK,UAAkC;EAC7E,OAAO;CACT;;;;;;;;;;;;;;CAeA,AAAO,SAAS,QAAgD;EAC9D,KAAK,WAAW,WAAW;EAC3B,OAAO;CACT;;;;;;;;;;;;;;CAeA,AAAO,SAAS,QAAgD;EAC9D,KAAK,WAAW,WAAW;EAC3B,OAAO;CACT;;;;;;;;;;;CAYA,AAAO,aAAmB;EACxB,KAAK,WAAW,WAAW;EAC3B,KAAK,WAAW,WAAW;EAC3B,OAAO;CACT;AACF"}
@@ -1,6 +1,7 @@
1
1
  import { ColumnBuilder } from "./column-builder.mjs";
2
- import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./column-helpers.mjs";
2
+ import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, bool as boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./column-helpers.mjs";
3
3
  import { ForeignKeyBuilder } from "./foreign-key-builder.mjs";
4
4
  import { AlterSchema, ColumnMap, IndexEntry, Migration, MigrationAlterOptions, MigrationConstructor, MigrationContract, MigrationCreateOptions, MigrationOrigin, MigrationStep, OperationType, PendingOperation, UniqueEntry, migrate } from "./migration.mjs";
5
5
  import { MigrationRecord, MigrationResult, MigrationRunnerOptions, MigrationStatus, RollbackOptions, RunMigrationsOptions } from "./types.mjs";
6
- import { MigrationRunner, inferMigrationName, migrationRunner } from "./migration-runner.mjs";
6
+ import { MigrationRunner, inferMigrationName, migrationRunner } from "./migration-runner.mjs";
7
+ export { AlterSchema, ColumnBuilder, ColumnMap, DetachedColumnBuilder, ForeignKeyBuilder, IndexEntry, Migration, MigrationAlterOptions, MigrationConstructor, MigrationContract, MigrationCreateOptions, MigrationOrigin, type MigrationRecord, type MigrationResult, MigrationRunner, type MigrationRunnerOptions, type MigrationStatus, MigrationStep, OperationType, PendingOperation, type RollbackOptions, type RunMigrationsOptions, UniqueEntry, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol as bool, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, inferMigrationName, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, migrate, migrationRunner, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year };
@@ -1,7 +1,7 @@
1
1
  import { ColumnBuilder } from "./column-builder.mjs";
2
2
  import { ForeignKeyBuilder } from "./foreign-key-builder.mjs";
3
- import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./column-helpers.mjs";
3
+ import { DetachedColumnBuilder, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, bool as boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year } from "./column-helpers.mjs";
4
4
  import { Migration, migrate } from "./migration.mjs";
5
5
  import { MigrationRunner, inferMigrationName, migrationRunner } from "./migration-runner.mjs";
6
6
 
7
- export { };
7
+ export { ColumnBuilder, DetachedColumnBuilder, ForeignKeyBuilder, Migration, MigrationRunner, arrayBigInt, arrayBoolean, arrayDate, arrayDecimal, arrayFloat, arrayInt, arrayJson, arrayText, arrayTimestamp, arrayUuid, bigInt, bigInteger, binary, blobCol, boolCol as bool, boolCol, char, date, dateTime, decimal, double, enumCol, float, geometry, inferMigrationName, int, integer, ipAddress, json, lineString, longText, macAddress, mediumText, migrate, migrationRunner, objectCol, point, polygon, setCol, smallInt, smallInteger, string, text, time, timestamp, tinyInt, tinyInteger, ulid, uuid, vector, year };