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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@spheremall_org/auth-module

v2.0.2

Published

This module must be used for SM Products to unify the authorization flow.

Readme

SM Authorization Module

This module must be used for SM Products to unify the authorization flow.

Features of the module:

  • provide Amplify dynamic config for working with Cognito Multipools;

  • check authorization (local storage idToken) with Amplify and redirect a user to the SM Authorization form if the user is not authorized;

  • provide your app with logout component for header;

  • provide your app with available products component for header;

  • provide Authorization Guard to verify routes;

  • provide Authorization Interceptor to add auth token automatically for each request to microservices using HttpHandler.

Integration

  • app.module:

Should be added as one of imports with provided parameters: apiEndpoint, formUrl which should be stored in environments files

import {SmAuthModule} from '@spheremall_org/auth-module';
@NgModule({
    imports: [
        SmAuthModule.forRoot({
          apiEndpoint: environment.ACCOUNTS_API_ENDPOINT,
          formUrl: environment.AUTH_FORM_URL
        })
    ]
})
  • routes.ts:

You should use authorization guard for your routes.

import {AuthGuardService} from '@spheremall_org/auth-module';

export const routes: Routes = [
  {
      path       : '', 
      component  : Component, 
      canActivate: [ AuthGuardService ], 
      data       : { isProduction: environment.production }
  }
];
  • app.component:

Authorization will be automatically checked on Guard level, but you can use isAuthorized method from AuthService if it is needed.

import {AuthService} from '@spheremall_org/auth-module';
export class AppComponent implements OnInit {
    constructor(private authService: AuthService) {}
    ngOnInit() {
        this.authService.isAuthorized().subscribe((isAuthorized) => {
            // this.showNavigation = isAuthorized;
            // your action on authorized here
        });
    }
}
  • services usage

AuthorizationInterceptor will add authorization header to each request automatically. It is already included in SmAuthModule, no other actions required. IdToken can be found in AuthService.getToken().

import {AuthService} from '@spheremall_org/auth-module';
export class UsersService {
  private token: string;
  
  constructor(private authService: AuthService) {
    authService.getToken().then(token => {
      this.token = token;
    });
  }
}
  • header logout functionality

user.component.ts

import {AuthService} from '@spheremall_org/auth-module';
@Component({
  selector   : 'app-user',
  templateUrl: './user.component.html'
})
export class UserComponent implements OnInit {
  user: any = {};
  
  constructor(private authService: AuthService) { }
  
  ngOnInit() {
    this.authService.getAuthorizedUser().subscribe(user => {
      this.user = user;
    });
  }
}

user.component.html

<div class="user-data" *ngIf="!!user.email" appDialog>
  <span class="user-name">
    {{ user.email }}
    <mat-icon aria-hidden="false">more_vert</mat-icon>
  </span>
  <div class="user-details">
    <div class="content">
      <mat-card>
        <mat-card-content>
          <mat-list class="nav-list navigation">
            <mat-list-item>
              <!-- SmAuthModule logout in header -->
              <sm-auth-header-logout></sm-auth-header-logout>
            </mat-list-item>
          </mat-list>
        </mat-card-content>
      </mat-card>
    </div>
  </div>
</div>
  • header available products list

app.component.html

<!--Remove existing logo & title
<span class="title-logo">
  <img src="../assets/images/shell-app-icon.png" alt="{{ title }}">
</span>
<h1>{{ title }}</h1>
-->

<!--Add component with `product` parameter-->
<sm-header-products product="Heimdall || Eden || Tyto || Thuja"></sm-header-products>