prettier-plugin-sql-cst 0.19.1 → 0.19.3

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.
Files changed (145) hide show
  1. package/dist/index.d.ts +21 -7
  2. package/dist/index.js +2637 -55
  3. package/package.json +4 -2
  4. package/dist/CstToDocMap.d.ts +0 -11
  5. package/dist/CstToDocMap.js +0 -1
  6. package/dist/PrintFn.d.ts +0 -17
  7. package/dist/PrintFn.js +0 -1
  8. package/dist/embed.d.ts +0 -3
  9. package/dist/embed.js +0 -6
  10. package/dist/embedJs.d.ts +0 -3
  11. package/dist/embedJs.js +0 -43
  12. package/dist/embedJson.d.ts +0 -3
  13. package/dist/embedJson.js +0 -34
  14. package/dist/embedSql.d.ts +0 -3
  15. package/dist/embedSql.js +0 -39
  16. package/dist/node_utils.d.ts +0 -38
  17. package/dist/node_utils.js +0 -44
  18. package/dist/options.d.ts +0 -15
  19. package/dist/options.js +0 -147
  20. package/dist/printComment.d.ts +0 -3
  21. package/dist/printComment.js +0 -12
  22. package/dist/printSql.d.ts +0 -5
  23. package/dist/printSql.js +0 -61
  24. package/dist/print_utils.d.ts +0 -13
  25. package/dist/print_utils.js +0 -49
  26. package/dist/syntax/alias.d.ts +0 -3
  27. package/dist/syntax/alias.js +0 -3
  28. package/dist/syntax/alter_action.d.ts +0 -3
  29. package/dist/syntax/alter_action.js +0 -120
  30. package/dist/syntax/alter_table.d.ts +0 -3
  31. package/dist/syntax/alter_table.js +0 -19
  32. package/dist/syntax/analyze.d.ts +0 -3
  33. package/dist/syntax/analyze.js +0 -4
  34. package/dist/syntax/base.d.ts +0 -3
  35. package/dist/syntax/base.js +0 -19
  36. package/dist/syntax/cast.d.ts +0 -3
  37. package/dist/syntax/cast.js +0 -4
  38. package/dist/syntax/comment.d.ts +0 -3
  39. package/dist/syntax/comment.js +0 -54
  40. package/dist/syntax/constraint.d.ts +0 -6
  41. package/dist/syntax/constraint.js +0 -80
  42. package/dist/syntax/create_table.d.ts +0 -3
  43. package/dist/syntax/create_table.js +0 -69
  44. package/dist/syntax/data_type.d.ts +0 -3
  45. package/dist/syntax/data_type.js +0 -29
  46. package/dist/syntax/dcl.d.ts +0 -3
  47. package/dist/syntax/dcl.js +0 -83
  48. package/dist/syntax/delete.d.ts +0 -3
  49. package/dist/syntax/delete.js +0 -5
  50. package/dist/syntax/dialects/bigquery.d.ts +0 -3
  51. package/dist/syntax/dialects/bigquery.js +0 -84
  52. package/dist/syntax/dialects/mysql.d.ts +0 -3
  53. package/dist/syntax/dialects/mysql.js +0 -3
  54. package/dist/syntax/dialects/postgresql.d.ts +0 -3
  55. package/dist/syntax/dialects/postgresql.js +0 -9
  56. package/dist/syntax/dialects/sqlite.d.ts +0 -3
  57. package/dist/syntax/dialects/sqlite.js +0 -9
  58. package/dist/syntax/do.d.ts +0 -3
  59. package/dist/syntax/do.js +0 -4
  60. package/dist/syntax/domain.d.ts +0 -3
  61. package/dist/syntax/domain.js +0 -11
  62. package/dist/syntax/drop_table.d.ts +0 -3
  63. package/dist/syntax/drop_table.js +0 -11
  64. package/dist/syntax/explain.d.ts +0 -3
  65. package/dist/syntax/explain.js +0 -7
  66. package/dist/syntax/expr.d.ts +0 -5
  67. package/dist/syntax/expr.js +0 -224
  68. package/dist/syntax/extension.d.ts +0 -3
  69. package/dist/syntax/extension.js +0 -13
  70. package/dist/syntax/frame.d.ts +0 -3
  71. package/dist/syntax/frame.js +0 -13
  72. package/dist/syntax/function.d.ts +0 -4
  73. package/dist/syntax/function.js +0 -55
  74. package/dist/syntax/index.d.ts +0 -3
  75. package/dist/syntax/index.js +0 -60
  76. package/dist/syntax/insert.d.ts +0 -3
  77. package/dist/syntax/insert.js +0 -33
  78. package/dist/syntax/merge.d.ts +0 -3
  79. package/dist/syntax/merge.js +0 -30
  80. package/dist/syntax/other_clauses.d.ts +0 -3
  81. package/dist/syntax/other_clauses.js +0 -9
  82. package/dist/syntax/parameter.d.ts +0 -3
  83. package/dist/syntax/parameter.js +0 -18
  84. package/dist/syntax/policy.d.ts +0 -3
  85. package/dist/syntax/policy.js +0 -27
  86. package/dist/syntax/prepared_statements.d.ts +0 -3
  87. package/dist/syntax/prepared_statements.js +0 -31
  88. package/dist/syntax/proc_clause.d.ts +0 -3
  89. package/dist/syntax/proc_clause.js +0 -14
  90. package/dist/syntax/procedural_language.d.ts +0 -3
  91. package/dist/syntax/procedural_language.js +0 -104
  92. package/dist/syntax/procedure.d.ts +0 -3
  93. package/dist/syntax/procedure.js +0 -38
  94. package/dist/syntax/program.d.ts +0 -3
  95. package/dist/syntax/program.js +0 -39
  96. package/dist/syntax/publication.d.ts +0 -3
  97. package/dist/syntax/publication.js +0 -27
  98. package/dist/syntax/rename_table.d.ts +0 -3
  99. package/dist/syntax/rename_table.js +0 -8
  100. package/dist/syntax/role.d.ts +0 -3
  101. package/dist/syntax/role.js +0 -31
  102. package/dist/syntax/schema.d.ts +0 -3
  103. package/dist/syntax/schema.js +0 -18
  104. package/dist/syntax/select.d.ts +0 -3
  105. package/dist/syntax/select.js +0 -226
  106. package/dist/syntax/sequence.d.ts +0 -3
  107. package/dist/syntax/sequence.js +0 -36
  108. package/dist/syntax/subscription.d.ts +0 -3
  109. package/dist/syntax/subscription.js +0 -10
  110. package/dist/syntax/transaction.d.ts +0 -3
  111. package/dist/syntax/transaction.js +0 -19
  112. package/dist/syntax/transformMap.d.ts +0 -3
  113. package/dist/syntax/transformMap.js +0 -100
  114. package/dist/syntax/trigger.d.ts +0 -3
  115. package/dist/syntax/trigger.js +0 -52
  116. package/dist/syntax/truncate.d.ts +0 -3
  117. package/dist/syntax/truncate.js +0 -10
  118. package/dist/syntax/type.d.ts +0 -3
  119. package/dist/syntax/type.js +0 -12
  120. package/dist/syntax/unsupported_grammar.d.ts +0 -3
  121. package/dist/syntax/unsupported_grammar.js +0 -4
  122. package/dist/syntax/update.d.ts +0 -3
  123. package/dist/syntax/update.js +0 -14
  124. package/dist/syntax/view.d.ts +0 -3
  125. package/dist/syntax/view.js +0 -48
  126. package/dist/transform/addFinalSemicolon.d.ts +0 -2
  127. package/dist/transform/addFinalSemicolon.js +0 -9
  128. package/dist/transform/aliasAs.d.ts +0 -2
  129. package/dist/transform/aliasAs.js +0 -10
  130. package/dist/transform/canonicKeywords.d.ts +0 -2
  131. package/dist/transform/canonicKeywords.js +0 -62
  132. package/dist/transform/canonicOperators.d.ts +0 -3
  133. package/dist/transform/canonicOperators.js +0 -28
  134. package/dist/transform/comments.d.ts +0 -12
  135. package/dist/transform/comments.js +0 -22
  136. package/dist/transform/stripTrailingCommas.d.ts +0 -2
  137. package/dist/transform/stripTrailingCommas.js +0 -15
  138. package/dist/transform/transformCst.d.ts +0 -5
  139. package/dist/transform/transformCst.js +0 -21
  140. package/dist/transform/transformUtils.d.ts +0 -2
  141. package/dist/transform/transformUtils.js +0 -3
  142. package/dist/utils.d.ts +0 -9
  143. package/dist/utils.js +0 -9
  144. package/dist/visitAllNodes.d.ts +0 -2
  145. package/dist/visitAllNodes.js +0 -16
@@ -1,30 +0,0 @@
1
- import { group, hardline, indent, join, line } from "../print_utils";
2
- export const mergeMap = {
3
- merge_stmt: (print) => group(join(hardline, print("clauses"))),
4
- merge_clause: (print) => join(line, [
5
- print.spaced(["mergeKw", "intoKw", "target"]),
6
- print.spaced(["usingKw", "source"]),
7
- group([print("onKw"), indent([line, print("condition")])]),
8
- ]),
9
- merge_when_clause: (print, node) => [
10
- group([
11
- print.spaced(["whenKw", "matchedKw", "byKw"]),
12
- node.condition ? indent([line, print("condition")]) : [],
13
- [line, print("thenKw")],
14
- ]),
15
- indent([hardline, group(print("action"))]),
16
- ],
17
- merge_when_condition: (print) => print.spaced(["andKw", "expr"]),
18
- merge_action_delete: (print) => print("deleteKw"),
19
- merge_action_insert: (print, node) => [
20
- group([
21
- print("insertKw"),
22
- node.columns ? indent([hardline, print("columns")]) : [],
23
- ]),
24
- line,
25
- join(hardline, print("clauses")),
26
- ],
27
- merge_action_insert_row_clause: (print) => print("rowKw"),
28
- merge_action_update: (print) => print.spaced(["updateKw", "set"]),
29
- merge_action_do_nothing: (print) => print.spaced(["doNothingKw"]),
30
- };
@@ -1,3 +0,0 @@
1
- import { AllOtherClauses } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const otherClausesMap: CstToDocMap<AllOtherClauses>;
@@ -1,9 +0,0 @@
1
- import { line, indent, group } from "../print_utils";
2
- export const otherClausesMap = {
3
- // CLUSTER BY clause
4
- cluster_by_clause: (print) => group([print.spaced("clusterByKw"), indent([line, print("columns")])]),
5
- // RETURNING clause
6
- returning_clause: (print) => group([print("returningKw"), indent([line, print("columns")])]),
7
- // WHERE CURRENT OF clause
8
- where_current_of_clause: (print) => print.spaced(["whereCurrentOfKw", "cursor"]),
9
- };
@@ -1,3 +0,0 @@
1
- import { AllParameterNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const parameterMap: CstToDocMap<AllParameterNodes>;
@@ -1,18 +0,0 @@
1
- import { printLiteral } from "./expr";
2
- import { group } from "../print_utils";
3
- export const parameterMap = {
4
- // SET
5
- set_parameter_stmt: (print) => group(print.spaced(["setKw", "modifierKw", "name", "operator", "value"])),
6
- set_time_zone_parameter_stmt: (print) => group(print.spaced(["setKw", "modifierKw", "timeZoneKw", "value"])),
7
- set_parameter_clause: (print) => print.spaced(["setKw", "name", "operator", "value"]),
8
- local_parameter_value: (print) => print("localKw"),
9
- set_parameter_from_current_clause: (print) => print.spaced(["setKw", "name", "fromCurrentKw"]),
10
- // RESET
11
- reset_parameter_stmt: (print) => group(print.spaced(["resetKw", "name"])),
12
- reset_parameter_clause: (print) => print.spaced(["resetKw", "name"]),
13
- all_parameters: (print) => print("allKw"),
14
- // SHOW
15
- show_parameter_stmt: (print) => group(print.spaced(["showKw", "name"])),
16
- /** cst-ignore: value */
17
- boolean_on_off_literal: (print, node, path, options) => printLiteral(node.valueKw, options),
18
- };
@@ -1,3 +0,0 @@
1
- import { AllPolicyNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const policyMap: CstToDocMap<AllPolicyNodes>;
@@ -1,27 +0,0 @@
1
- import { group, join } from "../print_utils";
2
- export const policyMap = {
3
- create_policy_stmt: (print, node) => group([
4
- print.spaced(["createPolicyKw", "name", "onKw", "table"]),
5
- node.clauses.length > 0 ? print.dynamicLine() : [],
6
- join(print.dynamicLine(), print("clauses")),
7
- ]),
8
- policy_permissive_clause: (print) => group(print.spaced(["asKw", "permissiveKw"])),
9
- policy_restrictive_clause: (print) => group(print.spaced(["asKw", "restrictiveKw"])),
10
- policy_command_clause: (print) => group(print.spaced(["forKw", "commandKw"])),
11
- policy_roles_clause: (print) => group(print.spaced(["toKw", "roles"])),
12
- policy_using_clause: (print) => group(print.spaced(["usingKw", "expr"])),
13
- policy_check_clause: (print) => group(print.spaced(["withKw", "checkKw", "expr"])),
14
- alter_policy_stmt: (print) => group([
15
- print.spaced(["alterPolicyKw", "name", "onKw", "table"]),
16
- print.dynamicLine(),
17
- join(print.dynamicLine(), print("actions")),
18
- ]),
19
- drop_policy_stmt: (print) => group(print.spaced([
20
- "dropPolicyKw",
21
- "ifExistsKw",
22
- "name",
23
- "onKw",
24
- "table",
25
- "behaviorKw",
26
- ])),
27
- };
@@ -1,3 +0,0 @@
1
- import { AllPreparedStatementNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const preparedStatementsMap: CstToDocMap<AllPreparedStatementNodes>;
@@ -1,31 +0,0 @@
1
- import { group, hardline, indent, join, line } from "../print_utils";
2
- export const preparedStatementsMap = {
3
- // EXECUTE
4
- execute_stmt: (print, node) => {
5
- if (node.args?.type === "execute_using_clause") {
6
- return group(print.spaced(["executeKw", "name", "args"]));
7
- }
8
- else {
9
- return group([print.spaced(["executeKw", "name"]), print("args")]);
10
- }
11
- },
12
- execute_immediate_stmt: (print) => group(join(hardline, [
13
- group([
14
- print.spaced(["executeKw", "immediateKw"]),
15
- indent([line, print("expr")]),
16
- ]),
17
- ...print(["into", "using"]).map((clause) => group(clause)),
18
- ])),
19
- execute_into_clause: (print) => print.spaced(["intoKw", "variables"]),
20
- execute_using_clause: (print) => group([print("usingKw"), indent([line, print("values")])]),
21
- // PREPARE
22
- prepare_stmt: (print) => group(join(" ", [
23
- print("prepareKw"),
24
- print(["name", "params"]),
25
- print("source"),
26
- ])),
27
- prepare_from_clause: (print) => group([print("fromKw"), indent([line, print("expr")])]),
28
- // DEALLOCATE
29
- deallocate_stmt: (print) => group(print.spaced(["deallocateKw", "name"])),
30
- deallocate_all: (print) => print("allKw"),
31
- };
@@ -1,3 +0,0 @@
1
- import { AllProcClauseNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const procClauseMap: CstToDocMap<AllProcClauseNodes>;
@@ -1,14 +0,0 @@
1
- import { isDynamicallyLoadedFunction, isStringLiteral } from "../node_utils";
2
- import { hardline, indent } from "../print_utils";
3
- export const procClauseMap = {
4
- returns_clause: (print) => print.spaced(["returnsKw", "dataType"]),
5
- determinism_clause: (print) => print.spaced("deterministicKw"),
6
- language_clause: (print) => print.spaced(["languageKw", "name"]),
7
- as_clause: (print, node) => {
8
- if (isStringLiteral(node.expr) || isDynamicallyLoadedFunction(node.expr)) {
9
- return print.spaced(["asKw", "expr"]);
10
- }
11
- return [print("asKw"), indent([hardline, print("expr")])];
12
- },
13
- with_connection_clause: (print) => print.spaced(["withConnectionKw", "connection"]),
14
- };
@@ -1,3 +0,0 @@
1
- import { AllProceduralNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const proceduralLanguageMap: CstToDocMap<AllProceduralNodes>;
@@ -1,104 +0,0 @@
1
- import { group, hardline, indent, join, line, stripTrailingHardline, } from "../print_utils";
2
- export const proceduralLanguageMap = {
3
- // BEGIN .. END
4
- block_stmt: (print, node) => group([
5
- print.spaced(["beginKw", "atomicKw"]),
6
- indent([hardline, stripTrailingHardline(print("program"))]),
7
- node.exception ? [hardline, print("exception")] : [],
8
- hardline,
9
- print("endKw"),
10
- ]),
11
- exception_clause: (print) => group([
12
- print.spaced(["exceptionKw", "whenKw", "condition", "thenKw"]),
13
- indent([hardline, stripTrailingHardline(print("program"))]),
14
- ]),
15
- error_category: (print) => print("errorKw"),
16
- // DECLARE
17
- declare_stmt: (print) => group(join(" ", [
18
- print("declareKw"),
19
- group(print("names")),
20
- ...print.spaced(["dataType", "default"]),
21
- ])),
22
- declare_default: (print) => print.spaced(["defaultKw", "expr"]),
23
- // SET
24
- set_stmt: (print) => group(print.spaced(["setKw", "assignments"])),
25
- // IF
26
- if_stmt: (print) => group(join(hardline, [...print("clauses"), print.spaced("endIfKw")])),
27
- if_clause: (print) => [
28
- group([
29
- print("ifKw"),
30
- indent([line, print("condition")]),
31
- line,
32
- print("thenKw"),
33
- ]),
34
- indent([hardline, stripTrailingHardline(print("consequent"))]),
35
- ],
36
- elseif_clause: (print) => [
37
- group([
38
- print("elseifKw"),
39
- indent([line, print("condition")]),
40
- line,
41
- print("thenKw"),
42
- ]),
43
- indent([hardline, stripTrailingHardline(print("consequent"))]),
44
- ],
45
- else_clause: (print) => [
46
- print("elseKw"),
47
- indent([hardline, stripTrailingHardline(print("consequent"))]),
48
- ],
49
- // CASE
50
- case_stmt: (print) => group([
51
- print.spaced(["caseKw", "expr"]),
52
- indent([hardline, join(hardline, print("clauses"))]),
53
- hardline,
54
- print.spaced("endCaseKw"),
55
- ]),
56
- // LOOP
57
- loop_stmt: (print) => group([
58
- print("loopKw"),
59
- indent([hardline, stripTrailingHardline(print("body"))]),
60
- hardline,
61
- print.spaced("endLoopKw"),
62
- ]),
63
- // REPEAT
64
- repeat_stmt: (print) => group([
65
- print("repeatKw"),
66
- indent([hardline, stripTrailingHardline(print("body"))]),
67
- hardline,
68
- print.spaced(["untilKw", "condition", "endRepeatKw"]),
69
- ]),
70
- // WHILE
71
- while_stmt: (print) => group([
72
- print.spaced(["whileKw", "condition", "doKw"]),
73
- indent([hardline, stripTrailingHardline(print("body"))]),
74
- hardline,
75
- print.spaced("endWhileKw"),
76
- ]),
77
- // FOR .. IN
78
- for_stmt: (print) => group([
79
- print.spaced(["forKw", "left", "inKw", "right", "doKw"]),
80
- indent([hardline, stripTrailingHardline(print("body"))]),
81
- hardline,
82
- print.spaced("endForKw"),
83
- ]),
84
- // BREAK/CONTINUE
85
- break_stmt: (print) => group(print.spaced(["breakKw", "label"])),
86
- continue_stmt: (print) => group(print.spaced(["continueKw", "label"])),
87
- labeled_stmt: (print, node) => group([
88
- print("beginLabel"),
89
- ": ",
90
- print("statement"),
91
- node.endLabel ? [" ", print(["endLabel"])] : [],
92
- ]),
93
- // CALL
94
- call_stmt: (print) => group(print.spaced(["callKw", "func"])),
95
- // RETURN
96
- return_stmt: (print) => group(print.spaced(["returnKw", "expr"])),
97
- // RAISE
98
- raise_stmt: (print) => group(print.spaced(["raiseKw", "message"])),
99
- raise_message: (print) => [
100
- print.spaced("usingMessageKw"),
101
- " = ",
102
- print("string"),
103
- ],
104
- };
@@ -1,3 +0,0 @@
1
- import { AllProcedureNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const procedureMap: CstToDocMap<AllProcedureNodes>;
@@ -1,38 +0,0 @@
1
- import { group, hardline, join } from "../print_utils";
2
- import { hasOnlyAsClause } from "./function";
3
- export const procedureMap = {
4
- create_procedure_stmt: (print, node) => group([
5
- print.spaced([
6
- "createKw",
7
- "orReplaceKw",
8
- "procedureKw",
9
- "ifNotExistsKw",
10
- "name",
11
- ]),
12
- print("params"),
13
- hasOnlyAsClause(node)
14
- ? [" ", group(print("clauses"))]
15
- : [
16
- hardline,
17
- join(hardline, print("clauses").map((clause) => group(clause))),
18
- ],
19
- ]),
20
- drop_procedure_stmt: (print) => group([
21
- print.spaced([
22
- "dropKw",
23
- "procedureKw",
24
- "ifExistsKw",
25
- "signatures",
26
- "behaviorKw",
27
- ]),
28
- ]),
29
- // almost exact copy of alter_function_stmt
30
- alter_procedure_stmt: (print, node) => group([
31
- print.spaced(["alterKw", "procedureKw"]),
32
- " ",
33
- print(["signature"]),
34
- print.dynamicLine(),
35
- join(print.dynamicLine(), print("actions")),
36
- node.behaviorKw ? [print.dynamicLine(), print("behaviorKw")] : [],
37
- ]),
38
- };
@@ -1,3 +0,0 @@
1
- import { Program } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const programMap: CstToDocMap<Program>;
@@ -1,39 +0,0 @@
1
- import { hardline, hasEmptyLineBetweenNodes } from "../print_utils";
2
- export const programMap = {
3
- program: (print, node, path, options) => print("statements").map((doc, i) => i === node.statements.length - 1
4
- ? printFinalStatement(doc, i, node.statements, options)
5
- : printStatement(doc, i, node.statements, options)),
6
- };
7
- const printStatement = (doc, i, statements, options) => {
8
- const prevNode = statements[i - 1];
9
- const node = statements[i];
10
- if (i === 0) {
11
- return doc;
12
- }
13
- else if (node.type !== "empty") {
14
- if (hasEmptyLineBetweenNodes(prevNode, node, options)) {
15
- return [";", hardline, hardline, doc];
16
- }
17
- else {
18
- return [";", hardline, doc];
19
- }
20
- }
21
- else {
22
- return [";", hardline, doc];
23
- }
24
- };
25
- const printFinalStatement = (doc, i, statements, options) => {
26
- const stmtDoc = printStatement(doc, i, statements, options);
27
- if (statements[i].type === "empty") {
28
- // When the final statement is an empty statement,
29
- // this means we have inserted a semicolon and newline before it.
30
- // So nothing else is needed.
31
- return stmtDoc;
32
- }
33
- else {
34
- // If the last statement is not empty,
35
- // this means sqlFinalSemicolon option is false,
36
- // so we need to add an empty line after it.
37
- return [stmtDoc, hardline];
38
- }
39
- };
@@ -1,3 +0,0 @@
1
- import { AllPublicationNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const publicationMap: CstToDocMap<AllPublicationNodes>;
@@ -1,27 +0,0 @@
1
- import { group, indent, line } from "../print_utils";
2
- export const publicationMap = {
3
- create_publication_stmt: (print, node) => group([
4
- print.spaced(["createPublicationKw", "name"]),
5
- print("clauses").map((printedClause, i) => {
6
- if (node.clauses[i].type === "for_publication_objects_clause") {
7
- return [" ", printedClause];
8
- }
9
- else {
10
- return [line, printedClause];
11
- }
12
- }),
13
- ]),
14
- for_publication_objects_clause: (print) => group([print("forKw"), indent([line, print("publicationObjects")])]),
15
- all_publication_object: (print) => group(print.spaced(["allKw", "typesKw"])),
16
- publication_object_table: (print) => group(print.spaced(["tableKw", "table", "columns", "where"])),
17
- publication_object_tables_in_schema: (print) => group(print.spaced(["tablesInSchemaKw", "schema"])),
18
- alter_publication_stmt: (print) => group([
19
- print.spaced(["alterPublicationKw", "name"]),
20
- print.dynamicLine(),
21
- print("action"),
22
- ]),
23
- alter_action_add_publication_objects: (print) => group([print("addKw"), indent([line, print("publicationObjects")])]),
24
- alter_action_set_publication_objects: (print) => group([print("setKw"), indent([line, print("publicationObjects")])]),
25
- alter_action_drop_publication_objects: (print) => group([print("dropKw"), indent([line, print("publicationObjects")])]),
26
- drop_publication_stmt: (print) => group(print.spaced(["dropPublicationKw", "ifExistsKw", "names", "behaviorKw"])),
27
- };
@@ -1,3 +0,0 @@
1
- import { AllRenameTableNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const renameTableMap: CstToDocMap<AllRenameTableNodes>;
@@ -1,8 +0,0 @@
1
- import { group, indent, line } from "../print_utils";
2
- export const renameTableMap = {
3
- rename_table_stmt: (print) => group([
4
- print.spaced(["renameKw", "tableKw"]),
5
- indent([line, print("actions")]),
6
- ]),
7
- rename_action: (print) => print.spaced(["from", "toKw", "to"]),
8
- };
@@ -1,3 +0,0 @@
1
- import { AllRoleNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const roleMap: CstToDocMap<AllRoleNodes>;
@@ -1,31 +0,0 @@
1
- import { group, indent, join, line } from "../print_utils";
2
- export const roleMap = {
3
- create_role_stmt: (print, node) => group([
4
- print.spaced(["createRoleKw", "name", "withKw"]),
5
- ...(node.options?.length
6
- ? [indent([line, join(print.dynamicLine(), print("options"))])]
7
- : []),
8
- ]),
9
- alter_role_stmt: (print, node) => group([
10
- join(print.dynamicLine(), [
11
- group([print.spaced("alterRoleKw"), indent([line, print("name")])]),
12
- ...(node.database ? print(["database"]) : []),
13
- ]),
14
- node.action.type === "alter_action_with_role_options" &&
15
- !node.action.withKw
16
- ? indent([print.dynamicLine(), print("action")])
17
- : [print.dynamicLine(), print("action")],
18
- ]),
19
- drop_role_stmt: (print) => group(print.spaced(["dropRoleKw", "ifExistsKw", "names"])),
20
- set_role_stmt: (print) => group(print.spaced(["setKw", "scopeKw", "roleKw", "name"])),
21
- reset_role_stmt: (print) => group(print.spaced("resetRoleKw")),
22
- role_option_keyword: (print) => print("kw"),
23
- role_option_connection_limit: (print) => group(print.spaced(["connectionLimitKw", "limit"])),
24
- role_option_password: (print) => group(print.spaced(["encryptedKw", "passwordKw", "password"])),
25
- role_option_valid_until: (print) => group(print.spaced(["validUntilKw", "timestamp"])),
26
- role_option_in_role: (print) => group(print.spaced(["inRoleKw", "names"])),
27
- role_option_role: (print) => group(print.spaced(["roleKw", "names"])),
28
- role_option_admin: (print) => group(print.spaced(["adminKw", "names"])),
29
- role_option_sysid: (print) => group(print.spaced(["sysIdKw", "sysId"])),
30
- in_database_clause: (print) => group(print.spaced(["inDatabaseKw", "name"])),
31
- };
@@ -1,3 +0,0 @@
1
- import { AllSchemaStatements } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const schemaMap: CstToDocMap<AllSchemaStatements>;
@@ -1,18 +0,0 @@
1
- import { group, hardline, indent, join } from "../print_utils";
2
- export const schemaMap = {
3
- create_schema_stmt: (print, node) => group([
4
- group(join(print.dynamicLine(), [
5
- print.spaced(["createSchemaKw", "ifNotExistsKw", "name"]),
6
- ...print("clauses"),
7
- ])),
8
- node.statements.length > 0
9
- ? indent([hardline, join(hardline, print("statements"))])
10
- : [],
11
- ]),
12
- create_schema_authorization_clause: (print) => print.spaced(["authorizationKw", "role"]),
13
- drop_schema_stmt: (print) => group(print.spaced(["dropSchemaKw", "ifExistsKw", "schemas", "behaviorKw"])),
14
- alter_schema_stmt: (print) => group(join(print.dynamicLine(), [
15
- print.spaced(["alterSchemaKw", "ifExistsKw", "name"]),
16
- ...print("actions"),
17
- ])),
18
- };
@@ -1,3 +0,0 @@
1
- import { AllSelectNodes } from "sql-parser-cst";
2
- import { CstToDocMap } from "../CstToDocMap";
3
- export declare const selectMap: CstToDocMap<AllSelectNodes>;