botium-core 1.12.0 → 1.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/botium-cjs.js +290 -115
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +281 -107
- package/dist/botium-es.js.map +1 -1
- package/index.js +1 -0
- package/package.json +21 -21
- package/src/Capabilities.js +3 -0
- package/src/Defaults.js +1 -0
- package/src/Enums.js +6 -0
- package/src/scripting/BotiumError.js +21 -0
- 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/logichooks/ClearQueueLogicHook.js +1 -1
- package/src/scripting/logichook/userinput/MediaInput.js +14 -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-es.js
CHANGED
|
@@ -36,7 +36,7 @@ import express from 'express';
|
|
|
36
36
|
import bodyParser from 'body-parser';
|
|
37
37
|
|
|
38
38
|
var name = "botium-core";
|
|
39
|
-
var version$1 = "1.12.
|
|
39
|
+
var version$1 = "1.12.1";
|
|
40
40
|
var description = "The Selenium for Chatbots";
|
|
41
41
|
var main = "index.js";
|
|
42
42
|
var module = "dist/botium-es.js";
|
|
@@ -68,22 +68,22 @@ var bugs = {
|
|
|
68
68
|
};
|
|
69
69
|
var homepage = "https://www.botium.ai";
|
|
70
70
|
var dependencies = {
|
|
71
|
-
"@babel/runtime": "^7.16.
|
|
72
|
-
async: "^3.2.
|
|
71
|
+
"@babel/runtime": "^7.16.7",
|
|
72
|
+
async: "^3.2.3",
|
|
73
73
|
"body-parser": "^1.19.1",
|
|
74
74
|
boolean: "^3.1.4",
|
|
75
75
|
bottleneck: "^2.19.5",
|
|
76
|
-
"csv-parse": "^5.0.
|
|
76
|
+
"csv-parse": "^5.0.4",
|
|
77
77
|
debug: "^4.3.3",
|
|
78
78
|
esprima: "^4.0.1",
|
|
79
79
|
express: "^4.17.2",
|
|
80
80
|
globby: "11.0.4",
|
|
81
|
-
ioredis: "^4.28.
|
|
81
|
+
ioredis: "^4.28.3",
|
|
82
82
|
"is-class": "^0.0.9",
|
|
83
83
|
"is-json": "^2.0.1",
|
|
84
84
|
jsonpath: "^1.1.1",
|
|
85
85
|
lodash: "^4.17.21",
|
|
86
|
-
"markdown-it": "^12.3.
|
|
86
|
+
"markdown-it": "^12.3.2",
|
|
87
87
|
"mime-types": "^2.1.34",
|
|
88
88
|
mkdirp: "^1.0.4",
|
|
89
89
|
moment: "^2.29.1",
|
|
@@ -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.4.
|
|
99
|
-
"socket.io-client": "^4.4.
|
|
97
|
+
slugify: "^1.6.5",
|
|
98
|
+
"socket.io": "^4.4.1",
|
|
99
|
+
"socket.io-client": "^4.4.1",
|
|
100
100
|
"socketio-auth": "^0.1.1",
|
|
101
101
|
"swagger-jsdoc": "^6.1.0",
|
|
102
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.5",
|
|
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.12",
|
|
112
|
+
"@babel/node": "^7.16.8",
|
|
113
|
+
"@babel/plugin-transform-runtime": "^7.16.10",
|
|
114
|
+
"@babel/preset-env": "^7.16.11",
|
|
115
115
|
chai: "^4.3.4",
|
|
116
116
|
"chai-as-promised": "^7.1.1",
|
|
117
117
|
"cross-env": "^7.0.3",
|
|
118
|
-
eslint: "^8.
|
|
118
|
+
eslint: "^8.7.0",
|
|
119
119
|
"eslint-config-standard": "^16.0.3",
|
|
120
|
-
"eslint-plugin-import": "^2.25.
|
|
120
|
+
"eslint-plugin-import": "^2.25.4",
|
|
121
121
|
"eslint-plugin-node": "^11.1.0",
|
|
122
|
-
"eslint-plugin-promise": "^
|
|
122
|
+
"eslint-plugin-promise": "^6.0.0",
|
|
123
123
|
"eslint-plugin-standard": "^4.1.0",
|
|
124
124
|
"license-checker": "^25.0.1",
|
|
125
125
|
"license-compatibility-checker": "^0.3.5",
|
|
126
|
-
mocha: "^9.
|
|
127
|
-
nock: "^13.2.
|
|
128
|
-
"npm-check-updates": "^12.
|
|
126
|
+
mocha: "^9.2.0",
|
|
127
|
+
nock: "^13.2.2",
|
|
128
|
+
"npm-check-updates": "^12.2.1",
|
|
129
129
|
nyc: "^15.1.0",
|
|
130
|
-
rollup: "^2.
|
|
130
|
+
rollup: "^2.66.0",
|
|
131
131
|
"rollup-plugin-babel": "^4.4.0",
|
|
132
132
|
"rollup-plugin-commonjs": "^10.1.0",
|
|
133
133
|
"rollup-plugin-json": "^4.0.0",
|
|
@@ -282,6 +282,7 @@ var Capabilities = {
|
|
|
282
282
|
SCRIPTING_NORMALIZE_TEXT: 'SCRIPTING_NORMALIZE_TEXT',
|
|
283
283
|
SCRIPTING_ENABLE_MEMORY: 'SCRIPTING_ENABLE_MEMORY',
|
|
284
284
|
SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS: 'SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS',
|
|
285
|
+
SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS: 'SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS',
|
|
285
286
|
SCRIPTING_FORCE_BOT_CONSUMED: 'SCRIPTING_FORCE_BOT_CONSUMED',
|
|
286
287
|
// regexp, regexpIgnoreCase, wildcard, wildcardIgnoreCase, wildcardExact, wildcardExactIgnoreCase, include, includeIgnoreCase, equals, equalsIgnoreCase
|
|
287
288
|
SCRIPTING_MATCHING_MODE: 'SCRIPTING_MATCHING_MODE',
|
|
@@ -297,6 +298,8 @@ var Capabilities = {
|
|
|
297
298
|
SCRIPTING_MEMORYEXPANSION_KEEP_ORIG: 'SCRIPTING_MEMORYEXPANSION_KEEP_ORIG',
|
|
298
299
|
// word, non_whitespace, joker
|
|
299
300
|
SCRIPTING_MEMORY_MATCHING_MODE: 'SCRIPTING_MEMORY_MATCHING_MODE',
|
|
301
|
+
// varnames, testcasenames
|
|
302
|
+
SCRIPTING_MEMORY_COLUMN_MODE: 'SCRIPTING_MEMORY_COLUMN_MODE',
|
|
300
303
|
// Botium Lifecycle Hooks
|
|
301
304
|
CUSTOMHOOK_ONBUILD: 'CUSTOMHOOK_ONBUILD',
|
|
302
305
|
CUSTOMHOOK_ONSTART: 'CUSTOMHOOK_ONSTART',
|
|
@@ -422,6 +425,7 @@ Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER;
|
|
|
422
425
|
Capabilities.SCRIPTING_NORMALIZE_TEXT;
|
|
423
426
|
Capabilities.SCRIPTING_ENABLE_MEMORY;
|
|
424
427
|
Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS;
|
|
428
|
+
Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS;
|
|
425
429
|
Capabilities.SCRIPTING_FORCE_BOT_CONSUMED;
|
|
426
430
|
Capabilities.SCRIPTING_MATCHING_MODE;
|
|
427
431
|
Capabilities.SCRIPTING_UTTEXPANSION_MODE;
|
|
@@ -432,6 +436,7 @@ Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE;
|
|
|
432
436
|
Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX;
|
|
433
437
|
Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG;
|
|
434
438
|
Capabilities.SCRIPTING_MEMORY_MATCHING_MODE;
|
|
439
|
+
Capabilities.SCRIPTING_MEMORY_COLUMN_MODE;
|
|
435
440
|
Capabilities.CUSTOMHOOK_ONBUILD;
|
|
436
441
|
Capabilities.CUSTOMHOOK_ONSTART;
|
|
437
442
|
Capabilities.CUSTOMHOOK_ONUSERSAYS;
|
|
@@ -510,6 +515,7 @@ var Defaults$1 = {
|
|
|
510
515
|
[Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE]: 'justLineTag',
|
|
511
516
|
[Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX]: '16',
|
|
512
517
|
[Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG]: false,
|
|
518
|
+
[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]: false,
|
|
513
519
|
[Capabilities.SCRIPTING_FORCE_BOT_CONSUMED]: false,
|
|
514
520
|
[Capabilities.ASSERTERS]: [],
|
|
515
521
|
[Capabilities.LOGIC_HOOKS]: [],
|
|
@@ -856,6 +862,27 @@ const BotiumError$7 = class BotiumError extends Error {
|
|
|
856
862
|
this.context.message = message.message || message;
|
|
857
863
|
}
|
|
858
864
|
|
|
865
|
+
isAsserterError() {
|
|
866
|
+
if (this.context) {
|
|
867
|
+
const errArr = lodash.isArray(this.context) ? this.context : [this.context];
|
|
868
|
+
const hasNotAsserterError = errArr.findIndex(errDetail => {
|
|
869
|
+
if (errDetail.type === 'list') {
|
|
870
|
+
if (errDetail.errors) {
|
|
871
|
+
return errDetail.errors.findIndex(e => e.type !== 'asserter') >= 0;
|
|
872
|
+
} else {
|
|
873
|
+
return true;
|
|
874
|
+
}
|
|
875
|
+
} else {
|
|
876
|
+
return errDetail.type !== 'asserter';
|
|
877
|
+
}
|
|
878
|
+
}) >= 0;
|
|
879
|
+
if (hasNotAsserterError) return false;
|
|
880
|
+
return true;
|
|
881
|
+
} else {
|
|
882
|
+
return false;
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
|
|
859
886
|
prettify(includeJson) {
|
|
860
887
|
const lines = [];
|
|
861
888
|
|
|
@@ -1693,6 +1720,18 @@ var BotiumMockMessage_1 = class BotiumMockMessage {
|
|
|
1693
1720
|
|
|
1694
1721
|
};
|
|
1695
1722
|
|
|
1723
|
+
var Enums = {
|
|
1724
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE: {
|
|
1725
|
+
VARNAMES: 'varnames',
|
|
1726
|
+
TESTCASENAMES: 'testcasenames'
|
|
1727
|
+
}
|
|
1728
|
+
};
|
|
1729
|
+
Enums.E_SCRIPTING_MEMORY_COLUMN_MODE;
|
|
1730
|
+
|
|
1731
|
+
const {
|
|
1732
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE: E_SCRIPTING_MEMORY_COLUMN_MODE$1
|
|
1733
|
+
} = Enums;
|
|
1734
|
+
|
|
1696
1735
|
const normalizeText$1 = (str, doCleanup) => {
|
|
1697
1736
|
if (str && lodash.isArray(str)) {
|
|
1698
1737
|
str = str.join(' ');
|
|
@@ -2221,6 +2260,71 @@ const convoStepToLines$2 = step => {
|
|
|
2221
2260
|
return lines.map(l => l.trim());
|
|
2222
2261
|
};
|
|
2223
2262
|
|
|
2263
|
+
const linesToScriptingMemories$2 = (lines, columnMode = null) => {
|
|
2264
|
+
const guessScriptingMemoryColumnMode = lines => {
|
|
2265
|
+
if (lines && lines.length > 1) {
|
|
2266
|
+
if (lines[1].trim().startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES;
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
return E_SCRIPTING_MEMORY_COLUMN_MODE$1.VARNAMES;
|
|
2270
|
+
};
|
|
2271
|
+
|
|
2272
|
+
columnMode = columnMode || guessScriptingMemoryColumnMode(lines);
|
|
2273
|
+
const scriptingMemories = [];
|
|
2274
|
+
|
|
2275
|
+
if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES) {
|
|
2276
|
+
const caseNames = lines[0].split('|').map(name => name.trim()).slice(1);
|
|
2277
|
+
const varNames = [];
|
|
2278
|
+
const varValues = [];
|
|
2279
|
+
|
|
2280
|
+
for (let row = 1; row < lines.length; row++) {
|
|
2281
|
+
if (!lines[row] || lines[row].length === 0) continue;
|
|
2282
|
+
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
2283
|
+
varNames.push(rawRow[0]);
|
|
2284
|
+
varValues.push(rawRow.slice(1));
|
|
2285
|
+
}
|
|
2286
|
+
|
|
2287
|
+
for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
|
|
2288
|
+
const caseName = caseNames[caseIndex];
|
|
2289
|
+
const values = varNames.reduce((agg, varName, varIndex) => {
|
|
2290
|
+
agg[varName] = varValues[varIndex][caseIndex] || null;
|
|
2291
|
+
return agg;
|
|
2292
|
+
}, {});
|
|
2293
|
+
const scriptingMemory = {
|
|
2294
|
+
header: {
|
|
2295
|
+
name: caseName
|
|
2296
|
+
},
|
|
2297
|
+
values: values
|
|
2298
|
+
};
|
|
2299
|
+
scriptingMemories.push(scriptingMemory);
|
|
2300
|
+
}
|
|
2301
|
+
} else {
|
|
2302
|
+
const varNames = lines[0].split('|').map(name => name.trim()).slice(1);
|
|
2303
|
+
|
|
2304
|
+
for (let row = 1; row < lines.length; row++) {
|
|
2305
|
+
if (!lines[row] || lines[row].length === 0) continue;
|
|
2306
|
+
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
2307
|
+
const caseName = rawRow[0];
|
|
2308
|
+
const values = rawRow.slice(1);
|
|
2309
|
+
const varValues = {};
|
|
2310
|
+
|
|
2311
|
+
for (let varIndex = 0; varIndex < varNames.length; varIndex++) {
|
|
2312
|
+
varValues[varNames[varIndex]] = values[varIndex];
|
|
2313
|
+
}
|
|
2314
|
+
|
|
2315
|
+
const scriptingMemory = {
|
|
2316
|
+
header: {
|
|
2317
|
+
name: caseName
|
|
2318
|
+
},
|
|
2319
|
+
values: varValues
|
|
2320
|
+
};
|
|
2321
|
+
scriptingMemories.push(scriptingMemory);
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
return scriptingMemories;
|
|
2326
|
+
};
|
|
2327
|
+
|
|
2224
2328
|
var helper = {
|
|
2225
2329
|
normalizeText: normalizeText$1,
|
|
2226
2330
|
splitStringInNonEmptyLines: splitStringInNonEmptyLines$1,
|
|
@@ -2233,7 +2337,8 @@ var helper = {
|
|
|
2233
2337
|
convoStepToObject: convoStepToObject$1,
|
|
2234
2338
|
validSenders: validSenders$3,
|
|
2235
2339
|
validateSender: validateSender$1,
|
|
2236
|
-
validateConvo: validateConvo$2
|
|
2340
|
+
validateConvo: validateConvo$2,
|
|
2341
|
+
linesToScriptingMemories: linesToScriptingMemories$2
|
|
2237
2342
|
};
|
|
2238
2343
|
|
|
2239
2344
|
const debug$j = debug$l('botium-core-ScriptingMemory');
|
|
@@ -2606,7 +2711,9 @@ class ConvoStepAssert {
|
|
|
2606
2711
|
}
|
|
2607
2712
|
|
|
2608
2713
|
toString() {
|
|
2609
|
-
return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.
|
|
2714
|
+
return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.map(a => lodash.truncate(a, {
|
|
2715
|
+
length: 200
|
|
2716
|
+
})).join(',') : 'no args') + ')';
|
|
2610
2717
|
}
|
|
2611
2718
|
|
|
2612
2719
|
}
|
|
@@ -2618,7 +2725,9 @@ class ConvoStepLogicHook {
|
|
|
2618
2725
|
}
|
|
2619
2726
|
|
|
2620
2727
|
toString() {
|
|
2621
|
-
return this.name + '(' + (this.args ? this.args.
|
|
2728
|
+
return this.name + '(' + (this.args ? this.args.map(a => lodash.truncate(a, {
|
|
2729
|
+
length: 200
|
|
2730
|
+
})).join(',') : 'no args') + ')';
|
|
2622
2731
|
}
|
|
2623
2732
|
|
|
2624
2733
|
}
|
|
@@ -2630,7 +2739,9 @@ class ConvoStepUserInput {
|
|
|
2630
2739
|
}
|
|
2631
2740
|
|
|
2632
2741
|
toString() {
|
|
2633
|
-
return this.name + '(' + (this.args ? this.args.
|
|
2742
|
+
return this.name + '(' + (this.args ? this.args.map(a => lodash.truncate(a, {
|
|
2743
|
+
length: 200
|
|
2744
|
+
})).join(',') : 'no args') + ')';
|
|
2634
2745
|
}
|
|
2635
2746
|
|
|
2636
2747
|
}
|
|
@@ -3238,7 +3349,14 @@ class Convo$6 {
|
|
|
3238
3349
|
}
|
|
3239
3350
|
|
|
3240
3351
|
transcriptStep.err = err;
|
|
3241
|
-
|
|
3352
|
+
|
|
3353
|
+
if (err instanceof BotiumError$4 && container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
|
|
3354
|
+
if (!err.isAsserterError()) {
|
|
3355
|
+
throw err;
|
|
3356
|
+
}
|
|
3357
|
+
} else {
|
|
3358
|
+
throw err;
|
|
3359
|
+
}
|
|
3242
3360
|
} finally {
|
|
3243
3361
|
if (convoStep.sender !== 'begin' && convoStep.sender !== 'end' && !skipTranscriptStep) {
|
|
3244
3362
|
transcriptStep.scriptingMemory = Object.assign({}, scriptingMemory);
|
|
@@ -3253,6 +3371,14 @@ class Convo$6 {
|
|
|
3253
3371
|
transcript.steps = transcriptSteps.filter(s => s);
|
|
3254
3372
|
transcript.scriptingMemory = scriptingMemory;
|
|
3255
3373
|
transcript.convoEnd = new Date();
|
|
3374
|
+
|
|
3375
|
+
if (container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
|
|
3376
|
+
const transcriptStepErrs = transcript.steps.filter(s => s.err).map(s => s.err);
|
|
3377
|
+
|
|
3378
|
+
if (transcriptStepErrs && transcriptStepErrs.length > 0) {
|
|
3379
|
+
transcript.err = botiumErrorFromList$1([transcriptStepErrs, transcript.err].filter(e => e), {});
|
|
3380
|
+
}
|
|
3381
|
+
}
|
|
3256
3382
|
}
|
|
3257
3383
|
}
|
|
3258
3384
|
|
|
@@ -4323,6 +4449,9 @@ var Utterance_1 = class Utterance {
|
|
|
4323
4449
|
};
|
|
4324
4450
|
|
|
4325
4451
|
const debug$d = debug$l('botium-core-CompilerXlsx');
|
|
4452
|
+
const {
|
|
4453
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE
|
|
4454
|
+
} = Enums;
|
|
4326
4455
|
const {
|
|
4327
4456
|
Convo: Convo$5
|
|
4328
4457
|
} = Convo_1;
|
|
@@ -4635,49 +4764,120 @@ var CompilerXlsx_1 = class CompilerXlsx extends CompilerBase_1 {
|
|
|
4635
4764
|
}
|
|
4636
4765
|
|
|
4637
4766
|
if (scriptType === Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY) {
|
|
4638
|
-
const
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
while (true) {
|
|
4642
|
-
const variableNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4767
|
+
const guessScriptingMemoryColumnMode = () => {
|
|
4768
|
+
const line1Cell = this.colnames[colindex] + (rowindex + 1);
|
|
4643
4769
|
|
|
4644
|
-
if (sheet[
|
|
4645
|
-
|
|
4646
|
-
} else {
|
|
4647
|
-
break;
|
|
4770
|
+
if (sheet[line1Cell] && sheet[line1Cell].v) {
|
|
4771
|
+
if (sheet[line1Cell].v.startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES;
|
|
4648
4772
|
}
|
|
4649
4773
|
|
|
4650
|
-
|
|
4651
|
-
}
|
|
4774
|
+
return E_SCRIPTING_MEMORY_COLUMN_MODE.VARNAMES;
|
|
4775
|
+
};
|
|
4652
4776
|
|
|
4653
|
-
|
|
4777
|
+
const columnMode = this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE] || guessScriptingMemoryColumnMode();
|
|
4654
4778
|
|
|
4655
|
-
|
|
4656
|
-
const
|
|
4779
|
+
if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES) {
|
|
4780
|
+
const caseNames = [];
|
|
4781
|
+
let colindexTemp = colindex + 1;
|
|
4657
4782
|
|
|
4658
|
-
|
|
4659
|
-
const
|
|
4660
|
-
|
|
4783
|
+
while (true) {
|
|
4784
|
+
const caseNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4785
|
+
|
|
4786
|
+
if (sheet[caseNameCell] && sheet[caseNameCell].v) {
|
|
4787
|
+
caseNames.push(sheet[caseNameCell].v);
|
|
4788
|
+
} else {
|
|
4789
|
+
break;
|
|
4790
|
+
}
|
|
4661
4791
|
|
|
4662
|
-
|
|
4663
|
-
|
|
4792
|
+
colindexTemp++;
|
|
4793
|
+
}
|
|
4664
4794
|
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4795
|
+
const varNames = [];
|
|
4796
|
+
const varValues = [];
|
|
4797
|
+
rowindex += 1;
|
|
4798
|
+
|
|
4799
|
+
while (true) {
|
|
4800
|
+
const varNameCell = this.colnames[colindex] + rowindex;
|
|
4801
|
+
|
|
4802
|
+
if (sheet[varNameCell] && sheet[varNameCell].v) {
|
|
4803
|
+
varNames.push(sheet[varNameCell].v);
|
|
4804
|
+
const values = [];
|
|
4805
|
+
|
|
4806
|
+
for (let i = 0; i < caseNames.length; i++) {
|
|
4807
|
+
const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
|
|
4808
|
+
|
|
4809
|
+
if (sheet[variableValueCell] && sheet[variableValueCell].v) {
|
|
4810
|
+
values.push(sheet[variableValueCell].v.toString());
|
|
4811
|
+
} else {
|
|
4812
|
+
values.push(null);
|
|
4813
|
+
}
|
|
4669
4814
|
}
|
|
4815
|
+
|
|
4816
|
+
varValues.push(values);
|
|
4817
|
+
rowindex += 1;
|
|
4818
|
+
} else {
|
|
4819
|
+
break;
|
|
4670
4820
|
}
|
|
4821
|
+
}
|
|
4671
4822
|
|
|
4672
|
-
|
|
4823
|
+
for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
|
|
4824
|
+
const caseName = caseNames[caseIndex];
|
|
4825
|
+
const values = varNames.reduce((agg, varName, varIndex) => {
|
|
4826
|
+
agg[varName] = varValues[varIndex][caseIndex] || null;
|
|
4827
|
+
return agg;
|
|
4828
|
+
}, {});
|
|
4673
4829
|
scriptResults.push({
|
|
4674
4830
|
header: {
|
|
4675
4831
|
name: caseName
|
|
4676
4832
|
},
|
|
4677
4833
|
values: values
|
|
4678
4834
|
});
|
|
4679
|
-
}
|
|
4680
|
-
|
|
4835
|
+
}
|
|
4836
|
+
} else {
|
|
4837
|
+
const variableNames = [];
|
|
4838
|
+
let colindexTemp = colindex + 1;
|
|
4839
|
+
|
|
4840
|
+
while (true) {
|
|
4841
|
+
const variableNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4842
|
+
|
|
4843
|
+
if (sheet[variableNameCell] && sheet[variableNameCell].v) {
|
|
4844
|
+
variableNames.push(sheet[variableNameCell].v);
|
|
4845
|
+
} else {
|
|
4846
|
+
break;
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
colindexTemp++;
|
|
4850
|
+
}
|
|
4851
|
+
|
|
4852
|
+
rowindex += 1;
|
|
4853
|
+
|
|
4854
|
+
while (true) {
|
|
4855
|
+
const caseNameCell = this.colnames[colindex] + rowindex;
|
|
4856
|
+
|
|
4857
|
+
if (sheet[caseNameCell] && sheet[caseNameCell].v) {
|
|
4858
|
+
const caseName = sheet[caseNameCell].v;
|
|
4859
|
+
const values = {};
|
|
4860
|
+
|
|
4861
|
+
for (let i = 0; i < variableNames.length; i++) {
|
|
4862
|
+
const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
|
|
4863
|
+
|
|
4864
|
+
if (sheet[variableValueCell] && sheet[variableValueCell].v) {
|
|
4865
|
+
values[variableNames[i]] = sheet[variableValueCell].v.toString();
|
|
4866
|
+
} else {
|
|
4867
|
+
values[variableNames[i]] = null;
|
|
4868
|
+
}
|
|
4869
|
+
}
|
|
4870
|
+
|
|
4871
|
+
rowindex += 1;
|
|
4872
|
+
scriptResults.push({
|
|
4873
|
+
header: {
|
|
4874
|
+
name: caseName
|
|
4875
|
+
},
|
|
4876
|
+
values: values
|
|
4877
|
+
});
|
|
4878
|
+
} else {
|
|
4879
|
+
break;
|
|
4880
|
+
}
|
|
4681
4881
|
}
|
|
4682
4882
|
}
|
|
4683
4883
|
}
|
|
@@ -4837,7 +5037,8 @@ const {
|
|
|
4837
5037
|
linesToConvoStep: linesToConvoStep$3,
|
|
4838
5038
|
convoStepToLines,
|
|
4839
5039
|
validateConvo,
|
|
4840
|
-
validSenders: validSenders$2
|
|
5040
|
+
validSenders: validSenders$2,
|
|
5041
|
+
linesToScriptingMemories: linesToScriptingMemories$1
|
|
4841
5042
|
} = helper;
|
|
4842
5043
|
var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
4843
5044
|
constructor(context, caps = {}) {
|
|
@@ -4968,30 +5169,12 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4968
5169
|
|
|
4969
5170
|
_compileScriptingMemory(lines) {
|
|
4970
5171
|
if (lines && lines.length > 1) {
|
|
4971
|
-
const
|
|
4972
|
-
const scriptingMemories = [];
|
|
4973
|
-
|
|
4974
|
-
for (let row = 1; row < lines.length; row++) {
|
|
4975
|
-
if (!lines[row] || lines[row].length === 0) continue;
|
|
4976
|
-
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
4977
|
-
const caseName = rawRow[0];
|
|
4978
|
-
const values = rawRow.slice(1);
|
|
4979
|
-
const json = {};
|
|
5172
|
+
const scriptingMemories = linesToScriptingMemories$1(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
|
|
4980
5173
|
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
}
|
|
4984
|
-
|
|
4985
|
-
const scriptingMemory = {
|
|
4986
|
-
header: {
|
|
4987
|
-
name: caseName
|
|
4988
|
-
},
|
|
4989
|
-
values: json
|
|
4990
|
-
};
|
|
4991
|
-
scriptingMemories.push(scriptingMemory);
|
|
5174
|
+
if (scriptingMemories && scriptingMemories.length > 0) {
|
|
5175
|
+
this.context.AddScriptingMemories(scriptingMemories);
|
|
4992
5176
|
}
|
|
4993
5177
|
|
|
4994
|
-
this.context.AddScriptingMemories(scriptingMemories);
|
|
4995
5178
|
return scriptingMemories;
|
|
4996
5179
|
}
|
|
4997
5180
|
}
|
|
@@ -5249,7 +5432,8 @@ const {
|
|
|
5249
5432
|
} = Convo_1;
|
|
5250
5433
|
const {
|
|
5251
5434
|
linesToConvoStep: linesToConvoStep$1,
|
|
5252
|
-
validSenders: validSenders$1
|
|
5435
|
+
validSenders: validSenders$1,
|
|
5436
|
+
linesToScriptingMemories
|
|
5253
5437
|
} = helper;
|
|
5254
5438
|
var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
5255
5439
|
constructor(context, caps = {}) {
|
|
@@ -5358,29 +5542,12 @@ var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
|
5358
5542
|
if (lines && lines.length > 0) {
|
|
5359
5543
|
if (lodash.isString(lines[0])) {
|
|
5360
5544
|
if (lines.length > 1) {
|
|
5361
|
-
const
|
|
5362
|
-
const scriptingMemories = [];
|
|
5363
|
-
|
|
5364
|
-
for (let row = 1; row < lines.length; row++) {
|
|
5365
|
-
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
5366
|
-
const caseName = rawRow[0];
|
|
5367
|
-
const values = rawRow.slice(1);
|
|
5368
|
-
const json = {};
|
|
5369
|
-
|
|
5370
|
-
for (let col = 0; col < names.length; col++) {
|
|
5371
|
-
json[names[col]] = values[col];
|
|
5372
|
-
}
|
|
5545
|
+
const scriptingMemories = linesToScriptingMemories(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
|
|
5373
5546
|
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
name: caseName
|
|
5377
|
-
},
|
|
5378
|
-
values: json
|
|
5379
|
-
};
|
|
5380
|
-
scriptingMemories.push(scriptingMemory);
|
|
5547
|
+
if (scriptingMemories && scriptingMemories.length > 0) {
|
|
5548
|
+
this.context.AddScriptingMemories(scriptingMemories);
|
|
5381
5549
|
}
|
|
5382
5550
|
|
|
5383
|
-
this.context.AddScriptingMemories(scriptingMemories);
|
|
5384
5551
|
return scriptingMemories;
|
|
5385
5552
|
}
|
|
5386
5553
|
} else {
|
|
@@ -6554,6 +6721,8 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6554
6721
|
|
|
6555
6722
|
debug$9(`ExpandScriptingMemoryToConvos - ${convosExpandedAll.length} convo expanded, added to convos (${this.convos.length}). Result ${convosExpandedAll.length + this.convos.length} convo`);
|
|
6556
6723
|
this.convos = this.convos.concat(convosExpandedAll);
|
|
6724
|
+
|
|
6725
|
+
this._sortConvos();
|
|
6557
6726
|
}
|
|
6558
6727
|
|
|
6559
6728
|
ExpandUtterancesToConvos({
|
|
@@ -6593,6 +6762,9 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6593
6762
|
},
|
|
6594
6763
|
conversation: [{
|
|
6595
6764
|
sender: 'me',
|
|
6765
|
+
logicHooks: [{
|
|
6766
|
+
name: 'SKIP_BOT_UNCONSUMED'
|
|
6767
|
+
}],
|
|
6596
6768
|
messageText: utt.name,
|
|
6597
6769
|
stepTag: 'Step 1 - tell utterance'
|
|
6598
6770
|
}, useNameAsIntent ? {
|
|
@@ -9672,6 +9844,7 @@ var botiumCore = {
|
|
|
9672
9844
|
ScriptingConstants: Constants,
|
|
9673
9845
|
Capabilities: Capabilities,
|
|
9674
9846
|
Defaults: Defaults$1,
|
|
9847
|
+
Enums: Enums,
|
|
9675
9848
|
Source: Source,
|
|
9676
9849
|
Events: Events,
|
|
9677
9850
|
Plugins: Plugins,
|
|
@@ -9691,16 +9864,17 @@ var botiumCore_2 = botiumCore.ScriptingProvider;
|
|
|
9691
9864
|
var botiumCore_3 = botiumCore.ScriptingConstants;
|
|
9692
9865
|
var botiumCore_4 = botiumCore.Capabilities;
|
|
9693
9866
|
var botiumCore_5 = botiumCore.Defaults;
|
|
9694
|
-
var botiumCore_6 = botiumCore.
|
|
9695
|
-
var botiumCore_7 = botiumCore.
|
|
9696
|
-
var botiumCore_8 = botiumCore.
|
|
9697
|
-
var botiumCore_9 = botiumCore.
|
|
9698
|
-
var botiumCore_10 = botiumCore.
|
|
9699
|
-
var botiumCore_11 = botiumCore.
|
|
9700
|
-
var botiumCore_12 = botiumCore.
|
|
9701
|
-
var botiumCore_13 = botiumCore.
|
|
9702
|
-
var botiumCore_14 = botiumCore.
|
|
9703
|
-
var botiumCore_15 = botiumCore.
|
|
9704
|
-
|
|
9705
|
-
|
|
9867
|
+
var botiumCore_6 = botiumCore.Enums;
|
|
9868
|
+
var botiumCore_7 = botiumCore.Source;
|
|
9869
|
+
var botiumCore_8 = botiumCore.Events;
|
|
9870
|
+
var botiumCore_9 = botiumCore.Plugins;
|
|
9871
|
+
var botiumCore_10 = botiumCore.BotiumError;
|
|
9872
|
+
var botiumCore_11 = botiumCore.ScriptingMemory;
|
|
9873
|
+
var botiumCore_12 = botiumCore.HookUtils;
|
|
9874
|
+
var botiumCore_13 = botiumCore.LogicHookConstants;
|
|
9875
|
+
var botiumCore_14 = botiumCore.Lib;
|
|
9876
|
+
var botiumCore_15 = botiumCore.InboundProxy;
|
|
9877
|
+
var botiumCore_16 = botiumCore.BotiumMockRichMessageTypes;
|
|
9878
|
+
|
|
9879
|
+
export { botiumCore_1 as BotDriver, botiumCore_10 as BotiumError, botiumCore_16 as BotiumMockRichMessageTypes, botiumCore_4 as Capabilities, botiumCore_5 as Defaults, botiumCore_6 as Enums, botiumCore_8 as Events, botiumCore_12 as HookUtils, botiumCore_15 as InboundProxy, botiumCore_14 as Lib, botiumCore_13 as LogicHookConstants, botiumCore_9 as Plugins, botiumCore_3 as ScriptingConstants, botiumCore_11 as ScriptingMemory, botiumCore_2 as ScriptingProvider, botiumCore_7 as Source, botiumCore as default };
|
|
9706
9880
|
//# sourceMappingURL=botium-es.js.map
|