botium-core 1.14.3 → 1.14.4

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
@@ -10,7 +10,7 @@ import randomatic from 'randomatic';
10
10
  import lodash from 'lodash';
11
11
  import boolean$1 from 'boolean';
12
12
  import events from 'events';
13
- import debug$n from 'debug';
13
+ import debug$o from 'debug';
14
14
  import isClass from 'is-class';
15
15
  import crypto from 'crypto';
16
16
  import globby from 'globby';
@@ -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.3";
38
+ var version$1 = "1.14.4";
39
39
  var description = "The Selenium for Chatbots";
40
40
  var main = "index.js";
41
41
  var module = "dist/botium-es.js";
@@ -1062,7 +1062,7 @@ LogicHookConsts.DEFAULT_LOGIC_HOOKS;
1062
1062
  LogicHookConsts.DEFAULT_USER_INPUTS;
1063
1063
  LogicHookConsts.LOGIC_HOOK_EVENTS;
1064
1064
 
1065
- const debug$m = debug$n('botium-core-asserterUtils');
1065
+ const debug$n = debug$o('botium-core-asserterUtils');
1066
1066
  const {
1067
1067
  DEFAULT_ASSERTERS,
1068
1068
  DEFAULT_LOGIC_HOOKS,
@@ -1114,7 +1114,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
1114
1114
  _fetchAsserters() {
1115
1115
  this.caps[Capabilities.ASSERTERS].forEach(asserter => {
1116
1116
  if (this.asserters[asserter.ref]) {
1117
- debug$m(`${asserter.ref} asserter already exists, overwriting.`);
1117
+ debug$n(`${asserter.ref} asserter already exists, overwriting.`);
1118
1118
  }
1119
1119
  this.asserters[asserter.ref] = this._loadClass(asserter, 'asserter');
1120
1120
  if (asserter.global) {
@@ -1125,7 +1125,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
1125
1125
  _fetchLogicHooks() {
1126
1126
  this.caps[Capabilities.LOGIC_HOOKS].forEach(logicHook => {
1127
1127
  if (this.logicHooks[logicHook.ref]) {
1128
- debug$m(`${logicHook.ref} logic hook already exists, overwriting.`);
1128
+ debug$n(`${logicHook.ref} logic hook already exists, overwriting.`);
1129
1129
  }
1130
1130
  this.logicHooks[logicHook.ref] = this._loadClass(logicHook, 'logichook');
1131
1131
  if (logicHook.global) {
@@ -1136,7 +1136,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
1136
1136
  _fetchUserInputs() {
1137
1137
  this.caps[Capabilities.USER_INPUTS].forEach(userInput => {
1138
1138
  if (this.userInputs[userInput.ref]) {
1139
- debug$m(`${userInput.ref} userinput already exists, overwriting.`);
1139
+ debug$n(`${userInput.ref} userinput already exists, overwriting.`);
1140
1140
  }
1141
1141
  this.userInputs[userInput.ref] = this._loadClass(userInput, 'userinput');
1142
1142
  });
@@ -1322,7 +1322,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
1322
1322
  }
1323
1323
  }
1324
1324
  }
1325
- loadErr.forEach(debug$m);
1325
+ loadErr.forEach(debug$n);
1326
1326
  }
1327
1327
  throw new Error(`${typeAsText} specification ${ref} ${hookType} from "${util.inspect(src)}" invalid : no loader available`);
1328
1328
  }
@@ -1533,10 +1533,11 @@ var Enums = {
1533
1533
  };
1534
1534
  Enums.E_SCRIPTING_MEMORY_COLUMN_MODE;
1535
1535
 
1536
- const debug$l = debug$n('botium-core-scripting-helper');
1536
+ const debug$m = debug$o('botium-core-scripting-helper');
1537
1537
  const {
1538
1538
  E_SCRIPTING_MEMORY_COLUMN_MODE: E_SCRIPTING_MEMORY_COLUMN_MODE$1
1539
1539
  } = Enums;
1540
+ const WHITE_SPACES_EXCEPT_SPACE_CHAR_AT_THE_END = /[\n\t\r]+$/;
1540
1541
  const normalizeText$1 = (str, doCleanup) => {
1541
1542
  if (str && lodash.isArray(str)) {
1542
1543
  str = str.join(' ');
@@ -1778,7 +1779,7 @@ const linesToConvoStep$5 = (lines, sender, context, eol, singleLineMode = false)
1778
1779
  if (eol === null) {
1779
1780
  throw new Error('eol cant be null');
1780
1781
  }
1781
- convoStep.messageText = textLines.join(eol).trim();
1782
+ convoStep.messageText = textLines.join(eol).replace(WHITE_SPACES_EXCEPT_SPACE_CHAR_AT_THE_END, '');
1782
1783
  }
1783
1784
  }
1784
1785
  } else {
@@ -1995,7 +1996,7 @@ const convoStepToLines$2 = step => {
1995
1996
  lines.push(logicHook.name + _formatAppendArgs(logicHook.args));
1996
1997
  });
1997
1998
  }
1998
- return lines.map(l => l.trim());
1999
+ return lines;
1999
2000
  };
2000
2001
  const linesToScriptingMemories$2 = (lines, columnMode = null) => {
2001
2002
  const guessScriptingMemoryColumnMode = lines => {
@@ -2109,7 +2110,7 @@ const calculateWer$2 = (str, pattern) => {
2109
2110
  errCount += err.filter(err => err === true).length;
2110
2111
  allCount += err.length;
2111
2112
  }
2112
- debug$l(`Word Error Rate Asserter - Compared Bot Message '${botMessage}' / '${utt}': ${(errCount / allCount).toFixed(2)}`);
2113
+ debug$m(`Word Error Rate Asserter - Compared Bot Message '${botMessage}' / '${utt}': ${(errCount / allCount).toFixed(2)}`);
2113
2114
  return (errCount / allCount).toFixed(2);
2114
2115
  };
2115
2116
  const toPercent$1 = s => `${(s * 100).toFixed(0)}%`;
@@ -2307,7 +2308,7 @@ var BotiumError_1 = {
2307
2308
  botiumErrorFromList: botiumErrorFromList$2
2308
2309
  };
2309
2310
 
2310
- const debug$k = debug$n('botium-core-ScriptingMemory');
2311
+ const debug$l = debug$o('botium-core-ScriptingMemory');
2311
2312
  const {
2312
2313
  v1: uuidv1
2313
2314
  } = uuid;
@@ -2567,7 +2568,7 @@ const extractVarNames = text => {
2567
2568
  return (lodash.isString(text) ? text.match(/\$[A-Za-z]\w+/g) : false) || [];
2568
2569
  };
2569
2570
  const fill = (container, scriptingMemory, result, utterance, scriptingEvents) => {
2570
- debug$k(`fill start: ${util.inspect(scriptingMemory)}`);
2571
+ debug$l(`fill start: ${util.inspect(scriptingMemory)}`);
2571
2572
  let varRegex;
2572
2573
  switch (container.caps[Capabilities.SCRIPTING_MEMORY_MATCHING_MODE]) {
2573
2574
  case 'word':
@@ -2601,14 +2602,14 @@ const fill = (container, scriptingMemory, result, utterance, scriptingEvents) =>
2601
2602
  if (i <= varMatches.length) {
2602
2603
  const varName = varMatches[i - 1];
2603
2604
  if (RESERVED_WORDS.indexOf(varName) >= 0) {
2604
- debug$k(`fill Variable "${varName}" is not overwritten, because it is reserved word. `);
2605
+ debug$l(`fill Variable "${varName}" is not overwritten, because it is reserved word. `);
2605
2606
  } else {
2606
2607
  scriptingMemory[varName] = resultMatches[i];
2607
2608
  }
2608
2609
  }
2609
2610
  }
2610
2611
  });
2611
- debug$k(`fill end: ${util.inspect(scriptingMemory)}`);
2612
+ debug$l(`fill end: ${util.inspect(scriptingMemory)}`);
2612
2613
  }
2613
2614
  };
2614
2615
  var ScriptingMemory = {
@@ -2626,7 +2627,7 @@ ScriptingMemory.extractVarNames;
2626
2627
  ScriptingMemory.RESERVED_WORDS;
2627
2628
  ScriptingMemory.SCRIPTING_FUNCTIONS;
2628
2629
 
2629
- const debug$j = debug$n('botium-core-Convo');
2630
+ const debug$k = debug$o('botium-core-Convo');
2630
2631
  const {
2631
2632
  BotiumError: BotiumError$2,
2632
2633
  botiumErrorFromErr: botiumErrorFromErr$1,
@@ -2780,10 +2781,10 @@ class TranscriptError extends Error {
2780
2781
  class Convo$6 {
2781
2782
  constructor(context, fromJson = {}) {
2782
2783
  if (fromJson instanceof Convo$6) {
2783
- debug$j('Illegal state!!! Parameter should be a JSON, but it is a Convo');
2784
+ debug$k('Illegal state!!! Parameter should be a JSON, but it is a Convo');
2784
2785
  } else if (fromJson.beginAsserter) {
2785
2786
  // beginAsserter is one of the fields which are lost
2786
- debug$j('Illegal state!!! Parameter should be a native JSON, but looks as a Convo converted to JSON');
2787
+ debug$k('Illegal state!!! Parameter should be a native JSON, but looks as a Convo converted to JSON');
2787
2788
  }
2788
2789
  this.scriptingEvents = context.scriptingEvents;
2789
2790
  this.context = context;
@@ -2947,7 +2948,7 @@ class Convo$6 {
2947
2948
  try {
2948
2949
  params = JSON.parse(rawConvoStepParameters[0]);
2949
2950
  } catch (e) {
2950
- debug$j(`${this.header.name}/${convoStep.stepTag}: Failed to parse convo step parameters from JSON ${rawConvoStepParameters[0]}`);
2951
+ debug$k(`${this.header.name}/${convoStep.stepTag}: Failed to parse convo step parameters from JSON ${rawConvoStepParameters[0]}`);
2951
2952
  }
2952
2953
  }
2953
2954
  if (!params || !Object.keys(params).length) {
@@ -2960,7 +2961,7 @@ class Convo$6 {
2960
2961
  const value = param.substring(semicolon + 1);
2961
2962
  params[name] = value;
2962
2963
  } catch (e) {
2963
- debug$j(`${this.header.name}/${convoStep.stepTag}: Failed to parse convo step parameter from arg ${param}`);
2964
+ debug$k(`${this.header.name}/${convoStep.stepTag}: Failed to parse convo step parameter from arg ${param}`);
2964
2965
  }
2965
2966
  }
2966
2967
  }
@@ -2976,7 +2977,7 @@ class Convo$6 {
2976
2977
  }
2977
2978
  }
2978
2979
  if (Object.keys(convoStepParameters).length) {
2979
- debug$j(`${this.header.name}: using convo step parameters ${JSON.stringify(convoStepParameters)}`);
2980
+ debug$k(`${this.header.name}: using convo step parameters ${JSON.stringify(convoStepParameters)}`);
2980
2981
  }
2981
2982
  const currentStepIndex = i;
2982
2983
  container.eventEmitter.emit(Events.CONVO_STEP_NEXT, container, convoStep, i);
@@ -3039,7 +3040,7 @@ class Convo$6 {
3039
3040
  });
3040
3041
  await this._checkBotRepliesConsumed(container);
3041
3042
  const coreMsg = lodash.omit(removeBuffers(meMsg), ['sourceData']);
3042
- debug$j(`${this.header.name}/${convoStep.stepTag}: user says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3043
+ debug$k(`${this.header.name}/${convoStep.stepTag}: user says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3043
3044
  await new Promise(resolve => {
3044
3045
  if (container.caps[Capabilities.SIMULATE_WRITING_SPEED] && meMsg.messageText && meMsg.messageText.length) {
3045
3046
  setTimeout(() => resolve(), container.caps[Capabilities.SIMULATE_WRITING_SPEED] * meMsg.messageText.length);
@@ -3075,7 +3076,7 @@ class Convo$6 {
3075
3076
  });
3076
3077
  continue;
3077
3078
  } else {
3078
- debug$j(`${this.header.name}/${convoStep.stepTag}: message not found in #me section, message not sent to container ${util.inspect(convoStep)}`);
3079
+ debug$k(`${this.header.name}/${convoStep.stepTag}: message not found in #me section, message not sent to container ${util.inspect(convoStep)}`);
3079
3080
  transcriptStep.botEnd = new Date();
3080
3081
  await this.scriptingEvents.onMeEnd({
3081
3082
  convo: this,
@@ -3091,7 +3092,7 @@ class Convo$6 {
3091
3092
  } catch (err) {
3092
3093
  transcriptStep.botEnd = new Date();
3093
3094
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: error sending to bot - ${err.message || err}`, err);
3094
- debug$j(failErr);
3095
+ debug$k(failErr);
3095
3096
  try {
3096
3097
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr);
3097
3098
  } catch (failErr) {}
@@ -3104,7 +3105,7 @@ class Convo$6 {
3104
3105
  waitForBotSays = true;
3105
3106
  }
3106
3107
  try {
3107
- debug$j(`${this.header.name} wait for bot ${convoStep.channel || ''}`);
3108
+ debug$k(`${this.header.name} wait for bot ${convoStep.channel || ''}`);
3108
3109
  await this.scriptingEvents.onBotStart({
3109
3110
  convo: this,
3110
3111
  convoStep,
@@ -3120,11 +3121,11 @@ class Convo$6 {
3120
3121
  transcriptStep.botEnd = new Date();
3121
3122
  transcriptStep.actual = new BotiumMockMessage_1(botMsg);
3122
3123
  const coreMsg = lodash.omit(removeBuffers(botMsg), ['sourceData']);
3123
- debug$j(`${this.header.name}: bot says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3124
+ debug$k(`${this.header.name}: bot says (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3124
3125
  } catch (err) {
3125
3126
  transcriptStep.botEnd = new Date();
3126
3127
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: error waiting for bot - ${err.message}`, err);
3127
- debug$j(failErr);
3128
+ debug$k(failErr);
3128
3129
  try {
3129
3130
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3130
3131
  } catch (failErr) {}
@@ -3143,11 +3144,11 @@ class Convo$6 {
3143
3144
  if (prepared) {
3144
3145
  transcriptStep.actual = new BotiumMockMessage_1(botMsg);
3145
3146
  const coreMsg = lodash.omit(removeBuffers(botMsg), ['sourceData']);
3146
- debug$j(`${this.header.name}: onBotPrepare (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3147
+ debug$k(`${this.header.name}: onBotPrepare (cleaned by binary and base64 data and sourceData) ${JSON.stringify(coreMsg, null, 2)}`);
3147
3148
  }
3148
3149
  } catch (err) {
3149
3150
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: onBotPrepare error - ${err.message || err}`, err);
3150
- debug$j(failErr);
3151
+ debug$k(failErr);
3151
3152
  try {
3152
3153
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3153
3154
  } catch (failErr) {}
@@ -3168,7 +3169,7 @@ class Convo$6 {
3168
3169
  skipTranscriptStep = true;
3169
3170
  if (endOfConditionalGroup && !conditionMetInGroup && !convoStep.optional) {
3170
3171
  const failErr = new BotiumError$2(`${this.header.name}/${convoStep.stepTag}: Non of the conditions are met in ${conditionalGroupId ? `'${conditionalGroupId}' ` : ''}condition group`);
3171
- debug$j(failErr);
3172
+ debug$k(failErr);
3172
3173
  throw failErr;
3173
3174
  }
3174
3175
  if (endOfConditionalGroup) {
@@ -3188,7 +3189,7 @@ class Convo$6 {
3188
3189
  }
3189
3190
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
3190
3191
  const failErr = new BotiumError$2(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
3191
- debug$j(failErr);
3192
+ debug$k(failErr);
3192
3193
  try {
3193
3194
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3194
3195
  } catch (failErr) {}
@@ -3200,7 +3201,7 @@ class Convo$6 {
3200
3201
  const retryOn = convoStep.sender === 'bot' && retryConfig && retryConfig.timeout && retryConfig.mainAsserter;
3201
3202
  if (convoStep.optional && nextConvoStep && nextConvoStep.sender === 'bot') {
3202
3203
  if (retryOn) {
3203
- debug$j(`${this.header.name}/${convoStep.stepTag}: Retry failed asserter is ignored on optional convo`);
3204
+ debug$k(`${this.header.name}/${convoStep.stepTag}: Retry failed asserter is ignored on optional convo`);
3204
3205
  }
3205
3206
  waitForBotSays = false;
3206
3207
  skipTranscriptStep = true;
@@ -3213,11 +3214,11 @@ class Convo$6 {
3213
3214
  const now = new Date().getTime();
3214
3215
  const timeoutRemaining = retryBotMessageTimeoutEnd - now;
3215
3216
  if (timeoutRemaining > 0) {
3216
- debug$j(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, timeout remaining: ${timeoutRemaining}, error: "${err.message}"`);
3217
+ debug$k(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, timeout remaining: ${timeoutRemaining}, error: "${err.message}"`);
3217
3218
  retryBotMessageDropBotResponse = true;
3218
3219
  return false;
3219
3220
  } else {
3220
- debug$j(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, but timeout is over. error: "${err.message}"`);
3221
+ debug$k(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, but timeout is over. error: "${err.message}"`);
3221
3222
  }
3222
3223
  }
3223
3224
  if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS]) {
@@ -3301,14 +3302,14 @@ class Convo$6 {
3301
3302
  const now = new Date().getTime();
3302
3303
  const timeoutRemaining = retryOn && retryBotMessageTimeoutEnd - now;
3303
3304
  if (retryOn && timeoutRemaining > 0) {
3304
- debug$j(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, timeout remaining: ${timeoutRemaining}, error: "${err.message}"`);
3305
+ debug$k(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, timeout remaining: ${timeoutRemaining}, error: "${err.message}"`);
3305
3306
  retryBotMessageDropBotResponse = true;
3306
3307
  } else {
3307
3308
  if (retryOn && timeoutRemaining <= 0) {
3308
- debug$j(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, but timeout is over. error: "${err.message}"`);
3309
+ debug$k(`${this.header.name}/${convoStep.stepTag}: Convo step retry on, but timeout is over. error: "${err.message}"`);
3309
3310
  }
3310
3311
  const failErr = botiumErrorFromErr$1(`${this.header.name}/${convoStep.stepTag}: assertion error - ${err.message || err}`, err);
3311
- debug$j(failErr);
3312
+ debug$k(failErr);
3312
3313
  try {
3313
3314
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3314
3315
  } catch (failErr) {}
@@ -3332,7 +3333,7 @@ class Convo$6 {
3332
3333
  }
3333
3334
  } else {
3334
3335
  const failErr = new BotiumError$2(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util.inspect(convoStep.sender)}`);
3335
- debug$j(failErr);
3336
+ debug$k(failErr);
3336
3337
  try {
3337
3338
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr);
3338
3339
  } catch (failErr) {}
@@ -3538,7 +3539,7 @@ class Convo$6 {
3538
3539
  throw new BotiumError$2(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
3539
3540
  }
3540
3541
  _getEffectiveConversationRecursive(partialConvo.conversation, [...parentPConvos, includeLogicHook], result, true);
3541
- debug$j(`Partial convo ${includeLogicHook} included`);
3542
+ debug$k(`Partial convo ${includeLogicHook} included`);
3542
3543
  });
3543
3544
  });
3544
3545
  return result;
@@ -3559,7 +3560,7 @@ var Convo_1 = {
3559
3560
  TranscriptError
3560
3561
  };
3561
3562
 
3562
- const debug$i = debug$n('botium-core-RetryHelper');
3563
+ const debug$j = debug$o('botium-core-RetryHelper');
3563
3564
  var RetryHelper_1 = class RetryHelper {
3564
3565
  constructor(caps, section, options = {}) {
3565
3566
  this.retryErrorPatterns = [];
@@ -3583,7 +3584,7 @@ var RetryHelper_1 = class RetryHelper {
3583
3584
  minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (lodash.isNil(options.minTimeout) ? 1000 : options.minTimeout)
3584
3585
  };
3585
3586
  if (this.retrySettings.retries > 0) {
3586
- debug$i(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
3587
+ debug$j(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
3587
3588
  }
3588
3589
  }
3589
3590
  shouldRetry(err) {
@@ -3597,26 +3598,36 @@ var RetryHelper_1 = class RetryHelper {
3597
3598
  }
3598
3599
  };
3599
3600
 
3601
+ const debug$i = debug$o('botium-core-MatchFunctions');
3600
3602
  const {
3601
3603
  toString,
3602
3604
  quoteRegexpString,
3603
3605
  calculateWer: calculateWer$1
3604
3606
  } = helper;
3605
- const _normalize = botresponse => {
3607
+ const _normalize = (botresponse, args, convoStepParameters) => {
3608
+ if (!convoStepParameters) {
3609
+ debug$i('Convo step parameters might be missing!');
3610
+ }
3606
3611
  if (lodash.isUndefined(botresponse) || lodash.isNil(botresponse)) return '';
3607
3612
  if (lodash.isObject(botresponse) && lodash.has(botresponse, 'messageText')) {
3608
3613
  return toString(botresponse.messageText) || '';
3609
3614
  }
3610
3615
  return toString(botresponse);
3611
3616
  };
3612
- const regexp = ignoreCase => (botresponse, utterance) => {
3617
+ const regexp = ignoreCase => (botresponse, utterance, args, convoStepParameters) => {
3618
+ if (!convoStepParameters) {
3619
+ debug$i('Convo step parameters might be missing!');
3620
+ }
3613
3621
  if (lodash.isUndefined(botresponse)) return false;
3614
3622
  utterance = toString(utterance);
3615
3623
  botresponse = _normalize(botresponse);
3616
3624
  const regexp = ignoreCase ? new RegExp(utterance, 'i') : new RegExp(utterance, '');
3617
3625
  return regexp.test(botresponse);
3618
3626
  };
3619
- const wildcard = ignoreCase => (botresponse, utterance) => {
3627
+ const wildcard = ignoreCase => (botresponse, utterance, args, convoStepParameters) => {
3628
+ if (!convoStepParameters) {
3629
+ debug$i('Convo step parameters might be missing!');
3630
+ }
3620
3631
  if (lodash.isUndefined(botresponse)) {
3621
3632
  if (utterance.trim() === '*') return true;else return false;
3622
3633
  }
@@ -3630,7 +3641,10 @@ const wildcard = ignoreCase => (botresponse, utterance) => {
3630
3641
  const regexp = ignoreCase ? new RegExp(utteranceRe, 'i') : new RegExp(utteranceRe, '');
3631
3642
  return regexp.test(botresponse);
3632
3643
  };
3633
- const wildcardExact = ignoreCase => (botresponse, utterance) => {
3644
+ const wildcardExact = ignoreCase => (botresponse, utterance, args, convoStepParameters) => {
3645
+ if (!convoStepParameters) {
3646
+ debug$i('Convo step parameters might be missing!');
3647
+ }
3634
3648
  if (lodash.isUndefined(botresponse)) {
3635
3649
  if (utterance.trim() === '*') return true;else return false;
3636
3650
  }
@@ -3644,7 +3658,10 @@ const wildcardExact = ignoreCase => (botresponse, utterance) => {
3644
3658
  const regexp = ignoreCase ? new RegExp(utteranceRe, 'i') : new RegExp(utteranceRe, '');
3645
3659
  return regexp.test(botresponse);
3646
3660
  };
3647
- const include = ignoreCase => (botresponse, utterance) => {
3661
+ const include = ignoreCase => (botresponse, utterance, args, convoStepParameters) => {
3662
+ if (!convoStepParameters) {
3663
+ debug$i('Convo step parameters might be missing!');
3664
+ }
3648
3665
  if (lodash.isUndefined(botresponse)) return false;
3649
3666
  utterance = toString(utterance);
3650
3667
  botresponse = _normalize(botresponse);
@@ -3654,7 +3671,10 @@ const include = ignoreCase => (botresponse, utterance) => {
3654
3671
  }
3655
3672
  return botresponse.indexOf(utterance) >= 0;
3656
3673
  };
3657
- const equals = ignoreCase => (botresponse, utterance) => {
3674
+ const equals = ignoreCase => (botresponse, utterance, args, convoStepParameters) => {
3675
+ if (!convoStepParameters) {
3676
+ debug$i('Convo step parameters might be missing!');
3677
+ }
3658
3678
  if (lodash.isUndefined(botresponse)) return false;
3659
3679
  utterance = toString(utterance);
3660
3680
  botresponse = _normalize(botresponse);
@@ -3664,10 +3684,13 @@ const equals = ignoreCase => (botresponse, utterance) => {
3664
3684
  }
3665
3685
  return botresponse === utterance;
3666
3686
  };
3667
- const wer = () => (botresponse, utterance, args) => {
3687
+ const wer = () => (botresponse, utterance, args, convoStepParameters) => {
3688
+ if (!convoStepParameters) {
3689
+ debug$i('Convo step parameters might be missing!');
3690
+ }
3668
3691
  botresponse = _normalize(botresponse || '');
3669
3692
  utterance = toString(utterance || '');
3670
- const threshold = [',', '.'].find(p => `${args[0]}`.includes(p)) ? parseFloat(args[0]) : parseInt(args[0]) / 100;
3693
+ const threshold = !lodash.isNil(convoStepParameters?.matchingModeWer) ? convoStepParameters?.matchingModeWer / 100 : [',', '.'].find(p => `${args[0]}`.includes(p)) ? parseFloat(args[0]) : parseInt(args[0]) / 100;
3671
3694
  return calculateWer$1(botresponse, utterance) <= threshold;
3672
3695
  };
3673
3696
  const getMatchFunction$1 = matchingMode => {
@@ -3870,7 +3893,7 @@ var JsonToJson = {
3870
3893
  precompile: precompile$2
3871
3894
  };
3872
3895
 
3873
- const debug$h = debug$n('botium-core-HookUtils');
3896
+ const debug$h = debug$o('botium-core-HookUtils');
3874
3897
  const executeHook$2 = async (caps, hook, ...args) => {
3875
3898
  return executeHookSync$1(caps, hook, ...args);
3876
3899
  };
@@ -3970,7 +3993,7 @@ var Script = {
3970
3993
  precompile: precompile$1
3971
3994
  };
3972
3995
 
3973
- const debug$g = debug$n('botium-core-PrecompilerMarkdownRasa');
3996
+ const debug$g = debug$o('botium-core-PrecompilerMarkdownRasa');
3974
3997
  const htmlCommentRegexp = /(<!--.*?-->)/g;
3975
3998
  var precompile = (caps, scriptBuffer, options, filename) => {
3976
3999
  if (!filename.endsWith('.md')) {
@@ -4071,7 +4094,7 @@ var MarkdownRasa = {
4071
4094
  precompile: precompile
4072
4095
  };
4073
4096
 
4074
- const debug$f = debug$n('botium-core-CapabilitiesUtils');
4097
+ const debug$f = debug$o('botium-core-CapabilitiesUtils');
4075
4098
  const {
4076
4099
  toJsonWeak
4077
4100
  } = Utils;
@@ -4162,7 +4185,7 @@ var CapabilitiesUtils = {
4162
4185
  flatCababilities: flatCababilities$1
4163
4186
  };
4164
4187
 
4165
- const debug$e = debug$n('botium-core-Precompilers');
4188
+ const debug$e = debug$o('botium-core-Precompilers');
4166
4189
  const {
4167
4190
  isJsonObject
4168
4191
  } = Utils;
@@ -4289,7 +4312,7 @@ var Utterance_1 = class Utterance {
4289
4312
  }
4290
4313
  };
4291
4314
 
4292
- const debug$d = debug$n('botium-core-CompilerXlsx');
4315
+ const debug$d = debug$o('botium-core-CompilerXlsx');
4293
4316
  const {
4294
4317
  E_SCRIPTING_MEMORY_COLUMN_MODE
4295
4318
  } = Enums;
@@ -4826,7 +4849,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4826
4849
  Compile(scriptBuffer, scriptType = Constants.SCRIPTING_TYPE_CONVO) {
4827
4850
  let scriptData = scriptBuffer;
4828
4851
  if (Buffer.isBuffer(scriptBuffer)) scriptData = scriptData.toString();
4829
- const lines = lodash.map(scriptData.split(this.eol), line => line.trim());
4852
+ const lines = scriptData.split(this.eol);
4830
4853
  if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
4831
4854
  return this._compileConvo(lines, false);
4832
4855
  } else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
@@ -4876,7 +4899,6 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4876
4899
  };
4877
4900
  lines.forEach(line => {
4878
4901
  currentLineIndex++;
4879
- line = line.trim();
4880
4902
  if (isValidTagLine(line)) {
4881
4903
  pushPrev();
4882
4904
  convoStepSender = line.substr(1).trim();
@@ -4952,7 +4974,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4952
4974
  const {
4953
4975
  parse
4954
4976
  } = sync;
4955
- const debug$c = debug$n('botium-core-CompilerCsv');
4977
+ const debug$c = debug$o('botium-core-CompilerCsv');
4956
4978
  const {
4957
4979
  Convo: Convo$3
4958
4980
  } = Convo_1;
@@ -5163,7 +5185,7 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
5163
5185
  }
5164
5186
  };
5165
5187
 
5166
- const debug$b = debug$n('botium-core-CompilerObject');
5188
+ const debug$b = debug$o('botium-core-CompilerObject');
5167
5189
  const {
5168
5190
  Convo: Convo$2
5169
5191
  } = Convo_1;
@@ -5309,7 +5331,7 @@ var CompilerJson_1 = class CompilerJson extends CompilerObjectBase_1 {
5309
5331
  }
5310
5332
  };
5311
5333
 
5312
- const debug$a = debug$n('botium-core-CompilerMarkdown');
5334
+ const debug$a = debug$o('botium-core-CompilerMarkdown');
5313
5335
  const md = new markdownIt();
5314
5336
  const {
5315
5337
  Convo: Convo$1
@@ -5388,7 +5410,7 @@ var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
5388
5410
  conversation.push(Object.assign({
5389
5411
  sender,
5390
5412
  stepTag: 'Line ' + (step.map[0] + 1)
5391
- }, linesToConvoStep(step.children.map(child => child.content + (child.children ? ' ' + child.children.map(child => child.content).join('|') : '')), sender, this.context, this.eol)));
5413
+ }, linesToConvoStep(step.children.map(child => child.content + (child.children && child.children.length > 0 ? ' ' + child.children.map(child => child.content).join('|') : '')), sender, this.context, this.eol)));
5392
5414
  } else {
5393
5415
  debug$a(`Expected sender ${validSenders.map(s => `'${s}'`).join(' or ')} but found ${sender}`);
5394
5416
  }
@@ -5420,7 +5442,7 @@ var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
5420
5442
  };
5421
5443
 
5422
5444
  promise.shim();
5423
- const debug$9 = debug$n('botium-core-ScriptingProvider');
5445
+ const debug$9 = debug$o('botium-core-ScriptingProvider');
5424
5446
  const {
5425
5447
  Convo,
5426
5448
  ConvoStep
@@ -5689,25 +5711,26 @@ var ScriptingProvider_1 = class ScriptingProvider {
5689
5711
  resolveEmptyIfUnknown
5690
5712
  });
5691
5713
  },
5692
- assertBotResponse: (botresponse, tomatch, stepTag, meMsg, convoStepParameters) => {
5714
+ assertBotResponse: (botresponse, tomatch, stepTag, meMsg, convoStepParameters = {}) => {
5693
5715
  if (!lodash.isArray(tomatch)) {
5694
5716
  tomatch = [tomatch];
5695
5717
  }
5696
5718
  debug$9(`assertBotResponse ${stepTag} ${meMsg ? `(${meMsg}) ` : ''}BOT: ${botresponse} = ${tomatch} ...`);
5697
5719
  const matchFn = convoStepParameters.matchingMode ? getMatchFunction(convoStepParameters.matchingMode) || this.matchFn : this.matchFn;
5698
- const found = lodash.find(tomatch, utt => matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
5720
+ const found = lodash.find(tomatch, utt => matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS], convoStepParameters));
5699
5721
  const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
5700
5722
  if (lodash.isNil(found)) {
5701
- if (this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer') {
5723
+ const matchingMode = convoStepParameters.matchingMode || this.caps[Capabilities.SCRIPTING_MATCHING_MODE];
5724
+ if (matchingMode === 'wer') {
5702
5725
  const wer = calculateWer(botresponse, tomatch[0]);
5703
5726
  const werArgs = this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS];
5704
- const threshold = [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5727
+ const threshold = !lodash.isNil(convoStepParameters.matchingModeWer) ? convoStepParameters.matchingModeWer / 100 : [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5705
5728
  const message = `${stepTag}: Word Error Rate (${toPercent(wer)}) higher than accepted (${toPercent(threshold)})`;
5706
5729
  throw new BotiumError$1(message, {
5707
5730
  type: 'asserter',
5708
5731
  source: asserterType,
5709
5732
  params: {
5710
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5733
+ matchingMode,
5711
5734
  args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5712
5735
  },
5713
5736
  context: {
@@ -5745,25 +5768,26 @@ var ScriptingProvider_1 = class ScriptingProvider {
5745
5768
  }
5746
5769
  }
5747
5770
  },
5748
- assertBotNotResponse: (botresponse, nottomatch, stepTag, meMsg, convoStepParameters) => {
5771
+ assertBotNotResponse: (botresponse, nottomatch, stepTag, meMsg, convoStepParameters = {}) => {
5749
5772
  if (!lodash.isArray(nottomatch)) {
5750
5773
  nottomatch = [nottomatch];
5751
5774
  }
5752
5775
  debug$9(`assertBotNotResponse ${stepTag} ${meMsg ? `(${meMsg}) ` : ''}BOT: ${botresponse} != ${nottomatch} ...`);
5753
5776
  const matchFn = convoStepParameters.matchingMode ? getMatchFunction(convoStepParameters.matchingMode) || this.matchFn : this.matchFn;
5754
- const found = lodash.find(nottomatch, utt => matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
5777
+ const found = lodash.find(nottomatch, utt => matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS], convoStepParameters));
5755
5778
  const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
5756
5779
  if (!lodash.isNil(found)) {
5757
- if (this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer') {
5780
+ const matchingMode = convoStepParameters.matchingMode || this.caps[Capabilities.SCRIPTING_MATCHING_MODE];
5781
+ if (matchingMode === 'wer') {
5758
5782
  const wer = calculateWer(botresponse, nottomatch[0]);
5759
5783
  const werArgs = this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS];
5760
- const threshold = [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5784
+ const threshold = !lodash.isNil(convoStepParameters.matchingModeWer) ? convoStepParameters.matchingModeWer / 100 : [',', '.'].find(p => `${werArgs[0]}`.includes(p)) ? parseFloat(werArgs[0]) : parseInt(werArgs[0]) / 100;
5761
5785
  const message = `${stepTag}: Word Error Rate (${toPercent(wer)}) lower than accepted (${toPercent(threshold)})`;
5762
5786
  throw new BotiumError$1(message, {
5763
5787
  type: 'asserter',
5764
5788
  source: asserterType,
5765
5789
  params: {
5766
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
5790
+ matchingMode,
5767
5791
  args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
5768
5792
  },
5769
5793
  context: {
@@ -7129,7 +7153,7 @@ var NoRepo_1 = class NoRepo extends BaseRepo_1 {
7129
7153
  };
7130
7154
 
7131
7155
  var ProcessUtils = createCommonjsModule(function (module) {
7132
- const debug = debug$n('botium-core-ProcessUtils');
7156
+ const debug = debug$o('botium-core-ProcessUtils');
7133
7157
  module.exports = {
7134
7158
  childCommandLineRun: (cmd, ignoreErrors = false, processOptions = {}) => {
7135
7159
  const cmdOptions = cmd.split(' ');
@@ -7180,7 +7204,7 @@ var ProcessUtils = createCommonjsModule(function (module) {
7180
7204
  ProcessUtils.childCommandLineRun;
7181
7205
  ProcessUtils.childProcessRun;
7182
7206
 
7183
- const debug$8 = debug$n('botium-core-GitRepo');
7207
+ const debug$8 = debug$o('botium-core-GitRepo');
7184
7208
  var GitRepo_1 = class GitRepo extends BaseRepo_1 {
7185
7209
  Validate() {
7186
7210
  return super.Validate().then(() => {
@@ -7329,7 +7353,7 @@ var Queue_1 = class Queue {
7329
7353
  }
7330
7354
  };
7331
7355
 
7332
- const debug$7 = debug$n('botium-connector-BaseContainer');
7356
+ const debug$7 = debug$o('botium-connector-BaseContainer');
7333
7357
  const {
7334
7358
  executeHook: executeHook$1,
7335
7359
  getHook: getHook$1
@@ -7530,7 +7554,7 @@ var BaseContainer_1 = class BaseContainer {
7530
7554
  }
7531
7555
  };
7532
7556
 
7533
- const debug$6 = debug$n('botium-connector-GridContainer');
7557
+ const debug$6 = debug$o('botium-connector-GridContainer');
7534
7558
  var GridContainer_1 = class GridContainer extends BaseContainer_1 {
7535
7559
  Validate() {
7536
7560
  return super.Validate().then(() => {
@@ -7730,7 +7754,7 @@ var InProcessContainer_1 = class InProcessContainer extends BaseContainer_1 {
7730
7754
  }
7731
7755
  };
7732
7756
 
7733
- const debug$5 = debug$n('botium-core-inbound-proxy');
7757
+ const debug$5 = debug$o('botium-core-inbound-proxy');
7734
7758
  const buildRedisHandler = (redisurl, topic) => {
7735
7759
  const redis = new ioredis(redisurl);
7736
7760
  redis.on('connect', () => {
@@ -7808,7 +7832,7 @@ proxy.startProxy;
7808
7832
  const {
7809
7833
  v4: uuidv4
7810
7834
  } = uuid;
7811
- const debug$4 = debug$n('botium-connector-simplerest');
7835
+ const debug$4 = debug$o('botium-connector-simplerest');
7812
7836
  const {
7813
7837
  startProxy
7814
7838
  } = proxy;
@@ -8762,7 +8786,7 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8762
8786
  }
8763
8787
  };
8764
8788
 
8765
- const debug$3 = debug$n('botium-connector-PluginConnectorContainer-helper');
8789
+ const debug$3 = debug$o('botium-connector-PluginConnectorContainer-helper');
8766
8790
  const pluginResolver = containermode => {
8767
8791
  if (containermode === 'simplerest') {
8768
8792
  return SimpleRestContainer_1;
@@ -8890,7 +8914,7 @@ var plugins = {
8890
8914
  tryLoadPlugin: tryLoadPlugin$1
8891
8915
  };
8892
8916
 
8893
- const debug$2 = debug$n('botium-connector-PluginConnectorContainer');
8917
+ const debug$2 = debug$o('botium-connector-PluginConnectorContainer');
8894
8918
  const {
8895
8919
  tryLoadPlugin
8896
8920
  } = plugins;
@@ -9045,7 +9069,7 @@ const {
9045
9069
  const {
9046
9070
  boolean
9047
9071
  } = boolean$1;
9048
- const debug$1 = debug$n('botium-core-BotDriver');
9072
+ const debug$1 = debug$o('botium-core-BotDriver');
9049
9073
  const {
9050
9074
  version
9051
9075
  } = require$$3;
@@ -9348,7 +9372,7 @@ var BotDriver_1 = class BotDriver {
9348
9372
  }
9349
9373
  };
9350
9374
 
9351
- const debug = debug$n('botium-core-Plugins');
9375
+ const debug = debug$o('botium-core-Plugins');
9352
9376
  const PLUGIN_TYPE_CONNECTOR = 'PLUGIN_TYPE_CONNECTOR';
9353
9377
  const PLUGIN_TYPE_ASSERTER = 'PLUGIN_TYPE_ASSERTER';
9354
9378
  const PLUGIN_TYPE_LOGICHOOK = 'PLUGIN_TYPE_LOGICHOOK';