botium-core 1.11.15 → 1.12.2
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-cjs.js +420 -172
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +411 -164
- package/dist/botium-es.js.map +1 -1
- package/index.js +1 -0
- package/package.json +27 -27
- package/samples/connectors/custom/botium-connector-myapi.js +3 -3
- package/samples/extensions/asserterHooks/DummyAsserter.js +3 -3
- package/src/Capabilities.js +4 -0
- package/src/Defaults.js +1 -0
- package/src/Enums.js +6 -0
- package/src/containers/BaseContainer.js +20 -10
- package/src/containers/PluginConnectorContainer.js +1 -0
- package/src/containers/plugins/SimpleRestContainer.js +36 -4
- package/src/scripting/BotiumError.js +21 -0
- package/src/scripting/CompilerCsv.js +1 -1
- package/src/scripting/CompilerObjectBase.js +4 -14
- package/src/scripting/CompilerTxt.js +4 -15
- package/src/scripting/CompilerXlsx.js +81 -25
- package/src/scripting/Convo.js +16 -4
- package/src/scripting/ScriptingProvider.js +6 -0
- package/src/scripting/helper.js +54 -1
- package/src/scripting/logichook/LogicHookUtils.js +2 -0
- package/src/scripting/logichook/asserter/JsonPathAsserter.js +1 -1
- package/src/scripting/logichook/logichooks/ClearQueueLogicHook.js +1 -1
- package/src/scripting/logichook/userinput/MediaInput.js +14 -2
- package/test/connectors/convos/hello.convo.txt +6 -0
- package/test/connectors/simplerest.spec.js +42 -2
- package/test/convo/convos/continuefailing.convo.txt +19 -0
- package/test/convo/transcript.spec.js +34 -0
- package/test/scripting/scriptingProvider.spec.js +4 -4
- package/test/scripting/scriptingmemory/convosMultiMemorySameCols/buy.convo.txt +6 -0
- package/test/scripting/scriptingmemory/convosMultiMemorySameCols/products1.scriptingmemory.txt +2 -0
- package/test/scripting/scriptingmemory/convosMultiMemorySameCols/products2.scriptingmemory.txt +2 -0
- package/test/scripting/scriptingmemory/convosSimpleCols/buy.convo.txt +8 -0
- package/test/scripting/scriptingmemory/convosSimpleCols/product.scriptingmemory.txt +3 -0
- package/test/scripting/scriptingmemory/convosTwoTablesCols/buy.convo.txt +6 -0
- package/test/scripting/scriptingmemory/convosTwoTablesCols/customer.xlsx +0 -0
- package/test/scripting/scriptingmemory/convosTwoTablesCols/product.xlsx +0 -0
- package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +45 -0
- package/test/scripting/userinputs/mediaInputConvos.spec.js +53 -2
package/dist/botium-cjs.js
CHANGED
|
@@ -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/
|
|
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.
|
|
82
|
+
var version$1 = "1.12.2";
|
|
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: ">=
|
|
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.
|
|
115
|
-
async: "^3.2.
|
|
116
|
-
"body-parser": "^1.19.
|
|
114
|
+
"@babel/runtime": "^7.16.7",
|
|
115
|
+
async: "^3.2.3",
|
|
116
|
+
"body-parser": "^1.19.1",
|
|
117
117
|
boolean: "^3.1.4",
|
|
118
118
|
bottleneck: "^2.19.5",
|
|
119
|
-
"csv-parse": "^
|
|
120
|
-
debug: "^4.3.
|
|
119
|
+
"csv-parse": "^5.0.4",
|
|
120
|
+
debug: "^4.3.3",
|
|
121
121
|
esprima: "^4.0.1",
|
|
122
|
-
express: "^4.17.
|
|
122
|
+
express: "^4.17.2",
|
|
123
123
|
globby: "11.0.4",
|
|
124
|
-
ioredis: "^4.28.
|
|
124
|
+
ioredis: "^4.28.3",
|
|
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
|
|
130
|
-
"mime-types": "^2.1.
|
|
129
|
+
"markdown-it": "^12.3.2",
|
|
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.
|
|
141
|
-
"socket.io": "^4.
|
|
142
|
-
"socket.io-client": "^4.
|
|
140
|
+
slugify: "^1.6.5",
|
|
141
|
+
"socket.io": "^4.4.1",
|
|
142
|
+
"socket.io-client": "^4.4.1",
|
|
143
143
|
"socketio-auth": "^0.1.1",
|
|
144
144
|
"swagger-jsdoc": "^6.1.0",
|
|
145
|
-
"swagger-ui-express": "^4.
|
|
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.
|
|
149
|
+
xlsx: "^0.17.5",
|
|
150
150
|
xregexp: "^5.1.0",
|
|
151
151
|
yaml: "^1.10.2"
|
|
152
152
|
};
|
|
153
153
|
var devDependencies = {
|
|
154
|
-
"@babel/core": "^7.16.
|
|
155
|
-
"@babel/node": "^7.16.
|
|
156
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
157
|
-
"@babel/preset-env": "^7.16.
|
|
154
|
+
"@babel/core": "^7.16.12",
|
|
155
|
+
"@babel/node": "^7.16.8",
|
|
156
|
+
"@babel/plugin-transform-runtime": "^7.16.10",
|
|
157
|
+
"@babel/preset-env": "^7.16.11",
|
|
158
158
|
chai: "^4.3.4",
|
|
159
159
|
"chai-as-promised": "^7.1.1",
|
|
160
160
|
"cross-env": "^7.0.3",
|
|
161
|
-
eslint: "^8.
|
|
161
|
+
eslint: "^8.7.0",
|
|
162
162
|
"eslint-config-standard": "^16.0.3",
|
|
163
|
-
"eslint-plugin-import": "^2.25.
|
|
163
|
+
"eslint-plugin-import": "^2.25.4",
|
|
164
164
|
"eslint-plugin-node": "^11.1.0",
|
|
165
|
-
"eslint-plugin-promise": "^
|
|
165
|
+
"eslint-plugin-promise": "^6.0.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
|
-
mocha: "^9.
|
|
170
|
-
nock: "^13.
|
|
171
|
-
"npm-check-updates": "^12.
|
|
169
|
+
mocha: "^9.2.0",
|
|
170
|
+
nock: "^13.2.2",
|
|
171
|
+
"npm-check-updates": "^12.2.1",
|
|
172
172
|
nyc: "^15.1.0",
|
|
173
|
-
rollup: "^2.
|
|
173
|
+
rollup: "^2.66.0",
|
|
174
174
|
"rollup-plugin-babel": "^4.4.0",
|
|
175
175
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
176
176
|
"rollup-plugin-json": "^4.0.0",
|
|
@@ -325,6 +325,7 @@ var Capabilities = {
|
|
|
325
325
|
SCRIPTING_NORMALIZE_TEXT: 'SCRIPTING_NORMALIZE_TEXT',
|
|
326
326
|
SCRIPTING_ENABLE_MEMORY: 'SCRIPTING_ENABLE_MEMORY',
|
|
327
327
|
SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS: 'SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS',
|
|
328
|
+
SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS: 'SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS',
|
|
328
329
|
SCRIPTING_FORCE_BOT_CONSUMED: 'SCRIPTING_FORCE_BOT_CONSUMED',
|
|
329
330
|
// regexp, regexpIgnoreCase, wildcard, wildcardIgnoreCase, wildcardExact, wildcardExactIgnoreCase, include, includeIgnoreCase, equals, equalsIgnoreCase
|
|
330
331
|
SCRIPTING_MATCHING_MODE: 'SCRIPTING_MATCHING_MODE',
|
|
@@ -340,6 +341,8 @@ var Capabilities = {
|
|
|
340
341
|
SCRIPTING_MEMORYEXPANSION_KEEP_ORIG: 'SCRIPTING_MEMORYEXPANSION_KEEP_ORIG',
|
|
341
342
|
// word, non_whitespace, joker
|
|
342
343
|
SCRIPTING_MEMORY_MATCHING_MODE: 'SCRIPTING_MEMORY_MATCHING_MODE',
|
|
344
|
+
// varnames, testcasenames
|
|
345
|
+
SCRIPTING_MEMORY_COLUMN_MODE: 'SCRIPTING_MEMORY_COLUMN_MODE',
|
|
343
346
|
// Botium Lifecycle Hooks
|
|
344
347
|
CUSTOMHOOK_ONBUILD: 'CUSTOMHOOK_ONBUILD',
|
|
345
348
|
CUSTOMHOOK_ONSTART: 'CUSTOMHOOK_ONSTART',
|
|
@@ -354,6 +357,7 @@ var Capabilities = {
|
|
|
354
357
|
// API Calls Rate Limiting
|
|
355
358
|
RATELIMIT_USERSAYS_MAXCONCURRENT: 'RATELIMIT_USERSAYS_MAXCONCURRENT',
|
|
356
359
|
RATELIMIT_USERSAYS_MINTIME: 'RATELIMIT_USERSAYS_MINTIME',
|
|
360
|
+
RATELIMIT_BOTTLENECK_FN: 'RATELIMIT_BOTTLENECK_FN',
|
|
357
361
|
SECURITY_ALLOW_UNSAFE: 'SECURITY_ALLOW_UNSAFE',
|
|
358
362
|
PRECOMPILERS: 'PRECOMPILERS'
|
|
359
363
|
};
|
|
@@ -465,6 +469,7 @@ Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER;
|
|
|
465
469
|
Capabilities.SCRIPTING_NORMALIZE_TEXT;
|
|
466
470
|
Capabilities.SCRIPTING_ENABLE_MEMORY;
|
|
467
471
|
Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS;
|
|
472
|
+
Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS;
|
|
468
473
|
Capabilities.SCRIPTING_FORCE_BOT_CONSUMED;
|
|
469
474
|
Capabilities.SCRIPTING_MATCHING_MODE;
|
|
470
475
|
Capabilities.SCRIPTING_UTTEXPANSION_MODE;
|
|
@@ -475,6 +480,7 @@ Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE;
|
|
|
475
480
|
Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX;
|
|
476
481
|
Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG;
|
|
477
482
|
Capabilities.SCRIPTING_MEMORY_MATCHING_MODE;
|
|
483
|
+
Capabilities.SCRIPTING_MEMORY_COLUMN_MODE;
|
|
478
484
|
Capabilities.CUSTOMHOOK_ONBUILD;
|
|
479
485
|
Capabilities.CUSTOMHOOK_ONSTART;
|
|
480
486
|
Capabilities.CUSTOMHOOK_ONUSERSAYS;
|
|
@@ -486,6 +492,7 @@ Capabilities.LOGIC_HOOKS;
|
|
|
486
492
|
Capabilities.USER_INPUTS;
|
|
487
493
|
Capabilities.RATELIMIT_USERSAYS_MAXCONCURRENT;
|
|
488
494
|
Capabilities.RATELIMIT_USERSAYS_MINTIME;
|
|
495
|
+
Capabilities.RATELIMIT_BOTTLENECK_FN;
|
|
489
496
|
Capabilities.SECURITY_ALLOW_UNSAFE;
|
|
490
497
|
Capabilities.PRECOMPILERS;
|
|
491
498
|
|
|
@@ -553,6 +560,7 @@ var Defaults$1 = {
|
|
|
553
560
|
[Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE]: 'justLineTag',
|
|
554
561
|
[Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX]: '16',
|
|
555
562
|
[Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG]: false,
|
|
563
|
+
[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]: false,
|
|
556
564
|
[Capabilities.SCRIPTING_FORCE_BOT_CONSUMED]: false,
|
|
557
565
|
[Capabilities.ASSERTERS]: [],
|
|
558
566
|
[Capabilities.LOGIC_HOOKS]: [],
|
|
@@ -874,7 +882,7 @@ function getCjsExportFromNamespace (n) {
|
|
|
874
882
|
return n && n['default'] || n;
|
|
875
883
|
}
|
|
876
884
|
|
|
877
|
-
const BotiumError$
|
|
885
|
+
const BotiumError$7 = class BotiumError extends Error {
|
|
878
886
|
/**
|
|
879
887
|
*
|
|
880
888
|
* @param message
|
|
@@ -899,6 +907,27 @@ const BotiumError$6 = class BotiumError extends Error {
|
|
|
899
907
|
this.context.message = message.message || message;
|
|
900
908
|
}
|
|
901
909
|
|
|
910
|
+
isAsserterError() {
|
|
911
|
+
if (this.context) {
|
|
912
|
+
const errArr = lodash__default["default"].isArray(this.context) ? this.context : [this.context];
|
|
913
|
+
const hasNotAsserterError = errArr.findIndex(errDetail => {
|
|
914
|
+
if (errDetail.type === 'list') {
|
|
915
|
+
if (errDetail.errors) {
|
|
916
|
+
return errDetail.errors.findIndex(e => e.type !== 'asserter') >= 0;
|
|
917
|
+
} else {
|
|
918
|
+
return true;
|
|
919
|
+
}
|
|
920
|
+
} else {
|
|
921
|
+
return errDetail.type !== 'asserter';
|
|
922
|
+
}
|
|
923
|
+
}) >= 0;
|
|
924
|
+
if (hasNotAsserterError) return false;
|
|
925
|
+
return true;
|
|
926
|
+
} else {
|
|
927
|
+
return false;
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
|
|
902
931
|
prettify(includeJson) {
|
|
903
932
|
const lines = [];
|
|
904
933
|
|
|
@@ -960,10 +989,10 @@ const _getChildErrorsFromContext = context => {
|
|
|
960
989
|
};
|
|
961
990
|
|
|
962
991
|
const botiumErrorFromErr$2 = (message, err) => {
|
|
963
|
-
if (err instanceof BotiumError$
|
|
964
|
-
return new BotiumError$
|
|
992
|
+
if (err instanceof BotiumError$7) {
|
|
993
|
+
return new BotiumError$7(message, err.context, true);
|
|
965
994
|
} else {
|
|
966
|
-
return new BotiumError$
|
|
995
|
+
return new BotiumError$7(message, {
|
|
967
996
|
err
|
|
968
997
|
}, true);
|
|
969
998
|
}
|
|
@@ -978,7 +1007,7 @@ const botiumErrorFromList$2 = (errors, {
|
|
|
978
1007
|
let children = [];
|
|
979
1008
|
|
|
980
1009
|
for (const error of errors) {
|
|
981
|
-
if (error instanceof BotiumError$
|
|
1010
|
+
if (error instanceof BotiumError$7) {
|
|
982
1011
|
const childErrors = flat && _getChildErrorsFromContext(error.context);
|
|
983
1012
|
|
|
984
1013
|
if (childErrors && childErrors.length) {
|
|
@@ -991,7 +1020,7 @@ const botiumErrorFromList$2 = (errors, {
|
|
|
991
1020
|
}
|
|
992
1021
|
}
|
|
993
1022
|
|
|
994
|
-
const result = new BotiumError$
|
|
1023
|
+
const result = new BotiumError$7(message, {
|
|
995
1024
|
errors: children,
|
|
996
1025
|
type,
|
|
997
1026
|
source
|
|
@@ -1000,7 +1029,7 @@ const botiumErrorFromList$2 = (errors, {
|
|
|
1000
1029
|
};
|
|
1001
1030
|
|
|
1002
1031
|
var BotiumError_1 = {
|
|
1003
|
-
BotiumError: BotiumError$
|
|
1032
|
+
BotiumError: BotiumError$7,
|
|
1004
1033
|
botiumErrorFromErr: botiumErrorFromErr$2,
|
|
1005
1034
|
botiumErrorFromList: botiumErrorFromList$2
|
|
1006
1035
|
};
|
|
@@ -1181,7 +1210,7 @@ const {
|
|
|
1181
1210
|
} = vm2__default["default"];
|
|
1182
1211
|
const debug$k = debug__default["default"]('botium-core-asserterUtils');
|
|
1183
1212
|
const {
|
|
1184
|
-
BotiumError: BotiumError$
|
|
1213
|
+
BotiumError: BotiumError$6
|
|
1185
1214
|
} = BotiumError_1;
|
|
1186
1215
|
const {
|
|
1187
1216
|
DEFAULT_ASSERTERS,
|
|
@@ -1332,7 +1361,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
|
|
|
1332
1361
|
|
|
1333
1362
|
const _checkUnsafe = () => {
|
|
1334
1363
|
if (!this.caps[Capabilities.SECURITY_ALLOW_UNSAFE]) {
|
|
1335
|
-
throw new BotiumError$
|
|
1364
|
+
throw new BotiumError$6('Security Error. Using unsafe component is not allowed', {
|
|
1336
1365
|
type: 'security',
|
|
1337
1366
|
subtype: 'allow unsafe',
|
|
1338
1367
|
source: path__default["default"].basename(__filename),
|
|
@@ -1476,6 +1505,11 @@ var LogicHookUtils_1 = class LogicHookUtils {
|
|
|
1476
1505
|
ref,
|
|
1477
1506
|
...this.buildScriptContext
|
|
1478
1507
|
}, this.caps, args);
|
|
1508
|
+
} else if (lodash__default["default"].isFunction(CheckClass.PluginClass)) {
|
|
1509
|
+
return CheckClass.PluginClass({
|
|
1510
|
+
ref,
|
|
1511
|
+
...this.buildScriptContext
|
|
1512
|
+
}, this.caps, args);
|
|
1479
1513
|
} else {
|
|
1480
1514
|
throw new Error(`${src} class or function expected`);
|
|
1481
1515
|
}
|
|
@@ -1731,6 +1765,18 @@ var BotiumMockMessage_1 = class BotiumMockMessage {
|
|
|
1731
1765
|
|
|
1732
1766
|
};
|
|
1733
1767
|
|
|
1768
|
+
var Enums = {
|
|
1769
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE: {
|
|
1770
|
+
VARNAMES: 'varnames',
|
|
1771
|
+
TESTCASENAMES: 'testcasenames'
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
Enums.E_SCRIPTING_MEMORY_COLUMN_MODE;
|
|
1775
|
+
|
|
1776
|
+
const {
|
|
1777
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE: E_SCRIPTING_MEMORY_COLUMN_MODE$1
|
|
1778
|
+
} = Enums;
|
|
1779
|
+
|
|
1734
1780
|
const normalizeText$1 = (str, doCleanup) => {
|
|
1735
1781
|
if (str && lodash__default["default"].isArray(str)) {
|
|
1736
1782
|
str = str.join(' ');
|
|
@@ -2259,6 +2305,71 @@ const convoStepToLines$2 = step => {
|
|
|
2259
2305
|
return lines.map(l => l.trim());
|
|
2260
2306
|
};
|
|
2261
2307
|
|
|
2308
|
+
const linesToScriptingMemories$2 = (lines, columnMode = null) => {
|
|
2309
|
+
const guessScriptingMemoryColumnMode = lines => {
|
|
2310
|
+
if (lines && lines.length > 1) {
|
|
2311
|
+
if (lines[1].trim().startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES;
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
return E_SCRIPTING_MEMORY_COLUMN_MODE$1.VARNAMES;
|
|
2315
|
+
};
|
|
2316
|
+
|
|
2317
|
+
columnMode = columnMode || guessScriptingMemoryColumnMode(lines);
|
|
2318
|
+
const scriptingMemories = [];
|
|
2319
|
+
|
|
2320
|
+
if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES) {
|
|
2321
|
+
const caseNames = lines[0].split('|').map(name => name.trim()).slice(1);
|
|
2322
|
+
const varNames = [];
|
|
2323
|
+
const varValues = [];
|
|
2324
|
+
|
|
2325
|
+
for (let row = 1; row < lines.length; row++) {
|
|
2326
|
+
if (!lines[row] || lines[row].length === 0) continue;
|
|
2327
|
+
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
2328
|
+
varNames.push(rawRow[0]);
|
|
2329
|
+
varValues.push(rawRow.slice(1));
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
|
|
2333
|
+
const caseName = caseNames[caseIndex];
|
|
2334
|
+
const values = varNames.reduce((agg, varName, varIndex) => {
|
|
2335
|
+
agg[varName] = varValues[varIndex][caseIndex] || null;
|
|
2336
|
+
return agg;
|
|
2337
|
+
}, {});
|
|
2338
|
+
const scriptingMemory = {
|
|
2339
|
+
header: {
|
|
2340
|
+
name: caseName
|
|
2341
|
+
},
|
|
2342
|
+
values: values
|
|
2343
|
+
};
|
|
2344
|
+
scriptingMemories.push(scriptingMemory);
|
|
2345
|
+
}
|
|
2346
|
+
} else {
|
|
2347
|
+
const varNames = lines[0].split('|').map(name => name.trim()).slice(1);
|
|
2348
|
+
|
|
2349
|
+
for (let row = 1; row < lines.length; row++) {
|
|
2350
|
+
if (!lines[row] || lines[row].length === 0) continue;
|
|
2351
|
+
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
2352
|
+
const caseName = rawRow[0];
|
|
2353
|
+
const values = rawRow.slice(1);
|
|
2354
|
+
const varValues = {};
|
|
2355
|
+
|
|
2356
|
+
for (let varIndex = 0; varIndex < varNames.length; varIndex++) {
|
|
2357
|
+
varValues[varNames[varIndex]] = values[varIndex];
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
const scriptingMemory = {
|
|
2361
|
+
header: {
|
|
2362
|
+
name: caseName
|
|
2363
|
+
},
|
|
2364
|
+
values: varValues
|
|
2365
|
+
};
|
|
2366
|
+
scriptingMemories.push(scriptingMemory);
|
|
2367
|
+
}
|
|
2368
|
+
}
|
|
2369
|
+
|
|
2370
|
+
return scriptingMemories;
|
|
2371
|
+
};
|
|
2372
|
+
|
|
2262
2373
|
var helper = {
|
|
2263
2374
|
normalizeText: normalizeText$1,
|
|
2264
2375
|
splitStringInNonEmptyLines: splitStringInNonEmptyLines$1,
|
|
@@ -2271,7 +2382,8 @@ var helper = {
|
|
|
2271
2382
|
convoStepToObject: convoStepToObject$1,
|
|
2272
2383
|
validSenders: validSenders$3,
|
|
2273
2384
|
validateSender: validateSender$1,
|
|
2274
|
-
validateConvo: validateConvo$2
|
|
2385
|
+
validateConvo: validateConvo$2,
|
|
2386
|
+
linesToScriptingMemories: linesToScriptingMemories$2
|
|
2275
2387
|
};
|
|
2276
2388
|
|
|
2277
2389
|
const debug$j = debug__default["default"]('botium-core-ScriptingMemory');
|
|
@@ -2286,7 +2398,7 @@ const {
|
|
|
2286
2398
|
toString: toString$2
|
|
2287
2399
|
} = helper;
|
|
2288
2400
|
const {
|
|
2289
|
-
BotiumError: BotiumError$
|
|
2401
|
+
BotiumError: BotiumError$5
|
|
2290
2402
|
} = BotiumError_1; // If they got parameter, then it will be a string always.
|
|
2291
2403
|
// the receiver can decide what to do with it,
|
|
2292
2404
|
// convert to int,
|
|
@@ -2455,7 +2567,7 @@ const SCRIPTING_FUNCTIONS$1 = lodash__default["default"].mapValues(SCRIPTING_FUN
|
|
|
2455
2567
|
return {
|
|
2456
2568
|
handler: (caps, ...rest) => {
|
|
2457
2569
|
if (!caps[Capabilities.SECURITY_ALLOW_UNSAFE] && funcOrStruct.unsafe) {
|
|
2458
|
-
throw new BotiumError$
|
|
2570
|
+
throw new BotiumError$5(`Security Error. Using unsafe scripting memory function ${name} is not allowed`, {
|
|
2459
2571
|
type: 'security',
|
|
2460
2572
|
subtype: 'allow unsafe',
|
|
2461
2573
|
source: path__default["default"].basename(__filename),
|
|
@@ -2604,7 +2716,7 @@ ScriptingMemory.SCRIPTING_FUNCTIONS;
|
|
|
2604
2716
|
|
|
2605
2717
|
const debug$i = debug__default["default"]('botium-core-Convo');
|
|
2606
2718
|
const {
|
|
2607
|
-
BotiumError: BotiumError$
|
|
2719
|
+
BotiumError: BotiumError$4,
|
|
2608
2720
|
botiumErrorFromErr: botiumErrorFromErr$1,
|
|
2609
2721
|
botiumErrorFromList: botiumErrorFromList$1
|
|
2610
2722
|
} = BotiumError_1;
|
|
@@ -2644,7 +2756,9 @@ class ConvoStepAssert {
|
|
|
2644
2756
|
}
|
|
2645
2757
|
|
|
2646
2758
|
toString() {
|
|
2647
|
-
return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.
|
|
2759
|
+
return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.map(a => lodash__default["default"].truncate(a, {
|
|
2760
|
+
length: 200
|
|
2761
|
+
})).join(',') : 'no args') + ')';
|
|
2648
2762
|
}
|
|
2649
2763
|
|
|
2650
2764
|
}
|
|
@@ -2656,7 +2770,9 @@ class ConvoStepLogicHook {
|
|
|
2656
2770
|
}
|
|
2657
2771
|
|
|
2658
2772
|
toString() {
|
|
2659
|
-
return this.name + '(' + (this.args ? this.args.
|
|
2773
|
+
return this.name + '(' + (this.args ? this.args.map(a => lodash__default["default"].truncate(a, {
|
|
2774
|
+
length: 200
|
|
2775
|
+
})).join(',') : 'no args') + ')';
|
|
2660
2776
|
}
|
|
2661
2777
|
|
|
2662
2778
|
}
|
|
@@ -2668,7 +2784,9 @@ class ConvoStepUserInput {
|
|
|
2668
2784
|
}
|
|
2669
2785
|
|
|
2670
2786
|
toString() {
|
|
2671
|
-
return this.name + '(' + (this.args ? this.args.
|
|
2787
|
+
return this.name + '(' + (this.args ? this.args.map(a => lodash__default["default"].truncate(a, {
|
|
2788
|
+
length: 200
|
|
2789
|
+
})).join(',') : 'no args') + ')';
|
|
2672
2790
|
}
|
|
2673
2791
|
|
|
2674
2792
|
}
|
|
@@ -3133,7 +3251,7 @@ class Convo$6 {
|
|
|
3133
3251
|
}
|
|
3134
3252
|
|
|
3135
3253
|
if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
|
|
3136
|
-
const failErr = new BotiumError$
|
|
3254
|
+
const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
|
|
3137
3255
|
debug$i(failErr);
|
|
3138
3256
|
|
|
3139
3257
|
try {
|
|
@@ -3236,7 +3354,7 @@ class Convo$6 {
|
|
|
3236
3354
|
this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
|
|
3237
3355
|
} catch (failErr) {}
|
|
3238
3356
|
|
|
3239
|
-
if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$
|
|
3357
|
+
if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$4) {
|
|
3240
3358
|
assertErrors.push(err);
|
|
3241
3359
|
} else {
|
|
3242
3360
|
throw failErr;
|
|
@@ -3253,7 +3371,7 @@ class Convo$6 {
|
|
|
3253
3371
|
}
|
|
3254
3372
|
}
|
|
3255
3373
|
} else {
|
|
3256
|
-
const failErr = new BotiumError$
|
|
3374
|
+
const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util__default["default"].inspect(convoStep.sender)}`);
|
|
3257
3375
|
debug$i(failErr);
|
|
3258
3376
|
|
|
3259
3377
|
try {
|
|
@@ -3264,7 +3382,7 @@ class Convo$6 {
|
|
|
3264
3382
|
}
|
|
3265
3383
|
} catch (err) {
|
|
3266
3384
|
if (lastMeConvoStep) {
|
|
3267
|
-
if (err instanceof BotiumError$
|
|
3385
|
+
if (err instanceof BotiumError$4 && err.context) {
|
|
3268
3386
|
err.context.input = new ConvoStep$1(lastMeConvoStep);
|
|
3269
3387
|
err.context.transcript = [...transcriptSteps, { ...transcriptStep
|
|
3270
3388
|
}];
|
|
@@ -3276,7 +3394,14 @@ class Convo$6 {
|
|
|
3276
3394
|
}
|
|
3277
3395
|
|
|
3278
3396
|
transcriptStep.err = err;
|
|
3279
|
-
|
|
3397
|
+
|
|
3398
|
+
if (err instanceof BotiumError$4 && container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
|
|
3399
|
+
if (!err.isAsserterError()) {
|
|
3400
|
+
throw err;
|
|
3401
|
+
}
|
|
3402
|
+
} else {
|
|
3403
|
+
throw err;
|
|
3404
|
+
}
|
|
3280
3405
|
} finally {
|
|
3281
3406
|
if (convoStep.sender !== 'begin' && convoStep.sender !== 'end' && !skipTranscriptStep) {
|
|
3282
3407
|
transcriptStep.scriptingMemory = Object.assign({}, scriptingMemory);
|
|
@@ -3291,6 +3416,14 @@ class Convo$6 {
|
|
|
3291
3416
|
transcript.steps = transcriptSteps.filter(s => s);
|
|
3292
3417
|
transcript.scriptingMemory = scriptingMemory;
|
|
3293
3418
|
transcript.convoEnd = new Date();
|
|
3419
|
+
|
|
3420
|
+
if (container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
|
|
3421
|
+
const transcriptStepErrs = transcript.steps.filter(s => s.err).map(s => s.err);
|
|
3422
|
+
|
|
3423
|
+
if (transcriptStepErrs && transcriptStepErrs.length > 0) {
|
|
3424
|
+
transcript.err = botiumErrorFromList$1([transcriptStepErrs, transcript.err].filter(e => e), {});
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3294
3427
|
}
|
|
3295
3428
|
}
|
|
3296
3429
|
|
|
@@ -3299,11 +3432,11 @@ class Convo$6 {
|
|
|
3299
3432
|
|
|
3300
3433
|
if (lodash__default["default"].isArray(expected)) {
|
|
3301
3434
|
if (!lodash__default["default"].isArray(result)) {
|
|
3302
|
-
throw new BotiumError$
|
|
3435
|
+
throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array, got "${result}"`);
|
|
3303
3436
|
}
|
|
3304
3437
|
|
|
3305
3438
|
if (expected.length !== result.length) {
|
|
3306
|
-
throw new BotiumError$
|
|
3439
|
+
throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array length ${expected.length}, got ${result.length}`);
|
|
3307
3440
|
}
|
|
3308
3441
|
|
|
3309
3442
|
for (let i = 0; i < expected.length; i++) {
|
|
@@ -3314,7 +3447,7 @@ class Convo$6 {
|
|
|
3314
3447
|
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
3315
3448
|
this._compareObject(container, scriptingMemory, convoStep, result[key], expected[key]);
|
|
3316
3449
|
} else {
|
|
3317
|
-
throw new BotiumError$
|
|
3450
|
+
throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response "${result}" missing expected property: ${key}`);
|
|
3318
3451
|
}
|
|
3319
3452
|
});
|
|
3320
3453
|
} else {
|
|
@@ -3442,17 +3575,17 @@ class Convo$6 {
|
|
|
3442
3575
|
const alreadyThereAt = parentPConvos.indexOf(includeLogicHook);
|
|
3443
3576
|
|
|
3444
3577
|
if (alreadyThereAt >= 0) {
|
|
3445
|
-
throw new BotiumError$
|
|
3578
|
+
throw new BotiumError$4(`Partial convos are included circular. "${includeLogicHook}" is referenced by "/${parentPConvos.slice(0, alreadyThereAt).join('/')}" and by "/${parentPConvos.join('/')}" `);
|
|
3446
3579
|
}
|
|
3447
3580
|
|
|
3448
3581
|
if (!partialConvos || Object.keys(partialConvos).length === 0) {
|
|
3449
|
-
throw new BotiumError$
|
|
3582
|
+
throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (There are no partial convos)`);
|
|
3450
3583
|
}
|
|
3451
3584
|
|
|
3452
3585
|
const partialConvo = partialConvos[includeLogicHook];
|
|
3453
3586
|
|
|
3454
3587
|
if (!partialConvo) {
|
|
3455
|
-
throw new BotiumError$
|
|
3588
|
+
throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
|
|
3456
3589
|
}
|
|
3457
3590
|
|
|
3458
3591
|
_getEffectiveConversationRecursive(partialConvo.conversation, [...parentPConvos, includeLogicHook], result, true);
|
|
@@ -3834,7 +3967,7 @@ const {
|
|
|
3834
3967
|
} = vm2__default["default"];
|
|
3835
3968
|
const debug$h = debug__default["default"]('botium-core-HookUtils');
|
|
3836
3969
|
const {
|
|
3837
|
-
BotiumError: BotiumError$
|
|
3970
|
+
BotiumError: BotiumError$3
|
|
3838
3971
|
} = BotiumError_1;
|
|
3839
3972
|
|
|
3840
3973
|
const executeHook$2 = async (caps, hook, args) => {
|
|
@@ -3906,7 +4039,7 @@ const getHook$3 = (caps, data) => {
|
|
|
3906
4039
|
|
|
3907
4040
|
if (resultWithRequire) {
|
|
3908
4041
|
if (!allowUnsafe) {
|
|
3909
|
-
throw new BotiumError$
|
|
4042
|
+
throw new BotiumError$3('Security Error. Using unsafe custom hook with require is not allowed', {
|
|
3910
4043
|
type: 'security',
|
|
3911
4044
|
subtype: 'allow unsafe',
|
|
3912
4045
|
source: path__default["default"].basename(__filename),
|
|
@@ -4361,6 +4494,9 @@ var Utterance_1 = class Utterance {
|
|
|
4361
4494
|
};
|
|
4362
4495
|
|
|
4363
4496
|
const debug$d = debug__default["default"]('botium-core-CompilerXlsx');
|
|
4497
|
+
const {
|
|
4498
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE
|
|
4499
|
+
} = Enums;
|
|
4364
4500
|
const {
|
|
4365
4501
|
Convo: Convo$5
|
|
4366
4502
|
} = Convo_1;
|
|
@@ -4673,49 +4809,120 @@ var CompilerXlsx_1 = class CompilerXlsx extends CompilerBase_1 {
|
|
|
4673
4809
|
}
|
|
4674
4810
|
|
|
4675
4811
|
if (scriptType === Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY) {
|
|
4676
|
-
const
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
while (true) {
|
|
4680
|
-
const variableNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4812
|
+
const guessScriptingMemoryColumnMode = () => {
|
|
4813
|
+
const line1Cell = this.colnames[colindex] + (rowindex + 1);
|
|
4681
4814
|
|
|
4682
|
-
if (sheet[
|
|
4683
|
-
|
|
4684
|
-
} else {
|
|
4685
|
-
break;
|
|
4815
|
+
if (sheet[line1Cell] && sheet[line1Cell].v) {
|
|
4816
|
+
if (sheet[line1Cell].v.startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES;
|
|
4686
4817
|
}
|
|
4687
4818
|
|
|
4688
|
-
|
|
4689
|
-
}
|
|
4819
|
+
return E_SCRIPTING_MEMORY_COLUMN_MODE.VARNAMES;
|
|
4820
|
+
};
|
|
4690
4821
|
|
|
4691
|
-
|
|
4822
|
+
const columnMode = this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE] || guessScriptingMemoryColumnMode();
|
|
4692
4823
|
|
|
4693
|
-
|
|
4694
|
-
const
|
|
4824
|
+
if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES) {
|
|
4825
|
+
const caseNames = [];
|
|
4826
|
+
let colindexTemp = colindex + 1;
|
|
4695
4827
|
|
|
4696
|
-
|
|
4697
|
-
const
|
|
4698
|
-
const values = {};
|
|
4828
|
+
while (true) {
|
|
4829
|
+
const caseNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4699
4830
|
|
|
4700
|
-
|
|
4701
|
-
|
|
4831
|
+
if (sheet[caseNameCell] && sheet[caseNameCell].v) {
|
|
4832
|
+
caseNames.push(sheet[caseNameCell].v);
|
|
4833
|
+
} else {
|
|
4834
|
+
break;
|
|
4835
|
+
}
|
|
4702
4836
|
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4837
|
+
colindexTemp++;
|
|
4838
|
+
}
|
|
4839
|
+
|
|
4840
|
+
const varNames = [];
|
|
4841
|
+
const varValues = [];
|
|
4842
|
+
rowindex += 1;
|
|
4843
|
+
|
|
4844
|
+
while (true) {
|
|
4845
|
+
const varNameCell = this.colnames[colindex] + rowindex;
|
|
4846
|
+
|
|
4847
|
+
if (sheet[varNameCell] && sheet[varNameCell].v) {
|
|
4848
|
+
varNames.push(sheet[varNameCell].v);
|
|
4849
|
+
const values = [];
|
|
4850
|
+
|
|
4851
|
+
for (let i = 0; i < caseNames.length; i++) {
|
|
4852
|
+
const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
|
|
4853
|
+
|
|
4854
|
+
if (sheet[variableValueCell] && sheet[variableValueCell].v) {
|
|
4855
|
+
values.push(sheet[variableValueCell].v.toString());
|
|
4856
|
+
} else {
|
|
4857
|
+
values.push(null);
|
|
4858
|
+
}
|
|
4707
4859
|
}
|
|
4860
|
+
|
|
4861
|
+
varValues.push(values);
|
|
4862
|
+
rowindex += 1;
|
|
4863
|
+
} else {
|
|
4864
|
+
break;
|
|
4708
4865
|
}
|
|
4866
|
+
}
|
|
4709
4867
|
|
|
4710
|
-
|
|
4868
|
+
for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
|
|
4869
|
+
const caseName = caseNames[caseIndex];
|
|
4870
|
+
const values = varNames.reduce((agg, varName, varIndex) => {
|
|
4871
|
+
agg[varName] = varValues[varIndex][caseIndex] || null;
|
|
4872
|
+
return agg;
|
|
4873
|
+
}, {});
|
|
4711
4874
|
scriptResults.push({
|
|
4712
4875
|
header: {
|
|
4713
4876
|
name: caseName
|
|
4714
4877
|
},
|
|
4715
4878
|
values: values
|
|
4716
4879
|
});
|
|
4717
|
-
}
|
|
4718
|
-
|
|
4880
|
+
}
|
|
4881
|
+
} else {
|
|
4882
|
+
const variableNames = [];
|
|
4883
|
+
let colindexTemp = colindex + 1;
|
|
4884
|
+
|
|
4885
|
+
while (true) {
|
|
4886
|
+
const variableNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4887
|
+
|
|
4888
|
+
if (sheet[variableNameCell] && sheet[variableNameCell].v) {
|
|
4889
|
+
variableNames.push(sheet[variableNameCell].v);
|
|
4890
|
+
} else {
|
|
4891
|
+
break;
|
|
4892
|
+
}
|
|
4893
|
+
|
|
4894
|
+
colindexTemp++;
|
|
4895
|
+
}
|
|
4896
|
+
|
|
4897
|
+
rowindex += 1;
|
|
4898
|
+
|
|
4899
|
+
while (true) {
|
|
4900
|
+
const caseNameCell = this.colnames[colindex] + rowindex;
|
|
4901
|
+
|
|
4902
|
+
if (sheet[caseNameCell] && sheet[caseNameCell].v) {
|
|
4903
|
+
const caseName = sheet[caseNameCell].v;
|
|
4904
|
+
const values = {};
|
|
4905
|
+
|
|
4906
|
+
for (let i = 0; i < variableNames.length; i++) {
|
|
4907
|
+
const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
|
|
4908
|
+
|
|
4909
|
+
if (sheet[variableValueCell] && sheet[variableValueCell].v) {
|
|
4910
|
+
values[variableNames[i]] = sheet[variableValueCell].v.toString();
|
|
4911
|
+
} else {
|
|
4912
|
+
values[variableNames[i]] = null;
|
|
4913
|
+
}
|
|
4914
|
+
}
|
|
4915
|
+
|
|
4916
|
+
rowindex += 1;
|
|
4917
|
+
scriptResults.push({
|
|
4918
|
+
header: {
|
|
4919
|
+
name: caseName
|
|
4920
|
+
},
|
|
4921
|
+
values: values
|
|
4922
|
+
});
|
|
4923
|
+
} else {
|
|
4924
|
+
break;
|
|
4925
|
+
}
|
|
4719
4926
|
}
|
|
4720
4927
|
}
|
|
4721
4928
|
}
|
|
@@ -4875,7 +5082,8 @@ const {
|
|
|
4875
5082
|
linesToConvoStep: linesToConvoStep$3,
|
|
4876
5083
|
convoStepToLines,
|
|
4877
5084
|
validateConvo,
|
|
4878
|
-
validSenders: validSenders$2
|
|
5085
|
+
validSenders: validSenders$2,
|
|
5086
|
+
linesToScriptingMemories: linesToScriptingMemories$1
|
|
4879
5087
|
} = helper;
|
|
4880
5088
|
var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
4881
5089
|
constructor(context, caps = {}) {
|
|
@@ -5006,30 +5214,12 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
5006
5214
|
|
|
5007
5215
|
_compileScriptingMemory(lines) {
|
|
5008
5216
|
if (lines && lines.length > 1) {
|
|
5009
|
-
const
|
|
5010
|
-
const scriptingMemories = [];
|
|
5011
|
-
|
|
5012
|
-
for (let row = 1; row < lines.length; row++) {
|
|
5013
|
-
if (!lines[row] || lines[row].length === 0) continue;
|
|
5014
|
-
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
5015
|
-
const caseName = rawRow[0];
|
|
5016
|
-
const values = rawRow.slice(1);
|
|
5017
|
-
const json = {};
|
|
5217
|
+
const scriptingMemories = linesToScriptingMemories$1(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
|
|
5018
5218
|
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
}
|
|
5022
|
-
|
|
5023
|
-
const scriptingMemory = {
|
|
5024
|
-
header: {
|
|
5025
|
-
name: caseName
|
|
5026
|
-
},
|
|
5027
|
-
values: json
|
|
5028
|
-
};
|
|
5029
|
-
scriptingMemories.push(scriptingMemory);
|
|
5219
|
+
if (scriptingMemories && scriptingMemories.length > 0) {
|
|
5220
|
+
this.context.AddScriptingMemories(scriptingMemories);
|
|
5030
5221
|
}
|
|
5031
5222
|
|
|
5032
|
-
this.context.AddScriptingMemories(scriptingMemories);
|
|
5033
5223
|
return scriptingMemories;
|
|
5034
5224
|
}
|
|
5035
5225
|
}
|
|
@@ -5073,6 +5263,9 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
5073
5263
|
|
|
5074
5264
|
};
|
|
5075
5265
|
|
|
5266
|
+
const {
|
|
5267
|
+
parse
|
|
5268
|
+
} = sync__default["default"];
|
|
5076
5269
|
const debug$c = debug__default["default"]('botium-core-CompilerCsv');
|
|
5077
5270
|
const {
|
|
5078
5271
|
Convo: Convo$3
|
|
@@ -5145,7 +5338,7 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5145
5338
|
let rows;
|
|
5146
5339
|
|
|
5147
5340
|
try {
|
|
5148
|
-
rows =
|
|
5341
|
+
rows = parse(scriptData, {
|
|
5149
5342
|
delimiter,
|
|
5150
5343
|
escape: this.caps[Capabilities.SCRIPTING_CSV_ESCAPE],
|
|
5151
5344
|
quote: this.caps[Capabilities.SCRIPTING_CSV_QUOTE],
|
|
@@ -5284,7 +5477,8 @@ const {
|
|
|
5284
5477
|
} = Convo_1;
|
|
5285
5478
|
const {
|
|
5286
5479
|
linesToConvoStep: linesToConvoStep$1,
|
|
5287
|
-
validSenders: validSenders$1
|
|
5480
|
+
validSenders: validSenders$1,
|
|
5481
|
+
linesToScriptingMemories
|
|
5288
5482
|
} = helper;
|
|
5289
5483
|
var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
5290
5484
|
constructor(context, caps = {}) {
|
|
@@ -5393,29 +5587,12 @@ var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
|
5393
5587
|
if (lines && lines.length > 0) {
|
|
5394
5588
|
if (lodash__default["default"].isString(lines[0])) {
|
|
5395
5589
|
if (lines.length > 1) {
|
|
5396
|
-
const
|
|
5397
|
-
const scriptingMemories = [];
|
|
5590
|
+
const scriptingMemories = linesToScriptingMemories(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
|
|
5398
5591
|
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
const caseName = rawRow[0];
|
|
5402
|
-
const values = rawRow.slice(1);
|
|
5403
|
-
const json = {};
|
|
5404
|
-
|
|
5405
|
-
for (let col = 0; col < names.length; col++) {
|
|
5406
|
-
json[names[col]] = values[col];
|
|
5407
|
-
}
|
|
5408
|
-
|
|
5409
|
-
const scriptingMemory = {
|
|
5410
|
-
header: {
|
|
5411
|
-
name: caseName
|
|
5412
|
-
},
|
|
5413
|
-
values: json
|
|
5414
|
-
};
|
|
5415
|
-
scriptingMemories.push(scriptingMemory);
|
|
5592
|
+
if (scriptingMemories && scriptingMemories.length > 0) {
|
|
5593
|
+
this.context.AddScriptingMemories(scriptingMemories);
|
|
5416
5594
|
}
|
|
5417
5595
|
|
|
5418
|
-
this.context.AddScriptingMemories(scriptingMemories);
|
|
5419
5596
|
return scriptingMemories;
|
|
5420
5597
|
}
|
|
5421
5598
|
} else {
|
|
@@ -5608,7 +5785,7 @@ const {
|
|
|
5608
5785
|
ConvoStep
|
|
5609
5786
|
} = Convo_1;
|
|
5610
5787
|
const {
|
|
5611
|
-
BotiumError: BotiumError$
|
|
5788
|
+
BotiumError: BotiumError$2,
|
|
5612
5789
|
botiumErrorFromList,
|
|
5613
5790
|
botiumErrorFromErr
|
|
5614
5791
|
} = BotiumError_1;
|
|
@@ -5888,7 +6065,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
5888
6065
|
message += ' expected to match ';
|
|
5889
6066
|
message += tomatch && tomatch.length > 1 ? 'one of ' : '';
|
|
5890
6067
|
message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
|
|
5891
|
-
throw new BotiumError$
|
|
6068
|
+
throw new BotiumError$2(message, {
|
|
5892
6069
|
type: 'asserter',
|
|
5893
6070
|
source: 'TextMatchAsserter',
|
|
5894
6071
|
context: {
|
|
@@ -5918,7 +6095,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
5918
6095
|
message += ' expected NOT to match ';
|
|
5919
6096
|
message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
|
|
5920
6097
|
message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
|
|
5921
|
-
throw new BotiumError$
|
|
6098
|
+
throw new BotiumError$2(message, {
|
|
5922
6099
|
type: 'asserter',
|
|
5923
6100
|
source: 'TextMatchAsserter',
|
|
5924
6101
|
context: {
|
|
@@ -5965,7 +6142,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
5965
6142
|
if (asserter[notAsserterType]) {
|
|
5966
6143
|
return p(this.retryHelperAsserter, () => asserter[notAsserterType](params));
|
|
5967
6144
|
} else {
|
|
5968
|
-
return pnot(this.retryHelperAsserter, () => asserter[asserterType](params), new BotiumError$
|
|
6145
|
+
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
6146
|
type: 'asserter',
|
|
5970
6147
|
source: asserter.name || asserterSpec.name,
|
|
5971
6148
|
params: {
|
|
@@ -6399,7 +6576,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6399
6576
|
});
|
|
6400
6577
|
|
|
6401
6578
|
if (aggregatedNoNames.length) {
|
|
6402
|
-
throw new BotiumError$
|
|
6579
|
+
throw new BotiumError$2('Scripting Memory Definition(s) without name', {
|
|
6403
6580
|
type: 'Scripting Memory',
|
|
6404
6581
|
subtype: 'Scripting Memory without name',
|
|
6405
6582
|
source: 'ScriptingProvider',
|
|
@@ -6415,7 +6592,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6415
6592
|
});
|
|
6416
6593
|
|
|
6417
6594
|
if (aggregatedNoVariables.length) {
|
|
6418
|
-
throw new BotiumError$
|
|
6595
|
+
throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariables.map(e => e.header.name).join(', ')} without variable`, {
|
|
6419
6596
|
type: 'Scripting Memory',
|
|
6420
6597
|
subtype: 'Scripting Memory without variable',
|
|
6421
6598
|
source: 'ScriptingProvider',
|
|
@@ -6431,7 +6608,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6431
6608
|
});
|
|
6432
6609
|
|
|
6433
6610
|
if (aggregatedNoVariableNames.length) {
|
|
6434
|
-
throw new BotiumError$
|
|
6611
|
+
throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariableNames.map(e => e.header.name).join(', ')} without variable name`, {
|
|
6435
6612
|
type: 'Scripting Memory',
|
|
6436
6613
|
subtype: 'Scripting Memory without variable name',
|
|
6437
6614
|
source: 'ScriptingProvider',
|
|
@@ -6463,7 +6640,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6463
6640
|
}
|
|
6464
6641
|
|
|
6465
6642
|
if (aggregatedDuplicates.length) {
|
|
6466
|
-
throw new BotiumError$
|
|
6643
|
+
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
6644
|
type: 'Scripting Memory',
|
|
6468
6645
|
subtype: 'Scripting Memory name collision',
|
|
6469
6646
|
source: 'ScriptingProvider',
|
|
@@ -6500,7 +6677,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6500
6677
|
}
|
|
6501
6678
|
|
|
6502
6679
|
if (aggregatedIntersections.length) {
|
|
6503
|
-
throw new BotiumError$
|
|
6680
|
+
throw new BotiumError$2(`Scripting Memory Definitions "${aggregatedIntersections.map(i => i.scriptingMemory.header.name).join(', ')}" are invalid because variable name collision"`, {
|
|
6504
6681
|
type: 'Scripting Memory',
|
|
6505
6682
|
subtype: 'Scripting Memory variable name collision',
|
|
6506
6683
|
source: 'ScriptingProvider',
|
|
@@ -6589,6 +6766,8 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6589
6766
|
|
|
6590
6767
|
debug$9(`ExpandScriptingMemoryToConvos - ${convosExpandedAll.length} convo expanded, added to convos (${this.convos.length}). Result ${convosExpandedAll.length + this.convos.length} convo`);
|
|
6591
6768
|
this.convos = this.convos.concat(convosExpandedAll);
|
|
6769
|
+
|
|
6770
|
+
this._sortConvos();
|
|
6592
6771
|
}
|
|
6593
6772
|
|
|
6594
6773
|
ExpandUtterancesToConvos({
|
|
@@ -6628,6 +6807,9 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6628
6807
|
},
|
|
6629
6808
|
conversation: [{
|
|
6630
6809
|
sender: 'me',
|
|
6810
|
+
logicHooks: [{
|
|
6811
|
+
name: 'SKIP_BOT_UNCONSUMED'
|
|
6812
|
+
}],
|
|
6631
6813
|
messageText: utt.name,
|
|
6632
6814
|
stepTag: 'Step 1 - tell utterance'
|
|
6633
6815
|
}, useNameAsIntent ? {
|
|
@@ -6943,7 +7125,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6943
7125
|
}
|
|
6944
7126
|
} else if (scriptingMemories) {
|
|
6945
7127
|
if (!scriptingMemories.header || !scriptingMemories.header.name) {
|
|
6946
|
-
throw new BotiumError$
|
|
7128
|
+
throw new BotiumError$2('Scripting Memory Definition has no name', {
|
|
6947
7129
|
type: 'Compiler',
|
|
6948
7130
|
subtype: 'Scripting memory without name',
|
|
6949
7131
|
source: 'ScriptingProvider',
|
|
@@ -6954,7 +7136,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6954
7136
|
}
|
|
6955
7137
|
|
|
6956
7138
|
if (!scriptingMemories.values || !Object.keys(scriptingMemories.values).length) {
|
|
6957
|
-
throw new BotiumError$
|
|
7139
|
+
throw new BotiumError$2('Scripting Memory Definition has no variables', {
|
|
6958
7140
|
type: 'Compiler',
|
|
6959
7141
|
subtype: 'Scripting memory without variable',
|
|
6960
7142
|
source: 'ScriptingProvider',
|
|
@@ -6965,7 +7147,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6965
7147
|
}
|
|
6966
7148
|
|
|
6967
7149
|
if (scriptingMemories.values && !lodash__default["default"].isUndefined(scriptingMemories.values[''])) {
|
|
6968
|
-
throw new BotiumError$
|
|
7150
|
+
throw new BotiumError$2('Scripting Memory Definition variable has no name', {
|
|
6969
7151
|
type: 'Compiler',
|
|
6970
7152
|
subtype: 'Scripting memory without variable name',
|
|
6971
7153
|
source: 'ScriptingProvider',
|
|
@@ -7400,7 +7582,7 @@ var BaseContainer_1 = class BaseContainer {
|
|
|
7400
7582
|
this.tempDirectory = tempDirectory;
|
|
7401
7583
|
this.cleanupTasks = [];
|
|
7402
7584
|
this.queues = {};
|
|
7403
|
-
this.
|
|
7585
|
+
this.bottleneck = null;
|
|
7404
7586
|
}
|
|
7405
7587
|
|
|
7406
7588
|
Validate() {
|
|
@@ -7410,18 +7592,33 @@ var BaseContainer_1 = class BaseContainer {
|
|
|
7410
7592
|
this.onBotResponseHook = getHook$1(this.caps, this.caps[Capabilities.CUSTOMHOOK_ONBOTRESPONSE]);
|
|
7411
7593
|
this.onStopHook = getHook$1(this.caps, this.caps[Capabilities.CUSTOMHOOK_ONSTOP]);
|
|
7412
7594
|
this.onCleanHook = getHook$1(this.caps, this.caps[Capabilities.CUSTOMHOOK_ONCLEAN]);
|
|
7413
|
-
return Promise.resolve();
|
|
7414
|
-
}
|
|
7415
7595
|
|
|
7416
|
-
|
|
7417
|
-
|
|
7596
|
+
if (this.caps[Capabilities.RATELIMIT_BOTTLENECK_FN]) {
|
|
7597
|
+
if (lodash__default["default"].isFunction(this.caps[Capabilities.RATELIMIT_BOTTLENECK_FN])) {
|
|
7598
|
+
this.bottleneck = this.caps[Capabilities.RATELIMIT_BOTTLENECK_FN];
|
|
7599
|
+
debug$7('Validate: Applying userSays rate limits from capability');
|
|
7600
|
+
} else {
|
|
7601
|
+
const limiter = new bottleneck__default["default"](this.caps[Capabilities.RATELIMIT_BOTTLENECK_FN]);
|
|
7602
|
+
|
|
7603
|
+
this.bottleneck = fn => limiter.schedule(fn);
|
|
7604
|
+
|
|
7605
|
+
debug$7(`Validate: Applying userSays rate limits ${util__default["default"].inspect(this.caps[Capabilities.RATELIMIT_BOTTLENECK_FN])}`);
|
|
7606
|
+
}
|
|
7607
|
+
} else if (this.caps[Capabilities.RATELIMIT_USERSAYS_MAXCONCURRENT] || this.caps[Capabilities.RATELIMIT_USERSAYS_MINTIME]) {
|
|
7418
7608
|
const opts = {};
|
|
7419
7609
|
if (this.caps[Capabilities.RATELIMIT_USERSAYS_MAXCONCURRENT]) opts.maxConcurrent = this.caps[Capabilities.RATELIMIT_USERSAYS_MAXCONCURRENT];
|
|
7420
7610
|
if (this.caps[Capabilities.RATELIMIT_USERSAYS_MINTIME]) opts.minTime = this.caps[Capabilities.RATELIMIT_USERSAYS_MINTIME];
|
|
7421
|
-
|
|
7422
|
-
|
|
7611
|
+
const limiter = new bottleneck__default["default"](opts);
|
|
7612
|
+
|
|
7613
|
+
this.bottleneck = fn => limiter.schedule(fn);
|
|
7614
|
+
|
|
7615
|
+
debug$7(`Validate: Applying userSays rate limits ${util__default["default"].inspect(opts)}`);
|
|
7423
7616
|
}
|
|
7424
7617
|
|
|
7618
|
+
return Promise.resolve();
|
|
7619
|
+
}
|
|
7620
|
+
|
|
7621
|
+
Build() {
|
|
7425
7622
|
return new Promise((resolve, reject) => {
|
|
7426
7623
|
this._RunCustomHook('onBuild', this.onBuildHook).then(() => resolve(this)).catch(err => reject(err));
|
|
7427
7624
|
});
|
|
@@ -7447,8 +7644,8 @@ var BaseContainer_1 = class BaseContainer {
|
|
|
7447
7644
|
meMsg
|
|
7448
7645
|
}).then(() => this.UserSaysImpl(meMsg));
|
|
7449
7646
|
|
|
7450
|
-
if (this.
|
|
7451
|
-
return this.
|
|
7647
|
+
if (this.bottleneck) {
|
|
7648
|
+
return this.bottleneck(run);
|
|
7452
7649
|
} else {
|
|
7453
7650
|
return run();
|
|
7454
7651
|
}
|
|
@@ -7927,16 +8124,23 @@ const {
|
|
|
7927
8124
|
const {
|
|
7928
8125
|
escapeJSONString
|
|
7929
8126
|
} = Utils;
|
|
8127
|
+
const {
|
|
8128
|
+
BotiumError: BotiumError$1
|
|
8129
|
+
} = BotiumError_1;
|
|
7930
8130
|
|
|
7931
8131
|
mustache__default["default"].escape = s => s;
|
|
7932
8132
|
|
|
7933
8133
|
var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
7934
8134
|
constructor({
|
|
7935
8135
|
queueBotSays,
|
|
7936
|
-
caps
|
|
8136
|
+
caps,
|
|
8137
|
+
bottleneck
|
|
7937
8138
|
}) {
|
|
7938
8139
|
this.queueBotSays = queueBotSays;
|
|
7939
8140
|
this.caps = Object.assign({}, Defaults, caps);
|
|
8141
|
+
|
|
8142
|
+
this.bottleneck = bottleneck || (fn => fn());
|
|
8143
|
+
|
|
7940
8144
|
this.processInbound = false;
|
|
7941
8145
|
this.redisTopic = this.caps[Capabilities.SIMPLEREST_REDIS_TOPIC] || 'SIMPLEREST_INBOUND_SUBSCRIPTION';
|
|
7942
8146
|
|
|
@@ -8311,6 +8515,22 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8311
8515
|
} else {
|
|
8312
8516
|
if (response.statusCode >= 400) {
|
|
8313
8517
|
debug$4(`got error response: ${response.statusCode}/${response.statusMessage}`);
|
|
8518
|
+
|
|
8519
|
+
if (debug$4.enabled && body) {
|
|
8520
|
+
debug$4(Utils.shortenJsonString(body));
|
|
8521
|
+
}
|
|
8522
|
+
|
|
8523
|
+
if (body) {
|
|
8524
|
+
const jsonBody = Utils.toJsonWeak(body);
|
|
8525
|
+
const errKey = Object.keys(jsonBody).find(k => k.startsWith('err') || k.startsWith('fail'));
|
|
8526
|
+
|
|
8527
|
+
if (errKey) {
|
|
8528
|
+
return reject(new BotiumError$1(`got error response: ${response.statusCode}/${response.statusMessage} - ${jsonBody[errKey]}`, {
|
|
8529
|
+
message: Utils.shortenJsonString(body)
|
|
8530
|
+
}));
|
|
8531
|
+
}
|
|
8532
|
+
}
|
|
8533
|
+
|
|
8314
8534
|
return reject(new Error(`got error response: ${response.statusCode}/${response.statusMessage}`));
|
|
8315
8535
|
}
|
|
8316
8536
|
|
|
@@ -8408,6 +8628,16 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8408
8628
|
}
|
|
8409
8629
|
}
|
|
8410
8630
|
|
|
8631
|
+
if (msg.ADD_FORM_PARAM && Object.keys(msg.ADD_FORM_PARAM).length > 0) {
|
|
8632
|
+
requestOptions.form = {};
|
|
8633
|
+
|
|
8634
|
+
for (const formKey of Object.keys(msg.ADD_FORM_PARAM)) {
|
|
8635
|
+
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);
|
|
8636
|
+
|
|
8637
|
+
requestOptions.form[formKey] = formValue;
|
|
8638
|
+
}
|
|
8639
|
+
}
|
|
8640
|
+
|
|
8411
8641
|
if (msg.ADD_HEADER && Object.keys(msg.ADD_HEADER).length > 0) {
|
|
8412
8642
|
requestOptions.headers = requestOptions.headers || {};
|
|
8413
8643
|
|
|
@@ -8449,7 +8679,7 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8449
8679
|
err,
|
|
8450
8680
|
response,
|
|
8451
8681
|
body
|
|
8452
|
-
} = await new Promise(resolve => {
|
|
8682
|
+
} = await this.bottleneck(() => new Promise(resolve => {
|
|
8453
8683
|
request__default["default"](pingConfig, (err, response, body) => {
|
|
8454
8684
|
resolve({
|
|
8455
8685
|
err,
|
|
@@ -8457,16 +8687,26 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8457
8687
|
body
|
|
8458
8688
|
});
|
|
8459
8689
|
});
|
|
8460
|
-
});
|
|
8690
|
+
}));
|
|
8461
8691
|
|
|
8462
8692
|
if (err) {
|
|
8463
8693
|
debug$4(`_waitForUrlResponse error on url check ${pingConfig.uri}: ${err}`);
|
|
8464
8694
|
await timeout(pingConfig.timeout);
|
|
8465
8695
|
} else if (response.statusCode >= 400) {
|
|
8466
8696
|
debug$4(`_waitForUrlResponse on url check ${pingConfig.uri} got error response: ${response.statusCode}/${response.statusMessage}`);
|
|
8697
|
+
|
|
8698
|
+
if (debug$4.enabled && body) {
|
|
8699
|
+
debug$4(Utils.shortenJsonString(body));
|
|
8700
|
+
}
|
|
8701
|
+
|
|
8467
8702
|
await timeout(pingConfig.timeout);
|
|
8468
8703
|
} else {
|
|
8469
|
-
debug$4(`_waitForUrlResponse success on url check ${pingConfig.uri}`);
|
|
8704
|
+
debug$4(`_waitForUrlResponse success on url check ${pingConfig.uri}: ${response.statusCode}/${response.statusMessage}`);
|
|
8705
|
+
|
|
8706
|
+
if (debug$4.enabled && body) {
|
|
8707
|
+
debug$4(Utils.shortenJsonString(body));
|
|
8708
|
+
}
|
|
8709
|
+
|
|
8470
8710
|
return body;
|
|
8471
8711
|
}
|
|
8472
8712
|
}
|
|
@@ -8690,6 +8930,10 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8690
8930
|
} else {
|
|
8691
8931
|
if (response.statusCode >= 400) {
|
|
8692
8932
|
debug$4(`_runPolling: got error response: ${response.statusCode}/${response.statusMessage}, request: ${JSON.stringify(pollConfig)}`);
|
|
8933
|
+
|
|
8934
|
+
if (debug$4.enabled && body) {
|
|
8935
|
+
debug$4(Utils.shortenJsonString(body));
|
|
8936
|
+
}
|
|
8693
8937
|
} else if (body) {
|
|
8694
8938
|
debug$4(`_runPolling: got response code: ${response.statusCode}, body: ${Utils.shortenJsonString(body)}`);
|
|
8695
8939
|
|
|
@@ -8967,6 +9211,7 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
|
|
|
8967
9211
|
this.pluginInstance = tryLoadPlugin(this.caps[Capabilities.CONTAINERMODE], this.caps[Capabilities.PLUGINMODULEPATH], {
|
|
8968
9212
|
container: this,
|
|
8969
9213
|
queueBotSays: msg => this._QueueBotSays(msg),
|
|
9214
|
+
bottleneck: this.bottleneck,
|
|
8970
9215
|
eventEmitter: this.eventEmitter,
|
|
8971
9216
|
caps: this.caps,
|
|
8972
9217
|
sources: this.sources,
|
|
@@ -9664,6 +9909,7 @@ var botiumCore = {
|
|
|
9664
9909
|
ScriptingConstants: Constants,
|
|
9665
9910
|
Capabilities: Capabilities,
|
|
9666
9911
|
Defaults: Defaults$1,
|
|
9912
|
+
Enums: Enums,
|
|
9667
9913
|
Source: Source,
|
|
9668
9914
|
Events: Events,
|
|
9669
9915
|
Plugins: Plugins,
|
|
@@ -9683,31 +9929,33 @@ var botiumCore_2 = botiumCore.ScriptingProvider;
|
|
|
9683
9929
|
var botiumCore_3 = botiumCore.ScriptingConstants;
|
|
9684
9930
|
var botiumCore_4 = botiumCore.Capabilities;
|
|
9685
9931
|
var botiumCore_5 = botiumCore.Defaults;
|
|
9686
|
-
var botiumCore_6 = botiumCore.
|
|
9687
|
-
var botiumCore_7 = botiumCore.
|
|
9688
|
-
var botiumCore_8 = botiumCore.
|
|
9689
|
-
var botiumCore_9 = botiumCore.
|
|
9690
|
-
var botiumCore_10 = botiumCore.
|
|
9691
|
-
var botiumCore_11 = botiumCore.
|
|
9692
|
-
var botiumCore_12 = botiumCore.
|
|
9693
|
-
var botiumCore_13 = botiumCore.
|
|
9694
|
-
var botiumCore_14 = botiumCore.
|
|
9695
|
-
var botiumCore_15 = botiumCore.
|
|
9932
|
+
var botiumCore_6 = botiumCore.Enums;
|
|
9933
|
+
var botiumCore_7 = botiumCore.Source;
|
|
9934
|
+
var botiumCore_8 = botiumCore.Events;
|
|
9935
|
+
var botiumCore_9 = botiumCore.Plugins;
|
|
9936
|
+
var botiumCore_10 = botiumCore.BotiumError;
|
|
9937
|
+
var botiumCore_11 = botiumCore.ScriptingMemory;
|
|
9938
|
+
var botiumCore_12 = botiumCore.HookUtils;
|
|
9939
|
+
var botiumCore_13 = botiumCore.LogicHookConstants;
|
|
9940
|
+
var botiumCore_14 = botiumCore.Lib;
|
|
9941
|
+
var botiumCore_15 = botiumCore.InboundProxy;
|
|
9942
|
+
var botiumCore_16 = botiumCore.BotiumMockRichMessageTypes;
|
|
9696
9943
|
|
|
9697
9944
|
exports.BotDriver = botiumCore_1;
|
|
9698
|
-
exports.BotiumError =
|
|
9699
|
-
exports.BotiumMockRichMessageTypes =
|
|
9945
|
+
exports.BotiumError = botiumCore_10;
|
|
9946
|
+
exports.BotiumMockRichMessageTypes = botiumCore_16;
|
|
9700
9947
|
exports.Capabilities = botiumCore_4;
|
|
9701
9948
|
exports.Defaults = botiumCore_5;
|
|
9702
|
-
exports.
|
|
9703
|
-
exports.
|
|
9704
|
-
exports.
|
|
9705
|
-
exports.
|
|
9706
|
-
exports.
|
|
9707
|
-
exports.
|
|
9949
|
+
exports.Enums = botiumCore_6;
|
|
9950
|
+
exports.Events = botiumCore_8;
|
|
9951
|
+
exports.HookUtils = botiumCore_12;
|
|
9952
|
+
exports.InboundProxy = botiumCore_15;
|
|
9953
|
+
exports.Lib = botiumCore_14;
|
|
9954
|
+
exports.LogicHookConstants = botiumCore_13;
|
|
9955
|
+
exports.Plugins = botiumCore_9;
|
|
9708
9956
|
exports.ScriptingConstants = botiumCore_3;
|
|
9709
|
-
exports.ScriptingMemory =
|
|
9957
|
+
exports.ScriptingMemory = botiumCore_11;
|
|
9710
9958
|
exports.ScriptingProvider = botiumCore_2;
|
|
9711
|
-
exports.Source =
|
|
9959
|
+
exports.Source = botiumCore_7;
|
|
9712
9960
|
exports["default"] = botiumCore;
|
|
9713
9961
|
//# sourceMappingURL=botium-cjs.js.map
|