@@ -115,20 +115,14 @@ class DBTransaction {
115
115
if ( utils . checkSepKeyPath ( keyPath as KeyPath ) ) {
116
116
throw new errors . ErrorDBLevelSep ( ) ;
117
117
}
118
- let value : T | undefined ;
119
- try {
120
- value = await this . db . _get < T > (
121
- [ ...this . transactionPath , ...keyPath ] as unknown as KeyPath ,
122
- raw as any
123
- ) ;
124
- } catch ( e ) {
125
- if ( e . notFound ) {
126
- value = await this . db . get < T > ( keyPath , raw as any ) ;
127
- // Don't set it in the transaction DB
128
- // Because this is not a repeatable-read "snapshot"
129
- } else {
130
- throw e ;
131
- }
118
+ let value = await this . db . _get < T > (
119
+ [ ...this . transactionPath , ...keyPath ] as unknown as KeyPath ,
120
+ raw as any
121
+ ) ;
122
+ if ( value === undefined ) {
123
+ value = await this . db . get < T > ( keyPath , raw as any ) ;
124
+ // Don't set it in the transaction DB
125
+ // Because this is not a repeatable-read "snapshot"
132
126
}
133
127
return value ;
134
128
}
@@ -204,7 +198,7 @@ class DBTransaction {
204
198
keyAsBuffer : true ,
205
199
valueAsBuffer : true
206
200
} ,
207
- [ 'data' ]
201
+ [ 'data' , ... levelPath ]
208
202
) ;
209
203
const tranIterator = this . db . _iterator (
210
204
this . db . db ,
@@ -214,13 +208,13 @@ class DBTransaction {
214
208
keyAsBuffer : true ,
215
209
valueAsBuffer : true
216
210
} ,
217
- this . transactionPath ,
211
+ [ ... this . transactionPath , ... levelPath ] ,
218
212
) ;
219
213
const order = options ?. reverse ? 'desc' : 'asc' ;
220
214
const iterator = {
221
215
_ended : false ,
222
216
_nexting : false ,
223
- seek : ( k : Buffer | string ) => {
217
+ seek : ( k : Buffer | string ) : void => {
224
218
if ( iterator . _ended ) {
225
219
throw new Error ( 'cannot call seek() after end()' ) ;
226
220
}
@@ -233,7 +227,7 @@ class DBTransaction {
233
227
dataIterator . seek ( k ) ;
234
228
tranIterator . seek ( k ) ;
235
229
} ,
236
- end : async ( ) => {
230
+ end : async ( ) : Promise < void > => {
237
231
if ( iterator . _ended ) {
238
232
throw new Error ( 'end() already called on iterator' ) ;
239
233
}
0 commit comments