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 11.1.0 to 11.2.0

10

ast-mapper.d.ts

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

setTimezone?(val: a.SetTimezone): a.Statement | nil;
setNames?(val: a.SetNames): a.Statement | nil;
createSequence?(seq: a.CreateSequenceStatement): a.Statement | nil;

@@ -89,6 +90,6 @@ alterSequence?(seq: a.AlterSequenceStatement): a.Statement | nil;

}
export declare type IAstFullMapper = {
export type IAstFullMapper = {
[key in keyof IAstPartialMapper]-?: IAstPartialMapper[key];
};
export declare type IAstMapper = IAstFullMapper & {
export type IAstMapper = IAstFullMapper & {
/** Forces the next call to use the default implementation, not yours */

@@ -114,4 +115,4 @@ super(): IAstMapper;

export declare function astMapper(modifierBuilder: MapperBuilder): IAstMapper;
export declare type MapperBuilder = (defaultImplem: IAstMapper) => IAstPartialMapper;
declare type PartialNil<T> = {
export type MapperBuilder = (defaultImplem: IAstMapper) => IAstPartialMapper;
type PartialNil<T> = {
[P in keyof T]?: T[P] | nil;

@@ -161,2 +162,3 @@ };

setTimezone(val: a.SetTimezone): a.Statement | nil;
setNames(val: a.SetNames): a.Statement | nil;
update(val: a.UpdateStatement): a.Statement | nil;

@@ -163,0 +165,0 @@ insert(val: a.InsertStatement): a.Statement | nil;

6

ast-visitor.d.ts
import { IAstPartialMapper } from './ast-mapper';
import { ReplaceReturnType } from './utils';
export declare type IAstPartialVisitor = {
export type IAstPartialVisitor = {
[key in keyof IAstPartialMapper]: ReplaceReturnType<IAstPartialMapper[key], any>;
};
export declare type IAstFullVisitor = {
export type IAstFullVisitor = {
[key in keyof IAstPartialVisitor]-?: IAstPartialVisitor[key];
};
export declare type IAstVisitor = IAstFullVisitor & {
export type IAstVisitor = IAstFullVisitor & {
super(): IAstVisitor;

@@ -11,0 +11,0 @@ };

@@ -17,3 +17,3 @@ interface NearleyToken {

}
declare type NearleySymbol = string | {
type NearleySymbol = string | {
literal: any;

@@ -20,0 +20,0 @@ } | {

@@ -17,3 +17,3 @@ interface NearleyToken {

}
declare type NearleySymbol = string | {
type NearleySymbol = string | {
literal: any;

@@ -20,0 +20,0 @@ } | {

import { Interval } from '../syntax/ast';
declare type E = [keyof Interval, number];
declare type K = E | K[];
type E = [keyof Interval, number];
type K = E | K[];
export declare function buildInterval(orig: string, vals: 'invalid' | K): Interval;

@@ -5,0 +5,0 @@ /** Returns a normalized copy of the given interval */

@@ -17,3 +17,3 @@ interface NearleyToken {

}
declare type NearleySymbol = string | {
type NearleySymbol = string | {
literal: any;

@@ -20,0 +20,0 @@ } | {

@@ -17,3 +17,3 @@ interface NearleyToken {

}
declare type NearleySymbol = string | {
type NearleySymbol = string | {
literal: any;

@@ -20,0 +20,0 @@ } | {

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

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

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

setTimezone?(val: a.SetTimezone): a.Statement | nil
setNames?(val: a.SetNames): a.Statement | nil
createSequence?(seq: a.CreateSequenceStatement): a.Statement | nil

@@ -253,2 +254,4 @@ alterSequence?(seq: a.AlterSequenceStatement): a.Statement | nil

return this.setTimezone(val);
case 'set names':
return this.setNames(val);
case 'create sequence':

@@ -445,2 +448,5 @@ return this.createSequence(val);

setNames(val: a.SetNames): a.Statement | nil {
return val;
}

@@ -447,0 +453,0 @@ update(val: a.UpdateStatement): a.Statement | nil {

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

| SetTimezone
| SetNames
| CreateEnumType

@@ -994,2 +995,12 @@ | CreateCompositeType

export interface SetNames extends PGNode {
type: 'set names',
to: SetNamesValue;
}
export type SetNamesValue = {
type: 'value';
value: string;
};
type SetGlobalValueRaw = {

@@ -996,0 +1007,0 @@ type: 'value',

@@ -109,2 +109,9 @@ import 'mocha';

checkStatement(`SET NAMES 'utf8'`, {
type: 'set names',
to: {
type: 'value',
value: 'utf8',
},
});

@@ -111,0 +118,0 @@ checkStatement(['create schema test'], {

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

setNames: g => {
ret.push('SET NAMES ');
switch (g.to.type) {
case 'value':
ret.push(literal(g.to.value));
break;
}
},
dataType: d => {

@@ -822,0 +831,0 @@ if (d?.kind === 'array') {

import { nil } from '../utils';
export declare function locationOf(node: PGNode): NodeLocation;
export declare type Statement = SelectStatement | CreateTableStatement | CreateSequenceStatement | CreateIndexStatement | CreateExtensionStatement | CommitStatement | InsertStatement | UpdateStatement | ShowStatement | PrepareStatement | DeallocateStatement | DeleteStatement | WithStatement | RollbackStatement | TablespaceStatement | CreateViewStatement | CreateMaterializedViewStatement | RefreshMaterializedViewStatement | AlterTableStatement | AlterIndexStatement | AlterSequenceStatement | SetGlobalStatement | SetTimezone | CreateEnumType | CreateCompositeType | TruncateTableStatement | DropStatement | CommentStatement | CreateSchemaStatement | WithRecursiveStatement | RaiseStatement | ValuesStatement | CreateFunctionStatement | DropFunctionStatement | DoStatement | BeginStatement | StartTransactionStatement;
export type Statement = SelectStatement | CreateTableStatement | CreateSequenceStatement | CreateIndexStatement | CreateExtensionStatement | CommitStatement | InsertStatement | UpdateStatement | ShowStatement | PrepareStatement | DeallocateStatement | DeleteStatement | WithStatement | RollbackStatement | TablespaceStatement | CreateViewStatement | CreateMaterializedViewStatement | RefreshMaterializedViewStatement | AlterTableStatement | AlterIndexStatement | AlterSequenceStatement | SetGlobalStatement | SetTimezone | SetNames | CreateEnumType | CreateCompositeType | TruncateTableStatement | DropStatement | CommentStatement | CreateSchemaStatement | WithRecursiveStatement | RaiseStatement | ValuesStatement | CreateFunctionStatement | DropFunctionStatement | DoStatement | BeginStatement | StartTransactionStatement;
export interface PGNode {

@@ -49,3 +49,3 @@ _location?: NodeLocation;

}
export declare type FunctionArgumentMode = 'in' | 'out' | 'inout' | 'variadic';
export type FunctionArgumentMode = 'in' | 'out' | 'inout' | 'variadic';
export interface FunctionArgument extends PGNode {

@@ -189,3 +189,3 @@ name?: Name;

}
export declare type IndexAlteration = IndexAlterationRename | IndexAlterationSetTablespace;
export type IndexAlteration = IndexAlterationRename | IndexAlterationSetTablespace;
export interface IndexAlterationRename {

@@ -246,3 +246,3 @@ type: 'rename';

}
export declare type TableAlteration = TableAlterationRename | TableAlterationRenameColumn | TableAlterationRenameConstraint | TableAlterationAddColumn | TableAlterationDropColumn | TableAlterationAlterColumn | TableAlterationAddConstraint | TableAlterationOwner | TableAlterationDropConstraint;
export type TableAlteration = TableAlterationRename | TableAlterationRenameColumn | TableAlterationRenameConstraint | TableAlterationAddColumn | TableAlterationDropColumn | TableAlterationAlterColumn | TableAlterationAddConstraint | TableAlterationOwner | TableAlterationDropConstraint;
export interface TableAlterationOwner extends PGNode {

@@ -272,3 +272,3 @@ type: 'owner';

}
export declare type AlterColumn = AlterColumnSetType | AlterColumnSetDefault | AlterColumnAddGenerated | AlterColumnSimple;
export type AlterColumn = AlterColumnSetType | AlterColumnSetDefault | AlterColumnAddGenerated | AlterColumnSimple;
/**

@@ -289,3 +289,3 @@ * FROM https://www.postgresql.org/docs/12/ddl-constraints.html

*/
export declare type ConstraintAction = 'cascade' | 'no action' | 'restrict' | 'set null' | 'set default';
export type ConstraintAction = 'cascade' | 'no action' | 'restrict' | 'set null' | 'set default';
export interface CreateIndexStatement extends PGNode {

@@ -391,3 +391,3 @@ type: 'create index';

}
export declare type DataTypeDef = ArrayDataTypeDef | BasicDataTypeDef;
export type DataTypeDef = ArrayDataTypeDef | BasicDataTypeDef;
export interface ArrayDataTypeDef extends PGNode {

@@ -404,3 +404,3 @@ kind: 'array';

}
export declare type ColumnConstraint = ColumnConstraintSimple | ColumnConstraintDefault | AlterColumnAddGenerated | ColumnConstraintReference | ColumnConstraintCheck;
export type ColumnConstraint = ColumnConstraintSimple | ColumnConstraintDefault | AlterColumnAddGenerated | ColumnConstraintReference | ColumnConstraintCheck;
export interface ColumnConstraintSimple extends PGNode {

@@ -430,4 +430,4 @@ type: 'unique' | 'primary key' | 'not null' | 'null';

}
export declare type TableConstraint = TableConstraintUnique | TableConstraintForeignKey | TableConstraintCheck;
export declare type TableConstraintCheck = ColumnConstraintCheck;
export type TableConstraint = TableConstraintUnique | TableConstraintForeignKey | TableConstraintCheck;
export type TableConstraintCheck = ColumnConstraintCheck;
export interface TableConstraintUnique extends PGNode {

@@ -446,3 +446,3 @@ type: 'primary key' | 'unique';

}
export declare type WithStatementBinding = SelectStatement | WithStatement | WithRecursiveStatement | InsertStatement | UpdateStatement | DeleteStatement;
export type WithStatementBinding = SelectStatement | WithStatement | WithRecursiveStatement | InsertStatement | UpdateStatement | DeleteStatement;
export interface WithStatement extends PGNode {

@@ -463,3 +463,3 @@ type: 'with';

}
export declare type SelectStatement = SelectFromStatement | SelectFromUnion | ValuesStatement | WithStatement | WithRecursiveStatement;
export type SelectStatement = SelectFromStatement | SelectFromUnion | ValuesStatement | WithStatement | WithRecursiveStatement;
export interface SelectFromStatement extends PGNode {

@@ -514,3 +514,3 @@ type: 'select';

}
export declare type From = FromTable | FromStatement | FromCall;
export type From = FromTable | FromStatement | FromCall;
export interface FromCall extends ExprCall, PGNode {

@@ -549,4 +549,4 @@ alias?: TableAliasName;

}
export declare type JoinType = 'INNER JOIN' | 'LEFT JOIN' | 'RIGHT JOIN' | 'FULL JOIN' | 'CROSS JOIN';
export declare type Expr = ExprRef | ExprParameter | ExprList | ExprArrayFromSelect | ExprNull | ExprExtract | ExprInteger | ExprDefault | ExprMember | ExprValueKeyword | ExprArrayIndex | ExprNumeric | ExprString | ExprCase | ExprBinary | ExprUnary | ExprCast | ExprBool | ExprCall | SelectStatement | WithStatement | ExprConstant | ExprTernary | ExprOverlay | ExprSubstring;
export type JoinType = 'INNER JOIN' | 'LEFT JOIN' | 'RIGHT JOIN' | 'FULL JOIN' | 'CROSS JOIN';
export type Expr = ExprRef | ExprParameter | ExprList | ExprArrayFromSelect | ExprNull | ExprExtract | ExprInteger | ExprDefault | ExprMember | ExprValueKeyword | ExprArrayIndex | ExprNumeric | ExprString | ExprCase | ExprBinary | ExprUnary | ExprCast | ExprBool | ExprCall | SelectStatement | WithStatement | ExprConstant | ExprTernary | ExprOverlay | ExprSubstring;
/**

@@ -569,10 +569,10 @@ * Handle special syntax: overlay('12345678' placing 'ab' from 2 for 4)

}
export declare type LogicOperator = 'OR' | 'AND';
export declare type EqualityOperator = 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'ILIKE' | 'NOT ILIKE' | '=' | '!=';
export declare type MathOpsBinary = '|' | '&' | '>>' | '^' | '#' | '<<' | '>>';
export declare type ComparisonOperator = '>' | '>=' | '<' | '<=' | '@>' | '<@' | '?' | '?|' | '?&' | '#>>' | '~' | '~*' | '!~' | '!~*' | '@@';
export declare type AdditiveOperator = '||' | '-' | '#-' | '&&' | '+';
export declare type MultiplicativeOperator = '*' | '%' | '/';
export declare type ConstructOperator = 'AT TIME ZONE';
export declare type BinaryOperator = LogicOperator | EqualityOperator | ComparisonOperator | AdditiveOperator | MultiplicativeOperator | MathOpsBinary | ConstructOperator;
export type LogicOperator = 'OR' | 'AND';
export type EqualityOperator = 'IN' | 'NOT IN' | 'LIKE' | 'NOT LIKE' | 'ILIKE' | 'NOT ILIKE' | '=' | '!=';
export type MathOpsBinary = '|' | '&' | '>>' | '^' | '#' | '<<' | '>>';
export type ComparisonOperator = '>' | '>=' | '<' | '<=' | '@>' | '<@' | '?' | '?|' | '?&' | '#>>' | '~' | '~*' | '!~' | '!~*' | '@@';
export type AdditiveOperator = '||' | '-' | '#-' | '&&' | '+';
export type MultiplicativeOperator = '*' | '%' | '/';
export type ConstructOperator = 'AT TIME ZONE';
export type BinaryOperator = LogicOperator | EqualityOperator | ComparisonOperator | AdditiveOperator | MultiplicativeOperator | MathOpsBinary | ConstructOperator;
export interface ExprBinary extends PGNode {

@@ -590,3 +590,3 @@ type: 'binary';

}
export declare type ExprLiteral = ExprConstant | ExprInteger | ExprNumeric | ExprString | ExprBool | ExprNull;
export type ExprLiteral = ExprConstant | ExprInteger | ExprNumeric | ExprString | ExprBool | ExprNull;
export interface ExprTernary extends PGNode {

@@ -604,3 +604,3 @@ type: 'ternary';

}
export declare type UnaryOperator = '+' | '-' | 'NOT' | 'IS NULL' | 'IS NOT NULL' | 'IS TRUE' | 'IS FALSE' | 'IS NOT TRUE' | 'IS NOT FALSE';
export type UnaryOperator = '+' | '-' | 'NOT' | 'IS NULL' | 'IS NOT NULL' | 'IS TRUE' | 'IS FALSE' | 'IS NOT TRUE' | 'IS NOT FALSE';
export interface ExprUnary extends PGNode {

@@ -631,3 +631,3 @@ type: 'unary';

}
export declare type ValueKeyword = 'current_catalog' | 'current_date' | 'current_role' | 'current_schema' | 'current_timestamp' | 'current_time' | 'localtimestamp' | 'localtime' | 'session_user' | 'user' | 'current_user' | 'distinct';
export type ValueKeyword = 'current_catalog' | 'current_date' | 'current_role' | 'current_schema' | 'current_timestamp' | 'current_time' | 'localtimestamp' | 'localtime' | 'session_user' | 'user' | 'current_user' | 'distinct';
/**

@@ -716,3 +716,3 @@ * Function calls.

}
export declare type SetTimezoneValue = {
export type SetTimezoneValue = {
type: 'value';

@@ -726,4 +726,12 @@ value: number | string;

};
declare type SetGlobalValueRaw = {
export interface SetNames extends PGNode {
type: 'set names';
to: SetNamesValue;
}
export type SetNamesValue = {
type: 'value';
value: string;
};
type SetGlobalValueRaw = {
type: 'value';
value: number | string;

@@ -735,3 +743,3 @@ } | {

};
export declare type SetGlobalValue = SetGlobalValueRaw | {
export type SetGlobalValue = SetGlobalValueRaw | {
type: 'default';

@@ -765,3 +773,3 @@ } | {

}
export declare type AlterSequenceChange = AlterSequenceSetOptions | AlterSequenceOwnerTo | AlterSequenceRename | AlterSequenceSetSchema;
export type AlterSequenceChange = AlterSequenceSetOptions | AlterSequenceOwnerTo | AlterSequenceRename | AlterSequenceSetSchema;
export interface AlterSequenceSetOptions extends CreateSequenceOptions, PGNode {

@@ -783,3 +791,3 @@ type: 'set options';

}
export declare type GeometricLiteral = Point | Line | Segment | Box | Path | Polygon | Circle;
export type GeometricLiteral = Point | Line | Segment | Box | Path | Polygon | Circle;
export interface Point {

@@ -795,4 +803,4 @@ x: number;

}
export declare type Segment = [Point, Point];
export declare type Box = [Point, Point];
export type Segment = [Point, Point];
export type Box = [Point, Point];
export interface Path {

@@ -802,3 +810,3 @@ closed: boolean;

}
export declare type Polygon = Point[];
export type Polygon = Point[];
export interface Circle {

@@ -805,0 +813,0 @@ c: Point;

@@ -17,3 +17,3 @@ interface NearleyToken {

}
declare type NearleySymbol = string | {
type NearleySymbol = string | {
literal: any;

@@ -20,0 +20,0 @@ } | {

import { IAstPartialMapper } from './ast-mapper';
import { ReplaceReturnType } from './utils';
export declare type IAstToSql = {
export type IAstToSql = {
readonly [key in keyof IAstPartialMapper]-?: ReplaceReturnType<IAstPartialMapper[key], string>;

@@ -5,0 +5,0 @@ };

@@ -1,10 +0,10 @@

export declare type Optional<T> = {
export type Optional<T> = {
[key in keyof T]?: T[key];
};
export declare type nil = undefined | null;
declare type Impossible<K extends keyof any> = {
export type nil = undefined | null;
type Impossible<K extends keyof any> = {
[P in K]: never;
};
export declare type NoExtraProperties<T, U extends T = T> = U & Impossible<Exclude<keyof U, keyof T>>;
export declare type ReplaceReturnType<T, TNewReturn> = T extends (...a: any) => any ? (...a: Parameters<T>) => TNewReturn : never;
export type NoExtraProperties<T, U extends T = T> = U & Impossible<Exclude<keyof U, keyof T>>;
export type ReplaceReturnType<T, TNewReturn> = T extends (...a: any) => any ? (...a: Parameters<T>) => TNewReturn : never;
export declare class NotSupported extends Error {

@@ -11,0 +11,0 @@ constructor(what?: string);

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 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

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