prettier-plugin-sql-cst
Advanced tools
Comparing version 0.11.1 to 0.11.2
@@ -1,3 +0,3 @@ | ||
import { AlterTableStmt, AllAlterActionNodes } from "sql-parser-cst"; | ||
import { AllAlterTableNodes } from "sql-parser-cst"; | ||
import { CstToDocMap } from "../CstToDocMap"; | ||
export declare const alterTableMap: CstToDocMap<AlterTableStmt | AllAlterActionNodes>; | ||
export declare const alterTableMap: CstToDocMap<AllAlterTableNodes>; |
@@ -13,42 +13,10 @@ "use strict"; | ||
}, | ||
alter_action_rename_table: function (print) { return print.spaced(["renameKw", "newName"]); }, | ||
alter_action_rename_column: function (print) { | ||
return print.spaced(["renameKw", "ifExistsKw", "oldName", "toKw", "newName"]); | ||
}, | ||
alter_action_add_column: function (print) { | ||
return print.spaced(["addKw", "ifNotExistsKw", "column"]); | ||
}, | ||
alter_action_drop_column: function (print) { | ||
return print.spaced(["dropKw", "ifExistsKw", "column", "behaviorKw"]); | ||
}, | ||
alter_action_set_options: function (print) { return print.spaced(["setKw", "options"]); }, | ||
alter_action_set_default_collate: function (print) { | ||
return print.spaced(["setDefaultCollateKw", "collation"]); | ||
}, | ||
alter_action_add_constraint: function (print) { | ||
return print.spaced(["addKw", "constraint"]); | ||
}, | ||
alter_action_drop_constraint: function (print) { | ||
return print.spaced([ | ||
"dropConstraintKw", | ||
"ifExistsKw", | ||
"constraint", | ||
"behaviorKw", | ||
]); | ||
}, | ||
alter_action_alter_constraint: function (print) { | ||
return print.spaced(["alterConstraintKw", "constraint", "modifiers"]); | ||
}, | ||
alter_action_rename_constraint: function (print) { | ||
return print.spaced(["renameConstraintKw", "oldName", "toKw", "newName"]); | ||
}, | ||
alter_action_validate_constraint: function (print) { | ||
return print.spaced(["validateConstraintKw", "constraint"]); | ||
}, | ||
alter_action_set_visible: function (print) { return print.spaced("setVisibleKw"); }, | ||
alter_action_set_invisible: function (print) { return print.spaced("setInvisibleKw"); }, | ||
// ALTER COLUMN | ||
alter_action_alter_column: function (print) { | ||
alter_table_all_in_tablespace_stmt: function (print) { | ||
return (0, print_utils_1.group)([ | ||
print.spaced(["alterKw", "ifExistsKw", "column"]), | ||
print.spaced([ | ||
"alterTableKw", | ||
"allInTablespaceKw", | ||
"tablespace", | ||
"ownedBy", | ||
]), | ||
print.dynamicLine(), | ||
@@ -58,9 +26,5 @@ print("action"), | ||
}, | ||
alter_action_set_default: function (print) { return print.spaced(["setDefaultKw", "expr"]); }, | ||
alter_action_drop_default: function (print) { return print.spaced("dropDefaultKw"); }, | ||
alter_action_set_not_null: function (print) { return print.spaced("setNotNullKw"); }, | ||
alter_action_drop_not_null: function (print) { return print.spaced("dropNotNullKw"); }, | ||
alter_action_set_data_type: function (print) { | ||
return print.spaced(["setDataTypeKw", "dataType"]); | ||
owned_by_clause: function (print) { | ||
return (0, print_utils_1.group)([print.spaced("ownedByKw"), (0, print_utils_1.indent)([print_utils_1.line, print("owners")])]); | ||
}, | ||
}; |
@@ -38,2 +38,3 @@ "use strict"; | ||
}, | ||
existing_index: function (print) { return print.spaced(["usingIndexKw", "index"]); }, | ||
constraint_check: function (print) { | ||
@@ -68,3 +69,9 @@ return (0, print_utils_1.group)(print.spaced(["checkKw", "expr", "clauses"])); | ||
constraint_generated: function (print) { | ||
return print.spaced(["generatedKw", "asKw", "expr", "storageKw"]); | ||
return print.spaced([ | ||
"generatedKw", | ||
"asKw", | ||
"expr", | ||
"storageKw", | ||
"sequenceOptions", | ||
]); | ||
}, | ||
@@ -71,0 +78,0 @@ identity_column: function (print) { return print("identityKw"); }, |
@@ -38,3 +38,3 @@ "use strict"; | ||
}, | ||
table_kind: function (print) { return print.spaced("kindKw"); }, | ||
relation_kind: function (print) { return print.spaced("kindKw"); }, | ||
column_definition: function (print) { | ||
@@ -90,8 +90,3 @@ return print.spaced(["name", "dataType", "withOptionsKw", "constraints"]); | ||
using_access_method_clause: function (print) { return print.spaced(["usingKw", "method"]); }, | ||
create_table_tablespace_clause: function (print) { | ||
return print.spaced(["tablespaceKw", "name"]); | ||
}, | ||
with_storage_parameters_clause: function (print) { | ||
return print.spaced(["withKw", "options"]); | ||
}, | ||
tablespace_clause: function (print) { return print.spaced(["tablespaceKw", "name"]); }, | ||
create_table_without_oids_clause: function (print) { return print.spaced("withoutOidsKw"); }, | ||
@@ -101,3 +96,4 @@ create_table_on_commit_clause: function (print) { | ||
}, | ||
create_table_with_data_clause: function (print) { return print.spaced("withDataKw"); }, | ||
with_data_clause: function (print) { return print.spaced("withDataKw"); }, | ||
create_table_server_clause: function (print) { return print.spaced(["serverKw", "name"]); }, | ||
}; | ||
@@ -104,0 +100,0 @@ var printClauses = function (print, node) { |
@@ -8,2 +8,5 @@ "use strict"; | ||
postgresql_operator_class: function (print) { return print("name"); }, | ||
postgresql_with_options: function (print) { return print.spaced(["withKw", "options"]); }, | ||
postgresql_options: function (print) { return print.spaced(["optionsKw", "options"]); }, | ||
postgresql_option_element: function (print) { return print.spaced(["name", "value"]); }, | ||
}; |
@@ -15,15 +15,23 @@ "use strict"; | ||
exports.schemaMap = { | ||
create_schema_stmt: function (print) { | ||
return (0, print_utils_1.join)(print_utils_1.hardline, __spreadArray([ | ||
print.spaced(["createSchemaKw", "ifNotExistsKw", "name"]) | ||
], print("options"), true)); | ||
create_schema_stmt: function (print, node) { | ||
return (0, print_utils_1.group)([ | ||
(0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([ | ||
print.spaced(["createSchemaKw", "ifNotExistsKw", "name"]) | ||
], print("clauses"), true))), | ||
node.statements.length > 0 | ||
? (0, print_utils_1.indent)([print_utils_1.hardline, (0, print_utils_1.join)(print_utils_1.hardline, print("statements"))]) | ||
: [], | ||
]); | ||
}, | ||
create_schema_authorization_clause: function (print) { | ||
return print.spaced(["authorizationKw", "role"]); | ||
}, | ||
drop_schema_stmt: function (print) { | ||
return print.spaced(["dropSchemaKw", "ifExistsKw", "name", "behaviorKw"]); | ||
return print.spaced(["dropSchemaKw", "ifExistsKw", "schemas", "behaviorKw"]); | ||
}, | ||
alter_schema_stmt: function (print) { | ||
return (0, print_utils_1.join)(print_utils_1.hardline, __spreadArray([ | ||
return (0, print_utils_1.group)((0, print_utils_1.join)(print.dynamicLine(), __spreadArray([ | ||
print.spaced(["alterSchemaKw", "ifExistsKw", "name"]) | ||
], print("actions"), true)); | ||
], print("actions"), true))); | ||
}, | ||
}; |
@@ -16,2 +16,3 @@ "use strict"; | ||
var alias_1 = require("./alias"); | ||
var alter_action_1 = require("./alter_action"); | ||
var alter_table_1 = require("./alter_table"); | ||
@@ -42,2 +43,3 @@ var analyze_1 = require("./analyze"); | ||
var select_1 = require("./select"); | ||
var sequence_1 = require("./sequence"); | ||
var transaction_1 = require("./transaction"); | ||
@@ -52,2 +54,2 @@ var trigger_1 = require("./trigger"); | ||
var postgresql_1 = require("./dialects/postgresql"); | ||
exports.transformMap = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, alias_1.aliasMap), alter_table_1.alterTableMap), analyze_1.analyzeMap), base_1.baseMap), constraint_1.constraintMap), create_table_1.createTableMap), data_type_1.dataTypeMap), dcl_1.dclMap), delete_1.deleteMap), drop_table_1.dropTableMap), explain_1.explainMap), expr_1.exprMap), frame_1.frameMap), function_1.functionMap), index_1.indexMap), insert_1.insertMap), merge_1.mergeMap), other_clauses_1.otherClausesMap), prepared_statements_1.preparedStatementsMap), proc_clause_1.procClauseMap), procedural_language_1.proceduralLanguageMap), procedure_1.procedureMap), program_1.programMap), rename_table_1.renameTableMap), schema_1.schemaMap), select_1.selectMap), transaction_1.transactionMap), trigger_1.triggerMap), truncate_1.truncateMap), update_1.updateMap), view_1.viewMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), sqlite_1.sqliteMap); | ||
exports.transformMap = __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, alias_1.aliasMap), alter_action_1.alterActionMap), alter_table_1.alterTableMap), analyze_1.analyzeMap), base_1.baseMap), constraint_1.constraintMap), create_table_1.createTableMap), data_type_1.dataTypeMap), dcl_1.dclMap), delete_1.deleteMap), drop_table_1.dropTableMap), explain_1.explainMap), expr_1.exprMap), frame_1.frameMap), function_1.functionMap), index_1.indexMap), insert_1.insertMap), merge_1.mergeMap), other_clauses_1.otherClausesMap), prepared_statements_1.preparedStatementsMap), proc_clause_1.procClauseMap), procedural_language_1.proceduralLanguageMap), procedure_1.procedureMap), program_1.programMap), rename_table_1.renameTableMap), schema_1.schemaMap), select_1.selectMap), sequence_1.sequenceMap), transaction_1.transactionMap), trigger_1.triggerMap), truncate_1.truncateMap), update_1.updateMap), view_1.viewMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), sqlite_1.sqliteMap); |
@@ -11,7 +11,3 @@ "use strict"; | ||
print_utils_1.line, | ||
print.separated(print_utils_1.line, [ | ||
"tables", | ||
"restartOrContinueKw", | ||
"cascadeOrRestrictKw", | ||
]), | ||
print.separated(print_utils_1.line, ["tables", "restartOrContinueKw", "behaviorKw"]), | ||
]), | ||
@@ -18,0 +14,0 @@ ]); |
@@ -1,3 +0,3 @@ | ||
import { AllViewStatements } from "sql-parser-cst"; | ||
import { AllViewNodes } from "sql-parser-cst"; | ||
import { CstToDocMap } from "../CstToDocMap"; | ||
export declare const viewMap: CstToDocMap<AllViewStatements>; | ||
export declare const viewMap: CstToDocMap<AllViewNodes>; |
@@ -13,4 +13,3 @@ "use strict"; | ||
"orReplaceKw", | ||
"temporaryKw", | ||
"materializedKw", | ||
"kinds", | ||
"viewKw", | ||
@@ -25,6 +24,9 @@ "ifNotExistsKw", | ||
}, | ||
with_check_option_clause: function (print) { | ||
return print.spaced(["withKw", "levelKw", "checkOptionKw"]); | ||
}, | ||
drop_view_stmt: function (print) { | ||
return print.spaced([ | ||
return (0, print_utils_1.group)(print.spaced([ | ||
"dropKw", | ||
"materializedKw", | ||
"kind", | ||
"viewKw", | ||
@@ -34,3 +36,3 @@ "ifExistsKw", | ||
"behaviorKw", | ||
]); | ||
])); | ||
}, | ||
@@ -40,3 +42,3 @@ alter_view_stmt: function (print) { return [ | ||
"alterKw", | ||
"materializedKw", | ||
"kind", | ||
"viewKw", | ||
@@ -48,4 +50,12 @@ "ifExistsKw", | ||
print_utils_1.hardline, | ||
(0, print_utils_1.join)(print_utils_1.hardline, print("actions")), | ||
print("actions"), | ||
]; }, | ||
refresh_materialized_view_stmt: function (print, node) { | ||
return (0, print_utils_1.group)([ | ||
print.spaced(["refreshMaterializedViewKw", "concurrentlyKw", "name"]), | ||
node.clauses.length > 0 | ||
? [print.dynamicLine(), (0, print_utils_1.join)(print_utils_1.line, print("clauses"))] | ||
: [], | ||
]); | ||
}, | ||
}; |
@@ -9,3 +9,3 @@ "use strict"; | ||
// Replaces TEMP with TEMPORARY | ||
table_kind: function (node) { | ||
relation_kind: function (node) { | ||
if (Array.isArray(node.kindKw)) { | ||
@@ -29,3 +29,3 @@ // TODO... | ||
// Replaces RENAME & RENAME AS with RENAME TO | ||
alter_action_rename_table: function (node) { | ||
alter_action_rename: function (node) { | ||
if (Array.isArray(node.renameKw)) { | ||
@@ -32,0 +32,0 @@ if (node.renameKw[1].name === "AS") { |
{ | ||
"name": "prettier-plugin-sql-cst", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Prettier plugin for SQL", | ||
@@ -36,3 +36,3 @@ "author": "Rene Saarsoo <nene@triin.net>", | ||
"prettier": "^3.0.3", | ||
"sql-parser-cst": "^0.24.0" | ||
"sql-parser-cst": "^0.26.0" | ||
}, | ||
@@ -39,0 +39,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
171772
121
2856
+ Addedsql-parser-cst@0.26.0(transitive)
- Removedsql-parser-cst@0.24.0(transitive)
Updatedsql-parser-cst@^0.26.0