wingbot 3.38.0-alpha.1 → 3.38.0-alpha.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wingbot",
|
|
3
|
-
"version": "3.38.0-alpha.
|
|
3
|
+
"version": "3.38.0-alpha.3",
|
|
4
4
|
"description": "Enterprise Messaging Bot Conversation Engine",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"doc": "npm run doc:gql && node ./bin/makeApiDoc.js && cpy ./CHANGELOG.md ./doc && gitbook install ./doc && gitbook build ./doc && rimraf -rf ./docs && rimraf --rf ./doc/CHANGELOG.md && move-cli ./doc/_book ./docs",
|
|
10
10
|
"test": "npm run test:lint && npm run test:coverage && npm run test:coverage:threshold",
|
|
11
11
|
"test:coverage": "nyc --reporter=html mocha ./test && nyc report",
|
|
12
|
-
"test:coverage:threshold": "nyc check-coverage --lines
|
|
12
|
+
"test:coverage:threshold": "nyc check-coverage --lines 90 --functions 90 --branches 80",
|
|
13
13
|
"test:backend": "mocha ./test",
|
|
14
14
|
"test:lint": "eslint --ext .js src test *.js plugins"
|
|
15
15
|
},
|
|
@@ -119,11 +119,17 @@ const compare = (variable, operator, value = undefined) => {
|
|
|
119
119
|
return isStringNumber(variable) ? !toNumber(variable) : !variable;
|
|
120
120
|
case ConditionOperators.contains:
|
|
121
121
|
if (typeof variable === 'string') {
|
|
122
|
-
if (isSimpleWord(value))
|
|
123
|
-
|
|
122
|
+
if (isSimpleWord(value)) {
|
|
123
|
+
return webalize(variable).includes(webalize(`${value}`));
|
|
124
|
+
}
|
|
125
|
+
return variable.toLocaleLowerCase().includes(`${value}`.toLocaleLowerCase());
|
|
124
126
|
}
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
if (variable === null || variable === undefined) {
|
|
129
|
+
return value === null || value === undefined || value === '';
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return `${variable}`.includes(`${value}`);
|
|
127
133
|
|
|
128
134
|
case ConditionOperators['not contains']:
|
|
129
135
|
return !compare(variable, ConditionOperators.contains, value);
|
package/src/utils/getUpdate.js
CHANGED
|
@@ -86,7 +86,7 @@ function toArray (previousValue) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
const ENTITY_HBS_REGEXP = /^\s*\{\{\[?@([^@[\]{}\s]+)(\])?\}\}\s*$/;
|
|
89
|
-
const VARIABLE_HBS_REGEXP = /^\s*\{\{\[?([
|
|
89
|
+
const VARIABLE_HBS_REGEXP = /^\s*\{\{\[?([^$@[\]{}\s]+)\]?\}\}\s*$/;
|
|
90
90
|
|
|
91
91
|
function getSetState (setState, req, res = null, useState = null, configuration = null) {
|
|
92
92
|
if (!setState) {
|
|
@@ -161,8 +161,6 @@ function getSetState (setState, req, res = null, useState = null, configuration
|
|
|
161
161
|
valAsArray.shift();
|
|
162
162
|
} else if (val._$pop) {
|
|
163
163
|
valAsArray.pop();
|
|
164
|
-
} else if (val._$pushT) {
|
|
165
|
-
valAsArray.push(req.text());
|
|
166
164
|
} else {
|
|
167
165
|
const value = val._$add || val._$rem || val._$push || val._$set;
|
|
168
166
|
const [, entity, rear] = `${value}`.match(ENTITY_HBS_REGEXP) || [];
|