Why repldb
Repldb is amazing. it is completely free and integrated into repl. the problem though is that repl db has some values which it cannot parse, etc which becomes really annoying:
Do any of you know why this happens? Is there a way to prevent this?
Edit: For clarification: some values fail to be properly retrieved and this results with the program crashing.
If you're referring to Repl.it's Node implementation, it uses JSON. It can't parse a JSON input that isn't JSON. Try just using @coder100 's implementation or make your own! Also, you can use encodeURIComponent
and decodeURIComponent
to sanitize different characters!
@AmazingMech2418 The raw option it says also doesn't exist, so if you want that, you have to go into the module for ReplDB and make your own modification. LOL!
@AmazingMech2418 hmm, i actually do use coder100's implementation, @Coder100 can you make your replitdb-client
use the encodeURIComponent and decodeURIComponent?
@EpicGamer007 Are you sure? The issue seems to be in the following code which is @replit/database
...
<removed because all you need is in the next code snippet>
Look specifically at this part:
try { // Try to parse as JSON, if it fails, we throw value = JSON.parse(strValue); } catch (_err) { throw new SyntaxError( `Failed to parse value of ${key}, try passing a raw option to get the raw value` ); }
@EpicGamer007 Wait... @Coder100 's implementation is the same as @replit/database
...
@AmazingMech2418 Wait, does @Coder100 know about this? LOL!
@EpicGamer007 Run require("@replit/database").toString()
to test this.
@EpicGamer007 https://repl.it/@AmazingMech2418/ReplDB-test#a Compare the files a and b. LOL! They are pretty much the same!
@EpicGamer007 Literally, Repl.it reformatted @Coder100 's code and called it their own. LOL! I don't see any credit either!
@EpicGamer007 What is this? StackOverflow?
@AmazingMech2418 wait, so who copied, coder or repl?
@EpicGamer007 Actually, I just looked and @Coder100 's is actually a fork of https://github.com/mrlapizgithub/repl-it.js ! That one is contributed to by @amasad 's brother too and likely other members of the Repl.it team! And @Coder100 's post was created AFTER that was!
@EpicGamer007 Wait, the mrlapizgithub was actually @Coder100 too. LOL! He just moved to cursorweb on GitHub though... So technically, Repl.it took it from @Coder100 ... Unless you count the contributions from masfrost and kochman. IDK...
oh yeah masfrost specifically asked permission lol @AmazingMech2418
it's all good, so here is what happened
- old computer: (was mrlapizgithub)
- initial development of lib
- repl.it: acquired
- mission complete time to abandon project
@AmazingMech2418
@Coder100 Ah... Okay. LOL!
@Coder100 lol, i wish u can add the encode and decode URIComponent, it sucks that we have to do it manually :((
I think it might just be a bad client which isn't URL-encoding characters. Here's my results, with the input character on the left, and what each client put it in the DB as:
@replit/database
replitdb-client
better-repldb
a
a
a
a
/
/
*/
*/
%
?
?
*?
*?
*#
#
*#
*#
*=
Note that I also encountered issues with deleting keys, those are marked with an asterisk. As far as I have tested, you can fix all of these issues by URL-encoding your keys and values first, using
encodeURIComponent
, except for/
, which should not be put in the database when using the official client orreplitdb-client
due to deletion issues.Edit: added
better-repldb
@19wintersp This is true, but this issue, I believe, has to do with JSON.
@AmazingMech2418 It's stored as JSON?! I thought these issues stemmed from the usage of HTTP requests to update the database, and URLs being badly created... that's why I tested those characters specifically, and when compared to the API, the results make sense.
@19wintersp Yeah. LOL! It uses JSON instead of text for the Node version. That's why
curl
worked!@AmazingMech2418 What? I'm confused... what's using JSON? Does ReplDB have a JSON API?
@19wintersp The clients use JSON. At least
repldb-client
and@replit/database
which are the same thing.@AmazingMech2418 As in, internally? I'm going to look at the source...