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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@acknow-srl/user

v0.1.19

Published

Handles users and their metadata on a GraphQL server.

Readme

User

Handles users and their metadata on a GraphQL server.

AckUserModule (Module)

Methods

  • forRoot(config: AckUserConfig): void: configure the connection to the GraphQL server.

AckUserConfig (Interface)

  • server (string): GraphQL server URL.

AckUserListOptions (Interface)

  • attrs (string[]): An array of user's attributes to read when listing all users.
  • orderBy (string): The attribute to sort the user list by. You can prepend a "-" sign to sort users in descending order.

User (Interface)

A user model. It must always have an id attribute. All other attributes are optional.

AckAvatarConfig (Interface)

Describes avatars display options.

  • rating (string): either g, pg, r or x. Please, refer to Gravatar documentation. If not provided or empty, defaults to an empty string (equivalent to g).
  • secure (boolean|null): true to force HTTP with SSL (HTTPS), false to force HTTP, null to automatically use the current protocol. Defaults to null.
  • defaultAvatar (string): default avatar type. It can be the URL to a custom stored image or a predefined Gravatar type (gravatar, gravatar_default, mm, mystery, mysteryman, mp, mystery-person, identicon, monsterid, wavatar, retro, robohash, blank, 404). Please, refer to Gravatar documentation. Defaults to an empty string (equivalent to gravatar).
  • forceDefault (boolean): true to always force the default avatar, false to use the real user's avatar (if exists). Defaults to false.

App (Interface)

  • userId (number): The user ID.
  • appId (string): The app ID.
  • data (any|null): JSON object with the app data or null (if there are no data).

AckUser (Service)

It is provided in root, so it is available to the whole app.

Methods

  • me(): Observable<User|null>: returns an Observable with the authenticated user object, if exists. Otherwise, returns an Observable with null.
  • read(options: AckUserListOptions): Observable<User[]>: returns an Observable with all users, based on the given options (see AckUserListOptions Interface). Otherwise, returns an Observable with an empty array.
  • getById(userId: number): Observable<User|null>: returns an Observable with user data based on the given user ID. If the user does not exists, returns an Observable with null.
  • avatar(hashOrUser: User|string, size: number, config: AckAvatarConfig|null): return the URL to the avatar for a given user or MD5 hash, based on a given size and other options (see the AckAvatarConfig interface).

AckApp (Service)

It is provided in root, so it is available to the whole app.

Methods

  • read(userId: number): Observable<App[]>: returns an Observable with all app data for the given user ID. Otherwise, returns returns an Observable with an empty array.
  • get(app: App): Observable<App|null>: Returns an Observable with app data based on user ID and app ID. Otherwise, returns an Observable with null.
  • create(app: App): Observable<App|null>: Create an app for a given user. Returns an Observable with the created app. Otherwise, returns returns an Observable with null.
  • update(app: App): Observable<App|null>: Updates app data based on a given user ID and app ID. Returns an Observable with the updated app. Otherwise, returns returns an Observable with null.
  • delete(app: App): Observable<string>: Delete an app based on a given user ID and app ID. Returns an Observable with the deleted internal Postgraphile ID. Otherwise, returns returns an Observable with an empty string.

Example

AckAvatar (Component)

Displays user informations, like avatar, first name, last name and registration date.

Selector

ack-avatar

Input

  • user (User|string|null): the user object or an MD5 hash. If an empty value is supplied, the avatar is calculated on [email protected] fake e-mail address. Defaults to null.
  • size (number): size for the user's avatar, in pixels. Defaults to 80.
  • alt (string): text for the avatar image alt attribute.
  • options (AckAvatarConfig): additional options to display the user's avatar.
/**
 * 1. Import the module and all classes you need in your main module (usually app.module.ts).
 */

import { AckUserModule, AckUserConfig } from '@acknow-srl/user';

/**
 * 2. Add the module to your app imports and configure it.
 */

 const conf: AckUserConfig = {
     server: 'http://my-graphql-server-url'
 };

@NgModule({
  declarations: [
    AppComponent
    ...
  ],
  imports: [
    ...
    AckUserModule.config(conf),
    ...
  ],
  providers: [
  ],
  bootstrap: [AppComponent]
})
export class AppModule {
}

/**
 * 3. Import the AckUser and/or AckApp services in your components or services to use it.
 */

import { AckUser, User, AckApp, App } from '@acknow-srl/user';

@Component({
    ...
})
export class MyComponent implements OnInit {

    me: User|null;

    appData: App|null;

    constructor(private userService: AckUser, private appService: AckApp) {
    }

    ngOnInit() {

        // Sets the logged in user.

        this.userService.me().subscribe(user => {
            this.me = user;

            // Sets app data based on the logged in user ID and app ID.

            this.appService.get({userId: this.me.id, appId: 'my-app-id'}).subscribe(app => {
              this.appData = app;
            });

        },
        err => {
            this.me = null;
            this.appData = null;
        });
    }

}