graphile-sql-expression-validator 2.16.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/validator.js +3 -2
- package/package.json +4 -4
- package/validator.js +3 -2
package/esm/validator.js
CHANGED
|
@@ -304,7 +304,7 @@ export async function parseAndValidateSqlExpression(expression, options = {}) {
|
|
|
304
304
|
return { valid: false, error: 'Failed to parse expression' };
|
|
305
305
|
}
|
|
306
306
|
const stmt = parseResult.stmts[0]?.stmt;
|
|
307
|
-
if (!stmt
|
|
307
|
+
if (!stmt || !('SelectStmt' in stmt) || !stmt.SelectStmt) {
|
|
308
308
|
return { valid: false, error: 'Unexpected parse result structure' };
|
|
309
309
|
}
|
|
310
310
|
const selectStmt = stmt.SelectStmt;
|
|
@@ -326,7 +326,8 @@ export async function parseAndValidateSqlExpression(expression, options = {}) {
|
|
|
326
326
|
if (!targetList || targetList.length !== 1) {
|
|
327
327
|
return { valid: false, error: 'Expected single expression' };
|
|
328
328
|
}
|
|
329
|
-
const
|
|
329
|
+
const targetNode = targetList[0];
|
|
330
|
+
const resTarget = targetNode && 'ResTarget' in targetNode ? targetNode.ResTarget : undefined;
|
|
330
331
|
if (!resTarget || !resTarget.val) {
|
|
331
332
|
return {
|
|
332
333
|
valid: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphile-sql-expression-validator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.2",
|
|
4
4
|
"description": "SQL expression validation for PostGraphile v5",
|
|
5
5
|
"author": "Constructive <developers@constructive.io>",
|
|
6
6
|
"homepage": "https://github.com/constructive-io/constructive",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"url": "https://github.com/constructive-io/constructive/issues"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"pgsql-deparser": "^
|
|
46
|
-
"pgsql-parser": "^
|
|
45
|
+
"pgsql-deparser": "^18.1.1",
|
|
46
|
+
"pgsql-parser": "^18.1.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"grafast": "1.0.2",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"@types/node": "^22.19.11",
|
|
57
57
|
"makage": "^0.3.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "08741ce3a6897192c2dbc7d1da48b9f456ffb59f"
|
|
60
60
|
}
|
package/validator.js
CHANGED
|
@@ -309,7 +309,7 @@ async function parseAndValidateSqlExpression(expression, options = {}) {
|
|
|
309
309
|
return { valid: false, error: 'Failed to parse expression' };
|
|
310
310
|
}
|
|
311
311
|
const stmt = parseResult.stmts[0]?.stmt;
|
|
312
|
-
if (!stmt
|
|
312
|
+
if (!stmt || !('SelectStmt' in stmt) || !stmt.SelectStmt) {
|
|
313
313
|
return { valid: false, error: 'Unexpected parse result structure' };
|
|
314
314
|
}
|
|
315
315
|
const selectStmt = stmt.SelectStmt;
|
|
@@ -331,7 +331,8 @@ async function parseAndValidateSqlExpression(expression, options = {}) {
|
|
|
331
331
|
if (!targetList || targetList.length !== 1) {
|
|
332
332
|
return { valid: false, error: 'Expected single expression' };
|
|
333
333
|
}
|
|
334
|
-
const
|
|
334
|
+
const targetNode = targetList[0];
|
|
335
|
+
const resTarget = targetNode && 'ResTarget' in targetNode ? targetNode.ResTarget : undefined;
|
|
335
336
|
if (!resTarget || !resTarget.val) {
|
|
336
337
|
return {
|
|
337
338
|
valid: false,
|