botium-core 1.14.5 → 1.14.6
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 +32 -37
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +32 -37
- package/dist/botium-es.js.map +1 -1
- package/package.json +18 -18
- package/src/Defaults.js +0 -1
- package/src/scripting/CompilerMarkdown.js +1 -5
- package/src/scripting/CompilerObjectBase.js +1 -4
- package/src/scripting/CompilerTxt.js +13 -11
- package/src/scripting/helper.js +1 -1
- package/test/compiler/compilertxt.spec.js +13 -0
- package/test/compiler/convos/txt/convos_mixed_new_line_characters.convo.txt +10 -0
package/dist/botium-es.js
CHANGED
|
@@ -35,7 +35,7 @@ import express from 'express';
|
|
|
35
35
|
import bodyParser from 'body-parser';
|
|
36
36
|
|
|
37
37
|
var name = "botium-core";
|
|
38
|
-
var version$1 = "1.14.
|
|
38
|
+
var version$1 = "1.14.6";
|
|
39
39
|
var description = "The Selenium for Chatbots";
|
|
40
40
|
var main = "index.js";
|
|
41
41
|
var module = "dist/botium-es.js";
|
|
@@ -53,7 +53,7 @@ var scripts = {
|
|
|
53
53
|
link: "npm link botium-connector-dialogflow botium-connector-webdriverio botium-connector-directline3 botium-connector-watson botium-connector-alexa-smapi botium-connector-echo",
|
|
54
54
|
test: "cross-env NODE_PATH=\"./test/plugins/plugindir/fromfolder:./test/plugins/plugindir/fromfile:./test/security/resources\" mocha \"./test/**/*.spec.js\"",
|
|
55
55
|
"coverage:report": "nyc report --reporter=lcov npm test",
|
|
56
|
-
"update-dependencies": "npm-check-updates --reject globby,rollup -u --timeout 120000"
|
|
56
|
+
"update-dependencies": "npm-check-updates --reject chai,globby,rollup -u --timeout 120000"
|
|
57
57
|
};
|
|
58
58
|
var repository = {
|
|
59
59
|
type: "git",
|
|
@@ -66,7 +66,7 @@ var bugs = {
|
|
|
66
66
|
};
|
|
67
67
|
var homepage = "https://www.botium.ai";
|
|
68
68
|
var dependencies = {
|
|
69
|
-
"@babel/runtime": "^7.23.
|
|
69
|
+
"@babel/runtime": "^7.23.9",
|
|
70
70
|
async: "^3.2.5",
|
|
71
71
|
"body-parser": "^1.20.2",
|
|
72
72
|
boolean: "^3.2.0",
|
|
@@ -83,8 +83,8 @@ var dependencies = {
|
|
|
83
83
|
"markdown-it": "^14.0.0",
|
|
84
84
|
"mime-types": "^2.1.35",
|
|
85
85
|
mkdirp: "^3.0.1",
|
|
86
|
-
moment: "^2.
|
|
87
|
-
"moment-timezone": "^0.5.
|
|
86
|
+
moment: "^2.30.1",
|
|
87
|
+
"moment-timezone": "^0.5.45",
|
|
88
88
|
mustache: "^4.2.0",
|
|
89
89
|
"promise-retry": "^2.0.1",
|
|
90
90
|
"promise.allsettled": "^1.0.7",
|
|
@@ -93,8 +93,8 @@ var dependencies = {
|
|
|
93
93
|
rimraf: "^5.0.5",
|
|
94
94
|
"sanitize-filename": "^1.6.3",
|
|
95
95
|
slugify: "^1.6.6",
|
|
96
|
-
"socket.io": "^4.7.
|
|
97
|
-
"socket.io-client": "^4.7.
|
|
96
|
+
"socket.io": "^4.7.4",
|
|
97
|
+
"socket.io-client": "^4.7.4",
|
|
98
98
|
"socketio-auth": "^0.1.1",
|
|
99
99
|
"swagger-jsdoc": "^6.2.8",
|
|
100
100
|
"swagger-ui-express": "^5.0.0",
|
|
@@ -106,23 +106,23 @@ var dependencies = {
|
|
|
106
106
|
yaml: "^2.3.4"
|
|
107
107
|
};
|
|
108
108
|
var devDependencies = {
|
|
109
|
-
"@babel/core": "^7.23.
|
|
110
|
-
"@babel/node": "^7.
|
|
111
|
-
"@babel/plugin-transform-runtime": "^7.23.
|
|
112
|
-
"@babel/preset-env": "^7.23.
|
|
113
|
-
chai: "
|
|
109
|
+
"@babel/core": "^7.23.9",
|
|
110
|
+
"@babel/node": "^7.23.9",
|
|
111
|
+
"@babel/plugin-transform-runtime": "^7.23.9",
|
|
112
|
+
"@babel/preset-env": "^7.23.9",
|
|
113
|
+
chai: "4.3.10",
|
|
114
114
|
"chai-as-promised": "^7.1.1",
|
|
115
115
|
"cross-env": "^7.0.3",
|
|
116
|
-
eslint: "^8.
|
|
116
|
+
eslint: "^8.56.0",
|
|
117
117
|
"eslint-config-standard": "^17.1.0",
|
|
118
|
-
"eslint-plugin-import": "^2.29.
|
|
118
|
+
"eslint-plugin-import": "^2.29.1",
|
|
119
119
|
"eslint-plugin-mocha": "^10.2.0",
|
|
120
|
-
"eslint-plugin-n": "^16.
|
|
120
|
+
"eslint-plugin-n": "^16.6.2",
|
|
121
121
|
"eslint-plugin-promise": "^6.1.1",
|
|
122
122
|
"eslint-plugin-standard": "^4.1.0",
|
|
123
|
-
mocha: "^10.
|
|
124
|
-
nock: "^13.
|
|
125
|
-
"npm-check-updates": "^16.14.
|
|
123
|
+
mocha: "^10.3.0",
|
|
124
|
+
nock: "^13.5.1",
|
|
125
|
+
"npm-check-updates": "^16.14.15",
|
|
126
126
|
nyc: "^15.1.0",
|
|
127
127
|
rollup: "2.79.1",
|
|
128
128
|
"rollup-plugin-babel": "^4.4.0",
|
|
@@ -552,7 +552,6 @@ var Defaults$1 = {
|
|
|
552
552
|
[Capabilities.SIMPLEREST_INBOUND_UPDATE_CONTEXT]: true,
|
|
553
553
|
[Capabilities.SIMPLEREST_CONTEXT_MERGE_OR_REPLACE]: 'MERGE',
|
|
554
554
|
[Capabilities.SIMPLEREST_COOKIE_REPLICATION]: true,
|
|
555
|
-
[Capabilities.SCRIPTING_TXT_EOL]: '\n',
|
|
556
555
|
[Capabilities.SCRIPTING_XLSX_EOL_WRITE]: '\r\n',
|
|
557
556
|
[Capabilities.SCRIPTING_XLSX_HASHEADERS]: true,
|
|
558
557
|
[Capabilities.SCRIPTING_CSV_SKIP_HEADER]: true,
|
|
@@ -1605,7 +1604,7 @@ const _formatAppendArgs = args => {
|
|
|
1605
1604
|
const _parseArgs = str => {
|
|
1606
1605
|
return str && str.length > 0 && str.replace(/\\\|/g, '###ESCAPESPLIT###').split('|').map(s => s.replace(/###ESCAPESPLIT###/g, '|').trim()) || [];
|
|
1607
1606
|
};
|
|
1608
|
-
const linesToConvoStep$5 = (lines, sender, context, eol, singleLineMode = false) => {
|
|
1607
|
+
const linesToConvoStep$5 = (lines, sender, context, eol = '\n', singleLineMode = false) => {
|
|
1609
1608
|
if (!validateSender$1(sender)) throw new Error(`Failed to parse conversation. Section "${sender}" unknown.`);
|
|
1610
1609
|
const convoStep = {
|
|
1611
1610
|
asserters: [],
|
|
@@ -4835,16 +4834,16 @@ const {
|
|
|
4835
4834
|
var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
4836
4835
|
constructor(context, caps = {}) {
|
|
4837
4836
|
super(context, caps);
|
|
4838
|
-
this.
|
|
4837
|
+
this.eolRead = caps[Capabilities.SCRIPTING_TXT_EOL] || /\r\n|\r|\n/;
|
|
4838
|
+
this.eolWrite = caps[Capabilities.SCRIPTING_TXT_EOL] && !lodash.isRegExp(caps[Capabilities.SCRIPTING_TXT_EOL]) ? caps[Capabilities.SCRIPTING_TXT_EOL] : '\n';
|
|
4839
4839
|
}
|
|
4840
4840
|
Validate() {
|
|
4841
4841
|
super.Validate();
|
|
4842
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
4843
4842
|
}
|
|
4844
4843
|
GetHeaders(scriptBuffer) {
|
|
4845
4844
|
let scriptData = scriptBuffer;
|
|
4846
4845
|
if (Buffer.isBuffer(scriptBuffer)) scriptData = scriptData.toString();
|
|
4847
|
-
const lines = scriptData.split(this.
|
|
4846
|
+
const lines = scriptData.split(this.eolRead);
|
|
4848
4847
|
const header = {};
|
|
4849
4848
|
if (lines && !lines[0].startsWith('#')) {
|
|
4850
4849
|
header.name = lines[0];
|
|
@@ -4854,7 +4853,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4854
4853
|
Compile(scriptBuffer, scriptType = Constants.SCRIPTING_TYPE_CONVO) {
|
|
4855
4854
|
let scriptData = scriptBuffer;
|
|
4856
4855
|
if (Buffer.isBuffer(scriptBuffer)) scriptData = scriptData.toString();
|
|
4857
|
-
const lines = scriptData.split(this.
|
|
4856
|
+
const lines = scriptData.split(this.eolRead);
|
|
4858
4857
|
if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
|
|
4859
4858
|
return this._compileConvo(lines, false);
|
|
4860
4859
|
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
@@ -4879,7 +4878,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4879
4878
|
let convoStepLineIndex = null;
|
|
4880
4879
|
const parseMsg = lines => {
|
|
4881
4880
|
lines = lines || [];
|
|
4882
|
-
return linesToConvoStep$3(lines, convoStepSender, this.context
|
|
4881
|
+
return linesToConvoStep$3(lines, convoStepSender, this.context);
|
|
4883
4882
|
};
|
|
4884
4883
|
const pushPrev = () => {
|
|
4885
4884
|
if (convoStepSender && currentLines) {
|
|
@@ -4893,7 +4892,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4893
4892
|
} else if (!convoStepSender && currentLines) {
|
|
4894
4893
|
convo.header.name = currentLines[0];
|
|
4895
4894
|
if (currentLines.length > 1) {
|
|
4896
|
-
convo.header.description = currentLines.slice(1).join(this.
|
|
4895
|
+
convo.header.description = currentLines.slice(1).join(this.eolWrite);
|
|
4897
4896
|
}
|
|
4898
4897
|
}
|
|
4899
4898
|
};
|
|
@@ -4957,20 +4956,20 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4957
4956
|
}
|
|
4958
4957
|
let script = '';
|
|
4959
4958
|
if (convo.header.name) {
|
|
4960
|
-
script += convo.header.name + this.
|
|
4959
|
+
script += convo.header.name + this.eolWrite;
|
|
4961
4960
|
}
|
|
4962
4961
|
if (convo.header.description) {
|
|
4963
|
-
script += convo.header.description + this.
|
|
4962
|
+
script += convo.header.description + this.eolWrite;
|
|
4964
4963
|
}
|
|
4965
4964
|
convo.conversation.forEach(step => {
|
|
4966
|
-
script += this.
|
|
4965
|
+
script += this.eolWrite;
|
|
4967
4966
|
script += '#' + step.sender;
|
|
4968
4967
|
if (step.channel && step.channel !== 'default') {
|
|
4969
4968
|
script += ' ' + step.channel;
|
|
4970
4969
|
}
|
|
4971
|
-
script += this.
|
|
4970
|
+
script += this.eolWrite;
|
|
4972
4971
|
const stepLines = convoStepToLines(step);
|
|
4973
|
-
if (stepLines && stepLines.length > 0) script += stepLines.join(this.
|
|
4972
|
+
if (stepLines && stepLines.length > 0) script += stepLines.join(this.eolWrite) + this.eolWrite;
|
|
4974
4973
|
});
|
|
4975
4974
|
return script;
|
|
4976
4975
|
}
|
|
@@ -5202,11 +5201,9 @@ const {
|
|
|
5202
5201
|
var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
5203
5202
|
constructor(context, caps = {}) {
|
|
5204
5203
|
super(context, caps);
|
|
5205
|
-
this.eol = caps[Capabilities.SCRIPTING_TXT_EOL];
|
|
5206
5204
|
}
|
|
5207
5205
|
Validate() {
|
|
5208
5206
|
super.Validate();
|
|
5209
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
5210
5207
|
}
|
|
5211
5208
|
GetHeaders(scriptBuffer) {
|
|
5212
5209
|
debug$b('GetHeaders is not implemented!');
|
|
@@ -5247,7 +5244,7 @@ var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
|
5247
5244
|
conversation.push(Object.assign({
|
|
5248
5245
|
sender: convoStepSender,
|
|
5249
5246
|
stepTag: 'Line ' + lineTag
|
|
5250
|
-
}, linesToConvoStep$1(convoStepObject, convoStepSender, this.context
|
|
5247
|
+
}, linesToConvoStep$1(convoStepObject, convoStepSender, this.context)));
|
|
5251
5248
|
}
|
|
5252
5249
|
const convo = {
|
|
5253
5250
|
header: {
|
|
@@ -5349,11 +5346,9 @@ const {
|
|
|
5349
5346
|
var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
|
|
5350
5347
|
constructor(context, caps = {}) {
|
|
5351
5348
|
super(context, caps);
|
|
5352
|
-
this.eol = caps[Capabilities.SCRIPTING_TXT_EOL];
|
|
5353
5349
|
}
|
|
5354
5350
|
Validate() {
|
|
5355
5351
|
super.Validate();
|
|
5356
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
5357
5352
|
}
|
|
5358
5353
|
Compile(scriptBuffer, scriptType = Constants.SCRIPTING_TYPE_CONVO) {
|
|
5359
5354
|
if (Buffer.isBuffer(scriptBuffer)) scriptBuffer = scriptBuffer.toString();
|
|
@@ -5415,7 +5410,7 @@ var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
|
|
|
5415
5410
|
conversation.push(Object.assign({
|
|
5416
5411
|
sender,
|
|
5417
5412
|
stepTag: 'Line ' + (step.map[0] + 1)
|
|
5418
|
-
}, linesToConvoStep(step.children.map(child => child.content + (child.children && child.children.length > 0 ? ' ' + child.children.map(child => child.content).join('|') : '')), sender, this.context
|
|
5413
|
+
}, linesToConvoStep(step.children.map(child => child.content + (child.children && child.children.length > 0 ? ' ' + child.children.map(child => child.content).join('|') : '')), sender, this.context)));
|
|
5419
5414
|
} else {
|
|
5420
5415
|
debug$a(`Expected sender ${validSenders.map(s => `'${s}'`).join(' or ')} but found ${sender}`);
|
|
5421
5416
|
}
|