Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sql-parser-cst

Package Overview
Dependencies
Maintainers
1
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sql-parser-cst - npm Package Compare versions

Comparing version 0.21.2 to 0.22.0

changelog.md

3

lib/cst/CreateTable.d.ts

@@ -7,3 +7,4 @@ import { BaseNode, Keyword } from "./Base";

import { AsClause, WithConnectionClause } from "./ProcClause";
import { ClusterByClause, ForSystemTimeAsOfExpr, PartitionByClause, SubSelect } from "./Select";
import { ForSystemTimeAsOfExpr, PartitionByClause, SubSelect } from "./Select";
import { ClusterByClause } from "./OtherClauses";
export type AllCreateTableNodes = CreateTableStmt | ColumnDefinition | TableOption | CreateTableLikeClause | CreateTableCopyClause | CreateTableCloneClause | WithPartitionColumnsClause | CreateTableUsingClause;

@@ -10,0 +11,0 @@ export interface CreateTableStmt extends BaseNode {

@@ -5,7 +5,8 @@ import { Alias } from "./Alias";

import { MysqlModifier } from "./dialects/Mysql";
import { FromClause, LimitClause, OrderByClause, PartitionedTable, RelationExpr, ReturningClause, WhereClause, WithClause } from "./Select";
import { FromClause, LimitClause, OrderByClause, PartitionedTable, RelationExpr, WhereClause, WithClause } from "./Select";
import { ReturningClause, WhereCurrentOfClause } from "./OtherClauses";
export type AllDeleteNodes = DeleteStmt | DeleteClause;
export interface DeleteStmt extends BaseNode {
type: "delete_stmt";
clauses: (WithClause | DeleteClause | WhereClause | ReturningClause | OrderByClause | LimitClause | FromClause)[];
clauses: (WithClause | DeleteClause | WhereClause | WhereCurrentOfClause | ReturningClause | OrderByClause | LimitClause | FromClause)[];
}

@@ -12,0 +13,0 @@ export interface DeleteClause extends BaseNode {

@@ -6,4 +6,5 @@ import { AlterActionSetOptions } from "../AlterAction";

import { StringLiteral } from "../Literal";
import { ClusterByClause } from "../OtherClauses";
import { AsClause, WithConnectionClause } from "../ProcClause";
import { ClusterByClause, PartitionByClause, SubSelect } from "../Select";
import { PartitionByClause, SubSelect } from "../Select";
export type AllBigqueryNodes = BigqueryOptions | BigqueryOptionDefaultCollate | AllBigqueryStatements | RowAccessPolicyGrantClause | RowAccessPolicyFilterClause | FromFilesOptions;

@@ -10,0 +11,0 @@ export interface BigqueryOptions extends BaseNode {

import { BaseNode, Keyword } from "./Base";
import { Expr, Identifier, ListExpr, ParenExpr, EntityName, RowConstructor } from "./Expr";
import { Alias } from "./Alias";
import { PartitionedTable, ReturningClause, SortSpecification, SubSelect, WhereClause, WithClause } from "./Select";
import { PartitionedTable, SortSpecification, SubSelect, WhereClause, WithClause } from "./Select";
import { ColumnAssignment, SetClause } from "./Update";
import { MysqlModifier } from "./dialects/Mysql";
export type AllInsertNodes = InsertStmt | InsertClause | OrAlternateAction | ValuesClause | DefaultValues | Default | RowAliasClause | UpsertClause | UpsertActionNothing | UpsertActionUpdate | OnDuplicateKeyUpdateClause;
import { ReturningClause } from "./OtherClauses";
export type AllInsertNodes = InsertStmt | InsertClause | OrAlternateAction | ValuesClause | DefaultValues | Default | OverridingClause | RowAliasClause | UpsertClause | ConflictTargetOnConstraint | UpsertActionNothing | UpsertActionUpdate | OnDuplicateKeyUpdateClause;
export interface InsertStmt extends BaseNode {
type: "insert_stmt";
clauses: (WithClause | InsertClause | (ValuesClause | SubSelect | DefaultValues | SetClause) | RowAliasClause | UpsertClause | OnDuplicateKeyUpdateClause | ReturningClause)[];
clauses: (WithClause | InsertClause | (ValuesClause | SubSelect | DefaultValues | SetClause) | OverridingClause | RowAliasClause | UpsertClause | OnDuplicateKeyUpdateClause | ReturningClause)[];
}

@@ -39,6 +40,14 @@ export interface InsertClause extends BaseNode {

}
export interface OverridingClause extends BaseNode {
type: "overriding_clause";
overridingKw: [
Keyword<"OVERRIDING">,
Keyword<"SYSTEM" | "USER">,
Keyword<"VALUE">
];
}
export interface UpsertClause extends BaseNode {
type: "upsert_clause";
onConflictKw: [Keyword<"ON">, Keyword<"CONFLICT">];
columns?: ParenExpr<ListExpr<SortSpecification | Identifier>>;
conflictTarget?: ConflictTargetOnConstraint | ParenExpr<ListExpr<SortSpecification | Identifier>>;
where?: WhereClause;

@@ -48,2 +57,7 @@ doKw: Keyword<"DOR">;

}
export interface ConflictTargetOnConstraint extends BaseNode {
type: "conflict_target_on_constraint";
onConstraintKw: [Keyword<"ON">, Keyword<"CONSTRAINT">];
constraint: Identifier;
}
export interface UpsertActionNothing extends BaseNode {

@@ -50,0 +64,0 @@ type: "upsert_action_nothing";

import { Alias } from "./Alias";
import { BaseNode, Keyword } from "./Base";
import { Expr, Identifier, ListExpr, ParenExpr, EntityName } from "./Expr";
import { ValuesClause } from "./Insert";
import { SelectStmt } from "./Select";
import { DefaultValues, OverridingClause, ValuesClause } from "./Insert";
import { SelectStmt, WithClause } from "./Select";
import { SetClause } from "./Update";
export type AllMergeNodes = MergeStmt | MergeWhenClause | MergeWhenCondition | MergeActionDelete | MergeActionUpdate | MergeActionInsert | MergeActionInsertRowClause;
export type AllMergeNodes = MergeStmt | MergeClause | MergeWhenClause | MergeWhenCondition | MergeActionDoNothing | MergeActionDelete | MergeActionUpdate | MergeActionInsert | MergeActionInsertRowClause;
export interface MergeStmt extends BaseNode {
type: "merge_stmt";
clauses: (WithClause | MergeClause | MergeWhenClause)[];
}
export interface MergeClause extends BaseNode {
type: "merge_clause";
mergeKw: Keyword<"MERGE">;

@@ -17,3 +21,2 @@ intoKw: Keyword<"INTO">;

condition: Expr;
clauses: MergeWhenClause[];
}

@@ -27,3 +30,3 @@ export interface MergeWhenClause extends BaseNode {

thenKw: Keyword<"THEN">;
action: MergeActionDelete | MergeActionUpdate | MergeActionInsert;
action: MergeActionDoNothing | MergeActionDelete | MergeActionUpdate | MergeActionInsert;
}

@@ -35,2 +38,6 @@ export interface MergeWhenCondition extends BaseNode {

}
export interface MergeActionDoNothing extends BaseNode {
type: "merge_action_do_nothing";
doNothingKw: [Keyword<"DO">, Keyword<"NOTHING">];
}
export interface MergeActionDelete extends BaseNode {

@@ -49,3 +56,3 @@ type: "merge_action_delete";

columns?: ParenExpr<ListExpr<Identifier>>;
values: ValuesClause | MergeActionInsertRowClause;
clauses: (OverridingClause | ValuesClause | DefaultValues | MergeActionInsertRowClause)[];
}

@@ -52,0 +59,0 @@ export interface MergeActionInsertRowClause extends BaseNode {

@@ -22,2 +22,3 @@ export * from "./Alias";

export * from "./dialects/Postgresql";
export * from "./OtherClauses";
export * from "./PreparedStatements";

@@ -54,2 +55,3 @@ export * from "./ProcClause";

import { AllMysqlNodes } from "./dialects/Mysql";
import { AllOtherClauses } from "./OtherClauses";
import { AllPostgresqlNodes } from "./dialects/Postgresql";

@@ -68,2 +70,2 @@ import { AllPreparedStatementNodes } from "./PreparedStatements";

import { Statement } from "./Statement";
export type Node = Alias | AllAlterActionNodes | AllBigqueryNodes | AllColumns | AllConstraintNodes | AllCreateTableNodes | AllDataTypeNodes | AllDeleteNodes | AllExprNodes | AllFrameNodes | AllFunctionNodes | AllIndexNodes | AllInsertNodes | AllMergeNodes | AllMysqlNodes | AllPostgresqlNodes | AllPreparedStatementNodes | AllProcClauseNodes | AllProceduralNodes | AllProcedureNodes | AllRenameTableNodes | AllSelectNodes | AllSqliteNodes | AllTransactionNodes | AllTriggerNodes | AllUpdateNodes | Keyword | Program | Statement;
export type Node = Alias | AllAlterActionNodes | AllBigqueryNodes | AllColumns | AllConstraintNodes | AllCreateTableNodes | AllDataTypeNodes | AllDeleteNodes | AllExprNodes | AllFrameNodes | AllFunctionNodes | AllIndexNodes | AllInsertNodes | AllMergeNodes | AllMysqlNodes | AllOtherClauses | AllPostgresqlNodes | AllPreparedStatementNodes | AllProcClauseNodes | AllProceduralNodes | AllProcedureNodes | AllRenameTableNodes | AllSelectNodes | AllSqliteNodes | AllTransactionNodes | AllTriggerNodes | AllUpdateNodes | Keyword | Program | Statement;

@@ -38,2 +38,3 @@ "use strict";

__exportStar(require("./dialects/Postgresql"), exports);
__exportStar(require("./OtherClauses"), exports);
__exportStar(require("./PreparedStatements"), exports);

@@ -40,0 +41,0 @@ __exportStar(require("./ProcClause"), exports);

@@ -9,3 +9,3 @@ import { AllColumns, BaseNode, Empty, Keyword } from "./Base";

import { DeleteStmt, InsertStmt, PostgresqlOperator, PostgresqlOperatorExpr, UpdateStmt } from "./Node";
export type AllSelectNodes = CompoundSelectStmt | SelectStmt | WithClause | CommonTableExpr | CteSearchClause | CteCycleClause | CteCycleClauseValues | SelectClause | SelectAll | SelectDistinct | SelectDistinctOn | SelectAsStruct | SelectAsValue | ExceptColumns | ReplaceColumns | FromClause | WhereClause | GroupByClause | GroupByRollup | GroupByCube | GroupByGroupingSets | HavingClause | WindowClause | QualifyClause | NamedWindow | WindowDefinition | OrderByClause | PartitionByClause | ClusterByClause | LimitClause | LimitAll | LimitRowsExamined | OffsetClause | FetchClause | DualTable | JoinExpr | IndexedTable | NotIndexedTable | LateralDerivedTable | PartitionedTable | TableWithInheritance | TableWithoutInheritance | FuncCallWithColumnDefinitions | WithOrdinalityExpr | RowsFromExpr | UnnestWithOffsetExpr | UnnestExpr | PivotExpr | PivotForIn | UnpivotExpr | UnpivotForIn | TablesampleExpr | TablesampleMethod | TablesamplePercent | TablesampleRepeatable | ForSystemTimeAsOfExpr | JoinOnSpecification | JoinUsingSpecification | SortSpecification | SortDirectionAsc | SortDirectionDesc | SortDirectionUsingOperator | ReturningClause | IntoTableClause | IntoVariablesClause | IntoDumpfileClause | IntoOutfileClause | OutfileFields | OutfileLines | OutfileOptionTerminatedBy | OutfileOptionEscapedBy | OutfileOptionStartingBy | OutfileOptionEnclosedBy | OutfileOptionCharacterSet | ForClause | ForClauseTables | LockInShareModeClause | TableClause;
export type AllSelectNodes = CompoundSelectStmt | SelectStmt | WithClause | CommonTableExpr | CteSearchClause | CteCycleClause | CteCycleClauseValues | SelectClause | SelectAll | SelectDistinct | SelectDistinctOn | SelectAsStruct | SelectAsValue | ExceptColumns | ReplaceColumns | FromClause | WhereClause | GroupByClause | GroupByRollup | GroupByCube | GroupByGroupingSets | HavingClause | WindowClause | QualifyClause | NamedWindow | WindowDefinition | OrderByClause | PartitionByClause | LimitClause | LimitAll | LimitRowsExamined | OffsetClause | FetchClause | DualTable | JoinExpr | IndexedTable | NotIndexedTable | LateralDerivedTable | PartitionedTable | TableWithInheritance | TableWithoutInheritance | FuncCallWithColumnDefinitions | WithOrdinalityExpr | RowsFromExpr | UnnestWithOffsetExpr | UnnestExpr | PivotExpr | PivotForIn | UnpivotExpr | UnpivotForIn | TablesampleExpr | TablesampleMethod | TablesamplePercent | TablesampleRepeatable | ForSystemTimeAsOfExpr | JoinOnSpecification | JoinUsingSpecification | SortSpecification | SortDirectionAsc | SortDirectionDesc | SortDirectionUsingOperator | IntoTableClause | IntoVariablesClause | IntoDumpfileClause | IntoOutfileClause | OutfileFields | OutfileLines | OutfileOptionTerminatedBy | OutfileOptionEscapedBy | OutfileOptionStartingBy | OutfileOptionEnclosedBy | OutfileOptionCharacterSet | ForClause | ForClauseTables | LockInShareModeClause | TableClause;
export interface CompoundSelectStmt extends BaseNode {

@@ -173,7 +173,2 @@ type: "compound_select_stmt";

}
export interface ClusterByClause extends BaseNode {
type: "cluster_by_clause";
clusterByKw: [Keyword<"CLUSTER">, Keyword<"BY">];
columns: ListExpr<Identifier>;
}
export interface LimitClause extends BaseNode {

@@ -378,7 +373,2 @@ type: "limit_clause";

}
export interface ReturningClause extends BaseNode {
type: "returning_clause";
returningKw: Keyword<"RETURNING">;
columns: ListExpr<Expr | Alias<Expr>>;
}
export interface IntoTableClause extends BaseNode {

@@ -385,0 +375,0 @@ type: "into_table_clause";

import { BaseNode, Keyword } from "./Base";
import { EntityName } from "./Expr";
import { ListExpr } from "./Expr";
import { TableFactor } from "./Select";
export interface TruncateStmt extends BaseNode {

@@ -7,3 +8,5 @@ type: "truncate_stmt";

tableKw?: Keyword<"TABLE">;
table: EntityName;
tables: ListExpr<TableFactor>;
restartOrContinueKw?: [Keyword<"RESTART" | "CONTINUE">, Keyword<"IDENTITY">];
cascadeOrRestrictKw?: Keyword<"CASCADE" | "RESTRICT">;
}

@@ -6,3 +6,4 @@ import { Alias } from "./Alias";

import { MysqlModifier } from "./dialects/Mysql";
import { FromClause, LimitClause, OrderByClause, RelationExpr, ReturningClause, WhereClause, WithClause } from "./Select";
import { FromClause, LimitClause, OrderByClause, RelationExpr, WhereClause, WithClause } from "./Select";
import { ReturningClause } from "./OtherClauses";
export type AllUpdateNodes = UpdateStmt | UpdateClause | SetClause | ColumnAssignment;

@@ -9,0 +10,0 @@ export interface UpdateStmt extends BaseNode {

@@ -5,4 +5,5 @@ import { AlterActionSetOptions } from "./AlterAction";

import { Identifier, ListExpr, ParenExpr, EntityName } from "./Expr";
import { ClusterByClause } from "./OtherClauses";
import { AsClause } from "./ProcClause";
import { ClusterByClause, PartitionByClause, SubSelect } from "./Select";
import { PartitionByClause, SubSelect } from "./Select";
export type AllViewStatements = CreateViewStmt | DropViewStmt | AlterViewStmt;

@@ -9,0 +10,0 @@ export interface CreateViewStmt extends BaseNode {

@@ -20,3 +20,13 @@ "use strict";

default: (node) => (0, show_1.show)(node.defaultKw),
upsert_clause: (node) => (0, show_1.show)([node.onConflictKw, node.columns, node.where, node.doKw, node.action]),
// OVERRIDING
overriding_clause: (node) => (0, show_1.show)(node.overridingKw),
// ON CONFLICT
upsert_clause: (node) => (0, show_1.show)([
node.onConflictKw,
node.conflictTarget,
node.where,
node.doKw,
node.action,
]),
conflict_target_on_constraint: (node) => (0, show_1.show)([node.onConstraintKw, node.constraint]),
upsert_action_nothing: (node) => (0, show_1.show)(node.nothingKw),

@@ -23,0 +33,0 @@ upsert_action_update: (node) => (0, show_1.show)([node.updateKw, node.set, node.where]),

@@ -6,3 +6,4 @@ "use strict";

exports.mergeMap = {
merge_stmt: (node) => (0, show_1.show)([
merge_stmt: (node) => (0, show_1.show)(node.clauses),
merge_clause: (node) => (0, show_1.show)([
node.mergeKw,

@@ -15,3 +16,2 @@ node.intoKw,

node.condition,
node.clauses,
]),

@@ -27,6 +27,7 @@ merge_when_clause: (node) => (0, show_1.show)([

merge_when_condition: (node) => (0, show_1.show)([node.andKw, node.expr]),
merge_action_do_nothing: (node) => (0, show_1.show)(node.doNothingKw),
merge_action_delete: (node) => (0, show_1.show)([node.deleteKw]),
merge_action_insert: (node) => (0, show_1.show)([node.insertKw, node.columns, node.values]),
merge_action_insert: (node) => (0, show_1.show)([node.insertKw, node.columns, node.clauses]),
merge_action_update: (node) => (0, show_1.show)([node.updateKw, node.set]),
merge_action_insert_row_clause: (node) => (0, show_1.show)(node.rowKw),
};

@@ -97,3 +97,2 @@ "use strict";

partition_by_clause: (node) => (0, show_1.show)([node.partitionByKw, node.specifications]),
cluster_by_clause: (node) => (0, show_1.show)([node.clusterByKw, node.columns]),
// WINDOW

@@ -132,4 +131,2 @@ window_clause: (node) => (0, show_1.show)([node.windowKw, node.namedWindows]),

fetch_clause: (node) => (0, show_1.show)([node.fetchKw, node.count, node.rowsKw, node.withTiesKw]),
// returning clause
returning_clause: (node) => (0, show_1.show)([node.returningKw, node.columns]),
// INTO ...

@@ -136,0 +133,0 @@ into_table_clause: (node) => (0, show_1.show)([

@@ -33,2 +33,3 @@ "use strict";

const rename_table_1 = require("./rename_table");
const other_clauses_1 = require("./other_clauses");
const bigquery_1 = require("./dialects/bigquery");

@@ -38,2 +39,2 @@ const postgresql_1 = require("./dialects/postgresql");

const mysql_1 = require("./dialects/mysql");
exports.transformMap = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, base_1.baseMap), select_1.selectMap), window_frame_1.frameMap), insert_1.insertMap), update_1.updateMap), delete_1.deleteMap), truncate_1.truncateMap), merge_1.mergeMap), create_table_1.createTableMap), constraint_1.constraintMap), alter_table_1.alterTableMap), alter_action_1.alterActionMap), drop_table_1.dropTableMap), rename_table_1.renameTableMap), schema_1.schemaMap), view_1.viewMap), index_1.indexMap), trigger_1.triggerMap), function_1.functionMap), procedure_1.procedureMap), proc_clause_1.procClauseMap), analyze_1.analyzeMap), explain_1.explainMap), transaction_1.transactionMap), dcl_1.dclMap), procedural_language_1.proceduralLanguageMap), prepared_statements_1.preparedStatementsMap), sqlite_1.sqliteMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), expr_1.exprMap), data_type_1.dataTypeMap);
exports.transformMap = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, base_1.baseMap), select_1.selectMap), window_frame_1.frameMap), insert_1.insertMap), update_1.updateMap), delete_1.deleteMap), truncate_1.truncateMap), merge_1.mergeMap), create_table_1.createTableMap), constraint_1.constraintMap), alter_table_1.alterTableMap), alter_action_1.alterActionMap), drop_table_1.dropTableMap), rename_table_1.renameTableMap), schema_1.schemaMap), view_1.viewMap), index_1.indexMap), trigger_1.triggerMap), function_1.functionMap), procedure_1.procedureMap), proc_clause_1.procClauseMap), analyze_1.analyzeMap), explain_1.explainMap), transaction_1.transactionMap), dcl_1.dclMap), procedural_language_1.proceduralLanguageMap), prepared_statements_1.preparedStatementsMap), other_clauses_1.otherClausesMap), sqlite_1.sqliteMap), bigquery_1.bigqueryMap), mysql_1.mysqlMap), postgresql_1.postgresqlMap), expr_1.exprMap), data_type_1.dataTypeMap);

@@ -6,3 +6,9 @@ "use strict";

exports.truncateMap = {
truncate_stmt: (node) => (0, show_1.show)([node.truncateKw, node.tableKw, node.table]),
truncate_stmt: (node) => (0, show_1.show)([
node.truncateKw,
node.tableKw,
node.tables,
node.restartOrContinueKw,
node.cascadeOrRestrictKw,
]),
};

@@ -5,3 +5,3 @@ {

"license": "GPL-2.0-or-later",
"version": "0.21.2",
"version": "0.22.0",
"main": "lib/main.js",

@@ -41,3 +41,5 @@ "types": "lib/main.d.ts",

"perf:select": "yarn ts-node perf/perf-test.ts select",
"lint": "eslint src test scripts perf"
"perf:case": "yarn ts-node perf/perf-test.ts case",
"lint": "eslint src test scripts perf",
"ts:check": "tsc --noEmit"
},

@@ -44,0 +46,0 @@ "devDependencies": {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc