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-cjs.js
CHANGED
|
@@ -77,7 +77,7 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
|
|
|
77
77
|
var bodyParser__default = /*#__PURE__*/_interopDefaultLegacy(bodyParser);
|
|
78
78
|
|
|
79
79
|
var name = "botium-core";
|
|
80
|
-
var version$1 = "1.14.
|
|
80
|
+
var version$1 = "1.14.6";
|
|
81
81
|
var description = "The Selenium for Chatbots";
|
|
82
82
|
var main = "index.js";
|
|
83
83
|
var module$1 = "dist/botium-es.js";
|
|
@@ -95,7 +95,7 @@ var scripts = {
|
|
|
95
95
|
link: "npm link botium-connector-dialogflow botium-connector-webdriverio botium-connector-directline3 botium-connector-watson botium-connector-alexa-smapi botium-connector-echo",
|
|
96
96
|
test: "cross-env NODE_PATH=\"./test/plugins/plugindir/fromfolder:./test/plugins/plugindir/fromfile:./test/security/resources\" mocha \"./test/**/*.spec.js\"",
|
|
97
97
|
"coverage:report": "nyc report --reporter=lcov npm test",
|
|
98
|
-
"update-dependencies": "npm-check-updates --reject globby,rollup -u --timeout 120000"
|
|
98
|
+
"update-dependencies": "npm-check-updates --reject chai,globby,rollup -u --timeout 120000"
|
|
99
99
|
};
|
|
100
100
|
var repository = {
|
|
101
101
|
type: "git",
|
|
@@ -108,7 +108,7 @@ var bugs = {
|
|
|
108
108
|
};
|
|
109
109
|
var homepage = "https://www.botium.ai";
|
|
110
110
|
var dependencies = {
|
|
111
|
-
"@babel/runtime": "^7.23.
|
|
111
|
+
"@babel/runtime": "^7.23.9",
|
|
112
112
|
async: "^3.2.5",
|
|
113
113
|
"body-parser": "^1.20.2",
|
|
114
114
|
boolean: "^3.2.0",
|
|
@@ -125,8 +125,8 @@ var dependencies = {
|
|
|
125
125
|
"markdown-it": "^14.0.0",
|
|
126
126
|
"mime-types": "^2.1.35",
|
|
127
127
|
mkdirp: "^3.0.1",
|
|
128
|
-
moment: "^2.
|
|
129
|
-
"moment-timezone": "^0.5.
|
|
128
|
+
moment: "^2.30.1",
|
|
129
|
+
"moment-timezone": "^0.5.45",
|
|
130
130
|
mustache: "^4.2.0",
|
|
131
131
|
"promise-retry": "^2.0.1",
|
|
132
132
|
"promise.allsettled": "^1.0.7",
|
|
@@ -135,8 +135,8 @@ var dependencies = {
|
|
|
135
135
|
rimraf: "^5.0.5",
|
|
136
136
|
"sanitize-filename": "^1.6.3",
|
|
137
137
|
slugify: "^1.6.6",
|
|
138
|
-
"socket.io": "^4.7.
|
|
139
|
-
"socket.io-client": "^4.7.
|
|
138
|
+
"socket.io": "^4.7.4",
|
|
139
|
+
"socket.io-client": "^4.7.4",
|
|
140
140
|
"socketio-auth": "^0.1.1",
|
|
141
141
|
"swagger-jsdoc": "^6.2.8",
|
|
142
142
|
"swagger-ui-express": "^5.0.0",
|
|
@@ -148,23 +148,23 @@ var dependencies = {
|
|
|
148
148
|
yaml: "^2.3.4"
|
|
149
149
|
};
|
|
150
150
|
var devDependencies = {
|
|
151
|
-
"@babel/core": "^7.23.
|
|
152
|
-
"@babel/node": "^7.
|
|
153
|
-
"@babel/plugin-transform-runtime": "^7.23.
|
|
154
|
-
"@babel/preset-env": "^7.23.
|
|
155
|
-
chai: "
|
|
151
|
+
"@babel/core": "^7.23.9",
|
|
152
|
+
"@babel/node": "^7.23.9",
|
|
153
|
+
"@babel/plugin-transform-runtime": "^7.23.9",
|
|
154
|
+
"@babel/preset-env": "^7.23.9",
|
|
155
|
+
chai: "4.3.10",
|
|
156
156
|
"chai-as-promised": "^7.1.1",
|
|
157
157
|
"cross-env": "^7.0.3",
|
|
158
|
-
eslint: "^8.
|
|
158
|
+
eslint: "^8.56.0",
|
|
159
159
|
"eslint-config-standard": "^17.1.0",
|
|
160
|
-
"eslint-plugin-import": "^2.29.
|
|
160
|
+
"eslint-plugin-import": "^2.29.1",
|
|
161
161
|
"eslint-plugin-mocha": "^10.2.0",
|
|
162
|
-
"eslint-plugin-n": "^16.
|
|
162
|
+
"eslint-plugin-n": "^16.6.2",
|
|
163
163
|
"eslint-plugin-promise": "^6.1.1",
|
|
164
164
|
"eslint-plugin-standard": "^4.1.0",
|
|
165
|
-
mocha: "^10.
|
|
166
|
-
nock: "^13.
|
|
167
|
-
"npm-check-updates": "^16.14.
|
|
165
|
+
mocha: "^10.3.0",
|
|
166
|
+
nock: "^13.5.1",
|
|
167
|
+
"npm-check-updates": "^16.14.15",
|
|
168
168
|
nyc: "^15.1.0",
|
|
169
169
|
rollup: "2.79.1",
|
|
170
170
|
"rollup-plugin-babel": "^4.4.0",
|
|
@@ -594,7 +594,6 @@ var Defaults$1 = {
|
|
|
594
594
|
[Capabilities.SIMPLEREST_INBOUND_UPDATE_CONTEXT]: true,
|
|
595
595
|
[Capabilities.SIMPLEREST_CONTEXT_MERGE_OR_REPLACE]: 'MERGE',
|
|
596
596
|
[Capabilities.SIMPLEREST_COOKIE_REPLICATION]: true,
|
|
597
|
-
[Capabilities.SCRIPTING_TXT_EOL]: '\n',
|
|
598
597
|
[Capabilities.SCRIPTING_XLSX_EOL_WRITE]: '\r\n',
|
|
599
598
|
[Capabilities.SCRIPTING_XLSX_HASHEADERS]: true,
|
|
600
599
|
[Capabilities.SCRIPTING_CSV_SKIP_HEADER]: true,
|
|
@@ -1647,7 +1646,7 @@ const _formatAppendArgs = args => {
|
|
|
1647
1646
|
const _parseArgs = str => {
|
|
1648
1647
|
return str && str.length > 0 && str.replace(/\\\|/g, '###ESCAPESPLIT###').split('|').map(s => s.replace(/###ESCAPESPLIT###/g, '|').trim()) || [];
|
|
1649
1648
|
};
|
|
1650
|
-
const linesToConvoStep$5 = (lines, sender, context, eol, singleLineMode = false) => {
|
|
1649
|
+
const linesToConvoStep$5 = (lines, sender, context, eol = '\n', singleLineMode = false) => {
|
|
1651
1650
|
if (!validateSender$1(sender)) throw new Error(`Failed to parse conversation. Section "${sender}" unknown.`);
|
|
1652
1651
|
const convoStep = {
|
|
1653
1652
|
asserters: [],
|
|
@@ -4877,16 +4876,16 @@ const {
|
|
|
4877
4876
|
var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
4878
4877
|
constructor(context, caps = {}) {
|
|
4879
4878
|
super(context, caps);
|
|
4880
|
-
this.
|
|
4879
|
+
this.eolRead = caps[Capabilities.SCRIPTING_TXT_EOL] || /\r\n|\r|\n/;
|
|
4880
|
+
this.eolWrite = caps[Capabilities.SCRIPTING_TXT_EOL] && !lodash__default["default"].isRegExp(caps[Capabilities.SCRIPTING_TXT_EOL]) ? caps[Capabilities.SCRIPTING_TXT_EOL] : '\n';
|
|
4881
4881
|
}
|
|
4882
4882
|
Validate() {
|
|
4883
4883
|
super.Validate();
|
|
4884
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
4885
4884
|
}
|
|
4886
4885
|
GetHeaders(scriptBuffer) {
|
|
4887
4886
|
let scriptData = scriptBuffer;
|
|
4888
4887
|
if (Buffer.isBuffer(scriptBuffer)) scriptData = scriptData.toString();
|
|
4889
|
-
const lines = scriptData.split(this.
|
|
4888
|
+
const lines = scriptData.split(this.eolRead);
|
|
4890
4889
|
const header = {};
|
|
4891
4890
|
if (lines && !lines[0].startsWith('#')) {
|
|
4892
4891
|
header.name = lines[0];
|
|
@@ -4896,7 +4895,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4896
4895
|
Compile(scriptBuffer, scriptType = Constants.SCRIPTING_TYPE_CONVO) {
|
|
4897
4896
|
let scriptData = scriptBuffer;
|
|
4898
4897
|
if (Buffer.isBuffer(scriptBuffer)) scriptData = scriptData.toString();
|
|
4899
|
-
const lines = scriptData.split(this.
|
|
4898
|
+
const lines = scriptData.split(this.eolRead);
|
|
4900
4899
|
if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
|
|
4901
4900
|
return this._compileConvo(lines, false);
|
|
4902
4901
|
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
@@ -4921,7 +4920,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4921
4920
|
let convoStepLineIndex = null;
|
|
4922
4921
|
const parseMsg = lines => {
|
|
4923
4922
|
lines = lines || [];
|
|
4924
|
-
return linesToConvoStep$3(lines, convoStepSender, this.context
|
|
4923
|
+
return linesToConvoStep$3(lines, convoStepSender, this.context);
|
|
4925
4924
|
};
|
|
4926
4925
|
const pushPrev = () => {
|
|
4927
4926
|
if (convoStepSender && currentLines) {
|
|
@@ -4935,7 +4934,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4935
4934
|
} else if (!convoStepSender && currentLines) {
|
|
4936
4935
|
convo.header.name = currentLines[0];
|
|
4937
4936
|
if (currentLines.length > 1) {
|
|
4938
|
-
convo.header.description = currentLines.slice(1).join(this.
|
|
4937
|
+
convo.header.description = currentLines.slice(1).join(this.eolWrite);
|
|
4939
4938
|
}
|
|
4940
4939
|
}
|
|
4941
4940
|
};
|
|
@@ -4999,20 +4998,20 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4999
4998
|
}
|
|
5000
4999
|
let script = '';
|
|
5001
5000
|
if (convo.header.name) {
|
|
5002
|
-
script += convo.header.name + this.
|
|
5001
|
+
script += convo.header.name + this.eolWrite;
|
|
5003
5002
|
}
|
|
5004
5003
|
if (convo.header.description) {
|
|
5005
|
-
script += convo.header.description + this.
|
|
5004
|
+
script += convo.header.description + this.eolWrite;
|
|
5006
5005
|
}
|
|
5007
5006
|
convo.conversation.forEach(step => {
|
|
5008
|
-
script += this.
|
|
5007
|
+
script += this.eolWrite;
|
|
5009
5008
|
script += '#' + step.sender;
|
|
5010
5009
|
if (step.channel && step.channel !== 'default') {
|
|
5011
5010
|
script += ' ' + step.channel;
|
|
5012
5011
|
}
|
|
5013
|
-
script += this.
|
|
5012
|
+
script += this.eolWrite;
|
|
5014
5013
|
const stepLines = convoStepToLines(step);
|
|
5015
|
-
if (stepLines && stepLines.length > 0) script += stepLines.join(this.
|
|
5014
|
+
if (stepLines && stepLines.length > 0) script += stepLines.join(this.eolWrite) + this.eolWrite;
|
|
5016
5015
|
});
|
|
5017
5016
|
return script;
|
|
5018
5017
|
}
|
|
@@ -5244,11 +5243,9 @@ const {
|
|
|
5244
5243
|
var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
5245
5244
|
constructor(context, caps = {}) {
|
|
5246
5245
|
super(context, caps);
|
|
5247
|
-
this.eol = caps[Capabilities.SCRIPTING_TXT_EOL];
|
|
5248
5246
|
}
|
|
5249
5247
|
Validate() {
|
|
5250
5248
|
super.Validate();
|
|
5251
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
5252
5249
|
}
|
|
5253
5250
|
GetHeaders(scriptBuffer) {
|
|
5254
5251
|
debug$b('GetHeaders is not implemented!');
|
|
@@ -5289,7 +5286,7 @@ var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
|
5289
5286
|
conversation.push(Object.assign({
|
|
5290
5287
|
sender: convoStepSender,
|
|
5291
5288
|
stepTag: 'Line ' + lineTag
|
|
5292
|
-
}, linesToConvoStep$1(convoStepObject, convoStepSender, this.context
|
|
5289
|
+
}, linesToConvoStep$1(convoStepObject, convoStepSender, this.context)));
|
|
5293
5290
|
}
|
|
5294
5291
|
const convo = {
|
|
5295
5292
|
header: {
|
|
@@ -5391,11 +5388,9 @@ const {
|
|
|
5391
5388
|
var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
|
|
5392
5389
|
constructor(context, caps = {}) {
|
|
5393
5390
|
super(context, caps);
|
|
5394
|
-
this.eol = caps[Capabilities.SCRIPTING_TXT_EOL];
|
|
5395
5391
|
}
|
|
5396
5392
|
Validate() {
|
|
5397
5393
|
super.Validate();
|
|
5398
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
5399
5394
|
}
|
|
5400
5395
|
Compile(scriptBuffer, scriptType = Constants.SCRIPTING_TYPE_CONVO) {
|
|
5401
5396
|
if (Buffer.isBuffer(scriptBuffer)) scriptBuffer = scriptBuffer.toString();
|
|
@@ -5457,7 +5452,7 @@ var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
|
|
|
5457
5452
|
conversation.push(Object.assign({
|
|
5458
5453
|
sender,
|
|
5459
5454
|
stepTag: 'Line ' + (step.map[0] + 1)
|
|
5460
|
-
}, linesToConvoStep(step.children.map(child => child.content + (child.children && child.children.length > 0 ? ' ' + child.children.map(child => child.content).join('|') : '')), sender, this.context
|
|
5455
|
+
}, linesToConvoStep(step.children.map(child => child.content + (child.children && child.children.length > 0 ? ' ' + child.children.map(child => child.content).join('|') : '')), sender, this.context)));
|
|
5461
5456
|
} else {
|
|
5462
5457
|
debug$a(`Expected sender ${validSenders.map(s => `'${s}'`).join(' or ')} but found ${sender}`);
|
|
5463
5458
|
}
|