prettier-plugin-sql-cst 0.11.0 → 0.11.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/dist/node_utils.d.ts +1 -0
- package/dist/node_utils.js +2 -1
- package/dist/syntax/data_type.js +1 -0
- package/dist/syntax/function.js +28 -2
- package/dist/syntax/proc_clause.js +1 -1
- package/dist/syntax/procedural_language.js +1 -1
- package/dist/syntax/procedure.js +4 -2
- package/package.json +2 -2
package/dist/node_utils.d.ts
CHANGED
|
@@ -15,3 +15,4 @@ export declare const isParenExpr: (node: any) => node is import("sql-parser-cst"
|
|
|
15
15
|
export declare const isListExpr: (node: any) => node is import("sql-parser-cst").ListExpr<Node>;
|
|
16
16
|
export declare const isCreateFunctionStmt: (node: any) => node is import("sql-parser-cst").CreateFunctionStmt;
|
|
17
17
|
export declare const isLanguageClause: (node: any) => node is import("sql-parser-cst").LanguageClause;
|
|
18
|
+
export declare const isDynamicallyLoadedFunction: (node: any) => node is import("sql-parser-cst").DynamicallyLoadedFunction;
|
package/dist/node_utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isLanguageClause = exports.isCreateFunctionStmt = exports.isListExpr = exports.isParenExpr = exports.isAsClause = exports.isArraySubscript = exports.isStringLiteral = exports.isJsonbLiteral = exports.isJsonLiteral = exports.isEmpty = exports.isKeyword = exports.isCreateTableStmt = exports.isFuncArgs = exports.isFuncCall = exports.isValuesClause = exports.isProgram = void 0;
|
|
3
|
+
exports.isDynamicallyLoadedFunction = exports.isLanguageClause = exports.isCreateFunctionStmt = exports.isListExpr = exports.isParenExpr = exports.isAsClause = exports.isArraySubscript = exports.isStringLiteral = exports.isJsonbLiteral = exports.isJsonLiteral = exports.isEmpty = exports.isKeyword = exports.isCreateTableStmt = exports.isFuncArgs = exports.isFuncCall = exports.isValuesClause = exports.isProgram = void 0;
|
|
4
4
|
var utils_1 = require("./utils");
|
|
5
5
|
var is = function (type) {
|
|
6
6
|
return function (node) {
|
|
@@ -23,3 +23,4 @@ exports.isParenExpr = is("paren_expr");
|
|
|
23
23
|
exports.isListExpr = is("list_expr");
|
|
24
24
|
exports.isCreateFunctionStmt = is("create_function_stmt");
|
|
25
25
|
exports.isLanguageClause = is("language_clause");
|
|
26
|
+
exports.isDynamicallyLoadedFunction = is("dynamically_loaded_function");
|
package/dist/syntax/data_type.js
CHANGED
package/dist/syntax/function.js
CHANGED
|
@@ -22,9 +22,35 @@ exports.functionMap = {
|
|
|
22
22
|
(0, print_utils_1.join)(print_utils_1.hardline, print("clauses").map(function (cls) { return (0, print_utils_1.group)(cls); })),
|
|
23
23
|
],
|
|
24
24
|
]; },
|
|
25
|
-
function_param: function (print) {
|
|
25
|
+
function_param: function (print) {
|
|
26
|
+
return print.spaced(["mode", "name", "dataType", "default"]);
|
|
27
|
+
},
|
|
28
|
+
function_param_default: function (print) { return print.spaced(["operator", "expr"]); },
|
|
29
|
+
return_clause: function (print) { return print.spaced(["returnKw", "expr"]); },
|
|
30
|
+
function_behavior_clause: function (print) { return print.spaced(["behaviorKw"]); },
|
|
31
|
+
function_security_clause: function (print) {
|
|
32
|
+
return print.spaced(["externalKw", "securityKw"]);
|
|
33
|
+
},
|
|
34
|
+
function_cost_clause: function (print) { return print.spaced(["costKw", "cost"]); },
|
|
35
|
+
function_rows_clause: function (print) { return print.spaced(["rowsKw", "rows"]); },
|
|
36
|
+
function_support_clause: function (print) { return print.spaced(["supportKw", "name"]); },
|
|
37
|
+
function_window_clause: function (print) { return print.spaced("windowKw"); },
|
|
38
|
+
function_transform_clause: function (print) { return print.spaced(["transformKw", "types"]); },
|
|
39
|
+
transform_type: function (print) { return print.spaced(["forTypeKw", "dataType"]); },
|
|
40
|
+
set_parameter_clause: function (print) {
|
|
41
|
+
return print.spaced(["setKw", "name", "operator", "value"]);
|
|
42
|
+
},
|
|
43
|
+
set_parameter_from_current_clause: function (print) {
|
|
44
|
+
return print.spaced(["setKw", "name", "fromCurrentKw"]);
|
|
45
|
+
},
|
|
46
|
+
dynamically_loaded_function: function (print) {
|
|
47
|
+
return (0, print_utils_1.join)(", ", print(["objectFile", "symbol"]));
|
|
48
|
+
},
|
|
26
49
|
drop_function_stmt: function (print) {
|
|
27
|
-
return
|
|
50
|
+
return (0, print_utils_1.group)([
|
|
51
|
+
print.spaced(["dropKw", "tableKw", "functionKw", "ifExistsKw", "name"]),
|
|
52
|
+
print.spaced(["params", "behaviorKw"]),
|
|
53
|
+
]);
|
|
28
54
|
},
|
|
29
55
|
};
|
|
30
56
|
var hasOnlyAsClause = function (node) {
|
|
@@ -8,7 +8,7 @@ exports.procClauseMap = {
|
|
|
8
8
|
determinism_clause: function (print) { return print.spaced("deterministicKw"); },
|
|
9
9
|
language_clause: function (print) { return print.spaced(["languageKw", "name"]); },
|
|
10
10
|
as_clause: function (print, node) {
|
|
11
|
-
if ((0, node_utils_1.isStringLiteral)(node.expr)) {
|
|
11
|
+
if ((0, node_utils_1.isStringLiteral)(node.expr) || (0, node_utils_1.isDynamicallyLoadedFunction)(node.expr)) {
|
|
12
12
|
return print.spaced(["asKw", "expr"]);
|
|
13
13
|
}
|
|
14
14
|
return [print("asKw"), (0, print_utils_1.indent)([print_utils_1.hardline, print("expr")])];
|
|
@@ -14,7 +14,7 @@ var print_utils_1 = require("../print_utils");
|
|
|
14
14
|
exports.proceduralLanguageMap = {
|
|
15
15
|
// BEGIN .. END
|
|
16
16
|
block_stmt: function (print, node) { return [
|
|
17
|
-
print("beginKw"),
|
|
17
|
+
print.spaced(["beginKw", "atomicKw"]),
|
|
18
18
|
(0, print_utils_1.indent)([print_utils_1.hardline, (0, print_utils_1.stripTrailingHardline)(print("program"))]),
|
|
19
19
|
node.exception ? [print_utils_1.hardline, print("exception")] : [],
|
|
20
20
|
print_utils_1.hardline,
|
package/dist/syntax/procedure.js
CHANGED
|
@@ -15,8 +15,10 @@ exports.procedureMap = {
|
|
|
15
15
|
print_utils_1.hardline,
|
|
16
16
|
(0, print_utils_1.join)(print_utils_1.hardline, print("clauses").map(function (clause) { return (0, print_utils_1.group)(clause); })),
|
|
17
17
|
]; },
|
|
18
|
-
procedure_param: function (print) { return print.spaced(["mode", "name", "dataType"]); },
|
|
19
18
|
drop_procedure_stmt: function (print) {
|
|
20
|
-
return
|
|
19
|
+
return (0, print_utils_1.group)([
|
|
20
|
+
print.spaced(["dropKw", "procedureKw", "ifExistsKw", "name"]),
|
|
21
|
+
print.spaced(["params", "behaviorKw"]),
|
|
22
|
+
]);
|
|
21
23
|
},
|
|
22
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prettier-plugin-sql-cst",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Prettier plugin for SQL",
|
|
5
5
|
"author": "Rene Saarsoo <nene@triin.net>",
|
|
6
6
|
"license": "GPL-3.0-or-later",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"prettier": "^3.0.3",
|
|
36
|
-
"sql-parser-cst": "^0.
|
|
36
|
+
"sql-parser-cst": "^0.24.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/jest": "^29.2.5",
|