New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

pgsql-ast-parser

Package Overview
Dependencies
Maintainers
1
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pgsql-ast-parser - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

src/syntax/union.ne

8

ast-mapper.d.ts

@@ -35,3 +35,5 @@ import * as a from './syntax/ast';

with?: (val: a.WithStatement) => a.Statement | nil;
selection?: (val: a.SelectStatement) => a.SelectStatement | nil;
union?: (val: a.SelectFromUnion) => a.SelectStatement | nil;
select?: (val: a.SelectStatement) => a.SelectStatement | nil;
selection?: (val: a.SelectFromStatement) => a.SelectStatement | nil;
from?: (from: a.From) => a.From | nil;

@@ -149,3 +151,5 @@ fromStatement?: (from: a.FromStatement) => a.From | nil;

createColumn(col: a.CreateColumnDef): a.CreateColumnDef | nil;
selection(val: a.SelectStatement): a.SelectStatement | nil;
select(val: a.SelectStatement): a.SelectStatement | nil;
selection(val: a.SelectFromStatement): a.SelectStatement | nil;
union(val: a.SelectFromUnion): a.SelectStatement | nil;
with(val: a.WithStatement): a.Statement | nil;

@@ -152,0 +156,0 @@ from(from: a.From): a.From | nil;

{
"name": "pgsql-ast-parser",
"version": "2.2.0",
"version": "3.0.0",
"description": "Yet another simple Postgres SQL parser/modifier",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -38,3 +38,5 @@ import * as a from './syntax/ast';

with?: (val: a.WithStatement) => a.Statement | nil
selection?: (val: a.SelectStatement) => a.SelectStatement | nil
union?: (val: a.SelectFromUnion) => a.SelectStatement | nil
select?: (val: a.SelectStatement) => a.SelectStatement | nil
selection?: (val: a.SelectFromStatement) => a.SelectStatement | nil
from?: (from: a.From) => a.From | nil

@@ -226,2 +228,4 @@ fromStatement?: (from: a.FromStatement) => a.From | nil

return this.createEnum(val);
case 'union':
return this.union(val);
default:

@@ -315,3 +319,3 @@ throw NotSupported.never(val);

const select = val.select && this.selection(val.select);
const select = val.select && this.select(val.select);

@@ -642,3 +646,14 @@ if (!values?.length && !select) {

selection(val: a.SelectStatement): a.SelectStatement | nil {
select(val: a.SelectStatement): a.SelectStatement | nil {
switch (val.type) {
case 'select':
return this.selection(val);
case 'union':
return this.union(val);
default:
throw NotSupported.never(val);
}
}
selection(val: a.SelectFromStatement): a.SelectStatement | nil {
const from = arrayNilMap(val.from, c => this.from(c));

@@ -671,2 +686,14 @@ const columns = arrayNilMap(val.columns, c => this.selectionColumn(c));

union(val: a.SelectFromUnion): a.SelectStatement | nil {
const left = this.select(val.left);
const right = this.select(val.right);
if (!left || !right) {
return left ?? right;
}
return assignChanged(val, {
left,
right
})
}
with(val: a.WithStatement): a.Statement | nil {

@@ -709,3 +736,3 @@ const bind = arrayNilMap(val.bind, s => {

fromStatement(from: a.FromStatement): a.From | nil {
const statement = this.selection(from.statement);
const statement = this.select(from.statement);
if (!statement) {

@@ -795,3 +822,4 @@ return null; // nothing to select from

case 'select':
return this.selection(val);
case 'union':
return this.select(val);
case 'keyword':

@@ -798,0 +826,0 @@ return this.valueKeyword(val);

@@ -346,3 +346,5 @@ // import { IType } from '../../interfaces';

export interface SelectStatement {
export type SelectStatement = SelectFromStatement | SelectFromUnion;
export interface SelectFromStatement {
type: 'select',

@@ -358,2 +360,8 @@ columns?: SelectedColumn[] | nil;

export interface SelectFromUnion {
type: 'union',
left: SelectStatement;
right: SelectStatement;
}
export interface OrderByStatement {

@@ -360,0 +368,0 @@ by: Expr;

@@ -638,3 +638,3 @@ import { IAstPartialMapper, AstDefaultMapper } from './ast-mapper';

ret.push('(');
m.selection(s.statement);
m.select(s.statement);
ret.push(') ');

@@ -706,3 +706,3 @@ if (s.alias) {

if (i.select) {
m.selection(i.select);
m.select(i.select);
ret.push(' ');

@@ -765,2 +765,4 @@ }

select: s => m.super().select(s),
selection: s => {

@@ -824,2 +826,15 @@ ret.push('SELECT ');

union: s => {
ret.push('(');
m.statement(s.left);
ret.push(') UNION ');
if (s.right.type === 'union') {
m.union(s.right);
} else {
ret.push('(');
m.statement(s.right);
ret.push(')');
}
},
selectionColumn: c => {

@@ -826,0 +841,0 @@ m.expr(c.expr);

@@ -248,3 +248,4 @@ import { nil } from '../utils';

}
export interface SelectStatement {
export declare type SelectStatement = SelectFromStatement | SelectFromUnion;
export interface SelectFromStatement {
type: 'select';

@@ -259,2 +260,7 @@ columns?: SelectedColumn[] | nil;

}
export interface SelectFromUnion {
type: 'union';
left: SelectStatement;
right: SelectStatement;
}
export interface OrderByStatement {

@@ -261,0 +267,0 @@ by: Expr;

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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