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.
- package/dist/botium-cjs.js +95 -63
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +95 -63
- package/dist/botium-es.js.map +1 -1
- package/package.json +25 -25
- package/samples/connectors/custom/botium-connector-myapi.js +3 -3
- package/samples/extensions/asserterHooks/DummyAsserter.js +3 -3
- package/src/containers/plugins/SimpleRestContainer.js +19 -0
- package/src/scripting/CompilerCsv.js +1 -1
- package/src/scripting/logichook/LogicHookUtils.js +2 -0
- package/src/scripting/logichook/asserter/JsonPathAsserter.js +1 -1
- package/test/connectors/convos/hello.convo.txt +6 -0
- package/test/connectors/simplerest.spec.js +42 -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/
|
|
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.
|
|
39
|
+
var version$1 = "1.12.0";
|
|
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: ">=
|
|
44
|
+
node: ">=14.0.0"
|
|
45
45
|
};
|
|
46
46
|
var scripts = {
|
|
47
47
|
postinstall: "node ./report.js",
|
|
@@ -68,23 +68,23 @@ var bugs = {
|
|
|
68
68
|
};
|
|
69
69
|
var homepage = "https://www.botium.ai";
|
|
70
70
|
var dependencies = {
|
|
71
|
-
"@babel/runtime": "^7.16.
|
|
71
|
+
"@babel/runtime": "^7.16.5",
|
|
72
72
|
async: "^3.2.2",
|
|
73
|
-
"body-parser": "^1.19.
|
|
73
|
+
"body-parser": "^1.19.1",
|
|
74
74
|
boolean: "^3.1.4",
|
|
75
75
|
bottleneck: "^2.19.5",
|
|
76
|
-
"csv-parse": "^
|
|
77
|
-
debug: "^4.3.
|
|
76
|
+
"csv-parse": "^5.0.3",
|
|
77
|
+
debug: "^4.3.3",
|
|
78
78
|
esprima: "^4.0.1",
|
|
79
|
-
express: "^4.17.
|
|
79
|
+
express: "^4.17.2",
|
|
80
80
|
globby: "11.0.4",
|
|
81
|
-
ioredis: "^4.28.
|
|
81
|
+
ioredis: "^4.28.2",
|
|
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.
|
|
87
|
-
"mime-types": "^2.1.
|
|
86
|
+
"markdown-it": "^12.3.0",
|
|
87
|
+
"mime-types": "^2.1.34",
|
|
88
88
|
mkdirp: "^1.0.4",
|
|
89
89
|
moment: "^2.29.1",
|
|
90
90
|
mustache: "^4.2.0",
|
|
@@ -94,40 +94,40 @@ var dependencies = {
|
|
|
94
94
|
request: "^2.88.2",
|
|
95
95
|
rimraf: "^3.0.2",
|
|
96
96
|
"sanitize-filename": "^1.6.3",
|
|
97
|
-
slugify: "^1.6.
|
|
98
|
-
"socket.io": "^4.
|
|
99
|
-
"socket.io-client": "^4.
|
|
97
|
+
slugify: "^1.6.4",
|
|
98
|
+
"socket.io": "^4.4.0",
|
|
99
|
+
"socket.io-client": "^4.4.0",
|
|
100
100
|
"socketio-auth": "^0.1.1",
|
|
101
101
|
"swagger-jsdoc": "^6.1.0",
|
|
102
|
-
"swagger-ui-express": "^4.
|
|
102
|
+
"swagger-ui-express": "^4.3.0",
|
|
103
103
|
uuid: "^8.3.2",
|
|
104
104
|
vm2: "^3.9.5",
|
|
105
105
|
"write-yaml": "^1.0.0",
|
|
106
|
-
xlsx: "^0.17.
|
|
106
|
+
xlsx: "^0.17.4",
|
|
107
107
|
xregexp: "^5.1.0",
|
|
108
108
|
yaml: "^1.10.2"
|
|
109
109
|
};
|
|
110
110
|
var devDependencies = {
|
|
111
|
-
"@babel/core": "^7.16.
|
|
112
|
-
"@babel/node": "^7.16.
|
|
113
|
-
"@babel/plugin-transform-runtime": "^7.16.
|
|
114
|
-
"@babel/preset-env": "^7.16.
|
|
111
|
+
"@babel/core": "^7.16.5",
|
|
112
|
+
"@babel/node": "^7.16.5",
|
|
113
|
+
"@babel/plugin-transform-runtime": "^7.16.5",
|
|
114
|
+
"@babel/preset-env": "^7.16.5",
|
|
115
115
|
chai: "^4.3.4",
|
|
116
116
|
"chai-as-promised": "^7.1.1",
|
|
117
117
|
"cross-env": "^7.0.3",
|
|
118
|
-
eslint: "^8.1
|
|
118
|
+
eslint: "^8.4.1",
|
|
119
119
|
"eslint-config-standard": "^16.0.3",
|
|
120
|
-
"eslint-plugin-import": "^2.25.
|
|
120
|
+
"eslint-plugin-import": "^2.25.3",
|
|
121
121
|
"eslint-plugin-node": "^11.1.0",
|
|
122
|
-
"eslint-plugin-promise": "^5.
|
|
122
|
+
"eslint-plugin-promise": "^5.2.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
126
|
mocha: "^9.1.3",
|
|
127
|
-
nock: "^13.1
|
|
128
|
-
"npm-check-updates": "^12.0.
|
|
127
|
+
nock: "^13.2.1",
|
|
128
|
+
"npm-check-updates": "^12.0.5",
|
|
129
129
|
nyc: "^15.1.0",
|
|
130
|
-
rollup: "^2.
|
|
130
|
+
rollup: "^2.61.1",
|
|
131
131
|
"rollup-plugin-babel": "^4.4.0",
|
|
132
132
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
133
133
|
"rollup-plugin-json": "^4.0.0",
|
|
@@ -831,7 +831,7 @@ function getCjsExportFromNamespace (n) {
|
|
|
831
831
|
return n && n['default'] || n;
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
-
const BotiumError$
|
|
834
|
+
const BotiumError$7 = class BotiumError extends Error {
|
|
835
835
|
/**
|
|
836
836
|
*
|
|
837
837
|
* @param message
|
|
@@ -917,10 +917,10 @@ const _getChildErrorsFromContext = context => {
|
|
|
917
917
|
};
|
|
918
918
|
|
|
919
919
|
const botiumErrorFromErr$2 = (message, err) => {
|
|
920
|
-
if (err instanceof BotiumError$
|
|
921
|
-
return new BotiumError$
|
|
920
|
+
if (err instanceof BotiumError$7) {
|
|
921
|
+
return new BotiumError$7(message, err.context, true);
|
|
922
922
|
} else {
|
|
923
|
-
return new BotiumError$
|
|
923
|
+
return new BotiumError$7(message, {
|
|
924
924
|
err
|
|
925
925
|
}, true);
|
|
926
926
|
}
|
|
@@ -935,7 +935,7 @@ const botiumErrorFromList$2 = (errors, {
|
|
|
935
935
|
let children = [];
|
|
936
936
|
|
|
937
937
|
for (const error of errors) {
|
|
938
|
-
if (error instanceof BotiumError$
|
|
938
|
+
if (error instanceof BotiumError$7) {
|
|
939
939
|
const childErrors = flat && _getChildErrorsFromContext(error.context);
|
|
940
940
|
|
|
941
941
|
if (childErrors && childErrors.length) {
|
|
@@ -948,7 +948,7 @@ const botiumErrorFromList$2 = (errors, {
|
|
|
948
948
|
}
|
|
949
949
|
}
|
|
950
950
|
|
|
951
|
-
const result = new BotiumError$
|
|
951
|
+
const result = new BotiumError$7(message, {
|
|
952
952
|
errors: children,
|
|
953
953
|
type,
|
|
954
954
|
source
|
|
@@ -957,7 +957,7 @@ const botiumErrorFromList$2 = (errors, {
|
|
|
957
957
|
};
|
|
958
958
|
|
|
959
959
|
var BotiumError_1 = {
|
|
960
|
-
BotiumError: BotiumError$
|
|
960
|
+
BotiumError: BotiumError$7,
|
|
961
961
|
botiumErrorFromErr: botiumErrorFromErr$2,
|
|
962
962
|
botiumErrorFromList: botiumErrorFromList$2
|
|
963
963
|
};
|
|
@@ -1138,7 +1138,7 @@ const {
|
|
|
1138
1138
|
} = vm2;
|
|
1139
1139
|
const debug$k = debug$l('botium-core-asserterUtils');
|
|
1140
1140
|
const {
|
|
1141
|
-
BotiumError: BotiumError$
|
|
1141
|
+
BotiumError: BotiumError$6
|
|
1142
1142
|
} = BotiumError_1;
|
|
1143
1143
|
const {
|
|
1144
1144
|
DEFAULT_ASSERTERS,
|
|
@@ -1289,7 +1289,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
|
|
|
1289
1289
|
|
|
1290
1290
|
const _checkUnsafe = () => {
|
|
1291
1291
|
if (!this.caps[Capabilities.SECURITY_ALLOW_UNSAFE]) {
|
|
1292
|
-
throw new BotiumError$
|
|
1292
|
+
throw new BotiumError$6('Security Error. Using unsafe component is not allowed', {
|
|
1293
1293
|
type: 'security',
|
|
1294
1294
|
subtype: 'allow unsafe',
|
|
1295
1295
|
source: path.basename(__filename),
|
|
@@ -1433,6 +1433,11 @@ var LogicHookUtils_1 = class LogicHookUtils {
|
|
|
1433
1433
|
ref,
|
|
1434
1434
|
...this.buildScriptContext
|
|
1435
1435
|
}, this.caps, args);
|
|
1436
|
+
} else if (lodash.isFunction(CheckClass.PluginClass)) {
|
|
1437
|
+
return CheckClass.PluginClass({
|
|
1438
|
+
ref,
|
|
1439
|
+
...this.buildScriptContext
|
|
1440
|
+
}, this.caps, args);
|
|
1436
1441
|
} else {
|
|
1437
1442
|
throw new Error(`${src} class or function expected`);
|
|
1438
1443
|
}
|
|
@@ -2243,7 +2248,7 @@ const {
|
|
|
2243
2248
|
toString: toString$2
|
|
2244
2249
|
} = helper;
|
|
2245
2250
|
const {
|
|
2246
|
-
BotiumError: BotiumError$
|
|
2251
|
+
BotiumError: BotiumError$5
|
|
2247
2252
|
} = BotiumError_1; // If they got parameter, then it will be a string always.
|
|
2248
2253
|
// the receiver can decide what to do with it,
|
|
2249
2254
|
// convert to int,
|
|
@@ -2412,7 +2417,7 @@ const SCRIPTING_FUNCTIONS$1 = lodash.mapValues(SCRIPTING_FUNCTIONS_RAW, (funcOrS
|
|
|
2412
2417
|
return {
|
|
2413
2418
|
handler: (caps, ...rest) => {
|
|
2414
2419
|
if (!caps[Capabilities.SECURITY_ALLOW_UNSAFE] && funcOrStruct.unsafe) {
|
|
2415
|
-
throw new BotiumError$
|
|
2420
|
+
throw new BotiumError$5(`Security Error. Using unsafe scripting memory function ${name} is not allowed`, {
|
|
2416
2421
|
type: 'security',
|
|
2417
2422
|
subtype: 'allow unsafe',
|
|
2418
2423
|
source: path.basename(__filename),
|
|
@@ -2561,7 +2566,7 @@ ScriptingMemory.SCRIPTING_FUNCTIONS;
|
|
|
2561
2566
|
|
|
2562
2567
|
const debug$i = debug$l('botium-core-Convo');
|
|
2563
2568
|
const {
|
|
2564
|
-
BotiumError: BotiumError$
|
|
2569
|
+
BotiumError: BotiumError$4,
|
|
2565
2570
|
botiumErrorFromErr: botiumErrorFromErr$1,
|
|
2566
2571
|
botiumErrorFromList: botiumErrorFromList$1
|
|
2567
2572
|
} = BotiumError_1;
|
|
@@ -3090,7 +3095,7 @@ class Convo$6 {
|
|
|
3090
3095
|
}
|
|
3091
3096
|
|
|
3092
3097
|
if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
|
|
3093
|
-
const failErr = new BotiumError$
|
|
3098
|
+
const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);
|
|
3094
3099
|
debug$i(failErr);
|
|
3095
3100
|
|
|
3096
3101
|
try {
|
|
@@ -3193,7 +3198,7 @@ class Convo$6 {
|
|
|
3193
3198
|
this.scriptingEvents.fail && this.scriptingEvents.fail(failErr, lastMeConvoStep);
|
|
3194
3199
|
} catch (failErr) {}
|
|
3195
3200
|
|
|
3196
|
-
if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$
|
|
3201
|
+
if (container.caps[Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS] && err instanceof BotiumError$4) {
|
|
3197
3202
|
assertErrors.push(err);
|
|
3198
3203
|
} else {
|
|
3199
3204
|
throw failErr;
|
|
@@ -3210,7 +3215,7 @@ class Convo$6 {
|
|
|
3210
3215
|
}
|
|
3211
3216
|
}
|
|
3212
3217
|
} else {
|
|
3213
|
-
const failErr = new BotiumError$
|
|
3218
|
+
const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: invalid sender - ${util.inspect(convoStep.sender)}`);
|
|
3214
3219
|
debug$i(failErr);
|
|
3215
3220
|
|
|
3216
3221
|
try {
|
|
@@ -3221,7 +3226,7 @@ class Convo$6 {
|
|
|
3221
3226
|
}
|
|
3222
3227
|
} catch (err) {
|
|
3223
3228
|
if (lastMeConvoStep) {
|
|
3224
|
-
if (err instanceof BotiumError$
|
|
3229
|
+
if (err instanceof BotiumError$4 && err.context) {
|
|
3225
3230
|
err.context.input = new ConvoStep$1(lastMeConvoStep);
|
|
3226
3231
|
err.context.transcript = [...transcriptSteps, { ...transcriptStep
|
|
3227
3232
|
}];
|
|
@@ -3256,11 +3261,11 @@ class Convo$6 {
|
|
|
3256
3261
|
|
|
3257
3262
|
if (lodash.isArray(expected)) {
|
|
3258
3263
|
if (!lodash.isArray(result)) {
|
|
3259
|
-
throw new BotiumError$
|
|
3264
|
+
throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array, got "${result}"`);
|
|
3260
3265
|
}
|
|
3261
3266
|
|
|
3262
3267
|
if (expected.length !== result.length) {
|
|
3263
|
-
throw new BotiumError$
|
|
3268
|
+
throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response expected array length ${expected.length}, got ${result.length}`);
|
|
3264
3269
|
}
|
|
3265
3270
|
|
|
3266
3271
|
for (let i = 0; i < expected.length; i++) {
|
|
@@ -3271,7 +3276,7 @@ class Convo$6 {
|
|
|
3271
3276
|
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
3272
3277
|
this._compareObject(container, scriptingMemory, convoStep, result[key], expected[key]);
|
|
3273
3278
|
} else {
|
|
3274
|
-
throw new BotiumError$
|
|
3279
|
+
throw new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot response "${result}" missing expected property: ${key}`);
|
|
3275
3280
|
}
|
|
3276
3281
|
});
|
|
3277
3282
|
} else {
|
|
@@ -3399,17 +3404,17 @@ class Convo$6 {
|
|
|
3399
3404
|
const alreadyThereAt = parentPConvos.indexOf(includeLogicHook);
|
|
3400
3405
|
|
|
3401
3406
|
if (alreadyThereAt >= 0) {
|
|
3402
|
-
throw new BotiumError$
|
|
3407
|
+
throw new BotiumError$4(`Partial convos are included circular. "${includeLogicHook}" is referenced by "/${parentPConvos.slice(0, alreadyThereAt).join('/')}" and by "/${parentPConvos.join('/')}" `);
|
|
3403
3408
|
}
|
|
3404
3409
|
|
|
3405
3410
|
if (!partialConvos || Object.keys(partialConvos).length === 0) {
|
|
3406
|
-
throw new BotiumError$
|
|
3411
|
+
throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (There are no partial convos)`);
|
|
3407
3412
|
}
|
|
3408
3413
|
|
|
3409
3414
|
const partialConvo = partialConvos[includeLogicHook];
|
|
3410
3415
|
|
|
3411
3416
|
if (!partialConvo) {
|
|
3412
|
-
throw new BotiumError$
|
|
3417
|
+
throw new BotiumError$4(`Cant find partial convo with name ${includeLogicHook} (available partial convos: ${Object.keys(partialConvos).join(',')})`);
|
|
3413
3418
|
}
|
|
3414
3419
|
|
|
3415
3420
|
_getEffectiveConversationRecursive(partialConvo.conversation, [...parentPConvos, includeLogicHook], result, true);
|
|
@@ -3791,7 +3796,7 @@ const {
|
|
|
3791
3796
|
} = vm2;
|
|
3792
3797
|
const debug$h = debug$l('botium-core-HookUtils');
|
|
3793
3798
|
const {
|
|
3794
|
-
BotiumError: BotiumError$
|
|
3799
|
+
BotiumError: BotiumError$3
|
|
3795
3800
|
} = BotiumError_1;
|
|
3796
3801
|
|
|
3797
3802
|
const executeHook$2 = async (caps, hook, args) => {
|
|
@@ -3863,7 +3868,7 @@ const getHook$3 = (caps, data) => {
|
|
|
3863
3868
|
|
|
3864
3869
|
if (resultWithRequire) {
|
|
3865
3870
|
if (!allowUnsafe) {
|
|
3866
|
-
throw new BotiumError$
|
|
3871
|
+
throw new BotiumError$3('Security Error. Using unsafe custom hook with require is not allowed', {
|
|
3867
3872
|
type: 'security',
|
|
3868
3873
|
subtype: 'allow unsafe',
|
|
3869
3874
|
source: path.basename(__filename),
|
|
@@ -5030,6 +5035,9 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
5030
5035
|
|
|
5031
5036
|
};
|
|
5032
5037
|
|
|
5038
|
+
const {
|
|
5039
|
+
parse
|
|
5040
|
+
} = sync;
|
|
5033
5041
|
const debug$c = debug$l('botium-core-CompilerCsv');
|
|
5034
5042
|
const {
|
|
5035
5043
|
Convo: Convo$3
|
|
@@ -5102,7 +5110,7 @@ var CompilerCsv_1 = class CompilerCsv extends CompilerBase_1 {
|
|
|
5102
5110
|
let rows;
|
|
5103
5111
|
|
|
5104
5112
|
try {
|
|
5105
|
-
rows =
|
|
5113
|
+
rows = parse(scriptData, {
|
|
5106
5114
|
delimiter,
|
|
5107
5115
|
escape: this.caps[Capabilities.SCRIPTING_CSV_ESCAPE],
|
|
5108
5116
|
quote: this.caps[Capabilities.SCRIPTING_CSV_QUOTE],
|
|
@@ -5565,7 +5573,7 @@ const {
|
|
|
5565
5573
|
ConvoStep
|
|
5566
5574
|
} = Convo_1;
|
|
5567
5575
|
const {
|
|
5568
|
-
BotiumError: BotiumError$
|
|
5576
|
+
BotiumError: BotiumError$2,
|
|
5569
5577
|
botiumErrorFromList,
|
|
5570
5578
|
botiumErrorFromErr
|
|
5571
5579
|
} = BotiumError_1;
|
|
@@ -5845,7 +5853,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
5845
5853
|
message += ' expected to match ';
|
|
5846
5854
|
message += tomatch && tomatch.length > 1 ? 'one of ' : '';
|
|
5847
5855
|
message += `${tomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
|
|
5848
|
-
throw new BotiumError$
|
|
5856
|
+
throw new BotiumError$2(message, {
|
|
5849
5857
|
type: 'asserter',
|
|
5850
5858
|
source: 'TextMatchAsserter',
|
|
5851
5859
|
context: {
|
|
@@ -5875,7 +5883,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
5875
5883
|
message += ' expected NOT to match ';
|
|
5876
5884
|
message += nottomatch && nottomatch.length > 1 ? 'one of ' : '';
|
|
5877
5885
|
message += `${nottomatch.map(e => e ? '"' + e + '"' : '<any response>').join(', ')}`;
|
|
5878
|
-
throw new BotiumError$
|
|
5886
|
+
throw new BotiumError$2(message, {
|
|
5879
5887
|
type: 'asserter',
|
|
5880
5888
|
source: 'TextMatchAsserter',
|
|
5881
5889
|
context: {
|
|
@@ -5922,7 +5930,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
5922
5930
|
if (asserter[notAsserterType]) {
|
|
5923
5931
|
return p(this.retryHelperAsserter, () => asserter[notAsserterType](params));
|
|
5924
5932
|
} else {
|
|
5925
|
-
return pnot(this.retryHelperAsserter, () => asserter[asserterType](params), new BotiumError$
|
|
5933
|
+
return pnot(this.retryHelperAsserter, () => asserter[asserterType](params), new BotiumError$2(`${convoStep.stepTag}: Expected asserter ${asserter.name || asserterSpec.name} with args "${params.args}" to fail`, {
|
|
5926
5934
|
type: 'asserter',
|
|
5927
5935
|
source: asserter.name || asserterSpec.name,
|
|
5928
5936
|
params: {
|
|
@@ -6356,7 +6364,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6356
6364
|
});
|
|
6357
6365
|
|
|
6358
6366
|
if (aggregatedNoNames.length) {
|
|
6359
|
-
throw new BotiumError$
|
|
6367
|
+
throw new BotiumError$2('Scripting Memory Definition(s) without name', {
|
|
6360
6368
|
type: 'Scripting Memory',
|
|
6361
6369
|
subtype: 'Scripting Memory without name',
|
|
6362
6370
|
source: 'ScriptingProvider',
|
|
@@ -6372,7 +6380,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6372
6380
|
});
|
|
6373
6381
|
|
|
6374
6382
|
if (aggregatedNoVariables.length) {
|
|
6375
|
-
throw new BotiumError$
|
|
6383
|
+
throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariables.map(e => e.header.name).join(', ')} without variable`, {
|
|
6376
6384
|
type: 'Scripting Memory',
|
|
6377
6385
|
subtype: 'Scripting Memory without variable',
|
|
6378
6386
|
source: 'ScriptingProvider',
|
|
@@ -6388,7 +6396,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6388
6396
|
});
|
|
6389
6397
|
|
|
6390
6398
|
if (aggregatedNoVariableNames.length) {
|
|
6391
|
-
throw new BotiumError$
|
|
6399
|
+
throw new BotiumError$2(`Scripting Memory Definition(s) ${aggregatedNoVariableNames.map(e => e.header.name).join(', ')} without variable name`, {
|
|
6392
6400
|
type: 'Scripting Memory',
|
|
6393
6401
|
subtype: 'Scripting Memory without variable name',
|
|
6394
6402
|
source: 'ScriptingProvider',
|
|
@@ -6420,7 +6428,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6420
6428
|
}
|
|
6421
6429
|
|
|
6422
6430
|
if (aggregatedDuplicates.length) {
|
|
6423
|
-
throw new BotiumError$
|
|
6431
|
+
throw new BotiumError$2(`Scripting Memory Definition name(s) "${lodash.uniq(aggregatedDuplicates.map(d => d.scriptingMemory.header.name)).join(', ')}" are not unique`, {
|
|
6424
6432
|
type: 'Scripting Memory',
|
|
6425
6433
|
subtype: 'Scripting Memory name collision',
|
|
6426
6434
|
source: 'ScriptingProvider',
|
|
@@ -6457,7 +6465,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6457
6465
|
}
|
|
6458
6466
|
|
|
6459
6467
|
if (aggregatedIntersections.length) {
|
|
6460
|
-
throw new BotiumError$
|
|
6468
|
+
throw new BotiumError$2(`Scripting Memory Definitions "${aggregatedIntersections.map(i => i.scriptingMemory.header.name).join(', ')}" are invalid because variable name collision"`, {
|
|
6461
6469
|
type: 'Scripting Memory',
|
|
6462
6470
|
subtype: 'Scripting Memory variable name collision',
|
|
6463
6471
|
source: 'ScriptingProvider',
|
|
@@ -6900,7 +6908,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6900
6908
|
}
|
|
6901
6909
|
} else if (scriptingMemories) {
|
|
6902
6910
|
if (!scriptingMemories.header || !scriptingMemories.header.name) {
|
|
6903
|
-
throw new BotiumError$
|
|
6911
|
+
throw new BotiumError$2('Scripting Memory Definition has no name', {
|
|
6904
6912
|
type: 'Compiler',
|
|
6905
6913
|
subtype: 'Scripting memory without name',
|
|
6906
6914
|
source: 'ScriptingProvider',
|
|
@@ -6911,7 +6919,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6911
6919
|
}
|
|
6912
6920
|
|
|
6913
6921
|
if (!scriptingMemories.values || !Object.keys(scriptingMemories.values).length) {
|
|
6914
|
-
throw new BotiumError$
|
|
6922
|
+
throw new BotiumError$2('Scripting Memory Definition has no variables', {
|
|
6915
6923
|
type: 'Compiler',
|
|
6916
6924
|
subtype: 'Scripting memory without variable',
|
|
6917
6925
|
source: 'ScriptingProvider',
|
|
@@ -6922,7 +6930,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6922
6930
|
}
|
|
6923
6931
|
|
|
6924
6932
|
if (scriptingMemories.values && !lodash.isUndefined(scriptingMemories.values[''])) {
|
|
6925
|
-
throw new BotiumError$
|
|
6933
|
+
throw new BotiumError$2('Scripting Memory Definition variable has no name', {
|
|
6926
6934
|
type: 'Compiler',
|
|
6927
6935
|
subtype: 'Scripting memory without variable name',
|
|
6928
6936
|
source: 'ScriptingProvider',
|
|
@@ -7884,6 +7892,9 @@ const {
|
|
|
7884
7892
|
const {
|
|
7885
7893
|
escapeJSONString
|
|
7886
7894
|
} = Utils;
|
|
7895
|
+
const {
|
|
7896
|
+
BotiumError: BotiumError$1
|
|
7897
|
+
} = BotiumError_1;
|
|
7887
7898
|
|
|
7888
7899
|
mustache.escape = s => s;
|
|
7889
7900
|
|
|
@@ -8273,6 +8284,17 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8273
8284
|
debug$4(Utils.shortenJsonString(body));
|
|
8274
8285
|
}
|
|
8275
8286
|
|
|
8287
|
+
if (body) {
|
|
8288
|
+
const jsonBody = Utils.toJsonWeak(body);
|
|
8289
|
+
const errKey = Object.keys(jsonBody).find(k => k.startsWith('err') || k.startsWith('fail'));
|
|
8290
|
+
|
|
8291
|
+
if (errKey) {
|
|
8292
|
+
return reject(new BotiumError$1(`got error response: ${response.statusCode}/${response.statusMessage} - ${jsonBody[errKey]}`, {
|
|
8293
|
+
message: Utils.shortenJsonString(body)
|
|
8294
|
+
}));
|
|
8295
|
+
}
|
|
8296
|
+
}
|
|
8297
|
+
|
|
8276
8298
|
return reject(new Error(`got error response: ${response.statusCode}/${response.statusMessage}`));
|
|
8277
8299
|
}
|
|
8278
8300
|
|
|
@@ -8370,6 +8392,16 @@ var SimpleRestContainer_1 = class SimpleRestContainer {
|
|
|
8370
8392
|
}
|
|
8371
8393
|
}
|
|
8372
8394
|
|
|
8395
|
+
if (msg.ADD_FORM_PARAM && Object.keys(msg.ADD_FORM_PARAM).length > 0) {
|
|
8396
|
+
requestOptions.form = {};
|
|
8397
|
+
|
|
8398
|
+
for (const formKey of Object.keys(msg.ADD_FORM_PARAM)) {
|
|
8399
|
+
const formValue = this._getMustachedVal(lodash.isString(msg.ADD_FORM_PARAM[formKey]) ? msg.ADD_FORM_PARAM[formKey] : JSON.stringify(msg.ADD_FORM_PARAM[formKey]), false);
|
|
8400
|
+
|
|
8401
|
+
requestOptions.form[formKey] = formValue;
|
|
8402
|
+
}
|
|
8403
|
+
}
|
|
8404
|
+
|
|
8373
8405
|
if (msg.ADD_HEADER && Object.keys(msg.ADD_HEADER).length > 0) {
|
|
8374
8406
|
requestOptions.headers = requestOptions.headers || {};
|
|
8375
8407
|
|