pgsql-deparser 16.0.0 → 16.1.1
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 +24 -16
- package/deparser/deparser.d.ts +10 -3
- package/deparser/deparser.js +1042 -570
- package/deparser/utils/sql-formatter.js +1 -1
- package/deparser/visitors/base.d.ts +49 -2
- package/deparser/visitors/base.js +89 -1
- package/esm/deparser/deparser.js +1042 -570
- package/esm/deparser/utils/sql-formatter.js +1 -1
- package/esm/deparser/visitors/base.js +87 -0
- package/package.json +5 -5
|
@@ -6,7 +6,7 @@ export class SqlFormatter {
|
|
|
6
6
|
newlineChar;
|
|
7
7
|
tabChar;
|
|
8
8
|
prettyMode;
|
|
9
|
-
constructor(newlineChar = '\n', tabChar = ' ', prettyMode =
|
|
9
|
+
constructor(newlineChar = '\n', tabChar = ' ', prettyMode = true) {
|
|
10
10
|
this.newlineChar = newlineChar;
|
|
11
11
|
this.tabChar = tabChar;
|
|
12
12
|
this.prettyMode = prettyMode;
|
|
@@ -2,6 +2,93 @@
|
|
|
2
2
|
* Auto-generated file with types stripped for better tree-shaking
|
|
3
3
|
* DO NOT EDIT - Generated by strip-deparser-types.ts
|
|
4
4
|
*/
|
|
5
|
+
import { SqlFormatter } from '../utils/sql-formatter';
|
|
6
|
+
export class DeparserContext {
|
|
7
|
+
indentLevel;
|
|
8
|
+
prettyMode;
|
|
9
|
+
isStringLiteral;
|
|
10
|
+
parentNodeTypes;
|
|
11
|
+
formatter;
|
|
12
|
+
select;
|
|
13
|
+
from;
|
|
14
|
+
group;
|
|
15
|
+
sort;
|
|
16
|
+
insertColumns;
|
|
17
|
+
update;
|
|
18
|
+
bool;
|
|
19
|
+
isColumnConstraint;
|
|
20
|
+
isDomainConstraint;
|
|
21
|
+
alterColumnOptions;
|
|
22
|
+
alterTableOptions;
|
|
23
|
+
isEnumValue;
|
|
24
|
+
objtype;
|
|
25
|
+
subtype;
|
|
26
|
+
constructor({ indentLevel = 0, prettyMode = true, isStringLiteral, parentNodeTypes = [], formatter, select, from, group, sort, insertColumns, update, bool, isColumnConstraint, isDomainConstraint, alterColumnOptions, alterTableOptions, isEnumValue, objtype, subtype, ...rest } = {}) {
|
|
27
|
+
this.indentLevel = indentLevel;
|
|
28
|
+
this.prettyMode = prettyMode;
|
|
29
|
+
this.isStringLiteral = isStringLiteral;
|
|
30
|
+
this.parentNodeTypes = parentNodeTypes;
|
|
31
|
+
this.formatter = formatter || new SqlFormatter('\n', ' ', prettyMode);
|
|
32
|
+
this.select = select;
|
|
33
|
+
this.from = from;
|
|
34
|
+
this.group = group;
|
|
35
|
+
this.sort = sort;
|
|
36
|
+
this.insertColumns = insertColumns;
|
|
37
|
+
this.update = update;
|
|
38
|
+
this.bool = bool;
|
|
39
|
+
this.isColumnConstraint = isColumnConstraint;
|
|
40
|
+
this.isDomainConstraint = isDomainConstraint;
|
|
41
|
+
this.alterColumnOptions = alterColumnOptions;
|
|
42
|
+
this.alterTableOptions = alterTableOptions;
|
|
43
|
+
this.isEnumValue = isEnumValue;
|
|
44
|
+
this.objtype = objtype;
|
|
45
|
+
this.subtype = subtype;
|
|
46
|
+
Object.assign(this, rest);
|
|
47
|
+
}
|
|
48
|
+
spawn(nodeType, overrides = {}) {
|
|
49
|
+
return new DeparserContext({
|
|
50
|
+
indentLevel: this.indentLevel,
|
|
51
|
+
prettyMode: this.prettyMode,
|
|
52
|
+
isStringLiteral: this.isStringLiteral,
|
|
53
|
+
parentNodeTypes: [...this.parentNodeTypes, nodeType],
|
|
54
|
+
formatter: this.formatter,
|
|
55
|
+
select: this.select,
|
|
56
|
+
from: this.from,
|
|
57
|
+
group: this.group,
|
|
58
|
+
sort: this.sort,
|
|
59
|
+
insertColumns: this.insertColumns,
|
|
60
|
+
update: this.update,
|
|
61
|
+
bool: this.bool,
|
|
62
|
+
isColumnConstraint: this.isColumnConstraint,
|
|
63
|
+
isDomainConstraint: this.isDomainConstraint,
|
|
64
|
+
alterColumnOptions: this.alterColumnOptions,
|
|
65
|
+
alterTableOptions: this.alterTableOptions,
|
|
66
|
+
isEnumValue: this.isEnumValue,
|
|
67
|
+
objtype: this.objtype,
|
|
68
|
+
subtype: this.subtype,
|
|
69
|
+
...overrides,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
indent(text, count) {
|
|
73
|
+
if (!this.prettyMode) {
|
|
74
|
+
return text;
|
|
75
|
+
}
|
|
76
|
+
const indentCount = count !== undefined ? count : this.indentLevel + 1;
|
|
77
|
+
return this.formatter.indent(text, indentCount);
|
|
78
|
+
}
|
|
79
|
+
newline() {
|
|
80
|
+
return this.formatter.newline();
|
|
81
|
+
}
|
|
82
|
+
parens(content) {
|
|
83
|
+
return this.formatter.parens(content);
|
|
84
|
+
}
|
|
85
|
+
format(parts, separator) {
|
|
86
|
+
return this.formatter.format(parts, separator);
|
|
87
|
+
}
|
|
88
|
+
isPretty() {
|
|
89
|
+
return this.formatter.isPretty();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
5
92
|
export class BaseVisitor {
|
|
6
93
|
getNodeType(node) {
|
|
7
94
|
return Object.keys(node)[0];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"author": "
|
|
3
|
-
"homepage": "https://github.com/
|
|
2
|
+
"author": "Constructive <developers@constructive.io>",
|
|
3
|
+
"homepage": "https://github.com/constructive-io/pgsql-parser",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "esm/index.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
},
|
|
19
19
|
"repository": {
|
|
20
20
|
"type": "git",
|
|
21
|
-
"url": "https://github.com/
|
|
21
|
+
"url": "https://github.com/constructive-io/pgsql-parser"
|
|
22
22
|
},
|
|
23
23
|
"bugs": {
|
|
24
|
-
"url": "https://github.com/
|
|
24
|
+
"url": "https://github.com/constructive-io/pgsql-parser/issues"
|
|
25
25
|
},
|
|
26
26
|
"keywords": [
|
|
27
27
|
"sql",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"database"
|
|
35
35
|
],
|
|
36
36
|
"name": "pgsql-deparser",
|
|
37
|
-
"version": "16.
|
|
37
|
+
"version": "16.1.1",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@pgsql/types": "^16.1.1"
|
|
40
40
|
}
|