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

zrecore

v1.3.1

Published

zrecore-js ==========

Downloads

6

Readme

zrecore-js

ZRECore.js - A RESTful interface to commonly used 'commerce' data models.

How to use

Use npm install zrecore

Then open up your main node file (like app.js, or server.js, or whatever), and add the following line:

var zrecore = require('zrecore');

You can now use HTTP GET/PUT/POST/DELETE methods on the data model end-points (such as /acl-permission or /item)

You can add (or better yet, sym link) a _config.js to your npm_module/zrecore/ directory. When zrecore is loaded, it will automatically use those settings instead of the default ones.

Here is a sample _config.js for you to modify.

exports.port = 8080; // What port should this instance run on?
exports.useSSL = false; // Do you want to force SSL? (restify 2.0 or greater I think)
exports.sslCertificatePath = ''; // If useSSL is enabled (true), path to .crt file
exports.sslKeyPath = ''; // If useSSL is enabled, path to key file
exports.sslCaPath = ''; // If useSSL is enabled, path to ca or crt file
exports.databaseHost = 'localhost'; // Where is your mongodb at?
exports.databaseName = 'zrecore'; // What is the name of your mongo database

// Set this to true once you have an User document in your mongo database to 
// avoid unauthorized access of your RESTful end-points!
//
// If set to true, you must set the following headers with your 
// RESTful requests:
//
// API-USER: the_user_name
// API-KEY: the_user_password
// API-VERSION: 1.0
//
// (The API-VERSION header is reserved for future use)
exports.authorizationRequired = false; // Require valid User credentials to access this instance?

See the package.json file for dependencies. The full list of data model enpoints are available at http://www.zrecommerce.com

How are data models related to each other?

Our basic groups of models are organized in a straight-forward and simple manner (modify as you see fit). The idea is to think of the most commonly used features, and provide a starting point with a basic set of data models:

  • AclPermission - A list of valid ACL Permissions, such as 'allow', 'deny', or something like 'create', 'read', 'update', 'delete'. An access control list associates a user with a resource, and (according to the user's role) specifies what permissions a user has.
  • AclResource - A list of things that we consider a resource, such as '/foo/some-page', or 'Some object'.
  • AclRole - A list of roles a user can have, such as 'editor', 'administrator', 'guest', etc...
  • Folder - Just like a real-life folder, this is used to organize/group pages and sub-folders.
  • Page - A page is a page ...is a page. This just holds content we would like to make viewable out at some point.
  • Item - As in, items for sale, or an item for rent. Something tangible we would like to offer, or perhaps something intangible, such as a software/media download.
  • ItemCoupon - A list of coupons that are available for a specific item.
  • ItemProperty - A list of additional properties that are associated with a specific item, such as "shoe sizes", or "available colors", etc. See the Property models below.
  • MerchantGateway - A list of merchant gateways our application will use. This is solely a list, you should implement your own usage of merchant gateways however you see fit, and simply use this list to keep track of what merchant gateways you use.
  • Order - A list of orders. An order simply contains some basic information about a sale, including items purchased, sale date, sale totals, services purchased, subscriptions subscribed to, etc...
  • OrderCoupon - A list of coupons that were applied to a specific order. This has fields to keep track of what coupon values were used, so that if a specific coupon is updated in the future, we still have an immutable historical reference.
  • OrderItem - A list of items that were purchased under a specific order.
  • OrderService - A list of services that were purchased under a specific order.
  • OrderStatusHistory - A historical list of status changes made to a specific order record, such as changing from 'placed' to 'pending', then to 'shipped', or whatever status you have defined in the 'Status' list of records.
  • OrderSubscription - A list of subscriptions associated with a specific order.
  • PackageLevel - This is associated with the Subscription and Service data models. Subscriptions and services can offer multiple packages, sometimes in order of most basic to most full featured. The PackageLevel model simply lists what these package levels are.
  • Property - A generic list of extra properties we can associate with an Item data model object, such as 'shoe sizes', or 't-shirt color', etc...
  • PropertyType - A list of available 'types' we can assign to our Property objects.
  • PropertyValue - A list of available value(s) a specific PropertyType model can have.
  • Service - A list of services offered for sale, such as 'Tax consultation', or 'Landscaping', etc...
  • ServiceCoupon - A list of coupons available to a specific service.
  • ServicePackageLevel - A list of package levels available to a specific service.
  • Status - A list to help define what status an Order may have, such as 'pending', 'sold', 'rma begin', 'lost in space', or whatever you think are valid order history statuses.
  • Subscription - A list of available subscriptions you offer.
  • SubscriptionCoupon - A list of coupons available for a specific subscription.
  • SubscriptionPackageLevel - A list of package levels available for a specific subscription.
  • SubscriptionService - A list of service(s) available as part of a specific subscription. Kind of like how you can sign up something such as a gym membership subscription, and receive personal training, or a 10 days of kick-boxing lessons (as a service, not a punching bag).
  • User - A list of users that may access your application. This is usually used in conjunction with ACL data models to define who can (or can't) access certain resources, according to what permissions a user's role has on a resource.
  • UserAcl - A list defining what role is associated with a specific user, along with resources and permissions.
  • UserProfile - This is just a list containing common user 'profile' properties, such as 'twitter handle', or 'about me', etc.

A complete list of related resources can be viewed at http://www.zrecommerce.com/