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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@techoopsie/oopsie

v0.0.21

Published

Javascript SDK for Oopsie

Readme

JS SDK to use towards Sites created at Oopsie. Visit http://oopsie.io for more information.

More documentation can be found at http://docs.techoopsie.com/

This SDK works both for node application and browsers applications.

Installation

npm

npm install @techoopsie/oopsie

Script tag

To get latest:

<script src="https://cdn.jsdelivr.net/npm/@techoopsie/oopsie/dist/oopsie.min.js"></script>

Or to get a specific version:

<script src="https://cdn.jsdelivr.net/npm/@techoopsie/oopsie@<version>/dist/oopsie.min.js"></script>

<!-- For example -->
<script src="https://cdn.jsdelivr.net/npm/@techoopsie/[email protected]/dist/oopsie.min.js"></script>

Webpack

If you are using webpack you might need to add

node: {
    fs: "empty"
}

to your webpack.config.js

Example

Initialization

var oopsie = new OopsieSite(apiEndpoint, siteId, customerId);
oopsie.init((err) => {
    // We are done loading meta data...
    // Now we can use oopsie to create, get, save, delete entities.
});

Chooce Application and Resource

var app = oopsie.getApp('BookApp');
var bookResource = app.getResource('Book');

Get entities

bookResource.get().withParams({}).limit(100).execute(callback);

// Get data from a View. 
var query = bookResource.get().byView('myView').withParams({example: 'test'}).limit(100).execute(callback);

query.nextPage(callback);
query.prevPage(callback);
query.hasNextPage();
query.hasPrevPage();

It is possible to query partition/clustering keys by using greater or equal then (gte) or less or equal then (lte). To do so, the syntax is:

// Here "key" is a partition or a cluster key on your Resource.

// Greater or equal then
bookResource.get().withParams({'key>': 'myKey'}).execute();
// Less or equal then
bookResource.get().withParams({'key<': 'myKey'}).execute();

Create entity

bookResource.create().withParams({}).execute((err, resp) => {});

Update entity

bookResource.save().withParams({}).execute((err, resp) => {});

Delete entity

bookResource.delete().withParams({}).execute((err) => {});

Api key

If you are using auth on your Site, you can create Api Keys to protect your data. You can use it in the JS SDK as below, but be carefull, you shouldn't do this in the frontend. If you do put it in the frontend, be sure it's not any secret data you want to protect. For example, you may put a read only Api Key in the frontend because you want anyone to be able to read your data, but you create data in your backend where you use another Api key with read permissions.

var oopsie = new OopsieSite(apiEndpoint, siteId, customerId);
oopsie.init((err) => {
    
    // We are done loading meta data...
    // Now we can use oopsie to create, get, save, delete entities.
    var apiKey = 'api-key-from-dashboard'; 
    oopsie.setApiKey(apiKey);
});

Handle Users

If you have auth enabled on your site you can manage Users via the SDK.

Register user

To let Users register via the SDK you need to set this up in the Dashboard for your site. By default no Roles are allowed to register via the API and only the Admin for the Site can add Users in the Dashboard.

var user = {
    email: '[email protected]',
    password: 'my-super-secret',
    firstname: 'Anja',
    lastname: 'Hrabun'
};
oopsie.register(user, (err) => {
    if (err) {
        // We failed to register user.
        alert(err.message);
        return;
    }
    // User registered.
})

Login user

var user = {
    email: '[email protected]',
    password: 'my-super-secret'
};
oopsie.login(user, (err) => {
    if (err) {
        // We failed to login.
        alert(err.message);
        return;
    }
    // User logged in.
})

Logout

oopsie.logout((err) => {
    if (err) {
        // We failed to logout.
        alert(err.message);
        return;
    }
    // User logged out.
})

Me

oopsie.me((err, me) => {
    if (err) {
        // We failed to get me.
        return alert(err.message);
    }
    console.log(me); // {email: '[email protected]', id: 'id-of-user', auths: []}
})

isLoggedIn

This is basically a wrapper around the "oopsie.me()" function, but it returns a boolean to easier verify if user is logged in or not.

oopsie.isLoggedIn((err, loggedIn) => {
    if (err) {
        // We failed check if logged in, something went wrong.
        return alert(err.message);
    }
    console.log(loggedIn); // True if user is logged in, false otherwise.
});

Promises

Oopsie SDK follows nodejs callback pattern so you can use bluebird to promisefy the functions if you rather use promises then callbacks.

Examples

Examples can be found in the examples folder. Each example will be in a subfolder and include everything needed to run the example. They need a working Oopsie site to run, and we will most likely provide them for you, but you can also create your own Site in the sandbox and try the examples against your own Site.

NOTE: the examples are meant to give you a better understanding of how you can use Oopsie to store your data and handle your Users, they are not meant to be a beauty for the eye ;)

If you can't stand the awesome design of the examples, feel free to give us a pull request

Development

Prerequisite

Node and npm

npm install

Build dev and watch

npm run dev

Build production

npm run build

Run tests once

npm run test

Run tests with watch

npm run tdd