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

onep-mock

v0.0.7

Published

Mock server for Exosite's One Platform

Downloads

2

Readme

Mock One Platform

NPM

This is a HTTP server for testing applications built against Exosite's One Platform. At the moment it supports just a subset of RPC API commands:

Compared with testing against One Platform, onep-mock allows tests to run faster because it uses an in-memory database and can run locally with your app. It also provides more feedback about app misbehavior and allows for working offline.

$ git clone [email protected]:dweaver/onep-mock.git 
$ cd onep-mock
$ npm install
$ supervisor mock.js
One Platform mock server listening on 3001

The server's in-memory database starts out with a root CIK of all 1s, with some more debug data underneath it. Once the server is running, you can run some Exoline commands against it:

$ alias exock='exo --http --host=127.0.0.1 --port=3001 ' 
$ exock twee 1111111111111111111111111111111111111111
Mock Master Client    cl cik: 1111111111111111111111111111111111111111
  └─Mock Other Client    cl cik: 2222222222222222222222222222222222222222
      └─gas  dp.i mock_gas: 34 (Yesterday)
danw@MacBook-Pro:~/prj/exosite/onep-mock [master]
$ exock write 2222222222222222222222222222222222222222 mock_gas --value=35
danw@MacBook-Pro:~/prj/exosite/onep-mock [master]
$ exock read 2222222222222222222222222222222222222222 mock_gas
2014-12-30 09:45:29-06:00,35

The server will complain loudly if you try to do something it doesn't support yet, as when trying to call the usage command.

$ exo --curl --http --host=127.0.0.1 --port=3001 usage 1111111111111111111111111111111111111111 --start=1/1/2012
DEBUG:pyonep.onep:curl http://127.0.0.1:3001/onep:v1/rpc/process -X POST -m 60 -H 'Content-Type: application/json; charset=utf-8' -H 'User-Agent: Exoline 0.9.5' -d '{"calls": [{"id": 91, "procedure": "usage", "arguments": [{"alias": ""}, "client", 1325397600, null]}, {"id": 92, "procedure": "usage", "arguments": [{"alias": ""}, "dataport", 1325397600, null]}, {"id": 93, "procedure": "usage", "arguments": [{"alias": ""}, "datarule", 1325397600, null]}, {"id": 94, "procedure": "usage", "arguments": [{"alias": ""}, "dispatch", 1325397600, null]}, {"id": 95, "procedure": "usage", "arguments": [{"alias": ""}, "email", 1325397600, null]}, {"id": 96, "procedure": "usage", "arguments": [{"alias": ""}, "http", 1325397600, null]}, {"id": 97, "procedure": "usage", "arguments": [{"alias": ""}, "sms", 1325397600, null]}, {"id": 98, "procedure": "usage", "arguments": [{"alias": ""}, "xmpp", 1325397600, null]}], "auth": {"cik": "1111111111111111111111111111111111111111"}}'
DEBUG:pyonep.onep:HTTP/1.1 500 Internal Server Error
Headers: [('content-length', '45'), ('x-content-type-options', 'nosniff'), ('x-powered-by', 'Express'), ('connection', 'keep-alive'), ('date', 'Sat, 27 Dec 2014 19:12:37 GMT'), ('content-type', 'text/html; charset=utf-8')]
DEBUG:pyonep.onep:Body: Mock server does not support procedure usage

One Platform exception: Exception while parsing JSON response: Mock server does not support procedure usage

No JSON object could be decoded

...or when trying to use a different Exosite API.

$ exo --http --host=127.0.0.1 --port=3001 model list
One Platform provisioning exception: 404 Not Found (Cannot GET /provision/manage/model/)

Tests

To run the tests, first make sure the development dependencies are installed.

$ npm install 

Then run the tests:

$ mocha
...

You can get a coverage report:

$ istanbul cover _mocha -- -R spec
...