wingbot 3.67.10 → 3.67.12

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/.babelrc ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "presets": [
3
+ "@babel/preset-react",
4
+ [
5
+ "@babel/preset-env",
6
+ {
7
+ "targets": {
8
+ "node": "current",
9
+ "browsers": [
10
+ "last 2 versions",
11
+ "ie >= 11"
12
+ ]
13
+ }
14
+ }
15
+ ],
16
+ "@babel/preset-typescript"
17
+ ],
18
+ "plugins": [
19
+ "@babel/plugin-proposal-class-properties"
20
+ ],
21
+ "sourceType": "unambiguous"
22
+ }
@@ -15,7 +15,7 @@ jobs:
15
15
 
16
16
  strategy:
17
17
  matrix:
18
- node-version: [14.x]
18
+ node-version: [16.x]
19
19
 
20
20
  steps:
21
21
 
@@ -33,7 +33,7 @@ jobs:
33
33
 
34
34
  - name: Test
35
35
  run: npm run test
36
-
36
+
37
37
  - name: Rewrite gatsby confing inside smoothdoc
38
38
  run: cp documentation/smooth-doc-gatsby-config.js documentation/node_modules/smooth-doc/gatsby-config.js
39
39
 
@@ -42,7 +42,7 @@ jobs:
42
42
 
43
43
  - name: Build documentation website with gatsby
44
44
  run: cd documentation && npm run build
45
-
45
+
46
46
  - name: Deploy documentation to github pages
47
47
  uses: JamesIves/github-pages-deploy-action@v4
48
48
  with:
@@ -11,7 +11,7 @@ jobs:
11
11
 
12
12
  strategy:
13
13
  matrix:
14
- node-version: [12.x]
14
+ node-version: [16.x]
15
15
 
16
16
  steps:
17
17
 
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "wingbot",
3
- "version": "3.67.10",
3
+ "version": "3.67.12",
4
4
  "description": "Enterprise Messaging Bot Conversation Engine",
5
5
  "main": "index.js",
6
+ "type": "commonjs",
6
7
  "scripts": {
7
8
  "tsd:update": "jsdoc -t ./node_modules/tsd-jsdoc/dist/ -r ./src",
8
9
  "doc:gql": "graphql-markdown ./src/graphApi/schema.gql > doc/api/graphqlSchema.md",
@@ -36,20 +37,20 @@
36
37
  },
37
38
  "homepage": "https://github.com/wingbot.ai/wingbot#readme",
38
39
  "devDependencies": {
39
- "cpy-cli": "^4.2.0",
40
- "eslint": "^8.36.0",
40
+ "cpy-cli": "^5.0.0",
41
+ "eslint": "^8.56.0",
41
42
  "eslint-config-airbnb": "^19.0.4",
42
- "eslint-plugin-import": "^2.27.5",
43
- "eslint-plugin-jsdoc": "^40.1.0",
44
- "eslint-plugin-jsx-a11y": "^6.7.1",
45
- "eslint-plugin-mocha": "^10.1.0",
46
- "eslint-plugin-react": "^7.32.2",
43
+ "eslint-plugin-import": "^2.29.1",
44
+ "eslint-plugin-jsdoc": "^48.0.2",
45
+ "eslint-plugin-jsx-a11y": "^6.8.0",
46
+ "eslint-plugin-mocha": "^10.2.0",
47
+ "eslint-plugin-react": "^7.33.2",
47
48
  "graphql-markdown": "^7.0.0",
48
49
  "jsdoc-to-markdown": "^8.0.0",
49
50
  "mocha": "^10.2.0",
50
51
  "nyc": "^15.1.0",
51
- "rimraf": "^3.0.2",
52
- "sinon": "^15.0.3",
52
+ "rimraf": "^5.0.5",
53
+ "sinon": "^17.0.1",
53
54
  "tsd-jsdoc": "^2.5.0"
54
55
  },
55
56
  "dependencies": {
@@ -4,7 +4,7 @@
4
4
  'use strict';
5
5
 
6
6
  const PHONE_REGEX = /((00|\+)[\s-]?[0-9]{1,4}[\s-]?)?([0-9]{3,4}[\s-]?([0-9]{2,3}[\s-]?[0-9]{2}[\s-]?[0-9]{2,3}|[0-9]{3,4}[\s-]?[0-9]{3,4}))(?=(\s|$|[,!.?\-:]))/;
7
- const EMAIL_REGEX = /(?<=(\s|^|:|,))[a-zA-Z0-9!#$%&'*+\-=?^_`{|}~"][^@:\s]*@[^.@\s]+\.[^@\s,]+/;
7
+ const EMAIL_REGEX = /(?<=(\s|^|:|,|;|-|\+))[a-zA-Z0-9!#$%&'*+\-=?^_`{|}~"][^@:\s]*@[^.@\s]+\.[^@\s,:+;+-]+/;
8
8
 
9
9
  module.exports = {
10
10
  PHONE_REGEX,
@@ -120,15 +120,13 @@ class CachedModel extends CustomEntityDetectionModel {
120
120
 
121
121
  return {
122
122
  ...i,
123
- entities: expectedEntities
124
- ? this.nonOverlapping(ents, expectedEntities)
125
- : ents
123
+ entities: this.nonOverlapping(ents, expectedEntities || [], !expectedEntities)
126
124
  };
127
125
  });
128
126
 
129
127
  return [
130
128
  retIntents,
131
- expectedEntities ? this.nonOverlapping(retEntities, expectedEntities) : retEntities
129
+ this.nonOverlapping(retEntities, expectedEntities || [], !expectedEntities)
132
130
  ];
133
131
  }
134
132
 
@@ -287,9 +287,10 @@ class CustomEntityDetectionModel {
287
287
  *
288
288
  * @param {DetectedEntity[]} entities
289
289
  * @param {string[]} [expectedEntities]
290
+ * @param {boolean} [justDuplicates]
290
291
  * @returns {DetectedEntity[]}
291
292
  */
292
- nonOverlapping (entities, expectedEntities = []) {
293
+ nonOverlapping (entities, expectedEntities = [], justDuplicates = false) {
293
294
  // longest first
294
295
  entities.sort(({ start: a, end: b }, { start: z, end: y }) => {
295
296
  const aLen = b - a;
@@ -308,18 +309,22 @@ class CustomEntityDetectionModel {
308
309
 
309
310
  const isExpected = expectedEntities.includes(entity.entity);
310
311
 
311
- let overlapping = res
312
- .some((e) => e.start < entity.end && e.end > entity.start);
312
+ const duplicate = res
313
+ .find((e) => e.start === entity.start && e.end === entity.end);
313
314
 
314
- if (overlapping) {
315
- const duplicate = res
316
- .find((e) => e.start === entity.start && e.end === entity.end);
315
+ let overlapping = justDuplicates
316
+ ? !!duplicate
317
+ : res
318
+ .some((e) => e.start < entity.end && e.end > entity.start);
317
319
 
320
+ if (overlapping) {
318
321
  if (duplicate) {
319
322
  overlapping = !isExpected && expectedEntities.includes(duplicate.entity);
320
323
  }
321
324
 
322
- if (isExpected) {
325
+ if (duplicate && duplicate.entity === entity.entity) {
326
+ overlapping = true;
327
+ } else if (isExpected) {
323
328
  overlapping = false;
324
329
  res = res.filter((e) => {
325
330
  const isOverlapping = e.start < entity.end && e.end > entity.start;