prettier-plugin-sql-cst 0.14.0 → 0.14.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 +1 -1
- package/dist/syntax/cast.d.ts +3 -0
- package/dist/syntax/cast.js +7 -0
- package/dist/syntax/comment.d.ts +3 -0
- package/dist/syntax/comment.js +123 -0
- package/dist/syntax/dcl.js +34 -0
- package/dist/syntax/dialects/postgresql.js +4 -1
- package/dist/syntax/expr.d.ts +3 -1
- package/dist/syntax/expr.js +4 -3
- package/dist/syntax/extension.d.ts +3 -0
- package/dist/syntax/extension.js +22 -0
- package/dist/syntax/parameter.js +5 -0
- package/dist/syntax/publication.d.ts +3 -0
- package/dist/syntax/publication.js +48 -0
- package/dist/syntax/subscription.d.ts +3 -0
- package/dist/syntax/subscription.js +25 -0
- package/dist/syntax/transformMap.js +6 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -122,7 +122,7 @@ There are also some SQL-specific options:
|
|
|
122
122
|
| API Option | Default | Description |
|
|
123
123
|
| ----------------------------- | :-----: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
124
124
|
| `sqlKeywordCase` | `upper` | Convert SQL keywords to `upper` or `lower` case, or `preserve` existing. Note that for now `preserve` is somewhat incompatible with `sqlCanonicalSyntax: true` (e.g. the added `AS` keywords will always be in uppercase). |
|
|
125
|
-
| `sqlLiteralCase` | `upper` | Convert SQL literals TRUE, FALSE and NULL to `upper` or `lower` case, or `preserve` existing.
|
|
125
|
+
| `sqlLiteralCase` | `upper` | Convert SQL literals TRUE, FALSE and NULL to `upper` or `lower` case, or `preserve` existing. Also applies to `on` & `off` literals in PostgreSQL SET statements. |
|
|
126
126
|
| `sqlParamTypes` | `[]` | Array of bound parameter types: `?`, `?nr`, `$nr`, `:name`, `@name`, `$name`. |
|
|
127
127
|
| `sqlCanonicalSyntax` | `true` | When enabled, performs some opinionated changes of keywords and operators, like enforcing the use of `AS` in aliases and replacing `<>` comparisons with `!=`. See [STYLE_GUIDE][] for more details. (Since 0.11.0) |
|
|
128
128
|
| `sqlFinalSemicolon` | `true` | When enabled, enforces a semicolon at the end of last statement. When disabled leaves it up to the author whether to add a final semicolon or not. (Since 0.13.0) |
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.castMap = void 0;
|
|
4
|
+
var print_utils_1 = require("../print_utils");
|
|
5
|
+
exports.castMap = {
|
|
6
|
+
cast_definition: function (print) { return (0, print_utils_1.group)(print.spaced(["from", "asKw", "to"])); },
|
|
7
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.commentMap = void 0;
|
|
4
|
+
var print_utils_1 = require("../print_utils");
|
|
5
|
+
exports.commentMap = {
|
|
6
|
+
comment_stmt: function (print) {
|
|
7
|
+
return (0, print_utils_1.group)([
|
|
8
|
+
print.spaced(["commentKw", "onKw", "target", "isKw"]),
|
|
9
|
+
(0, print_utils_1.indent)([print_utils_1.line, print("message")]),
|
|
10
|
+
]);
|
|
11
|
+
},
|
|
12
|
+
comment_target_aggregate: function (print) {
|
|
13
|
+
return (0, print_utils_1.group)([print.spaced(["aggregateKw", "name"]), print(["params"])]);
|
|
14
|
+
},
|
|
15
|
+
comment_target_function: function (print) {
|
|
16
|
+
return (0, print_utils_1.group)([print.spaced(["functionKw", "name"]), print(["params"])]);
|
|
17
|
+
},
|
|
18
|
+
comment_target_procedure: function (print) {
|
|
19
|
+
return (0, print_utils_1.group)([print.spaced(["procedureKw", "name"]), print(["params"])]);
|
|
20
|
+
},
|
|
21
|
+
comment_target_routine: function (print) {
|
|
22
|
+
return (0, print_utils_1.group)([print.spaced(["routineKw", "name"]), print(["params"])]);
|
|
23
|
+
},
|
|
24
|
+
comment_target_access_method: function (print) {
|
|
25
|
+
return (0, print_utils_1.group)(print.spaced(["accessMethodKw", "name"]));
|
|
26
|
+
},
|
|
27
|
+
comment_target_cast: function (print) { return (0, print_utils_1.group)(print.spaced(["castKw", "args"])); },
|
|
28
|
+
comment_target_collation: function (print) {
|
|
29
|
+
return (0, print_utils_1.group)(print.spaced(["collationKw", "name"]));
|
|
30
|
+
},
|
|
31
|
+
comment_target_column: function (print) { return (0, print_utils_1.group)(print.spaced(["columnKw", "name"])); },
|
|
32
|
+
comment_target_table_constraint: function (print) {
|
|
33
|
+
return (0, print_utils_1.group)(print.spaced(["constraintKw", "name", "onKw", "tableName"]));
|
|
34
|
+
},
|
|
35
|
+
comment_target_domain_constraint: function (print) {
|
|
36
|
+
return (0, print_utils_1.group)(print.spaced(["constraintKw", "name", "onKw", "domainKw", "domainName"]));
|
|
37
|
+
},
|
|
38
|
+
comment_target_conversion: function (print) {
|
|
39
|
+
return (0, print_utils_1.group)(print.spaced(["conversionKw", "name"]));
|
|
40
|
+
},
|
|
41
|
+
comment_target_database: function (print) {
|
|
42
|
+
return (0, print_utils_1.group)(print.spaced(["databaseKw", "name"]));
|
|
43
|
+
},
|
|
44
|
+
comment_target_domain: function (print) { return (0, print_utils_1.group)(print.spaced(["domainKw", "name"])); },
|
|
45
|
+
comment_target_extension: function (print) {
|
|
46
|
+
return (0, print_utils_1.group)(print.spaced(["extensionKw", "name"]));
|
|
47
|
+
},
|
|
48
|
+
comment_target_event_trigger: function (print) {
|
|
49
|
+
return (0, print_utils_1.group)(print.spaced(["eventTriggerKw", "name"]));
|
|
50
|
+
},
|
|
51
|
+
comment_target_foreign_data_wrapper: function (print) {
|
|
52
|
+
return (0, print_utils_1.group)(print.spaced(["foreignDataWrapperKw", "name"]));
|
|
53
|
+
},
|
|
54
|
+
comment_target_foreign_table: function (print) {
|
|
55
|
+
return (0, print_utils_1.group)(print.spaced(["foreignTableKw", "name"]));
|
|
56
|
+
},
|
|
57
|
+
comment_target_index: function (print) { return (0, print_utils_1.group)(print.spaced(["indexKw", "name"])); },
|
|
58
|
+
comment_target_language: function (print) {
|
|
59
|
+
return (0, print_utils_1.group)(print.spaced(["languageKw", "name"]));
|
|
60
|
+
},
|
|
61
|
+
comment_target_large_object: function (print) {
|
|
62
|
+
return (0, print_utils_1.group)(print.spaced(["largeObjectKw", "oid"]));
|
|
63
|
+
},
|
|
64
|
+
comment_target_materialized_view: function (print) {
|
|
65
|
+
return (0, print_utils_1.group)(print.spaced(["materializedViewKw", "name"]));
|
|
66
|
+
},
|
|
67
|
+
comment_target_operator_class: function (print) {
|
|
68
|
+
return (0, print_utils_1.group)(print.spaced(["operatorClassKw", "name", "usingKw", "methodName"]));
|
|
69
|
+
},
|
|
70
|
+
comment_target_operator_family: function (print) {
|
|
71
|
+
return (0, print_utils_1.group)(print.spaced(["operatorFamilyKw", "name", "usingKw", "methodName"]));
|
|
72
|
+
},
|
|
73
|
+
comment_target_policy: function (print) {
|
|
74
|
+
return (0, print_utils_1.group)(print.spaced(["policyKw", "name", "onKw", "tableName"]));
|
|
75
|
+
},
|
|
76
|
+
comment_target_publication: function (print) {
|
|
77
|
+
return (0, print_utils_1.group)(print.spaced(["publicationKw", "name"]));
|
|
78
|
+
},
|
|
79
|
+
comment_target_role: function (print) { return (0, print_utils_1.group)(print.spaced(["roleKw", "name"])); },
|
|
80
|
+
comment_target_rule: function (print) {
|
|
81
|
+
return (0, print_utils_1.group)(print.spaced(["ruleKw", "name", "onKw", "tableName"]));
|
|
82
|
+
},
|
|
83
|
+
comment_target_schema: function (print) { return (0, print_utils_1.group)(print.spaced(["schemaKw", "name"])); },
|
|
84
|
+
comment_target_sequence: function (print) {
|
|
85
|
+
return (0, print_utils_1.group)(print.spaced(["sequenceKw", "name"]));
|
|
86
|
+
},
|
|
87
|
+
comment_target_server: function (print) { return (0, print_utils_1.group)(print.spaced(["serverKw", "name"])); },
|
|
88
|
+
comment_target_statistics: function (print) {
|
|
89
|
+
return (0, print_utils_1.group)(print.spaced(["statisticsKw", "name"]));
|
|
90
|
+
},
|
|
91
|
+
comment_target_subscription: function (print) {
|
|
92
|
+
return (0, print_utils_1.group)(print.spaced(["subscriptionKw", "name"]));
|
|
93
|
+
},
|
|
94
|
+
comment_target_table: function (print) { return (0, print_utils_1.group)(print.spaced(["tableKw", "name"])); },
|
|
95
|
+
comment_target_tablespace: function (print) {
|
|
96
|
+
return (0, print_utils_1.group)(print.spaced(["tablespaceKw", "name"]));
|
|
97
|
+
},
|
|
98
|
+
comment_target_text_search_configuration: function (print) {
|
|
99
|
+
return (0, print_utils_1.group)(print.spaced(["textSearchConfigurationKw", "name"]));
|
|
100
|
+
},
|
|
101
|
+
comment_target_text_search_dictionary: function (print) {
|
|
102
|
+
return (0, print_utils_1.group)(print.spaced(["textSearchDictionaryKw", "name"]));
|
|
103
|
+
},
|
|
104
|
+
comment_target_text_search_parser: function (print) {
|
|
105
|
+
return (0, print_utils_1.group)(print.spaced(["textSearchParserKw", "name"]));
|
|
106
|
+
},
|
|
107
|
+
comment_target_text_search_template: function (print) {
|
|
108
|
+
return (0, print_utils_1.group)(print.spaced(["textSearchTemplateKw", "name"]));
|
|
109
|
+
},
|
|
110
|
+
comment_target_transform: function (print) {
|
|
111
|
+
return (0, print_utils_1.group)(print.spaced([
|
|
112
|
+
"transformForKw",
|
|
113
|
+
"typeName",
|
|
114
|
+
"languageKw",
|
|
115
|
+
"languageName",
|
|
116
|
+
]));
|
|
117
|
+
},
|
|
118
|
+
comment_target_trigger: function (print) {
|
|
119
|
+
return (0, print_utils_1.group)(print.spaced(["triggerKw", "name", "onKw", "tableName"]));
|
|
120
|
+
},
|
|
121
|
+
comment_target_type: function (print) { return (0, print_utils_1.group)(print.spaced(["typeKw", "name"])); },
|
|
122
|
+
comment_target_view: function (print) { return (0, print_utils_1.group)(print.spaced(["viewKw", "name"])); },
|
|
123
|
+
};
|
package/dist/syntax/dcl.js
CHANGED
|
@@ -104,4 +104,38 @@ exports.dclMap = {
|
|
|
104
104
|
granted_by_clause: function (print) { return (0, print_utils_1.group)(print.spaced(["grantedByKw", "role"])); },
|
|
105
105
|
grantee_public: function (print) { return print("publicKw"); },
|
|
106
106
|
grantee_group: function (print) { return (0, print_utils_1.group)(print.spaced(["groupKw", "name"])); },
|
|
107
|
+
alter_default_privileges_stmt: function (print) {
|
|
108
|
+
return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray(__spreadArray([
|
|
109
|
+
print.spaced("alterDefaultPrivilegesKw")
|
|
110
|
+
], print("clauses"), true), [
|
|
111
|
+
print("action"),
|
|
112
|
+
], false)));
|
|
113
|
+
},
|
|
114
|
+
default_acl_for_role_clause: function (print) {
|
|
115
|
+
return (0, print_utils_1.group)(print.spaced(["forKw", "roleKw", "roles"]));
|
|
116
|
+
},
|
|
117
|
+
default_acl_in_schema_clause: function (print) {
|
|
118
|
+
return (0, print_utils_1.group)(print.spaced(["inKw", "schemaKw", "schemas"]));
|
|
119
|
+
},
|
|
120
|
+
grant_default_privileges_action: function (print) {
|
|
121
|
+
return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
|
|
122
|
+
(0, print_utils_1.group)(print.spaced(["grantKw", "privileges", "onKw", "resourcesKw"])),
|
|
123
|
+
(0, print_utils_1.group)(print.spaced(["toKw", "roles", "withGrantOption"])),
|
|
124
|
+
]));
|
|
125
|
+
},
|
|
126
|
+
revoke_default_privileges_action: function (print) {
|
|
127
|
+
return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
|
|
128
|
+
(0, print_utils_1.group)([
|
|
129
|
+
print.spaced(["revokeKw", "grantOptionFor"]),
|
|
130
|
+
(0, print_utils_1.indent)([
|
|
131
|
+
print_utils_1.line,
|
|
132
|
+
(0, print_utils_1.join)(print_utils_1.line, [
|
|
133
|
+
(0, print_utils_1.group)(print("privileges")),
|
|
134
|
+
print.spaced(["onKw", "resourcesKw"]),
|
|
135
|
+
]),
|
|
136
|
+
]),
|
|
137
|
+
]),
|
|
138
|
+
(0, print_utils_1.group)(print.spaced(["fromKw", "roles", "behaviorKw"])),
|
|
139
|
+
]));
|
|
140
|
+
},
|
|
107
141
|
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.postgresqlMap = void 0;
|
|
4
|
+
var print_utils_1 = require("../../print_utils");
|
|
4
5
|
exports.postgresqlMap = {
|
|
5
6
|
postgresql_operator_expr: function (print) { return print(["operatorKw", "expr"]); },
|
|
6
7
|
postgresql_operator: function (print) { return print("operator"); },
|
|
7
8
|
postgresql_operator_class: function (print) { return print.spaced(["name", "options"]); },
|
|
8
|
-
postgresql_with_options: function (print) {
|
|
9
|
+
postgresql_with_options: function (print) {
|
|
10
|
+
return (0, print_utils_1.group)(print.spaced(["withKw", "options"]));
|
|
11
|
+
},
|
|
9
12
|
postgresql_options: function (print) { return print.spaced(["optionsKw", "options"]); },
|
|
10
13
|
postgresql_option_element: function (print) { return print.spaced(["name", "value"]); },
|
|
11
14
|
};
|
package/dist/syntax/expr.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { AllExprNodes } from "sql-parser-cst";
|
|
1
|
+
import { AllExprNodes, Keyword } from "sql-parser-cst";
|
|
2
2
|
import { CstToDocMap } from "../CstToDocMap";
|
|
3
|
+
import { AllPrettierOptions } from "src/options";
|
|
3
4
|
export declare const exprMap: CstToDocMap<AllExprNodes>;
|
|
5
|
+
export declare const printLiteral: <T>(node: Keyword, options: AllPrettierOptions<T>) => string;
|
package/dist/syntax/expr.js
CHANGED
|
@@ -9,7 +9,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
9
9
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.exprMap = void 0;
|
|
12
|
+
exports.printLiteral = exports.exprMap = void 0;
|
|
13
13
|
var print_utils_1 = require("../print_utils");
|
|
14
14
|
var node_utils_1 = require("../node_utils");
|
|
15
15
|
var utils_1 = require("../utils");
|
|
@@ -163,7 +163,7 @@ exports.exprMap = {
|
|
|
163
163
|
number_literal: function (print) { return print("text"); },
|
|
164
164
|
/** cst-ignore: value */
|
|
165
165
|
boolean_literal: function (print, node, path, options) {
|
|
166
|
-
return printLiteral(node.valueKw, options);
|
|
166
|
+
return (0, exports.printLiteral)(node.valueKw, options);
|
|
167
167
|
},
|
|
168
168
|
/** cst-ignore: value */
|
|
169
169
|
string_literal: function (print) { return print("text"); },
|
|
@@ -171,7 +171,7 @@ exports.exprMap = {
|
|
|
171
171
|
blob_literal: function (print) { return print("text"); },
|
|
172
172
|
/** cst-ignore: value */
|
|
173
173
|
null_literal: function (print, node, path, options) {
|
|
174
|
-
return printLiteral(node.nullKw, options);
|
|
174
|
+
return (0, exports.printLiteral)(node.nullKw, options);
|
|
175
175
|
},
|
|
176
176
|
numeric_literal: function (print) { return print.spaced(["numericKw", "string"]); },
|
|
177
177
|
bignumeric_literal: function (print) { return print.spaced(["bignumericKw", "string"]); },
|
|
@@ -197,6 +197,7 @@ var printLiteral = function (node, options) {
|
|
|
197
197
|
return node.text.toLowerCase();
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
+
exports.printLiteral = printLiteral;
|
|
200
201
|
var isBooleanOp = function (_a) {
|
|
201
202
|
var name = _a.name;
|
|
202
203
|
return name === "AND" || name === "OR";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.extensionMap = void 0;
|
|
4
|
+
var print_utils_1 = require("../print_utils");
|
|
5
|
+
exports.extensionMap = {
|
|
6
|
+
create_extension_stmt: function (print, node) {
|
|
7
|
+
return (0, print_utils_1.group)([
|
|
8
|
+
print.spaced(["createExtensionKw", "ifNotExistsKw", "name"]),
|
|
9
|
+
node.clauses.length > 0
|
|
10
|
+
? (0, print_utils_1.indent)([print_utils_1.line, print.spaced(["withKw", "clauses"])])
|
|
11
|
+
: [],
|
|
12
|
+
]);
|
|
13
|
+
},
|
|
14
|
+
extension_cascade_clause: function (print) { return (0, print_utils_1.group)(print.spaced(["cascadeKw"])); },
|
|
15
|
+
extension_schema_clause: function (print) { return (0, print_utils_1.group)(print.spaced(["schemaKw", "name"])); },
|
|
16
|
+
extension_version_clause: function (print) {
|
|
17
|
+
return (0, print_utils_1.group)(print.spaced(["versionKw", "name"]));
|
|
18
|
+
},
|
|
19
|
+
drop_extension_stmt: function (print) {
|
|
20
|
+
return (0, print_utils_1.group)(print.spaced(["dropExtensionKw", "ifExistsKw", "names", "behaviorKw"]));
|
|
21
|
+
},
|
|
22
|
+
};
|
package/dist/syntax/parameter.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parameterMap = void 0;
|
|
4
|
+
var expr_1 = require("./expr");
|
|
4
5
|
exports.parameterMap = {
|
|
5
6
|
// SET
|
|
6
7
|
set_parameter_stmt: function (print) {
|
|
@@ -22,4 +23,8 @@ exports.parameterMap = {
|
|
|
22
23
|
all_parameters: function (print) { return print("allKw"); },
|
|
23
24
|
// SHOW
|
|
24
25
|
show_parameter_stmt: function (print) { return print.spaced(["showKw", "name"]); },
|
|
26
|
+
/** cst-ignore: value */
|
|
27
|
+
boolean_on_off_literal: function (print, node, path, options) {
|
|
28
|
+
return (0, expr_1.printLiteral)(node.valueKw, options);
|
|
29
|
+
},
|
|
25
30
|
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.publicationMap = void 0;
|
|
4
|
+
var print_utils_1 = require("../print_utils");
|
|
5
|
+
exports.publicationMap = {
|
|
6
|
+
create_publication_stmt: function (print, node) {
|
|
7
|
+
return (0, print_utils_1.group)([
|
|
8
|
+
print.spaced(["createPublicationKw", "name"]),
|
|
9
|
+
print("clauses").map(function (printedClause, i) {
|
|
10
|
+
if (node.clauses[i].type === "for_publication_objects_clause") {
|
|
11
|
+
return [" ", printedClause];
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
return [print_utils_1.line, printedClause];
|
|
15
|
+
}
|
|
16
|
+
}),
|
|
17
|
+
]);
|
|
18
|
+
},
|
|
19
|
+
for_publication_objects_clause: function (print) {
|
|
20
|
+
return (0, print_utils_1.group)([print("forKw"), (0, print_utils_1.indent)([print_utils_1.line, print("publicationObjects")])]);
|
|
21
|
+
},
|
|
22
|
+
all_publication_object: function (print) { return (0, print_utils_1.group)(print.spaced(["allKw", "typesKw"])); },
|
|
23
|
+
publication_object_table: function (print) {
|
|
24
|
+
return (0, print_utils_1.group)(print.spaced(["tableKw", "table", "columns", "where"]));
|
|
25
|
+
},
|
|
26
|
+
publication_object_tables_in_schema: function (print) {
|
|
27
|
+
return (0, print_utils_1.group)(print.spaced(["tablesInSchemaKw", "schema"]));
|
|
28
|
+
},
|
|
29
|
+
alter_publication_stmt: function (print) {
|
|
30
|
+
return (0, print_utils_1.group)([
|
|
31
|
+
print.spaced(["alterPublicationKw", "name"]),
|
|
32
|
+
print.dynamicLine(),
|
|
33
|
+
print("action"),
|
|
34
|
+
]);
|
|
35
|
+
},
|
|
36
|
+
alter_action_add_publication_objects: function (print) {
|
|
37
|
+
return (0, print_utils_1.group)([print("addKw"), (0, print_utils_1.indent)([print_utils_1.line, print("publicationObjects")])]);
|
|
38
|
+
},
|
|
39
|
+
alter_action_set_publication_objects: function (print) {
|
|
40
|
+
return (0, print_utils_1.group)([print("setKw"), (0, print_utils_1.indent)([print_utils_1.line, print("publicationObjects")])]);
|
|
41
|
+
},
|
|
42
|
+
alter_action_drop_publication_objects: function (print) {
|
|
43
|
+
return (0, print_utils_1.group)([print("dropKw"), (0, print_utils_1.indent)([print_utils_1.line, print("publicationObjects")])]);
|
|
44
|
+
},
|
|
45
|
+
drop_publication_stmt: function (print) {
|
|
46
|
+
return (0, print_utils_1.group)(print.spaced(["dropPublicationKw", "ifExistsKw", "names", "behaviorKw"]));
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.subscriptionMap = void 0;
|
|
13
|
+
var print_utils_1 = require("../print_utils");
|
|
14
|
+
exports.subscriptionMap = {
|
|
15
|
+
create_subscription_stmt: function (print, node) {
|
|
16
|
+
return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, __spreadArray([
|
|
17
|
+
print.spaced(["createSubscriptionKw", "name"]),
|
|
18
|
+
print.spaced(["connectionKw", "connectionInfo"]),
|
|
19
|
+
print.spaced(["publicationKw", "publications"])
|
|
20
|
+
], (node.with ? [print.spaced(["with"])] : []), true)));
|
|
21
|
+
},
|
|
22
|
+
drop_subscription_stmt: function (print) {
|
|
23
|
+
return (0, print_utils_1.group)(print.spaced(["dropSubscriptionKw", "ifExistsKw", "name", "behaviorKw"]));
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -17,6 +17,8 @@ var alter_action_1 = require("./alter_action");
|
|
|
17
17
|
var alter_table_1 = require("./alter_table");
|
|
18
18
|
var analyze_1 = require("./analyze");
|
|
19
19
|
var base_1 = require("./base");
|
|
20
|
+
var cast_1 = require("./cast");
|
|
21
|
+
var comment_1 = require("./comment");
|
|
20
22
|
var constraint_1 = require("./constraint");
|
|
21
23
|
var create_table_1 = require("./create_table");
|
|
22
24
|
var data_type_1 = require("./data_type");
|
|
@@ -27,6 +29,7 @@ var domain_1 = require("./domain");
|
|
|
27
29
|
var drop_table_1 = require("./drop_table");
|
|
28
30
|
var explain_1 = require("./explain");
|
|
29
31
|
var expr_1 = require("./expr");
|
|
32
|
+
var extension_1 = require("./extension");
|
|
30
33
|
var frame_1 = require("./frame");
|
|
31
34
|
var function_1 = require("./function");
|
|
32
35
|
var index_1 = require("./index");
|
|
@@ -42,9 +45,11 @@ var procedural_language_1 = require("./procedural_language");
|
|
|
42
45
|
var procedure_1 = require("./procedure");
|
|
43
46
|
var proc_clause_1 = require("./proc_clause");
|
|
44
47
|
var program_1 = require("./program");
|
|
48
|
+
var publication_1 = require("./publication");
|
|
45
49
|
var schema_1 = require("./schema");
|
|
46
50
|
var select_1 = require("./select");
|
|
47
51
|
var sequence_1 = require("./sequence");
|
|
52
|
+
var subscription_1 = require("./subscription");
|
|
48
53
|
var transaction_1 = require("./transaction");
|
|
49
54
|
var trigger_1 = require("./trigger");
|
|
50
55
|
var truncate_1 = require("./truncate");
|
|
@@ -56,4 +61,4 @@ var bigquery_1 = require("./dialects/bigquery");
|
|
|
56
61
|
var mysql_1 = require("./dialects/mysql");
|
|
57
62
|
var sqlite_1 = require("./dialects/sqlite");
|
|
58
63
|
var postgresql_1 = require("./dialects/postgresql");
|
|
59
|
-
exports.transformMap = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, alias_1.aliasMap), alter_action_1.alterActionMap), alter_table_1.alterTableMap), analyze_1.analyzeMap), base_1.baseMap), constraint_1.constraintMap), create_table_1.createTableMap), data_type_1.dataTypeMap), dcl_1.dclMap), delete_1.deleteMap), do_1.doMap), domain_1.domainMap), drop_table_1.dropTableMap), explain_1.explainMap), expr_1.exprMap), frame_1.frameMap), function_1.functionMap), index_1.indexMap), insert_1.insertMap), merge_1.mergeMap), other_clauses_1.otherClausesMap), parameter_1.parameterMap), policy_1.policyMap), prepared_statements_1.preparedStatementsMap), proc_clause_1.procClauseMap), procedural_language_1.proceduralLanguageMap), procedure_1.procedureMap), program_1.programMap), rename_table_1.renameTableMap), role_1.roleMap), schema_1.schemaMap), select_1.selectMap), sequence_1.sequenceMap), transaction_1.transactionMap), trigger_1.triggerMap), truncate_1.truncateMap), type_1.typeMap), unsupported_grammar_1.unsupportedGrammarMap), update_1.updateMap), view_1.viewMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), sqlite_1.sqliteMap);
|
|
64
|
+
exports.transformMap = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, alias_1.aliasMap), alter_action_1.alterActionMap), alter_table_1.alterTableMap), analyze_1.analyzeMap), base_1.baseMap), cast_1.castMap), comment_1.commentMap), constraint_1.constraintMap), create_table_1.createTableMap), data_type_1.dataTypeMap), dcl_1.dclMap), delete_1.deleteMap), do_1.doMap), domain_1.domainMap), drop_table_1.dropTableMap), explain_1.explainMap), expr_1.exprMap), extension_1.extensionMap), frame_1.frameMap), function_1.functionMap), index_1.indexMap), insert_1.insertMap), merge_1.mergeMap), other_clauses_1.otherClausesMap), parameter_1.parameterMap), policy_1.policyMap), prepared_statements_1.preparedStatementsMap), proc_clause_1.procClauseMap), procedural_language_1.proceduralLanguageMap), procedure_1.procedureMap), program_1.programMap), publication_1.publicationMap), rename_table_1.renameTableMap), role_1.roleMap), schema_1.schemaMap), select_1.selectMap), sequence_1.sequenceMap), subscription_1.subscriptionMap), transaction_1.transactionMap), trigger_1.triggerMap), truncate_1.truncateMap), type_1.typeMap), unsupported_grammar_1.unsupportedGrammarMap), update_1.updateMap), view_1.viewMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), sqlite_1.sqliteMap);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-sql-cst",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Prettier plugin for SQL",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Barna Magyarkuti <bmagyarkuti@gmail.com>",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"prettier": "^3.0.3",
|
|
40
|
-
"sql-parser-cst": "^0.
|
|
40
|
+
"sql-parser-cst": "^0.35.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/jest": "^29.2.5",
|