1- /*! indexeddbshim - v14 .0.0 - 7/16 /2024 */
1+ /*! indexeddbshim - v15 .0.0 - 8/3 /2024 */
22
33'use strict' ;
44
@@ -2679,6 +2679,14 @@ const signValues = ['negativeInfinity', 'bigNegative', 'smallNegative', 'smallPo
26792679 * @typedef {any } AnyValue
26802680 */
26812681
2682+ /**
2683+ * @type {{
2684+ * [key: string]: {
2685+ * encode: (param: any, inArray?: boolean) => string,
2686+ * decode: (param: string, inArray?: boolean) => any
2687+ * }
2688+ * }}
2689+ */
26822690const types$1 = {
26832691 invalid : {
26842692 /**
@@ -3534,7 +3542,6 @@ function encode$1(key, inArray) {
35343542 return null ;
35353543 }
35363544 // array, date, number, string, binary (should already have detected "invalid")
3537- // @ts -expect-error Argument may be ignored
35383545 return types$1 [ getKeyType ( key ) ] . encode ( key , inArray ) ;
35393546}
35403547
@@ -5077,7 +5084,7 @@ function _toPropertyKey(e) {
50775084 if ( "object" != typeof e || null === e ) return e ;
50785085 var r = e [ Symbol . toPrimitive ] ;
50795086 if ( void 0 !== r ) {
5080- var n = r . call ( e , t ) ;
5087+ var n = r . call ( e , t ) ;
50815088 if ( "object" != typeof n ) return n ;
50825089 throw new TypeError ( "@@toPrimitive must return a primitive value." ) ;
50835090 }
@@ -5133,7 +5140,7 @@ e.__typeson__type__ = "TypesonPromise", "undefined" != typeof Symbol && Object.d
51335140var t = Object . hasOwn ,
51345141 r = Object . getPrototypeOf ;
51355142function isThenable ( e , t ) {
5136- return isObject ( e ) && "function" == typeof e . then && ( ! t ) ;
5143+ return isObject ( e ) && "function" == typeof e . then && ( ! t ) ;
51375144}
51385145function toStringTag ( e ) {
51395146 return Object . prototype . toString . call ( e ) . slice ( 8 , - 1 ) ;
@@ -8310,6 +8317,8 @@ const readonlyProperties = ['name', 'version', 'objectStoreNames'];
83108317function IDBDatabase ( ) {
83118318 this . __versionTransaction = null ;
83128319 this . __objectStores = null ;
8320+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[] } */
8321+ this . __transactions = [ ] ;
83138322 throw new TypeError ( 'Illegal constructor' ) ;
83148323}
83158324const IDBDatabaseAlias = IDBDatabase ;
@@ -8372,6 +8381,8 @@ IDBDatabase.__createInstance = function (db, name, oldVersion, version, storePro
83728381 this . __setOptions ( {
83738382 legacyOutputDidListenersThrowFlag : true // Event hook for IndexedB
83748383 } ) ;
8384+
8385+ /** @type {import('./IDBTransaction.js').IDBTransactionFull[] } */
83758386 this . __transactions = [ ] ;
83768387
83778388 /** @type {{[key: string]: IDBObjectStore} } */
@@ -8501,6 +8512,7 @@ IDBDatabase.prototype.close = function () {
85018512 if ( this . __unblocking ) {
85028513 this . __unblocking . check ( ) ;
85038514 }
8515+ this . __transactions = [ ] ;
85048516} ;
85058517
85068518/**
@@ -8598,6 +8610,7 @@ IDBDatabase.prototype.__forceClose = function (msg) {
85988610 } ;
85998611 trans . __abortTransaction ( createDOMException ( 'AbortError' , 'The connection was force-closed: ' + ( msg || '' ) ) ) ;
86008612 } ) ;
8613+ me . __transactions = [ ] ;
86018614} ;
86028615defineOuterInterface ( IDBDatabase . prototype , listeners ) ;
86038616defineReadonlyOuterInterface ( IDBDatabase . prototype , readonlyProperties ) ;
@@ -9197,6 +9210,10 @@ IDBFactory.prototype.open = function (name /* , version */) {
91979210
91989211 // eslint-disable-next-line camelcase -- Clear API
91999212 req . transaction . on__complete = function ( ) {
9213+ const pos = connection . __transactions . indexOf ( req . transaction ) ;
9214+ if ( pos > - 1 ) {
9215+ connection . __transactions . splice ( pos , 1 ) ;
9216+ }
92009217 if ( /** @type {import('./IDBDatabase.js').IDBDatabaseFull } */ req . __result . __closePending ) {
92019218 req . __transaction = null ;
92029219 const err = createDOMException ( 'AbortError' , 'The connection has been closed.' ) ;
@@ -9581,9 +9598,10 @@ IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
95819598 conn . __forceClose ( msg ) ;
95829599 }
95839600 if ( isNullish ( dbName ) ) {
9584- Object . values ( me . __connections ) . forEach ( conn => {
9585- // @ts -expect-error It's ok
9586- forceClose ( conn ) ;
9601+ Object . values ( me . __connections ) . forEach ( connections => {
9602+ connections . forEach ( connection => {
9603+ forceClose ( connection ) ;
9604+ } ) ;
95879605 } ) ;
95889606 } else if ( ! me . __connections [ dbName ] ) {
95899607 console . log ( 'No database connections with that name to force close' ) ;
@@ -9592,7 +9610,7 @@ IDBFactory.prototype.__forceClose = function (dbName, connIdx, msg) {
95929610 forceClose ( conn ) ;
95939611 } ) ;
95949612 } else if ( ! Number . isInteger ( connIdx ) || connIdx < 0 || connIdx > me . __connections [ dbName ] . length - 1 ) {
9595- throw new TypeError ( 'If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to lose ' ) ;
9613+ throw new TypeError ( 'If providing an argument, __forceClose must be called with a ' + 'numeric index to indicate a specific connection to close ' ) ;
95969614 } else {
95979615 forceClose ( me . __connections [ dbName ] [ connIdx ] ) ;
95989616 }
0 commit comments