botium-core 1.13.16 → 1.13.18

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.
Files changed (29) hide show
  1. package/README.md +0 -1
  2. package/dist/botium-cjs.js +283 -172
  3. package/dist/botium-cjs.js.map +1 -1
  4. package/dist/botium-es.js +282 -171
  5. package/dist/botium-es.js.map +1 -1
  6. package/package.json +23 -23
  7. package/src/BotDriver.js +2 -4
  8. package/src/Capabilities.js +7 -3
  9. package/src/Events.js +1 -0
  10. package/src/containers/BaseContainer.js +5 -3
  11. package/src/containers/PluginConnectorContainer.js +0 -4
  12. package/src/containers/plugins/SimpleRestContainer.js +49 -0
  13. package/src/scripting/Convo.js +10 -27
  14. package/src/scripting/ScriptingProvider.js +121 -53
  15. package/src/scripting/helper.js +9 -2
  16. package/src/scripting/logichook/asserter/ButtonsAsserter.js +21 -8
  17. package/src/scripting/logichook/asserter/WerAsserter.js +53 -6
  18. package/src/scripting/logichook/logichooks/ClearQueueLogicHook.js +0 -1
  19. package/test/connectors/logicHook.js +0 -1
  20. package/test/connectors/simplerest.spec.js +79 -4
  21. package/test/scripting/asserters/buttonsAsserter.spec.js +84 -50
  22. package/test/scripting/logichooks/convos/custom_embedded_skip.convo.txt +11 -0
  23. package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_me.convo.txt +11 -0
  24. package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_nothing.convo.txt +8 -0
  25. package/test/scripting/logichooks/customEmbeddedSkip.json +14 -0
  26. package/test/scripting/logichooks/customEmbeddedSkip.spec.js +58 -0
  27. package/test/security/allowUnsafe.spec.js +20 -10
  28. package/test/security/convos/withscriptingmemoryfunction.convo.txt +1 -0
  29. package/test/convo/retryconvo.spec.js +0 -134
@@ -6,7 +6,7 @@ var util = require('util');
6
6
  var fs = require('fs');
7
7
  var path = require('path');
8
8
  var async = require('async');
9
- var rimraf = require('rimraf');
9
+ var rimraf$1 = require('rimraf');
10
10
  var mkdirp = require('mkdirp');
11
11
  var sanitizeFilename = require('sanitize-filename');
12
12
  var moment = require('moment');
@@ -46,7 +46,7 @@ var util__default = /*#__PURE__*/_interopDefaultLegacy(util);
46
46
  var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
47
47
  var path__default = /*#__PURE__*/_interopDefaultLegacy(path);
48
48
  var async__default = /*#__PURE__*/_interopDefaultLegacy(async);
49
- var rimraf__default = /*#__PURE__*/_interopDefaultLegacy(rimraf);
49
+ var rimraf__default = /*#__PURE__*/_interopDefaultLegacy(rimraf$1);
50
50
  var mkdirp__default = /*#__PURE__*/_interopDefaultLegacy(mkdirp);
51
51
  var sanitizeFilename__default = /*#__PURE__*/_interopDefaultLegacy(sanitizeFilename);
52
52
  var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
@@ -81,7 +81,7 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
81
81
  var bodyParser__default = /*#__PURE__*/_interopDefaultLegacy(bodyParser);
82
82
 
83
83
  var name = "botium-core";
84
- var version$1 = "1.13.16";
84
+ var version$1 = "1.13.18";
85
85
  var description = "The Selenium for Chatbots";
86
86
  var main = "index.js";
87
87
  var module$1 = "dist/botium-es.js";
@@ -113,66 +113,66 @@ var bugs = {
113
113
  };
114
114
  var homepage = "https://www.botium.ai";
115
115
  var dependencies = {
116
- "@babel/runtime": "^7.20.6",
116
+ "@babel/runtime": "^7.21.5",
117
117
  async: "^3.2.4",
118
- "body-parser": "^1.20.1",
118
+ "body-parser": "^1.20.2",
119
119
  boolean: "^3.2.0",
120
120
  bottleneck: "^2.19.5",
121
- "csv-parse": "^5.3.3",
121
+ "csv-parse": "^5.3.10",
122
122
  debug: "^4.3.4",
123
123
  esprima: "^4.0.1",
124
124
  express: "^4.18.2",
125
125
  globby: "11.0.4",
126
- ioredis: "^5.2.4",
126
+ ioredis: "^5.3.2",
127
127
  "is-class": "^0.0.9",
128
128
  "is-json": "^2.0.1",
129
129
  jsonpath: "^1.1.1",
130
130
  lodash: "^4.17.21",
131
131
  "markdown-it": "^13.0.1",
132
132
  "mime-types": "^2.1.35",
133
- mkdirp: "^1.0.4",
133
+ mkdirp: "^3.0.1",
134
134
  moment: "^2.29.4",
135
135
  mustache: "^4.2.0",
136
136
  "promise-retry": "^2.0.1",
137
137
  "promise.allsettled": "^1.0.6",
138
138
  randomatic: "^3.1.1",
139
139
  request: "^2.88.2",
140
- rimraf: "^3.0.2",
140
+ rimraf: "^5.0.0",
141
141
  "sanitize-filename": "^1.6.3",
142
- slugify: "^1.6.5",
143
- "socket.io": "^4.5.4",
144
- "socket.io-client": "^4.5.4",
142
+ slugify: "^1.6.6",
143
+ "socket.io": "^4.6.1",
144
+ "socket.io-client": "^4.6.1",
145
145
  "socketio-auth": "^0.1.1",
146
- "swagger-jsdoc": "^6.2.5",
147
- "swagger-ui-express": "^4.6.0",
146
+ "swagger-jsdoc": "^6.2.8",
147
+ "swagger-ui-express": "^4.6.3",
148
148
  uuid: "^9.0.0",
149
- vm2: "^3.9.13",
149
+ vm2: "^3.9.17",
150
150
  "word-error-rate": "0.0.7",
151
151
  "write-yaml": "^1.0.0",
152
152
  xlsx: "^0.18.5",
153
153
  xregexp: "^5.1.1",
154
- yaml: "^2.1.3"
154
+ yaml: "^2.2.2"
155
155
  };
156
156
  var devDependencies = {
157
- "@babel/core": "^7.20.5",
158
- "@babel/node": "^7.20.5",
159
- "@babel/plugin-transform-runtime": "^7.19.6",
160
- "@babel/preset-env": "^7.20.2",
157
+ "@babel/core": "^7.21.8",
158
+ "@babel/node": "^7.20.7",
159
+ "@babel/plugin-transform-runtime": "^7.21.4",
160
+ "@babel/preset-env": "^7.21.5",
161
161
  chai: "^4.3.7",
162
162
  "chai-as-promised": "^7.1.1",
163
163
  "cross-env": "^7.0.3",
164
- eslint: "^8.29.0",
164
+ eslint: "^8.40.0",
165
165
  "eslint-config-standard": "^17.0.0",
166
- "eslint-plugin-import": "^2.26.0",
166
+ "eslint-plugin-import": "^2.27.5",
167
167
  "eslint-plugin-mocha": "^10.1.0",
168
- "eslint-plugin-n": "^15.6.0",
168
+ "eslint-plugin-n": "^15.7.0",
169
169
  "eslint-plugin-promise": "^6.1.1",
170
170
  "eslint-plugin-standard": "^4.1.0",
171
171
  "license-checker": "^25.0.1",
172
172
  "license-compatibility-checker": "^0.3.5",
173
173
  mocha: "^10.2.0",
174
- nock: "^13.2.9",
175
- "npm-check-updates": "^16.5.6",
174
+ nock: "^13.3.1",
175
+ "npm-check-updates": "^16.10.12",
176
176
  nyc: "^15.1.0",
177
177
  rollup: "2.79.1",
178
178
  "rollup-plugin-babel": "^4.4.0",
@@ -286,6 +286,12 @@ var Capabilities = {
286
286
  SIMPLEREST_POLL_INTERVAL: 'SIMPLEREST_POLL_INTERVAL',
287
287
  SIMPLEREST_POLL_TIMEOUT: 'SIMPLEREST_PING_TIMEOUT',
288
288
  SIMPLEREST_POLL_UPDATE_CONTEXT: 'SIMPLEREST_POLL_UPDATE_CONTEXT',
289
+ SIMPLEREST_CONTEXT_IGNORE_JSONPATH: 'SIMPLEREST_CONTEXT_IGNORE_JSONPATH',
290
+ SIMPLEREST_CONTEXT_IGNORE_MATCH: 'SIMPLEREST_CONTEXT_IGNORE_MATCH',
291
+ SIMPLEREST_CONTEXT_SKIP_JSONPATH: 'SIMPLEREST_CONTEXT_SKIP_JSONPATH',
292
+ SIMPLEREST_CONTEXT_SKIP_MATCH: 'SIMPLEREST_CONTEXT_SKIP_MATCH',
293
+ SIMPLEREST_CONTEXT_CONTINUE_JSONPATH: 'SIMPLEREST_CONTEXT_CONTINUE_JSONPATH',
294
+ SIMPLEREST_CONTEXT_CONTINUE_MATCH: 'SIMPLEREST_CONTEXT_CONTINUE_MATCH',
289
295
  SIMPLEREST_BODY_JSONPATH: 'SIMPLEREST_BODY_JSONPATH',
290
296
  SIMPLEREST_RESPONSE_JSONPATH: 'SIMPLEREST_RESPONSE_JSONPATH',
291
297
  SIMPLEREST_RESPONSE_HOOK: 'SIMPLEREST_RESPONSE_HOOK',
@@ -383,9 +389,7 @@ var Capabilities = {
383
389
  RATELIMIT_USERSAYS_MINTIME: 'RATELIMIT_USERSAYS_MINTIME',
384
390
  RATELIMIT_BOTTLENECK_FN: 'RATELIMIT_BOTTLENECK_FN',
385
391
  SECURITY_ALLOW_UNSAFE: 'SECURITY_ALLOW_UNSAFE',
386
- PRECOMPILERS: 'PRECOMPILERS',
387
- // RETRY
388
- RETRY_CONVO_ASYNC: 'RETRY_CONVO_ASYNC'
392
+ PRECOMPILERS: 'PRECOMPILERS'
389
393
  };
390
394
  Capabilities.PROJECTNAME;
391
395
  Capabilities.TESTSESSIONNAME;
@@ -454,6 +458,12 @@ Capabilities.SIMPLEREST_POLL_REQUEST_HOOK;
454
458
  Capabilities.SIMPLEREST_POLL_INTERVAL;
455
459
  Capabilities.SIMPLEREST_POLL_TIMEOUT;
456
460
  Capabilities.SIMPLEREST_POLL_UPDATE_CONTEXT;
461
+ Capabilities.SIMPLEREST_CONTEXT_IGNORE_JSONPATH;
462
+ Capabilities.SIMPLEREST_CONTEXT_IGNORE_MATCH;
463
+ Capabilities.SIMPLEREST_CONTEXT_SKIP_JSONPATH;
464
+ Capabilities.SIMPLEREST_CONTEXT_SKIP_MATCH;
465
+ Capabilities.SIMPLEREST_CONTEXT_CONTINUE_JSONPATH;
466
+ Capabilities.SIMPLEREST_CONTEXT_CONTINUE_MATCH;
457
467
  Capabilities.SIMPLEREST_BODY_JSONPATH;
458
468
  Capabilities.SIMPLEREST_RESPONSE_JSONPATH;
459
469
  Capabilities.SIMPLEREST_RESPONSE_HOOK;
@@ -538,7 +548,6 @@ Capabilities.RATELIMIT_USERSAYS_MINTIME;
538
548
  Capabilities.RATELIMIT_BOTTLENECK_FN;
539
549
  Capabilities.SECURITY_ALLOW_UNSAFE;
540
550
  Capabilities.PRECOMPILERS;
541
- Capabilities.RETRY_CONVO_ASYNC;
542
551
 
543
552
  var Source = {
544
553
  LOCALPATH: 'LOCALPATH',
@@ -859,6 +868,7 @@ var Events = {
859
868
  CONTAINER_CLEANED: 'CONTAINER_CLEANED',
860
869
  CONTAINER_CLEAN_ERROR: 'CONTAINER_CLEAN_ERROR',
861
870
  BOT_CONNECTED: 'BOT_CONNECTED',
871
+ CONVO_STEP_NEXT: 'CONVO_STEP_NEXT',
862
872
  // Chatbot Events
863
873
  MESSAGE_SENTTOBOT: 'MESSAGE_SENTTOBOT',
864
874
  MESSAGE_SENDTOBOT_ERROR: 'MESSAGE_SENDTOBOT_ERROR',
@@ -882,6 +892,7 @@ Events.CONTAINER_CLEANING;
882
892
  Events.CONTAINER_CLEANED;
883
893
  Events.CONTAINER_CLEAN_ERROR;
884
894
  Events.BOT_CONNECTED;
895
+ Events.CONVO_STEP_NEXT;
885
896
  Events.MESSAGE_SENTTOBOT;
886
897
  Events.MESSAGE_SENDTOBOT_ERROR;
887
898
  Events.MESSAGE_RECEIVEDFROMBOT;
@@ -2225,7 +2236,7 @@ const linesToScriptingMemories$2 = (lines, columnMode = null) => {
2225
2236
  }
2226
2237
  return scriptingMemories;
2227
2238
  };
2228
- const calculateWer$1 = (str, pattern) => {
2239
+ const calculateWer$2 = (str, pattern) => {
2229
2240
  const _prepareString = (str, remWildcard = false) => {
2230
2241
  if (remWildcard) return str.replace(/[.,/#!$%^&;:*{}=\-_`~()]/g, '').toLowerCase();
2231
2242
  return str.replace(/[.,/#!$%^&;:{}=\-_`~()]/g, '').toLowerCase();
@@ -2248,6 +2259,11 @@ const calculateWer$1 = (str, pattern) => {
2248
2259
  const botMessage = _prepareString(str);
2249
2260
  const botMessageWords = botMessage.split(' ').map(bm => bm.trim());
2250
2261
  const utt = _prepareString(utterance);
2262
+
2263
+ // if no wildcards, just calculate WER
2264
+ if (utt.indexOf('*') === -1) return wordErrorRate__default["default"].wordErrorRate(botMessage, utt).toFixed(2);
2265
+
2266
+ // if there are wildcards, calculate WER for each wildcard part
2251
2267
  const errors = [];
2252
2268
  for (let wildcardPart of utt.split('*')) {
2253
2269
  let wer = 1;
@@ -2267,7 +2283,7 @@ const calculateWer$1 = (str, pattern) => {
2267
2283
  }
2268
2284
  }
2269
2285
  if (lodash__default["default"].isNil(subsetPhraseFound)) {
2270
- throw new Error('Word Error Asserter: Something went wrong here, please try to modify your assertion!');
2286
+ throw new Error('Word Error Asserter: When using wild cards, please make sure that the length of the asserter text is smaller than the bot message!');
2271
2287
  }
2272
2288
  errors.push(_getErrors(_getWords(wildcardPart), _getWords(subsetPhraseFound)));
2273
2289
  }
@@ -2280,6 +2296,7 @@ const calculateWer$1 = (str, pattern) => {
2280
2296
  debug$l(`Word Error Rate Asserter - Compared Bot Message '${botMessage}' / '${utt}': ${(errCount / allCount).toFixed(2)}`);
2281
2297
  return (errCount / allCount).toFixed(2);
2282
2298
  };
2299
+ const toPercent$1 = s => `${(s * 100).toFixed(0)}%`;
2283
2300
  var helper = {
2284
2301
  normalizeText: normalizeText$1,
2285
2302
  splitStringInNonEmptyLines: splitStringInNonEmptyLines$1,
@@ -2294,7 +2311,8 @@ var helper = {
2294
2311
  validateSender: validateSender$1,
2295
2312
  validateConvo: validateConvo$2,
2296
2313
  linesToScriptingMemories: linesToScriptingMemories$2,
2297
- calculateWer: calculateWer$1
2314
+ calculateWer: calculateWer$2,
2315
+ toPercent: toPercent$1
2298
2316
  };
2299
2317
 
2300
2318
  const debug$k = debug__default["default"]('botium-core-ScriptingMemory');
@@ -2634,45 +2652,7 @@ ScriptingMemory.extractVarNames;
2634
2652
  ScriptingMemory.RESERVED_WORDS;
2635
2653
  ScriptingMemory.SCRIPTING_FUNCTIONS;
2636
2654
 
2637
- const debug$j = debug__default["default"]('botium-core-RetryHelper');
2638
- var RetryHelper_1 = class RetryHelper {
2639
- constructor(caps, section, options = {}) {
2640
- this.retryErrorPatterns = [];
2641
- const onErrorRegexp = caps[`RETRY_${section.toUpperCase()}_ONERROR_REGEXP`] || [];
2642
- if (onErrorRegexp) {
2643
- if (lodash__default["default"].isArray(onErrorRegexp)) {
2644
- onErrorRegexp.forEach(r => {
2645
- if (lodash__default["default"].isString(r)) this.retryErrorPatterns.push(new RegExp(r, 'i'));else this.retryErrorPatterns.push(r);
2646
- });
2647
- } else if (lodash__default["default"].isString(onErrorRegexp)) {
2648
- this.retryErrorPatterns.push(new RegExp(onErrorRegexp, 'i'));
2649
- } else {
2650
- this.retryErrorPatterns.push(onErrorRegexp);
2651
- }
2652
- }
2653
-
2654
- // to turn on retries, NUMRETRIES or ONERROR_REGEXP has to be set
2655
- this.retrySettings = {
2656
- retries: caps[`RETRY_${section.toUpperCase()}_NUMRETRIES`] || (!lodash__default["default"].isNil(options.numRetries) ? options.numRetries : this.retryErrorPatterns.length === 0 ? 0 : 1),
2657
- factor: caps[`RETRY_${section.toUpperCase()}_FACTOR`] || (lodash__default["default"].isNil(options.factor) ? 1 : options.factor),
2658
- minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (lodash__default["default"].isNil(options.minTimeout) ? 1000 : options.minTimeout)
2659
- };
2660
- if (this.retrySettings.retries > 0) {
2661
- debug$j(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
2662
- }
2663
- }
2664
- shouldRetry(err) {
2665
- if (!err) return false;
2666
- if (this.retryErrorPatterns.length === 0) return true;
2667
- const errString = util__default["default"].inspect(err);
2668
- for (const re of this.retryErrorPatterns) {
2669
- if (errString.match(re)) return true;
2670
- }
2671
- return false;
2672
- }
2673
- };
2674
-
2675
- const debug$i = debug__default["default"]('botium-core-Convo');
2655
+ const debug$j = debug__default["default"]('botium-core-Convo');
2676
2656
  const {
2677
2657
  BotiumError: BotiumError$4,
2678
2658
  botiumErrorFromErr: botiumErrorFromErr$1,
@@ -2826,10 +2806,10 @@ class TranscriptError extends Error {
2826
2806
  class Convo$6 {
2827
2807
  constructor(context, fromJson = {}) {
2828
2808
  if (fromJson instanceof Convo$6) {
2829
- debug$i('Illegal state!!! Parameter should be a JSON, but it is a Convo');
2809
+ debug$j('Illegal state!!! Parameter should be a JSON, but it is a Convo');
2830
2810
  } else if (fromJson.beginAsserter) {
2831
2811
  // beginAsserter is one of the fields which are lost
2832
- debug$i('Illegal state!!! Parameter should be a native JSON, but looks as a Convo converted to JSON');
2812
+ debug$j('Illegal state!!! Parameter should be a native JSON, but looks as a Convo converted to JSON');
2833
2813
  }
2834
2814
  this.scriptingEvents = context.scriptingEvents;
2835
2815
  this.context = context;
@@ -2874,30 +2854,6 @@ class Convo$6 {
2874
2854
  return this.header.toString() + (this.sourceTag ? ` (${util__default["default"].inspect(this.sourceTag)})` : '') + ': ' + this.conversation.map(c => c.toString()).join(' | ');
2875
2855
  }
2876
2856
  async Run(container) {
2877
- if (container.caps.RETRY_CONVO_ASYNC) {
2878
- return this.RunImpl(container).catch(err => {
2879
- debug$i(`Convo failed with error "${err.message || JSON.stringify(err)}".`);
2880
- throw err;
2881
- });
2882
- } else {
2883
- const retryHelper = new RetryHelper_1(container.caps, 'CONVO');
2884
- return promiseRetry__default["default"](async (retry, number) => {
2885
- const retryRemaining = retryHelper.retrySettings.retries - number + 1;
2886
- return this.RunImpl(container).catch(err => {
2887
- if (retryHelper.shouldRetry(err)) {
2888
- debug$i(`Convo failed with error "${err.message || JSON.stringify(err)}". Retry ${retryRemaining > 0 ? 'enabled' : 'disabled'} (remaining #${retryRemaining}/${retryHelper.retrySettings.retries}, criterion matches)`);
2889
- retry(err);
2890
- } else {
2891
- if (retryHelper.retryErrorPatterns.length > 0) {
2892
- debug$i(`Convo failed with error "${err.message || JSON.stringify(err)}". Retry 'disabled' (remaining (#${retryRemaining}/${retryHelper.retrySettings.retries}), criterion does not match)`);
2893
- }
2894
- throw err;
2895
- }
2896
- });
2897
- }, retryHelper.retrySettings);
2898
- }
2899
- }
2900
- async RunImpl(container) {
2901
2857
  const transcript = new Transcript({
2902
2858
  steps: [],
2903
2859
  attachments: [],
@@ -3003,6 +2959,7 @@ class Convo$6 {
3003
2959
  for (let i = 0; i < this.conversation.length; i++) {
3004
2960
  const convoStep = this.conversation[i];
3005
2961
  const currentStepIndex = i;
2962
+ container.eventEmitter.emit(Events.CONVO_STEP_NEXT, container, convoStep, i);
3006
2963
  skipTranscriptStep = false;
3007
2964
  const transcriptStep = new TranscriptStep({
3008
2965
  expected: new BotiumMockMessage_1(convoStep),
@@ -3062,7 +3019,7 @@ class Convo$6 {
3062
3019
  });
3063
3020
  await this._checkBotRepliesConsumed(container);
3064
3021
  const coreMsg = lodash__default["default"].omit(removeBuffers(meMsg), ['sourceData']);
3065
- debug$i(`${this.header.name}/${convoStep.stepTag}: user says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3022
+ debug$j(`${this.header.name}/${convoStep.stepTag}: user says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3066
3023
  await new Promise(resolve => {
3067
3024
  if (container.caps.SIMULATE_WRITING_SPEED && meMsg.messageText && meMsg.messageText.length) {
3068
3025
  setTimeout(() => resolve(), container.caps.SIMULATE_WRITING_SPEED * meMsg.messageText.length);
@@ -3098,7 +3055,7 @@ class Convo$6 {
3098
3055
  });
3099
3056
  continue;
3100
3057
  } else {
3101
- debug$i(`${this.header.name}/${convoStep.stepTag}: message not found in #me section, message not sent to container ${util__default["default"].inspect(convoStep)}`);
3058
+ debug$j(`${this.header.name}/${convoStep.stepTag}: message not found in #me section, message not sent to container ${util__default["default"].inspect(convoStep)}`);
3102
3059
  transcriptStep.botEnd = new Date();
3103
3060
  await this.scriptingEvents.onMeEnd({
3104
3061
  convo: this,
@@ -3114,7 +3071,7 @@ class Convo$6 {
3114
3071
  } catch (err) {
3115
3072
  transcriptStep.botEnd = new Date();
3116
3073
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: error sending to bot - ${err.message || err}`, err);
3117
- debug$i(failErr);
3074
+ debug$j(failErr);
3118
3075
  try {
3119
3076
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr);
3120
3077
  } catch (failErr) {}
@@ -3127,7 +3084,7 @@ class Convo$6 {
3127
3084
  waitForBotSays = true;
3128
3085
  }
3129
3086
  try {
3130
- debug$i(`${this.header.name} wait for bot ${convoStep.channel || ''}`);
3087
+ debug$j(`${this.header.name} wait for bot ${convoStep.channel || ''}`);
3131
3088
  await this.scriptingEvents.onBotStart({
3132
3089
  convo: this,
3133
3090
  convoStep,
@@ -3143,11 +3100,11 @@ class Convo$6 {
3143
3100
  transcriptStep.botEnd = new Date();
3144
3101
  transcriptStep.actual = new BotiumMockMessage_1(botMsg);
3145
3102
  const coreMsg = lodash__default["default"].omit(removeBuffers(botMsg), ['sourceData']);
3146
- debug$i(`${this.header.name}: bot says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3103
+ debug$j(`${this.header.name}: bot says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3147
3104
  } catch (err) {
3148
3105
  transcriptStep.botEnd = new Date();
3149
3106
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: error waiting for bot - ${err.message}`, err);
3150
- debug$i(failErr);
3107
+ debug$j(failErr);
3151
3108
  try {
3152
3109
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3153
3110
  } catch (failErr) {}
@@ -3166,19 +3123,27 @@ class Convo$6 {
3166
3123
  if (prepared) {
3167
3124
  transcriptStep.actual = new BotiumMockMessage_1(botMsg);
3168
3125
  const coreMsg = lodash__default["default"].omit(removeBuffers(botMsg), ['sourceData']);
3169
- debug$i(`${this.header.name}: onBotPrepare (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3126
+ debug$j(`${this.header.name}: onBotPrepare (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3170
3127
  }
3171
3128
  } catch (err) {
3172
3129
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: onBotPrepare error - ${err.message || err}`, err);
3173
- debug$i(failErr);
3130
+ debug$j(failErr);
3174
3131
  try {
3175
3132
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3176
3133
  } catch (failErr) {}
3177
3134
  throw failErr;
3178
3135
  }
3136
+ if (convoStep.skip === true) {
3137
+ skipTranscriptStep = true;
3138
+ const nextConvoStep = this.conversation[i + 1];
3139
+ if (nextConvoStep && nextConvoStep.sender === 'bot') {
3140
+ waitForBotSays = false;
3141
+ }
3142
+ continue;
3143
+ }
3179
3144
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
3180
3145
  const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
3181
- debug$i(failErr);
3146
+ debug$j(failErr);
3182
3147
  try {
3183
3148
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3184
3149
  } catch (failErr) {}
@@ -3259,7 +3224,7 @@ class Convo$6 {
3259
3224
  continue;
3260
3225
  }
3261
3226
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: assertion error - ${err.message || err}`, err);
3262
- debug$i(failErr);
3227
+ debug$j(failErr);
3263
3228
  try {
3264
3229
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3265
3230
  } catch (failErr) {}
@@ -3280,7 +3245,7 @@ class Convo$6 {
3280
3245
  }
3281
3246
  } else {
3282
3247
  const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util__default["default"].inspect(convoStep.sender)}`);
3283
- debug$i(failErr);
3248
+ debug$j(failErr);
3284
3249
  try {
3285
3250
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr);
3286
3251
  } catch (failErr) {}
@@ -3486,7 +3451,7 @@ class Convo$6 {
3486
3451
  throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
3487
3452
  }
3488
3453
  _getEffectiveConversationRecursive(partialConvo.conversation, [...parentPConvos, includeLogicHook], result, true);
3489
- debug$i(`Partial convo ${includeLogicHook} included`);
3454
+ debug$j(`Partial convo ${includeLogicHook} included`);
3490
3455
  });
3491
3456
  });
3492
3457
  return result;
@@ -3507,10 +3472,48 @@ var Convo_1 = {
3507
3472
  TranscriptError
3508
3473
  };
3509
3474
 
3475
+ const debug$i = debug__default["default"]('botium-core-RetryHelper');
3476
+ var RetryHelper_1 = class RetryHelper {
3477
+ constructor(caps, section, options = {}) {
3478
+ this.retryErrorPatterns = [];
3479
+ const onErrorRegexp = caps[`RETRY_${section.toUpperCase()}_ONERROR_REGEXP`] || [];
3480
+ if (onErrorRegexp) {
3481
+ if (lodash__default["default"].isArray(onErrorRegexp)) {
3482
+ onErrorRegexp.forEach(r => {
3483
+ if (lodash__default["default"].isString(r)) this.retryErrorPatterns.push(new RegExp(r, 'i'));else this.retryErrorPatterns.push(r);
3484
+ });
3485
+ } else if (lodash__default["default"].isString(onErrorRegexp)) {
3486
+ this.retryErrorPatterns.push(new RegExp(onErrorRegexp, 'i'));
3487
+ } else {
3488
+ this.retryErrorPatterns.push(onErrorRegexp);
3489
+ }
3490
+ }
3491
+
3492
+ // to turn on retries, NUMRETRIES or ONERROR_REGEXP has to be set
3493
+ this.retrySettings = {
3494
+ retries: caps[`RETRY_${section.toUpperCase()}_NUMRETRIES`] || (!lodash__default["default"].isNil(options.numRetries) ? options.numRetries : this.retryErrorPatterns.length === 0 ? 0 : 1),
3495
+ factor: caps[`RETRY_${section.toUpperCase()}_FACTOR`] || (lodash__default["default"].isNil(options.factor) ? 1 : options.factor),
3496
+ minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (lodash__default["default"].isNil(options.minTimeout) ? 1000 : options.minTimeout)
3497
+ };
3498
+ if (this.retrySettings.retries > 0) {
3499
+ debug$i(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
3500
+ }
3501
+ }
3502
+ shouldRetry(err) {
3503
+ if (!err) return false;
3504
+ if (this.retryErrorPatterns.length === 0) return true;
3505
+ const errString = util__default["default"].inspect(err);
3506
+ for (const re of this.retryErrorPatterns) {
3507
+ if (errString.match(re)) return true;
3508
+ }
3509
+ return false;
3510
+ }
3511
+ };
3512
+
3510
3513
  const {
3511
3514
  toString,
3512
3515
  quoteRegexpString,
3513
- calculateWer
3516
+ calculateWer: calculateWer$1
3514
3517
  } = helper;
3515
3518
  const _normalize = botresponse => {
3516
3519
  if (lodash__default["default"].isUndefined(botresponse) || lodash__default["default"].isNil(botresponse)) return '';
@@ -3578,7 +3581,7 @@ const wer = () => (botresponse, utterance, args) => {
3578
3581
  botresponse = _normalize(botresponse || '');
3579
3582
  utterance = toString(utterance || '');
3580
3583
  const threshold = [',', '.'].find(p => `${args[0]}`.includes(p)) ? parseFloat(args[0]) : parseInt(args[0]) / 100;
3581
- return calculateWer(botresponse, utterance) <= threshold;
3584
+ return calculateWer$1(botresponse, utterance) <= threshold;
3582
3585
  };
3583
3586
  const getMatchFunction$1 = matchingMode => {
3584
3587
  if (matchingMode === 'regexp' || matchingMode === 'regexpIgnoreCase') {
@@ -5372,6 +5375,10 @@ const {
5372
5375
  const {
5373
5376
  getMatchFunction
5374
5377
  } = MatchFunctions;
5378
+ const {
5379
+ calculateWer,
5380
+ toPercent
5381
+ } = helper;
5375
5382
  const globPattern = '**/+(*.convo.txt|*.utterances.txt|*.pconvo.txt|*.scriptingmemory.txt|*.xlsx|*.xlsm|*.convo.csv|*.pconvo.csv|*.utterances.csv|*.yaml|*.yml|*.json|*.md|*.markdown)';
5376
5383
  const skipPattern = /^skip[.\-_]/i;
5377
5384
  const p = (retryHelper, fn) => {
@@ -5632,29 +5639,51 @@ var ScriptingProvider_1 = class ScriptingProvider {
5632
5639
  const found = lodash__default["default"].find(tomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
5633
5640
  const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
5634
5641
  if (lodash__default["default"].isNil(found)) {
5635
- let message = `${stepTag}: Bot response `;
5636
- message += meMsg ? `(on ${meMsg}) ` : '';
5637
- message += botresponse ? '"' + botresponse + '"' : '<no response>';
5638
- message += ' expected to match ';
5639
- message += tomatch && tomatch.length > 1 ? 'one of ' : '';
5640
- message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5641
- throw new BotiumError$2(message, {
5642
- type: 'asserter',
5643
- source: asserterType,
5644
- params: {
5645
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5646
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5647
- },
5648
- context: {
5649
- stepTag
5650
- },
5651
- cause: {
5652
- expected: tomatch,
5653
- actual: botresponse,
5654
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5655
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5656
- }
5657
- });
5642
+ if (this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer') {
5643
+ const wer = calculateWer(botresponse, tomatch[0]);
5644
+ const werArgs = this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS];
5645
+ const threshold = [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5646
+ const message = `${stepTag}: Word Error Rate (${toPercent(wer)}) higher than accepted (${toPercent(threshold)})`;
5647
+ throw new BotiumError$2(message, {
5648
+ type: 'asserter',
5649
+ source: asserterType,
5650
+ params: {
5651
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5652
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5653
+ },
5654
+ context: {
5655
+ stepTag
5656
+ },
5657
+ cause: {
5658
+ expected: `<=${toPercent(threshold)} (${tomatch})`,
5659
+ actual: `${toPercent(wer)} (${botresponse})`
5660
+ }
5661
+ });
5662
+ } else {
5663
+ let message = `${stepTag}: Bot response `;
5664
+ message += meMsg ? `(on ${meMsg}) ` : '';
5665
+ message += botresponse ? '"' + botresponse + '"' : '<no response>';
5666
+ message += ' expected to match ';
5667
+ message += tomatch && tomatch.length > 1 ? 'one of ' : '';
5668
+ message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5669
+ throw new BotiumError$2(message, {
5670
+ type: 'asserter',
5671
+ source: asserterType,
5672
+ params: {
5673
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5674
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5675
+ },
5676
+ context: {
5677
+ stepTag
5678
+ },
5679
+ cause: {
5680
+ expected: tomatch,
5681
+ actual: botresponse,
5682
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5683
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5684
+ }
5685
+ });
5686
+ }
5658
5687
  }
5659
5688
  },
5660
5689
  assertBotNotResponse: (botresponse, nottomatch, stepTag, meMsg) => {
@@ -5665,30 +5694,52 @@ var ScriptingProvider_1 = class ScriptingProvider {
5665
5694
  const found = lodash__default["default"].find(nottomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
5666
5695
  const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
5667
5696
  if (!lodash__default["default"].isNil(found)) {
5668
- let message = `${stepTag}: Bot response `;
5669
- message += meMsg ? `(on ${meMsg}) ` : '';
5670
- message += botresponse ? '"' + botresponse + '"' : '<no response>';
5671
- message += ' expected NOT to match ';
5672
- message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
5673
- message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5674
- throw new BotiumError$2(message, {
5675
- type: 'asserter',
5676
- source: asserterType,
5677
- params: {
5678
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5679
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5680
- },
5681
- context: {
5682
- stepTag
5683
- },
5684
- cause: {
5685
- not: true,
5686
- expected: nottomatch,
5687
- actual: botresponse,
5688
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5689
- args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5690
- }
5691
- });
5697
+ if (this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer') {
5698
+ const wer = calculateWer(botresponse, nottomatch[0]);
5699
+ const werArgs = this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS];
5700
+ const threshold = [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5701
+ const message = `${stepTag}: Word Error Rate (${toPercent(wer)}) lower than accepted (${toPercent(threshold)})`;
5702
+ throw new BotiumError$2(message, {
5703
+ type: 'asserter',
5704
+ source: asserterType,
5705
+ params: {
5706
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5707
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5708
+ },
5709
+ context: {
5710
+ stepTag
5711
+ },
5712
+ cause: {
5713
+ expected: `>=${toPercent(threshold)} (${nottomatch})`,
5714
+ actual: `${toPercent(wer)} (${botresponse})`
5715
+ }
5716
+ });
5717
+ } else {
5718
+ let message = `${stepTag}: Bot response `;
5719
+ message += meMsg ? `(on ${meMsg}) ` : '';
5720
+ message += botresponse ? '"' + botresponse + '"' : '<no response>';
5721
+ message += ' expected NOT to match ';
5722
+ message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
5723
+ message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5724
+ throw new BotiumError$2(message, {
5725
+ type: 'asserter',
5726
+ source: asserterType,
5727
+ params: {
5728
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5729
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5730
+ },
5731
+ context: {
5732
+ stepTag
5733
+ },
5734
+ cause: {
5735
+ not: true,
5736
+ expected: nottomatch,
5737
+ actual: botresponse,
5738
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5739
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5740
+ }
5741
+ });
5742
+ }
5692
5743
  }
5693
5744
  },
5694
5745
  fail: null
@@ -6384,10 +6435,16 @@ var ScriptingProvider_1 = class ScriptingProvider {
6384
6435
  convoFilter: null
6385
6436
  }, options);
6386
6437
  const expandedConvos = [];
6438
+ // The globalContext is going to keep the data even if the Object.assign which happening to create the myContext in _expandConvo function
6439
+ const context = {
6440
+ globalContext: {
6441
+ totalConvoCount: 0
6442
+ }
6443
+ };
6387
6444
  debug$9(`ExpandConvos - Using utterances expansion mode: ${this.caps[Capabilities.SCRIPTING_UTTEXPANSION_MODE]}`);
6388
6445
  this.convos.forEach(convo => {
6389
6446
  convo.expandPartialConvos();
6390
- for (const expanded of this._expandConvo(convo, options, {})) {
6447
+ for (const expanded of this._expandConvo(convo, options, context)) {
6391
6448
  expanded.header.assertionCount = this.GetAssertionCount(expanded);
6392
6449
  if (options.justHeader) {
6393
6450
  const ConvoWithOnlyHeader = {
@@ -6403,6 +6460,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6403
6460
  }
6404
6461
  });
6405
6462
  this.convos = expandedConvos;
6463
+ this.totalConvoCount = context.globalContext.totalConvoCount;
6406
6464
  if (!options.justHeader) {
6407
6465
  this._sortConvos();
6408
6466
  } else {
@@ -6414,16 +6472,23 @@ var ScriptingProvider_1 = class ScriptingProvider {
6414
6472
  // drop unwanted convos
6415
6473
  convoFilter: null
6416
6474
  }, options);
6475
+ // The globalContext is going to keep the data even if the Object.assign which happening to create the myContext in _expandConvo function
6476
+ const context = {
6477
+ globalContext: {
6478
+ totalConvoCount: 0
6479
+ }
6480
+ };
6417
6481
  debug$9(`ExpandConvos - Using utterances expansion mode: ${this.caps[Capabilities.SCRIPTING_UTTEXPANSION_MODE]}`);
6418
6482
  // creating a nested generator, calling the other.
6419
6483
  // We hope this.convos does not changes while this iterator is used
6420
6484
  const _convosIterable = function* (options) {
6421
6485
  for (const convo of this.convos) {
6422
6486
  convo.expandPartialConvos();
6423
- yield* this._expandConvo(convo, options, {});
6487
+ yield* this._expandConvo(convo, options, context);
6424
6488
  }
6425
6489
  }.bind(this);
6426
6490
  this.convosIterable = _convosIterable(options);
6491
+ this.totalConvoCount = context.globalContext.totalConvoCount;
6427
6492
  }
6428
6493
 
6429
6494
  /**
@@ -6641,6 +6706,9 @@ var ScriptingProvider_1 = class ScriptingProvider {
6641
6706
  const expanded = Object.assign(lodash__default["default"].cloneDeep(currentConvo), {
6642
6707
  conversation: lodash__default["default"].cloneDeep(convoStepsStack)
6643
6708
  });
6709
+ if (!lodash__default["default"].isNil(lodash__default["default"].get(context, 'globalContext.totalConvoCount'))) {
6710
+ context.globalContext.totalConvoCount++;
6711
+ }
6644
6712
  if (!options.convoFilter || options.convoFilter(expanded)) {
6645
6713
  yield expanded;
6646
6714
  }
@@ -7291,10 +7359,12 @@ var BaseContainer_1 = class BaseContainer {
7291
7359
  }, rimraffed => {
7292
7360
  if (this.caps[Capabilities.CLEANUPTEMPDIR]) {
7293
7361
  debug$7(`Cleanup rimrafing temp dir ${this.tempDirectory}`);
7294
- rimraf__default["default"](this.tempDirectory, err => {
7295
- if (err) debug$7(`Cleanup temp dir ${this.tempDirectory} failed: ${util__default["default"].inspect(err)}`);
7362
+ try {
7363
+ rimraf__default["default"].sync(this.tempDirectory);
7296
7364
  rimraffed();
7297
- });
7365
+ } catch (err) {
7366
+ rimraffed(new Error(`Cleanup temp directory ${this.tempDirectory} failed: ${util__default["default"].inspect(err)}`));
7367
+ }
7298
7368
  } else {
7299
7369
  rimraffed();
7300
7370
  }
@@ -7913,6 +7983,43 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
7913
7983
  }
7914
7984
  debug$4(`current session context: ${util__default["default"].inspect(this.view.context)}`);
7915
7985
  }
7986
+ const _isAnyContextJsonPathMatch = (capName, capNameMatch) => {
7987
+ const jsonPaths = getAllCapValues(capName, this.caps);
7988
+ if (jsonPaths.length > 0) {
7989
+ const jsonPathsMatch = getAllCapValues(capNameMatch, this.caps);
7990
+ for (const [index, jsonPath] of jsonPaths.entries()) {
7991
+ const contextNodes = jsonpath__default["default"].query(this.view.context, jsonPath);
7992
+ if (lodash__default["default"].isArray(contextNodes) && contextNodes.length > 0) {
7993
+ if (jsonPathsMatch[index]) {
7994
+ if (contextNodes[0] === jsonPathsMatch[index]) {
7995
+ return {
7996
+ jsonPath,
7997
+ match: contextNodes[0]
7998
+ };
7999
+ }
8000
+ } else {
8001
+ return {
8002
+ jsonPath
8003
+ };
8004
+ }
8005
+ }
8006
+ }
8007
+ }
8008
+ return null;
8009
+ };
8010
+ const ignoreMatch = _isAnyContextJsonPathMatch(Capabilities.SIMPLEREST_CONTEXT_IGNORE_JSONPATH, Capabilities.SIMPLEREST_CONTEXT_IGNORE_MATCH);
8011
+ if (ignoreMatch) {
8012
+ if (ignoreMatch.match) debug$4(`ignoring response for context match: ${ignoreMatch.jsonPath} = ${ignoreMatch.match}`);else debug$4(`ignoring response for context: ${ignoreMatch.jsonPath}`);
8013
+ return;
8014
+ }
8015
+ const skipMatch = _isAnyContextJsonPathMatch(Capabilities.SIMPLEREST_CONTEXT_SKIP_JSONPATH, Capabilities.SIMPLEREST_CONTEXT_SKIP_MATCH);
8016
+ if (skipMatch) {
8017
+ if (skipMatch.match) debug$4(`skipping response for context match: ${skipMatch.jsonPath} = ${skipMatch.match}`);else debug$4(`skipping response for context: ${skipMatch.jsonPath}`);
8018
+ setTimeout(() => this._doRequest({
8019
+ messageText: ''
8020
+ }, true, true), 0);
8021
+ return;
8022
+ }
7916
8023
  const result = [];
7917
8024
  if (isFromUser) {
7918
8025
  const _extractFrom = (root, jsonPaths) => {
@@ -8061,6 +8168,13 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8061
8168
  }
8062
8169
  }
8063
8170
  }
8171
+ const continueMatch = _isAnyContextJsonPathMatch(Capabilities.SIMPLEREST_CONTEXT_CONTINUE_JSONPATH, Capabilities.SIMPLEREST_CONTEXT_CONTINUE_MATCH);
8172
+ if (continueMatch) {
8173
+ if (continueMatch.match) debug$4(`continue with next response for context match: ${continueMatch.jsonPath} = ${continueMatch.match}`);else debug$4(`continue with next response for context: ${continueMatch.jsonPath}`);
8174
+ setTimeout(() => this._doRequest({
8175
+ messageText: ''
8176
+ }, true, true), 0);
8177
+ }
8064
8178
  return result;
8065
8179
  }
8066
8180
  _doRequest(msg, isFromUser, updateContext) {
@@ -8685,13 +8799,9 @@ const {
8685
8799
  var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseContainer_1 {
8686
8800
  async Validate() {
8687
8801
  await super.Validate();
8688
- const setAsync = isAsync => {
8689
- this.caps.RETRY_CONVO_ASYNC = isAsync;
8690
- };
8691
8802
  this.pluginInstance = tryLoadPlugin(this.caps[Capabilities.CONTAINERMODE], this.caps[Capabilities.PLUGINMODULEPATH], {
8692
8803
  container: this,
8693
8804
  queueBotSays: msg => this._QueueBotSays(msg),
8694
- setAsync: isAsync => setAsync(isAsync),
8695
8805
  bottleneck: this.bottleneck,
8696
8806
  eventEmitter: this.eventEmitter,
8697
8807
  caps: this.caps,
@@ -8822,15 +8932,18 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
8822
8932
  }
8823
8933
  };
8824
8934
 
8825
- var require$$2 = getCjsExportFromNamespace(_package$1);
8935
+ var require$$3 = getCjsExportFromNamespace(_package$1);
8826
8936
 
8937
+ const {
8938
+ rimraf
8939
+ } = rimraf__default["default"];
8827
8940
  const {
8828
8941
  boolean
8829
8942
  } = boolean__default["default"];
8830
8943
  const debug$1 = debug__default["default"]('botium-core-BotDriver');
8831
8944
  const {
8832
8945
  version
8833
- } = require$$2;
8946
+ } = require$$3;
8834
8947
  var BotDriver_1 = class BotDriver {
8835
8948
  constructor(caps = {}, sources = {}, envs = {}) {
8836
8949
  this.eventEmitter = new events__default["default"]();
@@ -8948,9 +9061,7 @@ var BotDriver_1 = class BotDriver {
8948
9061
  debug$1(`BotDriver Build error: ${err}`);
8949
9062
  this.eventEmitter.emit(Events.CONTAINER_BUILD_ERROR, err);
8950
9063
  if (tempDirectory) {
8951
- rimraf__default["default"](tempDirectory, err => {
8952
- if (err) debug$1(`Cleanup temp dir ${tempDirectory} failed: ${util__default["default"].inspect(err)}`);
8953
- });
9064
+ rimraf(tempDirectory).catch(err => debug$1(`Cleanup temp dir ${tempDirectory} failed: ${util__default["default"].inspect(err)}`));
8954
9065
  }
8955
9066
  return reject(err);
8956
9067
  }