Skip to content

Commit fa301fa

Browse files
authored
Merge pull request #318 from constructive-io/feat/transform-pure-ast
refactor(transform): keep @pgsql/transform pure AST-level; move change-aware pieces up
2 parents b590564 + 575b393 commit fa301fa

8 files changed

Lines changed: 2 additions & 621 deletions

File tree

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ A pnpm monorepo for PostgreSQL AST parsing, deparsing, and code generation. All
1717
| `@pgsql/utils` | `packages/utils` | Type-safe AST node creation utilities |
1818
| `@pgsql/traverse` | `packages/traverse` | Visitor-pattern AST traversal |
1919
| `@pgsql/transform-ast` | `packages/transform-ast` | Multi-version AST transformer (PG 13-17) |
20-
| `@pgsql/transform` | `packages/transform` | SQL schema transformation, statement classification, qualification, dependency closure |
20+
| `@pgsql/transform` | `packages/transform` | SQL schema transformation, statement classification (AST facts), qualification, round-trip validation |
2121
| `@pgsql/quotes` | `packages/quotes` | SQL identifier/string quoting and keyword classification |
2222
| `@pgsql/cli` | `packages/pgsql-cli` | CLI tool for parse/deparse operations |
2323
| `pg-proto-parser` | `packages/proto-parser` | Generate TypeScript from PostgreSQL protobuf definitions |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ walk(ast, visitor);
174174
| [**@pgsql/utils**](./packages/utils) | Type-safe AST node creation utilities | • Programmatic AST construction<br>• Runtime Schema<br>• Seamless integration with types |
175175
| [**pg-proto-parser**](./packages/proto-parser) | PostgreSQL protobuf parser and code generator | • Generate TypeScript interfaces from protobuf<br>• Create enum mappings and utilities<br>• AST helper generation |
176176
| [**@pgsql/transform-ast**](./packages/transform-ast) | Multi-version PostgreSQL AST transformer | • Transform ASTs between PostgreSQL versions (13→17)<br>• Single source of truth deparser pipeline<br>• Backward compatibility for legacy SQL |
177-
| [**@pgsql/transform**](./packages/transform) | SQL transformation & classification | • Schema-name rewriting (incl. PL/pgSQL bodies)<br>• Per-statement AST facts (`classifyStatements`)<br>• Transitive dependency closure & qualification |
177+
| [**@pgsql/transform**](./packages/transform) | SQL transformation & classification | • Schema-name rewriting (incl. PL/pgSQL bodies)<br>• Per-statement AST facts (`classifyStatements`)<br>• Qualification & round-trip validation |
178178
| [**@pgsql/traverse**](./packages/traverse) | PostgreSQL AST traversal utilities | • Visitor pattern for traversing PostgreSQL AST nodes<br>• NodePath context with parent/path information<br>• Runtime schema-based precise traversal |
179179

180180
## 🛠️ Development

packages/transform/README.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ const facts = classifyStatements(sql);
5454

5555
Qualify unqualified object references against an inventory of known objects, with multi-schema routing support.
5656

57-
### `resolveFixtureClosure` — transitive dependency closure
58-
59-
Given a set of changes (name + SQL + optional declared dependencies), compute the transitive closure of a selection: forward producers of every referenced object/schema/role, plus attached fixtures (policies/grants/RLS targeting closure members), with explicit unresolved-reference reporting.
60-
61-
### `categorizeChange` / `buildCategoryOf` — change categorization
62-
63-
Profile-driven categorization of migration changes (e.g. schema / functionality / security / fixtures) from their AST facts.
64-
6557
### Round-trip validation
6658

6759
`normalizeTree` / `cleanTree` / `validateRoundTrip` — dependency-free AST normalization and mutation-aware parse→deparse→re-parse validation.

packages/transform/__tests__/categorize.test.ts

Lines changed: 0 additions & 100 deletions
This file was deleted.

packages/transform/__tests__/fixture-closure.test.ts

Lines changed: 0 additions & 127 deletions
This file was deleted.

packages/transform/src/categorize.ts

Lines changed: 0 additions & 81 deletions
This file was deleted.

0 commit comments

Comments
 (0)