prettier-plugin-sql-cst 0.18.0 → 0.19.1

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 (76) hide show
  1. package/dist/CstToDocMap.d.ts +2 -2
  2. package/dist/CstToDocMap.js +1 -2
  3. package/dist/PrintFn.js +1 -2
  4. package/dist/embed.js +5 -13
  5. package/dist/embedJs.js +28 -84
  6. package/dist/embedJson.js +29 -85
  7. package/dist/embedSql.js +26 -76
  8. package/dist/index.js +28 -34
  9. package/dist/node_utils.d.ts +1 -0
  10. package/dist/node_utils.js +44 -54
  11. package/dist/options.js +1 -4
  12. package/dist/printComment.js +2 -6
  13. package/dist/printSql.js +29 -39
  14. package/dist/print_utils.js +19 -38
  15. package/dist/syntax/alias.js +2 -5
  16. package/dist/syntax/alter_action.js +115 -208
  17. package/dist/syntax/alter_table.js +18 -27
  18. package/dist/syntax/analyze.js +3 -8
  19. package/dist/syntax/base.js +6 -9
  20. package/dist/syntax/cast.js +3 -6
  21. package/dist/syntax/comment.js +53 -122
  22. package/dist/syntax/constraint.d.ts +1 -1
  23. package/dist/syntax/constraint.js +54 -90
  24. package/dist/syntax/create_table.js +49 -87
  25. package/dist/syntax/data_type.js +25 -44
  26. package/dist/syntax/dcl.js +78 -136
  27. package/dist/syntax/delete.js +4 -9
  28. package/dist/syntax/dialects/bigquery.js +70 -116
  29. package/dist/syntax/dialects/mysql.js +2 -5
  30. package/dist/syntax/dialects/postgresql.js +8 -13
  31. package/dist/syntax/dialects/sqlite.js +8 -17
  32. package/dist/syntax/do.js +3 -6
  33. package/dist/syntax/domain.js +10 -19
  34. package/dist/syntax/drop_table.js +10 -15
  35. package/dist/syntax/explain.js +6 -11
  36. package/dist/syntax/expr.js +124 -173
  37. package/dist/syntax/extension.js +12 -21
  38. package/dist/syntax/frame.js +11 -16
  39. package/dist/syntax/function.js +53 -63
  40. package/dist/syntax/index.js +54 -81
  41. package/dist/syntax/insert.js +32 -49
  42. package/dist/syntax/merge.js +25 -30
  43. package/dist/syntax/other_clauses.js +5 -14
  44. package/dist/syntax/parameter.js +13 -26
  45. package/dist/syntax/policy.js +26 -41
  46. package/dist/syntax/prepared_statements.js +23 -43
  47. package/dist/syntax/proc_clause.js +10 -15
  48. package/dist/syntax/procedural_language.js +80 -111
  49. package/dist/syntax/procedure.js +36 -40
  50. package/dist/syntax/program.js +15 -22
  51. package/dist/syntax/publication.js +26 -47
  52. package/dist/syntax/rename_table.js +7 -12
  53. package/dist/syntax/role.js +30 -55
  54. package/dist/syntax/schema.js +17 -35
  55. package/dist/syntax/select.js +157 -226
  56. package/dist/syntax/sequence.js +35 -52
  57. package/dist/syntax/subscription.js +9 -24
  58. package/dist/syntax/transaction.js +18 -33
  59. package/dist/syntax/transformMap.js +99 -63
  60. package/dist/syntax/trigger.js +48 -72
  61. package/dist/syntax/truncate.js +9 -14
  62. package/dist/syntax/type.js +11 -22
  63. package/dist/syntax/unsupported_grammar.js +3 -6
  64. package/dist/syntax/update.js +7 -14
  65. package/dist/syntax/view.js +32 -43
  66. package/dist/transform/addFinalSemicolon.js +5 -9
  67. package/dist/transform/aliasAs.js +4 -8
  68. package/dist/transform/canonicKeywords.js +16 -20
  69. package/dist/transform/canonicOperators.js +8 -12
  70. package/dist/transform/comments.js +10 -31
  71. package/dist/transform/stripTrailingCommas.js +7 -11
  72. package/dist/transform/transformCst.js +13 -17
  73. package/dist/transform/transformUtils.js +2 -6
  74. package/dist/utils.js +9 -30
  75. package/dist/visitAllNodes.js +8 -13
  76. package/package.json +9 -8
@@ -1,141 +1,83 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.dclMap = void 0;
13
- var print_utils_1 = require("../print_utils");
14
- exports.dclMap = {
15
- grant_privilege_stmt: function (print) {
16
- return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([
17
- (0, print_utils_1.group)([print("grantKw"), (0, print_utils_1.indent)([print_utils_1.line, print("privileges")])]),
18
- (0, print_utils_1.group)(print.spaced(["onKw", "resource"])),
19
- (0, print_utils_1.group)([print("toKw"), (0, print_utils_1.indent)([print_utils_1.line, print("roles")])])
20
- ], print("clauses"), true)));
21
- },
22
- grant_role_stmt: function (print) {
23
- return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([
24
- (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
25
- (0, print_utils_1.group)([print("grantKw"), (0, print_utils_1.indent)([print_utils_1.line, print("grantedRoles")])]),
26
- (0, print_utils_1.group)([print("toKw"), (0, print_utils_1.indent)([print_utils_1.line, print("granteeRoles")])]),
27
- ]))
28
- ], print("clauses"), true)));
29
- },
30
- revoke_privilege_stmt: function (print) {
31
- return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([
32
- (0, print_utils_1.group)([
1
+ import { group, indent, join, line } from "../print_utils";
2
+ export const dclMap = {
3
+ grant_privilege_stmt: (print) => group(join(print.dynamicLine(), [
4
+ group([print("grantKw"), indent([line, print("privileges")])]),
5
+ group(print.spaced(["onKw", "resource"])),
6
+ group([print("toKw"), indent([line, print("roles")])]),
7
+ ...print("clauses"),
8
+ ])),
9
+ grant_role_stmt: (print) => group(join(print.dynamicLine(), [
10
+ group(join(line, [
11
+ group([print("grantKw"), indent([line, print("grantedRoles")])]),
12
+ group([print("toKw"), indent([line, print("granteeRoles")])]),
13
+ ])),
14
+ ...print("clauses"),
15
+ ])),
16
+ revoke_privilege_stmt: (print) => group(join(print.dynamicLine(), [
17
+ group([
18
+ print.spaced(["revokeKw", "option"]),
19
+ indent([line, print("privileges")]),
20
+ ]),
21
+ group(print.spaced(["onKw", "resource"])),
22
+ group([print("fromKw"), indent([line, print("roles")])]),
23
+ ...print(["grantedBy", "behaviorKw"]),
24
+ ])),
25
+ revoke_role_stmt: (print) => group(join(print.dynamicLine(), [
26
+ group(join(line, [
27
+ group([
33
28
  print.spaced(["revokeKw", "option"]),
34
- (0, print_utils_1.indent)([print_utils_1.line, print("privileges")]),
29
+ indent([line, print("grantedRoles")]),
35
30
  ]),
36
- (0, print_utils_1.group)(print.spaced(["onKw", "resource"])),
37
- (0, print_utils_1.group)([print("fromKw"), (0, print_utils_1.indent)([print_utils_1.line, print("roles")])])
38
- ], print(["grantedBy", "behaviorKw"]), true)));
39
- },
40
- revoke_role_stmt: function (print) {
41
- return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([
42
- (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
43
- (0, print_utils_1.group)([
44
- print.spaced(["revokeKw", "option"]),
45
- (0, print_utils_1.indent)([print_utils_1.line, print("grantedRoles")]),
46
- ]),
47
- (0, print_utils_1.group)([print("fromKw"), (0, print_utils_1.indent)([print_utils_1.line, print("granteeRoles")])]),
48
- ]))
49
- ], print(["grantedBy", "behaviorKw"]), true)));
50
- },
51
- privilege: function (print) { return print.spaced(["privilegeKw", "columns"]); },
52
- all_privileges: function (print) { return print.spaced(["allKw", "privilegesKw", "columns"]); },
53
- grant_resource_table: function (print) { return (0, print_utils_1.group)(print.spaced(["tableKw", "tables"])); },
54
- grant_resource_view: function (print) { return (0, print_utils_1.group)(print.spaced(["viewKw", "views"])); },
55
- grant_resource_schema: function (print) {
56
- return (0, print_utils_1.group)(print.spaced(["schemaKw", "schemas"]));
57
- },
58
- grant_resource_sequence: function (print) {
59
- return (0, print_utils_1.group)(print.spaced(["sequenceKw", "sequences"]));
60
- },
61
- grant_resource_database: function (print) {
62
- return (0, print_utils_1.group)(print.spaced(["databaseKw", "databases"]));
63
- },
64
- grant_resource_domain: function (print) {
65
- return (0, print_utils_1.group)(print.spaced(["domainKw", "domains"]));
66
- },
67
- grant_resource_foreign_data_wrapper: function (print) {
68
- return (0, print_utils_1.group)(print.spaced(["foreignDataWrapperKw", "dataWrappers"]));
69
- },
70
- grant_resource_foreign_server: function (print) {
71
- return (0, print_utils_1.group)(print.spaced(["foreignServerKw", "servers"]));
72
- },
73
- grant_resource_function: function (print) {
74
- return (0, print_utils_1.group)(print.spaced(["functionKw", "functions"]));
75
- },
76
- grant_resource_language: function (print) {
77
- return (0, print_utils_1.group)(print.spaced(["languageKw", "languages"]));
78
- },
79
- grant_resource_large_object: function (print) {
80
- return (0, print_utils_1.group)(print.spaced(["largeObjectKw", "oids"]));
81
- },
82
- grant_resource_postgresql_option: function (print) {
83
- return (0, print_utils_1.group)(print.spaced(["parameterKw", "options"]));
84
- },
85
- grant_resource_tablespace: function (print) {
86
- return (0, print_utils_1.group)(print.spaced(["tablespaceKw", "tablespaces"]));
87
- },
88
- grant_resource_type: function (print) { return (0, print_utils_1.group)(print.spaced(["typeKw", "types"])); },
89
- grant_resource_all_tables_in_schema: function (print) {
90
- return (0, print_utils_1.group)(print.spaced(["allTablesInSchemaKw", "schemas"]));
91
- },
92
- grant_resource_all_sequences_in_schema: function (print) {
93
- return (0, print_utils_1.group)(print.spaced(["allSequencesInSchemaKw", "schemas"]));
94
- },
95
- grant_resource_all_functions_in_schema: function (print) {
96
- return (0, print_utils_1.group)(print.spaced(["allFunctionsInSchemaKw", "schemas"]));
97
- },
98
- with_grant_option_clause: function (print) {
99
- return (0, print_utils_1.group)(print.spaced(["withKw", "nameKw", "value"]));
100
- },
101
- grant_option_for_clause: function (print) {
102
- return (0, print_utils_1.group)(print.spaced(["nameKw", "optionForKw"]));
103
- },
104
- granted_by_clause: function (print) { return (0, print_utils_1.group)(print.spaced(["grantedByKw", "role"])); },
105
- grantee_public: function (print) { return print("publicKw"); },
106
- grantee_group: function (print) { return (0, print_utils_1.group)(print.spaced(["groupKw", "name"])); },
107
- alter_default_privileges_stmt: function (print) {
108
- return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray(__spreadArray([
109
- print.spaced("alterDefaultPrivilegesKw")
110
- ], print("clauses"), true), [
111
- print("action"),
112
- ], false)));
113
- },
114
- default_acl_for_role_clause: function (print) {
115
- return (0, print_utils_1.group)(print.spaced(["forKw", "roleKw", "roles"]));
116
- },
117
- default_acl_in_schema_clause: function (print) {
118
- return (0, print_utils_1.group)(print.spaced(["inKw", "schemaKw", "schemas"]));
119
- },
120
- grant_default_privileges_action: function (print) {
121
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
122
- (0, print_utils_1.group)(print.spaced(["grantKw", "privileges", "onKw", "resourcesKw"])),
123
- (0, print_utils_1.group)(print.spaced(["toKw", "roles", "withGrantOption"])),
124
- ]));
125
- },
126
- revoke_default_privileges_action: function (print) {
127
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.line, [
128
- (0, print_utils_1.group)([
129
- print.spaced(["revokeKw", "grantOptionFor"]),
130
- (0, print_utils_1.indent)([
131
- print_utils_1.line,
132
- (0, print_utils_1.join)(print_utils_1.line, [
133
- (0, print_utils_1.group)(print("privileges")),
134
- print.spaced(["onKw", "resourcesKw"]),
135
- ]),
31
+ group([print("fromKw"), indent([line, print("granteeRoles")])]),
32
+ ])),
33
+ ...print(["grantedBy", "behaviorKw"]),
34
+ ])),
35
+ privilege: (print) => print.spaced(["privilegeKw", "columns"]),
36
+ all_privileges: (print) => print.spaced(["allKw", "privilegesKw", "columns"]),
37
+ grant_resource_table: (print) => group(print.spaced(["tableKw", "tables"])),
38
+ grant_resource_view: (print) => group(print.spaced(["viewKw", "views"])),
39
+ grant_resource_schema: (print) => group(print.spaced(["schemaKw", "schemas"])),
40
+ grant_resource_sequence: (print) => group(print.spaced(["sequenceKw", "sequences"])),
41
+ grant_resource_database: (print) => group(print.spaced(["databaseKw", "databases"])),
42
+ grant_resource_domain: (print) => group(print.spaced(["domainKw", "domains"])),
43
+ grant_resource_foreign_data_wrapper: (print) => group(print.spaced(["foreignDataWrapperKw", "dataWrappers"])),
44
+ grant_resource_foreign_server: (print) => group(print.spaced(["foreignServerKw", "servers"])),
45
+ grant_resource_function: (print) => group(print.spaced(["functionKw", "functions"])),
46
+ grant_resource_language: (print) => group(print.spaced(["languageKw", "languages"])),
47
+ grant_resource_large_object: (print) => group(print.spaced(["largeObjectKw", "oids"])),
48
+ grant_resource_postgresql_option: (print) => group(print.spaced(["parameterKw", "options"])),
49
+ grant_resource_tablespace: (print) => group(print.spaced(["tablespaceKw", "tablespaces"])),
50
+ grant_resource_type: (print) => group(print.spaced(["typeKw", "types"])),
51
+ grant_resource_all_tables_in_schema: (print) => group(print.spaced(["allTablesInSchemaKw", "schemas"])),
52
+ grant_resource_all_sequences_in_schema: (print) => group(print.spaced(["allSequencesInSchemaKw", "schemas"])),
53
+ grant_resource_all_functions_in_schema: (print) => group(print.spaced(["allFunctionsInSchemaKw", "schemas"])),
54
+ with_grant_option_clause: (print) => group(print.spaced(["withKw", "nameKw", "value"])),
55
+ grant_option_for_clause: (print) => group(print.spaced(["nameKw", "optionForKw"])),
56
+ granted_by_clause: (print) => group(print.spaced(["grantedByKw", "role"])),
57
+ grantee_public: (print) => print("publicKw"),
58
+ grantee_group: (print) => group(print.spaced(["groupKw", "name"])),
59
+ alter_default_privileges_stmt: (print) => group(join(print.dynamicLine(), [
60
+ print.spaced("alterDefaultPrivilegesKw"),
61
+ ...print("clauses"),
62
+ print("action"),
63
+ ])),
64
+ default_acl_for_role_clause: (print) => group(print.spaced(["forKw", "roleKw", "roles"])),
65
+ default_acl_in_schema_clause: (print) => group(print.spaced(["inKw", "schemaKw", "schemas"])),
66
+ grant_default_privileges_action: (print) => group(join(line, [
67
+ group(print.spaced(["grantKw", "privileges", "onKw", "resourcesKw"])),
68
+ group(print.spaced(["toKw", "roles", "withGrantOption"])),
69
+ ])),
70
+ revoke_default_privileges_action: (print) => group(join(line, [
71
+ group([
72
+ print.spaced(["revokeKw", "grantOptionFor"]),
73
+ indent([
74
+ line,
75
+ join(line, [
76
+ group(print("privileges")),
77
+ print.spaced(["onKw", "resourcesKw"]),
136
78
  ]),
137
79
  ]),
138
- (0, print_utils_1.group)(print.spaced(["fromKw", "roles", "behaviorKw"])),
139
- ]));
140
- },
80
+ ]),
81
+ group(print.spaced(["fromKw", "roles", "behaviorKw"])),
82
+ ])),
141
83
  };
@@ -1,10 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deleteMap = void 0;
4
- var print_utils_1 = require("../print_utils");
5
- exports.deleteMap = {
6
- delete_stmt: function (print) { return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), print("clauses"))); },
7
- delete_clause: function (print) {
8
- return print.spaced(["deleteKw", "modifiers", "fromKw", "tables"]);
9
- },
1
+ import { group, join } from "../print_utils";
2
+ export const deleteMap = {
3
+ delete_stmt: (print) => group(join(print.dynamicLine(), print("clauses"))),
4
+ delete_clause: (print) => print.spaced(["deleteKw", "modifiers", "fromKw", "tables"]),
10
5
  };
@@ -1,130 +1,84 @@
1
- "use strict";
2
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
- if (ar || !(i in from)) {
5
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
- ar[i] = from[i];
7
- }
8
- }
9
- return to.concat(ar || Array.prototype.slice.call(from));
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.bigqueryMap = void 0;
13
- var print_utils_1 = require("../../print_utils");
14
- exports.bigqueryMap = {
15
- bigquery_options: function (print) { return print.spaced(["optionsKw", "options"]); },
16
- bigquery_option_default_collate: function (print) {
17
- return print.spaced(["defaultCollateKw", "collation"]);
18
- },
1
+ import { group, hardline, join } from "../../print_utils";
2
+ export const bigqueryMap = {
3
+ bigquery_options: (print) => print.spaced(["optionsKw", "options"]),
4
+ bigquery_option_default_collate: (print) => print.spaced(["defaultCollateKw", "collation"]),
19
5
  // ROW ACCESS POLICY
20
- create_row_access_policy_stmt: function (print) {
21
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, __spreadArray([
22
- print.spaced([
23
- "createKw",
24
- "orReplaceKw",
25
- "rowAccessPolicyKw",
26
- "ifNotExistsKw",
27
- "name",
28
- "onKw",
29
- "table",
30
- ])
31
- ], print("clauses"), true)));
32
- },
33
- row_access_policy_grant_clause: function (print) {
34
- return print.spaced(["grantToKw", "grantees"]);
35
- },
36
- row_access_policy_filter_clause: function (print) {
37
- return print.spaced(["filterUsingKw", "expr"]);
38
- },
39
- drop_row_access_policy_stmt: function (print) {
40
- return (0, print_utils_1.group)(print.spaced([
41
- "dropKw",
42
- "allKw",
6
+ create_row_access_policy_stmt: (print) => group(join(hardline, [
7
+ print.spaced([
8
+ "createKw",
9
+ "orReplaceKw",
43
10
  "rowAccessPolicyKw",
44
- "ifExistsKw",
11
+ "ifNotExistsKw",
45
12
  "name",
46
13
  "onKw",
47
14
  "table",
48
- ]));
49
- },
15
+ ]),
16
+ ...print("clauses"),
17
+ ])),
18
+ row_access_policy_grant_clause: (print) => print.spaced(["grantToKw", "grantees"]),
19
+ row_access_policy_filter_clause: (print) => print.spaced(["filterUsingKw", "expr"]),
20
+ drop_row_access_policy_stmt: (print) => group(print.spaced([
21
+ "dropKw",
22
+ "allKw",
23
+ "rowAccessPolicyKw",
24
+ "ifExistsKw",
25
+ "name",
26
+ "onKw",
27
+ "table",
28
+ ])),
50
29
  // CAPACITY
51
- create_capacity_stmt: function (print) {
52
- return (0, print_utils_1.group)([
53
- print.spaced(["createKw", "capacityKw", "name"]),
54
- print_utils_1.hardline,
55
- print("options"),
56
- ]);
57
- },
58
- drop_capacity_stmt: function (print) {
59
- return (0, print_utils_1.group)(print.spaced(["dropKw", "capacityKw", "ifExistsKw", "name"]));
60
- },
30
+ create_capacity_stmt: (print) => group([
31
+ print.spaced(["createKw", "capacityKw", "name"]),
32
+ hardline,
33
+ print("options"),
34
+ ]),
35
+ drop_capacity_stmt: (print) => group(print.spaced(["dropKw", "capacityKw", "ifExistsKw", "name"])),
61
36
  // RESERVATION
62
- create_reservation_stmt: function (print) {
63
- return (0, print_utils_1.group)([
64
- print.spaced(["createKw", "reservationKw", "name"]),
65
- print_utils_1.hardline,
66
- print("options"),
67
- ]);
68
- },
69
- drop_reservation_stmt: function (print) {
70
- return (0, print_utils_1.group)(print.spaced(["dropKw", "reservationKw", "ifExistsKw", "name"]));
71
- },
37
+ create_reservation_stmt: (print) => group([
38
+ print.spaced(["createKw", "reservationKw", "name"]),
39
+ hardline,
40
+ print("options"),
41
+ ]),
42
+ drop_reservation_stmt: (print) => group(print.spaced(["dropKw", "reservationKw", "ifExistsKw", "name"])),
72
43
  // ASSIGNMENT
73
- create_assignment_stmt: function (print) {
74
- return (0, print_utils_1.group)([
75
- print.spaced(["createKw", "assignmentKw", "name"]),
76
- print_utils_1.hardline,
77
- print("options"),
78
- ]);
79
- },
80
- drop_assignment_stmt: function (print) {
81
- return (0, print_utils_1.group)(print.spaced(["dropKw", "assignmentKw", "ifExistsKw", "name"]));
82
- },
44
+ create_assignment_stmt: (print) => group([
45
+ print.spaced(["createKw", "assignmentKw", "name"]),
46
+ hardline,
47
+ print("options"),
48
+ ]),
49
+ drop_assignment_stmt: (print) => group(print.spaced(["dropKw", "assignmentKw", "ifExistsKw", "name"])),
83
50
  // ALTER ORGANIZATION
84
- alter_organization_stmt: function (print) {
85
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, [print.spaced("alterOrganizationKw"), print("actions")]));
86
- },
51
+ alter_organization_stmt: (print) => group(join(hardline, [print.spaced("alterOrganizationKw"), print("actions")])),
87
52
  // ALTER PROJECT
88
- alter_project_stmt: function (print) {
89
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, [
90
- print.spaced(["alterProjectKw", "name"]),
91
- print("actions"),
92
- ]));
93
- },
94
- alter_bi_capacity_stmt: function (print) {
95
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, [
96
- print.spaced(["alterBiCapacityKw", "name"]),
97
- print("actions"),
98
- ]));
99
- },
100
- alter_capacity_stmt: function (print) {
101
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, [
102
- print.spaced(["alterCapacityKw", "name"]),
103
- print("actions"),
104
- ]));
105
- },
106
- alter_reservation_stmt: function (print) {
107
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, [
108
- print.spaced(["alterReservationKw", "name"]),
109
- print("actions"),
110
- ]));
111
- },
53
+ alter_project_stmt: (print) => group(join(hardline, [
54
+ print.spaced(["alterProjectKw", "name"]),
55
+ print("actions"),
56
+ ])),
57
+ alter_bi_capacity_stmt: (print) => group(join(hardline, [
58
+ print.spaced(["alterBiCapacityKw", "name"]),
59
+ print("actions"),
60
+ ])),
61
+ alter_capacity_stmt: (print) => group(join(hardline, [
62
+ print.spaced(["alterCapacityKw", "name"]),
63
+ print("actions"),
64
+ ])),
65
+ alter_reservation_stmt: (print) => group(join(hardline, [
66
+ print.spaced(["alterReservationKw", "name"]),
67
+ print("actions"),
68
+ ])),
112
69
  // ASSERT
113
- assert_stmt: function (print) { return (0, print_utils_1.group)(print.spaced(["assertKw", "expr", "as"])); },
70
+ assert_stmt: (print) => group(print.spaced(["assertKw", "expr", "as"])),
114
71
  // EXPORT
115
- export_data_stmt: function (print) {
116
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, __spreadArray(__spreadArray([
117
- print.spaced("exportDataKw")
118
- ], print.spaced(["withConnection"]), true), [
119
- print.spaced("options"),
120
- print.spaced("as"),
121
- ], false)));
122
- },
72
+ export_data_stmt: (print) => group(join(hardline, [
73
+ print.spaced("exportDataKw"),
74
+ ...print.spaced(["withConnection"]),
75
+ print.spaced("options"),
76
+ print.spaced("as"),
77
+ ])),
123
78
  // LOAD
124
- load_data_stmt: function (print) {
125
- return (0, print_utils_1.group)((0, print_utils_1.join)(print_utils_1.hardline, __spreadArray([
126
- print.spaced(["loadDataKw", "intoKw", "table", "columns"])
127
- ], print("clauses"), true)));
128
- },
129
- from_files_options: function (print) { return print.spaced(["fromFilesKw", "options"]); },
79
+ load_data_stmt: (print) => group(join(hardline, [
80
+ print.spaced(["loadDataKw", "intoKw", "table", "columns"]),
81
+ ...print("clauses"),
82
+ ])),
83
+ from_files_options: (print) => print.spaced(["fromFilesKw", "options"]),
130
84
  };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mysqlMap = void 0;
4
- exports.mysqlMap = {
5
- mysql_modifier: function (print) { return print.spaced("modifierKw"); },
1
+ export const mysqlMap = {
2
+ mysql_modifier: (print) => print.spaced("modifierKw"),
6
3
  };
@@ -1,14 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.postgresqlMap = void 0;
4
- var print_utils_1 = require("../../print_utils");
5
- exports.postgresqlMap = {
6
- postgresql_operator_expr: function (print) { return print(["operatorKw", "expr"]); },
7
- postgresql_operator: function (print) { return print("operator"); },
8
- postgresql_operator_class: function (print) { return print.spaced(["name", "options"]); },
9
- postgresql_with_options: function (print) {
10
- return (0, print_utils_1.group)(print.spaced(["withKw", "options"]));
11
- },
12
- postgresql_options: function (print) { return print.spaced(["optionsKw", "options"]); },
13
- postgresql_option_element: function (print) { return print.spaced(["name", "value"]); },
1
+ import { group } from "../../print_utils";
2
+ export const postgresqlMap = {
3
+ postgresql_operator_expr: (print) => print(["operatorKw", "expr"]),
4
+ postgresql_operator: (print) => print("operator"),
5
+ postgresql_operator_class: (print) => print.spaced(["name", "options"]),
6
+ postgresql_with_options: (print) => group(print.spaced(["withKw", "options"])),
7
+ postgresql_options: (print) => print.spaced(["optionsKw", "options"]),
8
+ postgresql_option_element: (print) => print.spaced(["name", "value"]),
14
9
  };
@@ -1,18 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sqliteMap = void 0;
4
- var print_utils_1 = require("../../print_utils");
5
- exports.sqliteMap = {
6
- attach_database_stmt: function (print) {
7
- return (0, print_utils_1.group)(print.spaced(["attachKw", "databaseKw", "file", "asKw", "schema"]));
8
- },
9
- detach_database_stmt: function (print) {
10
- return (0, print_utils_1.group)(print.spaced(["detachKw", "databaseKw", "schema"]));
11
- },
12
- vacuum_stmt: function (print) {
13
- return (0, print_utils_1.group)(print.spaced(["vacuumKw", "schema", "intoKw", "file"]));
14
- },
15
- pragma_stmt: function (print) { return (0, print_utils_1.group)(print.spaced(["pragmaKw", "pragma"])); },
16
- pragma_assignment: function (print) { return (0, print_utils_1.join)(" = ", print(["name", "value"])); },
17
- pragma_func_call: function (print) { return print(["name", "args"]); },
1
+ import { group, join } from "../../print_utils";
2
+ export const sqliteMap = {
3
+ attach_database_stmt: (print) => group(print.spaced(["attachKw", "databaseKw", "file", "asKw", "schema"])),
4
+ detach_database_stmt: (print) => group(print.spaced(["detachKw", "databaseKw", "schema"])),
5
+ vacuum_stmt: (print) => group(print.spaced(["vacuumKw", "schema", "intoKw", "file"])),
6
+ pragma_stmt: (print) => group(print.spaced(["pragmaKw", "pragma"])),
7
+ pragma_assignment: (print) => join(" = ", print(["name", "value"])),
8
+ pragma_func_call: (print) => print(["name", "args"]),
18
9
  };
package/dist/syntax/do.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.doMap = void 0;
4
- var print_utils_1 = require("../print_utils");
5
- exports.doMap = {
6
- do_stmt: function (print) { return (0, print_utils_1.group)(print.spaced(["doKw", "language", "body"])); },
1
+ import { group } from "../print_utils";
2
+ export const doMap = {
3
+ do_stmt: (print) => group(print.spaced(["doKw", "language", "body"])),
7
4
  };
@@ -1,20 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.domainMap = void 0;
4
- var print_utils_1 = require("../print_utils");
5
- exports.domainMap = {
6
- create_domain_stmt: function (print, node) {
7
- return (0, print_utils_1.group)([
8
- print.spaced(["createDomainKw", "name", "asKw", "dataType"]),
9
- node.constraints.length > 0
10
- ? (0, print_utils_1.indent)([print.dynamicLine(), (0, print_utils_1.join)(print_utils_1.line, print("constraints"))])
11
- : [],
12
- ]);
13
- },
14
- alter_domain_stmt: function (print) {
15
- return (0, print_utils_1.group)(print.spaced(["alterDomainKw", "name", "action"]));
16
- },
17
- drop_domain_stmt: function (print) {
18
- return (0, print_utils_1.group)(print.spaced(["dropDomainKw", "ifExistsKw", "domains", "behaviorKw"]));
19
- },
1
+ import { group, line, indent, join } from "../print_utils";
2
+ export const domainMap = {
3
+ create_domain_stmt: (print, node) => group([
4
+ print.spaced(["createDomainKw", "name", "asKw", "dataType"]),
5
+ node.constraints.length > 0
6
+ ? indent([print.dynamicLine(), join(line, print("constraints"))])
7
+ : [],
8
+ ]),
9
+ alter_domain_stmt: (print) => group(print.spaced(["alterDomainKw", "name", "action"])),
10
+ drop_domain_stmt: (print) => group(print.spaced(["dropDomainKw", "ifExistsKw", "domains", "behaviorKw"])),
20
11
  };
@@ -1,16 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dropTableMap = void 0;
4
- var print_utils_1 = require("../print_utils");
5
- exports.dropTableMap = {
6
- drop_table_stmt: function (print) {
7
- return (0, print_utils_1.group)(print.spaced([
8
- "dropKw",
9
- "kind",
10
- "tableKw",
11
- "ifExistsKw",
12
- "tables",
13
- "behaviorKw",
14
- ]));
15
- },
1
+ import { group } from "../print_utils";
2
+ export const dropTableMap = {
3
+ drop_table_stmt: (print) => group(print.spaced([
4
+ "dropKw",
5
+ "kind",
6
+ "tableKw",
7
+ "ifExistsKw",
8
+ "tables",
9
+ "behaviorKw",
10
+ ])),
16
11
  };
@@ -1,12 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.explainMap = void 0;
4
- var print_utils_1 = require("../print_utils");
5
- exports.explainMap = {
6
- explain_stmt: function (print) {
7
- return (0, print_utils_1.group)([
8
- print.spaced(["explainKw", "analyzeKw", "queryPlanKw"]),
9
- (0, print_utils_1.indent)([print_utils_1.line, print("statement")]),
10
- ]);
11
- },
1
+ import { group, indent, line } from "../print_utils";
2
+ export const explainMap = {
3
+ explain_stmt: (print) => group([
4
+ print.spaced(["explainKw", "analyzeKw", "queryPlanKw"]),
5
+ indent([line, print("statement")]),
6
+ ]),
12
7
  };