prettier-plugin-sql-cst 0.15.0 → 0.16.0

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.
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.alterActionMap = void 0;
4
4
  var print_utils_1 = require("../print_utils");
5
+ var constraint_1 = require("./constraint");
5
6
  exports.alterActionMap = {
6
7
  alter_action_rename: function (print) { return print.spaced(["renameKw", "newName"]); },
7
8
  alter_action_rename_column: function (print) {
@@ -19,8 +20,12 @@ exports.alterActionMap = {
19
20
  alter_action_set_default_collate: function (print) {
20
21
  return print.spaced(["setDefaultCollateKw", "collation"]);
21
22
  },
22
- alter_action_add_constraint: function (print) {
23
- return print.spaced(["addKw", "name", "constraint", "modifiers"]);
23
+ /** cst-ignore: constraint, modifiers */
24
+ alter_action_add_constraint: function (print, node) {
25
+ return (0, print_utils_1.group)([
26
+ print.spaced(["addKw", "name"]),
27
+ (0, print_utils_1.indent)([print_utils_1.line, (0, constraint_1.printUnnamedConstraint)(print, node)]),
28
+ ]);
24
29
  },
25
30
  alter_action_add_constraint_constraint_name: function (print) {
26
31
  return print.spaced(["constraintKw", "ifNotExistsKw", "name"]);
@@ -1,3 +1,6 @@
1
- import { AllConstraintNodes } from "sql-parser-cst";
1
+ import { Doc } from "prettier";
2
+ import { AllConstraintNodes, AlterActionAddConstraint, Constraint } from "sql-parser-cst";
2
3
  import { CstToDocMap } from "../CstToDocMap";
4
+ import { PrintFn } from "../PrintFn";
3
5
  export declare const constraintMap: CstToDocMap<AllConstraintNodes>;
6
+ export declare const printUnnamedConstraint: <T>(print: PrintFn<Constraint<T>, "name" | "modifiers" | "constraint"> | PrintFn<AlterActionAddConstraint, "name" | "modifiers" | "constraint" | "addKw">, node: AlterActionAddConstraint | Constraint<T>) => Doc;
@@ -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.constraintMap = void 0;
12
+ exports.printUnnamedConstraint = exports.constraintMap = void 0;
13
13
  var print_utils_1 = require("../print_utils");
14
14
  exports.constraintMap = {
15
15
  /** cst-ignore: constraint, modifiers */
@@ -17,11 +17,11 @@ exports.constraintMap = {
17
17
  if (node.name) {
18
18
  return (0, print_utils_1.group)([
19
19
  print("name"),
20
- (0, print_utils_1.indent)([print_utils_1.line, printUnnamedConstraint(print, node)]),
20
+ (0, print_utils_1.indent)([print_utils_1.line, (0, exports.printUnnamedConstraint)(print, node)]),
21
21
  ]);
22
22
  }
23
23
  else {
24
- return printUnnamedConstraint(print, node);
24
+ return (0, exports.printUnnamedConstraint)(print, node);
25
25
  }
26
26
  },
27
27
  constraint_name: function (print) { return print.spaced(["constraintKw", "name"]); },
@@ -113,3 +113,4 @@ var printUnnamedConstraint = function (print, node) {
113
113
  return print("constraint");
114
114
  }
115
115
  };
116
+ exports.printUnnamedConstraint = printUnnamedConstraint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prettier-plugin-sql-cst",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
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.36.0"
40
+ "sql-parser-cst": "^0.36.1"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/jest": "^29.2.5",