@@ -449,7 +449,9 @@ describe('parameter queries', () => {
449449
450450 test ( 'request.parameters()' , function ( ) {
451451 const sql = "SELECT FROM posts WHERE category = request.parameters() ->> 'category_id'" ;
452- const query = SqlParameterQuery . fromSql ( 'mybucket' , sql ) as SqlParameterQuery ;
452+ const query = SqlParameterQuery . fromSql ( 'mybucket' , sql , undefined , {
453+ accept_potentially_dangerous_queries : true
454+ } ) as SqlParameterQuery ;
453455 expect ( query . errors ) . toEqual ( [ ] ) ;
454456 query . id = '1' ;
455457 expect ( query . evaluateParameterRow ( { id : 'group1' , category : 'red' } ) ) . toEqual ( [
@@ -463,7 +465,9 @@ describe('parameter queries', () => {
463465
464466 test ( 'nested request.parameters() (1)' , function ( ) {
465467 const sql = "SELECT FROM posts WHERE category = request.parameters() -> 'details' ->> 'category'" ;
466- const query = SqlParameterQuery . fromSql ( 'mybucket' , sql ) as SqlParameterQuery ;
468+ const query = SqlParameterQuery . fromSql ( 'mybucket' , sql , undefined , {
469+ accept_potentially_dangerous_queries : true
470+ } ) as SqlParameterQuery ;
467471 expect ( query . errors ) . toEqual ( [ ] ) ;
468472 query . id = '1' ;
469473 expect ( query . getLookups ( normalizeTokenParameters ( { } , { details : { category : 'red' } } ) ) ) . toEqual ( [
@@ -473,7 +477,9 @@ describe('parameter queries', () => {
473477
474478 test ( 'nested request.parameters() (2)' , function ( ) {
475479 const sql = "SELECT FROM posts WHERE category = request.parameters() ->> 'details.category'" ;
476- const query = SqlParameterQuery . fromSql ( 'mybucket' , sql ) as SqlParameterQuery ;
480+ const query = SqlParameterQuery . fromSql ( 'mybucket' , sql , undefined , {
481+ accept_potentially_dangerous_queries : true
482+ } ) as SqlParameterQuery ;
477483 expect ( query . errors ) . toEqual ( [ ] ) ;
478484 query . id = '1' ;
479485 expect ( query . getLookups ( normalizeTokenParameters ( { } , { details : { category : 'red' } } ) ) ) . toEqual ( [
@@ -484,7 +490,9 @@ describe('parameter queries', () => {
484490 test ( 'IN request.parameters()' , function ( ) {
485491 // Can use -> or ->> here
486492 const sql = "SELECT id as region_id FROM regions WHERE name IN request.parameters() -> 'region_names'" ;
487- const query = SqlParameterQuery . fromSql ( 'mybucket' , sql ) as SqlParameterQuery ;
493+ const query = SqlParameterQuery . fromSql ( 'mybucket' , sql , undefined , {
494+ accept_potentially_dangerous_queries : true
495+ } ) as SqlParameterQuery ;
488496 expect ( query . errors ) . toEqual ( [ ] ) ;
489497 query . id = '1' ;
490498 expect ( query . evaluateParameterRow ( { id : 'region1' , name : 'colorado' } ) ) . toEqual ( [
0 commit comments