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.
@@ -77,7 +77,7 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
77
77
  var bodyParser__default = /*#__PURE__*/_interopDefaultLegacy(bodyParser);
78
78
 
79
79
  var name = "botium-core";
80
- var version$1 = "1.14.0";
80
+ var version$1 = "1.14.1";
81
81
  var description = "The Selenium for Chatbots";
82
82
  var main = "index.js";
83
83
  var module$1 = "dist/botium-es.js";
@@ -108,12 +108,12 @@ var bugs = {
108
108
  };
109
109
  var homepage = "https://www.botium.ai";
110
110
  var dependencies = {
111
- "@babel/runtime": "^7.22.15",
112
- async: "^3.2.4",
111
+ "@babel/runtime": "^7.23.2",
112
+ async: "^3.2.5",
113
113
  "body-parser": "^1.20.2",
114
114
  boolean: "^3.2.0",
115
115
  bottleneck: "^2.19.5",
116
- "csv-parse": "^5.5.0",
116
+ "csv-parse": "^5.5.2",
117
117
  debug: "^4.3.4",
118
118
  express: "^4.18.2",
119
119
  globby: "11.0.4",
@@ -122,7 +122,7 @@ var dependencies = {
122
122
  "is-json": "^2.0.1",
123
123
  jsonpath: "^1.1.1",
124
124
  lodash: "^4.17.21",
125
- "markdown-it": "^13.0.1",
125
+ "markdown-it": "^13.0.2",
126
126
  "mime-types": "^2.1.35",
127
127
  mkdirp: "^3.0.1",
128
128
  moment: "^2.29.4",
@@ -132,7 +132,7 @@ var dependencies = {
132
132
  "promise.allsettled": "^1.0.7",
133
133
  randomatic: "^3.1.1",
134
134
  request: "^2.88.2",
135
- rimraf: "^5.0.1",
135
+ rimraf: "^5.0.5",
136
136
  "sanitize-filename": "^1.6.3",
137
137
  slugify: "^1.6.6",
138
138
  "socket.io": "^4.7.2",
@@ -140,31 +140,31 @@ var dependencies = {
140
140
  "socketio-auth": "^0.1.1",
141
141
  "swagger-jsdoc": "^6.2.8",
142
142
  "swagger-ui-express": "^5.0.0",
143
- uuid: "^9.0.0",
143
+ uuid: "^9.0.1",
144
144
  "word-error-rate": "0.0.7",
145
145
  "write-yaml": "^1.0.0",
146
146
  xlsx: "^0.18.5",
147
147
  xregexp: "^5.1.1",
148
- yaml: "^2.3.2"
148
+ yaml: "^2.3.4"
149
149
  };
150
150
  var devDependencies = {
151
- "@babel/core": "^7.22.17",
152
- "@babel/node": "^7.22.15",
153
- "@babel/plugin-transform-runtime": "^7.22.15",
154
- "@babel/preset-env": "^7.22.15",
155
- chai: "^4.3.8",
151
+ "@babel/core": "^7.23.3",
152
+ "@babel/node": "^7.22.19",
153
+ "@babel/plugin-transform-runtime": "^7.23.3",
154
+ "@babel/preset-env": "^7.23.3",
155
+ chai: "^4.3.10",
156
156
  "chai-as-promised": "^7.1.1",
157
157
  "cross-env": "^7.0.3",
158
- eslint: "^8.49.0",
158
+ eslint: "^8.53.0",
159
159
  "eslint-config-standard": "^17.1.0",
160
- "eslint-plugin-import": "^2.28.1",
161
- "eslint-plugin-mocha": "^10.1.0",
162
- "eslint-plugin-n": "^16.1.0",
160
+ "eslint-plugin-import": "^2.29.0",
161
+ "eslint-plugin-mocha": "^10.2.0",
162
+ "eslint-plugin-n": "^16.3.1",
163
163
  "eslint-plugin-promise": "^6.1.1",
164
164
  "eslint-plugin-standard": "^4.1.0",
165
165
  mocha: "^10.2.0",
166
- nock: "^13.3.3",
167
- "npm-check-updates": "^16.13.3",
166
+ nock: "^13.3.8",
167
+ "npm-check-updates": "^16.14.6",
168
168
  nyc: "^15.1.0",
169
169
  rollup: "2.79.1",
170
170
  "rollup-plugin-babel": "^4.4.0",
@@ -2911,6 +2911,8 @@ class Convo$6 {
2911
2911
  let botMsg = null;
2912
2912
  let waitForBotSays = true;
2913
2913
  let skipTranscriptStep = false;
2914
+ let conditionalGroupId = null;
2915
+ let conditionMetInGroup = false;
2914
2916
  for (let i = 0; i < this.conversation.length; i++) {
2915
2917
  const convoStep = this.conversation[i];
2916
2918
  const currentStepIndex = i;
@@ -3033,7 +3035,6 @@ class Convo$6 {
3033
3035
  throw failErr;
3034
3036
  }
3035
3037
  } else if (convoStep.sender === 'bot') {
3036
- const previousWaitForBotSays = waitForBotSays;
3037
3038
  if (waitForBotSays) {
3038
3039
  botMsg = null;
3039
3040
  } else {
@@ -3090,20 +3091,36 @@ class Convo$6 {
3090
3091
  throw failErr;
3091
3092
  }
3092
3093
  if (convoStep.conditional) {
3093
- const nextConvoStep = this.conversation[i + 1];
3094
- if (!previousWaitForBotSays) {
3095
- skipTranscriptStep = true;
3096
- }
3097
3094
  waitForBotSays = false;
3095
+ let endOfConditionalGroup = false;
3096
+ conditionalGroupId = convoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP')).args[1];
3097
+ const nextConvoStep = this.conversation[i + 1];
3098
3098
  if (!nextConvoStep || nextConvoStep.sender !== 'bot' || !nextConvoStep.logicHooks || !nextConvoStep.logicHooks.some(lh => lh.name.toUpperCase().startsWith('CONDITIONAL_STEP'))) {
3099
- waitForBotSays = true;
3099
+ endOfConditionalGroup = true;
3100
3100
  } else {
3101
- const conditionalLogicHook = convoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3102
3101
  const nextConditionalLogicHook = nextConvoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3103
- waitForBotSays = conditionalLogicHook.args[1] !== nextConditionalLogicHook.args[1];
3102
+ endOfConditionalGroup = conditionalGroupId !== nextConditionalLogicHook.args[1];
3104
3103
  }
3105
- if (convoStep.conditional.skip) {
3104
+ if (convoStep.conditional.skip || conditionMetInGroup) {
3105
+ skipTranscriptStep = true;
3106
+ if (endOfConditionalGroup && !conditionMetInGroup && !convoStep.optional) {
3107
+ const failErr = new BotiumError$2(`${this.header.name}/${convoStep.stepTag}: Non of the conditions are met in ${conditionalGroupId ? `'${conditionalGroupId}' ` : ''}condition group`);
3108
+ debug$j(failErr);
3109
+ throw failErr;
3110
+ }
3111
+ if (endOfConditionalGroup) {
3112
+ waitForBotSays = !convoStep.optional;
3113
+ conditionalGroupId = undefined;
3114
+ conditionMetInGroup = false;
3115
+ }
3106
3116
  continue;
3117
+ } else {
3118
+ conditionMetInGroup = true;
3119
+ if (endOfConditionalGroup) {
3120
+ waitForBotSays = !convoStep.optional;
3121
+ conditionalGroupId = undefined;
3122
+ conditionMetInGroup = false;
3123
+ }
3107
3124
  }
3108
3125
  }
3109
3126
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {