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 🙏

© 2025 – Pkg Stats / Ryan Hefner

ember-rewind-stack

v0.1.4

Published

Central rewind stack for Ember apps that work with chatty APIs.

Downloads

1,150

Readme

ember-rewind-stack

Many applications have code that orchestrates a LOT of API calls. Particularly related to creation of complex solutions, it is quite reasonable to expect that one user action will result in 5 or more API calls, some of which will result in the creation of ancillary records/entities.

The question is - what happens when some critical path call fails in the middle of one of these giant chains?

Enter the rewind-stack-service, which allows you to manage multiple, possibly parallel, operation stacks. In the event of a failure, your .catch() block can ask the service for all the completed operations, and then take action to roll-back the changes.

Installation

ember install ember-rewind-stack

When should I use this?

Only use this when you are orchestrating a lot of calls. If you are just issuing a single save operation, this is massive overkill. Basically, if you can't easily figure out how to clean things up in a .catch(), then consider using this.

API

| method | returns | description | | --- | --- | --- | | addOperation (stackName, operationObj) | n/a | add an operation to a named stack. Creates the stack if it does not exist. Sets the .current to the passed in operation. If there is a .current, it is pushed into the stack's .completed array. A .startedAt property is added to the operation when pushed in. A .completedAt property is set when it's pushed into the .completed array.| | completeOperation (stackName, options) | n/a | Moves the current operation onto the .completed array, adding the .completedAt property, and clearing the stack's .current property. The options are merged into the current operation, allowing useful stuff like itemId's to be added after an operation completes.| | getCompleted (stackName) | array of completed operations, reversed | Used by exception handlers to rewind the completed actions | | removeStack (stackName) | n/a | clean up a stack | | getCurrent (stackName) | Current Operation Obj | Returns the current operation | | getStack (stackName) | stack object | returns the entire stack object |

Operation Object

The operation object can be whatever you need it to be. The intent here is that you provide enough info in that object to allow you to un-do the operation.

{
  "name": "create site item", // some sort of name that makes sense to you
  "type": "create-item",      // something that would make sense in a log
  "cleanup": "remove-item",   // a key for your clean up code to use...
  "inputs": {                 // whatever your cleanup code needs...
    "id": "3ef...",           // in this case, to delete an item we need the id and owner
    "owner": "dcadmin"
  }
}