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

botmaster-enrich

v1.0.1

Published

A standardized way to make your bot context-aware. It exposes an API for enrichers which are procedures you can run to add variables to the context before sending to an NLU processor like Watson Conversation, LUIS or API.ai

Downloads

375

Readme

Build Status Coverage Status

Enrich NLU contexts

Battle-tested middleware for botmaster http://botmasterai.com/).

Introduction

  • similar API to 'fulfill' middleware
  • allows caching of responses
  • manages merging
  • stuff anything else you need in your enrichers in params
  • callbacks, promises, and sync returns supported in controllers

Use cases

  • Scrapping websites for hours or telephone numbers to provide to bot
  • Validating user input

API

Enricher

Enricher Spec

The enricher spec is an object that describes an enricher

| Parameter | Description | | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | controller | Function a controller that can return error last callback, a promise or sync. Called with (params, calback). Its result will be merged with the results from other controllers and the old context. | | cache | Boolean whether or not to cache the result | | ttl | Integer if caching how long the result should stay cached in milliseconds |

Enricher controller params

The following properties are available in params.

| Parameter | Description | | --------- | ----------------------------------- | | context | the current context | | update | in botmaster the update is provided | | bot | in botmaster the bot is provided |

Botmaster Ware

Enrich

Run the given enrichers with context and update the given old context. Return using the callback.

Parameters

  • options object options for the created middleware
    • options.enrichers object enrichers to run on the new context
    • options.params object? merged with the standard params passed to enricher controller

Returns enrich a function that can enrich context

enrich

Used to enrich a context

Parameters

  • context Object context to enrich
  • callback Function error first callback, returns enriched context

EnrichIncomingWare

Factory function to generate incoming ware for enrich

Parameters

  • $0 Object options
    • $0.enrichers Object an object of enrichers
    • $0.sessionPath String? dot denoted path find the context in the update. defaults to 'context'
    • $0.params Object? optional additional params to pass to enrichers

Returns Function botmaster middleware