Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

botbuilder

Package Overview
Dependencies
Maintainers
1
Versions
631
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

botbuilder - npm Package Compare versions

Comparing version 0.11.1 to 1.0.0

tests/errors.js

2

lib/botbuilder.js

@@ -10,2 +10,3 @@ var session = require('./Session');

var command = require('./dialogs/CommandDialog');
var simple = require('./dialogs/SimpleDialog');
var entities = require('./dialogs/EntityRecognizer');

@@ -31,2 +32,3 @@ var storage = require('./storage/Storage');

exports.CommandDialog = command.CommandDialog;
exports.SimpleDialog = simple.SimpleDialog;
exports.EntityRecognizer = entities.EntityRecognizer;

@@ -33,0 +35,0 @@ exports.MemoryStorage = storage.MemoryStorage;

1

lib/Channel.js

@@ -6,3 +6,2 @@ function preferButtons(session, choiceCnt, rePrompt) {

case 'telegram':
return !rePrompt;
case 'kik':

@@ -9,0 +8,0 @@ return true;

@@ -95,5 +95,5 @@ var __extends = (this && this.__extends) || function (d, b) {

var fn;
var patterns = !util.isArray(patterns) ? [patterns] : patterns;
var p = (!util.isArray(patterns) ? [patterns] : patterns);
if (Array.isArray(dialogId)) {
fn = actions.DialogAction.waterfall(dialogId);
fn = actions.waterfall(dialogId);
}

@@ -104,7 +104,7 @@ else if (typeof dialogId == 'string') {

else {
fn = dialogId;
fn = actions.waterfall([dialogId]);
}
var expressions = [];
for (var i = 0; i < patterns.length; i++) {
expressions.push(new RegExp(patterns[i], 'i'));
for (var i = 0; i < p.length; i++) {
expressions.push(new RegExp(p[i], 'i'));
}

@@ -117,3 +117,3 @@ this.commands.push({ expressions: expressions, fn: fn });

if (Array.isArray(dialogId)) {
fn = actions.DialogAction.waterfall(dialogId);
fn = actions.waterfall(dialogId);
}

@@ -124,3 +124,3 @@ else if (typeof dialogId == 'string') {

else {
fn = dialogId;
fn = actions.waterfall([dialogId]);
}

@@ -127,0 +127,0 @@ this.default = { fn: fn };

@@ -5,2 +5,3 @@ var ses = require('../Session');

var dialog = require('./Dialog');
var simple = require('./SimpleDialog');
var DialogAction = (function () {

@@ -48,53 +49,4 @@ function DialogAction() {

};
DialogAction.waterfall = function (steps) {
return function waterfallAction(s, r) {
var skip = function (result) {
result = result || {};
if (!result.resumed) {
result.resumed = dialog.ResumeReason.forward;
}
waterfallAction(s, result);
};
if (r && r.hasOwnProperty('resumed')) {
var step = s.dialogData[consts.Data.WaterfallStep];
switch (r.resumed) {
case dialog.ResumeReason.back:
step -= 1;
break;
default:
step++;
}
if (step >= 0 && step < steps.length) {
try {
s.dialogData[consts.Data.WaterfallStep] = step;
steps[step](s, r, skip);
}
catch (e) {
delete s.dialogData[consts.Data.WaterfallStep];
s.endDialog({ resumed: dialog.ResumeReason.notCompleted, error: e instanceof Error ? e : new Error(e.toString()) });
}
}
else {
delete s.dialogData[consts.Data.WaterfallStep];
s.send();
}
}
else if (steps && steps.length > 0) {
try {
s.dialogData[consts.Data.WaterfallStep] = 0;
steps[0](s, r, skip);
}
catch (e) {
delete s.dialogData[consts.Data.WaterfallStep];
s.endDialog({ resumed: dialog.ResumeReason.notCompleted, error: e instanceof Error ? e : new Error(e.toString()) });
}
}
else {
delete s.dialogData[consts.Data.WaterfallStep];
s.send();
}
};
};
DialogAction.validatedPrompt = function (promptType, validator) {
return function validatePromptAction(s, r) {
return new simple.SimpleDialog(function (s, r) {
r = r || {};

@@ -141,3 +93,3 @@ var valid = false;

}
};
});
};

@@ -147,1 +99,49 @@ return DialogAction;

exports.DialogAction = DialogAction;
function waterfall(steps) {
return function waterfallAction(s, r) {
var skip = function (result) {
result = result || {};
if (!result.resumed) {
result.resumed = dialog.ResumeReason.forward;
}
waterfallAction(s, result);
};
if (r && r.hasOwnProperty('resumed')) {
var step = s.dialogData[consts.Data.WaterfallStep];
switch (r.resumed) {
case dialog.ResumeReason.back:
step -= 1;
break;
default:
step++;
}
if (step >= 0 && step < steps.length) {
try {
s.dialogData[consts.Data.WaterfallStep] = step;
steps[step](s, r, skip);
}
catch (e) {
delete s.dialogData[consts.Data.WaterfallStep];
s.endDialog({ resumed: dialog.ResumeReason.notCompleted, error: e instanceof Error ? e : new Error(e.toString()) });
}
}
else {
s.endDialog(r);
}
}
else if (steps && steps.length > 0) {
try {
s.dialogData[consts.Data.WaterfallStep] = 0;
steps[0](s, r, skip);
}
catch (e) {
delete s.dialogData[consts.Data.WaterfallStep];
s.endDialog({ resumed: dialog.ResumeReason.notCompleted, error: e instanceof Error ? e : new Error(e.toString()) });
}
}
else {
s.endDialog({ resumed: dialog.ResumeReason.notCompleted });
}
};
}
exports.waterfall = waterfall;

@@ -22,6 +22,6 @@ var __extends = (this && this.__extends) || function (d, b) {

if (Array.isArray(dialog)) {
dialog = new simpleDialog.SimpleDialog(actions.DialogAction.waterfall(dialog));
dialog = new simpleDialog.SimpleDialog(actions.waterfall(dialog));
}
else if (typeof dialog == 'function') {
dialog = new simpleDialog.SimpleDialog(dialog);
dialog = new simpleDialog.SimpleDialog(actions.waterfall([dialog]));
}

@@ -28,0 +28,0 @@ dialogs = (_a = {}, _a[id] = dialog, _a);

@@ -157,3 +157,3 @@ var __extends = (this && this.__extends) || function (d, b) {

catch (e) {
session.endDialog({ error: new Error('Exception handling intent: ' + e.message) });
session.error(e instanceof Error ? e : new Error(e.toString()));
}

@@ -210,3 +210,3 @@ };

if (Array.isArray(dialogId)) {
this.handlers[intent] = actions.DialogAction.waterfall(dialogId);
this.handlers[intent] = actions.waterfall(dialogId);
}

@@ -217,3 +217,3 @@ else if (typeof dialogId == 'string') {

else {
this.handlers[intent] = dialogId;
this.handlers[intent] = actions.waterfall([dialogId]);
}

@@ -220,0 +220,0 @@ }

@@ -5,3 +5,3 @@ {

"description": "Bot Builder is a dialog system for building rich bots on virtually any platform.",
"version": "0.11.1",
"version": "1.0.0",
"license": "MIT",

@@ -8,0 +8,0 @@ "keywords": [

Sorry, the diff of this file is too big to display

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