Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

idb

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

idb - npm Package Compare versions

Comparing version 7.0.1 to 7.0.2

2

build/entry.d.ts

@@ -48,3 +48,3 @@ export interface OpenDBCallbacks<DBTypes extends DBSchema | unknown> {

export declare function deleteDB(name: string, { blocked }?: DeleteDBCallbacks): Promise<void>;
export { unwrap, wrap } from './wrap-idb-value';
export { unwrap, wrap } from './wrap-idb-value.js';
declare type KeyToKeyNoIndex<T> = {

@@ -51,0 +51,0 @@ [K in keyof T]: string extends K ? never : number extends K ? never : K;

@@ -1,2 +0,2 @@

export * from './entry';
import './database-extras';
export * from './entry.js';
import './database-extras.js';

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).idb={})}(this,(function(e){"use strict";const t=(e,t)=>t.some((t=>e instanceof t));let n,r;const o=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap;let u={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return s.get(e);if("objectStoreNames"===t)return e.objectStoreNames||i.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return p(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function d(e){u=e(u)}function f(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(r||(r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(D(this),t),p(o.get(this))}:function(...t){return p(e.apply(D(this),t))}:function(t,...n){const r=e.call(D(this),t,...n);return i.set(r,t.sort?t.sort():[t]),p(r)}}function l(e){return"function"==typeof e?f(e):(e instanceof IDBTransaction&&function(e){if(s.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",s),e.removeEventListener("abort",s)},o=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",s),e.addEventListener("abort",s)}));s.set(e,t)}(e),t(e,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,u):e)}function p(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",s)},o=()=>{t(p(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&o.set(t,e)})).catch((()=>{})),c.set(t,e),t}(e);if(a.has(e))return a.get(e);const t=l(e);return t!==e&&(a.set(e,t),c.set(t,e)),t}const D=e=>c.get(e);const I=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],y=new Map;function B(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(y.get(t))return y.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=b.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!o&&!I.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,o?"readwrite":"readonly");let i=s.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),o&&s.done]))[0]};return y.set(t,s),s}d((e=>({...e,get:(t,n,r)=>B(t,n)||e.get(t,n,r),has:(t,n)=>!!B(t,n)||e.has(t,n)})));const g=["continue","continuePrimaryKey","advance"],h={},v=new WeakMap,m=new WeakMap,w={get(e,t){if(!g.includes(t))return e[t];let n=h[t];return n||(n=h[t]=function(...e){v.set(this,m.get(this)[t](...e))}),n}};async function*E(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;t=t;const n=new Proxy(t,w);for(m.set(n,t),c.set(n,D(t));t;)yield n,t=await(v.get(n)||t.continue()),v.delete(n)}function L(e,n){return n===Symbol.asyncIterator&&t(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===n&&t(e,[IDBIndex,IDBObjectStore])}d((e=>({...e,get:(t,n,r)=>L(t,n)?E:e.get(t,n,r),has:(t,n)=>L(t,n)||e.has(t,n)}))),e.deleteDB=function(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),p(n).then((()=>{}))},e.openDB=function(e,t,{blocked:n,upgrade:r,blocking:o,terminated:s}={}){const i=indexedDB.open(e,t),a=p(i);return r&&i.addEventListener("upgradeneeded",(e=>{r(p(i.result),e.oldVersion,e.newVersion,p(i.transaction))})),n&&i.addEventListener("blocked",(()=>n())),a.then((e=>{s&&e.addEventListener("close",(()=>s())),o&&e.addEventListener("versionchange",(()=>o()))})).catch((()=>{})),a},e.unwrap=D,e.wrap=p}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).idb={})}(this,(function(e){"use strict";const t=(e,t)=>t.some((t=>e instanceof t));let n,r;const o=new WeakMap,s=new WeakMap,i=new WeakMap,a=new WeakMap,c=new WeakMap;let u={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return s.get(e);if("objectStoreNames"===t)return e.objectStoreNames||i.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return p(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function d(e){u=e(u)}function f(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(r||(r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(D(this),t),p(o.get(this))}:function(...t){return p(e.apply(D(this),t))}:function(t,...n){const r=e.call(D(this),t,...n);return i.set(r,t.sort?t.sort():[t]),p(r)}}function l(e){return"function"==typeof e?f(e):(e instanceof IDBTransaction&&function(e){if(s.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",s),e.removeEventListener("abort",s)},o=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",o),e.addEventListener("error",s),e.addEventListener("abort",s)}));s.set(e,t)}(e),t(e,n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,u):e)}function p(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",o),e.removeEventListener("error",s)},o=()=>{t(p(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",o),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&o.set(t,e)})).catch((()=>{})),c.set(t,e),t}(e);if(a.has(e))return a.get(e);const t=l(e);return t!==e&&(a.set(e,t),c.set(t,e)),t}const D=e=>c.get(e);const I=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],y=new Map;function B(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(y.get(t))return y.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,o=b.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!o&&!I.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,o?"readwrite":"readonly");let i=s.store;return r&&(i=i.index(t.shift())),(await Promise.all([i[n](...t),o&&s.done]))[0]};return y.set(t,s),s}d((e=>({...e,get:(t,n,r)=>B(t,n)||e.get(t,n,r),has:(t,n)=>!!B(t,n)||e.has(t,n)})));const g=["continue","continuePrimaryKey","advance"],h={},v=new WeakMap,m=new WeakMap,w={get(e,t){if(!g.includes(t))return e[t];let n=h[t];return n||(n=h[t]=function(...e){v.set(this,m.get(this)[t](...e))}),n}};async function*E(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;const n=new Proxy(t,w);for(m.set(n,t),c.set(n,D(t));t;)yield n,t=await(v.get(n)||t.continue()),v.delete(n)}function L(e,n){return n===Symbol.asyncIterator&&t(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===n&&t(e,[IDBIndex,IDBObjectStore])}d((e=>({...e,get:(t,n,r)=>L(t,n)?E:e.get(t,n,r),has:(t,n)=>L(t,n)||e.has(t,n)}))),e.deleteDB=function(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),p(n).then((()=>{}))},e.openDB=function(e,t,{blocked:n,upgrade:r,blocking:o,terminated:s}={}){const i=indexedDB.open(e,t),a=p(i);return r&&i.addEventListener("upgradeneeded",(e=>{r(p(i.result),e.oldVersion,e.newVersion,p(i.transaction))})),n&&i.addEventListener("blocked",(()=>n())),a.then((e=>{s&&e.addEventListener("close",(()=>s())),o&&e.addEventListener("versionchange",(()=>o()))})).catch((()=>{})),a},e.unwrap=D,e.wrap=p}));

@@ -1,2 +0,2 @@

import { IDBPCursor, IDBPCursorWithValue, IDBPDatabase, IDBPIndex, IDBPObjectStore, IDBPTransaction } from './entry';
import { IDBPCursor, IDBPCursorWithValue, IDBPDatabase, IDBPIndex, IDBPObjectStore, IDBPTransaction } from './entry.js';
export declare const reverseTransformCache: WeakMap<object, any>;

@@ -3,0 +3,0 @@ export declare function replaceTraps(callback: (currentTraps: ProxyHandler<any>) => ProxyHandler<any>): void;

{
"name": "idb",
"version": "7.0.1",
"version": "7.0.2",
"description": "A small wrapper that makes IndexedDB usable",

@@ -10,2 +10,3 @@ "main": "./build/index.cjs",

".": {
"types": "./build/index.d.ts",
"module": "./build/index.js",

@@ -16,2 +17,3 @@ "import": "./build/index.js",

"./with-async-ittr": {
"types": "./with-async-ittr.d.ts",
"module": "./with-async-ittr.js",

@@ -42,4 +44,6 @@ "import": "./with-async-ittr.js",

"devDependencies": {
"@rollup/plugin-commonjs": "^21.0.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.3.0",
"@types/chai": "^4.2.22",
"@types/estree": "^0.0.51",
"@types/mocha": "^9.0.0",

@@ -49,11 +53,11 @@ "chai": "^4.3.4",

"del": "^6.0.0",
"filesize": "^8.0.6",
"glob": "^7.2.0",
"mocha": "^9.1.3",
"filesize": "^9.0.8",
"glob": "^8.0.3",
"mocha": "^10.0.0",
"prettier": "^2.4.1",
"rollup": "^2.59.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup": "^2.75.6",
"rollup-plugin-terser": "^7.0.2",
"typescript": "^4.3.1-rc"
"tsd": "^0.21.0",
"typescript": "^4.7.3"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc