@@ -52,7 +52,7 @@ export interface SimpleDbSchemaConverter {
5252 * specific object store.
5353 */
5454export class SimpleDbTransaction {
55- readonly debugId = `SimpleDbTransaction@ ${ generateUniqueDebugId ( ) } ` ;
55+ readonly debugId : string ;
5656 private aborted = false ;
5757
5858 /**
@@ -67,21 +67,24 @@ export class SimpleDbTransaction {
6767 objectStoreNames : string [ ]
6868 ) : SimpleDbTransaction {
6969 try {
70- const transaction = new SimpleDbTransaction (
70+ return new SimpleDbTransaction (
7171 action ,
72- db . idbDatabase . transaction ( objectStoreNames , mode )
72+ db . idbDatabase . transaction ( objectStoreNames , mode ) ,
73+ db . debugId
7374 ) ;
74- logDebug ( `${ transaction . debugId } created from ${ db . debugId } ` ) ;
75- return transaction ;
7675 } catch ( e ) {
7776 throw new IndexedDbTransactionError ( action , e as Error ) ;
7877 }
7978 }
8079
8180 constructor (
8281 private readonly action : string ,
83- private readonly transaction : IDBTransaction
82+ private readonly transaction : IDBTransaction ,
83+ readonly dbDebugId : string
8484 ) {
85+ this . debugId =
86+ `SimpleDbTransaction@${ generateUniqueDebugId ( ) } , ` +
87+ `action="${ action } ", dbDebugId=${ dbDebugId } ` ;
8588 this . transaction . oncomplete = ( ) => {
8689 this . completionDeferred . resolve ( ) ;
8790 } ;
@@ -148,9 +151,7 @@ export class SimpleDbTransaction {
148151 ) : SimpleDbStore < KeyType , ValueType > {
149152 const store = this . transaction . objectStore ( storeName ) ;
150153 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 ) ;
154155 }
155156}
156157
@@ -755,9 +756,11 @@ export class SimpleDbStore<
755756 KeyType extends IDBValidKey ,
756757 ValueType extends unknown
757758> {
758- readonly debugId = `SimpleDbStore@ ${ generateUniqueDebugId ( ) } ` ;
759+ readonly debugId : string ;
759760
760- constructor ( private store : IDBObjectStore ) { }
761+ constructor ( private store : IDBObjectStore , transactionId : string ) {
762+ this . debugId = transactionId ;
763+ }
761764
762765 /**
763766 * Writes a value into the Object Store.
0 commit comments