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

parse-superagent

v0.0.3

Published

A Parse.com REST client using superagent.

Readme

parse-superagent

A Parse.com REST client using superagent.

Install

npm install parse-superagent

Additional Install for Parse cloud code end-to-end testing.

npm install supertest

Usage

Simple example, included as examples/client.js:

/**
 * client.js
 */

var parseSuperAgent = require('../lib'),
    events = require('events'),
    eventEmitter = new events.EventEmitter();

// Setup the parse keys by environment variables.
// export NODE_PARSE_APP_ID=<Application ID>
// export NODE_PARSE_REST_API_KEY=<REST API Key>
// export NODE_PARSE_MASTER_KEY=<Master Key>
// export NODE_USE_PARSE_MASTER_KEY=(0|1)

// Or the instantiate arguments.
var client = new parseSuperAgent(/*{
  applicationId: '<Application ID>',
  restApiKey: '<REST API Key>',
  masterKey: '<Master Key>',
  useMasterKey: true  # Or false
}*/);

client.runFunction('hello').end(function(error, response) {
  if (error) {
    throw error;
  }
  console.log(response.body);
  // => { result: 'Hello world!' }
});

client.sendBatchRequest({
          requests: [{
            method: 'POST',
            path: '/1/classes/GameScore',
            body: {
              score: 1337,
              playerName: "Sean Plott"
            }
          }, {
            method: 'POST',
            path: '/1/classes/GameScore',
            body: {
              score: 1338,
              playerName: "ZeroCool"
            }
          }]
}).end(function(error, response) {
  if (error) {
    throw error;
  }
  console.log(response.body);
  // => [ { success:
  // { createdAt: '2013-11-17T14:43:40.296Z',
  // objectId: 'aGFMHhdHBY' } },
  // { success:
  // { createdAt: '2013-11-17T14:43:40.308Z',
  // objectId: 'rpQbB6RXgT' } } ]
  eventEmitter.emit('batchEnd');
});

client.send('POST', '/1/classes/GameScore', {
  score:1337,
  playerName: "Sean Plott",
  cheatMode:false
}).end(function(error, response) {
  if (error) {
    throw error;
  }
  console.log(response.body);
  // => { createdAt: '2013-11-17T14:43:40.297Z',
  // objectId: 'W2tdhLOWKC' }
  eventEmitter.emit('created', response.body.objectId);
});

eventEmitter.on('created', function(objectId) {
  client
    .send('GET', '/1/classes/GameScore/' + objectId)
    .end(function(error, response) {
      if (error) {
        throw error;
      }
      console.log(response.body);
      // => { cheatMode: false,
      // playerName: 'Sean Plott',
      // score: 73453,
      // createdAt: '2013-11-17T14:43:40.297Z',
      // updatedAt: '2013-11-17T14:43:41.432Z',
      // objectId: 'W2tdhLOWKC' }
      eventEmitter.emit('fetched', response.body.objectId);
    });

  client
    .send('PUT', '/1/classes/GameScore/' + objectId, {score: 73453})
    .end(function(error, response) {
      if (error) {
        throw error;
      }
      console.log(response.body);
      // => { updatedAt: '2013-11-17T14:43:41.432Z' }
      eventEmitter.emit('updated', objectId);
    });
});

eventEmitter.on('updated', function(objectId) {
  client
    .send('DELETE', '/1/classes/GameScore/' + objectId)
    .end(function(error, response) {
      if (error) {
        throw error;
      }
      console.log(response.body);
      // => {}
      eventEmitter.emit('deleted', response.body);
    });
});

eventEmitter.on('deleted', function() {
  client
    .send('GET', '/1/classes/GameScore')
    .end(function(error, response) {
      if (error) {
        throw error;
      }
      console.log(response.body);
      // => { results:
      // [ { score: 1337,
      // playerName: 'Sean Plott',
      // createdAt: '2013-11-17T14:43:40.296Z',
      // updatedAt: '2013-11-17T14:43:40.296Z',
      // objectId: 'aGFMHhdHBY' },
      // { score: 1338,
      // playerName: 'ZeroCool',
      // createdAt: '2013-11-17T14:43:40.308Z',
      // updatedAt: '2013-11-17T14:43:40.308Z',
      // objectId: 'rpQbB6RXgT' } ] }
      //     });
      var requests = [];
      var results = response.body.results;
      for (var i = 0, l = results.length; i < l; i++) {
        requests.push({
          method: 'DELETE',
          path: '/1/classes/GameScore/' + results[i].objectId
        });
      }
      eventEmitter.emit('fetchAll', requests);
    });
});

eventEmitter.on('fetchAll', function(requests) {
  // Cleanup.
  client
    .sendBatchRequest({requests: requests})
    .end(function(error, response) {
      if (error) {
        throw error;
      }
      console.log(response.body);
      // => [ { success: true }, { success: true } ]
    });
});

Setup the Parse cloud code project by parse command line tool.

$ parse new
[...]
Email: [email protected]
Password:
1: sampleApp
Select an App: 1

This will display:

$ node examples/client.js

# with NODE_ENV=testing(Use the `supertest` that is installed.)
$ NODE_ENV=testing examples/client.js