botium-core 1.11.14 → 1.12.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.
Files changed (52) hide show
  1. package/dist/botium-cjs.js +853 -579
  2. package/dist/botium-cjs.js.map +1 -1
  3. package/dist/botium-es.js +471 -198
  4. package/dist/botium-es.js.map +1 -1
  5. package/index.js +1 -0
  6. package/package.json +29 -29
  7. package/samples/connectors/custom/botium-connector-myapi.js +3 -3
  8. package/samples/extensions/asserterHooks/DummyAsserter.js +3 -3
  9. package/src/Capabilities.js +4 -1
  10. package/src/Defaults.js +1 -0
  11. package/src/Enums.js +6 -0
  12. package/src/containers/plugins/SimpleRestContainer.js +32 -1
  13. package/src/scripting/BotiumError.js +21 -0
  14. package/src/scripting/CompilerCsv.js +1 -1
  15. package/src/scripting/CompilerObjectBase.js +4 -14
  16. package/src/scripting/CompilerTxt.js +4 -15
  17. package/src/scripting/CompilerXlsx.js +81 -25
  18. package/src/scripting/Convo.js +16 -4
  19. package/src/scripting/MatchFunctions.js +21 -0
  20. package/src/scripting/ScriptingProvider.js +55 -40
  21. package/src/scripting/helper.js +57 -4
  22. package/src/scripting/logichook/LogicHookConsts.js +4 -0
  23. package/src/scripting/logichook/LogicHookUtils.js +2 -0
  24. package/src/scripting/logichook/asserter/JsonPathAsserter.js +1 -1
  25. package/src/scripting/logichook/asserter/TextWildcardExactAllAsserter.js +8 -0
  26. package/src/scripting/logichook/asserter/TextWildcardExactAllICAsserter.js +8 -0
  27. package/src/scripting/logichook/asserter/TextWildcardExactAnyAsserter.js +8 -0
  28. package/src/scripting/logichook/asserter/TextWildcardExactAnyICAsserter.js +8 -0
  29. package/src/scripting/logichook/logichooks/ClearQueueLogicHook.js +1 -1
  30. package/src/scripting/logichook/userinput/MediaInput.js +14 -2
  31. package/test/connectors/convos/hello.convo.txt +6 -0
  32. package/test/connectors/simplerest.spec.js +42 -2
  33. package/test/convo/convos/continuefailing.convo.txt +19 -0
  34. package/test/convo/transcript.spec.js +34 -0
  35. package/test/scripting/asserters/convos/text_wildcardexact_all_nok.yml +7 -0
  36. package/test/scripting/asserters/convos/text_wildcardexact_all_ok.yml +7 -0
  37. package/test/scripting/asserters/convos/text_wildcardexact_any_nok.yml +7 -0
  38. package/test/scripting/asserters/convos/text_wildcardexact_any_ok.yml +7 -0
  39. package/test/scripting/asserters/textWildcardExactAllAsserter.spec.js +51 -0
  40. package/test/scripting/asserters/textWildcardExactAnyAsserter.spec.js +51 -0
  41. package/test/scripting/matching/matchingmode.spec.js +43 -0
  42. package/test/scripting/scriptingProvider.spec.js +4 -4
  43. package/test/scripting/scriptingmemory/convosMultiMemorySameCols/buy.convo.txt +6 -0
  44. package/test/scripting/scriptingmemory/convosMultiMemorySameCols/products1.scriptingmemory.txt +2 -0
  45. package/test/scripting/scriptingmemory/convosMultiMemorySameCols/products2.scriptingmemory.txt +2 -0
  46. package/test/scripting/scriptingmemory/convosSimpleCols/buy.convo.txt +8 -0
  47. package/test/scripting/scriptingmemory/convosSimpleCols/product.scriptingmemory.txt +3 -0
  48. package/test/scripting/scriptingmemory/convosTwoTablesCols/buy.convo.txt +6 -0
  49. package/test/scripting/scriptingmemory/convosTwoTablesCols/customer.xlsx +0 -0
  50. package/test/scripting/scriptingmemory/convosTwoTablesCols/product.xlsx +0 -0
  51. package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +45 -0
  52. package/test/scripting/userinputs/mediaInputConvos.spec.js +53 -2
package/dist/botium-es.js CHANGED
@@ -23,7 +23,7 @@ import isJson$1 from 'is-json';
23
23
  import esprima from 'esprima';
24
24
  import markdownIt from 'markdown-it';
25
25
  import xlsx from 'xlsx';
26
- import sync from 'csv-parse/lib/sync';
26
+ import sync from 'csv-parse/sync';
27
27
  import yaml from 'yaml';
28
28
  import child_process from 'child_process';
29
29
  import socket from 'socket.io-client';
@@ -36,12 +36,12 @@ import express from 'express';
36
36
  import bodyParser from 'body-parser';
37
37
 
38
38
  var name = "botium-core";
39
- var version$1 = "1.11.14";
39
+ var version$1 = "1.12.1";
40
40
  var description = "The Selenium for Chatbots";
41
41
  var main = "index.js";
42
42
  var module = "dist/botium-es.js";
43
43
  var engines = {
44
- node: ">=10.0.0"
44
+ node: ">=14.0.0"
45
45
  };
46
46
  var scripts = {
47
47
  postinstall: "node ./report.js",
@@ -68,66 +68,66 @@ var bugs = {
68
68
  };
69
69
  var homepage = "https://www.botium.ai";
70
70
  var dependencies = {
71
- "@babel/runtime": "^7.15.4",
72
- async: "^3.2.1",
73
- "body-parser": "^1.19.0",
71
+ "@babel/runtime": "^7.16.7",
72
+ async: "^3.2.3",
73
+ "body-parser": "^1.19.1",
74
74
  boolean: "^3.1.4",
75
75
  bottleneck: "^2.19.5",
76
- "csv-parse": "^4.16.3",
77
- debug: "^4.3.2",
76
+ "csv-parse": "^5.0.4",
77
+ debug: "^4.3.3",
78
78
  esprima: "^4.0.1",
79
- express: "^4.17.1",
79
+ express: "^4.17.2",
80
80
  globby: "11.0.4",
81
- ioredis: "^4.27.9",
81
+ ioredis: "^4.28.3",
82
82
  "is-class": "^0.0.9",
83
83
  "is-json": "^2.0.1",
84
84
  jsonpath: "^1.1.1",
85
85
  lodash: "^4.17.21",
86
- "markdown-it": "^12.2.0",
87
- "mime-types": "^2.1.32",
86
+ "markdown-it": "^12.3.2",
87
+ "mime-types": "^2.1.34",
88
88
  mkdirp: "^1.0.4",
89
89
  moment: "^2.29.1",
90
90
  mustache: "^4.2.0",
91
91
  "promise-retry": "^2.0.1",
92
- "promise.allsettled": "^1.0.4",
92
+ "promise.allsettled": "^1.0.5",
93
93
  randomatic: "^3.1.1",
94
94
  request: "^2.88.2",
95
95
  rimraf: "^3.0.2",
96
96
  "sanitize-filename": "^1.6.3",
97
- slugify: "^1.6.0",
98
- "socket.io": "^4.2.0",
99
- "socket.io-client": "^4.2.0",
97
+ slugify: "^1.6.5",
98
+ "socket.io": "^4.4.1",
99
+ "socket.io-client": "^4.4.1",
100
100
  "socketio-auth": "^0.1.1",
101
101
  "swagger-jsdoc": "^6.1.0",
102
- "swagger-ui-express": "^4.1.6",
102
+ "swagger-ui-express": "^4.3.0",
103
103
  uuid: "^8.3.2",
104
- vm2: "^3.9.3",
104
+ vm2: "^3.9.5",
105
105
  "write-yaml": "^1.0.0",
106
- xlsx: "^0.17.1",
106
+ xlsx: "^0.17.5",
107
107
  xregexp: "^5.1.0",
108
108
  yaml: "^1.10.2"
109
109
  };
110
110
  var devDependencies = {
111
- "@babel/core": "^7.15.5",
112
- "@babel/node": "^7.15.4",
113
- "@babel/plugin-transform-runtime": "^7.15.0",
114
- "@babel/preset-env": "^7.15.6",
111
+ "@babel/core": "^7.16.12",
112
+ "@babel/node": "^7.16.8",
113
+ "@babel/plugin-transform-runtime": "^7.16.10",
114
+ "@babel/preset-env": "^7.16.11",
115
115
  chai: "^4.3.4",
116
116
  "chai-as-promised": "^7.1.1",
117
117
  "cross-env": "^7.0.3",
118
- eslint: "^7.32.0",
118
+ eslint: "^8.7.0",
119
119
  "eslint-config-standard": "^16.0.3",
120
- "eslint-plugin-import": "^2.24.2",
120
+ "eslint-plugin-import": "^2.25.4",
121
121
  "eslint-plugin-node": "^11.1.0",
122
- "eslint-plugin-promise": "^5.1.0",
122
+ "eslint-plugin-promise": "^6.0.0",
123
123
  "eslint-plugin-standard": "^4.1.0",
124
124
  "license-checker": "^25.0.1",
125
125
  "license-compatibility-checker": "^0.3.5",
126
- mocha: "^9.1.1",
127
- nock: "^13.1.3",
128
- "npm-check-updates": "^11.8.5",
126
+ mocha: "^9.2.0",
127
+ nock: "^13.2.2",
128
+ "npm-check-updates": "^12.2.1",
129
129
  nyc: "^15.1.0",
130
- rollup: "^2.56.3",
130
+ rollup: "^2.66.0",
131
131
  "rollup-plugin-babel": "^4.4.0",
132
132
  "rollup-plugin-commonjs": "^10.1.0",
133
133
  "rollup-plugin-json": "^4.0.0",
@@ -282,8 +282,9 @@ var Capabilities = {
282
282
  SCRIPTING_NORMALIZE_TEXT: 'SCRIPTING_NORMALIZE_TEXT',
283
283
  SCRIPTING_ENABLE_MEMORY: 'SCRIPTING_ENABLE_MEMORY',
284
284
  SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS: 'SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS',
285
+ SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS: 'SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS',
285
286
  SCRIPTING_FORCE_BOT_CONSUMED: 'SCRIPTING_FORCE_BOT_CONSUMED',
286
- // regexp, regexpIgnoreCase, wildcard, wildcardIgnoreCase, include, includeIgnoreCase, equals, equalsIgnoreCase
287
+ // regexp, regexpIgnoreCase, wildcard, wildcardIgnoreCase, wildcardExact, wildcardExactIgnoreCase, include, includeIgnoreCase, equals, equalsIgnoreCase
287
288
  SCRIPTING_MATCHING_MODE: 'SCRIPTING_MATCHING_MODE',
288
289
  // all, first, random
289
290
  SCRIPTING_UTTEXPANSION_MODE: 'SCRIPTING_UTTEXPANSION_MODE',
@@ -297,6 +298,8 @@ var Capabilities = {
297
298
  SCRIPTING_MEMORYEXPANSION_KEEP_ORIG: 'SCRIPTING_MEMORYEXPANSION_KEEP_ORIG',
298
299
  // word, non_whitespace, joker
299
300
  SCRIPTING_MEMORY_MATCHING_MODE: 'SCRIPTING_MEMORY_MATCHING_MODE',
301
+ // varnames, testcasenames
302
+ SCRIPTING_MEMORY_COLUMN_MODE: 'SCRIPTING_MEMORY_COLUMN_MODE',
300
303
  // Botium Lifecycle Hooks
301
304
  CUSTOMHOOK_ONBUILD: 'CUSTOMHOOK_ONBUILD',
302
305
  CUSTOMHOOK_ONSTART: 'CUSTOMHOOK_ONSTART',
@@ -422,6 +425,7 @@ Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER;
422
425
  Capabilities.SCRIPTING_NORMALIZE_TEXT;
423
426
  Capabilities.SCRIPTING_ENABLE_MEMORY;
424
427
  Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS;
428
+ Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS;
425
429
  Capabilities.SCRIPTING_FORCE_BOT_CONSUMED;
426
430
  Capabilities.SCRIPTING_MATCHING_MODE;
427
431
  Capabilities.SCRIPTING_UTTEXPANSION_MODE;
@@ -432,6 +436,7 @@ Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE;
432
436
  Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX;
433
437
  Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG;
434
438
  Capabilities.SCRIPTING_MEMORY_MATCHING_MODE;
439
+ Capabilities.SCRIPTING_MEMORY_COLUMN_MODE;
435
440
  Capabilities.CUSTOMHOOK_ONBUILD;
436
441
  Capabilities.CUSTOMHOOK_ONSTART;
437
442
  Capabilities.CUSTOMHOOK_ONUSERSAYS;
@@ -510,6 +515,7 @@ var Defaults$1 = {
510
515
  [Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE]: 'justLineTag',
511
516
  [Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX]: '16',
512
517
  [Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG]: false,
518
+ [Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]: false,
513
519
  [Capabilities.SCRIPTING_FORCE_BOT_CONSUMED]: false,
514
520
  [Capabilities.ASSERTERS]: [],
515
521
  [Capabilities.LOGIC_HOOKS]: [],
@@ -831,7 +837,7 @@ function getCjsExportFromNamespace (n) {
831
837
  return n && n['default'] || n;
832
838
  }
833
839
 
834
- const BotiumError$6 = class BotiumError extends Error {
840
+ const BotiumError$7 = class BotiumError extends Error {
835
841
  /**
836
842
  *
837
843
  * @param message
@@ -856,6 +862,27 @@ const BotiumError$6 = class BotiumError extends Error {
856
862
  this.context.message = message.message || message;
857
863
  }
858
864
 
865
+ isAsserterError() {
866
+ if (this.context) {
867
+ const errArr = lodash.isArray(this.context) ? this.context : [this.context];
868
+ const hasNotAsserterError = errArr.findIndex(errDetail => {
869
+ if (errDetail.type === 'list') {
870
+ if (errDetail.errors) {
871
+ return errDetail.errors.findIndex(e => e.type !== 'asserter') >= 0;
872
+ } else {
873
+ return true;
874
+ }
875
+ } else {
876
+ return errDetail.type !== 'asserter';
877
+ }
878
+ }) >= 0;
879
+ if (hasNotAsserterError) return false;
880
+ return true;
881
+ } else {
882
+ return false;
883
+ }
884
+ }
885
+
859
886
  prettify(includeJson) {
860
887
  const lines = [];
861
888
 
@@ -917,10 +944,10 @@ const _getChildErrorsFromContext = context => {
917
944
  };
918
945
 
919
946
  const botiumErrorFromErr$2 = (message, err) => {
920
- if (err instanceof BotiumError$6) {
921
- return new BotiumError$6(message, err.context, true);
947
+ if (err instanceof BotiumError$7) {
948
+ return new BotiumError$7(message, err.context, true);
922
949
  } else {
923
- return new BotiumError$6(message, {
950
+ return new BotiumError$7(message, {
924
951
  err
925
952
  }, true);
926
953
  }
@@ -935,7 +962,7 @@ const botiumErrorFromList$2 = (errors, {
935
962
  let children = [];
936
963
 
937
964
  for (const error of errors) {
938
- if (error instanceof BotiumError$6) {
965
+ if (error instanceof BotiumError$7) {
939
966
  const childErrors = flat && _getChildErrorsFromContext(error.context);
940
967
 
941
968
  if (childErrors && childErrors.length) {
@@ -948,7 +975,7 @@ const botiumErrorFromList$2 = (errors, {
948
975
  }
949
976
  }
950
977
 
951
- const result = new BotiumError$6(message, {
978
+ const result = new BotiumError$7(message, {
952
979
  errors: children,
953
980
  type,
954
981
  source
@@ -957,7 +984,7 @@ const botiumErrorFromList$2 = (errors, {
957
984
  };
958
985
 
959
986
  var BotiumError_1 = {
960
- BotiumError: BotiumError$6,
987
+ BotiumError: BotiumError$7,
961
988
  botiumErrorFromErr: botiumErrorFromErr$2,
962
989
  botiumErrorFromList: botiumErrorFromList$2
963
990
  };
@@ -1049,6 +1076,18 @@ var LogicHookConsts = {
1049
1076
  }, {
1050
1077
  name: 'TEXT_WILDCARD_ALL_IC',
1051
1078
  className: 'TextWildcardAllICAsserter'
1079
+ }, {
1080
+ name: 'TEXT_WILDCARDEXACT_ANY',
1081
+ className: 'TextWildcardExactAnyAsserter'
1082
+ }, {
1083
+ name: 'TEXT_WILDCARDEXACT_ANY_IC',
1084
+ className: 'TextWildcardExactAnyICAsserter'
1085
+ }, {
1086
+ name: 'TEXT_WILDCARDEXACT_ALL',
1087
+ className: 'TextWildcardExactAllAsserter'
1088
+ }, {
1089
+ name: 'TEXT_WILDCARDEXACT_ALL_IC',
1090
+ className: 'TextWildcardExactAllICAsserter'
1052
1091
  }, {
1053
1092
  name: 'TEXT_REGEXP_ANY',
1054
1093
  className: 'TextRegexpAnyAsserter'
@@ -1126,7 +1165,7 @@ const {
1126
1165
  } = vm2;
1127
1166
  const debug$k = debug$l('botium-core-asserterUtils');
1128
1167
  const {
1129
- BotiumError: BotiumError$5
1168
+ BotiumError: BotiumError$6
1130
1169
  } = BotiumError_1;
1131
1170
  const {
1132
1171
  DEFAULT_ASSERTERS,
@@ -1277,7 +1316,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
1277
1316
 
1278
1317
  const _checkUnsafe = () => {
1279
1318
  if (!this.caps[Capabilities.SECURITY_ALLOW_UNSAFE]) {
1280
- throw new BotiumError$5('Security Error. Using unsafe component is not allowed', {
1319
+ throw new BotiumError$6('Security Error. Using unsafe component is not allowed', {
1281
1320
  type: 'security',
1282
1321
  subtype: 'allow unsafe',
1283
1322
  source: path.basename(__filename),
@@ -1421,6 +1460,11 @@ var LogicHookUtils_1 = class LogicHookUtils {
1421
1460
  ref,
1422
1461
  ...this.buildScriptContext
1423
1462
  }, this.caps, args);
1463
+ } else if (lodash.isFunction(CheckClass.PluginClass)) {
1464
+ return CheckClass.PluginClass({
1465
+ ref,
1466
+ ...this.buildScriptContext
1467
+ }, this.caps, args);
1424
1468
  } else {
1425
1469
  throw new Error(`${src} class or function expected`);
1426
1470
  }
@@ -1676,6 +1720,18 @@ var BotiumMockMessage_1 = class BotiumMockMessage {
1676
1720
 
1677
1721
  };
1678
1722
 
1723
+ var Enums = {
1724
+ E_SCRIPTING_MEMORY_COLUMN_MODE: {
1725
+ VARNAMES: 'varnames',
1726
+ TESTCASENAMES: 'testcasenames'
1727
+ }
1728
+ };
1729
+ Enums.E_SCRIPTING_MEMORY_COLUMN_MODE;
1730
+
1731
+ const {
1732
+ E_SCRIPTING_MEMORY_COLUMN_MODE: E_SCRIPTING_MEMORY_COLUMN_MODE$1
1733
+ } = Enums;
1734
+
1679
1735
  const normalizeText$1 = (str, doCleanup) => {
1680
1736
  if (str && lodash.isArray(str)) {
1681
1737
  str = str.join(' ');
@@ -1747,7 +1803,7 @@ const toString$3 = value => {
1747
1803
  };
1748
1804
 
1749
1805
  const flatString = str => {
1750
- return str.split('\n').map(s => s.trim()).join(' ');
1806
+ return str ? str.split('\n').map(s => s.trim()).join(' ') : '';
1751
1807
  };
1752
1808
 
1753
1809
  const linesToConvoStep$5 = (lines, sender, context, eol, singleLineMode = false) => {
@@ -2178,7 +2234,7 @@ const convoStepToLines$2 = step => {
2178
2234
  lines.push((step.optional ? '?' : '') + (step.not ? '!' : '') + step.messageText);
2179
2235
  }
2180
2236
 
2181
- if (step.buttons && step.buttons.length > 0) lines.push('BUTTONS ' + step.buttons.map(b => flatString(b.text)).join('|'));
2237
+ if (step.buttons && step.buttons.length > 0) lines.push('BUTTONS ' + step.buttons.filter(b => b.text).map(b => flatString(b.text)).join('|'));
2182
2238
  if (step.media && step.media.length > 0) lines.push('MEDIA ' + step.media.filter(m => !m.buffer && m.mediaUri).map(m => m.mediaUri).join('|'));
2183
2239
 
2184
2240
  if (step.cards && step.cards.length > 0) {
@@ -2188,7 +2244,7 @@ const convoStepToLines$2 = step => {
2188
2244
  if (c.subtext) cardTexts = cardTexts.concat(lodash.isArray(c.subtext) ? c.subtext : [c.subtext]);
2189
2245
  if (c.content) cardTexts = cardTexts.concat(lodash.isArray(c.content) ? c.content : [c.content]);
2190
2246
  if (cardTexts.length > 0) lines.push('CARDS ' + cardTexts.map(c => flatString(c)).join('|'));
2191
- if (c.buttons && c.buttons.length > 0) lines.push('BUTTONS ' + c.buttons.map(b => flatString(b.text)).join('|'));
2247
+ if (c.buttons && c.buttons.length > 0) lines.push('BUTTONS ' + c.buttons.filter(b => b.text).map(b => flatString(b.text)).join('|'));
2192
2248
  if (c.image && !c.image.buffer && c.image.mediaUri) lines.push('MEDIA ' + c.image.mediaUri);
2193
2249
  });
2194
2250
  }
@@ -2204,6 +2260,71 @@ const convoStepToLines$2 = step => {
2204
2260
  return lines.map(l => l.trim());
2205
2261
  };
2206
2262
 
2263
+ const linesToScriptingMemories$2 = (lines, columnMode = null) => {
2264
+ const guessScriptingMemoryColumnMode = lines => {
2265
+ if (lines && lines.length > 1) {
2266
+ if (lines[1].trim().startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES;
2267
+ }
2268
+
2269
+ return E_SCRIPTING_MEMORY_COLUMN_MODE$1.VARNAMES;
2270
+ };
2271
+
2272
+ columnMode = columnMode || guessScriptingMemoryColumnMode(lines);
2273
+ const scriptingMemories = [];
2274
+
2275
+ if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES) {
2276
+ const caseNames = lines[0].split('|').map(name => name.trim()).slice(1);
2277
+ const varNames = [];
2278
+ const varValues = [];
2279
+
2280
+ for (let row = 1; row < lines.length; row++) {
2281
+ if (!lines[row] || lines[row].length === 0) continue;
2282
+ const rawRow = lines[row].split('|').map(name => name.trim());
2283
+ varNames.push(rawRow[0]);
2284
+ varValues.push(rawRow.slice(1));
2285
+ }
2286
+
2287
+ for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
2288
+ const caseName = caseNames[caseIndex];
2289
+ const values = varNames.reduce((agg, varName, varIndex) => {
2290
+ agg[varName] = varValues[varIndex][caseIndex] || null;
2291
+ return agg;
2292
+ }, {});
2293
+ const scriptingMemory = {
2294
+ header: {
2295
+ name: caseName
2296
+ },
2297
+ values: values
2298
+ };
2299
+ scriptingMemories.push(scriptingMemory);
2300
+ }
2301
+ } else {
2302
+ const varNames = lines[0].split('|').map(name => name.trim()).slice(1);
2303
+
2304
+ for (let row = 1; row < lines.length; row++) {
2305
+ if (!lines[row] || lines[row].length === 0) continue;
2306
+ const rawRow = lines[row].split('|').map(name => name.trim());
2307
+ const caseName = rawRow[0];
2308
+ const values = rawRow.slice(1);
2309
+ const varValues = {};
2310
+
2311
+ for (let varIndex = 0; varIndex < varNames.length; varIndex++) {
2312
+ varValues[varNames[varIndex]] = values[varIndex];
2313
+ }
2314
+
2315
+ const scriptingMemory = {
2316
+ header: {
2317
+ name: caseName
2318
+ },
2319
+ values: varValues
2320
+ };
2321
+ scriptingMemories.push(scriptingMemory);
2322
+ }
2323
+ }
2324
+
2325
+ return scriptingMemories;
2326
+ };
2327
+
2207
2328
  var helper = {
2208
2329
  normalizeText: normalizeText$1,
2209
2330
  splitStringInNonEmptyLines: splitStringInNonEmptyLines$1,
@@ -2216,7 +2337,8 @@ var helper = {
2216
2337
  convoStepToObject: convoStepToObject$1,
2217
2338
  validSenders: validSenders$3,
2218
2339
  validateSender: validateSender$1,
2219
- validateConvo: validateConvo$2
2340
+ validateConvo: validateConvo$2,
2341
+ linesToScriptingMemories: linesToScriptingMemories$2
2220
2342
  };
2221
2343
 
2222
2344
  const debug$j = debug$l('botium-core-ScriptingMemory');
@@ -2231,7 +2353,7 @@ const {
2231
2353
  toString: toString$2
2232
2354
  } = helper;
2233
2355
  const {
2234
- BotiumError: BotiumError$4
2356
+ BotiumError: BotiumError$5
2235
2357
  } = BotiumError_1; // If they got parameter, then it will be a string always.
2236
2358
  // the receiver can decide what to do with it,
2237
2359
  // convert to int,
@@ -2400,7 +2522,7 @@ const SCRIPTING_FUNCTIONS$1 = lodash.mapValues(SCRIPTING_FUNCTIONS_RAW, (funcOrS
2400
2522
  return {
2401
2523
  handler: (caps, ...rest) => {
2402
2524
  if (!caps[Capabilities.SECURITY_ALLOW_UNSAFE] && funcOrStruct.unsafe) {
2403
- throw new BotiumError$4(`Security Error. Using unsafe scripting memory function ${name} is not allowed`, {
2525
+ throw new BotiumError$5(`Security Error. Using unsafe scripting memory function ${name} is not allowed`, {
2404
2526
  type: 'security',
2405
2527
  subtype: 'allow unsafe',
2406
2528
  source: path.basename(__filename),
@@ -2549,7 +2671,7 @@ ScriptingMemory.SCRIPTING_FUNCTIONS;
2549
2671
 
2550
2672
  const debug$i = debug$l('botium-core-Convo');
2551
2673
  const {
2552
- BotiumError: BotiumError$3,
2674
+ BotiumError: BotiumError$4,
2553
2675
  botiumErrorFromErr: botiumErrorFromErr$1,
2554
2676
  botiumErrorFromList: botiumErrorFromList$1
2555
2677
  } = BotiumError_1;
@@ -2589,7 +2711,9 @@ class ConvoStepAssert {
2589
2711
  }
2590
2712
 
2591
2713
  toString() {
2592
- return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.join(',') : 'no args') + ')';
2714
+ return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.map(a => lodash.truncate(a, {
2715
+ length: 200
2716
+ })).join(',') : 'no args') + ')';
2593
2717
  }
2594
2718
 
2595
2719
  }
@@ -2601,7 +2725,9 @@ class ConvoStepLogicHook {
2601
2725
  }
2602
2726
 
2603
2727
  toString() {
2604
- return this.name + '(' + (this.args ? this.args.join(',') : 'no args') + ')';
2728
+ return this.name + '(' + (this.args ? this.args.map(a => lodash.truncate(a, {
2729
+ length: 200
2730
+ })).join(',') : 'no args') + ')';
2605
2731
  }
2606
2732
 
2607
2733
  }
@@ -2613,7 +2739,9 @@ class ConvoStepUserInput {
2613
2739
  }
2614
2740
 
2615
2741
  toString() {
2616
- return this.name + '(' + (this.args ? this.args.join(',') : 'no args') + ')';
2742
+ return this.name + '(' + (this.args ? this.args.map(a => lodash.truncate(a, {
2743
+ length: 200
2744
+ })).join(',') : 'no args') + ')';
2617
2745
  }
2618
2746
 
2619
2747
  }
@@ -3078,7 +3206,7 @@ class Convo$6 {
3078
3206
  }
3079
3207
 
3080
3208
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
3081
- const failErr = new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
3209
+ const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
3082
3210
  debug$i(failErr);
3083
3211
 
3084
3212
  try {
@@ -3181,7 +3309,7 @@ class Convo$6 {
3181
3309
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3182
3310
  } catch (failErr) {}
3183
3311
 
3184
- if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$3) {
3312
+ if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$4) {
3185
3313
  assertErrors.push(err);
3186
3314
  } else {
3187
3315
  throw failErr;
@@ -3198,7 +3326,7 @@ class Convo$6 {
3198
3326
  }
3199
3327
  }
3200
3328
  } else {
3201
- const failErr = new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util.inspect(convoStep.sender)}`);
3329
+ const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util.inspect(convoStep.sender)}`);
3202
3330
  debug$i(failErr);
3203
3331
 
3204
3332
  try {
@@ -3209,7 +3337,7 @@ class Convo$6 {
3209
3337
  }
3210
3338
  } catch (err) {
3211
3339
  if (lastMeConvoStep) {
3212
- if (err instanceof BotiumError$3 && err.context) {
3340
+ if (err instanceof BotiumError$4 && err.context) {
3213
3341
  err.context.input = new ConvoStep$1(lastMeConvoStep);
3214
3342
  err.context.transcript = [...transcriptSteps, { ...transcriptStep
3215
3343
  }];
@@ -3221,7 +3349,14 @@ class Convo$6 {
3221
3349
  }
3222
3350
 
3223
3351
  transcriptStep.err = err;
3224
- throw err;
3352
+
3353
+ if (err instanceof BotiumError$4 && container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
3354
+ if (!err.isAsserterError()) {
3355
+ throw err;
3356
+ }
3357
+ } else {
3358
+ throw err;
3359
+ }
3225
3360
  } finally {
3226
3361
  if (convoStep.sender !== 'begin' && convoStep.sender !== 'end' && !skipTranscriptStep) {
3227
3362
  transcriptStep.scriptingMemory = Object.assign({}, scriptingMemory);
@@ -3236,6 +3371,14 @@ class Convo$6 {
3236
3371
  transcript.steps = transcriptSteps.filter(s => s);
3237
3372
  transcript.scriptingMemory = scriptingMemory;
3238
3373
  transcript.convoEnd = new Date();
3374
+
3375
+ if (container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
3376
+ const transcriptStepErrs = transcript.steps.filter(s => s.err).map(s => s.err);
3377
+
3378
+ if (transcriptStepErrs && transcriptStepErrs.length > 0) {
3379
+ transcript.err = botiumErrorFromList$1([transcriptStepErrs, transcript.err].filter(e => e), {});
3380
+ }
3381
+ }
3239
3382
  }
3240
3383
  }
3241
3384
 
@@ -3244,11 +3387,11 @@ class Convo$6 {
3244
3387
 
3245
3388
  if (lodash.isArray(expected)) {
3246
3389
  if (!lodash.isArray(result)) {
3247
- throw new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot response expected array, got "${result}"`);
3390
+ throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array, got "${result}"`);
3248
3391
  }
3249
3392
 
3250
3393
  if (expected.length !== result.length) {
3251
- throw new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot response expected array length ${expected.length}, got ${result.length}`);
3394
+ throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array length ${expected.length}, got ${result.length}`);
3252
3395
  }
3253
3396
 
3254
3397
  for (let i = 0; i < expected.length; i++) {
@@ -3259,7 +3402,7 @@ class Convo$6 {
3259
3402
  if (Object.prototype.hasOwnProperty.call(result, key)) {
3260
3403
  this._compareObject(container, scriptingMemory, convoStep, result[key], expected[key]);
3261
3404
  } else {
3262
- throw new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot response "${result}" missing expected property: ${key}`);
3405
+ throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response "${result}" missing expected property: ${key}`);
3263
3406
  }
3264
3407
  });
3265
3408
  } else {
@@ -3387,17 +3530,17 @@ class Convo$6 {
3387
3530
  const alreadyThereAt = parentPConvos.indexOf(includeLogicHook);
3388
3531
 
3389
3532
  if (alreadyThereAt >= 0) {
3390
- throw new BotiumError$3(`Partial convos are included circular. "${includeLogicHook}" is referenced by "/${parentPConvos.slice(0, alreadyThereAt).join('/')}" and by "/${parentPConvos.join('/')}" `);
3533
+ throw new BotiumError$4(`Partial convos are included circular. "${includeLogicHook}" is referenced by "/${parentPConvos.slice(0, alreadyThereAt).join('/')}" and by "/${parentPConvos.join('/')}" `);
3391
3534
  }
3392
3535
 
3393
3536
  if (!partialConvos || Object.keys(partialConvos).length === 0) {
3394
- throw new BotiumError$3(`Cant find partial convo with name ${includeLogicHook} (There are no partial convos)`);
3537
+ throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (There are no partial convos)`);
3395
3538
  }
3396
3539
 
3397
3540
  const partialConvo = partialConvos[includeLogicHook];
3398
3541
 
3399
3542
  if (!partialConvo) {
3400
- throw new BotiumError$3(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
3543
+ throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
3401
3544
  }
3402
3545
 
3403
3546
  _getEffectiveConversationRecursive(partialConvo.conversation, [...parentPConvos, includeLogicHook], result, true);
@@ -3496,6 +3639,24 @@ const wildcard = ignoreCase => (botresponse, utterance) => {
3496
3639
  return regexp.test(botresponse);
3497
3640
  };
3498
3641
 
3642
+ const wildcardExact = ignoreCase => (botresponse, utterance) => {
3643
+ if (lodash.isUndefined(botresponse)) {
3644
+ if (utterance.trim() === '*') return true;else return false;
3645
+ }
3646
+
3647
+ utterance = toString(utterance);
3648
+ botresponse = _normalize(botresponse);
3649
+ const numWildcards = utterance.split('*').length - 1;
3650
+
3651
+ if (numWildcards > 10) {
3652
+ throw new Error('Maximum number of 10 wildcards supported.');
3653
+ }
3654
+
3655
+ const utteranceRe = '^' + quoteRegexpString(utterance).replace(/\\\*/g, '(.*)') + '$';
3656
+ const regexp = ignoreCase ? new RegExp(utteranceRe, 'i') : new RegExp(utteranceRe, '');
3657
+ return regexp.test(botresponse);
3658
+ };
3659
+
3499
3660
  const include = ignoreCase => (botresponse, utterance) => {
3500
3661
  if (lodash.isUndefined(botresponse)) return false;
3501
3662
  utterance = toString(utterance);
@@ -3527,6 +3688,8 @@ const getMatchFunction$1 = matchingMode => {
3527
3688
  return regexp(matchingMode === 'regexpIgnoreCase');
3528
3689
  } else if (matchingMode === 'wildcard' || matchingMode === 'wildcardIgnoreCase' || matchingMode === 'wildcardLowerCase') {
3529
3690
  return wildcard(matchingMode === 'wildcardIgnoreCase' || matchingMode === 'wildcardLowerCase');
3691
+ } else if (matchingMode === 'wildcardExact' || matchingMode === 'wildcardExactIgnoreCase') {
3692
+ return wildcardExact(matchingMode === 'wildcardExactIgnoreCase');
3530
3693
  } else if (matchingMode === 'include' || matchingMode === 'includeIgnoreCase' || matchingMode === 'includeLowerCase') {
3531
3694
  return include(matchingMode === 'includeIgnoreCase' || matchingMode === 'includeLowerCase');
3532
3695
  } else if (matchingMode === 'equals' || matchingMode === 'equalsIgnoreCase') {
@@ -3539,6 +3702,7 @@ const getMatchFunction$1 = matchingMode => {
3539
3702
  var MatchFunctions = {
3540
3703
  regexp,
3541
3704
  wildcard,
3705
+ wildcardExact,
3542
3706
  include,
3543
3707
  equals,
3544
3708
  getMatchFunction: getMatchFunction$1
@@ -3758,7 +3922,7 @@ const {
3758
3922
  } = vm2;
3759
3923
  const debug$h = debug$l('botium-core-HookUtils');
3760
3924
  const {
3761
- BotiumError: BotiumError$2
3925
+ BotiumError: BotiumError$3
3762
3926
  } = BotiumError_1;
3763
3927
 
3764
3928
  const executeHook$2 = async (caps, hook, args) => {
@@ -3830,7 +3994,7 @@ const getHook$3 = (caps, data) => {
3830
3994
 
3831
3995
  if (resultWithRequire) {
3832
3996
  if (!allowUnsafe) {
3833
- throw new BotiumError$2('Security Error. Using unsafe custom hook with require is not allowed', {
3997
+ throw new BotiumError$3('Security Error. Using unsafe custom hook with require is not allowed', {
3834
3998
  type: 'security',
3835
3999
  subtype: 'allow unsafe',
3836
4000
  source: path.basename(__filename),
@@ -4285,6 +4449,9 @@ var Utterance_1 = class Utterance {
4285
4449
  };
4286
4450
 
4287
4451
  const debug$d = debug$l('botium-core-CompilerXlsx');
4452
+ const {
4453
+ E_SCRIPTING_MEMORY_COLUMN_MODE
4454
+ } = Enums;
4288
4455
  const {
4289
4456
  Convo: Convo$5
4290
4457
  } = Convo_1;
@@ -4597,49 +4764,120 @@ var CompilerXlsx_1 = class CompilerXlsx extends CompilerBase_1 {
4597
4764
  }
4598
4765
 
4599
4766
  if (scriptType === Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY) {
4600
- const variableNames = [];
4601
- let colindexTemp = colindex + 1;
4767
+ const guessScriptingMemoryColumnMode = () => {
4768
+ const line1Cell = this.colnames[colindex] + (rowindex + 1);
4602
4769
 
4603
- while (true) {
4604
- const variableNameCell = this.colnames[colindexTemp] + rowindex;
4605
-
4606
- if (sheet[variableNameCell] && sheet[variableNameCell].v) {
4607
- variableNames.push(sheet[variableNameCell].v);
4608
- } else {
4609
- break;
4770
+ if (sheet[line1Cell] && sheet[line1Cell].v) {
4771
+ if (sheet[line1Cell].v.startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES;
4610
4772
  }
4611
4773
 
4612
- colindexTemp++;
4613
- }
4774
+ return E_SCRIPTING_MEMORY_COLUMN_MODE.VARNAMES;
4775
+ };
4614
4776
 
4615
- rowindex += 1;
4777
+ const columnMode = this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE] || guessScriptingMemoryColumnMode();
4616
4778
 
4617
- while (true) {
4618
- const caseNameCell = this.colnames[colindex] + rowindex;
4779
+ if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES) {
4780
+ const caseNames = [];
4781
+ let colindexTemp = colindex + 1;
4619
4782
 
4620
- if (sheet[caseNameCell] && sheet[caseNameCell].v) {
4621
- const caseName = sheet[caseNameCell].v;
4622
- const values = {};
4783
+ while (true) {
4784
+ const caseNameCell = this.colnames[colindexTemp] + rowindex;
4623
4785
 
4624
- for (let i = 0; i < variableNames.length; i++) {
4625
- const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
4786
+ if (sheet[caseNameCell] && sheet[caseNameCell].v) {
4787
+ caseNames.push(sheet[caseNameCell].v);
4788
+ } else {
4789
+ break;
4790
+ }
4626
4791
 
4627
- if (sheet[variableValueCell] && sheet[variableValueCell].v) {
4628
- values[variableNames[i]] = sheet[variableValueCell].v.toString();
4629
- } else {
4630
- values[variableNames[i]] = null;
4792
+ colindexTemp++;
4793
+ }
4794
+
4795
+ const varNames = [];
4796
+ const varValues = [];
4797
+ rowindex += 1;
4798
+
4799
+ while (true) {
4800
+ const varNameCell = this.colnames[colindex] + rowindex;
4801
+
4802
+ if (sheet[varNameCell] && sheet[varNameCell].v) {
4803
+ varNames.push(sheet[varNameCell].v);
4804
+ const values = [];
4805
+
4806
+ for (let i = 0; i < caseNames.length; i++) {
4807
+ const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
4808
+
4809
+ if (sheet[variableValueCell] && sheet[variableValueCell].v) {
4810
+ values.push(sheet[variableValueCell].v.toString());
4811
+ } else {
4812
+ values.push(null);
4813
+ }
4631
4814
  }
4815
+
4816
+ varValues.push(values);
4817
+ rowindex += 1;
4818
+ } else {
4819
+ break;
4632
4820
  }
4821
+ }
4633
4822
 
4634
- rowindex += 1;
4823
+ for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
4824
+ const caseName = caseNames[caseIndex];
4825
+ const values = varNames.reduce((agg, varName, varIndex) => {
4826
+ agg[varName] = varValues[varIndex][caseIndex] || null;
4827
+ return agg;
4828
+ }, {});
4635
4829
  scriptResults.push({
4636
4830
  header: {
4637
4831
  name: caseName
4638
4832
  },
4639
4833
  values: values
4640
4834
  });
4641
- } else {
4642
- break;
4835
+ }
4836
+ } else {
4837
+ const variableNames = [];
4838
+ let colindexTemp = colindex + 1;
4839
+
4840
+ while (true) {
4841
+ const variableNameCell = this.colnames[colindexTemp] + rowindex;
4842
+
4843
+ if (sheet[variableNameCell] && sheet[variableNameCell].v) {
4844
+ variableNames.push(sheet[variableNameCell].v);
4845
+ } else {
4846
+ break;
4847
+ }
4848
+
4849
+ colindexTemp++;
4850
+ }
4851
+
4852
+ rowindex += 1;
4853
+
4854
+ while (true) {
4855
+ const caseNameCell = this.colnames[colindex] + rowindex;
4856
+
4857
+ if (sheet[caseNameCell] && sheet[caseNameCell].v) {
4858
+ const caseName = sheet[caseNameCell].v;
4859
+ const values = {};
4860
+
4861
+ for (let i = 0; i < variableNames.length; i++) {
4862
+ const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
4863
+
4864
+ if (sheet[variableValueCell] && sheet[variableValueCell].v) {
4865
+ values[variableNames[i]] = sheet[variableValueCell].v.toString();
4866
+ } else {
4867
+ values[variableNames[i]] = null;
4868
+ }
4869
+ }
4870
+
4871
+ rowindex += 1;
4872
+ scriptResults.push({
4873
+ header: {
4874
+ name: caseName
4875
+ },
4876
+ values: values
4877
+ });
4878
+ } else {
4879
+ break;
4880
+ }
4643
4881
  }
4644
4882
  }
4645
4883
  }
@@ -4799,7 +5037,8 @@ const {
4799
5037
  linesToConvoStep: linesToConvoStep$3,
4800
5038
  convoStepToLines,
4801
5039
  validateConvo,
4802
- validSenders: validSenders$2
5040
+ validSenders: validSenders$2,
5041
+ linesToScriptingMemories: linesToScriptingMemories$1
4803
5042
  } = helper;
4804
5043
  var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4805
5044
  constructor(context, caps = {}) {
@@ -4930,30 +5169,12 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4930
5169
 
4931
5170
  _compileScriptingMemory(lines) {
4932
5171
  if (lines && lines.length > 1) {
4933
- const names = lines[0].split('|').map(name => name.trim()).slice(1);
4934
- const scriptingMemories = [];
4935
-
4936
- for (let row = 1; row < lines.length; row++) {
4937
- if (!lines[row] || lines[row].length === 0) continue;
4938
- const rawRow = lines[row].split('|').map(name => name.trim());
4939
- const caseName = rawRow[0];
4940
- const values = rawRow.slice(1);
4941
- const json = {};
5172
+ const scriptingMemories = linesToScriptingMemories$1(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
4942
5173
 
4943
- for (let col = 0; col < names.length; col++) {
4944
- json[names[col]] = values[col];
4945
- }
4946
-
4947
- const scriptingMemory = {
4948
- header: {
4949
- name: caseName
4950
- },
4951
- values: json
4952
- };
4953
- scriptingMemories.push(scriptingMemory);
5174
+ if (scriptingMemories && scriptingMemories.length > 0) {
5175
+ this.context.AddScriptingMemories(scriptingMemories);
4954
5176
  }
4955
5177
 
4956
- this.context.AddScriptingMemories(scriptingMemories);
4957
5178
  return scriptingMemories;
4958
5179
  }
4959
5180
  }
@@ -4997,6 +5218,9 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
4997
5218
 
4998
5219
  };
4999
5220
 
5221
+ const {
5222
+ parse
5223
+ } = sync;
5000
5224
  const debug$c = debug$l('botium-core-CompilerCsv');
5001
5225
  const {
5002
5226
  Convo: Convo$3
@@ -5069,7 +5293,7 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
5069
5293
  let rows;
5070
5294
 
5071
5295
  try {
5072
- rows = sync(scriptData, {
5296
+ rows = parse(scriptData, {
5073
5297
  delimiter,
5074
5298
  escape: this.caps[Capabilities.SCRIPTING_CSV_ESCAPE],
5075
5299
  quote: this.caps[Capabilities.SCRIPTING_CSV_QUOTE],
@@ -5208,7 +5432,8 @@ const {
5208
5432
  } = Convo_1;
5209
5433
  const {
5210
5434
  linesToConvoStep: linesToConvoStep$1,
5211
- validSenders: validSenders$1
5435
+ validSenders: validSenders$1,
5436
+ linesToScriptingMemories
5212
5437
  } = helper;
5213
5438
  var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
5214
5439
  constructor(context, caps = {}) {
@@ -5317,29 +5542,12 @@ var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
5317
5542
  if (lines && lines.length > 0) {
5318
5543
  if (lodash.isString(lines[0])) {
5319
5544
  if (lines.length > 1) {
5320
- const names = lines[0].split('|').map(name => name.trim()).slice(1);
5321
- const scriptingMemories = [];
5545
+ const scriptingMemories = linesToScriptingMemories(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
5322
5546
 
5323
- for (let row = 1; row < lines.length; row++) {
5324
- const rawRow = lines[row].split('|').map(name => name.trim());
5325
- const caseName = rawRow[0];
5326
- const values = rawRow.slice(1);
5327
- const json = {};
5328
-
5329
- for (let col = 0; col < names.length; col++) {
5330
- json[names[col]] = values[col];
5331
- }
5332
-
5333
- const scriptingMemory = {
5334
- header: {
5335
- name: caseName
5336
- },
5337
- values: json
5338
- };
5339
- scriptingMemories.push(scriptingMemory);
5547
+ if (scriptingMemories && scriptingMemories.length > 0) {
5548
+ this.context.AddScriptingMemories(scriptingMemories);
5340
5549
  }
5341
5550
 
5342
- this.context.AddScriptingMemories(scriptingMemories);
5343
5551
  return scriptingMemories;
5344
5552
  }
5345
5553
  } else {
@@ -5532,7 +5740,7 @@ const {
5532
5740
  ConvoStep
5533
5741
  } = Convo_1;
5534
5742
  const {
5535
- BotiumError: BotiumError$1,
5743
+ BotiumError: BotiumError$2,
5536
5744
  botiumErrorFromList,
5537
5745
  botiumErrorFromErr
5538
5746
  } = BotiumError_1;
@@ -5812,7 +6020,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
5812
6020
  message += ' expected to match ';
5813
6021
  message += tomatch && tomatch.length > 1 ? 'one of ' : '';
5814
6022
  message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5815
- throw new BotiumError$1(message, {
6023
+ throw new BotiumError$2(message, {
5816
6024
  type: 'asserter',
5817
6025
  source: 'TextMatchAsserter',
5818
6026
  context: {
@@ -5842,7 +6050,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
5842
6050
  message += ' expected NOT to match ';
5843
6051
  message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
5844
6052
  message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5845
- throw new BotiumError$1(message, {
6053
+ throw new BotiumError$2(message, {
5846
6054
  type: 'asserter',
5847
6055
  source: 'TextMatchAsserter',
5848
6056
  context: {
@@ -5889,7 +6097,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
5889
6097
  if (asserter[notAsserterType]) {
5890
6098
  return p(this.retryHelperAsserter, () => asserter[notAsserterType](params));
5891
6099
  } else {
5892
- return pnot(this.retryHelperAsserter, () => asserter[asserterType](params), new BotiumError$1(`${convoStep.stepTag}: Expected asserter ${asserter.name || asserterSpec.name} with args "${params.args}" to fail`, {
6100
+ return pnot(this.retryHelperAsserter, () => asserter[asserterType](params), new BotiumError$2(`${convoStep.stepTag}: Expected asserter ${asserter.name || asserterSpec.name} with args "${params.args}" to fail`, {
5893
6101
  type: 'asserter',
5894
6102
  source: asserter.name || asserterSpec.name,
5895
6103
  params: {
@@ -6174,11 +6382,37 @@ var ScriptingProvider_1 = class ScriptingProvider {
6174
6382
  };
6175
6383
  }
6176
6384
 
6385
+ ReadScriptFromBuffer(scriptBuffer, scriptingFormat, scriptingTypes = null) {
6386
+ if (lodash.isString(scriptingTypes)) scriptingTypes = [scriptingTypes];
6387
+ if (lodash.isArray(scriptingTypes) && scriptingTypes.length === 0) scriptingTypes = null;
6388
+ const result = {
6389
+ convos: [],
6390
+ utterances: [],
6391
+ pconvos: [],
6392
+ scriptingMemories: []
6393
+ };
6394
+
6395
+ if (!scriptingTypes || scriptingTypes.includes(Constants.SCRIPTING_TYPE_UTTERANCES)) {
6396
+ result.utterances = this.Compile(scriptBuffer, scriptingFormat, Constants.SCRIPTING_TYPE_UTTERANCES);
6397
+ }
6398
+
6399
+ if (!scriptingTypes || scriptingTypes.includes(Constants.SCRIPTING_TYPE_PCONVO)) {
6400
+ result.pconvos = this.Compile(scriptBuffer, scriptingFormat, Constants.SCRIPTING_TYPE_PCONVO);
6401
+ }
6402
+
6403
+ if (!scriptingTypes || scriptingTypes.includes(Constants.SCRIPTING_TYPE_CONVO)) {
6404
+ result.convos = this.Compile(scriptBuffer, scriptingFormat, Constants.SCRIPTING_TYPE_CONVO);
6405
+ }
6406
+
6407
+ if (!scriptingTypes || scriptingTypes.includes(Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY)) {
6408
+ result.scriptingMemories = this.Compile(scriptBuffer, scriptingFormat, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY);
6409
+ }
6410
+
6411
+ return result;
6412
+ }
6413
+
6177
6414
  ReadScript(convoDir, filename) {
6178
- let fileConvos = [];
6179
- let fileUtterances = [];
6180
- let filePartialConvos = [];
6181
- let fileScriptingMemories = [];
6415
+ let result = {};
6182
6416
 
6183
6417
  try {
6184
6418
  let scriptBuffer = fs.readFileSync(path.resolve(convoDir, filename));
@@ -6195,36 +6429,25 @@ var ScriptingProvider_1 = class ScriptingProvider {
6195
6429
  }
6196
6430
 
6197
6431
  if (filename.endsWith('.xlsx') || filename.endsWith('.xlsm')) {
6198
- fileUtterances = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_XSLX, Constants.SCRIPTING_TYPE_UTTERANCES);
6199
- filePartialConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_XSLX, Constants.SCRIPTING_TYPE_PCONVO);
6200
- fileConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_XSLX, Constants.SCRIPTING_TYPE_CONVO);
6201
- fileScriptingMemories = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_XSLX, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY);
6432
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_XSLX, [Constants.SCRIPTING_TYPE_UTTERANCES, Constants.SCRIPTING_TYPE_PCONVO, Constants.SCRIPTING_TYPE_CONVO, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY]);
6202
6433
  } else if (filename.endsWith('.convo.txt')) {
6203
- fileConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_CONVO);
6434
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_CONVO);
6204
6435
  } else if (filename.endsWith('.pconvo.txt')) {
6205
- filePartialConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_PCONVO);
6436
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_PCONVO);
6206
6437
  } else if (filename.endsWith('.utterances.txt')) {
6207
- fileUtterances = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_UTTERANCES);
6438
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_UTTERANCES);
6208
6439
  } else if (filename.endsWith('.scriptingmemory.txt')) {
6209
- fileScriptingMemories = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY);
6440
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_TXT, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY);
6210
6441
  } else if (filename.endsWith('.convo.csv')) {
6211
- fileConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_CONVO);
6442
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_CONVO);
6212
6443
  } else if (filename.endsWith('.pconvo.csv')) {
6213
- filePartialConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_PCONVO);
6444
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_CSV, Constants.SCRIPTING_TYPE_PCONVO);
6214
6445
  } else if (filename.endsWith('.yaml') || filename.endsWith('.yml')) {
6215
- fileUtterances = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_YAML, Constants.SCRIPTING_TYPE_UTTERANCES);
6216
- filePartialConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_YAML, Constants.SCRIPTING_TYPE_PCONVO);
6217
- fileConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_YAML, Constants.SCRIPTING_TYPE_CONVO);
6218
- fileScriptingMemories = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_YAML, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY);
6446
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_YAML, [Constants.SCRIPTING_TYPE_UTTERANCES, Constants.SCRIPTING_TYPE_PCONVO, Constants.SCRIPTING_TYPE_CONVO, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY]);
6219
6447
  } else if (filename.endsWith('.json')) {
6220
- fileUtterances = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_JSON, Constants.SCRIPTING_TYPE_UTTERANCES);
6221
- filePartialConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_JSON, Constants.SCRIPTING_TYPE_PCONVO);
6222
- fileConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_JSON, Constants.SCRIPTING_TYPE_CONVO);
6223
- fileScriptingMemories = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_JSON, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY);
6448
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_JSON, [Constants.SCRIPTING_TYPE_UTTERANCES, Constants.SCRIPTING_TYPE_PCONVO, Constants.SCRIPTING_TYPE_CONVO, Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY]);
6224
6449
  } else if (filename.endsWith('.markdown') || filename.endsWith('.md')) {
6225
- fileUtterances = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_MARKDOWN, Constants.SCRIPTING_TYPE_UTTERANCES);
6226
- fileConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_MARKDOWN, Constants.SCRIPTING_TYPE_CONVO);
6227
- filePartialConvos = this.Compile(scriptBuffer, Constants.SCRIPTING_FORMAT_MARKDOWN, Constants.SCRIPTING_TYPE_PCONVO);
6450
+ result = this.ReadScriptFromBuffer(scriptBuffer, Constants.SCRIPTING_FORMAT_MARKDOWN, [Constants.SCRIPTING_TYPE_UTTERANCES, Constants.SCRIPTING_TYPE_PCONVO, Constants.SCRIPTING_TYPE_CONVO]);
6228
6451
  } else {
6229
6452
  debug$9(`ReadScript - dropped file: ${filename}, filename not supported`);
6230
6453
  }
@@ -6234,8 +6457,8 @@ var ScriptingProvider_1 = class ScriptingProvider {
6234
6457
  } // Compilers saved the convos, and we alter here the saved version too
6235
6458
 
6236
6459
 
6237
- if (fileConvos) {
6238
- fileConvos.forEach(fileConvo => {
6460
+ if (result.convos && result.convos.length > 0) {
6461
+ result.convos.forEach(fileConvo => {
6239
6462
  fileConvo.sourceTag = {
6240
6463
  convoDir,
6241
6464
  filename
@@ -6248,12 +6471,12 @@ var ScriptingProvider_1 = class ScriptingProvider {
6248
6471
 
6249
6472
  const isSkip = c => c.header.name && skipPattern.test(c.header.name.toLowerCase());
6250
6473
 
6251
- fileConvos.filter(c => isSkip(c)).forEach(c => debug$9(`ReadScript - skipping convo '${c.header.name}'`));
6252
- fileConvos = fileConvos.filter(c => !isSkip(c));
6474
+ result.convos.filter(c => isSkip(c)).forEach(c => debug$9(`ReadScript - skipping convo '${c.header.name}'`));
6475
+ result.convos = result.convos.filter(c => !isSkip(c));
6253
6476
  }
6254
6477
 
6255
- if (filePartialConvos) {
6256
- filePartialConvos.forEach(filePartialConvo => {
6478
+ if (result.pconvos && result.pconvos.length > 0) {
6479
+ result.pconvos.forEach(filePartialConvo => {
6257
6480
  filePartialConvo.sourceTag = {
6258
6481
  convoDir,
6259
6482
  filename
@@ -6265,23 +6488,23 @@ var ScriptingProvider_1 = class ScriptingProvider {
6265
6488
  });
6266
6489
  }
6267
6490
 
6268
- if (fileScriptingMemories && fileScriptingMemories.length) {
6269
- fileScriptingMemories.forEach(scriptingMemory => {
6491
+ if (result.scriptingMemories && result.scriptingMemories.length > 0) {
6492
+ result.scriptingMemories.forEach(scriptingMemory => {
6270
6493
  scriptingMemory.sourceTag = {
6271
6494
  filename
6272
6495
  };
6273
6496
  });
6274
6497
  }
6275
6498
 
6276
- if (fileUtterances) {
6277
- this.fileUtterances = this._tagAndCleanupUtterances(fileUtterances, convoDir, filename);
6499
+ if (result.utterances) {
6500
+ result.utterances = this._tagAndCleanupUtterances(result.utterances, convoDir, filename);
6278
6501
  }
6279
6502
 
6280
6503
  return {
6281
- convos: fileConvos,
6282
- utterances: fileUtterances,
6283
- pconvos: filePartialConvos,
6284
- scriptingMemories: fileScriptingMemories
6504
+ convos: result.convos || [],
6505
+ utterances: result.utterances || [],
6506
+ pconvos: result.pconvos || [],
6507
+ scriptingMemories: result.scriptingMemories || []
6285
6508
  };
6286
6509
  }
6287
6510
 
@@ -6308,7 +6531,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6308
6531
  });
6309
6532
 
6310
6533
  if (aggregatedNoNames.length) {
6311
- throw new BotiumError$1('Scripting Memory Definition(s) without name', {
6534
+ throw new BotiumError$2('Scripting Memory Definition(s) without name', {
6312
6535
  type: 'Scripting Memory',
6313
6536
  subtype: 'Scripting Memory without name',
6314
6537
  source: 'ScriptingProvider',
@@ -6324,7 +6547,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6324
6547
  });
6325
6548
 
6326
6549
  if (aggregatedNoVariables.length) {
6327
- throw new BotiumError$1(`Scripting Memory Definition(s) ${aggregatedNoVariables.map(e => e.header.name).join(', ')} without variable`, {
6550
+ throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariables.map(e => e.header.name).join(', ')} without variable`, {
6328
6551
  type: 'Scripting Memory',
6329
6552
  subtype: 'Scripting Memory without variable',
6330
6553
  source: 'ScriptingProvider',
@@ -6340,7 +6563,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6340
6563
  });
6341
6564
 
6342
6565
  if (aggregatedNoVariableNames.length) {
6343
- throw new BotiumError$1(`Scripting Memory Definition(s) ${aggregatedNoVariableNames.map(e => e.header.name).join(', ')} without variable name`, {
6566
+ throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariableNames.map(e => e.header.name).join(', ')} without variable name`, {
6344
6567
  type: 'Scripting Memory',
6345
6568
  subtype: 'Scripting Memory without variable name',
6346
6569
  source: 'ScriptingProvider',
@@ -6372,7 +6595,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6372
6595
  }
6373
6596
 
6374
6597
  if (aggregatedDuplicates.length) {
6375
- throw new BotiumError$1(`Scripting Memory Definition name(s) "${lodash.uniq(aggregatedDuplicates.map(d => d.scriptingMemory.header.name)).join(', ')}" are not unique`, {
6598
+ throw new BotiumError$2(`Scripting Memory Definition name(s) "${lodash.uniq(aggregatedDuplicates.map(d => d.scriptingMemory.header.name)).join(', ')}" are not unique`, {
6376
6599
  type: 'Scripting Memory',
6377
6600
  subtype: 'Scripting Memory name collision',
6378
6601
  source: 'ScriptingProvider',
@@ -6409,7 +6632,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6409
6632
  }
6410
6633
 
6411
6634
  if (aggregatedIntersections.length) {
6412
- throw new BotiumError$1(`Scripting Memory Definitions "${aggregatedIntersections.map(i => i.scriptingMemory.header.name).join(', ')}" are invalid because variable name collision"`, {
6635
+ throw new BotiumError$2(`Scripting Memory Definitions "${aggregatedIntersections.map(i => i.scriptingMemory.header.name).join(', ')}" are invalid because variable name collision"`, {
6413
6636
  type: 'Scripting Memory',
6414
6637
  subtype: 'Scripting Memory variable name collision',
6415
6638
  source: 'ScriptingProvider',
@@ -6498,6 +6721,8 @@ var ScriptingProvider_1 = class ScriptingProvider {
6498
6721
 
6499
6722
  debug$9(`ExpandScriptingMemoryToConvos - ${convosExpandedAll.length} convo expanded, added to convos (${this.convos.length}). Result ${convosExpandedAll.length + this.convos.length} convo`);
6500
6723
  this.convos = this.convos.concat(convosExpandedAll);
6724
+
6725
+ this._sortConvos();
6501
6726
  }
6502
6727
 
6503
6728
  ExpandUtterancesToConvos({
@@ -6537,6 +6762,9 @@ var ScriptingProvider_1 = class ScriptingProvider {
6537
6762
  },
6538
6763
  conversation: [{
6539
6764
  sender: 'me',
6765
+ logicHooks: [{
6766
+ name: 'SKIP_BOT_UNCONSUMED'
6767
+ }],
6540
6768
  messageText: utt.name,
6541
6769
  stepTag: 'Step 1 - tell utterance'
6542
6770
  }, useNameAsIntent ? {
@@ -6731,7 +6959,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6731
6959
  }
6732
6960
  } else {
6733
6961
  expandedConvos.push(Object.assign(lodash.cloneDeep(currentConvo), {
6734
- conversation: convoStepsStack
6962
+ conversation: lodash.cloneDeep(convoStepsStack)
6735
6963
  }));
6736
6964
  }
6737
6965
  }
@@ -6852,7 +7080,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6852
7080
  }
6853
7081
  } else if (scriptingMemories) {
6854
7082
  if (!scriptingMemories.header || !scriptingMemories.header.name) {
6855
- throw new BotiumError$1('Scripting Memory Definition has no name', {
7083
+ throw new BotiumError$2('Scripting Memory Definition has no name', {
6856
7084
  type: 'Compiler',
6857
7085
  subtype: 'Scripting memory without name',
6858
7086
  source: 'ScriptingProvider',
@@ -6863,7 +7091,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6863
7091
  }
6864
7092
 
6865
7093
  if (!scriptingMemories.values || !Object.keys(scriptingMemories.values).length) {
6866
- throw new BotiumError$1('Scripting Memory Definition has no variables', {
7094
+ throw new BotiumError$2('Scripting Memory Definition has no variables', {
6867
7095
  type: 'Compiler',
6868
7096
  subtype: 'Scripting memory without variable',
6869
7097
  source: 'ScriptingProvider',
@@ -6874,7 +7102,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6874
7102
  }
6875
7103
 
6876
7104
  if (scriptingMemories.values && !lodash.isUndefined(scriptingMemories.values[''])) {
6877
- throw new BotiumError$1('Scripting Memory Definition variable has no name', {
7105
+ throw new BotiumError$2('Scripting Memory Definition variable has no name', {
6878
7106
  type: 'Compiler',
6879
7107
  subtype: 'Scripting memory without variable name',
6880
7108
  source: 'ScriptingProvider',
@@ -7836,6 +8064,9 @@ const {
7836
8064
  const {
7837
8065
  escapeJSONString
7838
8066
  } = Utils;
8067
+ const {
8068
+ BotiumError: BotiumError$1
8069
+ } = BotiumError_1;
7839
8070
 
7840
8071
  mustache.escape = s => s;
7841
8072
 
@@ -8220,6 +8451,22 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8220
8451
  } else {
8221
8452
  if (response.statusCode >= 400) {
8222
8453
  debug$4(`got error response: ${response.statusCode}/${response.statusMessage}`);
8454
+
8455
+ if (debug$4.enabled && body) {
8456
+ debug$4(Utils.shortenJsonString(body));
8457
+ }
8458
+
8459
+ if (body) {
8460
+ const jsonBody = Utils.toJsonWeak(body);
8461
+ const errKey = Object.keys(jsonBody).find(k => k.startsWith('err') || k.startsWith('fail'));
8462
+
8463
+ if (errKey) {
8464
+ return reject(new BotiumError$1(`got error response: ${response.statusCode}/${response.statusMessage} - ${jsonBody[errKey]}`, {
8465
+ message: Utils.shortenJsonString(body)
8466
+ }));
8467
+ }
8468
+ }
8469
+
8223
8470
  return reject(new Error(`got error response: ${response.statusCode}/${response.statusMessage}`));
8224
8471
  }
8225
8472
 
@@ -8317,6 +8564,16 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8317
8564
  }
8318
8565
  }
8319
8566
 
8567
+ if (msg.ADD_FORM_PARAM && Object.keys(msg.ADD_FORM_PARAM).length > 0) {
8568
+ requestOptions.form = {};
8569
+
8570
+ for (const formKey of Object.keys(msg.ADD_FORM_PARAM)) {
8571
+ const formValue = this._getMustachedVal(lodash.isString(msg.ADD_FORM_PARAM[formKey]) ? msg.ADD_FORM_PARAM[formKey] : JSON.stringify(msg.ADD_FORM_PARAM[formKey]), false);
8572
+
8573
+ requestOptions.form[formKey] = formValue;
8574
+ }
8575
+ }
8576
+
8320
8577
  if (msg.ADD_HEADER && Object.keys(msg.ADD_HEADER).length > 0) {
8321
8578
  requestOptions.headers = requestOptions.headers || {};
8322
8579
 
@@ -8373,9 +8630,19 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8373
8630
  await timeout(pingConfig.timeout);
8374
8631
  } else if (response.statusCode >= 400) {
8375
8632
  debug$4(`_waitForUrlResponse on url check ${pingConfig.uri} got error response: ${response.statusCode}/${response.statusMessage}`);
8633
+
8634
+ if (debug$4.enabled && body) {
8635
+ debug$4(Utils.shortenJsonString(body));
8636
+ }
8637
+
8376
8638
  await timeout(pingConfig.timeout);
8377
8639
  } else {
8378
- debug$4(`_waitForUrlResponse success on url check ${pingConfig.uri}`);
8640
+ debug$4(`_waitForUrlResponse success on url check ${pingConfig.uri}: ${response.statusCode}/${response.statusMessage}`);
8641
+
8642
+ if (debug$4.enabled && body) {
8643
+ debug$4(Utils.shortenJsonString(body));
8644
+ }
8645
+
8379
8646
  return body;
8380
8647
  }
8381
8648
  }
@@ -8599,6 +8866,10 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8599
8866
  } else {
8600
8867
  if (response.statusCode >= 400) {
8601
8868
  debug$4(`_runPolling: got error response: ${response.statusCode}/${response.statusMessage}, request: ${JSON.stringify(pollConfig)}`);
8869
+
8870
+ if (debug$4.enabled && body) {
8871
+ debug$4(Utils.shortenJsonString(body));
8872
+ }
8602
8873
  } else if (body) {
8603
8874
  debug$4(`_runPolling: got response code: ${response.statusCode}, body: ${Utils.shortenJsonString(body)}`);
8604
8875
 
@@ -9573,6 +9844,7 @@ var botiumCore = {
9573
9844
  ScriptingConstants: Constants,
9574
9845
  Capabilities: Capabilities,
9575
9846
  Defaults: Defaults$1,
9847
+ Enums: Enums,
9576
9848
  Source: Source,
9577
9849
  Events: Events,
9578
9850
  Plugins: Plugins,
@@ -9592,16 +9864,17 @@ var botiumCore_2 = botiumCore.ScriptingProvider;
9592
9864
  var botiumCore_3 = botiumCore.ScriptingConstants;
9593
9865
  var botiumCore_4 = botiumCore.Capabilities;
9594
9866
  var botiumCore_5 = botiumCore.Defaults;
9595
- var botiumCore_6 = botiumCore.Source;
9596
- var botiumCore_7 = botiumCore.Events;
9597
- var botiumCore_8 = botiumCore.Plugins;
9598
- var botiumCore_9 = botiumCore.BotiumError;
9599
- var botiumCore_10 = botiumCore.ScriptingMemory;
9600
- var botiumCore_11 = botiumCore.HookUtils;
9601
- var botiumCore_12 = botiumCore.LogicHookConstants;
9602
- var botiumCore_13 = botiumCore.Lib;
9603
- var botiumCore_14 = botiumCore.InboundProxy;
9604
- var botiumCore_15 = botiumCore.BotiumMockRichMessageTypes;
9605
-
9606
- export { botiumCore_1 as BotDriver, botiumCore_9 as BotiumError, botiumCore_15 as BotiumMockRichMessageTypes, botiumCore_4 as Capabilities, botiumCore_5 as Defaults, botiumCore_7 as Events, botiumCore_11 as HookUtils, botiumCore_14 as InboundProxy, botiumCore_13 as Lib, botiumCore_12 as LogicHookConstants, botiumCore_8 as Plugins, botiumCore_3 as ScriptingConstants, botiumCore_10 as ScriptingMemory, botiumCore_2 as ScriptingProvider, botiumCore_6 as Source, botiumCore as default };
9867
+ var botiumCore_6 = botiumCore.Enums;
9868
+ var botiumCore_7 = botiumCore.Source;
9869
+ var botiumCore_8 = botiumCore.Events;
9870
+ var botiumCore_9 = botiumCore.Plugins;
9871
+ var botiumCore_10 = botiumCore.BotiumError;
9872
+ var botiumCore_11 = botiumCore.ScriptingMemory;
9873
+ var botiumCore_12 = botiumCore.HookUtils;
9874
+ var botiumCore_13 = botiumCore.LogicHookConstants;
9875
+ var botiumCore_14 = botiumCore.Lib;
9876
+ var botiumCore_15 = botiumCore.InboundProxy;
9877
+ var botiumCore_16 = botiumCore.BotiumMockRichMessageTypes;
9878
+
9879
+ export { botiumCore_1 as BotDriver, botiumCore_10 as BotiumError, botiumCore_16 as BotiumMockRichMessageTypes, botiumCore_4 as Capabilities, botiumCore_5 as Defaults, botiumCore_6 as Enums, botiumCore_8 as Events, botiumCore_12 as HookUtils, botiumCore_15 as InboundProxy, botiumCore_14 as Lib, botiumCore_13 as LogicHookConstants, botiumCore_9 as Plugins, botiumCore_3 as ScriptingConstants, botiumCore_11 as ScriptingMemory, botiumCore_2 as ScriptingProvider, botiumCore_7 as Source, botiumCore as default };
9607
9880
  //# sourceMappingURL=botium-es.js.map