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-cjs.js
CHANGED
|
@@ -79,7 +79,7 @@ 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.12.
|
|
82
|
+
var version$1 = "1.12.1";
|
|
83
83
|
var description = "The Selenium for Chatbots";
|
|
84
84
|
var main = "index.js";
|
|
85
85
|
var module$1 = "dist/botium-es.js";
|
|
@@ -111,22 +111,22 @@ 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.
|
|
114
|
+
"@babel/runtime": "^7.16.7",
|
|
115
|
+
async: "^3.2.3",
|
|
116
116
|
"body-parser": "^1.19.1",
|
|
117
117
|
boolean: "^3.1.4",
|
|
118
118
|
bottleneck: "^2.19.5",
|
|
119
|
-
"csv-parse": "^5.0.
|
|
119
|
+
"csv-parse": "^5.0.4",
|
|
120
120
|
debug: "^4.3.3",
|
|
121
121
|
esprima: "^4.0.1",
|
|
122
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.3.
|
|
129
|
+
"markdown-it": "^12.3.2",
|
|
130
130
|
"mime-types": "^2.1.34",
|
|
131
131
|
mkdirp: "^1.0.4",
|
|
132
132
|
moment: "^2.29.1",
|
|
@@ -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.4.
|
|
142
|
-
"socket.io-client": "^4.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
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.2.
|
|
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',
|
|
@@ -465,6 +468,7 @@ Capabilities.SCRIPTING_CSV_QA_COLUMN_ANSWER;
|
|
|
465
468
|
Capabilities.SCRIPTING_NORMALIZE_TEXT;
|
|
466
469
|
Capabilities.SCRIPTING_ENABLE_MEMORY;
|
|
467
470
|
Capabilities.SCRIPTING_ENABLE_MULTIPLE_ASSERT_ERRORS;
|
|
471
|
+
Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS;
|
|
468
472
|
Capabilities.SCRIPTING_FORCE_BOT_CONSUMED;
|
|
469
473
|
Capabilities.SCRIPTING_MATCHING_MODE;
|
|
470
474
|
Capabilities.SCRIPTING_UTTEXPANSION_MODE;
|
|
@@ -475,6 +479,7 @@ Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE;
|
|
|
475
479
|
Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX;
|
|
476
480
|
Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG;
|
|
477
481
|
Capabilities.SCRIPTING_MEMORY_MATCHING_MODE;
|
|
482
|
+
Capabilities.SCRIPTING_MEMORY_COLUMN_MODE;
|
|
478
483
|
Capabilities.CUSTOMHOOK_ONBUILD;
|
|
479
484
|
Capabilities.CUSTOMHOOK_ONSTART;
|
|
480
485
|
Capabilities.CUSTOMHOOK_ONUSERSAYS;
|
|
@@ -553,6 +558,7 @@ var Defaults$1 = {
|
|
|
553
558
|
[Capabilities.SCRIPTING_UTTEXPANSION_NAMING_MODE]: 'justLineTag',
|
|
554
559
|
[Capabilities.SCRIPTING_UTTEXPANSION_NAMING_UTTERANCE_MAX]: '16',
|
|
555
560
|
[Capabilities.SCRIPTING_MEMORYEXPANSION_KEEP_ORIG]: false,
|
|
561
|
+
[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]: false,
|
|
556
562
|
[Capabilities.SCRIPTING_FORCE_BOT_CONSUMED]: false,
|
|
557
563
|
[Capabilities.ASSERTERS]: [],
|
|
558
564
|
[Capabilities.LOGIC_HOOKS]: [],
|
|
@@ -899,6 +905,27 @@ const BotiumError$7 = class BotiumError extends Error {
|
|
|
899
905
|
this.context.message = message.message || message;
|
|
900
906
|
}
|
|
901
907
|
|
|
908
|
+
isAsserterError() {
|
|
909
|
+
if (this.context) {
|
|
910
|
+
const errArr = lodash__default["default"].isArray(this.context) ? this.context : [this.context];
|
|
911
|
+
const hasNotAsserterError = errArr.findIndex(errDetail => {
|
|
912
|
+
if (errDetail.type === 'list') {
|
|
913
|
+
if (errDetail.errors) {
|
|
914
|
+
return errDetail.errors.findIndex(e => e.type !== 'asserter') >= 0;
|
|
915
|
+
} else {
|
|
916
|
+
return true;
|
|
917
|
+
}
|
|
918
|
+
} else {
|
|
919
|
+
return errDetail.type !== 'asserter';
|
|
920
|
+
}
|
|
921
|
+
}) >= 0;
|
|
922
|
+
if (hasNotAsserterError) return false;
|
|
923
|
+
return true;
|
|
924
|
+
} else {
|
|
925
|
+
return false;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
902
929
|
prettify(includeJson) {
|
|
903
930
|
const lines = [];
|
|
904
931
|
|
|
@@ -1736,6 +1763,18 @@ var BotiumMockMessage_1 = class BotiumMockMessage {
|
|
|
1736
1763
|
|
|
1737
1764
|
};
|
|
1738
1765
|
|
|
1766
|
+
var Enums = {
|
|
1767
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE: {
|
|
1768
|
+
VARNAMES: 'varnames',
|
|
1769
|
+
TESTCASENAMES: 'testcasenames'
|
|
1770
|
+
}
|
|
1771
|
+
};
|
|
1772
|
+
Enums.E_SCRIPTING_MEMORY_COLUMN_MODE;
|
|
1773
|
+
|
|
1774
|
+
const {
|
|
1775
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE: E_SCRIPTING_MEMORY_COLUMN_MODE$1
|
|
1776
|
+
} = Enums;
|
|
1777
|
+
|
|
1739
1778
|
const normalizeText$1 = (str, doCleanup) => {
|
|
1740
1779
|
if (str && lodash__default["default"].isArray(str)) {
|
|
1741
1780
|
str = str.join(' ');
|
|
@@ -2264,6 +2303,71 @@ const convoStepToLines$2 = step => {
|
|
|
2264
2303
|
return lines.map(l => l.trim());
|
|
2265
2304
|
};
|
|
2266
2305
|
|
|
2306
|
+
const linesToScriptingMemories$2 = (lines, columnMode = null) => {
|
|
2307
|
+
const guessScriptingMemoryColumnMode = lines => {
|
|
2308
|
+
if (lines && lines.length > 1) {
|
|
2309
|
+
if (lines[1].trim().startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
return E_SCRIPTING_MEMORY_COLUMN_MODE$1.VARNAMES;
|
|
2313
|
+
};
|
|
2314
|
+
|
|
2315
|
+
columnMode = columnMode || guessScriptingMemoryColumnMode(lines);
|
|
2316
|
+
const scriptingMemories = [];
|
|
2317
|
+
|
|
2318
|
+
if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE$1.TESTCASENAMES) {
|
|
2319
|
+
const caseNames = lines[0].split('|').map(name => name.trim()).slice(1);
|
|
2320
|
+
const varNames = [];
|
|
2321
|
+
const varValues = [];
|
|
2322
|
+
|
|
2323
|
+
for (let row = 1; row < lines.length; row++) {
|
|
2324
|
+
if (!lines[row] || lines[row].length === 0) continue;
|
|
2325
|
+
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
2326
|
+
varNames.push(rawRow[0]);
|
|
2327
|
+
varValues.push(rawRow.slice(1));
|
|
2328
|
+
}
|
|
2329
|
+
|
|
2330
|
+
for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
|
|
2331
|
+
const caseName = caseNames[caseIndex];
|
|
2332
|
+
const values = varNames.reduce((agg, varName, varIndex) => {
|
|
2333
|
+
agg[varName] = varValues[varIndex][caseIndex] || null;
|
|
2334
|
+
return agg;
|
|
2335
|
+
}, {});
|
|
2336
|
+
const scriptingMemory = {
|
|
2337
|
+
header: {
|
|
2338
|
+
name: caseName
|
|
2339
|
+
},
|
|
2340
|
+
values: values
|
|
2341
|
+
};
|
|
2342
|
+
scriptingMemories.push(scriptingMemory);
|
|
2343
|
+
}
|
|
2344
|
+
} else {
|
|
2345
|
+
const varNames = lines[0].split('|').map(name => name.trim()).slice(1);
|
|
2346
|
+
|
|
2347
|
+
for (let row = 1; row < lines.length; row++) {
|
|
2348
|
+
if (!lines[row] || lines[row].length === 0) continue;
|
|
2349
|
+
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
2350
|
+
const caseName = rawRow[0];
|
|
2351
|
+
const values = rawRow.slice(1);
|
|
2352
|
+
const varValues = {};
|
|
2353
|
+
|
|
2354
|
+
for (let varIndex = 0; varIndex < varNames.length; varIndex++) {
|
|
2355
|
+
varValues[varNames[varIndex]] = values[varIndex];
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
const scriptingMemory = {
|
|
2359
|
+
header: {
|
|
2360
|
+
name: caseName
|
|
2361
|
+
},
|
|
2362
|
+
values: varValues
|
|
2363
|
+
};
|
|
2364
|
+
scriptingMemories.push(scriptingMemory);
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
|
|
2368
|
+
return scriptingMemories;
|
|
2369
|
+
};
|
|
2370
|
+
|
|
2267
2371
|
var helper = {
|
|
2268
2372
|
normalizeText: normalizeText$1,
|
|
2269
2373
|
splitStringInNonEmptyLines: splitStringInNonEmptyLines$1,
|
|
@@ -2276,7 +2380,8 @@ var helper = {
|
|
|
2276
2380
|
convoStepToObject: convoStepToObject$1,
|
|
2277
2381
|
validSenders: validSenders$3,
|
|
2278
2382
|
validateSender: validateSender$1,
|
|
2279
|
-
validateConvo: validateConvo$2
|
|
2383
|
+
validateConvo: validateConvo$2,
|
|
2384
|
+
linesToScriptingMemories: linesToScriptingMemories$2
|
|
2280
2385
|
};
|
|
2281
2386
|
|
|
2282
2387
|
const debug$j = debug__default["default"]('botium-core-ScriptingMemory');
|
|
@@ -2649,7 +2754,9 @@ class ConvoStepAssert {
|
|
|
2649
2754
|
}
|
|
2650
2755
|
|
|
2651
2756
|
toString() {
|
|
2652
|
-
return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.
|
|
2757
|
+
return (this.optional ? '?' : '') + (this.not ? '!' : '') + this.name + '(' + (this.args ? this.args.map(a => lodash__default["default"].truncate(a, {
|
|
2758
|
+
length: 200
|
|
2759
|
+
})).join(',') : 'no args') + ')';
|
|
2653
2760
|
}
|
|
2654
2761
|
|
|
2655
2762
|
}
|
|
@@ -2661,7 +2768,9 @@ class ConvoStepLogicHook {
|
|
|
2661
2768
|
}
|
|
2662
2769
|
|
|
2663
2770
|
toString() {
|
|
2664
|
-
return this.name + '(' + (this.args ? this.args.
|
|
2771
|
+
return this.name + '(' + (this.args ? this.args.map(a => lodash__default["default"].truncate(a, {
|
|
2772
|
+
length: 200
|
|
2773
|
+
})).join(',') : 'no args') + ')';
|
|
2665
2774
|
}
|
|
2666
2775
|
|
|
2667
2776
|
}
|
|
@@ -2673,7 +2782,9 @@ class ConvoStepUserInput {
|
|
|
2673
2782
|
}
|
|
2674
2783
|
|
|
2675
2784
|
toString() {
|
|
2676
|
-
return this.name + '(' + (this.args ? this.args.
|
|
2785
|
+
return this.name + '(' + (this.args ? this.args.map(a => lodash__default["default"].truncate(a, {
|
|
2786
|
+
length: 200
|
|
2787
|
+
})).join(',') : 'no args') + ')';
|
|
2677
2788
|
}
|
|
2678
2789
|
|
|
2679
2790
|
}
|
|
@@ -3281,7 +3392,14 @@ class Convo$6 {
|
|
|
3281
3392
|
}
|
|
3282
3393
|
|
|
3283
3394
|
transcriptStep.err = err;
|
|
3284
|
-
|
|
3395
|
+
|
|
3396
|
+
if (err instanceof BotiumError$4 && container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
|
|
3397
|
+
if (!err.isAsserterError()) {
|
|
3398
|
+
throw err;
|
|
3399
|
+
}
|
|
3400
|
+
} else {
|
|
3401
|
+
throw err;
|
|
3402
|
+
}
|
|
3285
3403
|
} finally {
|
|
3286
3404
|
if (convoStep.sender !== 'begin' && convoStep.sender !== 'end' && !skipTranscriptStep) {
|
|
3287
3405
|
transcriptStep.scriptingMemory = Object.assign({}, scriptingMemory);
|
|
@@ -3296,6 +3414,14 @@ class Convo$6 {
|
|
|
3296
3414
|
transcript.steps = transcriptSteps.filter(s => s);
|
|
3297
3415
|
transcript.scriptingMemory = scriptingMemory;
|
|
3298
3416
|
transcript.convoEnd = new Date();
|
|
3417
|
+
|
|
3418
|
+
if (container.caps[Capabilities.SCRIPTING_ENABLE_SKIP_ASSERT_ERRORS]) {
|
|
3419
|
+
const transcriptStepErrs = transcript.steps.filter(s => s.err).map(s => s.err);
|
|
3420
|
+
|
|
3421
|
+
if (transcriptStepErrs && transcriptStepErrs.length > 0) {
|
|
3422
|
+
transcript.err = botiumErrorFromList$1([transcriptStepErrs, transcript.err].filter(e => e), {});
|
|
3423
|
+
}
|
|
3424
|
+
}
|
|
3299
3425
|
}
|
|
3300
3426
|
}
|
|
3301
3427
|
|
|
@@ -4366,6 +4492,9 @@ var Utterance_1 = class Utterance {
|
|
|
4366
4492
|
};
|
|
4367
4493
|
|
|
4368
4494
|
const debug$d = debug__default["default"]('botium-core-CompilerXlsx');
|
|
4495
|
+
const {
|
|
4496
|
+
E_SCRIPTING_MEMORY_COLUMN_MODE
|
|
4497
|
+
} = Enums;
|
|
4369
4498
|
const {
|
|
4370
4499
|
Convo: Convo$5
|
|
4371
4500
|
} = Convo_1;
|
|
@@ -4678,49 +4807,120 @@ var CompilerXlsx_1 = class CompilerXlsx extends CompilerBase_1 {
|
|
|
4678
4807
|
}
|
|
4679
4808
|
|
|
4680
4809
|
if (scriptType === Constants.SCRIPTING_TYPE_SCRIPTING_MEMORY) {
|
|
4681
|
-
const
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
while (true) {
|
|
4685
|
-
const variableNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4810
|
+
const guessScriptingMemoryColumnMode = () => {
|
|
4811
|
+
const line1Cell = this.colnames[colindex] + (rowindex + 1);
|
|
4686
4812
|
|
|
4687
|
-
if (sheet[
|
|
4688
|
-
|
|
4689
|
-
} else {
|
|
4690
|
-
break;
|
|
4813
|
+
if (sheet[line1Cell] && sheet[line1Cell].v) {
|
|
4814
|
+
if (sheet[line1Cell].v.startsWith('$')) return E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES;
|
|
4691
4815
|
}
|
|
4692
4816
|
|
|
4693
|
-
|
|
4694
|
-
}
|
|
4817
|
+
return E_SCRIPTING_MEMORY_COLUMN_MODE.VARNAMES;
|
|
4818
|
+
};
|
|
4695
4819
|
|
|
4696
|
-
|
|
4820
|
+
const columnMode = this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE] || guessScriptingMemoryColumnMode();
|
|
4697
4821
|
|
|
4698
|
-
|
|
4699
|
-
const
|
|
4822
|
+
if (columnMode === E_SCRIPTING_MEMORY_COLUMN_MODE.TESTCASENAMES) {
|
|
4823
|
+
const caseNames = [];
|
|
4824
|
+
let colindexTemp = colindex + 1;
|
|
4700
4825
|
|
|
4701
|
-
|
|
4702
|
-
const
|
|
4703
|
-
|
|
4826
|
+
while (true) {
|
|
4827
|
+
const caseNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4828
|
+
|
|
4829
|
+
if (sheet[caseNameCell] && sheet[caseNameCell].v) {
|
|
4830
|
+
caseNames.push(sheet[caseNameCell].v);
|
|
4831
|
+
} else {
|
|
4832
|
+
break;
|
|
4833
|
+
}
|
|
4704
4834
|
|
|
4705
|
-
|
|
4706
|
-
|
|
4835
|
+
colindexTemp++;
|
|
4836
|
+
}
|
|
4707
4837
|
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4838
|
+
const varNames = [];
|
|
4839
|
+
const varValues = [];
|
|
4840
|
+
rowindex += 1;
|
|
4841
|
+
|
|
4842
|
+
while (true) {
|
|
4843
|
+
const varNameCell = this.colnames[colindex] + rowindex;
|
|
4844
|
+
|
|
4845
|
+
if (sheet[varNameCell] && sheet[varNameCell].v) {
|
|
4846
|
+
varNames.push(sheet[varNameCell].v);
|
|
4847
|
+
const values = [];
|
|
4848
|
+
|
|
4849
|
+
for (let i = 0; i < caseNames.length; i++) {
|
|
4850
|
+
const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
|
|
4851
|
+
|
|
4852
|
+
if (sheet[variableValueCell] && sheet[variableValueCell].v) {
|
|
4853
|
+
values.push(sheet[variableValueCell].v.toString());
|
|
4854
|
+
} else {
|
|
4855
|
+
values.push(null);
|
|
4856
|
+
}
|
|
4712
4857
|
}
|
|
4858
|
+
|
|
4859
|
+
varValues.push(values);
|
|
4860
|
+
rowindex += 1;
|
|
4861
|
+
} else {
|
|
4862
|
+
break;
|
|
4713
4863
|
}
|
|
4864
|
+
}
|
|
4714
4865
|
|
|
4715
|
-
|
|
4866
|
+
for (let caseIndex = 0; caseIndex < caseNames.length; caseIndex++) {
|
|
4867
|
+
const caseName = caseNames[caseIndex];
|
|
4868
|
+
const values = varNames.reduce((agg, varName, varIndex) => {
|
|
4869
|
+
agg[varName] = varValues[varIndex][caseIndex] || null;
|
|
4870
|
+
return agg;
|
|
4871
|
+
}, {});
|
|
4716
4872
|
scriptResults.push({
|
|
4717
4873
|
header: {
|
|
4718
4874
|
name: caseName
|
|
4719
4875
|
},
|
|
4720
4876
|
values: values
|
|
4721
4877
|
});
|
|
4722
|
-
}
|
|
4723
|
-
|
|
4878
|
+
}
|
|
4879
|
+
} else {
|
|
4880
|
+
const variableNames = [];
|
|
4881
|
+
let colindexTemp = colindex + 1;
|
|
4882
|
+
|
|
4883
|
+
while (true) {
|
|
4884
|
+
const variableNameCell = this.colnames[colindexTemp] + rowindex;
|
|
4885
|
+
|
|
4886
|
+
if (sheet[variableNameCell] && sheet[variableNameCell].v) {
|
|
4887
|
+
variableNames.push(sheet[variableNameCell].v);
|
|
4888
|
+
} else {
|
|
4889
|
+
break;
|
|
4890
|
+
}
|
|
4891
|
+
|
|
4892
|
+
colindexTemp++;
|
|
4893
|
+
}
|
|
4894
|
+
|
|
4895
|
+
rowindex += 1;
|
|
4896
|
+
|
|
4897
|
+
while (true) {
|
|
4898
|
+
const caseNameCell = this.colnames[colindex] + rowindex;
|
|
4899
|
+
|
|
4900
|
+
if (sheet[caseNameCell] && sheet[caseNameCell].v) {
|
|
4901
|
+
const caseName = sheet[caseNameCell].v;
|
|
4902
|
+
const values = {};
|
|
4903
|
+
|
|
4904
|
+
for (let i = 0; i < variableNames.length; i++) {
|
|
4905
|
+
const variableValueCell = this.colnames[colindex + 1 + i] + rowindex;
|
|
4906
|
+
|
|
4907
|
+
if (sheet[variableValueCell] && sheet[variableValueCell].v) {
|
|
4908
|
+
values[variableNames[i]] = sheet[variableValueCell].v.toString();
|
|
4909
|
+
} else {
|
|
4910
|
+
values[variableNames[i]] = null;
|
|
4911
|
+
}
|
|
4912
|
+
}
|
|
4913
|
+
|
|
4914
|
+
rowindex += 1;
|
|
4915
|
+
scriptResults.push({
|
|
4916
|
+
header: {
|
|
4917
|
+
name: caseName
|
|
4918
|
+
},
|
|
4919
|
+
values: values
|
|
4920
|
+
});
|
|
4921
|
+
} else {
|
|
4922
|
+
break;
|
|
4923
|
+
}
|
|
4724
4924
|
}
|
|
4725
4925
|
}
|
|
4726
4926
|
}
|
|
@@ -4880,7 +5080,8 @@ const {
|
|
|
4880
5080
|
linesToConvoStep: linesToConvoStep$3,
|
|
4881
5081
|
convoStepToLines,
|
|
4882
5082
|
validateConvo,
|
|
4883
|
-
validSenders: validSenders$2
|
|
5083
|
+
validSenders: validSenders$2,
|
|
5084
|
+
linesToScriptingMemories: linesToScriptingMemories$1
|
|
4884
5085
|
} = helper;
|
|
4885
5086
|
var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
4886
5087
|
constructor(context, caps = {}) {
|
|
@@ -5011,30 +5212,12 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
5011
5212
|
|
|
5012
5213
|
_compileScriptingMemory(lines) {
|
|
5013
5214
|
if (lines && lines.length > 1) {
|
|
5014
|
-
const
|
|
5015
|
-
const scriptingMemories = [];
|
|
5016
|
-
|
|
5017
|
-
for (let row = 1; row < lines.length; row++) {
|
|
5018
|
-
if (!lines[row] || lines[row].length === 0) continue;
|
|
5019
|
-
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
5020
|
-
const caseName = rawRow[0];
|
|
5021
|
-
const values = rawRow.slice(1);
|
|
5022
|
-
const json = {};
|
|
5215
|
+
const scriptingMemories = linesToScriptingMemories$1(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
|
|
5023
5216
|
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
}
|
|
5027
|
-
|
|
5028
|
-
const scriptingMemory = {
|
|
5029
|
-
header: {
|
|
5030
|
-
name: caseName
|
|
5031
|
-
},
|
|
5032
|
-
values: json
|
|
5033
|
-
};
|
|
5034
|
-
scriptingMemories.push(scriptingMemory);
|
|
5217
|
+
if (scriptingMemories && scriptingMemories.length > 0) {
|
|
5218
|
+
this.context.AddScriptingMemories(scriptingMemories);
|
|
5035
5219
|
}
|
|
5036
5220
|
|
|
5037
|
-
this.context.AddScriptingMemories(scriptingMemories);
|
|
5038
5221
|
return scriptingMemories;
|
|
5039
5222
|
}
|
|
5040
5223
|
}
|
|
@@ -5292,7 +5475,8 @@ const {
|
|
|
5292
5475
|
} = Convo_1;
|
|
5293
5476
|
const {
|
|
5294
5477
|
linesToConvoStep: linesToConvoStep$1,
|
|
5295
|
-
validSenders: validSenders$1
|
|
5478
|
+
validSenders: validSenders$1,
|
|
5479
|
+
linesToScriptingMemories
|
|
5296
5480
|
} = helper;
|
|
5297
5481
|
var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
5298
5482
|
constructor(context, caps = {}) {
|
|
@@ -5401,29 +5585,12 @@ var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
|
5401
5585
|
if (lines && lines.length > 0) {
|
|
5402
5586
|
if (lodash__default["default"].isString(lines[0])) {
|
|
5403
5587
|
if (lines.length > 1) {
|
|
5404
|
-
const
|
|
5405
|
-
const scriptingMemories = [];
|
|
5406
|
-
|
|
5407
|
-
for (let row = 1; row < lines.length; row++) {
|
|
5408
|
-
const rawRow = lines[row].split('|').map(name => name.trim());
|
|
5409
|
-
const caseName = rawRow[0];
|
|
5410
|
-
const values = rawRow.slice(1);
|
|
5411
|
-
const json = {};
|
|
5412
|
-
|
|
5413
|
-
for (let col = 0; col < names.length; col++) {
|
|
5414
|
-
json[names[col]] = values[col];
|
|
5415
|
-
}
|
|
5588
|
+
const scriptingMemories = linesToScriptingMemories(lines, this.caps[Capabilities.SCRIPTING_MEMORY_COLUMN_MODE]);
|
|
5416
5589
|
|
|
5417
|
-
|
|
5418
|
-
|
|
5419
|
-
name: caseName
|
|
5420
|
-
},
|
|
5421
|
-
values: json
|
|
5422
|
-
};
|
|
5423
|
-
scriptingMemories.push(scriptingMemory);
|
|
5590
|
+
if (scriptingMemories && scriptingMemories.length > 0) {
|
|
5591
|
+
this.context.AddScriptingMemories(scriptingMemories);
|
|
5424
5592
|
}
|
|
5425
5593
|
|
|
5426
|
-
this.context.AddScriptingMemories(scriptingMemories);
|
|
5427
5594
|
return scriptingMemories;
|
|
5428
5595
|
}
|
|
5429
5596
|
} else {
|
|
@@ -6597,6 +6764,8 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6597
6764
|
|
|
6598
6765
|
debug$9(`ExpandScriptingMemoryToConvos - ${convosExpandedAll.length} convo expanded, added to convos (${this.convos.length}). Result ${convosExpandedAll.length + this.convos.length} convo`);
|
|
6599
6766
|
this.convos = this.convos.concat(convosExpandedAll);
|
|
6767
|
+
|
|
6768
|
+
this._sortConvos();
|
|
6600
6769
|
}
|
|
6601
6770
|
|
|
6602
6771
|
ExpandUtterancesToConvos({
|
|
@@ -6636,6 +6805,9 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6636
6805
|
},
|
|
6637
6806
|
conversation: [{
|
|
6638
6807
|
sender: 'me',
|
|
6808
|
+
logicHooks: [{
|
|
6809
|
+
name: 'SKIP_BOT_UNCONSUMED'
|
|
6810
|
+
}],
|
|
6639
6811
|
messageText: utt.name,
|
|
6640
6812
|
stepTag: 'Step 1 - tell utterance'
|
|
6641
6813
|
}, useNameAsIntent ? {
|
|
@@ -9715,6 +9887,7 @@ var botiumCore = {
|
|
|
9715
9887
|
ScriptingConstants: Constants,
|
|
9716
9888
|
Capabilities: Capabilities,
|
|
9717
9889
|
Defaults: Defaults$1,
|
|
9890
|
+
Enums: Enums,
|
|
9718
9891
|
Source: Source,
|
|
9719
9892
|
Events: Events,
|
|
9720
9893
|
Plugins: Plugins,
|
|
@@ -9734,31 +9907,33 @@ var botiumCore_2 = botiumCore.ScriptingProvider;
|
|
|
9734
9907
|
var botiumCore_3 = botiumCore.ScriptingConstants;
|
|
9735
9908
|
var botiumCore_4 = botiumCore.Capabilities;
|
|
9736
9909
|
var botiumCore_5 = botiumCore.Defaults;
|
|
9737
|
-
var botiumCore_6 = botiumCore.
|
|
9738
|
-
var botiumCore_7 = botiumCore.
|
|
9739
|
-
var botiumCore_8 = botiumCore.
|
|
9740
|
-
var botiumCore_9 = botiumCore.
|
|
9741
|
-
var botiumCore_10 = botiumCore.
|
|
9742
|
-
var botiumCore_11 = botiumCore.
|
|
9743
|
-
var botiumCore_12 = botiumCore.
|
|
9744
|
-
var botiumCore_13 = botiumCore.
|
|
9745
|
-
var botiumCore_14 = botiumCore.
|
|
9746
|
-
var botiumCore_15 = botiumCore.
|
|
9910
|
+
var botiumCore_6 = botiumCore.Enums;
|
|
9911
|
+
var botiumCore_7 = botiumCore.Source;
|
|
9912
|
+
var botiumCore_8 = botiumCore.Events;
|
|
9913
|
+
var botiumCore_9 = botiumCore.Plugins;
|
|
9914
|
+
var botiumCore_10 = botiumCore.BotiumError;
|
|
9915
|
+
var botiumCore_11 = botiumCore.ScriptingMemory;
|
|
9916
|
+
var botiumCore_12 = botiumCore.HookUtils;
|
|
9917
|
+
var botiumCore_13 = botiumCore.LogicHookConstants;
|
|
9918
|
+
var botiumCore_14 = botiumCore.Lib;
|
|
9919
|
+
var botiumCore_15 = botiumCore.InboundProxy;
|
|
9920
|
+
var botiumCore_16 = botiumCore.BotiumMockRichMessageTypes;
|
|
9747
9921
|
|
|
9748
9922
|
exports.BotDriver = botiumCore_1;
|
|
9749
|
-
exports.BotiumError =
|
|
9750
|
-
exports.BotiumMockRichMessageTypes =
|
|
9923
|
+
exports.BotiumError = botiumCore_10;
|
|
9924
|
+
exports.BotiumMockRichMessageTypes = botiumCore_16;
|
|
9751
9925
|
exports.Capabilities = botiumCore_4;
|
|
9752
9926
|
exports.Defaults = botiumCore_5;
|
|
9753
|
-
exports.
|
|
9754
|
-
exports.
|
|
9755
|
-
exports.
|
|
9756
|
-
exports.
|
|
9757
|
-
exports.
|
|
9758
|
-
exports.
|
|
9927
|
+
exports.Enums = botiumCore_6;
|
|
9928
|
+
exports.Events = botiumCore_8;
|
|
9929
|
+
exports.HookUtils = botiumCore_12;
|
|
9930
|
+
exports.InboundProxy = botiumCore_15;
|
|
9931
|
+
exports.Lib = botiumCore_14;
|
|
9932
|
+
exports.LogicHookConstants = botiumCore_13;
|
|
9933
|
+
exports.Plugins = botiumCore_9;
|
|
9759
9934
|
exports.ScriptingConstants = botiumCore_3;
|
|
9760
|
-
exports.ScriptingMemory =
|
|
9935
|
+
exports.ScriptingMemory = botiumCore_11;
|
|
9761
9936
|
exports.ScriptingProvider = botiumCore_2;
|
|
9762
|
-
exports.Source =
|
|
9937
|
+
exports.Source = botiumCore_7;
|
|
9763
9938
|
exports["default"] = botiumCore;
|
|
9764
9939
|
//# sourceMappingURL=botium-cjs.js.map
|