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

fng-audit

v0.12.0-beta.301

Published

Client part of forms-angular audit plugin

Downloads

444

Readme

fng-audit

Plugin for forms angular that comprises:

  • Mongoose plugin to record changes to data on audited collections
  • Default views of audit trail data and routes to invoke them

Usage

npm install fng-audit

On the server side:

In the call to create the forms-angular object (normally in the main server express start-up module) pass the plugin controller as follows:

var fngAudit = require('fng-audit');

var DataFormHandler = new (formsAngular)(app,
    {
        plugins:[
            fngAudit: { plugin: fngAudit.controller, options: {} }
        ]
    }
);

Valid options:

errorHandler : function(err: string) : void - a function to be called in the event of an error occuring within the server side of the audit plugin.

To enable auditing for a schema MySchema:

var fngAudit = require('fng-audit');
MySchema.plugin(fngAudit.plugin, {});
MyModel = mongoose.model('modelName', MySchema);

Valid options

strip : Array - an array of fields (or nested.fields) that are to be suppressed from the audit changes. Hidden fields are automatically suppressed, as are updatedAt and __v

Behaviour of the plugin can be modified by adding pseudo fields to the document (in the case of save or remove middleware) or to the query options (in the case of findOneAndUpdate, update or findOneAndRemove middlewares) as follows:

_noAudit suppress the audit entry if true

_user add the _id property of this value (if present) or the value itself as the user field of the Audit record

_op add the value of this property as the op field of the Audit record (for noting the operation that caused the change)

On the client side:

<script src="fng-audit/dist/client/fng-audit.js"></script>

Add fngAuditModule to your app's list of services.

The following client side routes are added:

/<model>/<id>/history displays a screen showing all the audited events involving a document

/<model>/<id>/changes displays a screen showing all the audited changes to a document

/<model>/<id>/version/<version> recreates the value of the specified version of the item and displays it in JSON format

Each of these routes also support the /<model>/<form>/<id> variants

You can set up a function $rootScope.describeUsers ({[userId: string]: any}) => IPromise<{[userId: string]: string}> to convert user ids into user descriptions.