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 3.0.4 to 3.1.0

src/syntax/prepare.ne

4

ast-mapper.d.ts

@@ -18,2 +18,4 @@ import * as a from './syntax/ast';

dataType?: (dataType: a.DataTypeDef) => a.DataTypeDef;
prepare?: (st: a.PrepareStatement) => a.Statement | nil;
parameter?: (st: a.ExprParameter) => a.Expr | nil;
tableRef?: (st: a.QNameAliased) => a.QNameAliased | nil;

@@ -139,2 +141,3 @@ transaction?: (val: a.CommitStatement | a.RollbackStatement | a.StartTransactionStatement) => a.Statement | nil;

createIndex(val: a.CreateIndexStatement): a.Statement | nil;
prepare(st: a.PrepareStatement): a.Statement | nil;
alterTable(st: a.AlterTableStatement): a.Statement | nil;

@@ -167,2 +170,3 @@ dropColumn(change: a.TableAlterationDropColumn, table: a.QNameAliased): a.TableAlteration | nil;

ternary(val: a.ExprTernary): a.Expr | nil;
parameter(st: a.ExprParameter): a.Expr | nil;
arrayIndex(val: a.ExprArrayIndex): a.Expr | nil;

@@ -169,0 +173,0 @@ member(val: a.ExprMember): a.Expr | nil;

2

package.json
{
"name": "pgsql-ast-parser",
"version": "3.0.4",
"version": "3.1.0",
"description": "Yet another simple Postgres SQL parser/modifier",

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

@@ -21,2 +21,4 @@ import * as a from './syntax/ast';

dataType?: (dataType: a.DataTypeDef) => a.DataTypeDef
prepare?: (st: a.PrepareStatement) => a.Statement | nil
parameter?: (st: a.ExprParameter) => a.Expr | nil
tableRef?: (st: a.QNameAliased) => a.QNameAliased | nil

@@ -234,2 +236,4 @@ transaction?: (val: a.CommitStatement | a.RollbackStatement | a.StartTransactionStatement) => a.Statement | nil

return this.show(val);
case 'prepare':
return this.prepare(val);
default:

@@ -489,2 +493,12 @@ throw NotSupported.never(val);

prepare(st: a.PrepareStatement): a.Statement | nil {
const statement = this.statement(st.statement);
if (!statement) {
return null;
}
return assignChanged(st, {
args: arrayNilMap(st.args, a => this.dataType(a)),
statement,
})
}

@@ -831,2 +845,4 @@ // =========================================

return this.valueKeyword(val);
case 'parameter':
return this.parameter(val);
default:

@@ -856,2 +872,6 @@ throw NotSupported.never(val);

parameter (st: a.ExprParameter): a.Expr | nil {
return st;
}
arrayIndex(val: a.ExprArrayIndex): a.Expr | nil {

@@ -858,0 +878,0 @@ const array = this.expr(val.array);

@@ -44,2 +44,5 @@ import {compile, keywords} from 'moo';

},
qparam: {
match: /\$\d+/,
},
star: '*',

@@ -46,0 +49,0 @@ comma: ',',

@@ -15,2 +15,3 @@ // import { IType } from '../../interfaces';

| ShowStatement
| PrepareStatement
| DeleteStatement

@@ -33,2 +34,9 @@ | WithStatement

export interface PrepareStatement {
type: 'prepare';
name: string;
args?: DataTypeDef[] | nil;
statement: Statement;
}
export interface CreateEnumType {

@@ -443,2 +451,3 @@ type: 'create enum',

export type Expr = ExprRef
| ExprParameter
| ExprList

@@ -519,2 +528,8 @@ | ExprNull

export interface ExprParameter {
type: 'parameter';
name: string;
}
export interface ExprMember {

@@ -521,0 +536,0 @@ type: 'member';

@@ -79,3 +79,3 @@ import { Parser, Grammar } from 'nearley';

const modified = mapper(parsed, astMapper(() => ({})));
expect(modified).to.equal(parsed, 'It is not stable when passing through a neutral AST mapper');
expect(modified).to.equal(parsed, 'It is not stable when passing through a neutral AST mapper -> Should return THE SAME REFERENCE to avoid copying stuff when nothing changed.');

@@ -82,0 +82,0 @@

@@ -744,2 +744,6 @@ import { IAstPartialMapper, AstDefaultMapper } from './ast-mapper';

parameter: p => {
ret.push(p.name);
},
renameColumn: r => {

@@ -828,2 +832,11 @@ ret.push(' RENAME COLUMN '

prepare: s => {
ret.push('PREPARE ', name(s.name));
if (s.args?.length) {
list(s.args, a => m.dataType(a), true);
}
ret.push(' AS ');
m.statement(s.statement);
},
union: s => {

@@ -830,0 +843,0 @@ ret.push('(');

import { nil } from '../utils';
export declare const LOCATION: unique symbol;
export declare type Statement = (SelectStatement | CreateTableStatement | CreateSequenceStatement | CreateIndexStatement | CreateExtensionStatement | CommitStatement | InsertStatement | UpdateStatement | ShowStatement | DeleteStatement | WithStatement | RollbackStatement | TablespaceStatement | AlterTableStatement | AlterSequenceStatement | SetGlobalStatement | SetTimezone | CreateEnumType | TruncateTableStatement | DropTableStatement | DropSequenceStatement | DropIndexStatement | StartTransactionStatement) & {
export declare type Statement = (SelectStatement | CreateTableStatement | CreateSequenceStatement | CreateIndexStatement | CreateExtensionStatement | CommitStatement | InsertStatement | UpdateStatement | ShowStatement | PrepareStatement | DeleteStatement | WithStatement | RollbackStatement | TablespaceStatement | AlterTableStatement | AlterSequenceStatement | SetGlobalStatement | SetTimezone | CreateEnumType | TruncateTableStatement | DropTableStatement | DropSequenceStatement | DropIndexStatement | StartTransactionStatement) & {
[LOCATION]?: StatementLocation;
};
export interface PrepareStatement {
type: 'prepare';
name: string;
args?: DataTypeDef[] | nil;
statement: Statement;
}
export interface CreateEnumType {

@@ -318,3 +324,3 @@ type: 'create enum';

export declare type JoinType = 'INNER JOIN' | 'LEFT JOIN' | 'RIGHT JOIN' | 'FULL JOIN';
export declare type Expr = ExprRef | ExprList | ExprNull | ExprInteger | ExprMember | ExprValueKeyword | ExprArrayIndex | ExprNumeric | ExprString | ExprCase | ExprBinary | ExprUnary | ExprCast | ExprBool | ExprCall | SelectStatement | ExprConstant | ExprTernary;
export declare type Expr = ExprRef | ExprParameter | ExprList | ExprNull | ExprInteger | ExprMember | ExprValueKeyword | ExprArrayIndex | ExprNumeric | ExprString | ExprCase | ExprBinary | ExprUnary | ExprCast | ExprBool | ExprCall | SelectStatement | ExprConstant | ExprTernary;
export declare type LogicOperator = 'OR' | 'AND';

@@ -361,2 +367,6 @@ export declare type EqualityOperator = 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'ILIKE' | 'NOT ILIKE' | '=' | '!=';

}
export interface ExprParameter {
type: 'parameter';
name: string;
}
export interface ExprMember {

@@ -363,0 +373,0 @@ type: 'member';

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

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