pgsql-deparser 13.16.0 → 13.18.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.
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Auto-generated file with types stripped for better tree-shaking
3
+ * DO NOT EDIT - Generated by strip-direct-transformer-types.ts
4
+ */
5
+
6
+ import { V13ToV14Transformer } from "./v13-to-v14";
7
+ import { V14ToV15Transformer } from "./v14-to-v15";
8
+ import { V15ToV16Transformer } from "./v15-to-v16";
9
+ import { V16ToV17Transformer } from "./v16-to-v17";
10
+ /**
11
+ * Direct transformer from PG13 to PG17
12
+ * This transformer chains v13->v14->v15->v16->v17 transformations
13
+ */
14
+ export class PG13ToPG17Transformer {
15
+ private v13to14 = new V13ToV14Transformer();
16
+ private v14to15 = new V14ToV15Transformer();
17
+ private v15to16 = new V15ToV16Transformer();
18
+ private v16to17 = new V16ToV17Transformer();
19
+ transform(node: any): any {
20
+ // If it's a ParseResult, handle it specially
21
+ if (this.isParseResult(node)) {
22
+ // Transform through the chain: v13->v14->v15->v16->v17
23
+ const v14Stmts = node.stmts.map((stmtWrapper: any) => {
24
+ if (stmtWrapper.stmt) {
25
+ const v14Stmt = this.v13to14.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
26
+ return { ...stmtWrapper, stmt: v14Stmt };
27
+ }
28
+ return stmtWrapper;
29
+ });
30
+ const v15Stmts = v14Stmts.map((stmtWrapper: any) => {
31
+ if (stmtWrapper.stmt) {
32
+ const v15Stmt = this.v14to15.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
33
+ return { ...stmtWrapper, stmt: v15Stmt };
34
+ }
35
+ return stmtWrapper;
36
+ });
37
+ const v16Stmts = v15Stmts.map((stmtWrapper: any) => {
38
+ if (stmtWrapper.stmt) {
39
+ const v16Stmt = this.v15to16.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
40
+ return { ...stmtWrapper, stmt: v16Stmt };
41
+ }
42
+ return stmtWrapper;
43
+ });
44
+ const v17Stmts = v16Stmts.map((stmtWrapper: any) => {
45
+ if (stmtWrapper.stmt) {
46
+ const v17Stmt = this.v16to17.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
47
+ return { ...stmtWrapper, stmt: v17Stmt };
48
+ }
49
+ return stmtWrapper;
50
+ });
51
+ return {
52
+ ...node,
53
+ version: 170004, // PG17 version
54
+ stmts: v17Stmts
55
+ };
56
+ }
57
+ // Otherwise, transform as a regular node through the chain
58
+ const v14Node = this.v13to14.transform(node, { parentNodeTypes: [] });
59
+ const v15Node = this.v14to15.transform(v14Node, { parentNodeTypes: [] });
60
+ const v16Node = this.v15to16.transform(v15Node, { parentNodeTypes: [] });
61
+ return this.v16to17.transform(v16Node, { parentNodeTypes: [] });
62
+ }
63
+ /**
64
+ * Transform a single statement from PG13 to PG17
65
+ * @deprecated Use transform() instead, which handles all node types
66
+ */
67
+ transformStatement(stmt: any): any {
68
+ const v14Stmt = this.v13to14.transform(stmt, { parentNodeTypes: [] });
69
+ const v15Stmt = this.v14to15.transform(v14Stmt, { parentNodeTypes: [] });
70
+ const v16Stmt = this.v15to16.transform(v15Stmt, { parentNodeTypes: [] });
71
+ return this.v16to17.transform(v16Stmt, { parentNodeTypes: [] });
72
+ }
73
+ /**
74
+ * Type guard to check if a node is a ParseResult
75
+ */
76
+ private isParseResult(node: any): any {
77
+ return node && typeof node === 'object' && 'version' in node && 'stmts' in node;
78
+ }
79
+ }