diff --git a/build/cjs/wrap-idb-value.d.ts b/build/cjs/wrap-idb-value.d.ts index aa531b6..06d4148 100644 --- a/build/cjs/wrap-idb-value.d.ts +++ b/build/cjs/wrap-idb-value.d.ts @@ -23,8 +23,8 @@ interface Unwrap { (value: IDBPCursorWithValue): IDBCursorWithValue; (value: IDBPCursor): IDBCursor; (value: IDBPDatabase): IDBDatabase; - (value: IDBPIndex): IDBIndex; - (value: IDBPObjectStore): IDBObjectStore; + (value: IDBPIndex): IDBIndex; + (value: IDBPObjectStore): IDBObjectStore; (value: IDBPTransaction): IDBTransaction; (value: Promise>): IDBOpenDBRequest; (value: Promise): IDBOpenDBRequest; diff --git a/build/cjs/wrap-idb-value.d.ts.map b/build/cjs/wrap-idb-value.d.ts.map index 52502c0..c44cbd2 100644 --- a/build/cjs/wrap-idb-value.d.ts.map +++ b/build/cjs/wrap-idb-value.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"wrap-idb-value.d.ts","sourceRoot":"","sources":["../../src/wrap-idb-value.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,eAAe,EAChB,MAAM,SAAS,CAAC;AAuCjB,eAAO,MAAM,qBAAqB,sBAAgB,CAAC;AAqGnD,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,KAAK,YAAY,CAAC,GAAG,CAAC,GAC/D,IAAI,CAEN;AA4DD;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;AACvD,wBAAgB,IAAI,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;AACjD,wBAAgB,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAAC;AAC7D,wBAAgB,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,CAAC;AAC7D,wBAAgB,IAAI,CAClB,KAAK,EA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GAAG,cAAc,CAAC;IAC7D,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,cAAc,CAAC;IACxD,CAAC,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC;IACnE,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,gBAAgB,CAAC;IACjD,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;CACvC;AACD,eAAO,MAAM,MAAM,EAAE,MACa,CAAC"} \ No newline at end of file diff --git a/build/esm/wrap-idb-value.d.ts b/build/esm/wrap-idb-value.d.ts index aa531b6..06d4148 100644 --- a/build/esm/wrap-idb-value.d.ts +++ b/build/esm/wrap-idb-value.d.ts @@ -23,8 +23,8 @@ interface Unwrap { (value: IDBPCursorWithValue): IDBCursorWithValue; (value: IDBPCursor): IDBCursor; (value: IDBPDatabase): IDBDatabase; - (value: IDBPIndex): IDBIndex; - (value: IDBPObjectStore): IDBObjectStore; + (value: IDBPIndex): IDBIndex; + (value: IDBPObjectStore): IDBObjectStore; (value: IDBPTransaction): IDBTransaction; (value: Promise>): IDBOpenDBRequest; (value: Promise): IDBOpenDBRequest; diff --git a/build/esm/wrap-idb-value.d.ts.map b/build/esm/wrap-idb-value.d.ts.map index 52502c0..c44cbd2 100644 --- a/build/esm/wrap-idb-value.d.ts.map +++ b/build/esm/wrap-idb-value.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"wrap-idb-value.d.ts","sourceRoot":"","sources":["../../src/wrap-idb-value.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,YAAY,EACZ,SAAS,EACT,eAAe,EACf,eAAe,EAChB,MAAM,SAAS,CAAC;AAuCjB,eAAO,MAAM,qBAAqB,sBAAgB,CAAC;AAqGn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,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,kBAAkB,CAAC;IAC1E,CAAC,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC;IACxD,CAAC,KAAK,EAAE,YAAY,GAAG,WAAW,CAAC;IACnC,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,QAAQ,CAAC;IACtD,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,cAAc,CAAC;IAC7D,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,cAAc,CAAC;IACxD,CAAC,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC;IACnE,CAAC,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,gBAAgB,CAAC;IACjD,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;CACvC;AACD,eAAO,MAAM,MAAM,EAAE,MACa,CAAC"} \ No newline at end of file diff --git a/src/wrap-idb-value.ts b/src/wrap-idb-value.ts index 7c409c9..3873444 100644 --- a/src/wrap-idb-value.ts +++ b/src/wrap-idb-value.ts @@ -253,8 +253,8 @@ interface Unwrap { (value: IDBPCursorWithValue): IDBCursorWithValue; (value: IDBPCursor): IDBCursor; (value: IDBPDatabase): IDBDatabase; - (value: IDBPIndex): IDBIndex; - (value: IDBPObjectStore): IDBObjectStore; + (value: IDBPIndex): IDBIndex; + (value: IDBPObjectStore): IDBObjectStore; (value: IDBPTransaction): IDBTransaction; (value: Promise>): IDBOpenDBRequest; (value: Promise): IDBOpenDBRequest; diff --git a/test/main.ts b/test/main.ts index ef44db5..e5a0bd7 100644 --- a/test/main.ts +++ b/test/main.ts @@ -838,15 +838,18 @@ suite('IDBPTransaction', () => { const tx = schemaDB.transaction('key-val-store'); const tx2 = db.transaction('key-val-store'); + const tx3 = schemaDB.transaction('key-val-store', 'readwrite'); const unwrappedTx = unwrap(tx); const unwrappedTx2 = unwrap(tx2); + const unwrappedTx3 = unwrap(tx3); typeAssert>(true); - typeAssert>(true); + typeAssert>(true); assert.notProperty(unwrappedTx, 'store'); assert.notProperty(unwrappedTx2, 'store'); + assert.notProperty(unwrappedTx3, 'store'); }); }); @@ -1495,15 +1498,18 @@ suite('IDBPObjectStore', () => { const store1 = schemaDB.transaction('key-val-store').store; const store2 = db.transaction('key-val-store').store; + const store3 = schemaDB.transaction('key-val-store', 'readwrite').store; const unwrappedStore1 = unwrap(store1); const unwrappedStore2 = unwrap(store2); + const unwrappedStore3 = unwrap(store3); typeAssert>(true); - typeAssert>(true); + typeAssert>(true); assert.instanceOf(unwrappedStore1.get('foo'), IDBRequest); assert.instanceOf(unwrappedStore2.get('foo'), IDBRequest); + assert.instanceOf(unwrappedStore3.get('foo'), IDBRequest); }); }); @@ -1973,15 +1979,21 @@ suite('IDBPIndex', () => { const index1 = schemaDB.transaction('object-store').store.index('date'); const index2 = db.transaction('object-store').store.index('title'); + const index3 = schemaDB + .transaction('object-store', 'readwrite') + .store.index('date'); + const unwrappedIndex1 = unwrap(index1); const unwrappedIndex2 = unwrap(index2); + const unwrappedIndex3 = unwrap(index3); typeAssert>(true); - typeAssert>(true); + typeAssert>(true); assert.instanceOf(unwrappedIndex1.get('foo'), IDBRequest); assert.instanceOf(unwrappedIndex2.get('foo'), IDBRequest); + assert.instanceOf(unwrappedIndex3.get('foo'), IDBRequest); }); });