botium-core 1.11.16 → 1.12.0

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.
@@ -27,7 +27,7 @@ var isJson$1 = require('is-json');
27
27
  var esprima = require('esprima');
28
28
  var markdownIt = require('markdown-it');
29
29
  var xlsx = require('xlsx');
30
- var sync = require('csv-parse/lib/sync');
30
+ var sync = require('csv-parse/sync');
31
31
  var yaml = require('yaml');
32
32
  var child_process = require('child_process');
33
33
  var socket = require('socket.io-client');
@@ -79,12 +79,12 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
79
79
  var bodyParser__default = /*#__PURE__*/_interopDefaultLegacy(bodyParser);
80
80
 
81
81
  var name = "botium-core";
82
- var version$1 = "1.11.16";
82
+ var version$1 = "1.12.0";
83
83
  var description = "The Selenium for Chatbots";
84
84
  var main = "index.js";
85
85
  var module$1 = "dist/botium-es.js";
86
86
  var engines = {
87
- node: ">=10.0.0"
87
+ node: ">=14.0.0"
88
88
  };
89
89
  var scripts = {
90
90
  postinstall: "node ./report.js",
@@ -111,23 +111,23 @@ var bugs = {
111
111
  };
112
112
  var homepage = "https://www.botium.ai";
113
113
  var dependencies = {
114
- "@babel/runtime": "^7.16.0",
114
+ "@babel/runtime": "^7.16.5",
115
115
  async: "^3.2.2",
116
- "body-parser": "^1.19.0",
116
+ "body-parser": "^1.19.1",
117
117
  boolean: "^3.1.4",
118
118
  bottleneck: "^2.19.5",
119
- "csv-parse": "^4.16.3",
120
- debug: "^4.3.2",
119
+ "csv-parse": "^5.0.3",
120
+ debug: "^4.3.3",
121
121
  esprima: "^4.0.1",
122
- express: "^4.17.1",
122
+ express: "^4.17.2",
123
123
  globby: "11.0.4",
124
- ioredis: "^4.28.0",
124
+ ioredis: "^4.28.2",
125
125
  "is-class": "^0.0.9",
126
126
  "is-json": "^2.0.1",
127
127
  jsonpath: "^1.1.1",
128
128
  lodash: "^4.17.21",
129
- "markdown-it": "^12.2.0",
130
- "mime-types": "^2.1.33",
129
+ "markdown-it": "^12.3.0",
130
+ "mime-types": "^2.1.34",
131
131
  mkdirp: "^1.0.4",
132
132
  moment: "^2.29.1",
133
133
  mustache: "^4.2.0",
@@ -137,40 +137,40 @@ var dependencies = {
137
137
  request: "^2.88.2",
138
138
  rimraf: "^3.0.2",
139
139
  "sanitize-filename": "^1.6.3",
140
- slugify: "^1.6.1",
141
- "socket.io": "^4.3.1",
142
- "socket.io-client": "^4.3.2",
140
+ slugify: "^1.6.4",
141
+ "socket.io": "^4.4.0",
142
+ "socket.io-client": "^4.4.0",
143
143
  "socketio-auth": "^0.1.1",
144
144
  "swagger-jsdoc": "^6.1.0",
145
- "swagger-ui-express": "^4.1.6",
145
+ "swagger-ui-express": "^4.3.0",
146
146
  uuid: "^8.3.2",
147
147
  vm2: "^3.9.5",
148
148
  "write-yaml": "^1.0.0",
149
- xlsx: "^0.17.3",
149
+ xlsx: "^0.17.4",
150
150
  xregexp: "^5.1.0",
151
151
  yaml: "^1.10.2"
152
152
  };
153
153
  var devDependencies = {
154
- "@babel/core": "^7.16.0",
155
- "@babel/node": "^7.16.0",
156
- "@babel/plugin-transform-runtime": "^7.16.0",
157
- "@babel/preset-env": "^7.16.0",
154
+ "@babel/core": "^7.16.5",
155
+ "@babel/node": "^7.16.5",
156
+ "@babel/plugin-transform-runtime": "^7.16.5",
157
+ "@babel/preset-env": "^7.16.5",
158
158
  chai: "^4.3.4",
159
159
  "chai-as-promised": "^7.1.1",
160
160
  "cross-env": "^7.0.3",
161
- eslint: "^8.1.0",
161
+ eslint: "^8.4.1",
162
162
  "eslint-config-standard": "^16.0.3",
163
- "eslint-plugin-import": "^2.25.2",
163
+ "eslint-plugin-import": "^2.25.3",
164
164
  "eslint-plugin-node": "^11.1.0",
165
- "eslint-plugin-promise": "^5.1.1",
165
+ "eslint-plugin-promise": "^5.2.0",
166
166
  "eslint-plugin-standard": "^4.1.0",
167
167
  "license-checker": "^25.0.1",
168
168
  "license-compatibility-checker": "^0.3.5",
169
169
  mocha: "^9.1.3",
170
- nock: "^13.1.4",
171
- "npm-check-updates": "^12.0.0",
170
+ nock: "^13.2.1",
171
+ "npm-check-updates": "^12.0.5",
172
172
  nyc: "^15.1.0",
173
- rollup: "^2.59.0",
173
+ rollup: "^2.61.1",
174
174
  "rollup-plugin-babel": "^4.4.0",
175
175
  "rollup-plugin-commonjs": "^10.1.0",
176
176
  "rollup-plugin-json": "^4.0.0",
@@ -874,7 +874,7 @@ function getCjsExportFromNamespace (n) {
874
874
  return n && n['default'] || n;
875
875
  }
876
876
 
877
- const BotiumError$6 = class BotiumError extends Error {
877
+ const BotiumError$7 = class BotiumError extends Error {
878
878
  /**
879
879
  *
880
880
  * @param message
@@ -960,10 +960,10 @@ const _getChildErrorsFromContext = context => {
960
960
  };
961
961
 
962
962
  const botiumErrorFromErr$2 = (message, err) => {
963
- if (err instanceof BotiumError$6) {
964
- return new BotiumError$6(message, err.context, true);
963
+ if (err instanceof BotiumError$7) {
964
+ return new BotiumError$7(message, err.context, true);
965
965
  } else {
966
- return new BotiumError$6(message, {
966
+ return new BotiumError$7(message, {
967
967
  err
968
968
  }, true);
969
969
  }
@@ -978,7 +978,7 @@ const botiumErrorFromList$2 = (errors, {
978
978
  let children = [];
979
979
 
980
980
  for (const error of errors) {
981
- if (error instanceof BotiumError$6) {
981
+ if (error instanceof BotiumError$7) {
982
982
  const childErrors = flat && _getChildErrorsFromContext(error.context);
983
983
 
984
984
  if (childErrors && childErrors.length) {
@@ -991,7 +991,7 @@ const botiumErrorFromList$2 = (errors, {
991
991
  }
992
992
  }
993
993
 
994
- const result = new BotiumError$6(message, {
994
+ const result = new BotiumError$7(message, {
995
995
  errors: children,
996
996
  type,
997
997
  source
@@ -1000,7 +1000,7 @@ const botiumErrorFromList$2 = (errors, {
1000
1000
  };
1001
1001
 
1002
1002
  var BotiumError_1 = {
1003
- BotiumError: BotiumError$6,
1003
+ BotiumError: BotiumError$7,
1004
1004
  botiumErrorFromErr: botiumErrorFromErr$2,
1005
1005
  botiumErrorFromList: botiumErrorFromList$2
1006
1006
  };
@@ -1181,7 +1181,7 @@ const {
1181
1181
  } = vm2__default["default"];
1182
1182
  const debug$k = debug__default["default"]('botium-core-asserterUtils');
1183
1183
  const {
1184
- BotiumError: BotiumError$5
1184
+ BotiumError: BotiumError$6
1185
1185
  } = BotiumError_1;
1186
1186
  const {
1187
1187
  DEFAULT_ASSERTERS,
@@ -1332,7 +1332,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
1332
1332
 
1333
1333
  const _checkUnsafe = () => {
1334
1334
  if (!this.caps[Capabilities.SECURITY_ALLOW_UNSAFE]) {
1335
- throw new BotiumError$5('Security Error. Using unsafe component is not allowed', {
1335
+ throw new BotiumError$6('Security Error. Using unsafe component is not allowed', {
1336
1336
  type: 'security',
1337
1337
  subtype: 'allow unsafe',
1338
1338
  source: path__default["default"].basename(__filename),
@@ -1476,6 +1476,11 @@ var LogicHookUtils_1 = class LogicHookUtils {
1476
1476
  ref,
1477
1477
  ...this.buildScriptContext
1478
1478
  }, this.caps, args);
1479
+ } else if (lodash__default["default"].isFunction(CheckClass.PluginClass)) {
1480
+ return CheckClass.PluginClass({
1481
+ ref,
1482
+ ...this.buildScriptContext
1483
+ }, this.caps, args);
1479
1484
  } else {
1480
1485
  throw new Error(`${src} class or function expected`);
1481
1486
  }
@@ -2286,7 +2291,7 @@ const {
2286
2291
  toString: toString$2
2287
2292
  } = helper;
2288
2293
  const {
2289
- BotiumError: BotiumError$4
2294
+ BotiumError: BotiumError$5
2290
2295
  } = BotiumError_1; // If they got parameter, then it will be a string always.
2291
2296
  // the receiver can decide what to do with it,
2292
2297
  // convert to int,
@@ -2455,7 +2460,7 @@ const SCRIPTING_FUNCTIONS$1 = lodash__default["default"].mapValues(SCRIPTING_FUN
2455
2460
  return {
2456
2461
  handler: (caps, ...rest) => {
2457
2462
  if (!caps[Capabilities.SECURITY_ALLOW_UNSAFE] && funcOrStruct.unsafe) {
2458
- throw new BotiumError$4(`Security Error. Using unsafe scripting memory function ${name} is not allowed`, {
2463
+ throw new BotiumError$5(`Security Error. Using unsafe scripting memory function ${name} is not allowed`, {
2459
2464
  type: 'security',
2460
2465
  subtype: 'allow unsafe',
2461
2466
  source: path__default["default"].basename(__filename),
@@ -2604,7 +2609,7 @@ ScriptingMemory.SCRIPTING_FUNCTIONS;
2604
2609
 
2605
2610
  const debug$i = debug__default["default"]('botium-core-Convo');
2606
2611
  const {
2607
- BotiumError: BotiumError$3,
2612
+ BotiumError: BotiumError$4,
2608
2613
  botiumErrorFromErr: botiumErrorFromErr$1,
2609
2614
  botiumErrorFromList: botiumErrorFromList$1
2610
2615
  } = BotiumError_1;
@@ -3133,7 +3138,7 @@ class Convo$6 {
3133
3138
  }
3134
3139
 
3135
3140
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
3136
- const failErr = new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
3141
+ const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
3137
3142
  debug$i(failErr);
3138
3143
 
3139
3144
  try {
@@ -3236,7 +3241,7 @@ class Convo$6 {
3236
3241
  this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
3237
3242
  } catch (failErr) {}
3238
3243
 
3239
- if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$3) {
3244
+ if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$4) {
3240
3245
  assertErrors.push(err);
3241
3246
  } else {
3242
3247
  throw failErr;
@@ -3253,7 +3258,7 @@ class Convo$6 {
3253
3258
  }
3254
3259
  }
3255
3260
  } else {
3256
- const failErr = new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util__default["default"].inspect(convoStep.sender)}`);
3261
+ const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util__default["default"].inspect(convoStep.sender)}`);
3257
3262
  debug$i(failErr);
3258
3263
 
3259
3264
  try {
@@ -3264,7 +3269,7 @@ class Convo$6 {
3264
3269
  }
3265
3270
  } catch (err) {
3266
3271
  if (lastMeConvoStep) {
3267
- if (err instanceof BotiumError$3 && err.context) {
3272
+ if (err instanceof BotiumError$4 && err.context) {
3268
3273
  err.context.input = new ConvoStep$1(lastMeConvoStep);
3269
3274
  err.context.transcript = [...transcriptSteps, { ...transcriptStep
3270
3275
  }];
@@ -3299,11 +3304,11 @@ class Convo$6 {
3299
3304
 
3300
3305
  if (lodash__default["default"].isArray(expected)) {
3301
3306
  if (!lodash__default["default"].isArray(result)) {
3302
- throw new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot response expected array, got "${result}"`);
3307
+ throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array, got "${result}"`);
3303
3308
  }
3304
3309
 
3305
3310
  if (expected.length !== result.length) {
3306
- throw new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot response expected array length ${expected.length}, got ${result.length}`);
3311
+ throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array length ${expected.length}, got ${result.length}`);
3307
3312
  }
3308
3313
 
3309
3314
  for (let i = 0; i < expected.length; i++) {
@@ -3314,7 +3319,7 @@ class Convo$6 {
3314
3319
  if (Object.prototype.hasOwnProperty.call(result, key)) {
3315
3320
  this._compareObject(container, scriptingMemory, convoStep, result[key], expected[key]);
3316
3321
  } else {
3317
- throw new BotiumError$3(`${this.header.name}/${convoStep.stepTag}: bot response "${result}" missing expected property: ${key}`);
3322
+ throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response "${result}" missing expected property: ${key}`);
3318
3323
  }
3319
3324
  });
3320
3325
  } else {
@@ -3442,17 +3447,17 @@ class Convo$6 {
3442
3447
  const alreadyThereAt = parentPConvos.indexOf(includeLogicHook);
3443
3448
 
3444
3449
  if (alreadyThereAt >= 0) {
3445
- throw new BotiumError$3(`Partial convos are included circular. "${includeLogicHook}" is referenced by "/${parentPConvos.slice(0, alreadyThereAt).join('/')}" and by "/${parentPConvos.join('/')}" `);
3450
+ throw new BotiumError$4(`Partial convos are included circular. "${includeLogicHook}" is referenced by "/${parentPConvos.slice(0, alreadyThereAt).join('/')}" and by "/${parentPConvos.join('/')}" `);
3446
3451
  }
3447
3452
 
3448
3453
  if (!partialConvos || Object.keys(partialConvos).length === 0) {
3449
- throw new BotiumError$3(`Cant find partial convo with name ${includeLogicHook} (There are no partial convos)`);
3454
+ throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (There are no partial convos)`);
3450
3455
  }
3451
3456
 
3452
3457
  const partialConvo = partialConvos[includeLogicHook];
3453
3458
 
3454
3459
  if (!partialConvo) {
3455
- throw new BotiumError$3(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
3460
+ throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
3456
3461
  }
3457
3462
 
3458
3463
  _getEffectiveConversationRecursive(partialConvo.conversation, [...parentPConvos, includeLogicHook], result, true);
@@ -3834,7 +3839,7 @@ const {
3834
3839
  } = vm2__default["default"];
3835
3840
  const debug$h = debug__default["default"]('botium-core-HookUtils');
3836
3841
  const {
3837
- BotiumError: BotiumError$2
3842
+ BotiumError: BotiumError$3
3838
3843
  } = BotiumError_1;
3839
3844
 
3840
3845
  const executeHook$2 = async (caps, hook, args) => {
@@ -3906,7 +3911,7 @@ const getHook$3 = (caps, data) => {
3906
3911
 
3907
3912
  if (resultWithRequire) {
3908
3913
  if (!allowUnsafe) {
3909
- throw new BotiumError$2('Security Error. Using unsafe custom hook with require is not allowed', {
3914
+ throw new BotiumError$3('Security Error. Using unsafe custom hook with require is not allowed', {
3910
3915
  type: 'security',
3911
3916
  subtype: 'allow unsafe',
3912
3917
  source: path__default["default"].basename(__filename),
@@ -5073,6 +5078,9 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
5073
5078
 
5074
5079
  };
5075
5080
 
5081
+ const {
5082
+ parse
5083
+ } = sync__default["default"];
5076
5084
  const debug$c = debug__default["default"]('botium-core-CompilerCsv');
5077
5085
  const {
5078
5086
  Convo: Convo$3
@@ -5145,7 +5153,7 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
5145
5153
  let rows;
5146
5154
 
5147
5155
  try {
5148
- rows = sync__default["default"](scriptData, {
5156
+ rows = parse(scriptData, {
5149
5157
  delimiter,
5150
5158
  escape: this.caps[Capabilities.SCRIPTING_CSV_ESCAPE],
5151
5159
  quote: this.caps[Capabilities.SCRIPTING_CSV_QUOTE],
@@ -5608,7 +5616,7 @@ const {
5608
5616
  ConvoStep
5609
5617
  } = Convo_1;
5610
5618
  const {
5611
- BotiumError: BotiumError$1,
5619
+ BotiumError: BotiumError$2,
5612
5620
  botiumErrorFromList,
5613
5621
  botiumErrorFromErr
5614
5622
  } = BotiumError_1;
@@ -5888,7 +5896,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
5888
5896
  message += ' expected to match ';
5889
5897
  message += tomatch && tomatch.length > 1 ? 'one of ' : '';
5890
5898
  message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5891
- throw new BotiumError$1(message, {
5899
+ throw new BotiumError$2(message, {
5892
5900
  type: 'asserter',
5893
5901
  source: 'TextMatchAsserter',
5894
5902
  context: {
@@ -5918,7 +5926,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
5918
5926
  message += ' expected NOT to match ';
5919
5927
  message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
5920
5928
  message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
5921
- throw new BotiumError$1(message, {
5929
+ throw new BotiumError$2(message, {
5922
5930
  type: 'asserter',
5923
5931
  source: 'TextMatchAsserter',
5924
5932
  context: {
@@ -5965,7 +5973,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
5965
5973
  if (asserter[notAsserterType]) {
5966
5974
  return p(this.retryHelperAsserter, () => asserter[notAsserterType](params));
5967
5975
  } else {
5968
- return pnot(this.retryHelperAsserter, () => asserter[asserterType](params), new BotiumError$1(`${convoStep.stepTag}: Expected asserter ${asserter.name || asserterSpec.name} with args "${params.args}" to fail`, {
5976
+ return pnot(this.retryHelperAsserter, () => asserter[asserterType](params), new BotiumError$2(`${convoStep.stepTag}: Expected asserter ${asserter.name || asserterSpec.name} with args "${params.args}" to fail`, {
5969
5977
  type: 'asserter',
5970
5978
  source: asserter.name || asserterSpec.name,
5971
5979
  params: {
@@ -6399,7 +6407,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6399
6407
  });
6400
6408
 
6401
6409
  if (aggregatedNoNames.length) {
6402
- throw new BotiumError$1('Scripting Memory Definition(s) without name', {
6410
+ throw new BotiumError$2('Scripting Memory Definition(s) without name', {
6403
6411
  type: 'Scripting Memory',
6404
6412
  subtype: 'Scripting Memory without name',
6405
6413
  source: 'ScriptingProvider',
@@ -6415,7 +6423,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6415
6423
  });
6416
6424
 
6417
6425
  if (aggregatedNoVariables.length) {
6418
- throw new BotiumError$1(`Scripting Memory Definition(s) ${aggregatedNoVariables.map(e => e.header.name).join(', ')} without variable`, {
6426
+ throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariables.map(e => e.header.name).join(', ')} without variable`, {
6419
6427
  type: 'Scripting Memory',
6420
6428
  subtype: 'Scripting Memory without variable',
6421
6429
  source: 'ScriptingProvider',
@@ -6431,7 +6439,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6431
6439
  });
6432
6440
 
6433
6441
  if (aggregatedNoVariableNames.length) {
6434
- throw new BotiumError$1(`Scripting Memory Definition(s) ${aggregatedNoVariableNames.map(e => e.header.name).join(', ')} without variable name`, {
6442
+ throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariableNames.map(e => e.header.name).join(', ')} without variable name`, {
6435
6443
  type: 'Scripting Memory',
6436
6444
  subtype: 'Scripting Memory without variable name',
6437
6445
  source: 'ScriptingProvider',
@@ -6463,7 +6471,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6463
6471
  }
6464
6472
 
6465
6473
  if (aggregatedDuplicates.length) {
6466
- throw new BotiumError$1(`Scripting Memory Definition name(s) "${lodash__default["default"].uniq(aggregatedDuplicates.map(d => d.scriptingMemory.header.name)).join(', ')}" are not unique`, {
6474
+ throw new BotiumError$2(`Scripting Memory Definition name(s) "${lodash__default["default"].uniq(aggregatedDuplicates.map(d => d.scriptingMemory.header.name)).join(', ')}" are not unique`, {
6467
6475
  type: 'Scripting Memory',
6468
6476
  subtype: 'Scripting Memory name collision',
6469
6477
  source: 'ScriptingProvider',
@@ -6500,7 +6508,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6500
6508
  }
6501
6509
 
6502
6510
  if (aggregatedIntersections.length) {
6503
- throw new BotiumError$1(`Scripting Memory Definitions "${aggregatedIntersections.map(i => i.scriptingMemory.header.name).join(', ')}" are invalid because variable name collision"`, {
6511
+ throw new BotiumError$2(`Scripting Memory Definitions "${aggregatedIntersections.map(i => i.scriptingMemory.header.name).join(', ')}" are invalid because variable name collision"`, {
6504
6512
  type: 'Scripting Memory',
6505
6513
  subtype: 'Scripting Memory variable name collision',
6506
6514
  source: 'ScriptingProvider',
@@ -6943,7 +6951,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6943
6951
  }
6944
6952
  } else if (scriptingMemories) {
6945
6953
  if (!scriptingMemories.header || !scriptingMemories.header.name) {
6946
- throw new BotiumError$1('Scripting Memory Definition has no name', {
6954
+ throw new BotiumError$2('Scripting Memory Definition has no name', {
6947
6955
  type: 'Compiler',
6948
6956
  subtype: 'Scripting memory without name',
6949
6957
  source: 'ScriptingProvider',
@@ -6954,7 +6962,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6954
6962
  }
6955
6963
 
6956
6964
  if (!scriptingMemories.values || !Object.keys(scriptingMemories.values).length) {
6957
- throw new BotiumError$1('Scripting Memory Definition has no variables', {
6965
+ throw new BotiumError$2('Scripting Memory Definition has no variables', {
6958
6966
  type: 'Compiler',
6959
6967
  subtype: 'Scripting memory without variable',
6960
6968
  source: 'ScriptingProvider',
@@ -6965,7 +6973,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6965
6973
  }
6966
6974
 
6967
6975
  if (scriptingMemories.values && !lodash__default["default"].isUndefined(scriptingMemories.values[''])) {
6968
- throw new BotiumError$1('Scripting Memory Definition variable has no name', {
6976
+ throw new BotiumError$2('Scripting Memory Definition variable has no name', {
6969
6977
  type: 'Compiler',
6970
6978
  subtype: 'Scripting memory without variable name',
6971
6979
  source: 'ScriptingProvider',
@@ -7927,6 +7935,9 @@ const {
7927
7935
  const {
7928
7936
  escapeJSONString
7929
7937
  } = Utils;
7938
+ const {
7939
+ BotiumError: BotiumError$1
7940
+ } = BotiumError_1;
7930
7941
 
7931
7942
  mustache__default["default"].escape = s => s;
7932
7943
 
@@ -8316,6 +8327,17 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8316
8327
  debug$4(Utils.shortenJsonString(body));
8317
8328
  }
8318
8329
 
8330
+ if (body) {
8331
+ const jsonBody = Utils.toJsonWeak(body);
8332
+ const errKey = Object.keys(jsonBody).find(k => k.startsWith('err') || k.startsWith('fail'));
8333
+
8334
+ if (errKey) {
8335
+ return reject(new BotiumError$1(`got error response: ${response.statusCode}/${response.statusMessage} - ${jsonBody[errKey]}`, {
8336
+ message: Utils.shortenJsonString(body)
8337
+ }));
8338
+ }
8339
+ }
8340
+
8319
8341
  return reject(new Error(`got error response: ${response.statusCode}/${response.statusMessage}`));
8320
8342
  }
8321
8343
 
@@ -8413,6 +8435,16 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
8413
8435
  }
8414
8436
  }
8415
8437
 
8438
+ if (msg.ADD_FORM_PARAM && Object.keys(msg.ADD_FORM_PARAM).length > 0) {
8439
+ requestOptions.form = {};
8440
+
8441
+ for (const formKey of Object.keys(msg.ADD_FORM_PARAM)) {
8442
+ const formValue = this._getMustachedVal(lodash__default["default"].isString(msg.ADD_FORM_PARAM[formKey]) ? msg.ADD_FORM_PARAM[formKey] : JSON.stringify(msg.ADD_FORM_PARAM[formKey]), false);
8443
+
8444
+ requestOptions.form[formKey] = formValue;
8445
+ }
8446
+ }
8447
+
8416
8448
  if (msg.ADD_HEADER && Object.keys(msg.ADD_HEADER).length > 0) {
8417
8449
  requestOptions.headers = requestOptions.headers || {};
8418
8450