botium-core 1.14.4 → 1.14.5

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.4";
38
+ var version$1 = "1.14.5";
39
39
  var description = "The Selenium for Chatbots";
40
40
  var main = "index.js";
41
41
  var module = "dist/botium-es.js";
@@ -1779,7 +1779,7 @@ const linesToConvoStep$5 = (lines, sender, context, eol, singleLineMode = false)
1779
1779
  if (eol === null) {
1780
1780
  throw new Error('eol cant be null');
1781
1781
  }
1782
- convoStep.messageText = textLines.join(eol).replace(WHITE_SPACES_EXCEPT_SPACE_CHAR_AT_THE_END, '');
1782
+ convoStep.messageText = trimExceptSpaceEnd$1(textLines.join(eol));
1783
1783
  }
1784
1784
  }
1785
1785
  } else {
@@ -1800,6 +1800,9 @@ const linesToConvoStep$5 = (lines, sender, context, eol, singleLineMode = false)
1800
1800
  }
1801
1801
  return convoStep;
1802
1802
  };
1803
+ const trimExceptSpaceEnd$1 = string => {
1804
+ return string?.replace(WHITE_SPACES_EXCEPT_SPACE_CHAR_AT_THE_END, '');
1805
+ };
1803
1806
  const convoStepToObject$1 = step => {
1804
1807
  const result = [];
1805
1808
  if (step.sender === 'me') {
@@ -2129,7 +2132,8 @@ var helper = {
2129
2132
  validateConvo: validateConvo$2,
2130
2133
  linesToScriptingMemories: linesToScriptingMemories$2,
2131
2134
  calculateWer: calculateWer$2,
2132
- toPercent: toPercent$1
2135
+ toPercent: toPercent$1,
2136
+ trimExceptSpaceEnd: trimExceptSpaceEnd$1
2133
2137
  };
2134
2138
 
2135
2139
  const BotiumError$4 = class BotiumError extends Error {
@@ -4825,7 +4829,8 @@ const {
4825
4829
  convoStepToLines,
4826
4830
  validateConvo,
4827
4831
  validSenders: validSenders$2,
4828
- linesToScriptingMemories: linesToScriptingMemories$1
4832
+ linesToScriptingMemories: linesToScriptingMemories$1,
4833
+ trimExceptSpaceEnd
4829
4834
  } = helper;
4830
4835
  var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4831
4836
  constructor(context, caps = {}) {
@@ -4925,8 +4930,8 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4925
4930
  _compileUtterances(lines) {
4926
4931
  if (lines && lines.length > 0) {
4927
4932
  const result = [new Utterance_1({
4928
- name: lines[0],
4929
- utterances: lines.length > 1 ? lines.slice(1) : []
4933
+ name: lines[0].trim(),
4934
+ utterances: lines.length > 1 ? lines.slice(1).map(line => trimExceptSpaceEnd(line)) : []
4930
4935
  })];
4931
4936
  this.context.AddUtterances(result);
4932
4937
  return result;
@@ -6897,18 +6902,19 @@ var ScriptingProvider_1 = class ScriptingProvider {
6897
6902
  }
6898
6903
  if (utterances) {
6899
6904
  lodash.forEach(utterances, utt => {
6900
- const eu = this.utterances[utt.name];
6905
+ const uttName = utt.name?.trim();
6906
+ const eu = this.utterances[uttName];
6901
6907
  if (eu) {
6902
6908
  eu.utterances = lodash.uniq(lodash.concat(eu.utterances, utt.utterances));
6903
6909
  } else {
6904
- this.utterances[utt.name] = utt;
6910
+ this.utterances[uttName] = utt;
6905
6911
  }
6906
6912
  const {
6907
6913
  ambiguous,
6908
6914
  expected
6909
- } = findAmbiguous(this.utterances[utt.name].utterances);
6915
+ } = findAmbiguous(this.utterances[uttName].utterances);
6910
6916
  if (ambiguous && ambiguous.length > 0) {
6911
- debug$9(`Ambigous utterance "${utt.name}", expecting exact ${expected.length ? '"' + expected.join(', ') + '"' : '<none>'} scripting memory variables in following user examples: ${ambiguous.map(d => `"${d}"`).join(', ')}`);
6917
+ debug$9(`Ambigous utterance "${uttName}", expecting exact ${expected.length ? '"' + expected.join(', ') + '"' : '<none>'} scripting memory variables in following user examples: ${ambiguous.map(d => `"${d}"`).join(', ')}`);
6912
6918
  }
6913
6919
  });
6914
6920
  }