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

@pgtyped/query

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pgtyped/query - npm Package Compare versions

Comparing version 0.8.2 to 0.9.0

19

lib/loader/sql/index.js

@@ -123,2 +123,21 @@ "use strict";

}
/** strip JS-like comments from SQL statements */
exitIgnoredComment(ctx) {
if (!this.currentQuery.statement) {
return;
}
assert(this.currentQuery.statement);
const statement = this.currentQuery.statement;
const a = ctx.start.startIndex - statement.loc.a;
const b = ctx.stop.stopIndex - statement.loc.a + 1;
const body = statement.body;
assert(b);
const [partA, ignored, partB] = [
body.slice(0, a),
body.slice(a, b),
body.slice(b),
];
const strippedStatement = partA + ' '.repeat(b - a) + partB;
this.currentQuery.statement.body = strippedStatement;
}
enterParamId(ctx) {

@@ -125,0 +144,0 @@ const paramName = ctx.text;

@@ -91,2 +91,12 @@ "use strict";

});
test('Ignore inline comments in queries', () => {
const text = `
/* @name UpdateBooks */
UPDATE books
/* ignored comment */
SET name = :name, rank = :rank WHERE id = :id;
`;
const parseTree = index_1.default(text);
expect(parseTree).toMatchSnapshot();
});
//# sourceMappingURL=index.test.js.map

2

lib/loader/sql/parser/SQLParser.d.ts

@@ -135,2 +135,4 @@ import { ATN } from "antlr4ts/atn/ATN";

word(i: number): WordContext;
ignoredComment(): IgnoredCommentContext[];
ignoredComment(i: number): IgnoredCommentContext;
param(): ParamContext[];

@@ -137,0 +139,0 @@ param(i: number): ParamContext;

184

lib/loader/sql/parser/SQLParser.js

@@ -263,13 +263,19 @@ "use strict";

this.word();
this.state = 81;
this.state = 82;
this._errHandler.sync(this);
_la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << SQLParser.ID) | (1 << SQLParser.WORD) | (1 << SQLParser.STRING) | (1 << SQLParser.PARAM_MARK))) !== 0)) {
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << SQLParser.ID) | (1 << SQLParser.OPEN_COMMENT) | (1 << SQLParser.WORD) | (1 << SQLParser.STRING) | (1 << SQLParser.PARAM_MARK))) !== 0)) {
{
this.state = 79;
this.state = 80;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case SQLParser.OPEN_COMMENT:
{
this.state = 77;
this.ignoredComment();
}
break;
case SQLParser.PARAM_MARK:
{
this.state = 77;
this.state = 78;
this.param();

@@ -282,3 +288,3 @@ }

{
this.state = 78;
this.state = 79;
this.word();

@@ -291,3 +297,3 @@ }

}
this.state = 83;
this.state = 84;
this._errHandler.sync(this);

@@ -321,3 +327,3 @@ _la = this._input.LA(1);

{
this.state = 84;
this.state = 85;
_la = this._input.LA(1);

@@ -358,5 +364,5 @@ if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << SQLParser.ID) | (1 << SQLParser.WORD) | (1 << SQLParser.STRING))) !== 0))) {

{
this.state = 86;
this.state = 87;
this.match(SQLParser.PARAM_MARK);
this.state = 87;
this.state = 88;
this.paramId();

@@ -387,3 +393,3 @@ }

{
this.state = 89;
this.state = 90;
this.match(SQLParser.ID);

@@ -414,5 +420,5 @@ }

{
this.state = 91;
this.state = 92;
this.match(SQLParser.NAME_TAG);
this.state = 92;
this.state = 93;
this.queryName();

@@ -443,7 +449,7 @@ }

{
this.state = 94;
this.state = 95;
this.match(SQLParser.TYPE_TAG);
this.state = 95;
this.state = 96;
this.paramName();
this.state = 96;
this.state = 97;
this.paramTransform();

@@ -474,5 +480,5 @@ }

{
this.state = 98;
this.state = 99;
this.match(SQLParser.TRANSFORM_ARROW);
this.state = 99;
this.state = 100;
this.transformRule();

@@ -501,3 +507,3 @@ }

try {
this.state = 104;
this.state = 105;
this._errHandler.sync(this);

@@ -508,3 +514,3 @@ switch (this.interpreter.adaptivePredict(this._input, 6, this._ctx)) {

{
this.state = 101;
this.state = 102;
this.spreadTransform();

@@ -516,3 +522,3 @@ }

{
this.state = 102;
this.state = 103;
this.pickTransform();

@@ -524,3 +530,3 @@ }

{
this.state = 103;
this.state = 104;
this.spreadPickTransform();

@@ -553,7 +559,7 @@ }

{
this.state = 106;
this.state = 107;
this.match(SQLParser.OB);
this.state = 107;
this.state = 108;
this.match(SQLParser.SPREAD);
this.state = 108;
this.state = 109;
this.match(SQLParser.CB);

@@ -586,7 +592,7 @@ }

{
this.state = 110;
this.state = 111;
this.match(SQLParser.OB);
this.state = 111;
this.state = 112;
this.key();
this.state = 116;
this.state = 117;
this._errHandler.sync(this);

@@ -598,5 +604,5 @@ _alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx);

{
this.state = 112;
this.state = 113;
this.match(SQLParser.COMMA);
this.state = 113;
this.state = 114;
this.key();

@@ -606,7 +612,7 @@ }

}
this.state = 118;
this.state = 119;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx);
}
this.state = 120;
this.state = 121;
this._errHandler.sync(this);

@@ -616,7 +622,7 @@ _la = this._input.LA(1);

{
this.state = 119;
this.state = 120;
this.match(SQLParser.COMMA);
}
}
this.state = 122;
this.state = 123;
this.match(SQLParser.CB);

@@ -647,9 +653,9 @@ }

{
this.state = 124;
this.state = 125;
this.match(SQLParser.OB);
this.state = 125;
this.state = 126;
this.pickTransform();
this.state = 126;
this.state = 127;
this.match(SQLParser.SPREAD);
this.state = 127;
this.state = 128;
this.match(SQLParser.CB);

@@ -680,3 +686,3 @@ }

{
this.state = 129;
this.state = 130;
this.match(SQLParser.ID);

@@ -707,3 +713,3 @@ }

{
this.state = 131;
this.state = 132;
this.match(SQLParser.ID);

@@ -734,3 +740,3 @@ }

{
this.state = 133;
this.state = 134;
this.match(SQLParser.ID);

@@ -817,3 +823,3 @@ }

SQLParser.VOCABULARY = new VocabularyImpl_1.VocabularyImpl(SQLParser._LITERAL_NAMES, SQLParser._SYMBOLIC_NAMES, []);
SQLParser._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x14\x8A\x04\x02" +
SQLParser._serializedATN = "\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x14\x8B\x04\x02" +
"\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" +

@@ -826,46 +832,46 @@ "\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r\x04" +

"\x03\x04\x03\x05\x03\x05\x07\x05E\n\x05\f\x05\x0E\x05H\v\x05\x03\x05\x03" +
"\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\x07\x07\x07R\n\x07\f" +
"\x07\x0E\x07U\v\x07\x03\b\x03\b\x03\t\x03\t\x03\t\x03\n\x03\n\x03\v\x03" +
"\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03\r\x03\x0E\x03\x0E\x03" +
"\x0E\x05\x0Ek\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x03\x10\x03\x10\x03" +
"\x10\x03\x10\x07\x10u\n\x10\f\x10\x0E\x10x\v\x10\x03\x10\x05\x10{\n\x10" +
"\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x12\x03\x12" +
"\x03\x13\x03\x13\x03\x14\x03\x14\x03\x14\x03F\x02\x02\x15\x02\x02\x04" +
"\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02\x16\x02" +
"\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02\x02\x04\x03\x02" +
"\r\r\x05\x02\x03\x03\x05\x05\b\b\x02\x80\x02/\x03\x02\x02\x02\x045\x03" +
"\x02\x02\x02\x068\x03\x02\x02\x02\bB\x03\x02\x02\x02\nK\x03\x02\x02\x02" +
"\fN\x03\x02\x02\x02\x0EV\x03\x02\x02\x02\x10X\x03\x02\x02\x02\x12[\x03" +
"\x02\x02\x02\x14]\x03\x02\x02\x02\x16`\x03\x02\x02\x02\x18d\x03\x02\x02" +
"\x02\x1Aj\x03\x02\x02\x02\x1Cl\x03\x02\x02\x02\x1Ep\x03\x02\x02\x02 ~" +
"\x03\x02\x02\x02\"\x83\x03\x02\x02\x02$\x85\x03\x02\x02\x02&\x87\x03\x02" +
"\x02\x02(*\x05\b\x05\x02)(\x03\x02\x02\x02*-\x03\x02\x02\x02+)\x03\x02" +
"\x02\x02+,\x03\x02\x02\x02,.\x03\x02\x02\x02-+\x03\x02\x02\x02.0\x05\x04" +
"\x03\x02/+\x03\x02\x02\x0201\x03\x02\x02\x021/\x03\x02\x02\x0212\x03\x02" +
"\x02\x0223\x03\x02\x02\x0234\x07\x02\x02\x034\x03\x03\x02\x02\x0256\x05" +
"\x06\x04\x0267\x05\n\x06\x027\x05\x03\x02\x02\x0289\x07\x04\x02\x029=" +
"\x05\x14\v\x02:<\x05\x16\f\x02;:\x03\x02\x02\x02<?\x03\x02\x02\x02=;\x03" +
"\x02\x02\x02=>\x03\x02\x02\x02>@\x03\x02\x02\x02?=\x03\x02\x02\x02@A\x07" +
"\x13\x02\x02A\x07\x03\x02\x02\x02BF\x07\x04\x02\x02CE\n\x02\x02\x02DC" +
"\x03\x02\x02\x02EH\x03\x02\x02\x02FG\x03\x02\x02\x02FD\x03\x02\x02\x02" +
"GI\x03\x02\x02\x02HF\x03\x02\x02\x02IJ\x07\x13\x02\x02J\t\x03\x02\x02" +
"\x02KL\x05\f\x07\x02LM\x07\x06\x02\x02M\v\x03\x02\x02\x02NS\x05\x0E\b" +
"\x02OR\x05\x10\t\x02PR\x05\x0E\b\x02QO\x03\x02\x02\x02QP\x03\x02\x02\x02" +
"RU\x03\x02\x02\x02SQ\x03\x02\x02\x02ST\x03\x02\x02\x02T\r\x03\x02\x02" +
"\x02US\x03\x02\x02\x02VW\t\x03\x02\x02W\x0F\x03\x02\x02\x02XY\x07\t\x02" +
"\x02YZ\x05\x12\n\x02Z\x11\x03\x02\x02\x02[\\\x07\x03\x02\x02\\\x13\x03" +
"\x02\x02\x02]^\x07\r\x02\x02^_\x05$\x13\x02_\x15\x03\x02\x02\x02`a\x07" +
"\x0E\x02\x02ab\x05&\x14\x02bc\x05\x18\r\x02c\x17\x03\x02\x02\x02de\x07" +
"\v\x02\x02ef\x05\x1A\x0E\x02f\x19\x03\x02\x02\x02gk\x05\x1C\x0F\x02hk" +
"\x05\x1E\x10\x02ik\x05 \x11\x02jg\x03\x02\x02\x02jh\x03\x02\x02\x02ji" +
"\x03\x02\x02\x02k\x1B\x03\x02\x02\x02lm\x07\x0F\x02\x02mn\x07\f\x02\x02" +
"no\x07\x10\x02\x02o\x1D\x03\x02\x02\x02pq\x07\x0F\x02\x02qv\x05\"\x12" +
"\x02rs\x07\x11\x02\x02su\x05\"\x12\x02tr\x03\x02\x02\x02ux\x03\x02\x02" +
"\x02vt\x03\x02\x02\x02vw\x03\x02\x02\x02wz\x03\x02\x02\x02xv\x03\x02\x02" +
"\x02y{\x07\x11\x02\x02zy\x03\x02\x02\x02z{\x03\x02\x02\x02{|\x03\x02\x02" +
"\x02|}\x07\x10\x02\x02}\x1F\x03\x02\x02\x02~\x7F\x07\x0F\x02\x02\x7F\x80" +
"\x05\x1E\x10\x02\x80\x81\x07\f\x02\x02\x81\x82\x07\x10\x02\x02\x82!\x03" +
"\x02\x02\x02\x83\x84\x07\x03\x02\x02\x84#\x03\x02\x02\x02\x85\x86\x07" +
"\x03\x02\x02\x86%\x03\x02\x02\x02\x87\x88\x07\x03\x02\x02\x88\'\x03\x02" +
"\x02\x02\v+1=FQSjvz";
"\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\x07\x03\x07\x07\x07S" +
"\n\x07\f\x07\x0E\x07V\v\x07\x03\b\x03\b\x03\t\x03\t\x03\t\x03\n\x03\n" +
"\x03\v\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03\r\x03\x0E\x03" +
"\x0E\x03\x0E\x05\x0El\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x03\x10\x03" +
"\x10\x03\x10\x03\x10\x07\x10v\n\x10\f\x10\x0E\x10y\v\x10\x03\x10\x05\x10" +
"|\n\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x12" +
"\x03\x12\x03\x13\x03\x13\x03\x14\x03\x14\x03\x14\x03F\x02\x02\x15\x02" +
"\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02" +
"\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02\x02\x04" +
"\x03\x02\r\r\x05\x02\x03\x03\x05\x05\b\b\x02\x82\x02/\x03\x02\x02\x02" +
"\x045\x03\x02\x02\x02\x068\x03\x02\x02\x02\bB\x03\x02\x02\x02\nK\x03\x02" +
"\x02\x02\fN\x03\x02\x02\x02\x0EW\x03\x02\x02\x02\x10Y\x03\x02\x02\x02" +
"\x12\\\x03\x02\x02\x02\x14^\x03\x02\x02\x02\x16a\x03\x02\x02\x02\x18e" +
"\x03\x02\x02\x02\x1Ak\x03\x02\x02\x02\x1Cm\x03\x02\x02\x02\x1Eq\x03\x02" +
"\x02\x02 \x7F\x03\x02\x02\x02\"\x84\x03\x02\x02\x02$\x86\x03\x02\x02\x02" +
"&\x88\x03\x02\x02\x02(*\x05\b\x05\x02)(\x03\x02\x02\x02*-\x03\x02\x02" +
"\x02+)\x03\x02\x02\x02+,\x03\x02\x02\x02,.\x03\x02\x02\x02-+\x03\x02\x02" +
"\x02.0\x05\x04\x03\x02/+\x03\x02\x02\x0201\x03\x02\x02\x021/\x03\x02\x02" +
"\x0212\x03\x02\x02\x0223\x03\x02\x02\x0234\x07\x02\x02\x034\x03\x03\x02" +
"\x02\x0256\x05\x06\x04\x0267\x05\n\x06\x027\x05\x03\x02\x02\x0289\x07" +
"\x04\x02\x029=\x05\x14\v\x02:<\x05\x16\f\x02;:\x03\x02\x02\x02<?\x03\x02" +
"\x02\x02=;\x03\x02\x02\x02=>\x03\x02\x02\x02>@\x03\x02\x02\x02?=\x03\x02" +
"\x02\x02@A\x07\x13\x02\x02A\x07\x03\x02\x02\x02BF\x07\x04\x02\x02CE\n" +
"\x02\x02\x02DC\x03\x02\x02\x02EH\x03\x02\x02\x02FG\x03\x02\x02\x02FD\x03" +
"\x02\x02\x02GI\x03\x02\x02\x02HF\x03\x02\x02\x02IJ\x07\x13\x02\x02J\t" +
"\x03\x02\x02\x02KL\x05\f\x07\x02LM\x07\x06\x02\x02M\v\x03\x02\x02\x02" +
"NT\x05\x0E\b\x02OS\x05\b\x05\x02PS\x05\x10\t\x02QS\x05\x0E\b\x02RO\x03" +
"\x02\x02\x02RP\x03\x02\x02\x02RQ\x03\x02\x02\x02SV\x03\x02\x02\x02TR\x03" +
"\x02\x02\x02TU\x03\x02\x02\x02U\r\x03\x02\x02\x02VT\x03\x02\x02\x02WX" +
"\t\x03\x02\x02X\x0F\x03\x02\x02\x02YZ\x07\t\x02\x02Z[\x05\x12\n\x02[\x11" +
"\x03\x02\x02\x02\\]\x07\x03\x02\x02]\x13\x03\x02\x02\x02^_\x07\r\x02\x02" +
"_`\x05$\x13\x02`\x15\x03\x02\x02\x02ab\x07\x0E\x02\x02bc\x05&\x14\x02" +
"cd\x05\x18\r\x02d\x17\x03\x02\x02\x02ef\x07\v\x02\x02fg\x05\x1A\x0E\x02" +
"g\x19\x03\x02\x02\x02hl\x05\x1C\x0F\x02il\x05\x1E\x10\x02jl\x05 \x11\x02" +
"kh\x03\x02\x02\x02ki\x03\x02\x02\x02kj\x03\x02\x02\x02l\x1B\x03\x02\x02" +
"\x02mn\x07\x0F\x02\x02no\x07\f\x02\x02op\x07\x10\x02\x02p\x1D\x03\x02" +
"\x02\x02qr\x07\x0F\x02\x02rw\x05\"\x12\x02st\x07\x11\x02\x02tv\x05\"\x12" +
"\x02us\x03\x02\x02\x02vy\x03\x02\x02\x02wu\x03\x02\x02\x02wx\x03\x02\x02" +
"\x02x{\x03\x02\x02\x02yw\x03\x02\x02\x02z|\x07\x11\x02\x02{z\x03\x02\x02" +
"\x02{|\x03\x02\x02\x02|}\x03\x02\x02\x02}~\x07\x10\x02\x02~\x1F\x03\x02" +
"\x02\x02\x7F\x80\x07\x0F\x02\x02\x80\x81\x05\x1E\x10\x02\x81\x82\x07\f" +
"\x02\x02\x82\x83\x07\x10\x02\x02\x83!\x03\x02\x02\x02\x84\x85\x07\x03" +
"\x02\x02\x85#\x03\x02\x02\x02\x86\x87\x07\x03\x02\x02\x87%\x03\x02\x02" +
"\x02\x88\x89\x07\x03\x02\x02\x89\'\x03\x02\x02\x02\v+1=FRTkw{";
class InputContext extends ParserRuleContext_1.ParserRuleContext {

@@ -1075,2 +1081,10 @@ EOF() { return this.getToken(SQLParser.EOF, 0); }

}
ignoredComment(i) {
if (i === undefined) {
return this.getRuleContexts(IgnoredCommentContext);
}
else {
return this.getRuleContext(i, IgnoredCommentContext);
}
}
param(i) {

@@ -1077,0 +1091,0 @@ if (i === undefined) {

import { Query as QueryAST } from './loader/sql';
import { TSQueryAST } from './loader/typescript';
interface IDatabaseConnection {
export interface IDatabaseConnection {
query: (query: string, bindings: any[]) => Promise<{

@@ -5,0 +5,0 @@ rows: any[];

{
"name": "@pgtyped/query",
"version": "0.8.2",
"version": "0.9.0",
"main": "lib/index.js",

@@ -27,3 +27,3 @@ "types": "lib/index.d.ts",

"dependencies": {
"@pgtyped/wire": "^0.8.0",
"@pgtyped/wire": "^0.9.0",
"@types/chalk": "^2.2.0",

@@ -41,3 +41,3 @@ "@types/debug": "^4.1.4",

},
"gitHead": "c51982b1ebfabeb09b43ea8511646170f9295aaf"
"gitHead": "ef0a980b5ef6f414129de066bee2e02553fd457e"
}

@@ -9,2 +9,3 @@ ## @pgtyped/query

The `sql.run` method automatically enforces correct input `TParams` and output `TResult` types.
```js

@@ -16,3 +17,5 @@ public run: (

```
Here `dbConnection` is any object that satisifies the `IDatabaseConnection` interface. It is used to actually send the query to the DB for execution.
```

@@ -23,2 +26,3 @@ interface IDatabaseConnection {

```
This is usually the `client` object created with [node-postgres](https://github.com/brianc/node-postgres), but can be any other connection of your choice.

@@ -25,0 +29,0 @@

@@ -96,1 +96,12 @@ import parse from './index';

});
test('Ignore inline comments in queries', () => {
const text = `
/* @name UpdateBooks */
UPDATE books
/* ignored comment */
SET name = :name, rank = :rank WHERE id = :id;
`;
const parseTree = parse(text);
expect(parseTree).toMatchSnapshot();
});

@@ -6,2 +6,3 @@ import { SQLParserListener } from './parser/SQLParserListener';

import {
IgnoredCommentContext,
KeyContext,

@@ -188,2 +189,22 @@ ParamIdContext,

/** strip JS-like comments from SQL statements */
exitIgnoredComment(ctx: IgnoredCommentContext) {
if (!this.currentQuery.statement) {
return;
}
assert(this.currentQuery.statement);
const statement = this.currentQuery.statement;
const a = ctx.start.startIndex - statement.loc.a;
const b = ctx.stop!.stopIndex - statement.loc.a + 1;
const body = statement.body;
assert(b);
const [partA, ignored, partB] = [
body.slice(0, a),
body.slice(a, b),
body.slice(b),
];
const strippedStatement = partA + ' '.repeat(b - a) + partB;
this.currentQuery.statement.body = strippedStatement;
}
enterParamId(ctx: ParamIdContext) {

@@ -190,0 +211,0 @@ const paramName = ctx.text;

@@ -328,13 +328,19 @@ // Generated from src/loader/sql/grammar/SQLParser.g4 by ANTLR 4.7.3-SNAPSHOT

this.word();
this.state = 81;
this.state = 82;
this._errHandler.sync(this);
_la = this._input.LA(1);
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << SQLParser.ID) | (1 << SQLParser.WORD) | (1 << SQLParser.STRING) | (1 << SQLParser.PARAM_MARK))) !== 0)) {
while ((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << SQLParser.ID) | (1 << SQLParser.OPEN_COMMENT) | (1 << SQLParser.WORD) | (1 << SQLParser.STRING) | (1 << SQLParser.PARAM_MARK))) !== 0)) {
{
this.state = 79;
this.state = 80;
this._errHandler.sync(this);
switch (this._input.LA(1)) {
case SQLParser.OPEN_COMMENT:
{
this.state = 77;
this.ignoredComment();
}
break;
case SQLParser.PARAM_MARK:
{
this.state = 77;
this.state = 78;
this.param();

@@ -347,3 +353,3 @@ }

{
this.state = 78;
this.state = 79;
this.word();

@@ -356,3 +362,3 @@ }

}
this.state = 83;
this.state = 84;
this._errHandler.sync(this);

@@ -385,3 +391,3 @@ _la = this._input.LA(1);

{
this.state = 84;
this.state = 85;
_la = this._input.LA(1);

@@ -421,5 +427,5 @@ if (!((((_la) & ~0x1F) === 0 && ((1 << _la) & ((1 << SQLParser.ID) | (1 << SQLParser.WORD) | (1 << SQLParser.STRING))) !== 0))) {

{
this.state = 86;
this.state = 87;
this.match(SQLParser.PARAM_MARK);
this.state = 87;
this.state = 88;
this.paramId();

@@ -449,3 +455,3 @@ }

{
this.state = 89;
this.state = 90;
this.match(SQLParser.ID);

@@ -475,5 +481,5 @@ }

{
this.state = 91;
this.state = 92;
this.match(SQLParser.NAME_TAG);
this.state = 92;
this.state = 93;
this.queryName();

@@ -503,7 +509,7 @@ }

{
this.state = 94;
this.state = 95;
this.match(SQLParser.TYPE_TAG);
this.state = 95;
this.state = 96;
this.paramName();
this.state = 96;
this.state = 97;
this.paramTransform();

@@ -533,5 +539,5 @@ }

{
this.state = 98;
this.state = 99;
this.match(SQLParser.TRANSFORM_ARROW);
this.state = 99;
this.state = 100;
this.transformRule();

@@ -559,3 +565,3 @@ }

try {
this.state = 104;
this.state = 105;
this._errHandler.sync(this);

@@ -566,3 +572,3 @@ switch ( this.interpreter.adaptivePredict(this._input, 6, this._ctx) ) {

{
this.state = 101;
this.state = 102;
this.spreadTransform();

@@ -575,3 +581,3 @@ }

{
this.state = 102;
this.state = 103;
this.pickTransform();

@@ -584,3 +590,3 @@ }

{
this.state = 103;
this.state = 104;
this.spreadPickTransform();

@@ -612,7 +618,7 @@ }

{
this.state = 106;
this.state = 107;
this.match(SQLParser.OB);
this.state = 107;
this.state = 108;
this.match(SQLParser.SPREAD);
this.state = 108;
this.state = 109;
this.match(SQLParser.CB);

@@ -644,7 +650,7 @@ }

{
this.state = 110;
this.state = 111;
this.match(SQLParser.OB);
this.state = 111;
this.state = 112;
this.key();
this.state = 116;
this.state = 117;
this._errHandler.sync(this);

@@ -656,5 +662,5 @@ _alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx);

{
this.state = 112;
this.state = 113;
this.match(SQLParser.COMMA);
this.state = 113;
this.state = 114;
this.key();

@@ -664,7 +670,7 @@ }

}
this.state = 118;
this.state = 119;
this._errHandler.sync(this);
_alt = this.interpreter.adaptivePredict(this._input, 7, this._ctx);
}
this.state = 120;
this.state = 121;
this._errHandler.sync(this);

@@ -674,3 +680,3 @@ _la = this._input.LA(1);

{
this.state = 119;
this.state = 120;
this.match(SQLParser.COMMA);

@@ -680,3 +686,3 @@ }

this.state = 122;
this.state = 123;
this.match(SQLParser.CB);

@@ -706,9 +712,9 @@ }

{
this.state = 124;
this.state = 125;
this.match(SQLParser.OB);
this.state = 125;
this.state = 126;
this.pickTransform();
this.state = 126;
this.state = 127;
this.match(SQLParser.SPREAD);
this.state = 127;
this.state = 128;
this.match(SQLParser.CB);

@@ -738,3 +744,3 @@ }

{
this.state = 129;
this.state = 130;
this.match(SQLParser.ID);

@@ -764,3 +770,3 @@ }

{
this.state = 131;
this.state = 132;
this.match(SQLParser.ID);

@@ -790,3 +796,3 @@ }

{
this.state = 133;
this.state = 134;
this.match(SQLParser.ID);

@@ -811,3 +817,3 @@ }

public static readonly _serializedATN: string =
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x14\x8A\x04\x02" +
"\x03\uC91D\uCABA\u058D\uAFBA\u4F53\u0607\uEA8B\uC241\x03\x14\x8B\x04\x02" +
"\t\x02\x04\x03\t\x03\x04\x04\t\x04\x04\x05\t\x05\x04\x06\t\x06\x04\x07" +

@@ -820,46 +826,46 @@ "\t\x07\x04\b\t\b\x04\t\t\t\x04\n\t\n\x04\v\t\v\x04\f\t\f\x04\r\t\r\x04" +

"\x03\x04\x03\x05\x03\x05\x07\x05E\n\x05\f\x05\x0E\x05H\v\x05\x03\x05\x03" +
"\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\x07\x07\x07R\n\x07\f" +
"\x07\x0E\x07U\v\x07\x03\b\x03\b\x03\t\x03\t\x03\t\x03\n\x03\n\x03\v\x03" +
"\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03\r\x03\x0E\x03\x0E\x03" +
"\x0E\x05\x0Ek\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x03\x10\x03\x10\x03" +
"\x10\x03\x10\x07\x10u\n\x10\f\x10\x0E\x10x\v\x10\x03\x10\x05\x10{\n\x10" +
"\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x12\x03\x12" +
"\x03\x13\x03\x13\x03\x14\x03\x14\x03\x14\x03F\x02\x02\x15\x02\x02\x04" +
"\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02\x16\x02" +
"\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02\x02\x04\x03\x02" +
"\r\r\x05\x02\x03\x03\x05\x05\b\b\x02\x80\x02/\x03\x02\x02\x02\x045\x03" +
"\x02\x02\x02\x068\x03\x02\x02\x02\bB\x03\x02\x02\x02\nK\x03\x02\x02\x02" +
"\fN\x03\x02\x02\x02\x0EV\x03\x02\x02\x02\x10X\x03\x02\x02\x02\x12[\x03" +
"\x02\x02\x02\x14]\x03\x02\x02\x02\x16`\x03\x02\x02\x02\x18d\x03\x02\x02" +
"\x02\x1Aj\x03\x02\x02\x02\x1Cl\x03\x02\x02\x02\x1Ep\x03\x02\x02\x02 ~" +
"\x03\x02\x02\x02\"\x83\x03\x02\x02\x02$\x85\x03\x02\x02\x02&\x87\x03\x02" +
"\x02\x02(*\x05\b\x05\x02)(\x03\x02\x02\x02*-\x03\x02\x02\x02+)\x03\x02" +
"\x02\x02+,\x03\x02\x02\x02,.\x03\x02\x02\x02-+\x03\x02\x02\x02.0\x05\x04" +
"\x03\x02/+\x03\x02\x02\x0201\x03\x02\x02\x021/\x03\x02\x02\x0212\x03\x02" +
"\x02\x0223\x03\x02\x02\x0234\x07\x02\x02\x034\x03\x03\x02\x02\x0256\x05" +
"\x06\x04\x0267\x05\n\x06\x027\x05\x03\x02\x02\x0289\x07\x04\x02\x029=" +
"\x05\x14\v\x02:<\x05\x16\f\x02;:\x03\x02\x02\x02<?\x03\x02\x02\x02=;\x03" +
"\x02\x02\x02=>\x03\x02\x02\x02>@\x03\x02\x02\x02?=\x03\x02\x02\x02@A\x07" +
"\x13\x02\x02A\x07\x03\x02\x02\x02BF\x07\x04\x02\x02CE\n\x02\x02\x02DC" +
"\x03\x02\x02\x02EH\x03\x02\x02\x02FG\x03\x02\x02\x02FD\x03\x02\x02\x02" +
"GI\x03\x02\x02\x02HF\x03\x02\x02\x02IJ\x07\x13\x02\x02J\t\x03\x02\x02" +
"\x02KL\x05\f\x07\x02LM\x07\x06\x02\x02M\v\x03\x02\x02\x02NS\x05\x0E\b" +
"\x02OR\x05\x10\t\x02PR\x05\x0E\b\x02QO\x03\x02\x02\x02QP\x03\x02\x02\x02" +
"RU\x03\x02\x02\x02SQ\x03\x02\x02\x02ST\x03\x02\x02\x02T\r\x03\x02\x02" +
"\x02US\x03\x02\x02\x02VW\t\x03\x02\x02W\x0F\x03\x02\x02\x02XY\x07\t\x02" +
"\x02YZ\x05\x12\n\x02Z\x11\x03\x02\x02\x02[\\\x07\x03\x02\x02\\\x13\x03" +
"\x02\x02\x02]^\x07\r\x02\x02^_\x05$\x13\x02_\x15\x03\x02\x02\x02`a\x07" +
"\x0E\x02\x02ab\x05&\x14\x02bc\x05\x18\r\x02c\x17\x03\x02\x02\x02de\x07" +
"\v\x02\x02ef\x05\x1A\x0E\x02f\x19\x03\x02\x02\x02gk\x05\x1C\x0F\x02hk" +
"\x05\x1E\x10\x02ik\x05 \x11\x02jg\x03\x02\x02\x02jh\x03\x02\x02\x02ji" +
"\x03\x02\x02\x02k\x1B\x03\x02\x02\x02lm\x07\x0F\x02\x02mn\x07\f\x02\x02" +
"no\x07\x10\x02\x02o\x1D\x03\x02\x02\x02pq\x07\x0F\x02\x02qv\x05\"\x12" +
"\x02rs\x07\x11\x02\x02su\x05\"\x12\x02tr\x03\x02\x02\x02ux\x03\x02\x02" +
"\x02vt\x03\x02\x02\x02vw\x03\x02\x02\x02wz\x03\x02\x02\x02xv\x03\x02\x02" +
"\x02y{\x07\x11\x02\x02zy\x03\x02\x02\x02z{\x03\x02\x02\x02{|\x03\x02\x02" +
"\x02|}\x07\x10\x02\x02}\x1F\x03\x02\x02\x02~\x7F\x07\x0F\x02\x02\x7F\x80" +
"\x05\x1E\x10\x02\x80\x81\x07\f\x02\x02\x81\x82\x07\x10\x02\x02\x82!\x03" +
"\x02\x02\x02\x83\x84\x07\x03\x02\x02\x84#\x03\x02\x02\x02\x85\x86\x07" +
"\x03\x02\x02\x86%\x03\x02\x02\x02\x87\x88\x07\x03\x02\x02\x88\'\x03\x02" +
"\x02\x02\v+1=FQSjvz";
"\x05\x03\x06\x03\x06\x03\x06\x03\x07\x03\x07\x03\x07\x03\x07\x07\x07S" +
"\n\x07\f\x07\x0E\x07V\v\x07\x03\b\x03\b\x03\t\x03\t\x03\t\x03\n\x03\n" +
"\x03\v\x03\v\x03\v\x03\f\x03\f\x03\f\x03\f\x03\r\x03\r\x03\r\x03\x0E\x03" +
"\x0E\x03\x0E\x05\x0El\n\x0E\x03\x0F\x03\x0F\x03\x0F\x03\x0F\x03\x10\x03" +
"\x10\x03\x10\x03\x10\x07\x10v\n\x10\f\x10\x0E\x10y\v\x10\x03\x10\x05\x10" +
"|\n\x10\x03\x10\x03\x10\x03\x11\x03\x11\x03\x11\x03\x11\x03\x11\x03\x12" +
"\x03\x12\x03\x13\x03\x13\x03\x14\x03\x14\x03\x14\x03F\x02\x02\x15\x02" +
"\x02\x04\x02\x06\x02\b\x02\n\x02\f\x02\x0E\x02\x10\x02\x12\x02\x14\x02" +
"\x16\x02\x18\x02\x1A\x02\x1C\x02\x1E\x02 \x02\"\x02$\x02&\x02\x02\x04" +
"\x03\x02\r\r\x05\x02\x03\x03\x05\x05\b\b\x02\x82\x02/\x03\x02\x02\x02" +
"\x045\x03\x02\x02\x02\x068\x03\x02\x02\x02\bB\x03\x02\x02\x02\nK\x03\x02" +
"\x02\x02\fN\x03\x02\x02\x02\x0EW\x03\x02\x02\x02\x10Y\x03\x02\x02\x02" +
"\x12\\\x03\x02\x02\x02\x14^\x03\x02\x02\x02\x16a\x03\x02\x02\x02\x18e" +
"\x03\x02\x02\x02\x1Ak\x03\x02\x02\x02\x1Cm\x03\x02\x02\x02\x1Eq\x03\x02" +
"\x02\x02 \x7F\x03\x02\x02\x02\"\x84\x03\x02\x02\x02$\x86\x03\x02\x02\x02" +
"&\x88\x03\x02\x02\x02(*\x05\b\x05\x02)(\x03\x02\x02\x02*-\x03\x02\x02" +
"\x02+)\x03\x02\x02\x02+,\x03\x02\x02\x02,.\x03\x02\x02\x02-+\x03\x02\x02" +
"\x02.0\x05\x04\x03\x02/+\x03\x02\x02\x0201\x03\x02\x02\x021/\x03\x02\x02" +
"\x0212\x03\x02\x02\x0223\x03\x02\x02\x0234\x07\x02\x02\x034\x03\x03\x02" +
"\x02\x0256\x05\x06\x04\x0267\x05\n\x06\x027\x05\x03\x02\x02\x0289\x07" +
"\x04\x02\x029=\x05\x14\v\x02:<\x05\x16\f\x02;:\x03\x02\x02\x02<?\x03\x02" +
"\x02\x02=;\x03\x02\x02\x02=>\x03\x02\x02\x02>@\x03\x02\x02\x02?=\x03\x02" +
"\x02\x02@A\x07\x13\x02\x02A\x07\x03\x02\x02\x02BF\x07\x04\x02\x02CE\n" +
"\x02\x02\x02DC\x03\x02\x02\x02EH\x03\x02\x02\x02FG\x03\x02\x02\x02FD\x03" +
"\x02\x02\x02GI\x03\x02\x02\x02HF\x03\x02\x02\x02IJ\x07\x13\x02\x02J\t" +
"\x03\x02\x02\x02KL\x05\f\x07\x02LM\x07\x06\x02\x02M\v\x03\x02\x02\x02" +
"NT\x05\x0E\b\x02OS\x05\b\x05\x02PS\x05\x10\t\x02QS\x05\x0E\b\x02RO\x03" +
"\x02\x02\x02RP\x03\x02\x02\x02RQ\x03\x02\x02\x02SV\x03\x02\x02\x02TR\x03" +
"\x02\x02\x02TU\x03\x02\x02\x02U\r\x03\x02\x02\x02VT\x03\x02\x02\x02WX" +
"\t\x03\x02\x02X\x0F\x03\x02\x02\x02YZ\x07\t\x02\x02Z[\x05\x12\n\x02[\x11" +
"\x03\x02\x02\x02\\]\x07\x03\x02\x02]\x13\x03\x02\x02\x02^_\x07\r\x02\x02" +
"_`\x05$\x13\x02`\x15\x03\x02\x02\x02ab\x07\x0E\x02\x02bc\x05&\x14\x02" +
"cd\x05\x18\r\x02d\x17\x03\x02\x02\x02ef\x07\v\x02\x02fg\x05\x1A\x0E\x02" +
"g\x19\x03\x02\x02\x02hl\x05\x1C\x0F\x02il\x05\x1E\x10\x02jl\x05 \x11\x02" +
"kh\x03\x02\x02\x02ki\x03\x02\x02\x02kj\x03\x02\x02\x02l\x1B\x03\x02\x02" +
"\x02mn\x07\x0F\x02\x02no\x07\f\x02\x02op\x07\x10\x02\x02p\x1D\x03\x02" +
"\x02\x02qr\x07\x0F\x02\x02rw\x05\"\x12\x02st\x07\x11\x02\x02tv\x05\"\x12" +
"\x02us\x03\x02\x02\x02vy\x03\x02\x02\x02wu\x03\x02\x02\x02wx\x03\x02\x02" +
"\x02x{\x03\x02\x02\x02yw\x03\x02\x02\x02z|\x07\x11\x02\x02{z\x03\x02\x02" +
"\x02{|\x03\x02\x02\x02|}\x03\x02\x02\x02}~\x07\x10\x02\x02~\x1F\x03\x02" +
"\x02\x02\x7F\x80\x07\x0F\x02\x02\x80\x81\x05\x1E\x10\x02\x81\x82\x07\f" +
"\x02\x02\x82\x83\x07\x10\x02\x02\x83!\x03\x02\x02\x02\x84\x85\x07\x03" +
"\x02\x02\x85#\x03\x02\x02\x02\x86\x87\x07\x03\x02\x02\x87%\x03\x02\x02" +
"\x02\x88\x89\x07\x03\x02\x02\x89\'\x03\x02\x02\x02\v+1=FRTkw{";
public static __ATN: ATN;

@@ -1085,2 +1091,11 @@ public static get _ATN(): ATN {

}
public ignoredComment(): IgnoredCommentContext[];
public ignoredComment(i: number): IgnoredCommentContext;
public ignoredComment(i?: number): IgnoredCommentContext | IgnoredCommentContext[] {
if (i === undefined) {
return this.getRuleContexts(IgnoredCommentContext);
} else {
return this.getRuleContext(i, IgnoredCommentContext);
}
}
public param(): ParamContext[];

@@ -1087,0 +1102,0 @@ public param(i: number): ParamContext;

@@ -7,3 +7,3 @@ import { processTSQueryAST } from './preprocessor-ts';

interface IDatabaseConnection {
export interface IDatabaseConnection {
query: (query: string, bindings: any[]) => Promise<{ rows: any[] }>;

@@ -10,0 +10,0 @@ }

{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./lib/", /* Redirect output structure to the directory. */
"outDir": "./lib/" /* Redirect output structure to the directory. */,
"rootDir": "./src/" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
},
"exclude": [
"tests",
"lib"
],
"include": [
"./src"
]
}
"exclude": ["tests", "lib"],
"include": ["./src"]
}

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