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

wingbot-mongodb

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wingbot-mongodb

MongoDB storage for wingbot.ai

  • 2.0.0-alpha.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
42
increased by5%
Maintainers
1
Weekly downloads
 
Created
Source

MongoDB plugin for wingbot.ai

Contains storage for tokens, chat states, bot config and chat logs.


API

Classes

StateStorage

Storage for chat states

BotTokenStorage

Storage for webview tokens

ChatLogStorage

Storage for conversation logs

BotConfigStorage

Storage for wingbot.ai conversation config

AttachmentCache

Cache storage for Facebook attachments

Typedefs

State : Object
Token : Object

StateStorage

Storage for chat states

Kind: global class

new StateStorage(mongoDb, collectionName)

ParamTypeDefault
mongoDbmongodb.Db | Object
collectionNamestring"states"

stateStorage._collection : mongodb.Collection

Kind: instance property of StateStorage

stateStorage._getCollection() ⇒ Promise.<mongodb.Collection>

Kind: instance method of StateStorage

stateStorage.getState(senderId, pageId) ⇒ Promise.<(State|null)>

Kind: instance method of StateStorage

ParamType
senderIdstring
pageIdstring

stateStorage.getOrCreateAndLock(senderId, pageId, [defaultState], [timeout]) ⇒ Promise.<Object>

Load state from database and lock it to prevent another reads

Kind: instance method of StateStorage
Returns: Promise.<Object> - - conversation state

ParamTypeDefaultDescription
senderIdstringsender identifier
pageIdstringpage identifier
[defaultState]Objectdefault state of the conversation
[timeout]number300given default state

stateStorage.saveState(state) ⇒ Promise.<Object>

Save the state to database

Kind: instance method of StateStorage

ParamTypeDescription
stateObjectconversation state

BotTokenStorage

Storage for webview tokens

Kind: global class

new BotTokenStorage(mongoDb, collectionName)

ParamTypeDefault
mongoDbmongodb.Db | Object
collectionNamestring"tokens"

botTokenStorage._collection : mongodb.Collection

Kind: instance property of BotTokenStorage

botTokenStorage._getCollection() ⇒ Promise.<mongodb.Collection>

Kind: instance method of BotTokenStorage

botTokenStorage.findByToken(token) ⇒ Promise.<(Token|null)>

Kind: instance method of BotTokenStorage

ParamType
tokenstring

botTokenStorage.getOrCreateToken(senderId, pageId, createToken) ⇒ Promise.<(Token|null)>

Kind: instance method of BotTokenStorage

ParamType
senderIdstring
pageIdstring
createTokenObject

ChatLogStorage

Storage for conversation logs

Kind: global class

new ChatLogStorage(mongoDb, collectionName, [log])

ParamTypeDefaultDescription
mongoDbmongodb.Db | Object
collectionNamestring"chatlogs"
[log]Objectconsole like logger

chatLogStorage._collection : mongodb.Collection

Kind: instance property of ChatLogStorage

chatLogStorage._getCollection() ⇒ Promise.<mongodb.Collection>

Kind: instance method of ChatLogStorage

chatLogStorage.log(senderId, responses, request)

Log single event

Kind: instance method of ChatLogStorage

ParamTypeDescription
senderIdstring
responsesArray.<Object>list of sent responses
requestObjectevent request

BotConfigStorage

Storage for wingbot.ai conversation config

Kind: global class

new BotConfigStorage(mongoDb, collectionName)

ParamTypeDefault
mongoDbmongodb.Db | Object
collectionNamestring"botconfig"

botConfigStorage._collection : mongodb.Collection

Kind: instance property of BotConfigStorage

botConfigStorage._getCollection() ⇒ Promise.<mongodb.Collection>

Kind: instance method of BotConfigStorage

botConfigStorage.invalidateConfig() ⇒ Promise

Invalidates current configuration

Kind: instance method of BotConfigStorage

botConfigStorage.getConfigTimestamp() ⇒ Promise.<number>

Kind: instance method of BotConfigStorage

botConfigStorage.updateConfig(newConfig) ⇒ Promise.<T>

Kind: instance method of BotConfigStorage
Template: T

ParamType
newConfigT

botConfigStorage.getConfig() ⇒ Promise.<(Object|null)>

Kind: instance method of BotConfigStorage

AttachmentCache

Cache storage for Facebook attachments

Kind: global class

new AttachmentCache(mongoDb, collectionName)

ParamTypeDefault
mongoDbmongodb.Db | Object
collectionNamestring"attachments"

attachmentCache._collection : mongodb.Collection

Kind: instance property of AttachmentCache

attachmentCache._getCollection() ⇒ Promise.<mongodb.Collection>

Kind: instance method of AttachmentCache

attachmentCache.findAttachmentByUrl(url) ⇒ Promise.<(number|null)>

Kind: instance method of AttachmentCache

ParamType
urlstring

attachmentCache.saveAttachmentId(url, attachmentId) ⇒ Promise

Kind: instance method of AttachmentCache

ParamType
urlstring
attachmentIdnumber

State : Object

Kind: global typedef
Properties

NameType
senderIdstring
pageIdstring
stateObject

Token : Object

Kind: global typedef
Properties

NameType
senderIdstring
pageIdstring
tokenstring

Keywords

FAQs

Package last updated on 04 Nov 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc