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

@janiscommerce/view-link

v1.1.0

Published

A package for creating Janis views links

Downloads

441

Readme

view-link

Build Status Coverage Status npm version

A package for creating Janis views links

Installation

npm install @janiscommerce/view-link

Configuration

ENV Variables

This package will obtain the stage name of your MS using the ENV variable JANIS_ENV

view-link uses a settings JSON config file. It's located in /path/to/root/[MS_PATH]/config/.janiscommercerc.json

Requires an field view-link [Object] with the following items:

  • hosts [Object]: The hosts by stage

Example

{
	'view-link': {
		hosts: {
			local: 'http://localhost:8080',
			beta: 'https://app.janisdev.in',
			qa: 'https://app.janisqa.in',
			prod: 'https://app.janis.in'
		}
	}
}

API

getBrowse(service, entity, params)

:star: New

Now browse filters are supported in params :sunglasses:

Generates the JANIS views Browse URL from the specified parameters Requires an service [String] and entity [String] Optionally you can add params [Object] that will be converted into query-strings Returns a [String] with the built JANIS view URL

Example

ViewLink.getBrowse('some-service', 'some-entity',{
	sortBy: 'something'
});

// https://app.janis.in/some-service/some-entity/browse?sortBy=something

Example with filters

ViewLink.getBrowse('some-service', 'some-entity',{
	sortBy: 'something',
	filters: {
		color: 'red',
		status: 'active'
	}
});

// https://app.janis.in/some-service/some-entity/browse?sortBy=something&filters[color]=red&filters[status]=active

getEdit(service, entity, entityId, params)

Generates the JANIS views Edit URL from the specified parameters Requires an service [String], entity [String] and entityId [String] Optionally you can add params [Object] that will be converted into query-strings Returns a [String] with the built JANIS view URL

Example

ViewLink.getEdit('some-service', 'some-entity', 'some-id',{
	foo: 'bar'
});

// https://app.janis.in/some-service/some-entity/edit/some-id?foo=bar

get(entries, params)

Generates a custom JANIS views URL from the specified parameters Requires entries [Array] Optionally you can add params [Object] that will be converted into query-strings Returns a [String] with the built JANIS view URL

Example

ViewLink.getBrowse(['some-service', 'some-entity'],{
	sortBy: 'something'
});

// https://app.janis.in/some-service/some-entity?sortBy=something

Usage

const ViewLink = require('@janiscommerce/view-link');

const myBrowseUrl = ViewLink.getBrowse('some-service', 'some-entity');
// https://app.janis.in/some-service/some-entity/browse

const myEditUrl = ViewLink.getEdit('some-service', 'some-entity', 'some-id');
// https://app.janis.in/some-service/some-entity/edit/some-id

const myCustomUrl = ViewLink.get(['my','custom','view'], {
	sortBy: 'something'
});
// https://app.janis.in/my/custom/view?sortBy=something