@@ -53,58 +53,57 @@ class DataApiConnection implements DatabaseConnection {
5353 }
5454
5555 public async beginTransaction ( ) {
56- const r = await this . #config. client
57- . beginTransaction ( {
58- secretArn : this . #config. secretArn ,
59- resourceArn : this . #config. resourceArn ,
60- database : this . #config. database ,
61- } ) ;
56+ const r = await this . #config. client . beginTransaction ( {
57+ secretArn : this . #config. secretArn ,
58+ resourceArn : this . #config. resourceArn ,
59+ database : this . #config. database ,
60+ } ) ;
6261 this . #transactionId = r . transactionId ;
6362 }
6463
6564 public async commitTransaction ( ) {
6665 if ( ! this . #transactionId)
6766 throw new Error ( "Cannot commit a transaction before creating it" ) ;
68- await this . #config. client
69- . commitTransaction ( {
70- secretArn : this . #config. secretArn ,
71- resourceArn : this . #config. resourceArn ,
72- transactionId : this . #transactionId,
73- } ) ;
67+ await this . #config. client . commitTransaction ( {
68+ secretArn : this . #config. secretArn ,
69+ resourceArn : this . #config. resourceArn ,
70+ transactionId : this . #transactionId,
71+ } ) ;
7472 }
7573
7674 public async rollbackTransaction ( ) {
7775 if ( ! this . #transactionId)
7876 throw new Error ( "Cannot rollback a transaction before creating it" ) ;
79- await this . #config. client
80- . rollbackTransaction ( {
81- secretArn : this . #config. secretArn ,
82- resourceArn : this . #config. resourceArn ,
83- transactionId : this . #transactionId,
84- } ) ;
77+ await this . #config. client . rollbackTransaction ( {
78+ secretArn : this . #config. secretArn ,
79+ resourceArn : this . #config. resourceArn ,
80+ transactionId : this . #transactionId,
81+ } ) ;
8582 }
8683
8784 async executeQuery < O > ( compiledQuery : CompiledQuery ) : Promise < QueryResult < O > > {
88- const r = await this . #config. client
89- . executeStatement ( {
90- transactionId : this . #transactionId,
91- secretArn : this . #config. secretArn ,
92- resourceArn : this . #config. resourceArn ,
93- sql : compiledQuery . sql ,
94- parameters : compiledQuery . parameters as SqlParameter [ ] ,
95- database : this . #config. database ,
96- includeResultMetadata : true ,
97- } ) ;
85+ const r = await this . #config. client . executeStatement ( {
86+ transactionId : this . #transactionId,
87+ secretArn : this . #config. secretArn ,
88+ resourceArn : this . #config. resourceArn ,
89+ sql : compiledQuery . sql ,
90+ parameters : compiledQuery . parameters as SqlParameter [ ] ,
91+ database : this . #config. database ,
92+ includeResultMetadata : true ,
93+ } ) ;
9894 if ( ! r . columnMetadata ) {
99- const numAffectedRows = BigInt ( r . numberOfRecordsUpdated || 0 )
95+ const numAffectedRows = BigInt ( r . numberOfRecordsUpdated || 0 ) ;
10096
10197 return {
102- // @ts -ignore replaces `QueryResult.numUpdatedOrDeletedRows` in kysely >= 0.23
98+ // @ts -ignore replaces `QueryResult.numUpdatedOrDeletedRows` in kysely >= 0.23
10399 // following https://github.com/koskimas/kysely/pull/188
104100 numAffectedRows,
105101 // deprecated in kysely >= 0.23, keep for backward compatibility.
106102 numUpdatedOrDeletedRows : numAffectedRows ,
107- insertId : r . generatedFields && r . generatedFields . length > 0 ? r . generatedFields [ 0 ] . longValue : undefined
103+ insertId :
104+ r . generatedFields && r . generatedFields . length > 0
105+ ? BigInt ( r . generatedFields [ 0 ] . longValue ! )
106+ : undefined ,
108107 rows : [ ] ,
109108 } ;
110109 }
@@ -121,16 +120,16 @@ class DataApiConnection implements DatabaseConnection {
121120 val . arrayValue ??
122121 val . doubleValue ??
123122 ( val . isNull ? null : val . booleanValue ) ,
124- ] ) ,
125- ) as unknown as O ,
123+ ] )
124+ ) as unknown as O
126125 ) ;
127126 const result : QueryResult < O > = {
128127 rows : rows || [ ] ,
129128 } ;
130129 return result ;
131130 }
132-
133- async * streamQuery < O > (
131+
132+ async * streamQuery < O > (
134133 _compiledQuery : CompiledQuery ,
135134 _chunkSize : number
136135 ) : AsyncIterableIterator < QueryResult < O > > {
0 commit comments