pgsql-deparser 13.16.0 → 13.19.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.
- package/README.md +94 -45
- package/deparser/deparser.d.ts +302 -0
- package/deparser/deparser.js +10451 -0
- package/deparser/index.d.ts +9 -0
- package/deparser/index.js +17 -0
- package/deparser/utils/list-utils.d.ts +8 -0
- package/deparser/utils/list-utils.js +30 -0
- package/deparser/utils/quote-utils.d.ts +24 -0
- package/deparser/utils/quote-utils.js +89 -0
- package/deparser/utils/sql-formatter.d.ts +16 -0
- package/deparser/utils/sql-formatter.js +40 -0
- package/deparser/visitors/base.d.ts +68 -0
- package/deparser/visitors/base.js +122 -0
- package/esm/deparser/deparser.js +10447 -0
- package/esm/deparser/index.js +13 -0
- package/esm/deparser/utils/list-utils.js +26 -0
- package/esm/deparser/utils/quote-utils.js +85 -0
- package/esm/deparser/utils/sql-formatter.js +36 -0
- package/esm/deparser/visitors/base.js +117 -0
- package/esm/index.js +15 -0
- package/esm/v13-to-v14.js +2750 -0
- package/esm/v13-to-v17-direct.js +78 -0
- package/esm/v14-to-v15.js +1223 -0
- package/esm/v15-to-v16.js +2940 -0
- package/esm/v16-to-v17.js +1488 -0
- package/index.d.ts +9 -0
- package/index.js +19 -0
- package/package.json +26 -75
- package/v13-to-v14.d.ts +253 -0
- package/v13-to-v14.js +2754 -0
- package/v13-to-v17-direct.d.ts +24 -0
- package/v13-to-v17-direct.js +82 -0
- package/v14-to-v15.d.ts +616 -0
- package/v14-to-v15.js +1227 -0
- package/v15-to-v16.d.ts +633 -0
- package/v15-to-v16.js +2944 -0
- package/v16-to-v17.d.ts +638 -0
- package/v16-to-v17.js +1492 -0
- package/main/deparser.js +0 -3495
- package/main/index.js +0 -10
- package/main/utils/index.js +0 -97
- package/module/deparser.js +0 -3492
- package/module/index.js +0 -3
- package/module/utils/index.js +0 -90
- package/src/deparser.ts +0 -4234
- package/src/index.ts +0 -3
- package/src/utils/index.ts +0 -92
- package/types/deparser.d.ts +0 -119
- package/types/index.d.ts +0 -3
- package/types/utils/index.d.ts +0 -4
package/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deparser for PostgreSQL version 13
|
|
3
|
+
* Auto-generated by generate-version-deparsers.ts
|
|
4
|
+
*/
|
|
5
|
+
import { Node, ParseResult } from '@pgsql/types';
|
|
6
|
+
import { DeparserOptions } from './deparser';
|
|
7
|
+
export declare function deparse(query: Node | Node[] | ParseResult, opts?: DeparserOptions): Promise<string>;
|
|
8
|
+
export declare function deparseSync(query: Node | Node[] | ParseResult, opts?: DeparserOptions): string;
|
|
9
|
+
export { DeparserOptions } from './deparser';
|
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Deparser for PostgreSQL version 13
|
|
4
|
+
* Auto-generated by generate-version-deparsers.ts
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.deparse = deparse;
|
|
8
|
+
exports.deparseSync = deparseSync;
|
|
9
|
+
const deparser_1 = require("./deparser");
|
|
10
|
+
const v13_to_v17_direct_1 = require("./v13-to-v17-direct");
|
|
11
|
+
const tx = new v13_to_v17_direct_1.PG13ToPG17Transformer();
|
|
12
|
+
async function deparse(query, opts) {
|
|
13
|
+
const ast17 = tx.transform(query);
|
|
14
|
+
return await (0, deparser_1.deparse)(ast17, opts);
|
|
15
|
+
}
|
|
16
|
+
function deparseSync(query, opts) {
|
|
17
|
+
const ast17 = tx.transform(query);
|
|
18
|
+
return (0, deparser_1.deparseSync)(ast17, opts);
|
|
19
|
+
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "pgsql-deparser",
|
|
3
|
-
"version": "13.16.0",
|
|
4
|
-
"description": "PostgreSQL AST Deparser",
|
|
5
2
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
6
3
|
"homepage": "https://github.com/launchql/pgsql-parser",
|
|
7
|
-
"license": "
|
|
8
|
-
"main": "
|
|
9
|
-
"module": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
"
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"module": "esm/index.js",
|
|
7
|
+
"types": "index.d.ts",
|
|
8
|
+
"description": "PostgreSQL AST Deparser",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"copy": "copyfiles -f ../../../../LICENSE README.md package.json dist",
|
|
11
|
+
"clean": "rimraf dist",
|
|
12
|
+
"build": "npm run clean && tsc && tsc -p tsconfig.esm.json && npm run copy",
|
|
13
|
+
"publish:pkg": "npm publish --tag pg13"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public",
|
|
17
|
+
"directory": "dist"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/launchql/pgsql-parser"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/launchql/pgsql-parser/issues"
|
|
14
25
|
},
|
|
15
|
-
"files": [
|
|
16
|
-
"types",
|
|
17
|
-
"module",
|
|
18
|
-
"src",
|
|
19
|
-
"main"
|
|
20
|
-
],
|
|
21
26
|
"keywords": [
|
|
22
27
|
"sql",
|
|
23
28
|
"postgres",
|
|
@@ -28,63 +33,9 @@
|
|
|
28
33
|
"deparser",
|
|
29
34
|
"database"
|
|
30
35
|
],
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
"repository": {
|
|
35
|
-
"type": "git",
|
|
36
|
-
"url": "https://github.com/launchql/pgsql-parser"
|
|
37
|
-
},
|
|
38
|
-
"scripts": {
|
|
39
|
-
"build:main": "yarn tsc -p tsconfig.json --outDir main --module commonjs",
|
|
40
|
-
"build:module": "yarn tsc -p tsconfig.json --outDir module --module es2022",
|
|
41
|
-
"build": "npm run build:module && npm run build:main",
|
|
42
|
-
"buidl": "npm run build",
|
|
43
|
-
"buidl:clean": "npm run clean && npm run buidl",
|
|
44
|
-
"prepare": "npm run build",
|
|
45
|
-
"lint": "eslint .",
|
|
46
|
-
"format": "eslint . --fix",
|
|
47
|
-
"test": "jest",
|
|
48
|
-
"test:watch": "jest --watch",
|
|
49
|
-
"test:debug": "node --inspect node_modules/.bin/jest --runInBand"
|
|
50
|
-
},
|
|
51
|
-
"bugs": {
|
|
52
|
-
"url": "https://github.com/launchql/pgsql-parser/issues"
|
|
53
|
-
},
|
|
54
|
-
"jest": {
|
|
55
|
-
"preset": "ts-jest",
|
|
56
|
-
"testEnvironment": "node",
|
|
57
|
-
"transform": {
|
|
58
|
-
"^.+\\.ts?$": "ts-jest"
|
|
59
|
-
},
|
|
60
|
-
"transformIgnorePatterns": [
|
|
61
|
-
"<rootDir>/node_modules/"
|
|
62
|
-
],
|
|
63
|
-
"testPathIgnorePatterns": [
|
|
64
|
-
"main/",
|
|
65
|
-
"module/",
|
|
66
|
-
"types/"
|
|
67
|
-
]
|
|
68
|
-
},
|
|
69
|
-
"devDependencies": {
|
|
70
|
-
"@types/jest": "^29.5.0",
|
|
71
|
-
"eslint": "8.38.0",
|
|
72
|
-
"eslint-config-prettier": "^8.8.0",
|
|
73
|
-
"eslint-plugin-prettier": "^4.0.0",
|
|
74
|
-
"esprima": "4.0.1",
|
|
75
|
-
"glob": "8.0.3",
|
|
76
|
-
"jest": "^29.7.0",
|
|
77
|
-
"pgsql-parser": "^13.17.0",
|
|
78
|
-
"prettier": "^2.8.7",
|
|
79
|
-
"rimraf": "5.0.5",
|
|
80
|
-
"ts-jest": "^29.1.0",
|
|
81
|
-
"ts-node": "10.9.2",
|
|
82
|
-
"typescript": "^5.0.4"
|
|
83
|
-
},
|
|
36
|
+
"name": "pgsql-deparser",
|
|
37
|
+
"version": "13.19.0",
|
|
84
38
|
"dependencies": {
|
|
85
|
-
"@pgsql/types": "^13.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
},
|
|
89
|
-
"gitHead": "85346892e652a57e570562fdac7a768545113619"
|
|
90
|
-
}
|
|
39
|
+
"@pgsql/types": "^13.11.1"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/v13-to-v14.d.ts
ADDED
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-generated file with types stripped for better tree-shaking
|
|
3
|
+
* DO NOT EDIT - Generated by strip-transformer-types.ts
|
|
4
|
+
*/
|
|
5
|
+
export declare class V13ToV14Transformer {
|
|
6
|
+
transform(node: any, context?: any): any;
|
|
7
|
+
visit(node: any, context?: any): any;
|
|
8
|
+
private transformGenericNode;
|
|
9
|
+
getNodeType(node: any): any;
|
|
10
|
+
getNodeData(node: any): any;
|
|
11
|
+
ParseResult(node: any, context: any): any;
|
|
12
|
+
FuncCall(node: any, context: any): {
|
|
13
|
+
FuncCall: any;
|
|
14
|
+
};
|
|
15
|
+
private shouldAddFuncformat;
|
|
16
|
+
private isInCheckConstraintContext;
|
|
17
|
+
private isInCommentContext;
|
|
18
|
+
private isInTypeCastContext;
|
|
19
|
+
private isInInsertContext;
|
|
20
|
+
private isInUpdateContext;
|
|
21
|
+
private isInXmlExprContext;
|
|
22
|
+
private isInRangeFunctionContext;
|
|
23
|
+
private isInSortByContext;
|
|
24
|
+
private isInDefaultConstraintContext;
|
|
25
|
+
private isInPolicyContext;
|
|
26
|
+
private isInSelectFromContext;
|
|
27
|
+
private isInSelectTargetContext;
|
|
28
|
+
private isInReturningContext;
|
|
29
|
+
private isInCreateIndexContext;
|
|
30
|
+
private isInConstraintContext;
|
|
31
|
+
private isInCreateDomainContext;
|
|
32
|
+
private isInCreateProcedureContext;
|
|
33
|
+
private isInCallStmtContext;
|
|
34
|
+
private isStandardFunctionCallSyntax;
|
|
35
|
+
private isSqlStandardSyntax;
|
|
36
|
+
CallStmt(node: any, context: any): {
|
|
37
|
+
CallStmt: any;
|
|
38
|
+
};
|
|
39
|
+
CommentStmt(node: any, context: any): {
|
|
40
|
+
CommentStmt: any;
|
|
41
|
+
};
|
|
42
|
+
DropStmt(node: any, context: any): {
|
|
43
|
+
DropStmt: any;
|
|
44
|
+
};
|
|
45
|
+
InsertStmt(node: any, context: any): {
|
|
46
|
+
InsertStmt: any;
|
|
47
|
+
};
|
|
48
|
+
UpdateStmt(node: any, context: any): {
|
|
49
|
+
UpdateStmt: any;
|
|
50
|
+
};
|
|
51
|
+
DeleteStmt(node: any, context: any): {
|
|
52
|
+
DeleteStmt: any;
|
|
53
|
+
};
|
|
54
|
+
CreateOpClassStmt(node: any, context: any): {
|
|
55
|
+
CreateOpClassStmt: any;
|
|
56
|
+
};
|
|
57
|
+
CreateOpClassItem(node: any, context: any): {
|
|
58
|
+
CreateOpClassItem: any;
|
|
59
|
+
};
|
|
60
|
+
CreateAccessMethodStmt(node: any, context: any): any;
|
|
61
|
+
GrantStmt(node: any, context: any): {
|
|
62
|
+
GrantStmt: any;
|
|
63
|
+
};
|
|
64
|
+
RevokeStmt(node: any, context: any): any;
|
|
65
|
+
ResTarget(node: any, context: any): {
|
|
66
|
+
ResTarget: any;
|
|
67
|
+
};
|
|
68
|
+
private getFunctionName;
|
|
69
|
+
private isOperatorName;
|
|
70
|
+
private getFuncformatValue;
|
|
71
|
+
private getFunctionNameFromContext;
|
|
72
|
+
private functionHasExplicitModes;
|
|
73
|
+
private allParametersHaveExplicitModes;
|
|
74
|
+
private hasOnlyExplicitInParameters;
|
|
75
|
+
private hasExplicitInParameters;
|
|
76
|
+
private isVariadicParameterType;
|
|
77
|
+
FunctionParameter(node: any, context: any): {
|
|
78
|
+
FunctionParameter: any;
|
|
79
|
+
};
|
|
80
|
+
AlterFunctionStmt(node: any, context: any): {
|
|
81
|
+
AlterFunctionStmt: any;
|
|
82
|
+
};
|
|
83
|
+
AlterOwnerStmt(node: any, context: any): {
|
|
84
|
+
AlterOwnerStmt: any;
|
|
85
|
+
};
|
|
86
|
+
AlterTableStmt(node: any, context: any): {
|
|
87
|
+
AlterTableStmt: any;
|
|
88
|
+
};
|
|
89
|
+
CreateTableAsStmt(node: any, context: any): {
|
|
90
|
+
CreateTableAsStmt: any;
|
|
91
|
+
};
|
|
92
|
+
RawStmt(node: any, context: any): {
|
|
93
|
+
RawStmt: any;
|
|
94
|
+
};
|
|
95
|
+
SelectStmt(node: any, context: any): {
|
|
96
|
+
SelectStmt: any;
|
|
97
|
+
};
|
|
98
|
+
RangeSubselect(node: any, context: any): {
|
|
99
|
+
RangeSubselect: any;
|
|
100
|
+
};
|
|
101
|
+
CommonTableExpr(node: any, context: any): {
|
|
102
|
+
CommonTableExpr: any;
|
|
103
|
+
};
|
|
104
|
+
SubLink(node: any, context: any): {
|
|
105
|
+
SubLink: any;
|
|
106
|
+
};
|
|
107
|
+
CopyStmt(node: any, context: any): {
|
|
108
|
+
CopyStmt: any;
|
|
109
|
+
};
|
|
110
|
+
CreateEnumStmt(node: any, context: any): {
|
|
111
|
+
CreateEnumStmt: any;
|
|
112
|
+
};
|
|
113
|
+
DefineStmt(node: any, context: any): {
|
|
114
|
+
DefineStmt: any;
|
|
115
|
+
};
|
|
116
|
+
DoStmt(node: any, context: any): {
|
|
117
|
+
DoStmt: any;
|
|
118
|
+
};
|
|
119
|
+
DeclareCursorStmt(node: any, context: any): {
|
|
120
|
+
DeclareCursorStmt: any;
|
|
121
|
+
};
|
|
122
|
+
VacuumStmt(node: any, context: any): {
|
|
123
|
+
VacuumStmt: any;
|
|
124
|
+
};
|
|
125
|
+
VacuumRelation(node: any, context: any): {
|
|
126
|
+
VacuumRelation: any;
|
|
127
|
+
};
|
|
128
|
+
RangeVar(node: any, context: any): {
|
|
129
|
+
RangeVar: any;
|
|
130
|
+
};
|
|
131
|
+
IntoClause(node: any, context: any): {
|
|
132
|
+
IntoClause: any;
|
|
133
|
+
};
|
|
134
|
+
CreateCastStmt(node: any, context: any): {
|
|
135
|
+
CreateCastStmt: any;
|
|
136
|
+
};
|
|
137
|
+
CreateTransformStmt(node: any, context: any): {
|
|
138
|
+
CreateTransformStmt: any;
|
|
139
|
+
};
|
|
140
|
+
CreateFunctionStmt(node: any, context: any): {
|
|
141
|
+
CreateFunctionStmt: any;
|
|
142
|
+
};
|
|
143
|
+
TableLikeClause(node: any, context: any): {
|
|
144
|
+
TableLikeClause: any;
|
|
145
|
+
};
|
|
146
|
+
private transformTableLikeOption;
|
|
147
|
+
private extractParameterNameFromFunctionName;
|
|
148
|
+
ObjectWithArgs(node: any, context: any): {
|
|
149
|
+
ObjectWithArgs: any;
|
|
150
|
+
};
|
|
151
|
+
private shouldCreateObjfuncargs;
|
|
152
|
+
private shouldPreserveObjfuncargs;
|
|
153
|
+
private shouldCreateObjfuncargsFromObjargs;
|
|
154
|
+
private shouldAddObjfuncargsForDropStmt;
|
|
155
|
+
private shouldPreserveObjnameAsObject;
|
|
156
|
+
private createFunctionParameterFromTypeName;
|
|
157
|
+
private isVariadicAggregateContext;
|
|
158
|
+
private transformA_Expr_Kind;
|
|
159
|
+
private transformRoleSpecType;
|
|
160
|
+
private isVariadicParameterContext;
|
|
161
|
+
private isCreateFunctionContext;
|
|
162
|
+
String(node: any, context: any): {
|
|
163
|
+
String: any;
|
|
164
|
+
};
|
|
165
|
+
BitString(node: any, context: any): {
|
|
166
|
+
BitString: any;
|
|
167
|
+
};
|
|
168
|
+
Float(node: any, context: any): {
|
|
169
|
+
Float: any;
|
|
170
|
+
};
|
|
171
|
+
Integer(node: any, context: any): {
|
|
172
|
+
Integer: any;
|
|
173
|
+
};
|
|
174
|
+
Null(node: any, context: any): {
|
|
175
|
+
Null: any;
|
|
176
|
+
};
|
|
177
|
+
List(node: any, context: any): {
|
|
178
|
+
List: any;
|
|
179
|
+
};
|
|
180
|
+
A_Expr(node: any, context: any): {
|
|
181
|
+
A_Expr: any;
|
|
182
|
+
};
|
|
183
|
+
RoleSpec(node: any, context: any): {
|
|
184
|
+
RoleSpec: any;
|
|
185
|
+
};
|
|
186
|
+
AlterTableCmd(node: any, context: any): {
|
|
187
|
+
AlterTableCmd: any;
|
|
188
|
+
};
|
|
189
|
+
TypeName(node: any, context: any): {
|
|
190
|
+
TypeName: any;
|
|
191
|
+
};
|
|
192
|
+
ColumnRef(node: any, context: any): {
|
|
193
|
+
ColumnRef: any;
|
|
194
|
+
};
|
|
195
|
+
A_Const(node: any, context: any): {
|
|
196
|
+
A_Const: any;
|
|
197
|
+
};
|
|
198
|
+
A_Star(node: any, context: any): {
|
|
199
|
+
A_Star: any;
|
|
200
|
+
};
|
|
201
|
+
SortBy(node: any, context: any): {
|
|
202
|
+
SortBy: any;
|
|
203
|
+
};
|
|
204
|
+
CreateDomainStmt(node: any, context: any): {
|
|
205
|
+
CreateDomainStmt: any;
|
|
206
|
+
};
|
|
207
|
+
CreateSeqStmt(node: any, context: any): {
|
|
208
|
+
CreateSeqStmt: any;
|
|
209
|
+
};
|
|
210
|
+
WithClause(node: any, context: any): {
|
|
211
|
+
WithClause: any;
|
|
212
|
+
};
|
|
213
|
+
private shouldConvertCTEsToArray;
|
|
214
|
+
AlterSeqStmt(node: any, context: any): {
|
|
215
|
+
AlterSeqStmt: any;
|
|
216
|
+
};
|
|
217
|
+
CTECycleClause(node: any, context: any): {
|
|
218
|
+
CTECycleClause: any;
|
|
219
|
+
};
|
|
220
|
+
CTESearchClause(node: any, context: any): {
|
|
221
|
+
CTESearchClause: any;
|
|
222
|
+
};
|
|
223
|
+
PLAssignStmt(node: any, context: any): {
|
|
224
|
+
PLAssignStmt: any;
|
|
225
|
+
};
|
|
226
|
+
ReturnStmt(node: any, context: any): {
|
|
227
|
+
ReturnStmt: any;
|
|
228
|
+
};
|
|
229
|
+
StatsElem(node: any, context: any): {
|
|
230
|
+
StatsElem: any;
|
|
231
|
+
};
|
|
232
|
+
CreateStatsStmt(node: any, context: any): {
|
|
233
|
+
CreateStatsStmt: any;
|
|
234
|
+
};
|
|
235
|
+
CreateStmt(node: any, context: any): {
|
|
236
|
+
CreateStmt: any;
|
|
237
|
+
};
|
|
238
|
+
CreatePolicyStmt(node: any, context: any): {
|
|
239
|
+
CreatePolicyStmt: any;
|
|
240
|
+
};
|
|
241
|
+
RenameStmt(node: any, context: any): {
|
|
242
|
+
RenameStmt: any;
|
|
243
|
+
};
|
|
244
|
+
AlterObjectSchemaStmt(node: any, context: any): {
|
|
245
|
+
AlterObjectSchemaStmt: any;
|
|
246
|
+
};
|
|
247
|
+
private mapTableLikeOption;
|
|
248
|
+
private getPG13EnumName;
|
|
249
|
+
private mapFunctionParameterMode;
|
|
250
|
+
ReindexStmt(node: any, context: any): {
|
|
251
|
+
ReindexStmt: any;
|
|
252
|
+
};
|
|
253
|
+
}
|