wingbot 3.55.0 → 3.55.2

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.55.0",
3
+ "version": "3.55.2",
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 90 --functions 89 --branches 80",
12
+ "test:coverage:threshold": "nyc check-coverage --lines 89 --functions 89 --branches 80",
13
13
  "test:backend": "mocha ./test",
14
14
  "test:lint": "eslint --ext .js src test *.js plugins"
15
15
  },
@@ -110,8 +110,15 @@ const compare = (variable, operator, value = undefined) => {
110
110
  }
111
111
 
112
112
  if (variable && typeof variable === 'object' && !isArrayLengthCompare) {
113
- return Object.values(variable)
114
- .some((variableElement) => compare(variableElement, operator, value));
113
+ switch (operator) {
114
+ case ConditionOperators['is true']:
115
+ return Object.keys(variable).length !== 0;
116
+ case ConditionOperators['is false']:
117
+ return Object.keys(variable).length === 0;
118
+ default:
119
+ return Object.values(variable)
120
+ .some((variableElement) => compare(variableElement, operator, value));
121
+ }
115
122
  }
116
123
 
117
124
  switch (operator) {
@@ -76,6 +76,8 @@ function optionalWrap (l, r, content) {
76
76
  return `${l || ''}(${content})${r || ''}`;
77
77
  }
78
78
 
79
+ const MULTI_ENTITY_CLEANER = /((?<!\\)\([^()]*[^()\\]\)|@[A-Z0-9-]+)\?/g;
80
+
79
81
  class CustomEntityDetectionModel {
80
82
 
81
83
  /**
@@ -485,11 +487,18 @@ class CustomEntityDetectionModel {
485
487
 
486
488
  /**
487
489
  *
488
- * @param {RegExp} regexp
490
+ * @param {RegExp|string} regexp
489
491
  */
490
492
  _extractRegExpDependencies (regexp) {
491
- const matches = regexp.source.match(/@[A-Z0-9-]+/g);
492
- return Array.from(new Set(matches).values());
493
+ let str = typeof regexp === 'string' ? regexp : regexp.source;
494
+ const matches = str.match(/@[A-Z0-9-]+/g);
495
+ const known = Array.from(new Set(matches));
496
+ if (known.length <= 1 || !str.match(MULTI_ENTITY_CLEANER)) {
497
+ return known;
498
+ }
499
+ str = str.replace(MULTI_ENTITY_CLEANER, '');
500
+ const cleanDeps = this._extractRegExpDependencies(str);
501
+ return Array.from(new Set([...cleanDeps, ...matches]));
493
502
  }
494
503
 
495
504
  /**