You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 6, 2021. It is now read-only.
One idea no Replit API package has managed so far (to my knowledge), is an interfacing option with ReplDB. I don't quite mean enveloping the ReplDB package with ReplAPI.it, but rather sending requests to the endpoint.
Ideas:
First initialize a ReplDB class, parameter can be to supply the endpoint URL
Use the normal functions (set, get, delete, list), just like the current ReplDB package
Add more utility functions?
This doesn't do much with just the basic functions and it could possibly be easier for users if there are utilities...
Pushed an update (2.0.8 on 4/25/2021) with the Database as an Experimental Feature. To use it, turn on Experimental Features.
The Database class will support ReplDB functions or the new ReplDB+ setup for ReplDB (in development by me).
What is ReplDB+?
Unlike the original ReplDB, ReplDB+ is an opinionated, easy-to-use database built on top of the existing ReplDB setup. It will hopefully include many features that give ReplDB a feel similar to a modern database. Modeled after Cloud Firestore, ReplDB+ is a NoSQL database with collections that contain documents of data. It will have more expressive functions, ease-of-life methods, privacy features, and more!
Current usage:
Database.constructor(dblink, salt, options)
dblink ~ The link to the database, automatically uses the
salt ~ A salt value to use for encrypting the password
options ~ Initialization Options. Used to define the usage of the Database:
{id: String(dbToken).split('/')[4]||process.env.REPLIT_DB_URL.split('/')[4],// The resource id of the databaseowner: process.env.REPL_OWNER,// The owner of the databasecollaborators: { ...options.collaborators},// Usernames and access levels of collaborators of the databasepassword: { ...hash(String(options.password),String(salt))},// Password to use the databasetype: options.type,// Type of database (currently accepts "repldb" or "plus")encrypted: options.encrypted||[false],// Whether or not to use encryption on the database'max-items': options['max-items']||10,// Maximum items in pagination}
Of course, none of these do anything right now.
Current Database Functions
Database.init() ~ Initialize the database. IMPORTANT database initialization with ReplAPI.it will only occur one time. After that, if it detects configuration exists on the database the function gets ignored. The program will throw an error if it doesn't find a "createDatabaseFlag" value in the .replapirc.json configuration files in order to prevent accidental initialization.
Database.createCollection(collectionName) ~ Create a collection
Database.createDoc(collectionName, docName, docItems) ~ Create a document in a collection
Database.getCollection(collectionName) ~ Get all documents
Database.getDoc(collectionName, docName) ~ Get a specific document in a collection
Database.updateDoc(collectionName, docName, docItems) ~ Overwrite contents in a document
Database.delete(key) ~ DO NOT USE This is placeholder with a incorrect function
Here are the database options, except easier on the eyes:
When you initialize a Database (using constructor)
{password: '',// <String> (required) A password to use to access the databasetype: '',// <String> (required) The type of database; options include "repldb" or "plus"collaborators: {},// <Object> (optional) The collaborators on a database (see below)encrypted: [],// <Array> (optional) Whether to use encryption automatically (see below)'max-items': 0,// <Integer> (optional)}
In the background, these are the options that are coded into the database:
Activity
rayhanadev commentedon Apr 25, 2021
Pushed an update (2.0.8 on 4/25/2021) with the Database as an Experimental Feature. To use it, turn on Experimental Features.
The Database class will support ReplDB functions or the new ReplDB+ setup for ReplDB (in development by me).
What is ReplDB+?
Unlike the original ReplDB, ReplDB+ is an opinionated, easy-to-use database built on top of the existing ReplDB setup. It will hopefully include many features that give ReplDB a feel similar to a modern database. Modeled after Cloud Firestore, ReplDB+ is a NoSQL database with collections that contain documents of data. It will have more expressive functions, ease-of-life methods, privacy features, and more!
Current usage:
dblink~ The link to the database, automatically uses thesalt~ A salt value to use for encrypting the passwordoptions~ Initialization Options. Used to define the usage of the Database:Of course, none of these do anything right now.Current Database Functions
Database.init()~ Initialize the database. IMPORTANT database initialization with ReplAPI.it will only occur one time. After that, if it detects configuration exists on the database the function gets ignored. The program will throw an error if it doesn't find a "createDatabaseFlag" value in the .replapirc.json configuration files in order to prevent accidental initialization.Database.createCollection(collectionName)~ Create a collectionDatabase.createDoc(collectionName, docName, docItems)~ Create a document in a collectionDatabase.getCollection(collectionName)~ Get all documentsDatabase.getDoc(collectionName, docName)~ Get a specific document in a collectionDatabase.updateDoc(collectionName, docName, docItems)~ Overwrite contents in a documentDatabase.delete(key)~ DO NOT USE This is placeholder with a incorrect functionMore to come!
rayhanadev commentedon Apr 28, 2021
Some (hopefully) planned features:
Deletion
Database.deleteCollection()Database.deleteDoc()Database.deleteField()Security
Database.encrypt()Ease of life Functions
.where('votes', '>', '100')returning documents meeting criteria)rayhanadev commentedon Apr 28, 2021
Here are the database options, except easier on the eyes:
When you initialize a Database (using constructor)
In the background, these are the options that are coded into the database:
What do you put in the collaborator field?
or:
What do you put in the encrypted field?
or:
rayhanadev commentedon May 3, 2021
Added deletion features :)