Closed ArtemGr closed 3 years ago
Hello!
LevelUp works with LevelDB, not IndexedDB. IMHO it doesn't suit. I found a pretty library called Dexie, it's powerful and very simple at the same time . Please look at this: https://observablehq.com/d/602f3b3d0d67a121
Nice!
BTW, what do you think this project is all about? D
Hm... What is it about?
We've also experimented with @Speedwares on loading the levelup, decided against it, but came up with the following ObservableHQ snippet in the process:
viewof requirejsExperiment = {
const script = document.createElement ('script')
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.6/require.js'
await new Promise ((resolve, reject) => {script.onload = resolve; document.head.appendChild (script)})
console.log ('requirejs loaded')
// Load the `date-and-time` module via the CommonJS `module.exports = date` code there
// https://requirejs.org/docs/api.html#cjsmodule, https://requirejs.org/docs/commonjs.html
window.define ('date', function (require, exports, module) {
return require ('https://unpkg.com/date-and-time@0.14.2/date-and-time')})
const date = await new Promise ((resolve, reject) => window.require (['date'], resolve))
const iso8601m = date.compile ('YYYY-MM-DDTHH:mm[Z]')
console.log ('date', date, date.format (new Date(), iso8601m, true))}
Hm... What is it about?
I guess there are different ways to look at it. One is - making the data more accessible and learning to work with it. Like the data about the bounties and the freelance jobs and the freelancers for instance, but other kinds of user data as well. We also want to learn to synchronize the offline-first data better, between the various servers and devices. Make sharing the data easier.
Feels like.. Liberating the data.
We've also experimented with @Speedwares on loading the levelup, decided against it, but came up with the following ObservableHQ snippet in the process
This is an interesting snippet. Does it work? I had some troubles loading some modules into ObservableHQ (I examined many of them to find the best one), this trick could help me (fortunately, the one that looked like the best one appeared to be compatible with ObservableHQ's require
).
We also want to learn to synchronize the offline-first data better, between the various servers and devices.
When I browsed the libraries for IndexedDB I saw something about it but rejected that module for some reason (either it was too inconvenient or too primitive). Now I'm going to find it again and look more attentively, maybe this module or some part of it can be useful for this project.
I submitted a claim. Would you accept it when you'll have a minute please?
Found the library I told about: https://github.com/mWater/minimongo . It doesn't seem lightweight but it has something about the synchronization and many other things that may appear useful.
This is an interesting snippet. Does it work?
I think so,
Now I'm going to find it again and look more attentively
I'm going to look at cpisync and how they're using cuckoo filters. Was going to experiment with merkle trees before that. Most databases encapsulate the data in a way that does not support the manual tinkering of it very well. I did a few of such implementations myself. But nowadays I think it pays to make a step back and implement a more generic list synchronization first. cf. https://hal.inria.fr/file/index/docid/535653/filename/Greenwald2006Agreeing-to-Agree-C.pdf
Found the library I told about: https://github.com/mWater/minimongo
Thanks. "Upserts are stored in local databases in a special state to record that they are upserts". A familiar idea, one of those which seems not very compatible with diverged data sets and with manual tinkering.
https://hal.inria.fr/file/index/docid/535653/filename/Greenwald2006Agreeing-to-Agree-C.pdf
I'll study this document.
Look for https://rxdb.info/. It has also replication feature and observable collections.
https://observablehq.com/@artemgr/path has the
fileForm
cell. I want the code in that cell to store the items in the browser's IndexedDB, but through a wrapper that is lightweight, convenient and compatible with NodeJS =Dhttps://github.com/Level/levelup looks good for that?
Acceptance test would be to file a number of items through that form in a fork of https://observablehq.com/@artemgr/path and see them appear in browser's developer tools rendition of the IndexedDB.
( Some of the context, entirely optional, can be gleaned from comments at https://github.com/ArtemGr/bounty/commit/b7e8867b3b8253dfd885aafc50934545e9029496#commitcomment-48515173 )