botium-core 1.14.5 → 1.14.7
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 +42 -45
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +42 -45
- package/dist/botium-es.js.map +1 -1
- package/package.json +18 -18
- package/src/Defaults.js +0 -1
- package/src/containers/PluginConnectorContainer.js +5 -5
- package/src/helpers/RetryHelper.js +3 -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/ScriptingProvider.js +2 -2
- 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.7";
|
|
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: [],
|
|
@@ -3633,8 +3632,10 @@ var RetryHelper_1 = class RetryHelper {
|
|
|
3633
3632
|
debug$j(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
|
|
3634
3633
|
}
|
|
3635
3634
|
}
|
|
3636
|
-
shouldRetry(err) {
|
|
3635
|
+
shouldRetry(err, currentRetryCount) {
|
|
3637
3636
|
if (!err) return false;
|
|
3637
|
+
if (!this.retrySettings.retries) return false;
|
|
3638
|
+
if (this.retrySettings.retries < currentRetryCount) return false;
|
|
3638
3639
|
if (this.retryErrorPatterns.length === 0) return true;
|
|
3639
3640
|
const errString = util__default["default"].inspect(err);
|
|
3640
3641
|
for (const re of this.retryErrorPatterns) {
|
|
@@ -4877,16 +4878,16 @@ const {
|
|
|
4877
4878
|
var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
4878
4879
|
constructor(context, caps = {}) {
|
|
4879
4880
|
super(context, caps);
|
|
4880
|
-
this.
|
|
4881
|
+
this.eolRead = caps[Capabilities.SCRIPTING_TXT_EOL] || /\r\n|\r|\n/;
|
|
4882
|
+
this.eolWrite = caps[Capabilities.SCRIPTING_TXT_EOL] && !lodash__default["default"].isRegExp(caps[Capabilities.SCRIPTING_TXT_EOL]) ? caps[Capabilities.SCRIPTING_TXT_EOL] : '\n';
|
|
4881
4883
|
}
|
|
4882
4884
|
Validate() {
|
|
4883
4885
|
super.Validate();
|
|
4884
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
4885
4886
|
}
|
|
4886
4887
|
GetHeaders(scriptBuffer) {
|
|
4887
4888
|
let scriptData = scriptBuffer;
|
|
4888
4889
|
if (Buffer.isBuffer(scriptBuffer)) scriptData = scriptData.toString();
|
|
4889
|
-
const lines = scriptData.split(this.
|
|
4890
|
+
const lines = scriptData.split(this.eolRead);
|
|
4890
4891
|
const header = {};
|
|
4891
4892
|
if (lines && !lines[0].startsWith('#')) {
|
|
4892
4893
|
header.name = lines[0];
|
|
@@ -4896,7 +4897,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4896
4897
|
Compile(scriptBuffer, scriptType = Constants.SCRIPTING_TYPE_CONVO) {
|
|
4897
4898
|
let scriptData = scriptBuffer;
|
|
4898
4899
|
if (Buffer.isBuffer(scriptBuffer)) scriptData = scriptData.toString();
|
|
4899
|
-
const lines = scriptData.split(this.
|
|
4900
|
+
const lines = scriptData.split(this.eolRead);
|
|
4900
4901
|
if (scriptType === Constants.SCRIPTING_TYPE_CONVO) {
|
|
4901
4902
|
return this._compileConvo(lines, false);
|
|
4902
4903
|
} else if (scriptType === Constants.SCRIPTING_TYPE_PCONVO) {
|
|
@@ -4921,7 +4922,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4921
4922
|
let convoStepLineIndex = null;
|
|
4922
4923
|
const parseMsg = lines => {
|
|
4923
4924
|
lines = lines || [];
|
|
4924
|
-
return linesToConvoStep$3(lines, convoStepSender, this.context
|
|
4925
|
+
return linesToConvoStep$3(lines, convoStepSender, this.context);
|
|
4925
4926
|
};
|
|
4926
4927
|
const pushPrev = () => {
|
|
4927
4928
|
if (convoStepSender && currentLines) {
|
|
@@ -4935,7 +4936,7 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4935
4936
|
} else if (!convoStepSender && currentLines) {
|
|
4936
4937
|
convo.header.name = currentLines[0];
|
|
4937
4938
|
if (currentLines.length > 1) {
|
|
4938
|
-
convo.header.description = currentLines.slice(1).join(this.
|
|
4939
|
+
convo.header.description = currentLines.slice(1).join(this.eolWrite);
|
|
4939
4940
|
}
|
|
4940
4941
|
}
|
|
4941
4942
|
};
|
|
@@ -4999,20 +5000,20 @@ var CompilerTxt_1 = class CompilerTxt extends CompilerBase_1 {
|
|
|
4999
5000
|
}
|
|
5000
5001
|
let script = '';
|
|
5001
5002
|
if (convo.header.name) {
|
|
5002
|
-
script += convo.header.name + this.
|
|
5003
|
+
script += convo.header.name + this.eolWrite;
|
|
5003
5004
|
}
|
|
5004
5005
|
if (convo.header.description) {
|
|
5005
|
-
script += convo.header.description + this.
|
|
5006
|
+
script += convo.header.description + this.eolWrite;
|
|
5006
5007
|
}
|
|
5007
5008
|
convo.conversation.forEach(step => {
|
|
5008
|
-
script += this.
|
|
5009
|
+
script += this.eolWrite;
|
|
5009
5010
|
script += '#' + step.sender;
|
|
5010
5011
|
if (step.channel && step.channel !== 'default') {
|
|
5011
5012
|
script += ' ' + step.channel;
|
|
5012
5013
|
}
|
|
5013
|
-
script += this.
|
|
5014
|
+
script += this.eolWrite;
|
|
5014
5015
|
const stepLines = convoStepToLines(step);
|
|
5015
|
-
if (stepLines && stepLines.length > 0) script += stepLines.join(this.
|
|
5016
|
+
if (stepLines && stepLines.length > 0) script += stepLines.join(this.eolWrite) + this.eolWrite;
|
|
5016
5017
|
});
|
|
5017
5018
|
return script;
|
|
5018
5019
|
}
|
|
@@ -5244,11 +5245,9 @@ const {
|
|
|
5244
5245
|
var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
5245
5246
|
constructor(context, caps = {}) {
|
|
5246
5247
|
super(context, caps);
|
|
5247
|
-
this.eol = caps[Capabilities.SCRIPTING_TXT_EOL];
|
|
5248
5248
|
}
|
|
5249
5249
|
Validate() {
|
|
5250
5250
|
super.Validate();
|
|
5251
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
5252
5251
|
}
|
|
5253
5252
|
GetHeaders(scriptBuffer) {
|
|
5254
5253
|
debug$b('GetHeaders is not implemented!');
|
|
@@ -5289,7 +5288,7 @@ var CompilerObjectBase_1 = class CompilerObjectBase extends CompilerBase_1 {
|
|
|
5289
5288
|
conversation.push(Object.assign({
|
|
5290
5289
|
sender: convoStepSender,
|
|
5291
5290
|
stepTag: 'Line ' + lineTag
|
|
5292
|
-
}, linesToConvoStep$1(convoStepObject, convoStepSender, this.context
|
|
5291
|
+
}, linesToConvoStep$1(convoStepObject, convoStepSender, this.context)));
|
|
5293
5292
|
}
|
|
5294
5293
|
const convo = {
|
|
5295
5294
|
header: {
|
|
@@ -5391,11 +5390,9 @@ const {
|
|
|
5391
5390
|
var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
|
|
5392
5391
|
constructor(context, caps = {}) {
|
|
5393
5392
|
super(context, caps);
|
|
5394
|
-
this.eol = caps[Capabilities.SCRIPTING_TXT_EOL];
|
|
5395
5393
|
}
|
|
5396
5394
|
Validate() {
|
|
5397
5395
|
super.Validate();
|
|
5398
|
-
this._AssertCapabilityExists(Capabilities.SCRIPTING_TXT_EOL);
|
|
5399
5396
|
}
|
|
5400
5397
|
Compile(scriptBuffer, scriptType = Constants.SCRIPTING_TYPE_CONVO) {
|
|
5401
5398
|
if (Buffer.isBuffer(scriptBuffer)) scriptBuffer = scriptBuffer.toString();
|
|
@@ -5457,7 +5454,7 @@ var CompilerMarkdown_1 = class CompilerMarkdown extends CompilerBase_1 {
|
|
|
5457
5454
|
conversation.push(Object.assign({
|
|
5458
5455
|
sender,
|
|
5459
5456
|
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
|
|
5457
|
+
}, linesToConvoStep(step.children.map(child => child.content + (child.children && child.children.length > 0 ? ' ' + child.children.map(child => child.content).join('|') : '')), sender, this.context)));
|
|
5461
5458
|
} else {
|
|
5462
5459
|
debug$a(`Expected sender ${validSenders.map(s => `'${s}'`).join(' or ')} but found ${sender}`);
|
|
5463
5460
|
}
|
|
@@ -5519,7 +5516,7 @@ const p = (retryHelper, fn) => {
|
|
|
5519
5516
|
if (retryHelper) {
|
|
5520
5517
|
return promiseRetry__default["default"]((retry, number) => {
|
|
5521
5518
|
return promise().catch(err => {
|
|
5522
|
-
if (retryHelper.shouldRetry(err)) {
|
|
5519
|
+
if (retryHelper.shouldRetry(err, number)) {
|
|
5523
5520
|
debug$9(`Asserter trial #${number} failed, retry activated`);
|
|
5524
5521
|
retry(err);
|
|
5525
5522
|
} else {
|
|
@@ -5544,7 +5541,7 @@ const pnot = (retryHelper, fn, errTemplate) => {
|
|
|
5544
5541
|
if (retryHelper) {
|
|
5545
5542
|
return promiseRetry__default["default"]((retry, number) => {
|
|
5546
5543
|
return promise().catch(() => {
|
|
5547
|
-
if (retryHelper.shouldRetry(errTemplate)) {
|
|
5544
|
+
if (retryHelper.shouldRetry(errTemplate, number)) {
|
|
5548
5545
|
debug$9(`Asserter trial #${number} failed, !retry activated`);
|
|
5549
5546
|
retry(errTemplate);
|
|
5550
5547
|
} else {
|
|
@@ -8997,7 +8994,7 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
|
|
|
8997
8994
|
try {
|
|
8998
8995
|
return super.Build().then(() => promiseRetry__default["default"]((retry, number) => {
|
|
8999
8996
|
return (this.pluginInstance.Build ? this.pluginInstance.Build() || Promise.resolve() : Promise.resolve()).catch(err => {
|
|
9000
|
-
if (this.retryHelperBuild.shouldRetry(err)) {
|
|
8997
|
+
if (this.retryHelperBuild.shouldRetry(err, number)) {
|
|
9001
8998
|
debug$2(`Build trial #${number} failed, retry activated`);
|
|
9002
8999
|
retry(err);
|
|
9003
9000
|
} else {
|
|
@@ -9014,7 +9011,7 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
|
|
|
9014
9011
|
try {
|
|
9015
9012
|
return super.Start().then(() => promiseRetry__default["default"]((retry, number) => {
|
|
9016
9013
|
return (this.pluginInstance.Start ? this.pluginInstance.Start() || Promise.resolve() : Promise.resolve()).catch(err => {
|
|
9017
|
-
if (this.retryHelperStart.shouldRetry(err)) {
|
|
9014
|
+
if (this.retryHelperStart.shouldRetry(err, number)) {
|
|
9018
9015
|
debug$2(`Start trial #${number} failed, retry activated`);
|
|
9019
9016
|
retry(err);
|
|
9020
9017
|
} else {
|
|
@@ -9037,7 +9034,7 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
|
|
|
9037
9034
|
try {
|
|
9038
9035
|
return promiseRetry__default["default"]((retry, number) => {
|
|
9039
9036
|
return (this.pluginInstance.UserSays(mockMsg) || Promise.resolve()).catch(err => {
|
|
9040
|
-
if (this.retryHelperUserSays.shouldRetry(err)) {
|
|
9037
|
+
if (this.retryHelperUserSays.shouldRetry(err, number)) {
|
|
9041
9038
|
debug$2(`UserSays trial #${number} failed, retry activated`);
|
|
9042
9039
|
retry(err);
|
|
9043
9040
|
} else {
|
|
@@ -9057,7 +9054,7 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
|
|
|
9057
9054
|
try {
|
|
9058
9055
|
return super.Stop().then(() => promiseRetry__default["default"]((retry, number) => {
|
|
9059
9056
|
return (this.pluginInstance.Stop ? this.pluginInstance.Stop() || Promise.resolve() : Promise.resolve()).catch(err => {
|
|
9060
|
-
if (this.retryHelperStop.shouldRetry(err)) {
|
|
9057
|
+
if (this.retryHelperStop.shouldRetry(err, number)) {
|
|
9061
9058
|
debug$2(`Stop trial #${number} failed, retry activated`);
|
|
9062
9059
|
retry(err);
|
|
9063
9060
|
} else {
|
|
@@ -9081,7 +9078,7 @@ var PluginConnectorContainer_1 = class PluginConnectorContainer extends BaseCont
|
|
|
9081
9078
|
try {
|
|
9082
9079
|
return promiseRetry__default["default"]((retry, number) => {
|
|
9083
9080
|
return (this.pluginInstance.Clean ? this.pluginInstance.Clean() || Promise.resolve() : Promise.resolve()).catch(err => {
|
|
9084
|
-
if (this.retryHelperClean.shouldRetry(err)) {
|
|
9081
|
+
if (this.retryHelperClean.shouldRetry(err, number)) {
|
|
9085
9082
|
debug$2(`Clean trial #${number} failed, retry activated`);
|
|
9086
9083
|
retry(err);
|
|
9087
9084
|
} else {
|