botium-core 1.15.8 → 1.15.9

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.15.8";
38
+ var version$1 = "1.15.9";
39
39
  var description = "The Selenium for Chatbots";
40
40
  var main = "index.js";
41
41
  var module = "dist/botium-es.js";
@@ -6055,12 +6055,18 @@ var ScriptingProvider_1 = class ScriptingProvider {
6055
6055
  if (hookType !== 'onMeStart' && hookType !== 'onMePrepare' && hookType !== 'onMeEnd' && hookType !== 'onBotStart' && hookType !== 'onBotPrepare' && hookType !== 'onBotEnd' && hookType !== 'onConvoBegin' && hookType !== 'onConvoEnd') {
6056
6056
  throw Error(`Unknown hookType ${hookType}`);
6057
6057
  }
6058
- const localHooks = (logicHooks || []).filter(l => this.logicHooks[l.name][hookType]);
6058
+ let localHooks = (logicHooks || []).filter(l => this.logicHooks[l.name][hookType]);
6059
+ // Scripting memory file are injected via SET_SCRIPTING_MEMORY in the BEGIN step
6060
+ // But there might be other logic hooks that need the scripting memory variables
6061
+ // Order is important (SET_SCRIPTING_MEMORY in begin can be because the user added it,
6062
+ // or because the scripting memory file added it. User one has to be the last one.
6063
+ localHooks = [...localHooks.filter(l => l.name === 'SET_SCRIPTING_MEMORY'), ...localHooks.filter(l => l.name !== 'SET_SCRIPTING_MEMORY')];
6059
6064
  const convoStepPromises = localHooks.map(l => p(this.retryHelperLogicHook, () => this.logicHooks[l.name][hookType]({
6060
6065
  convo,
6061
6066
  convoStep,
6062
6067
  scriptingMemory,
6063
6068
  container,
6069
+ // Do this more sensitve for SET_SCRIPTING_MEMORY? It can have scripting variables in the args
6064
6070
  args: ScriptingMemory.applyToArgs(l.args, scriptingMemory, container.caps, rest.botMsg),
6065
6071
  isGlobal: false,
6066
6072
  ...rest
@@ -9529,8 +9535,8 @@ var BotDriver_1 = class BotDriver {
9529
9535
  if (lodash.isString(newCaps[capKey])) {
9530
9536
  try {
9531
9537
  caps[capKey] = JSON.parse(newCaps[capKey]);
9532
- if (lodash.isFinite(caps[capKey])) {
9533
- caps[capKey] = caps[capKey].toString();
9538
+ if (lodash.isFinite(Number(newCaps[capKey]))) {
9539
+ caps[capKey] = newCaps[capKey].toString();
9534
9540
  }
9535
9541
  } catch (err) {
9536
9542
  caps[capKey] = newCaps[capKey];