Dexie.js | A Minimalistic Wrapper for IndexedDB | Storage library

 by   dfahlander JavaScript Version: v3.2.1-beta.1 License: Apache-2.0

kandi X-RAY | Dexie.js Summary

kandi X-RAY | Dexie.js Summary

Dexie.js is a JavaScript library typically used in Storage applications. Dexie.js has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can install using 'npm i f-dexie-observable' or download it from GitHub, npm.

[NPM Version][npm-image]][npm-url] [Build Status] with Browserstack(Dexie.js is a wrapper library for indexedDB - the standard database in the browser.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              Dexie.js has a medium active ecosystem.
              It has 7275 star(s) with 530 fork(s). There are 106 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 372 open issues and 667 have been closed. On average issues are closed in 215 days. There are 7 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of Dexie.js is v3.2.1-beta.1

            kandi-Quality Quality

              Dexie.js has 0 bugs and 0 code smells.

            kandi-Security Security

              Dexie.js has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              Dexie.js code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              Dexie.js is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              Dexie.js releases are available to install and integrate.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.
              Dexie.js saves you 284 person hours of effort in developing the same functionality from scratch.
              It has 687 lines of code, 0 functions and 361 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Dexie.js
            Get all kandi verified functions for this library.

            Dexie.js Key Features

            No Key Features are available at this moment for Dexie.js.

            Dexie.js Examples and Code Snippets

            No Code Snippets are available at this moment for Dexie.js.

            Community Discussions

            QUESTION

            migrate IndexedDB data to an array in JS
            Asked 2021-Mar-28 at 23:02

            I am relatively new to web development and currently trying to work out an "offline" Application with vue.js and dexie.js. Dexie.js allows easier access on modern browsers Indexed Database.

            Nontheless I believe my problem is more on the basic javascript side.

            I got this basic DB("enhanced" with Dexie):

            ...

            ANSWER

            Answered 2021-Mar-28 at 23:02

            You need to set app.tasks[i] to an empty object at the beginning of each assignment in the loop:

            Source https://stackoverflow.com/questions/66846650

            QUESTION

            Ensure data types in Dexie.js fields
            Asked 2021-Mar-25 at 12:53

            I have a Dexie.js database with the table "businessLayers" in my React application. I'd like to ensure de data types of the tuples inserted in that table. I thought the method Table.defineClass() would do that, but it does not. My db is the following:

            ...

            ANSWER

            Answered 2021-Mar-25 at 12:53

            Table.defineClass() was an old feature in Dexie 1.x for code completion only - no enforcements. The method should have been deprecated. But the functionality you need can be implemented using a DBCore middleware or creating/updating hooks. DBCore middlware would be the most performant solution as it does not need to verify existing data.

            Below is a dry coded full example. Please test and reply if it works. It should support String, Number, Boolean, Array, Object, Set, Map, ArrayBuffer, Uint8Array, etc... and even custom classes. If anyone wants to make a package of this code, please go ahead! I think it could be a nice addon to dexie:

            Source https://stackoverflow.com/questions/66798726

            QUESTION

            IndexedDB Database backup/ restore scenarios
            Asked 2021-Mar-07 at 22:49

            I have a question about indexedDB and Dexie.js library, for restoring and backing up databases and their performance improvements. lets imagine we have at least a 2 GB database (for offline map data) and they have a (key,value) structure which Key can be an string and value is blob (image or binary vector data). So in my scenario users select a database and my web application should start to download that database for offline access. So what approach do you think gives me the best performance in this case? Since I have to download the backup and restore them and for 2GB and a few million records it can be a performance challenge. I have done similar thing before for sqlite databases but I only needed to download the db file and connect to it. Here I have to restore IndexedDB after downloading which seems to be problematic. So I can break my problem in several sub issues:

            Firstly How can I make those databases in the first place?

            And then, how can I restore those backups? Is there any high-performance method to do so?

            Does the key data type (String or Integer) has effect on the performance of IndexedDB?

            ...

            ANSWER

            Answered 2021-Mar-07 at 22:49

            I'm not sure what you mean with "restore" but I think you mean to import data into IndexedDB? Or did you mean that IndexedDB is the backup and "restore" for putting it back into another database?

            I base the rest of my answer on the assumption that "restore" is importing data into indexeddb.

            The only way to know how the system would perform when adding millions of key/value (blob) based rows would be to test it. I would suggest you import the rows in chunks of maybe 1000 each and show a progress bar for each imported chunk. Use bulkAdd() or bulkPut() methods to import each chunk. Make sure not to do the entire import in a single transaction because that could probably starve the system and block indexeddb for too long. But by using the bulk-methods each chunk would use a single transaction at least (which is also important - one transaction per 1000 records would probably be fine - but if you test this, try different chunk sizes to find the optimal speed!).

            Also don't know what the user can expect in terms of waiting time. Can it be performed in the background while user can use your app in online mode? If so, it the user could probably accept longer import-time than if the user would have to wait for the entire data to be imported.

            You would also need to look at the StorageManager API and ask your user for permission to store large amounts of durable data. You can read page about it in dexie docs also.

            You would probably want a background worker to fetch the data and perform the bulk operations - create a service worker that does the job. Either use response.blob() and pass it to dexie-export-import. You could also try the ReadableStream api to download chunks of data. Letting a worker do this download and import will perform faster and not affect the application performance while importing.

            Dexie-export-import does almost exactly what I am suggesting here - imports the rows in chunks into indexeddb, but if using it you would need to let your service endpoint send JSON that is compatible with dexie-export-import where blobs are Baset64 encoded. But since your data is only keys and blobs, you could benefit from having your own binary format and do the bulkAdd() yourself without this addon.

            Regarding your last question: to my knowledge, there wouldn't be so much difference between using number or strings as keys. Long strings would be slower but short strings probably perform equal to numbers (correct me someone if this isn't true!). You would need to test to really know.

            If you will perform some test on this, please let me know what your results were ;)

            Source https://stackoverflow.com/questions/66500333

            QUESTION

            Dexie.js query with .equals not working with localStorage
            Asked 2021-Feb-01 at 04:53

            I am trying get a value from indexedDB with Dexie.js but it does not recognize the value from localStorage.

            I tried async/await, promises, placing localstorage call on created, mounted, outside export default, and none of these ways worked.

            ...

            ANSWER

            Answered 2021-Feb-01 at 04:53
            .equals strict equality

            The equals method is a strict equality test, so if id is a number type in indexedDB, then the string type returned from localStorage won't match, because of the different types. And localStorage only stores strings.

            For this reason, it's common to see JSON.parse used when retrieving data from localStorage, to convert serialized data :

            Source https://stackoverflow.com/questions/65979285

            QUESTION

            How to Troubleshoot Dexie bound on IDBKeyRange Error
            Asked 2020-Oct-23 at 16:55

            I'm using Dexie.js version 3.0.3-rc.3 in a Vue JS project and I occasionally run into this exception in Chrome (86):

            Failed to execute 'bound' on 'IDBKeyRange': The parameter is not a valid key.↵ DataError: Failed to execute 'bound' on 'IDBKeyRange': The parameter is not a valid key.

            Here's a screenshot of the full error:

            I'm fairly certain the problem lies with something in my data being undefined, but I'm trying to find a good way to troubleshoot this. I paused the Chrome dev tools on exceptions and inspected the code around this particular part of Dexie, but it doesn't reveal what data was used to make this exception occur.

            Does anyone have any suggestions on how to find out what's actually wrong? It feels a bit like a needle in a haystack.

            == Update ==

            Below is the full call stack:

            ...

            ANSWER

            Answered 2020-Oct-23 at 07:04

            Try inspecting the call stack. I know it can be long until you reach a frame within your application code, but the failing call should be there!

            Source https://stackoverflow.com/questions/64492402

            QUESTION

            Dexie.js: Table.where() errors with "Cannot read property 'bound' of undefined"
            Asked 2020-Oct-23 at 00:40

            I'm having some troubles getting where() statements to work in Dexie. My attempts to use where result in the following error:

            ...

            ANSWER

            Answered 2020-Oct-22 at 08:58

            I think you're missing to set Dexie.dependencies.IDBKeyRange also.

            Fake-indexeddb recommends to do the following to integrate fake-indexeddb in node:

            Source https://stackoverflow.com/questions/64475166

            QUESTION

            How to use Dexie.js inside of dedicated worker?
            Asked 2020-Jul-28 at 07:02

            I have a function that fetch a JSON data via window.fetch and put it inside IndexedDB table via db.table.bulkPut(array_of_data). It takes more than 10 seconds to do that because of large amount of data and it blocks UI and makes UX bad. I have decided to run this task in a Worker, but I have not found any examples how can I make that with Dexie.js or directly with IndexedDB

            Thank you for any advice :)

            ...

            ANSWER

            Answered 2020-Jul-28 at 07:02

            QUESTION

            Dexie JS .. Delete issue
            Asked 2020-Jul-23 at 00:51

            I am trying to delete a record by ID from indexedDB using dexie.js. (Dexie.js is a wrapper for indexedDB)

            ...

            ANSWER

            Answered 2020-Jul-23 at 00:51

            Please let your promise-using functions return a promise so you can chain the calls to them.

            Regarding calling delete within Collection.each(), it is not possible because Collection.each() is readonly unless you call it from a readwrite transaction. If you want to modify things within the iteration, use Collection.modify() instead of Collection.each(). This is described in the Notes section for Collection.each: https://dexie.org/docs/Collection/Collection.each()#notes

            Source https://stackoverflow.com/questions/63035406

            QUESTION

            setState in nested async function - React Hooks
            Asked 2020-May-10 at 15:47

            How can I build a function which gets some data asynchronously then uses that data to get more asynchronous data?

            I am using Dexie.js (indexedDB wrapper) to store data about a direct message. One thing I store in the object is the user id which I'm going to be sending messages to. To build a better UI I'm also getting some information about that user such as the profile picture, username, and display name which is stored on a remote rdbms. To build a complete link component in need data from both databases (local indexedDB and remote rdbms).

            My solution returns an empty array. It is being computed when logging it in Google Chrome and I do see my data. However because this is not being computed at render time the array is always empty and therefor I can't iterate over it to build a component.

            ...

            ANSWER

            Answered 2020-May-10 at 15:47

            Please set receivers initial value as array

            Source https://stackoverflow.com/questions/61709743

            QUESTION

            How to take a table data updated using Vue.js
            Asked 2020-Mar-28 at 09:14

            I have this vue.js instance that is managing the DOM of an electron app. I need to take the app UI updated, what is the app now doing is doing some calculations and then display the result. A save button will instruct the app to save the input info and the result of the calculations. What I'm trouble with is the DOM update. After I hit the save button, I need that the table that s displaying the data will refresh to show the new added row and show data into a chart. For the chart I didn't implemented it yet, I need help on how to format the dataset, for the rest, the table will not refresh for now.

            I'm using Dexie.js and I have chart.js as a dependency of the project.

            ...

            ANSWER

            Answered 2020-Mar-28 at 09:14

            To make a value or object reactive in Vue it needs to be initialised properly, generally this is either as a prop, a data property or a computed value.

            Vue is not seeing changes to your db variable because it hasn't been initialised as one of these.

            For an array of table data you can initialise it like this:

            Source https://stackoverflow.com/questions/60891696

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install Dexie.js

            You can install using 'npm i f-dexie-observable' or download it from GitHub, npm.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Storage Libraries

            localForage

            by localForage

            seaweedfs

            by chrislusf

            Cloudreve

            by cloudreve

            store.js

            by marcuswestin

            go-ipfs

            by ipfs

            Try Top Libraries by dfahlander

            dexie-relationships

            by dfahlanderJavaScript

            typeson

            by dfahlanderJavaScript

            idb-iegap

            by dfahlanderJavaScript

            dexie.js-web

            by dfahlanderJavaScript

            remotable

            by dfahlanderJavaScript