prettier-plugin-sql-cst 0.11.2 → 0.11.4

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 CHANGED
@@ -101,7 +101,7 @@ There are also some SQL-specific options:
101
101
  | API Option | Default | Description |
102
102
  | -------------------- | :-----: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
103
103
  | `sqlKeywordCase` | `upper` | Converts 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). |
104
- | `sqlParamTypes` | `[]` | Array of bound parameter types: `?`, `?nr`, `:name`, `@name`, `$name`. |
104
+ | `sqlParamTypes` | `[]` | Array of bound parameter types: `?`, `?nr`, `$nr`, `:name`, `@name`, `$name`. |
105
105
  | `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) |
106
106
 
107
107
  ## FAQ
package/dist/options.js CHANGED
@@ -32,7 +32,7 @@ exports.options = {
32
32
  default: [{ value: [] }],
33
33
  description: "Syntax for bound parameters",
34
34
  // Since 0.7.0
35
- // Possible values in array: "?" | "?nr" | ":name" | "$name" | "@name"
35
+ // Possible values in array: "?" | "?nr" | "$nr" | ":name" | "$name" | "@name"
36
36
  },
37
37
  sqlCanonicalSyntax: {
38
38
  type: "boolean",
@@ -19,7 +19,12 @@ exports.alterActionMap = {
19
19
  alter_action_set_default_collate: function (print) {
20
20
  return print.spaced(["setDefaultCollateKw", "collation"]);
21
21
  },
22
- alter_action_add_constraint: function (print) { return print.spaced(["addKw", "constraint"]); },
22
+ alter_action_add_constraint: function (print) {
23
+ return print.spaced(["addKw", "name", "constraint", "modifiers"]);
24
+ },
25
+ alter_action_add_constraint_constraint_name: function (print) {
26
+ return print.spaced(["constraintKw", "ifNotExistsKw", "name"]);
27
+ },
23
28
  alter_action_drop_constraint: function (print) {
24
29
  return print.spaced([
25
30
  "dropConstraintKw",
@@ -28,6 +33,9 @@ exports.alterActionMap = {
28
33
  "behaviorKw",
29
34
  ]);
30
35
  },
36
+ alter_action_drop_primary_key: function (print) {
37
+ return print.spaced(["dropPrimaryKeyKw", "ifExistsKw"]);
38
+ },
31
39
  alter_action_alter_constraint: function (print) {
32
40
  return print.spaced(["alterConstraintKw", "constraint", "modifiers"]);
33
41
  },
@@ -80,6 +88,9 @@ exports.alterActionMap = {
80
88
  alter_action_no_depends_on_extension: function (print) {
81
89
  return print.spaced(["noDependsOnExtensionKw", "extension"]);
82
90
  },
91
+ alter_action_attach_partition: function (print) {
92
+ return print.spaced(["attachPartitionKw", "index"]);
93
+ },
83
94
  // ALTER COLUMN
84
95
  alter_action_alter_column: function (print) {
85
96
  return (0, print_utils_1.group)([
@@ -57,9 +57,6 @@ exports.constraintMap = {
57
57
  return baseDoc;
58
58
  }
59
59
  },
60
- index_specification: function (print) {
61
- return print.spaced(["expr", "opclass", "direction", "nullHandlingKw"]);
62
- },
63
60
  referential_action: function (print) {
64
61
  return print.spaced(["onKw", "eventKw", "actionKw", "columns"]);
65
62
  },
@@ -101,7 +98,6 @@ exports.constraintMap = {
101
98
  ]);
102
99
  },
103
100
  exclusion_param: function (print) { return print.spaced(["index", "withKw", "operator"]); },
104
- index_include_clause: function (print) { return print.spaced(["includeKw", "columns"]); },
105
101
  index_tablespace_clause: function (print) {
106
102
  return print.spaced(["usingIndexTablespaceKw", "name"]);
107
103
  },
@@ -4,7 +4,7 @@ exports.postgresqlMap = void 0;
4
4
  exports.postgresqlMap = {
5
5
  postgresql_operator_expr: function (print) { return print(["operatorKw", "expr"]); },
6
6
  postgresql_operator: function (print) { return print("operator"); },
7
- postgresql_operator_class: function (print) { return print("name"); },
7
+ postgresql_operator_class: function (print) { return print.spaced(["name", "options"]); },
8
8
  postgresql_with_options: function (print) { return print.spaced(["withKw", "options"]); },
9
9
  postgresql_options: function (print) { return print.spaced(["optionsKw", "options"]); },
10
10
  postgresql_option_element: function (print) { return print.spaced(["name", "value"]); },
@@ -12,7 +12,6 @@ exports.sqliteMap = {
12
12
  vacuum_stmt: function (print) {
13
13
  return print.spaced(["vacuumKw", "schema", "intoKw", "file"]);
14
14
  },
15
- reindex_stmt: function (print) { return print.spaced(["reindexKw", "table"]); },
16
15
  pragma_stmt: function (print) { return print.spaced(["pragmaKw", "pragma"]); },
17
16
  pragma_assignment: function (print) { return (0, print_utils_1.join)(" = ", print(["name", "value"])); },
18
17
  pragma_func_call: function (print) { return print(["name", "args"]); },
@@ -16,26 +16,72 @@ exports.indexMap = {
16
16
  return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([
17
17
  print.spaced([
18
18
  "createKw",
19
+ "orReplaceKw",
19
20
  "indexTypeKw",
20
21
  "indexKw",
22
+ "concurrentlyKw",
21
23
  "ifNotExistsKw",
22
24
  "name",
23
25
  "onKw",
24
26
  "table",
27
+ "using",
25
28
  "columns",
26
29
  ])
27
30
  ], print("clauses"), true)));
28
31
  },
32
+ index_specification: function (print) {
33
+ return print.spaced(["expr", "opclass", "direction", "nullHandlingKw"]);
34
+ },
35
+ index_include_clause: function (print) { return print.spaced(["includeKw", "columns"]); },
36
+ index_nulls_distinct_clause: function (print) { return print.spaced(["nullsDistinctKw"]); },
37
+ index_nulls_not_distinct_clause: function (print) {
38
+ return print.spaced(["nullsNotDistinctKw"]);
39
+ },
29
40
  drop_index_stmt: function (print) {
30
- return print.spaced([
41
+ return (0, print_utils_1.group)(print.spaced([
31
42
  "dropKw",
32
43
  "indexTypeKw",
33
44
  "indexKw",
45
+ "concurrentlyKw",
34
46
  "ifExistsKw",
35
47
  "indexes",
36
48
  "onKw",
37
49
  "table",
38
- ]);
50
+ "behaviorKw",
51
+ ]));
39
52
  },
40
53
  verbose_all_columns: function (print) { return print.spaced("allColumnsKw"); },
54
+ alter_index_stmt: function (print) {
55
+ return (0, print_utils_1.group)([
56
+ print.spaced(["alterKw", "indexKw", "ifExistsKw", "index"]),
57
+ print.dynamicLine(),
58
+ print("action"),
59
+ ]);
60
+ },
61
+ alter_index_all_in_tablespace_stmt: function (print) {
62
+ return (0, print_utils_1.group)([
63
+ print.spaced([
64
+ "alterIndexKw",
65
+ "allInTablespaceKw",
66
+ "tablespace",
67
+ "ownedBy",
68
+ ]),
69
+ print.dynamicLine(),
70
+ print("action"),
71
+ ]);
72
+ },
73
+ reindex_stmt: function (print) {
74
+ return print.spaced([
75
+ "reindexKw",
76
+ "options",
77
+ "targetKw",
78
+ "concurrentlyKw",
79
+ "name",
80
+ ]);
81
+ },
82
+ reindex_option_concurrently: function (print) {
83
+ return print.spaced(["concurrentlyKw", "value"]);
84
+ },
85
+ reindex_option_tablespace: function (print) { return print.spaced(["tablespaceKw", "name"]); },
86
+ reindex_option_verbose: function (print) { return print.spaced(["verboseKw", "value"]); },
41
87
  };
@@ -23,6 +23,7 @@ exports.viewMap = {
23
23
  with_check_option_clause: function (print) {
24
24
  return print.spaced(["withKw", "levelKw", "checkOptionKw"]);
25
25
  },
26
+ as_replica_of_clause: function (print) { return print.spaced(["asReplicaOfKw", "view"]); },
26
27
  drop_view_stmt: function (print) {
27
28
  return (0, print_utils_1.group)(print.spaced([
28
29
  "dropKw",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-sql-cst",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "description": "Prettier plugin for SQL",
5
5
  "author": "Rene Saarsoo <nene@triin.net>",
6
6
  "license": "GPL-3.0-or-later",
@@ -33,10 +33,11 @@
33
33
  ],
34
34
  "dependencies": {
35
35
  "prettier": "^3.0.3",
36
- "sql-parser-cst": "^0.26.0"
36
+ "sql-parser-cst": "^0.27.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/jest": "^29.2.5",
40
+ "chalk": "^4.1.2",
40
41
  "dedent-js": "^1.0.1",
41
42
  "jest": "^29.7.0",
42
43
  "ts-jest": "^29.1.1",