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

kinvey-local

v0.0.5

Published

Tool to mock the Kinvey environment for testing.

Downloads

3

Readme

kinvey-local Build Status View on NPM code climate code coverage

Tool to mock the Kinvey environment for testing.

NPM

Installation

Install the latest version of this package with npm:

$ npm install kinvey-local

Usage

This package can simply replace your regular Kinvey import. For example:

// with regular kinvey object
var Kinvey = require('kinvey');

Kinvey.User.login('username', 'password', {
    success: function () {
        console.log('Success.');
    }
});
// inside your tests
var Kinvey = require('kinvey-local');

test.expect(1);
Kinvey.User.login('username', 'password', {
    success: function () {
        test.ok(true);
    }
});

Example Usage

An example of a business-logic repository is available in the example directory.

Options

How to Set Options

Options for kinvey-local should be saved inside a JSON file in your repo and loaded through the .setOptions() member of the kinvey-local object:

var Kinvey = require('kinvey-local');

// you can use a file path to load the document
Kinvey.setOptions(path.resolve('./kinvey-local.json'));

// you can also send a pre-parsed document as an argument:
Kinvey.setOptions({
    /* .. TODO: add values .. */
});

List of Options

  • endpoints-base: an absolute path to the directory with all the endpoints source code. (i.e. options["endpoints-base"] = path.resolve('./endpoints'))
  • email: a JSON document consisting of the nodemailer configuration to use for the email module. Most basic example (with gmail):
{
    "email": {
        "service": "Gmail",
        "auth": {
            "user": "[email protected]",
            "pass": "my-password"
        }
    }
}

Note: you can set this property to the string events to turn the event reporting into an event-based thing, where the event emitter is: Kinvey._events

  • collections: a JSON document to add pre-made data stores to the phony local environment. The property names are the names of the data stores and the value must an array of documents. Sample:
{
    "collections": {
        "my-data-store": [
            {
                "_id": "xxx",
                "name": "Document #1"
            }
        ]
    }
}
  • users: an array of user configurations. Sample:
{
    "users": [
        {
            // the _id property is required
            // and must be a valid string containing
            // only letters and numbers
            "_id": "identifier",
            "username": "userone",
            "password": "******",
            "email": "[email protected]"
        }
    ]
}

What isn't yet supported?

This project is still in its early stages, so the local environment does not support everything. I've tried to extend the support as much for it to work exactly as intended, but have no gotten around to implementing hooks and the tempObjectStore just yet. This is on the TODO list and will be supported soon.

Licensing

For license information, see LICENSE.md.

Support

I will try to keep this project as up-to-date as possible with the Kinvey spec, and bring the hooks support in soon. For all issues/todo-wishes, please use the official GitHub issues section.