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

@asfweb/grpc-session

v1.0.55

Published

## Installation: ``` yarn add @asfweb/grpc-session ``` or ``` npm install @asfweb/grpc-session --save ```

Readme

GRPC Session - Beta

Installation:

yarn add @asfweb/grpc-session

or

npm install @asfweb/grpc-session --save

Usage:

// Sessions.ts
import { Session, SessionRedisStore } from "@asfweb/grpc-session";

// Creates Session Store
// SessionRedisStore is using ioredis under the hood so all options for ioredis are available
// https://github.com/luin/ioredis
const sessionStore = new SessionRedisStore({ password: "12345" });

// Creates session
const session = new Session(sessionStore, { expires: 60 * 30 /* In seconds: 60 seconds * 30 = 30 min. */ });

export default session;

Auth Service:

// AuthService.ts
import path from "path";
import * as grpc from "@grpc/grpc-js";
import * as protoLoader from "@grpc/proto-loader";
import { ProtoGrpcType } from "./proto/auth";
import Session from "./lib/Session";

const PORT = 9060;
const PROTO_FILE = "./proto/auth.proto";

const packageDef = protoLoader.loadSync(path.resolve(__dirname, PROTO_FILE));
const grpcObj = grpc.loadPackageDefinition(
  packageDef
) as unknown as ProtoGrpcType;
const authPackage = grpcObj.auth.v1;

function main() {
  const server = getServer();
  server.bindAsync(
    `0.0.0.0:${PORT}`,
    grpc.ServerCredentials.createInsecure(),
    (err, port) => {
      if (err) {
        console.error(err);
        return;
      }
      console.log(`Your auth server has started on port ${port}`);
      server.start();
    }
  );
}

function getServer() {
  const server = new grpc.Server();
  server.addService(authPackage.AuthService.service, {
  Login: async (call, callback) => {

    // Check for existing session or create new one if doesn't exist
    await Session.gRPC(call);

    // Save some data in session
    await Session.set("userId", 10).save();
    
    return callback(null, {
      sessionId: Session.id(),
    });
  },
});

  return server;
}

main();

Some Service

// SomeService.ts 
import path from "path";
import * as grpc from "@grpc/grpc-js";
import * as protoLoader from "@grpc/proto-loader";
import { ProtoGrpcType } from "./proto/some";

const PORT = 9070;
const PROTO_FILE = "../../proto/some.proto";

const packageDef = protoLoader.loadSync(path.resolve(__dirname, PROTO_FILE));

const grpcObj = grpc.loadPackageDefinition(
  packageDef
) as unknown as ProtoGrpcType;
const grpcPackage = grpcObj.some.v1;

function main() {
  const server = getServer();
  server.bindAsync(
    `0.0.0.0:${PORT}`,
    grpc.ServerCredentials.createInsecure(),
    (err, port) => {
      if (err) {
        console.error(err);
        return;
      }
      console.log(`Your some server as started on port ${port}`);
      server.start();
    }
  );
}

/**
 * Creates a gRPC server
 *
 * @returns gRPC Server
 */
function getServer() {
  const server = new grpc.Server();

  // Add Services Here
  server.addService(grpcPackage.SomeService.service, {
  ListSome: async (call, callback) => {
    try {
        // Init Session
        await Session.gRPC(call, {someKey:"someKeyToOverwrite"});

        // Add Session Data
        // chained
        await Session
        .set('someKey', 'someValue')
        .set('anotherKey', 'anotherValue')
        .save();
        // or
        Session.set('key1', 'value1');
        Session.set('key2', 'value2');
        // NOTE: Save must be executed after set in order to persist session data
        await Session.save(); 

        // Get Session Data
        let someKey = Session.get('someKey');
        console.log(someKey);

        // Get all data
        let sessionData = Session.get();
        console.log(sessionData);

        return callback(null, {...});

    } catch (err) {
      if (err instanceof Error) {
        return callback(
          { code: grpc.status.INTERNAL, message: err.message },
          null
        );
      }
    }
  }
});

  return server;
}

// Start
main();

TODO:

  • SessionFileStore
  • SessionMongoStore
  • SessionMysqlStore
  • SessionSharedConfig