Commit 7c30b60
committed
feat(contract-psl): arrow-path through: column-based M:N recognition
Recognise the arrow-path many-to-many form
`through: "localKey -> Junction.nearCol -> Junction.farCol -> Target.targetKey"`
on terminal models over a junction that carries scalar columns + @@id but no
relation fields. The relation-field-based junction recognition cannot fire when
the junction declares no relation fields, so the resolver builds the `through`
descriptor straight from the path-named columns.
Value form: a quoted string (no grammar change). The parser already produces a
StringLiteralExpr; the resolver detects the `->` separator, strips quotes, and
splits the four segments. An unquoted arrow grammar would require a new
tokenizer token plus an expression node, AST class, union/cast extension,
printSyntax rendering, and formatter spacing rules — out of scope for this
escape-hatch slice.
Each end carries its own mirror-imaged path; both ends lower to N:M + through.
Diagnostics: malformed path (not four segments / bad arrows), a named column
absent on its model, the two junction columns on different models, and a
junction that is not a declared model.
Signed-off-by: Alexey Orlenko's AI Agent <robot@aqrln.net>1 parent afdd17e commit 7c30b60
3 files changed
Lines changed: 705 additions & 6 deletions
File tree
- packages/2-sql/2-authoring/contract-psl
- src
- test
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| |||
520 | 521 | | |
521 | 522 | | |
522 | 523 | | |
| 524 | + | |
523 | 525 | | |
524 | 526 | | |
525 | 527 | | |
| |||
551 | 553 | | |
552 | 554 | | |
553 | 555 | | |
| 556 | + | |
554 | 557 | | |
555 | 558 | | |
556 | 559 | | |
| |||
563 | 566 | | |
564 | 567 | | |
565 | 568 | | |
| 569 | + | |
566 | 570 | | |
567 | 571 | | |
568 | 572 | | |
| |||
2056 | 2060 | | |
2057 | 2061 | | |
2058 | 2062 | | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
2059 | 2066 | | |
2060 | 2067 | | |
2061 | 2068 | | |
2062 | 2069 | | |
2063 | 2070 | | |
2064 | 2071 | | |
2065 | 2072 | | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
2066 | 2077 | | |
2067 | 2078 | | |
2068 | 2079 | | |
2069 | 2080 | | |
2070 | 2081 | | |
2071 | 2082 | | |
| 2083 | + | |
2072 | 2084 | | |
2073 | 2085 | | |
2074 | 2086 | | |
| |||
0 commit comments