prettier-plugin-sql-cst 0.19.2 → 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.
- package/dist/index.d.ts +21 -7
- package/dist/index.js +2637 -55
- package/package.json +3 -2
- package/dist/CstToDocMap.d.ts +0 -11
- package/dist/CstToDocMap.js +0 -1
- package/dist/PrintFn.d.ts +0 -17
- package/dist/PrintFn.js +0 -1
- package/dist/embed.d.ts +0 -3
- package/dist/embed.js +0 -6
- package/dist/embedJs.d.ts +0 -3
- package/dist/embedJs.js +0 -43
- package/dist/embedJson.d.ts +0 -3
- package/dist/embedJson.js +0 -34
- package/dist/embedSql.d.ts +0 -3
- package/dist/embedSql.js +0 -39
- package/dist/node_utils.d.ts +0 -38
- package/dist/node_utils.js +0 -44
- package/dist/options.d.ts +0 -15
- package/dist/options.js +0 -147
- package/dist/printComment.d.ts +0 -3
- package/dist/printComment.js +0 -12
- package/dist/printSql.d.ts +0 -5
- package/dist/printSql.js +0 -61
- package/dist/print_utils.d.ts +0 -13
- package/dist/print_utils.js +0 -49
- package/dist/syntax/alias.d.ts +0 -3
- package/dist/syntax/alias.js +0 -3
- package/dist/syntax/alter_action.d.ts +0 -3
- package/dist/syntax/alter_action.js +0 -120
- package/dist/syntax/alter_table.d.ts +0 -3
- package/dist/syntax/alter_table.js +0 -19
- package/dist/syntax/analyze.d.ts +0 -3
- package/dist/syntax/analyze.js +0 -4
- package/dist/syntax/base.d.ts +0 -3
- package/dist/syntax/base.js +0 -19
- package/dist/syntax/cast.d.ts +0 -3
- package/dist/syntax/cast.js +0 -4
- package/dist/syntax/comment.d.ts +0 -3
- package/dist/syntax/comment.js +0 -54
- package/dist/syntax/constraint.d.ts +0 -6
- package/dist/syntax/constraint.js +0 -80
- package/dist/syntax/create_table.d.ts +0 -3
- package/dist/syntax/create_table.js +0 -69
- package/dist/syntax/data_type.d.ts +0 -3
- package/dist/syntax/data_type.js +0 -29
- package/dist/syntax/dcl.d.ts +0 -3
- package/dist/syntax/dcl.js +0 -83
- package/dist/syntax/delete.d.ts +0 -3
- package/dist/syntax/delete.js +0 -5
- package/dist/syntax/dialects/bigquery.d.ts +0 -3
- package/dist/syntax/dialects/bigquery.js +0 -84
- package/dist/syntax/dialects/mysql.d.ts +0 -3
- package/dist/syntax/dialects/mysql.js +0 -3
- package/dist/syntax/dialects/postgresql.d.ts +0 -3
- package/dist/syntax/dialects/postgresql.js +0 -9
- package/dist/syntax/dialects/sqlite.d.ts +0 -3
- package/dist/syntax/dialects/sqlite.js +0 -9
- package/dist/syntax/do.d.ts +0 -3
- package/dist/syntax/do.js +0 -4
- package/dist/syntax/domain.d.ts +0 -3
- package/dist/syntax/domain.js +0 -11
- package/dist/syntax/drop_table.d.ts +0 -3
- package/dist/syntax/drop_table.js +0 -11
- package/dist/syntax/explain.d.ts +0 -3
- package/dist/syntax/explain.js +0 -7
- package/dist/syntax/expr.d.ts +0 -5
- package/dist/syntax/expr.js +0 -224
- package/dist/syntax/extension.d.ts +0 -3
- package/dist/syntax/extension.js +0 -13
- package/dist/syntax/frame.d.ts +0 -3
- package/dist/syntax/frame.js +0 -13
- package/dist/syntax/function.d.ts +0 -4
- package/dist/syntax/function.js +0 -55
- package/dist/syntax/index.d.ts +0 -3
- package/dist/syntax/index.js +0 -60
- package/dist/syntax/insert.d.ts +0 -3
- package/dist/syntax/insert.js +0 -33
- package/dist/syntax/merge.d.ts +0 -3
- package/dist/syntax/merge.js +0 -30
- package/dist/syntax/other_clauses.d.ts +0 -3
- package/dist/syntax/other_clauses.js +0 -9
- package/dist/syntax/parameter.d.ts +0 -3
- package/dist/syntax/parameter.js +0 -18
- package/dist/syntax/policy.d.ts +0 -3
- package/dist/syntax/policy.js +0 -27
- package/dist/syntax/prepared_statements.d.ts +0 -3
- package/dist/syntax/prepared_statements.js +0 -31
- package/dist/syntax/proc_clause.d.ts +0 -3
- package/dist/syntax/proc_clause.js +0 -14
- package/dist/syntax/procedural_language.d.ts +0 -3
- package/dist/syntax/procedural_language.js +0 -104
- package/dist/syntax/procedure.d.ts +0 -3
- package/dist/syntax/procedure.js +0 -38
- package/dist/syntax/program.d.ts +0 -3
- package/dist/syntax/program.js +0 -39
- package/dist/syntax/publication.d.ts +0 -3
- package/dist/syntax/publication.js +0 -27
- package/dist/syntax/rename_table.d.ts +0 -3
- package/dist/syntax/rename_table.js +0 -8
- package/dist/syntax/role.d.ts +0 -3
- package/dist/syntax/role.js +0 -31
- package/dist/syntax/schema.d.ts +0 -3
- package/dist/syntax/schema.js +0 -18
- package/dist/syntax/select.d.ts +0 -3
- package/dist/syntax/select.js +0 -226
- package/dist/syntax/sequence.d.ts +0 -3
- package/dist/syntax/sequence.js +0 -36
- package/dist/syntax/subscription.d.ts +0 -3
- package/dist/syntax/subscription.js +0 -10
- package/dist/syntax/transaction.d.ts +0 -3
- package/dist/syntax/transaction.js +0 -19
- package/dist/syntax/transformMap.d.ts +0 -3
- package/dist/syntax/transformMap.js +0 -100
- package/dist/syntax/trigger.d.ts +0 -3
- package/dist/syntax/trigger.js +0 -52
- package/dist/syntax/truncate.d.ts +0 -3
- package/dist/syntax/truncate.js +0 -10
- package/dist/syntax/type.d.ts +0 -3
- package/dist/syntax/type.js +0 -12
- package/dist/syntax/unsupported_grammar.d.ts +0 -3
- package/dist/syntax/unsupported_grammar.js +0 -4
- package/dist/syntax/update.d.ts +0 -3
- package/dist/syntax/update.js +0 -14
- package/dist/syntax/view.d.ts +0 -3
- package/dist/syntax/view.js +0 -48
- package/dist/transform/addFinalSemicolon.d.ts +0 -2
- package/dist/transform/addFinalSemicolon.js +0 -9
- package/dist/transform/aliasAs.d.ts +0 -2
- package/dist/transform/aliasAs.js +0 -10
- package/dist/transform/canonicKeywords.d.ts +0 -2
- package/dist/transform/canonicKeywords.js +0 -62
- package/dist/transform/canonicOperators.d.ts +0 -3
- package/dist/transform/canonicOperators.js +0 -28
- package/dist/transform/comments.d.ts +0 -12
- package/dist/transform/comments.js +0 -22
- package/dist/transform/stripTrailingCommas.d.ts +0 -2
- package/dist/transform/stripTrailingCommas.js +0 -15
- package/dist/transform/transformCst.d.ts +0 -5
- package/dist/transform/transformCst.js +0 -21
- package/dist/transform/transformUtils.d.ts +0 -2
- package/dist/transform/transformUtils.js +0 -3
- package/dist/utils.d.ts +0 -9
- package/dist/utils.js +0 -9
- package/dist/visitAllNodes.d.ts +0 -2
- package/dist/visitAllNodes.js +0 -16
package/dist/syntax/merge.js
DELETED
|
@@ -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,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
|
-
};
|
package/dist/syntax/parameter.js
DELETED
|
@@ -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
|
-
};
|
package/dist/syntax/policy.d.ts
DELETED
package/dist/syntax/policy.js
DELETED
|
@@ -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,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,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,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
|
-
};
|
package/dist/syntax/procedure.js
DELETED
|
@@ -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
|
-
};
|
package/dist/syntax/program.d.ts
DELETED
package/dist/syntax/program.js
DELETED
|
@@ -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,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,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
|
-
};
|
package/dist/syntax/role.d.ts
DELETED
package/dist/syntax/role.js
DELETED
|
@@ -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
|
-
};
|
package/dist/syntax/schema.d.ts
DELETED
package/dist/syntax/schema.js
DELETED
|
@@ -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
|
-
};
|
package/dist/syntax/select.d.ts
DELETED