botium-core 1.14.0 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/botium-es.js CHANGED
@@ -35,7 +35,7 @@ import express from 'express';
35
35
  import bodyParser from 'body-parser';
36
36
 
37
37
  var name = "botium-core";
38
- var version$1 = "1.14.0";
38
+ var version$1 = "1.14.1";
39
39
  var description = "The Selenium for Chatbots";
40
40
  var main = "index.js";
41
41
  var module = "dist/botium-es.js";
@@ -66,12 +66,12 @@ var bugs = {
66
66
  };
67
67
  var homepage = "https://www.botium.ai";
68
68
  var dependencies = {
69
- "@babel/runtime": "^7.22.15",
70
- async: "^3.2.4",
69
+ "@babel/runtime": "^7.23.2",
70
+ async: "^3.2.5",
71
71
  "body-parser": "^1.20.2",
72
72
  boolean: "^3.2.0",
73
73
  bottleneck: "^2.19.5",
74
- "csv-parse": "^5.5.0",
74
+ "csv-parse": "^5.5.2",
75
75
  debug: "^4.3.4",
76
76
  express: "^4.18.2",
77
77
  globby: "11.0.4",
@@ -80,7 +80,7 @@ var dependencies = {
80
80
  "is-json": "^2.0.1",
81
81
  jsonpath: "^1.1.1",
82
82
  lodash: "^4.17.21",
83
- "markdown-it": "^13.0.1",
83
+ "markdown-it": "^13.0.2",
84
84
  "mime-types": "^2.1.35",
85
85
  mkdirp: "^3.0.1",
86
86
  moment: "^2.29.4",
@@ -90,7 +90,7 @@ var dependencies = {
90
90
  "promise.allsettled": "^1.0.7",
91
91
  randomatic: "^3.1.1",
92
92
  request: "^2.88.2",
93
- rimraf: "^5.0.1",
93
+ rimraf: "^5.0.5",
94
94
  "sanitize-filename": "^1.6.3",
95
95
  slugify: "^1.6.6",
96
96
  "socket.io": "^4.7.2",
@@ -98,31 +98,31 @@ var dependencies = {
98
98
  "socketio-auth": "^0.1.1",
99
99
  "swagger-jsdoc": "^6.2.8",
100
100
  "swagger-ui-express": "^5.0.0",
101
- uuid: "^9.0.0",
101
+ uuid: "^9.0.1",
102
102
  "word-error-rate": "0.0.7",
103
103
  "write-yaml": "^1.0.0",
104
104
  xlsx: "^0.18.5",
105
105
  xregexp: "^5.1.1",
106
- yaml: "^2.3.2"
106
+ yaml: "^2.3.4"
107
107
  };
108
108
  var devDependencies = {
109
- "@babel/core": "^7.22.17",
110
- "@babel/node": "^7.22.15",
111
- "@babel/plugin-transform-runtime": "^7.22.15",
112
- "@babel/preset-env": "^7.22.15",
113
- chai: "^4.3.8",
109
+ "@babel/core": "^7.23.3",
110
+ "@babel/node": "^7.22.19",
111
+ "@babel/plugin-transform-runtime": "^7.23.3",
112
+ "@babel/preset-env": "^7.23.3",
113
+ chai: "^4.3.10",
114
114
  "chai-as-promised": "^7.1.1",
115
115
  "cross-env": "^7.0.3",
116
- eslint: "^8.49.0",
116
+ eslint: "^8.53.0",
117
117
  "eslint-config-standard": "^17.1.0",
118
- "eslint-plugin-import": "^2.28.1",
119
- "eslint-plugin-mocha": "^10.1.0",
120
- "eslint-plugin-n": "^16.1.0",
118
+ "eslint-plugin-import": "^2.29.0",
119
+ "eslint-plugin-mocha": "^10.2.0",
120
+ "eslint-plugin-n": "^16.3.1",
121
121
  "eslint-plugin-promise": "^6.1.1",
122
122
  "eslint-plugin-standard": "^4.1.0",
123
123
  mocha: "^10.2.0",
124
- nock: "^13.3.3",
125
- "npm-check-updates": "^16.13.3",
124
+ nock: "^13.3.8",
125
+ "npm-check-updates": "^16.14.6",
126
126
  nyc: "^15.1.0",
127
127
  rollup: "2.79.1",
128
128
  "rollup-plugin-babel": "^4.4.0",
@@ -2869,6 +2869,8 @@ class Convo$6 {
2869
2869
  let botMsg = null;
2870
2870
  let waitForBotSays = true;
2871
2871
  let skipTranscriptStep = false;
2872
+ let conditionalGroupId = null;
2873
+ let conditionMetInGroup = false;
2872
2874
  for (let i = 0; i < this.conversation.length; i++) {
2873
2875
  const convoStep = this.conversation[i];
2874
2876
  const currentStepIndex = i;
@@ -2991,7 +2993,6 @@ class Convo$6 {
2991
2993
  throw failErr;
2992
2994
  }
2993
2995
  } else if (convoStep.sender === 'bot') {
2994
- const previousWaitForBotSays = waitForBotSays;
2995
2996
  if (waitForBotSays) {
2996
2997
  botMsg = null;
2997
2998
  } else {
@@ -3048,20 +3049,36 @@ class Convo$6 {
3048
3049
  throw failErr;
3049
3050
  }
3050
3051
  if (convoStep.conditional) {
3051
- const nextConvoStep = this.conversation[i + 1];
3052
- if (!previousWaitForBotSays) {
3053
- skipTranscriptStep = true;
3054
- }
3055
3052
  waitForBotSays = false;
3053
+ let endOfConditionalGroup = false;
3054
+ conditionalGroupId = convoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP')).args[1];
3055
+ const nextConvoStep = this.conversation[i + 1];
3056
3056
  if (!nextConvoStep || nextConvoStep.sender !== 'bot' || !nextConvoStep.logicHooks || !nextConvoStep.logicHooks.some(lh => lh.name.toUpperCase().startsWith('CONDITIONAL_STEP'))) {
3057
- waitForBotSays = true;
3057
+ endOfConditionalGroup = true;
3058
3058
  } else {
3059
- const conditionalLogicHook = convoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3060
3059
  const nextConditionalLogicHook = nextConvoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3061
- waitForBotSays = conditionalLogicHook.args[1] !== nextConditionalLogicHook.args[1];
3060
+ endOfConditionalGroup = conditionalGroupId !== nextConditionalLogicHook.args[1];
3062
3061
  }
3063
- if (convoStep.conditional.skip) {
3062
+ if (convoStep.conditional.skip || conditionMetInGroup) {
3063
+ skipTranscriptStep = true;
3064
+ if (endOfConditionalGroup && !conditionMetInGroup && !convoStep.optional) {
3065
+ const failErr = new BotiumError$2(`${this.header.name}/${convoStep.stepTag}: Non of the conditions are met in ${conditionalGroupId ? `'${conditionalGroupId}' ` : ''}condition group`);
3066
+ debug$j(failErr);
3067
+ throw failErr;
3068
+ }
3069
+ if (endOfConditionalGroup) {
3070
+ waitForBotSays = !convoStep.optional;
3071
+ conditionalGroupId = undefined;
3072
+ conditionMetInGroup = false;
3073
+ }
3064
3074
  continue;
3075
+ } else {
3076
+ conditionMetInGroup = true;
3077
+ if (endOfConditionalGroup) {
3078
+ waitForBotSays = !convoStep.optional;
3079
+ conditionalGroupId = undefined;
3080
+ conditionMetInGroup = false;
3081
+ }
3065
3082
  }
3066
3083
  }
3067
3084
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {