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

@redbeardlab/simplesql

v1.0.8

Published

An SDK for SimpleSQL.redbeardlab.com

Downloads

24

Readme

SimpleSQL SDK

SimpleSQL is a complete SQL database accessible via HTTP API.

It is based on SQLite and allow to create a multitude of small databases.

(Consider that we run our front-end test against the live service and each test create a new database.)

The API is documented on swagger where it is possible to create a new database and execute commands and query against it. Don't worry it is free!

User without authentication can create and work only with public databases, for private databases is necessary to register and then the user will have access to authentication tokens.

Subscribe to the mail list

SimpleSQL is a growing project, you can subscribe to updates here.

The SDK

This package provide a Javascript SDK that allow to write severless application that can comunicate with a database directly from the browser. The same SDK can be used to develop nodejs application.

The SDK is simple just like the API and it should be possible to understand it very quickly, especially if guided by the tests.

Installation

On server environments npm i @redbearlab/simplesql.

On browsers:

<script type="text/javascript" src="https://unpkg.com/@redbeardlab/simplesql@>=1.0.8"></script>

In the browser environment is necessary to set the CORS headers to use the authentication/private databases.

Access-Control-Allow-Origin: https://simplesql.redbeardlab.com

API

The API is await/async first.

Create new database

let new_public_database = await SimpleSQL.newDatabase();
let new_private_database = await SimpleSQL.newDatabase('your_token_here');

SimpleSQL.newDatabase([token]) create a new (private if you provide the token) database and returns its ID.

Send Command

let result_public = await SimpleSQL.command(database_id, query);
let result_private = await SimpleSQL.command(database_id, query, 'your_token_here');

SimpleSQL.command(database, command [, token] ) execute an SQL command against the database and return the results. If you provide a token it is possible to execute commands also against the private databases create by the costumer.

List databases

let databases = await SimpleSQL.listDatabases('your_token_here');

SimpleSQL.listDatabases(token) returns all the databases of the costumer. The command must be invoked with a token, it is not possible to list all the public databases.

Create new token

let new_token = await SimpleSQL.newToken('your_token_here');

SimpleSQL.newToken(token) create a new token and return it. The new token can be used to access all the databases created with the original token, to create new databases, or to create new tokens.

List all tokens

let tokens = await SimpleSQL.listTokens('your_token_here');

SimpleSQL.listTokens(token) returns a list of all the token associate with the account. Each token can be used to create private databases, query private databases or create new tokens.

Contributing

The biggest contribution is your feedback on the product and API.

Feel free to open an issue, a PR or send directly an email to [email protected]

If you want to contribute to the code, feel free to run the tests.

A dummy user with a dummy token is present in the tests, it can be used freely.