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

@appveen/odp-utils

v1.5.12

Published

General utility function

Downloads

54

Readme

odp-utils

Common utils for ODP

Audit Trail

This lib contain hooks to create audit logs in a specific DB. This DB will store all the logs of data change.

To store the logs, the node service should invoke the following hooks provided by the lib.

  1. getAuditPreSaveHook: This will return hook for pre save. collectionName(where the document is stored) has to be passed as an argument.

  2. getAuditPostSaveHook: This will return hook for post save. collectionName(where the audit log should be stored) has to be passed as an argument.

  3. getAuditPreRemoveHook: This will return hook for pre remove. No argument needed.

  4. getAuditPostRemoveHook: This will return hook for post remove. collectionName(where the audit log should be stored) has to be passed as an argument.

To record txnId and username in the audit log, one has to pass req object in the save method at the time of document creation.

KubeUtils: Kubernetes API and Docker Client

Kubernetes APIs

The following Kubernetes services have been implemented

  • Namespace
  • Deployment
  • Services

Setting up the environment

The following environment variables must be set,

  • MDM_KEY - User key file to be used for the Kubernetes connection.
  • MDM_CRT - User certificate file to be used for the Kubernetes connection.
  • KUBERNETES_SERVICE_HOST - Hostname/IP of the Kubernetes server.
  • KUBERNETES_SERVICE_PORT - Port to access the Kubernetes server.

APIs

Namespace

ns.getAllNamespaces()
ns.getNamespace("capiot")
ns.createNamespace("test")
ns.getAllNamespaces()
ns.deleteNamespace("test")
ns.getAllNamespaces()

Deployment

deployment.getAllDeployments()
deployment.getAllDeploymentsForNamespace("capiot")
deployment.getDeployment("capiot", "x")
deployment.createDeployment("capiot", "x", "x:2", 8080, [{"name": "ENV_VAR", "value": "value"}])
deployment.updateDeployment("capiot", "x", "x:2");
deployment.deleteDeployment("capiot", "x");

Service

service.getAllServices()
service.getAllServicesForNamespace("capiot").then(_d => console.log(_d)
service.getService("capiot", "x")
service.createService("capiot", "x", 20001)
service.updateService("capiot", "x", 8001)
service.getAllServicesForNamespace("capiot")
service.deleteService("capiot", "x");

Docker

Only one API is exposed. This is to push the image into a private registry

Setting-up the environment

  • REGISTRY - The AWS ECR URL
  • AWS_ACCESS_KEY_ID - AWS access key.
  • AWS_SECRET_ACCESS_KEY - AWS secret
  • AWS_DEFAULT_REGION - AWS region

APIs

docker.pushImage("mdm:x2")