npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

biota

v0.1.17

Published

a simple, yet powerful, framework for faunadb

Downloads

5

Readme

Feature requests npm npm GitHub npm bundle size

Find the raw documentation here.

import { Biota } from "biota";
// 4 lines to:
const db = new Biota({ secret: "<your-secret>" });

// - 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("[email protected]", "password", {
  nickname: "Georgy",
});

// - create a todo
await asUser.documents("todos").insert({ name: "Remember to star this project" });

// - query a todo with $ngram (autocomplete behavior)
await asUser.documents("todos").find({ name: { $ngram: "star" } });
// output: [{ ref, ts, data: { name: "Remember to star this project" } }]

Current status

Finishing up design and tests of the main API (400+ methods).

🙃 You're on preview 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!)

Found some errors? Let us know!

Getting Started

These instructions will take you through the few steps to get started playing with your Fauna database.

Prerequisites

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

import { Biota } from "biota";
// or
const { Biota } = require("biota");

Instance

There are two ways to instantiate Biota.

  1. You can use a admin/server key (or any secret key) as a paremeter.
const db = new Biota({ secret: "<your-secret>"})
// example
await db.query( q.Create(...) )
  1. You can use the function .login(id, password) to log a user.
const db = new Biota()
const logged = await db.login("123", "super_password123")
// which is a shortcut for
const logged = await db.current.user.login("123", "super_password123")

// example
await logged.query( q.Create(...) )

Api

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.. :)

Helpers

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.database(ctx)(name).insert(options)

Running the tests

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 😉

Built With

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

  • Gabin Desserprit instigator

See also the list of contributors who participated in this project. Join us :beers:

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

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 🙏