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

sails-orchestrate-raibutera

v0.0.9

Published

orchestrate adapter for Sails / Waterline

Downloads

4

Readme

image_squidhome@2x.png

waterline-orchestrate (Sails 0.10.x)

Provides easy access to orchestrate from Sails.js & Waterline.

Installation

To install this adapter, run:

$ npm install waterline-orchestrate

Usage

This adapter exposes the following methods:

find()
Model.find(id).exec(function (err, results) {
    console.log(err);
    console.log(results);
});

Or you can target multiples.


    Model.find({
        name: "Bob Marley",
        age: 16
    }).exec(function (err, results) {
        console.log(err);
        console.log(results);
    });

This will pull values from Orchestrate.io if they have the parameter of name that is the value of Bob Marley and if age is 16.

To view more methods for finding records please visit the waterline documentation. Waterline.

create()

To create a value

  var foo = {
    "id" : "key"
    "name": "Steve Kaliski",
    "hometown": "New York, NY",
    "twitter": "@stevekaliski"
  };

  Model.create(foo).exec(function (err, results){
        console.log(err);
        console.log(results);
  });

If you do not pass an id to the object before passing to the create function, one will be created for you.

The results returned is the key for the value.

update()

How to grab a single value from a collection from Orchestrate.

Model.find(id).exec(function (err, results){
    console.log(err);
    console.log(results);
});

Or you can grab a group of objects to be returned in an array by passing an object by describing which parameters to search for a value by.

Model.find()
.where({ age: 21 })
.limit(10)
.exec(function(err, users) {
  // Now we have an array of users
});

To view more methods for finding records please visit the waterline documentation. Waterline.

destroy()

To remove a value:

  Model.destroy('key').exec(function (err, results){

  });

To remove batch values

  Model.destroy({
    name: "Steve"
  }).exec(function (err, results){

  });

Graphing

An awesome feature Orchestrate includes is the ability to generate graphs between collections. For example, consider the collections users and movies. Some user Steve will like a variety of movies. We can generate this relationship:

graphCreate()
  • Completed

    Here is how to create a graph between two values. Notice that we are passing two collection names, because the "starting" collection is your Model name.

      Users.graphCreate({
        key: "Steve",
        relation: "likes",
        toCollection: "movies",
        toKey: "Superbad"
      }, function (err, results){
    
      });
graphRead()
  • Completed

We can then look up all the different items Steve likes:

  Users.graphRead({
    key: "Steve",
    relation: "likes"
  }, function (err, results){

  });

We can even take this another step further:

Users.graphRead({
  key: "Steve",
  relation: ["friends", "likes"]
}, function (err, results){

});
graphDelete()
  • Completed

This will return all of the things that friends of Steve have liked. This assumes a friend relation has previously been defined between Steve and another user.

If we want to delete a graph relationship:

  Users.graphDelete({
    key: "Steve",
    relation: "likes",
    toCollection: "movies",
    toKey: "Superbad"
  }, function (err, results){

  });

Events

Events are time-ordered objects that exist with the context of a Key-Value object. Consider comments on a post or messages in a thread.

eventCreate()

Creating an event:

  Users.eventCreate({
    key: 'Steve',
    type: "update",
    data: {
      "test" : "Hello!"
    }
  }, function (err. results){

  });

Creating an event at a specified time:

  Users.eventCreate({
    key: 'Steve',
    type: "update",
    data: {
      "test" : "Hello!"
    },
    time: 1384534722568
  }, function (err. results){

  });
eventList()

Listing events:

Users.eventList({
  key: 'Steve',
  start: 1384534722568,
  end: 1384534722568,
  type: "update"
}, function (err, results){

});
eventRead()

Getting a specific event:

Users.eventRead({
  key: "Steve",
  time: 1369832019085,
  ordinal: 9,
  type: 'update'
}, function (err, results){

});
eventUpdate()

Updating an event:

Users.eventUpdate({
  key: 'Steve',
  type: 'update',
  time: 1369832019085,
  ordinal: 9,
  data: {
    "text": "Orchestrate is awesome!"
  }
}, function (err, results){

});

Updating an event, conditionally:

Users.eventUpdate({
  key: 'Steve',
  type: 'update',
  time: 1369832019085,
  ordinal: 9,
  data: {
    "text": "Orchestrate is awesome!"
  },
  ref : 'ae3dfa4325abe21e'
}, function (err, results){

});
eventDelete()

Deleting an event:

Users.eventDelete({
  key: 'Steve',
  type: 'update',
  time: 1369832019085,
  ordinal: 9
}, function (err, results){

});
orchesNative()
  • Status
    • Planned

Getting Started

    /*Add this config/connections.js*/
    orchestrateServer : {
        adapter: "sails-orchestrate",
        masterkey: your master key,
        developmentkey: your developmentkey,
        status: process.env.NODE_ENV || "dev"
    },

Make sure that if you are using correct app status as the adapter will automatically select the appropriate key based on whether the app is production or not.