Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A simple, yet 💪, slightly opiniated database framework for Fauna, written in Javascript (Typescript).
🙃 You're on beta release. Don't get scared though, the api is pretty stable but tests need to be added to be fool-proof. (Thus, as of yet, Biota isn't production ready.)
❤️ Check the features and request the ones you would love to see in biota. (They arn't all listed yet!)
Getting some errors? Let us know!
import { Biota } from "biota";
// 4 lines to:
const db = new Biota({ secret: "<your-secret>", private_key: "123" });
// - scaffold the whole database (inc. users collection for ex)
await db.foundation();
// - add todos collection
await db.collection("todos").scaffold();
// - add autocomplete-search on name field
await db.collection("todos").index({ field: "name", ngram: true });
// 4 lines to:
// - create a user & login
let asUser = await db.user.register("my@email.com", "password", {
nickname: "Georgy",
});
// - create a todo
await asUser.collection("todos").insert({ name: "Remember to star this project" });
// - query a todo with $ngram (autocomplete behavior)
await asUser.collection("todos").find({ name: { $ngram: "star" } });
// output: [{ ref, ts, data: { name: "Remember to star this project" } }]
These instructions will take you through the few steps to get started playing with your Fauna database.
You'll need to add biota
either as a global or local (project) dependency.
yarn add biota // -G for global
// or
npm i biota // -G for global
import { Biota } from "biota";
// or
const { Biota } = require("biota");
There are two ways to instantiate Biota.
admin/server key
(or any secret key) as a paremeter.const db = new Biota({ secret: "<your-secret>"})
// example
await db.query( q.Create(...) )
.user.login(id, password)
to log a user.const db = new Biota()
const logged = await db.user.login("123", "super_password123")
// example
await logged.query( q.Create(...) )
Even though you can query
your database (same as you would do with the same fauna method query
), the main power of Biota lives in its extended api.
⏳ Patience: It's coming.. :)
const { q, factory, Page } = require('biota')
// q: export the query builder, same as fauna.query
q.If(..., true, false)
// factory: export the factory api (helpers that wrap FQL)
factory.create.database(name, options)
If you want to run the tests, you'll need to provide a FAUNA_KEY_TEST=<your-test-key>
in a .env
file.
:warning: Careful: At the moment tests covering everything yet. PR welcomed 😉
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project. Join us :beers:
This project is licensed under the MIT License - see the LICENSE.md file for details
This lib wouldn't exist if I had not dug deep into Fauna FQL and got helped through the Fauna's slack community channel. In no order, I'ld like to thank, for their help and support, fauna's team (Brecht De Rooms, Ben Edwards, Marrony Neris, Leo Regnier, Summer, ,...) as well as other users like Eigil Sagafos 🙏
FAQs
a simple, yet powerful, framework for faunadb
The npm package biota receives a total of 0 weekly downloads. As such, biota popularity was classified as not popular.
We found that biota demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.