prettier-plugin-sql-cst 0.11.4 → 0.11.6

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.
@@ -145,6 +145,7 @@ exports.exprMap = {
145
145
  },
146
146
  typed_expr: function (print) { return print(["dataType", "expr"]); },
147
147
  row_constructor: function (print) { return print(["rowKw", "row"]); },
148
+ array_constructor: function (print) { return print(["arrayKw", "expr"]); },
148
149
  quantifier_expr: function (print) { return print.spaced(["quantifierKw", "expr"]); },
149
150
  full_text_match_expr: function (print) {
150
151
  return print.spaced(["matchKw", "columns", "againstKw", "args"]);
@@ -4,6 +4,7 @@ exports.functionMap = void 0;
4
4
  var print_utils_1 = require("../print_utils");
5
5
  var node_utils_1 = require("../node_utils");
6
6
  exports.functionMap = {
7
+ /** cst-ignore: behaviorKw */
7
8
  create_function_stmt: function (print, node) { return [
8
9
  print.spaced([
9
10
  "createKw",
@@ -52,6 +53,20 @@ exports.functionMap = {
52
53
  print.spaced(["params", "behaviorKw"]),
53
54
  ]);
54
55
  },
56
+ // almost exact copy of alter_procedure_stmt
57
+ alter_function_stmt: function (print, node) {
58
+ return (0, print_utils_1.group)([
59
+ print.spaced(["alterKw", "functionKw"]),
60
+ " ",
61
+ print(["name", "params"]),
62
+ print.dynamicLine(),
63
+ (0, print_utils_1.join)(print.dynamicLine(), print("actions")),
64
+ node.behaviorKw ? [print.dynamicLine(), print("behaviorKw")] : [],
65
+ ]);
66
+ },
67
+ reset_parameter_clause: function (print) { return print.spaced(["resetKw", "name"]); },
68
+ /** cst-ignore: name */
69
+ reset_all_parameters_clause: function (print) { return print.spaced("resetAllKw"); },
55
70
  };
56
71
  var hasOnlyAsClause = function (node) {
57
72
  return node.clauses.length === 1 && (0, node_utils_1.isAsClause)(node.clauses[0]);
@@ -21,4 +21,15 @@ exports.procedureMap = {
21
21
  print.spaced(["params", "behaviorKw"]),
22
22
  ]);
23
23
  },
24
+ // almost exact copy of alter_function_stmt
25
+ alter_procedure_stmt: function (print, node) {
26
+ return (0, print_utils_1.group)([
27
+ print.spaced(["alterKw", "procedureKw"]),
28
+ " ",
29
+ print(["name", "params"]),
30
+ print.dynamicLine(),
31
+ (0, print_utils_1.join)(print.dynamicLine(), print("actions")),
32
+ node.behaviorKw ? [print.dynamicLine(), print("behaviorKw")] : [],
33
+ ]);
34
+ },
24
35
  };
@@ -13,31 +13,51 @@ exports.triggerMap = void 0;
13
13
  var print_utils_1 = require("../print_utils");
14
14
  exports.triggerMap = {
15
15
  create_trigger_stmt: function (print, node) {
16
- return (0, print_utils_1.join)(print_utils_1.hardline, __spreadArray(__spreadArray(__spreadArray([
16
+ return (0, print_utils_1.join)(print_utils_1.hardline, __spreadArray(__spreadArray([
17
17
  print.spaced([
18
18
  "createKw",
19
- "temporaryKw",
19
+ "orReplaceKw",
20
+ "kind",
20
21
  "triggerKw",
21
22
  "ifNotExistsKw",
22
23
  "name",
23
24
  ]),
24
- print("event")
25
- ], print.spaced(["forEachRowKw"]), true), print(["condition"]), true), [
25
+ (0, print_utils_1.group)([
26
+ node.timeKw ? [print.spaced("timeKw"), " "] : [],
27
+ print("event"),
28
+ print_utils_1.line,
29
+ print("target"),
30
+ ])
31
+ ], print("clauses"), true), [
26
32
  print("body"),
27
33
  ], false));
28
34
  },
29
- trigger_event: function (print) {
35
+ trigger_event: function (print, node) {
30
36
  return (0, print_utils_1.group)([
31
- print.spaced(["timeKw", "eventKw", "ofKw"]),
32
- (0, print_utils_1.indent)([
33
- print_utils_1.line,
34
- (0, print_utils_1.join)(print_utils_1.line, __spreadArray(__spreadArray([], print(["columns"]), true), [print.spaced(["onKw", "table"])], false)),
35
- ]),
37
+ print.spaced(["eventKw", "ofKw"]),
38
+ node.columns ? (0, print_utils_1.indent)([print_utils_1.line, print("columns")]) : [],
36
39
  ]);
37
40
  },
38
- trigger_condition: function (print) {
41
+ trigger_target: function (print) { return print.spaced(["onKw", "table"]); },
42
+ when_clause: function (print) {
39
43
  return (0, print_utils_1.group)([print("whenKw"), (0, print_utils_1.indent)([print_utils_1.line, print("expr")])]);
40
44
  },
45
+ for_each_clause: function (print) { return print.spaced(["forEachKw", "itemKw"]); },
46
+ execute_clause: function (print) { return [
47
+ print.spaced(["executeKw", "functionKw", "name"]),
48
+ print("args"),
49
+ ]; },
50
+ from_referenced_table_clause: function (print) { return print.spaced(["fromKw", "table"]); },
51
+ trigger_timing_clause: function (print) { return print.spaced(["timingKw"]); },
52
+ trigger_referencing_clause: function (print) {
53
+ return (0, print_utils_1.group)([
54
+ print.spaced(["referencingKw"]),
55
+ (0, print_utils_1.indent)([print_utils_1.line, print("transitions")]),
56
+ ]);
57
+ },
58
+ trigger_transition: function (print) { return [
59
+ print.spaced(["oldOrNewKw", "rowOrTableKw", "asKw", "name"]),
60
+ ]; },
41
61
  drop_trigger_stmt: function (print) {
42
62
  return print.spaced(["dropTriggerKw", "ifExistsKw", "trigger"]);
43
63
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-sql-cst",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
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.27.1"
36
+ "sql-parser-cst": "^0.28.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/jest": "^29.2.5",