@@ -139,7 +139,7 @@ export class Connection {
139
139
140
140
constructor (
141
141
connection_params : ClientConfiguration ,
142
- disconnection_callback : ( ) => Promise < void > ,
142
+ disconnection_callback : ( ) => Promise < void >
143
143
) {
144
144
this . #connection_params = connection_params ;
145
145
this . #onDisconnection = disconnection_callback ;
@@ -190,7 +190,7 @@ export class Connection {
190
190
return false ;
191
191
default :
192
192
throw new Error (
193
- `Could not check if server accepts SSL connections, server responded with: ${ response } ` ,
193
+ `Could not check if server accepts SSL connections, server responded with: ${ response } `
194
194
) ;
195
195
}
196
196
}
@@ -220,7 +220,7 @@ export class Connection {
220
220
. addCString (
221
221
connection_options
222
222
. map ( ( [ key , value ] ) => `--${ key } =${ value } ` )
223
- . join ( " " ) ,
223
+ . join ( " " )
224
224
) ;
225
225
}
226
226
@@ -266,7 +266,7 @@ export class Connection {
266
266
} catch ( e ) {
267
267
if ( e instanceof Deno . errors . NotFound ) {
268
268
throw new ConnectionError (
269
- `Could not open socket in path "${ socket_guess } "` ,
269
+ `Could not open socket in path "${ socket_guess } "`
270
270
) ;
271
271
}
272
272
throw e ;
@@ -276,7 +276,7 @@ export class Connection {
276
276
277
277
async #openTlsConnection(
278
278
connection : Deno . Conn ,
279
- options : { hostname : string ; caCerts : string [ ] } ,
279
+ options : { hostname : string ; caCerts : string [ ] }
280
280
) {
281
281
this . #conn = await Deno . startTls ( connection , options ) ;
282
282
this . #bufWriter = new BufWriter ( this . #conn) ;
@@ -345,7 +345,7 @@ export class Connection {
345
345
bold ( yellow ( "TLS connection failed with message: " ) ) +
346
346
e . message +
347
347
"\n" +
348
- bold ( "Defaulting to non-encrypted connection" ) ,
348
+ bold ( "Defaulting to non-encrypted connection" )
349
349
) ;
350
350
await this . #openConnection( { hostname, port, transport : "tcp" } ) ;
351
351
this . #tls = false ;
@@ -357,7 +357,7 @@ export class Connection {
357
357
// Make sure to close the connection before erroring
358
358
this . #closeConnection( ) ;
359
359
throw new Error (
360
- "The server isn't accepting TLS connections. Change the client configuration so TLS configuration isn't required to connect" ,
360
+ "The server isn't accepting TLS connections. Change the client configuration so TLS configuration isn't required to connect"
361
361
) ;
362
362
}
363
363
}
@@ -373,14 +373,14 @@ export class Connection {
373
373
if ( e instanceof Deno . errors . InvalidData && tls_enabled ) {
374
374
if ( tls_enforced ) {
375
375
throw new Error (
376
- "The certificate used to secure the TLS connection is invalid." ,
376
+ "The certificate used to secure the TLS connection is invalid."
377
377
) ;
378
378
} else {
379
379
console . error (
380
380
bold ( yellow ( "TLS connection failed with message: " ) ) +
381
381
e . message +
382
382
"\n" +
383
- bold ( "Defaulting to non-encrypted connection" ) ,
383
+ bold ( "Defaulting to non-encrypted connection" )
384
384
) ;
385
385
await this . #openConnection( { hostname, port, transport : "tcp" } ) ;
386
386
this . #tls = false ;
@@ -436,7 +436,7 @@ export class Connection {
436
436
async startup ( is_reconnection : boolean ) {
437
437
if ( is_reconnection && this . #connection_params. connection . attempts === 0 ) {
438
438
throw new Error (
439
- "The client has been disconnected from the database. Enable reconnection in the client to attempt reconnection after failure" ,
439
+ "The client has been disconnected from the database. Enable reconnection in the client to attempt reconnection after failure"
440
440
) ;
441
441
}
442
442
@@ -512,19 +512,19 @@ export class Connection {
512
512
}
513
513
case AUTHENTICATION_TYPE . SCM :
514
514
throw new Error (
515
- "Database server expected SCM authentication, which is not supported at the moment" ,
515
+ "Database server expected SCM authentication, which is not supported at the moment"
516
516
) ;
517
517
case AUTHENTICATION_TYPE . GSS_STARTUP :
518
518
throw new Error (
519
- "Database server expected GSS authentication, which is not supported at the moment" ,
519
+ "Database server expected GSS authentication, which is not supported at the moment"
520
520
) ;
521
521
case AUTHENTICATION_TYPE . GSS_CONTINUE :
522
522
throw new Error (
523
- "Database server expected GSS authentication, which is not supported at the moment" ,
523
+ "Database server expected GSS authentication, which is not supported at the moment"
524
524
) ;
525
525
case AUTHENTICATION_TYPE . SSPI :
526
526
throw new Error (
527
- "Database server expected SSPI authentication, which is not supported at the moment" ,
527
+ "Database server expected SSPI authentication, which is not supported at the moment"
528
528
) ;
529
529
case AUTHENTICATION_TYPE . SASL_STARTUP :
530
530
authentication_result = await this . #authenticateWithSasl( ) ;
@@ -552,14 +552,14 @@ export class Connection {
552
552
553
553
if ( ! this . #connection_params. password ) {
554
554
throw new ConnectionParamsError (
555
- "Attempting MD5 authentication with unset password" ,
555
+ "Attempting MD5 authentication with unset password"
556
556
) ;
557
557
}
558
558
559
559
const password = await hashMd5Password (
560
560
this . #connection_params. password ,
561
561
this . #connection_params. user ,
562
- salt ,
562
+ salt
563
563
) ;
564
564
const buffer = this . #packetWriter. addCString ( password ) . flush ( 0x70 ) ;
565
565
@@ -575,13 +575,13 @@ export class Connection {
575
575
async #authenticateWithSasl( ) : Promise < Message > {
576
576
if ( ! this . #connection_params. password ) {
577
577
throw new ConnectionParamsError (
578
- "Attempting SASL auth with unset password" ,
578
+ "Attempting SASL auth with unset password"
579
579
) ;
580
580
}
581
581
582
582
const client = new scram . Client (
583
583
this . #connection_params. user ,
584
- this . #connection_params. password ,
584
+ this . #connection_params. password
585
585
) ;
586
586
const utf8 = new TextDecoder ( "utf-8" ) ;
587
587
@@ -600,7 +600,7 @@ export class Connection {
600
600
const authentication_type = maybe_sasl_continue . reader . readInt32 ( ) ;
601
601
if ( authentication_type !== AUTHENTICATION_TYPE . SASL_CONTINUE ) {
602
602
throw new Error (
603
- `Unexpected authentication type in SASL negotiation: ${ authentication_type } ` ,
603
+ `Unexpected authentication type in SASL negotiation: ${ authentication_type } `
604
604
) ;
605
605
}
606
606
break ;
@@ -609,11 +609,11 @@ export class Connection {
609
609
throw new PostgresError ( parseNoticeMessage ( maybe_sasl_continue ) ) ;
610
610
default :
611
611
throw new Error (
612
- `Unexpected message in SASL negotiation: ${ maybe_sasl_continue . type } ` ,
612
+ `Unexpected message in SASL negotiation: ${ maybe_sasl_continue . type } `
613
613
) ;
614
614
}
615
615
const sasl_continue = utf8 . decode (
616
- maybe_sasl_continue . reader . readAllBytes ( ) ,
616
+ maybe_sasl_continue . reader . readAllBytes ( )
617
617
) ;
618
618
await client . receiveChallenge ( sasl_continue ) ;
619
619
@@ -628,7 +628,7 @@ export class Connection {
628
628
const authentication_type = maybe_sasl_final . reader . readInt32 ( ) ;
629
629
if ( authentication_type !== AUTHENTICATION_TYPE . SASL_FINAL ) {
630
630
throw new Error (
631
- `Unexpected authentication type in SASL finalization: ${ authentication_type } ` ,
631
+ `Unexpected authentication type in SASL finalization: ${ authentication_type } `
632
632
) ;
633
633
}
634
634
break ;
@@ -637,7 +637,7 @@ export class Connection {
637
637
throw new PostgresError ( parseNoticeMessage ( maybe_sasl_final ) ) ;
638
638
default :
639
639
throw new Error (
640
- `Unexpected message in SASL finalization: ${ maybe_sasl_continue . type } ` ,
640
+ `Unexpected message in SASL finalization: ${ maybe_sasl_continue . type } `
641
641
) ;
642
642
}
643
643
const sasl_final = utf8 . decode ( maybe_sasl_final . reader . readAllBytes ( ) ) ;
@@ -649,7 +649,7 @@ export class Connection {
649
649
650
650
async #simpleQuery( query : Query < ResultType . ARRAY > ) : Promise < QueryArrayResult > ;
651
651
async #simpleQuery(
652
- query : Query < ResultType . OBJECT > ,
652
+ query : Query < ResultType . OBJECT >
653
653
) : Promise < QueryObjectResult > ;
654
654
async #simpleQuery( query : Query < ResultType > ) : Promise < QueryResult > {
655
655
this . #packetWriter. clear ( ) ;
@@ -678,14 +678,14 @@ export class Connection {
678
678
break ;
679
679
case INCOMING_QUERY_MESSAGES . COMMAND_COMPLETE : {
680
680
result . handleCommandComplete (
681
- parseCommandCompleteMessage ( current_message ) ,
681
+ parseCommandCompleteMessage ( current_message )
682
682
) ;
683
683
break ;
684
684
}
685
685
case INCOMING_QUERY_MESSAGES . DATA_ROW : {
686
686
const row_data = parseRowDataMessage ( current_message ) ;
687
687
try {
688
- result . insertRow ( row_data ) ;
688
+ result . insertRow ( row_data , this . #connection_params . controls ) ;
689
689
} catch ( e ) {
690
690
error = e ;
691
691
}
@@ -705,13 +705,13 @@ export class Connection {
705
705
break ;
706
706
case INCOMING_QUERY_MESSAGES . ROW_DESCRIPTION : {
707
707
result . loadColumnDescriptions (
708
- parseRowDescriptionMessage ( current_message ) ,
708
+ parseRowDescriptionMessage ( current_message )
709
709
) ;
710
710
break ;
711
711
}
712
712
default :
713
713
throw new Error (
714
- `Unexpected simple query message: ${ current_message . type } ` ,
714
+ `Unexpected simple query message: ${ current_message . type } `
715
715
) ;
716
716
}
717
717
@@ -820,7 +820,7 @@ export class Connection {
820
820
* https://www.postgresql.org/docs/14/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY
821
821
*/
822
822
async #preparedQuery< T extends ResultType > (
823
- query : Query < T > ,
823
+ query : Query < T >
824
824
) : Promise < QueryResult > {
825
825
// The parse messages declares the statement, query arguments and the cursor used in the transaction
826
826
// The database will respond with a parse response
@@ -855,14 +855,14 @@ export class Connection {
855
855
break ;
856
856
case INCOMING_QUERY_MESSAGES . COMMAND_COMPLETE : {
857
857
result . handleCommandComplete (
858
- parseCommandCompleteMessage ( current_message ) ,
858
+ parseCommandCompleteMessage ( current_message )
859
859
) ;
860
860
break ;
861
861
}
862
862
case INCOMING_QUERY_MESSAGES . DATA_ROW : {
863
863
const row_data = parseRowDataMessage ( current_message ) ;
864
864
try {
865
- result . insertRow ( row_data ) ;
865
+ result . insertRow ( row_data , this . #connection_params . controls ) ;
866
866
} catch ( e ) {
867
867
error = e ;
868
868
}
@@ -884,13 +884,13 @@ export class Connection {
884
884
break ;
885
885
case INCOMING_QUERY_MESSAGES . ROW_DESCRIPTION : {
886
886
result . loadColumnDescriptions (
887
- parseRowDescriptionMessage ( current_message ) ,
887
+ parseRowDescriptionMessage ( current_message )
888
888
) ;
889
889
break ;
890
890
}
891
891
default :
892
892
throw new Error (
893
- `Unexpected prepared query message: ${ current_message . type } ` ,
893
+ `Unexpected prepared query message: ${ current_message . type } `
894
894
) ;
895
895
}
896
896
0 commit comments