New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

botmaster-session-ware

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botmaster-session-ware

botmaster session ware for storing context

0.1.3
Version published
Maintainers
1
Created

Build Status

Botmaster Session Ware

A configurable botmaster ware to provide session data to downstream middleware.

Quick Start

npm install botmaster-session-ware -S
const Botmaster = require('botmaster');
const SessionWare = require('botmaster-session-ware');

const {incoming, outgoing} = SessionWare();
botmaster.use('incoming', incoming);
botmaster.use('outgoing', outgoing);

Using a different adapter

Adapters should be provided in their own package. Their api must follow the MemoryStore example.

API Usage

MemoryStore

The most basic adapter ever for SessionWare

get

Get or create a session with the id.

Parameters

  • id String a unique id for the session

Returns Promise evaluates to an object that is the session

set

Update a session in the storage.

Parameters

  • id String a unique id for the session
  • value Object the new value for the session

Returns Promise resolves when the session has been saved

SessionWare

Create an object providing incoming and outgoing middleware

Parameters

  • options [Object] options object for generated sessionWare
    • options.adapter [Object] an object implementing the adapter api. defaults to in memory.
    • options.sessionPath [String] dot denoted path to where to store the context in the update. defaults to 'session'

Returns Object an object that contains two functions 'incoming' and 'outgoing'. The incoming should be placed before any middleware that requires it and the outgoing should be placed after all middleware have used it.

FAQs

Package last updated on 06 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts