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 4.1.3 to 4.1.4

2

ast-mapper.d.ts

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

member?: (val: a.ExprMember) => a.Expr | nil;
extract?: (st: a.ExprExtract) => a.Expr | nil;
case?: (val: a.ExprCase) => a.Expr | nil;

@@ -173,2 +174,3 @@ cast?: (val: a.ExprCast) => a.Expr | nil;

expr(val: a.Expr): a.Expr | nil;
extract(st: a.ExprExtract): a.Expr | nil;
valueKeyword(val: a.ExprValueKeyword): a.Expr | nil;

@@ -175,0 +177,0 @@ ternary(val: a.ExprTernary): a.Expr | nil;

2

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

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

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

member?: (val: a.ExprMember) => a.Expr | nil
extract?: (st: a.ExprExtract) => a.Expr | nil
case?: (val: a.ExprCase) => a.Expr | nil

@@ -893,2 +894,4 @@ cast?: (val: a.ExprCast) => a.Expr | nil

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

@@ -900,2 +903,10 @@ throw NotSupported.never(val);

extract(st: a.ExprExtract): a.Expr | nil {
const from = this.expr(st.from);
if (!from) {
return null;
}
return assignChanged(st, { from })
}
valueKeyword(val: a.ExprValueKeyword): a.Expr | nil {

@@ -902,0 +913,0 @@ return val;

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

| ExprNull
| ExprExtract
| ExprInteger

@@ -595,2 +596,9 @@ | ExprMember

export interface ExprExtract {
type: 'extract';
field: string;
from: Expr;
}
export interface ExprList {

@@ -597,0 +605,0 @@ type: 'list';

@@ -464,2 +464,21 @@ import 'mocha';

checkTreeExpr(`timestamp 'value'`, {
type: 'cast',
to: { name: 'timestamp' },
operand: { type: 'string', value: 'value' },
});
checkTreeExpr(`time 'value'`, {
type: 'cast',
to: { name: 'time' },
operand: { type: 'string', value: 'value' },
});
checkTreeExpr(`interval 'value'`, {
type: 'cast',
to: { name: 'interval' },
operand: { type: 'string', value: 'value' },
});
checkTreeExpr(['"a"+"b"::"JSONB"'], {

@@ -792,2 +811,12 @@ type: 'binary',

})
checkTreeExpr([`extract (century from timestamp 'value')`, `EXTRACT (CENTURY FROM 'value'::TIMESTAMP)`], {
type: 'extract',
field: 'century',
from: {
type: 'cast',
to: { name: 'timestamp' },
operand: { type: 'string', value: 'value' },
},
});
});

@@ -794,0 +823,0 @@

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

extract: v => {
ret.push('EXTRACT (', v.field.toUpperCase(), ' FROM ');
m.expr(v.from);
ret.push(') ');
},
createColumn: c => {

@@ -390,0 +396,0 @@ ret.push(name(c.name), ' ');

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

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

@@ -413,2 +413,7 @@ export declare type EqualityOperator = 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'ILIKE' | 'NOT ILIKE' | '=' | '!=';

}
export interface ExprExtract {
type: 'extract';
field: string;
from: Expr;
}
export interface ExprList {

@@ -415,0 +420,0 @@ type: 'list';

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