@@ -52,7 +52,7 @@ export interface SimpleDbSchemaConverter {
52
52
* specific object store.
53
53
*/
54
54
export class SimpleDbTransaction {
55
- readonly debugId = `SimpleDbTransaction@ ${ generateUniqueDebugId ( ) } ` ;
55
+ readonly debugId : string ;
56
56
private aborted = false ;
57
57
58
58
/**
@@ -67,21 +67,24 @@ export class SimpleDbTransaction {
67
67
objectStoreNames : string [ ]
68
68
) : SimpleDbTransaction {
69
69
try {
70
- const transaction = new SimpleDbTransaction (
70
+ return new SimpleDbTransaction (
71
71
action ,
72
- db . idbDatabase . transaction ( objectStoreNames , mode )
72
+ db . idbDatabase . transaction ( objectStoreNames , mode ) ,
73
+ db . debugId
73
74
) ;
74
- logDebug ( `${ transaction . debugId } created from ${ db . debugId } ` ) ;
75
- return transaction ;
76
75
} catch ( e ) {
77
76
throw new IndexedDbTransactionError ( action , e as Error ) ;
78
77
}
79
78
}
80
79
81
80
constructor (
82
81
private readonly action : string ,
83
- private readonly transaction : IDBTransaction
82
+ private readonly transaction : IDBTransaction ,
83
+ readonly dbDebugId : string
84
84
) {
85
+ this . debugId =
86
+ `SimpleDbTransaction@${ generateUniqueDebugId ( ) } , ` +
87
+ `action="${ action } ", dbDebugId=${ dbDebugId } ` ;
85
88
this . transaction . oncomplete = ( ) => {
86
89
this . completionDeferred . resolve ( ) ;
87
90
} ;
@@ -148,9 +151,7 @@ export class SimpleDbTransaction {
148
151
) : SimpleDbStore < KeyType , ValueType > {
149
152
const store = this . transaction . objectStore ( storeName ) ;
150
153
debugAssert ( ! ! store , 'Object store not part of transaction: ' + storeName ) ;
151
- const simpleDbStore = new SimpleDbStore < KeyType , ValueType > ( store ) ;
152
- logDebug ( `${ simpleDbStore . debugId } created from ${ this . debugId } ` ) ;
153
- return simpleDbStore ;
154
+ return new SimpleDbStore < KeyType , ValueType > ( store , this . debugId ) ;
154
155
}
155
156
}
156
157
@@ -755,9 +756,11 @@ export class SimpleDbStore<
755
756
KeyType extends IDBValidKey ,
756
757
ValueType extends unknown
757
758
> {
758
- readonly debugId = `SimpleDbStore@ ${ generateUniqueDebugId ( ) } ` ;
759
+ readonly debugId : string ;
759
760
760
- constructor ( private store : IDBObjectStore ) { }
761
+ constructor ( private store : IDBObjectStore , transactionId : string ) {
762
+ this . debugId = transactionId ;
763
+ }
761
764
762
765
/**
763
766
* Writes a value into the Object Store.
0 commit comments