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

eq-product-pricing

v0.0.0-development

Published

This is the service for Equinox Product Pricing

Downloads

3

Readme

EqProductPricing

App Status

Purpose

This project processes product pricing changes and sends them to Equinox.

Environment vars

This project uses the following environment variables:

| Name | Description | Required | Default Value | Accepted Values | | ----------------------- | ----------------------- | -------- | ------------- | --------------- | | NODE_ENV | Environment | Yes | DEV | DEV, TEST, PROD | | STORE_IDS | Equinox Store IDs | Yes | | | | BUSINESS_ID | Equinox Business ID | Yes | | | | OKTA_CLIENT_ID | Okta Client ID | Yes | | | | OKTA_CLIENT_SECRET | Okta Client Secret | Yes | | | | SOLACE_CONNECT_VPN_NAME | Solace Connect VPN Name | Yes | | | | SOLACE_CONNECT_USERNAME | Solace Connect Username | Yes | | | | SOLACE_CONNECT_PASSWORD | Solace Connect Password | Yes | | | | SOLACE_CONNECT_HOST | Solace Connect Host | Yes | | |

Pre-requisites

Getting started

Initialize and start application

You will need to have CODEARTIFACT_AUTH_TOKEN set as an environment variable. To do this run:

export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain nextgen --domain-owner 425432027451 --query authorizationToken --output text --profile nse-shd`

nse-shd should be replace by whatever you name as your profile to gain access to the nse-shared-services AWS environment. It is also helpful to add an alias to your .bash_profile if you use bash or .zshrc if you use zsh. That would look something like this:

alias set-codeartifact='export CODEARTIFACT_AUTH_TOKEN=`aws codeartifact get-authorization-token --domain nextgen --domain-owner 425432027451 --query authorizationToken --output text --profile nse-shd`'

Install dependencies

yarn

Create .env file and add update variable values

NODE_ENV=dev
STORE_IDS='{"US":406, "CA":407}'
OKTA_CLIENT_ID='fakeId'
OKTA_CLIENT_SECRET='fakeSecret'
SOLACE_CONNECT_PASSWORD='fakePassword'
SOLACE_CONNECT_USERNAME=solace-cloud-client
SOLACE_CONNECT_HOST='wss://fakeHost:443'
SOLACE_CONNECT_VPN_NAME='fakeVpnName'

Build and run the project

yarn start

Project Structure

The folder structure of this app is explained below:

| Name | Description | | ----------------- | ---------------------------------------------------------------- | | __mocks__ | Contains jest mocks | | __tests__ | Contains jest tests | | config | Application configuration including environment-specific configs | | src | Contains source code | | publisher | Contains code to do a test publish | | src/index.js | Entry point to the application | | Dockerfile | File used by docker to containerize application | | .gitignore | List of files and directories for Git to ignore | | jest.config.js | Configuration options for Jest | | .eslintrc | Configuration options for ES Lint | | .prettierrc | Configuration options for prettier | | package.json | Contains npm dependencies as well as build scripts | | .prettierignore | List of files and directories for prettier to ignore | | cx.config | File needed for common pipeline to pass | | yarn.lock | Yarn state snapshot | | .gitlab-ci.yml | CI pipeline configuration | | node_modules | Contains package dependencies |

Project Scripts

All the different build steps are orchestrated via yarn scripts. yarn scripts basically allow us to call (and chain) terminal commands via npm.

| yarn Script | Description | | ----------- | ---------------------------------------------------------------------------------------- | | start | Runs node on src/index.js. Can be invoked with yarn start | | pub | Publishes test messages that you can use locally to test. Can be invoked with yarn pub | | test | Runs tests with coverage using jest. Can be invoked with yarn test | | lint | Runs ESLint on project files. Can be invoked with yarn lint |

Testing

The tests and assertions use Jest.

Running tests using yarn Scripts

yarn test

ESLint

ESLint is a code linter that helps catch minor code quality and style issues.

ESLint rules

All rules are configured through .eslintrc.

Running ESLint

To run ESLint you can call the ESLint task.

yarn lint  // runs only ES lint

Logging

A dashboard has been added to Datadog for monitoring the application logs: Datadog Dashboard. This dashboard is a joint accumulation of logs for EqProductInventory, EqProductPricing, and EqProductData

Logging Metrics

To allow for better log visibility and acessibility, metric data is included in the application logs. Elements in the metric object can be used to fiter, sort and perform actions on application logs in Datadog.

An example you could enter something like this when filtering logs in the Search for field in Datadog:

service:eq-product-data @metric.destination:"nuskin/product/pricing/created/v1/US/sap"

Here is a description for the elements in the Metric Object

| Name | Description | | ------------- | --------------------------------------------------------------- | | country | The country passed on the event | | destination | The solace topic were the message been processed came from | | correlationId | A unique id that ties all the logs in a transaction together | | eventType | Event type taken from destination in the metric | | skuId | The sku that the update has been sent for |

Sample metric data

{
    "applicationMessageId": "ID:AMQP_NO_PREFIX:02020064-28b7-1eee-8b94-f2cdb6fae8de",
    "country": "US",
    "destination": "nuskin/product/pricing/created/v1/US/sap",
    "correlationId": "02020064-28b7-1eee-8b94-f2cdb6fae8de",
    "eventType": "created",
    "senderTimestamp": 1690480880443,
    "skuId": "01102945"
}