pgsql-deparser 16.0.0 → 17.4.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 (35) hide show
  1. package/README.md +45 -88
  2. package/deparser.d.ts +297 -0
  3. package/{deparser/deparser.js → deparser.js} +110 -435
  4. package/esm/{deparser/deparser.js → deparser.js} +110 -435
  5. package/esm/index.js +3 -15
  6. package/esm/utils/index.js +90 -0
  7. package/esm/{deparser/utils → utils}/list-utils.js +0 -4
  8. package/esm/{deparser/utils → utils}/quote-utils.js +0 -34
  9. package/esm/utils/sql-formatter.js +23 -0
  10. package/esm/{deparser/visitors → visitors}/base.js +0 -4
  11. package/index.d.ts +3 -9
  12. package/index.js +4 -16
  13. package/package.json +27 -14
  14. package/utils/index.d.ts +4 -0
  15. package/utils/index.js +97 -0
  16. package/{deparser/utils → utils}/list-utils.d.ts +0 -4
  17. package/{deparser/utils → utils}/list-utils.js +0 -4
  18. package/utils/quote-utils.d.ts +5 -0
  19. package/{deparser/utils → utils}/quote-utils.js +0 -34
  20. package/{deparser/utils → utils}/sql-formatter.d.ts +1 -7
  21. package/{deparser/utils → utils}/sql-formatter.js +2 -15
  22. package/{deparser/visitors → visitors}/base.d.ts +5 -8
  23. package/{deparser/visitors → visitors}/base.js +0 -4
  24. package/deparser/deparser.d.ts +0 -301
  25. package/deparser/index.d.ts +0 -9
  26. package/deparser/index.js +0 -17
  27. package/deparser/utils/quote-utils.d.ts +0 -24
  28. package/esm/deparser/index.js +0 -13
  29. package/esm/deparser/utils/sql-formatter.js +0 -36
  30. package/esm/v16-to-v17-direct.js +0 -44
  31. package/esm/v16-to-v17.js +0 -1488
  32. package/v16-to-v17-direct.d.ts +0 -21
  33. package/v16-to-v17-direct.js +0 -48
  34. package/v16-to-v17.d.ts +0 -638
  35. package/v16-to-v17.js +0 -1492
@@ -1,301 +0,0 @@
1
- /**
2
- * Auto-generated file with types stripped for better tree-shaking
3
- * DO NOT EDIT - Generated by strip-deparser-types.ts
4
- */
5
- import { DeparserContext, DeparserVisitor } from './visitors/base';
6
- export interface DeparserOptions {
7
- newline?: string;
8
- tab?: string;
9
- functionDelimiter?: string;
10
- functionDelimiterFallback?: string;
11
- pretty?: boolean;
12
- }
13
- /**
14
- * Deparser - Converts PostgreSQL AST nodes back to SQL strings
15
- *
16
- * Entry Points:
17
- * 1. ParseResult (from libpg-query) - The complete parse result
18
- * Structure: { version: number, stmts: RawStmt[] }
19
- * Note: stmts is "repeated RawStmt" in protobuf, so array contains RawStmt
20
- * objects inline (not wrapped as { RawStmt: ... } nodes)
21
- * Example: { version: 170004, stmts: [{ stmt: {...}, stmt_len: 32 }] }
22
- *
23
- * 2. Wrapped ParseResult - When explicitly wrapped as a Node
24
- * Structure: { ParseResult: { version: number, stmts: RawStmt[] } }
25
- *
26
- * 3. Wrapped RawStmt - When explicitly wrapped as a Node
27
- * Structure: { RawStmt: { stmt: Node, stmt_len?: number } }
28
- *
29
- * 4. Array of Nodes - Multiple statements to deparse
30
- * Can be: Node[] (e.g., SelectStmt, InsertStmt, etc.)
31
- *
32
- * 5. Single Node - Individual statement node
33
- * Example: { SelectStmt: {...} }, { InsertStmt: {...} }, etc.
34
- *
35
- * The deparser automatically detects bare ParseResult objects for backward
36
- * compatibility and wraps them internally for consistent processing.
37
- */
38
- export declare class Deparser implements DeparserVisitor {
39
- private formatter;
40
- private tree;
41
- private options;
42
- constructor(tree: any | any[] | any, opts?: DeparserOptions);
43
- /**
44
- * Static method to deparse PostgreSQL AST nodes to SQL
45
- * @param query - Can be:
46
- * - ParseResult from libpg-query (e.g., { version: 170004, stmts: [...] })
47
- * - Wrapped ParseResult node (e.g., { ParseResult: {...} })
48
- * - Wrapped RawStmt node (e.g., { RawStmt: {...} })
49
- * - Array of Nodes
50
- * - Single Node (e.g., { SelectStmt: {...} })
51
- * @param opts - Deparser options for formatting
52
- * @returns The deparsed SQL string
53
- */
54
- static deparse(query: any | any[] | any, opts?: DeparserOptions): string;
55
- deparseQuery(): string;
56
- /**
57
- * Get the appropriate function delimiter based on the body content
58
- * @param body The function body to check
59
- * @returns The delimiter to use
60
- */
61
- private getFunctionDelimiter;
62
- deparse(node: any, context?: DeparserContext): string | null;
63
- visit(node: any, context?: DeparserContext): string;
64
- getNodeType(node: any): string;
65
- getNodeData(node: any): any;
66
- ParseResult(node: any, context: DeparserContext): string;
67
- RawStmt(node: any, context: DeparserContext): string;
68
- SelectStmt(node: any, context: DeparserContext): string;
69
- A_Expr(node: any, context: DeparserContext): string;
70
- deparseOperatorName(name: any): string;
71
- private getOperatorPrecedence;
72
- private needsParentheses;
73
- private isComplexExpression;
74
- visitBetweenRange(rexpr: any, context: DeparserContext): string;
75
- InsertStmt(node: any, context: DeparserContext): string;
76
- UpdateStmt(node: any, context: DeparserContext): string;
77
- DeleteStmt(node: any, context: DeparserContext): string;
78
- WithClause(node: any, context: DeparserContext): string;
79
- ResTarget(node: any, context: DeparserContext): string;
80
- deparseReturningList(list: any, context: DeparserContext): string;
81
- BoolExpr(node: any, context: DeparserContext): string;
82
- FuncCall(node: any, context: DeparserContext): string;
83
- FuncExpr(node: any, context: DeparserContext): string;
84
- A_Const(node: any, context: DeparserContext): string;
85
- ColumnRef(node: any, context: DeparserContext): string;
86
- TypeName(node: any, context: DeparserContext): string;
87
- Alias(node: any, context: DeparserContext): string;
88
- RangeVar(node: any, context: DeparserContext): string;
89
- formatIntervalTypeMods(typmods: any, context: DeparserContext): string | null;
90
- formatTypeMods(typmods: any, context: DeparserContext): string | null;
91
- formatSingleTypeMod(typemod: number, typeName: string): string | null;
92
- getPgCatalogTypeName(typeName: string, size: string | null): string;
93
- A_ArrayExpr(node: any, context: DeparserContext): string;
94
- A_Indices(node: any, context: DeparserContext): string;
95
- A_Indirection(node: any, context: DeparserContext): string;
96
- A_Star(node: any, context: DeparserContext): string;
97
- CaseExpr(node: any, context: DeparserContext): string;
98
- CoalesceExpr(node: any, context: DeparserContext): string;
99
- TypeCast(node: any, context: DeparserContext): string;
100
- CollateClause(node: any, context: DeparserContext): string;
101
- BooleanTest(node: any, context: DeparserContext): string;
102
- NullTest(node: any, context: DeparserContext): string;
103
- private static readonly RESERVED_WORDS;
104
- private static needsQuotes;
105
- quoteIfNeeded(value: string): string;
106
- preserveOperatorDefElemCase(defName: string): string;
107
- String(node: any, context: DeparserContext): string;
108
- Integer(node: any, context: DeparserContext): string;
109
- Float(node: any, context: DeparserContext): string;
110
- Boolean(node: any, context: DeparserContext): string;
111
- BitString(node: any, context: DeparserContext): string;
112
- Null(node: any, context: DeparserContext): string;
113
- List(node: any, context: DeparserContext): string;
114
- CreateStmt(node: any, context: DeparserContext): string;
115
- ColumnDef(node: any, context: DeparserContext): string;
116
- Constraint(node: any, context: DeparserContext): string;
117
- SubLink(node: any, context: DeparserContext): string;
118
- CaseWhen(node: any, context: DeparserContext): string;
119
- WindowDef(node: any, context: DeparserContext): string;
120
- formatWindowFrame(node: any): string | null;
121
- SortBy(node: any, context: DeparserContext): string;
122
- GroupingSet(node: any, context: DeparserContext): string;
123
- CommonTableExpr(node: any, context: DeparserContext): string;
124
- ParamRef(node: any, context: DeparserContext): string;
125
- LockingClause(node: any, context: DeparserContext): string;
126
- MinMaxExpr(node: any, context: DeparserContext): string;
127
- RowExpr(node: any, context: DeparserContext): string;
128
- OpExpr(node: any, context: DeparserContext): string;
129
- DistinctExpr(node: any, context: DeparserContext): string;
130
- NullIfExpr(node: any, context: DeparserContext): string;
131
- ScalarArrayOpExpr(node: any, context: DeparserContext): string;
132
- Aggref(node: any, context: DeparserContext): string;
133
- WindowFunc(node: any, context: DeparserContext): string;
134
- FieldSelect(node: any, context: DeparserContext): string;
135
- RelabelType(node: any, context: DeparserContext): string;
136
- CoerceViaIO(node: any, context: DeparserContext): string;
137
- ArrayCoerceExpr(node: any, context: DeparserContext): string;
138
- ConvertRowtypeExpr(node: any, context: DeparserContext): string;
139
- NamedArgExpr(node: any, context: DeparserContext): string;
140
- ViewStmt(node: any, context: DeparserContext): string;
141
- IndexStmt(node: any, context: DeparserContext): string;
142
- IndexElem(node: any, context: DeparserContext): string;
143
- PartitionElem(node: any, context: DeparserContext): string;
144
- PartitionCmd(node: any, context: DeparserContext): string;
145
- private getAggFunctionName;
146
- private getWindowFunctionName;
147
- private getOperatorName;
148
- JoinExpr(node: any, context: DeparserContext): string;
149
- FromExpr(node: any, context: DeparserContext): string;
150
- TransactionStmt(node: any, context: DeparserContext): string;
151
- VariableSetStmt(node: any, context: DeparserContext): string;
152
- VariableShowStmt(node: any, context: DeparserContext): string;
153
- CreateSchemaStmt(node: any, context: DeparserContext): string;
154
- RoleSpec(node: any, context: DeparserContext): string;
155
- roletype(node: any, context: DeparserContext): string;
156
- DropStmt(node: any, context: DeparserContext): string;
157
- TruncateStmt(node: any, context: DeparserContext): string;
158
- ReturnStmt(node: any, context: DeparserContext): string;
159
- PLAssignStmt(node: any, context: DeparserContext): string;
160
- CopyStmt(node: any, context: DeparserContext): string;
161
- AlterTableStmt(node: any, context: DeparserContext): string;
162
- AlterTableCmd(node: any, context: DeparserContext): string;
163
- CreateFunctionStmt(node: any, context: DeparserContext): string;
164
- FunctionParameter(node: any, context: DeparserContext): string;
165
- CreateEnumStmt(node: any, context: DeparserContext): string;
166
- CreateDomainStmt(node: any, context: DeparserContext): string;
167
- CreateRoleStmt(node: any, context: DeparserContext): string;
168
- DefElem(node: any, context: DeparserContext): string;
169
- CreateTableSpaceStmt(node: any, context: DeparserContext): string;
170
- DropTableSpaceStmt(node: any, context: DeparserContext): string;
171
- AlterTableSpaceOptionsStmt(node: any, context: DeparserContext): string;
172
- CreateExtensionStmt(node: any, context: DeparserContext): string;
173
- AlterExtensionStmt(node: any, context: DeparserContext): string;
174
- CreateFdwStmt(node: any, context: DeparserContext): string;
175
- SetOperationStmt(node: any, context: DeparserContext): string;
176
- ReplicaIdentityStmt(node: any, context: DeparserContext): string;
177
- AlterCollationStmt(node: any, context: DeparserContext): string;
178
- AlterDomainStmt(node: any, context: DeparserContext): string;
179
- PrepareStmt(node: any, context: DeparserContext): string;
180
- ExecuteStmt(node: any, context: DeparserContext): string;
181
- DeallocateStmt(node: any, context: DeparserContext): string;
182
- NotifyStmt(node: any, context: DeparserContext): string;
183
- ListenStmt(node: any, context: DeparserContext): string;
184
- UnlistenStmt(node: any, context: DeparserContext): string;
185
- CheckPointStmt(node: any, context: DeparserContext): string;
186
- LoadStmt(node: any, context: DeparserContext): string;
187
- DiscardStmt(node: any, context: DeparserContext): string;
188
- CommentStmt(node: any, context: DeparserContext): string;
189
- LockStmt(node: any, context: DeparserContext): string;
190
- CreatePolicyStmt(node: any, context: DeparserContext): string;
191
- AlterPolicyStmt(node: any, context: DeparserContext): string;
192
- CreateUserMappingStmt(node: any, context: DeparserContext): string;
193
- CreateStatsStmt(node: any, context: DeparserContext): string;
194
- StatsElem(node: any, context: DeparserContext): string;
195
- CreatePublicationStmt(node: any, context: DeparserContext): string;
196
- CreateSubscriptionStmt(node: any, context: DeparserContext): string;
197
- AlterPublicationStmt(node: any, context: DeparserContext): string;
198
- AlterSubscriptionStmt(node: any, context: DeparserContext): string;
199
- DropSubscriptionStmt(node: any, context: DeparserContext): string;
200
- DoStmt(node: any, context: DeparserContext): string;
201
- private generateUniqueDollarTag;
202
- InlineCodeBlock(node: any, context: DeparserContext): string;
203
- CallContext(node: any, context: DeparserContext): string;
204
- ConstraintsSetStmt(node: any, context: DeparserContext): string;
205
- AlterSystemStmt(node: any, context: DeparserContext): string;
206
- VacuumRelation(node: any, context: DeparserContext): string;
207
- DropOwnedStmt(node: any, context: DeparserContext): string;
208
- ReassignOwnedStmt(node: any, context: DeparserContext): string;
209
- AlterTSDictionaryStmt(node: any, context: DeparserContext): string;
210
- AlterTSConfigurationStmt(node: any, context: DeparserContext): string;
211
- ClosePortalStmt(node: any, context: DeparserContext): string;
212
- FetchStmt(node: any, context: DeparserContext): string;
213
- AlterStatsStmt(node: any, context: DeparserContext): string;
214
- ObjectWithArgs(node: any, context: DeparserContext): string;
215
- AlterOperatorStmt(node: any, context: DeparserContext): string;
216
- AlterFdwStmt(node: any, context: DeparserContext): string;
217
- CreateForeignServerStmt(node: any, context: DeparserContext): string;
218
- AlterForeignServerStmt(node: any, context: DeparserContext): string;
219
- AlterUserMappingStmt(node: any, context: DeparserContext): string;
220
- DropUserMappingStmt(node: any, context: DeparserContext): string;
221
- ImportForeignSchemaStmt(node: any, context: DeparserContext): string;
222
- ClusterStmt(node: any, context: DeparserContext): string;
223
- VacuumStmt(node: any, context: DeparserContext): string;
224
- ExplainStmt(node: any, context: DeparserContext): string;
225
- ReindexStmt(node: any, context: DeparserContext): string;
226
- CallStmt(node: any, context: DeparserContext): string;
227
- CreatedbStmt(node: any, context: DeparserContext): string;
228
- DropdbStmt(node: any, context: DeparserContext): string;
229
- RenameStmt(node: any, context: DeparserContext): string;
230
- AlterOwnerStmt(node: any, context: DeparserContext): string;
231
- GrantStmt(node: any, context: DeparserContext): string;
232
- GrantRoleStmt(node: any, context: DeparserContext): string;
233
- SecLabelStmt(node: any, context: DeparserContext): string;
234
- AlterDefaultPrivilegesStmt(node: any, context: DeparserContext): string;
235
- CreateConversionStmt(node: any, context: DeparserContext): string;
236
- CreateCastStmt(node: any, context: DeparserContext): string;
237
- CreatePLangStmt(node: any, context: DeparserContext): string;
238
- CreateTransformStmt(node: any, context: DeparserContext): string;
239
- CreateTrigStmt(node: any, context: DeparserContext): string;
240
- TriggerTransition(node: any, context: DeparserContext): string;
241
- CreateEventTrigStmt(node: any, context: DeparserContext): string;
242
- AlterEventTrigStmt(node: any, context: DeparserContext): string;
243
- CreateOpClassStmt(node: any, context: DeparserContext): string;
244
- CreateOpFamilyStmt(node: any, context: DeparserContext): string;
245
- AlterOpFamilyStmt(node: any, context: DeparserContext): string;
246
- MergeStmt(node: any, context: DeparserContext): string;
247
- AlterTableMoveAllStmt(node: any, context: DeparserContext): string;
248
- CreateSeqStmt(node: any, context: DeparserContext): string;
249
- AlterSeqStmt(node: any, context: DeparserContext): string;
250
- CompositeTypeStmt(node: any, context: DeparserContext): string;
251
- CreateRangeStmt(node: any, context: DeparserContext): string;
252
- AlterEnumStmt(node: any, context: DeparserContext): string;
253
- AlterTypeStmt(node: any, context: DeparserContext): string;
254
- AlterRoleStmt(node: any, context: DeparserContext): string;
255
- DropRoleStmt(node: any, context: DeparserContext): string;
256
- targetList(node: any, context: DeparserContext): string;
257
- CreateAggregateStmt(node: any, context: DeparserContext): string;
258
- CreateTableAsStmt(node: any, context: DeparserContext): string;
259
- RefreshMatViewStmt(node: any, context: DeparserContext): string;
260
- AccessPriv(node: any, context: DeparserContext): string;
261
- aliasname(node: any, context: DeparserContext): string;
262
- DefineStmt(node: any, context: DeparserContext): string;
263
- AlterDatabaseStmt(node: any, context: DeparserContext): string;
264
- AlterDatabaseRefreshCollStmt(node: any, context: DeparserContext): string;
265
- AlterDatabaseSetStmt(node: any, context: DeparserContext): string;
266
- DeclareCursorStmt(node: any, context: DeparserContext): string;
267
- PublicationObjSpec(node: any, context: DeparserContext): string;
268
- PublicationTable(node: any, context: DeparserContext): string;
269
- CreateAmStmt(node: any, context: DeparserContext): string;
270
- IntoClause(node: any, context: DeparserContext): string;
271
- OnConflictExpr(node: any, context: DeparserContext): string;
272
- ScanToken(node: any, context: DeparserContext): string;
273
- CreateOpClassItem(node: any, context: DeparserContext): string;
274
- Var(node: any, context: DeparserContext): string;
275
- TableFunc(node: any, context: DeparserContext): string;
276
- RangeTableFunc(node: any, context: DeparserContext): string;
277
- RangeTableFuncCol(node: any, context: DeparserContext): string;
278
- JsonArrayQueryConstructor(node: any, context: DeparserContext): string;
279
- RangeFunction(node: any, context: DeparserContext): string;
280
- XmlExpr(node: any, context: DeparserContext): string;
281
- schemaname(node: any, context: DeparserContext): string;
282
- RangeTableSample(node: any, context: DeparserContext): string;
283
- XmlSerialize(node: any, context: DeparserContext): string;
284
- ctes(node: any, context: DeparserContext): string;
285
- RuleStmt(node: any, context: DeparserContext): string;
286
- RangeSubselect(node: any, context: DeparserContext): string;
287
- relname(node: any, context: DeparserContext): string;
288
- rel(node: any, context: DeparserContext): string;
289
- objname(node: any, context: DeparserContext): string;
290
- SQLValueFunction(node: any, context: DeparserContext): string;
291
- GroupingFunc(node: any, context: DeparserContext): string;
292
- MultiAssignRef(node: any, context: DeparserContext): string;
293
- SetToDefault(node: any, context: DeparserContext): string;
294
- CurrentOfExpr(node: any, context: DeparserContext): string;
295
- TableLikeClause(node: any, context: DeparserContext): string;
296
- AlterFunctionStmt(node: any, context: DeparserContext): string;
297
- AlterObjectSchemaStmt(node: any, context: DeparserContext): string;
298
- AlterRoleSetStmt(node: any, context: DeparserContext): string;
299
- CreateForeignTableStmt(node: any, context: DeparserContext): string;
300
- private containsMultilineStringLiteral;
301
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * Auto-generated file with types stripped for better tree-shaking
3
- * DO NOT EDIT - Generated by strip-deparser-types.ts
4
- */
5
- import { Deparser, DeparserOptions } from "./deparser";
6
- declare const deparseMethod: typeof Deparser.deparse;
7
- export declare const deparseSync: typeof Deparser.deparse;
8
- export declare const deparse: (...args: Parameters<typeof deparseMethod>) => Promise<ReturnType<typeof deparseMethod>>;
9
- export { Deparser, DeparserOptions };
package/deparser/index.js DELETED
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /**
3
- * Auto-generated file with types stripped for better tree-shaking
4
- * DO NOT EDIT - Generated by strip-deparser-types.ts
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.Deparser = exports.deparse = exports.deparseSync = void 0;
8
- const deparser_1 = require("./deparser");
9
- Object.defineProperty(exports, "Deparser", { enumerable: true, get: function () { return deparser_1.Deparser; } });
10
- const deparseMethod = deparser_1.Deparser.deparse;
11
- // Export the original sync version as deparseSync
12
- exports.deparseSync = deparseMethod;
13
- // Create an async wrapper for deparse
14
- const deparse = async (...args) => {
15
- return deparseMethod(...args);
16
- };
17
- exports.deparse = deparse;
@@ -1,24 +0,0 @@
1
- /**
2
- * Auto-generated file with types stripped for better tree-shaking
3
- * DO NOT EDIT - Generated by strip-deparser-types.ts
4
- */
5
- export declare class QuoteUtils {
6
- static needsQuotes(value: string): boolean;
7
- static quote(value: any): any;
8
- static escape(literal: string): string;
9
- /**
10
- * Escapes a string value for use in E-prefixed string literals
11
- * Handles both backslashes and single quotes properly
12
- */
13
- static escapeEString(value: string): string;
14
- /**
15
- * Formats a string as an E-prefixed string literal with proper escaping
16
- * This wraps the complete E-prefix logic including detection and formatting
17
- */
18
- static formatEString(value: string): string;
19
- /**
20
- * Determines if a string value needs E-prefix for escaped string literals
21
- * Detects backslash escape sequences that require E-prefix in PostgreSQL
22
- */
23
- static needsEscapePrefix(value: string): boolean;
24
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Auto-generated file with types stripped for better tree-shaking
3
- * DO NOT EDIT - Generated by strip-deparser-types.ts
4
- */
5
- import { Deparser } from "./deparser";
6
- const deparseMethod = Deparser.deparse;
7
- // Export the original sync version as deparseSync
8
- export const deparseSync = deparseMethod;
9
- // Create an async wrapper for deparse
10
- export const deparse = async (...args) => {
11
- return deparseMethod(...args);
12
- };
13
- export { Deparser };
@@ -1,36 +0,0 @@
1
- /**
2
- * Auto-generated file with types stripped for better tree-shaking
3
- * DO NOT EDIT - Generated by strip-deparser-types.ts
4
- */
5
- export class SqlFormatter {
6
- newlineChar;
7
- tabChar;
8
- prettyMode;
9
- constructor(newlineChar = '\n', tabChar = ' ', prettyMode = false) {
10
- this.newlineChar = newlineChar;
11
- this.tabChar = tabChar;
12
- this.prettyMode = prettyMode;
13
- }
14
- format(parts, separator = ' ') {
15
- return parts.filter(part => part !== null && part !== undefined && part !== '').join(separator);
16
- }
17
- indent(text, count = 1) {
18
- if (!this.prettyMode) {
19
- return text;
20
- }
21
- const indentation = this.tabChar.repeat(count);
22
- return text.split(this.newlineChar).map(line => line.trim() ? indentation + line : line).join(this.newlineChar);
23
- }
24
- parens(content) {
25
- return `(${content})`;
26
- }
27
- newline() {
28
- return this.newlineChar;
29
- }
30
- tab() {
31
- return this.tabChar;
32
- }
33
- isPretty() {
34
- return this.prettyMode;
35
- }
36
- }
@@ -1,44 +0,0 @@
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
- import { V16ToV17Transformer } from "./v16-to-v17";
6
- /**
7
- * Direct transformer from PG16 to PG17
8
- * This transformer only includes the necessary code for v16->v17 transformation
9
- */
10
- export class PG16ToPG17Transformer {
11
- transformer = new V16ToV17Transformer();
12
- transform(node) {
13
- // If it's a ParseResult, handle it specially
14
- if (this.isParseResult(node)) {
15
- const transformedStmts = node.stmts.map((stmtWrapper) => {
16
- if (stmtWrapper.stmt) {
17
- const transformedStmt = this.transformer.transform(stmtWrapper.stmt, { parentNodeTypes: [] });
18
- return { ...stmtWrapper, stmt: transformedStmt };
19
- }
20
- return stmtWrapper;
21
- });
22
- return {
23
- ...node,
24
- version: 170004, // PG17 version
25
- stmts: transformedStmts
26
- };
27
- }
28
- // Otherwise, transform as a regular node
29
- return this.transformer.transform(node, { parentNodeTypes: [] });
30
- }
31
- /**
32
- * Transform a single statement from PG16 to PG17
33
- * @deprecated Use transform() instead, which handles all node types
34
- */
35
- transformStatement(stmt) {
36
- return this.transformer.transform(stmt, { parentNodeTypes: [] });
37
- }
38
- /**
39
- * Type guard to check if a node is a ParseResult
40
- */
41
- isParseResult(node) {
42
- return node && typeof node === 'object' && 'version' in node && 'stmts' in node;
43
- }
44
- }