@xapp/stentor-validation 1.18.114 → 1.18.125

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/CHANGELOG.md CHANGED
@@ -3,6 +3,39 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.18.125](https://github.com/XappMedia/stentor-core/compare/v1.18.124...v1.18.125) (2020-04-01)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **deps:** update stentor to v1.24.7 ([4c8285d](https://github.com/XappMedia/stentor-core/commit/4c8285d6d68e0eebd4a4349270b438184facbad1))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.18.122](https://github.com/XappMedia/stentor-core/compare/v1.18.121...v1.18.122) (2020-03-31)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **deps:** update stentor ([#1621](https://github.com/XappMedia/stentor-core/issues/1621)) ([609fc99](https://github.com/XappMedia/stentor-core/commit/609fc991cc70516a9fa3c2432992012c3d584773))
23
+
24
+
25
+
26
+
27
+
28
+ ## [1.18.115](https://github.com/XappMedia/stentor-core/compare/v1.18.114...v1.18.115) (2020-03-23)
29
+
30
+
31
+ ### Bug Fixes
32
+
33
+ * Last decoupling, move Analyze code to it's own package ([#1615](https://github.com/XappMedia/stentor-core/issues/1615)) ([733fe43](https://github.com/XappMedia/stentor-core/commit/733fe433e568dc7e63a0e9df0ffc7c59d7b91654))
34
+
35
+
36
+
37
+
38
+
6
39
  ## [1.18.114](https://github.com/XappMedia/stentor-core/compare/v1.18.113...v1.18.114) (2020-03-22)
7
40
 
8
41
 
package/lib/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  /*! Copyright (c) 2019, XAPPmedia */
2
- export * from "./analyzeModelAndContent";
3
2
  export * from "./AppValidator";
4
3
  export * from "./HandlerValidator";
5
4
  export * from "./LogicValidator";
package/lib/index.js CHANGED
@@ -4,7 +4,6 @@ function __export(m) {
4
4
  }
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  /*! Copyright (c) 2019, XAPPmedia */
7
- __export(require("./analyzeModelAndContent"));
8
7
  __export(require("./AppValidator"));
9
8
  __export(require("./HandlerValidator"));
10
9
  __export(require("./LogicValidator"));
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,oCAAoC;AACpC,8CAAyC;AACzC,oCAA+B;AAC/B,wCAAmC;AACnC,sCAAiC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,oCAAoC;AACpC,oCAA+B;AAC/B,wCAAmC;AACnC,sCAAiC"}
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "publishConfig": {
5
5
  "access": "restricted"
6
6
  },
7
- "version": "1.18.114",
7
+ "version": "1.18.125",
8
8
  "description": "Model validation for Stentor",
9
9
  "types": "lib/index",
10
10
  "main": "lib/index",
@@ -20,16 +20,15 @@
20
20
  "@xapp/config": "0.2.3",
21
21
  "chai": "4.2.0",
22
22
  "mocha": "7.1.1",
23
- "stentor-models": "1.23.37",
23
+ "stentor-models": "1.24.7",
24
24
  "ts-node": "8.7.0",
25
25
  "typescript": "3.8.3"
26
26
  },
27
27
  "dependencies": {
28
28
  "lakmus": "0.3.0",
29
- "stentor-guards": "1.23.37",
30
- "stentor-handler": "1.23.37",
31
- "stentor-logger": "1.23.37",
32
- "stentor-utils": "1.23.37"
29
+ "stentor-guards": "1.24.7",
30
+ "stentor-logger": "1.24.7",
31
+ "stentor-utils": "1.24.7"
33
32
  },
34
33
  "peerDependencies": {
35
34
  "stentor-models": "1.x"
@@ -39,5 +38,5 @@
39
38
  "clean": "rm -rf ./lib/*",
40
39
  "test": "mocha --recursive -r ts-node/register \"./src/**/*.test.ts\""
41
40
  },
42
- "gitHead": "2d5c23f77be34275c42316e564ebc64c7e6e2a4f"
41
+ "gitHead": "98e0795637e99a72661b5d039f850d119dcd593c"
43
42
  }
@@ -1,12 +0,0 @@
1
- import { Handler, Intent } from "stentor-models";
2
- export interface AnalyzeModelAndContentResult {
3
- info: AnalysisResult[];
4
- warnings: AnalysisResult[];
5
- errors: AnalysisResult[];
6
- }
7
- export interface AnalysisResult {
8
- id: string;
9
- message: string;
10
- }
11
- export declare function analyzeModelAndContent(value: (Intent | Handler)[]): AnalyzeModelAndContentResult;
12
- export declare function printResult(results: AnalyzeModelAndContentResult): void;
@@ -1,140 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /*! Copyright (c) 2019, XAPPmedia */
4
- const stentor_logger_1 = require("stentor-logger");
5
- const stentor_guards_1 = require("stentor-guards");
6
- const stentor_handler_1 = require("stentor-handler");
7
- const OPEN_ENDED_RESPONSE = "^((?!(StopIntent|HelpIntent|CancelIntent)).)*$";
8
- function analyzeModelAndContent(value) {
9
- const results = {
10
- info: [],
11
- warnings: [],
12
- errors: []
13
- };
14
- const map = stentor_handler_1.toMap(value);
15
- // Look for any without utterance patterns or content.
16
- Object.keys(map).forEach(intentId => {
17
- /* tslint:disable:cyclomatic-complexity */
18
- const intent = map[intentId];
19
- const referenceName = `${intent.name ? intent.name + " / " : ""}${intentId}`;
20
- if (stentor_guards_1.isGlobalHandler(intent)) {
21
- results.info.push({
22
- id: intentId,
23
- message: `${referenceName} is a global handler (it has utterances and content).`
24
- });
25
- }
26
- // Warning if it doesn't have any utterances or content
27
- if (!stentor_handler_1.hasUtterances(intent) && !stentor_handler_1.hasContent(intent)) {
28
- results.warnings.push({
29
- id: intentId,
30
- message: `${referenceName} has neither utterances or content.`
31
- });
32
- }
33
- // Warning if it doesn't have content for itself
34
- if (stentor_handler_1.hasContent(intent)) {
35
- if (stentor_guards_1.isHandler(intent) && !intent.content[intent.intentId]) {
36
- results.warnings.push({
37
- id: intentId,
38
- message: `${referenceName} does not have content for it's own ID`
39
- });
40
- }
41
- }
42
- // Warning if it forwards to itself
43
- if (stentor_handler_1.forwardsTo(intent, intent.intentId)) {
44
- results.warnings.push({
45
- id: intentId,
46
- message: `${referenceName} forwards to itself.`
47
- });
48
- }
49
- // Info that is has an open ended response
50
- if (stentor_handler_1.handles(intent, OPEN_ENDED_RESPONSE, stentor_handler_1.HandledIn.Forward)) {
51
- results.info.push({
52
- id: intentId,
53
- message: `${intentId} handles an open-ended forward.`
54
- });
55
- }
56
- // Warning if it has forwards and no reprompt
57
- if (stentor_handler_1.hasForwards(intent) && !stentor_handler_1.hasReprompt(intent)) {
58
- results.errors.push({
59
- id: intentId,
60
- message: `${referenceName} has forwards but no reprompts.`
61
- });
62
- }
63
- // Warning if it has reprompt but no forwards
64
- if (!stentor_handler_1.hasForwards(intent) && stentor_handler_1.hasReprompt(intent)) {
65
- results.warnings.push({
66
- id: intentId,
67
- message: `${referenceName} has a reprompt but no forwards`
68
- });
69
- }
70
- // Error if content contains . “Help!” (bad characters) ". “Help!” "
71
- /* if (responsesContain(intent, "“") || responsesContain(intent, "”")) {
72
- results.errors.push({
73
- id: intentId,
74
- message: `${referenceName} contains illegal characters “” in the response.`
75
- })
76
- } */
77
- // Error Contains improper comments
78
- if (stentor_handler_1.responsesContain(intent, "<! --")) {
79
- results.errors.push({
80
- id: intentId,
81
- message: `${referenceName} contains improperly formated comments (<! -- instead of <!--) in the response.`
82
- });
83
- }
84
- // Error contains improper comments <!—
85
- if (stentor_handler_1.responsesContain(intent, "<!—")) {
86
- results.errors.push({
87
- id: intentId,
88
- message: `${referenceName} contains improperly formated comments (<!— instead of <!--) in the response.`
89
- });
90
- }
91
- const containsInvalid = stentor_handler_1.containsInvalidResponse(intent);
92
- if (containsInvalid.error) {
93
- results.errors.push({
94
- id: intentId,
95
- message: `${referenceName} contains invalid XML in response ${containsInvalid.response}`
96
- });
97
- }
98
- // Warning, has only one forward that isn't the open ended key
99
- if (stentor_handler_1.hasForwards(intent)) {
100
- if (stentor_guards_1.isHandler(intent)) {
101
- if (Object.keys(intent.forward).length === 1) {
102
- const key = Object.keys(intent.forward)[0];
103
- const paths = intent.forward[key];
104
- // We need to check for multiple paths
105
- const hasMultiplePaths = paths.length > 1;
106
- // Or if it is the open ended request.
107
- const isOpenEnded = OPEN_ENDED_RESPONSE === key;
108
- // If it is
109
- // !true && !true
110
- if (!hasMultiplePaths && !isOpenEnded) {
111
- results.warnings.push({
112
- id: intentId,
113
- message: `${referenceName} has only one forward and it is not the open ended forward or has multiple paths on the forward`
114
- });
115
- }
116
- }
117
- }
118
- }
119
- /* tslint:enable:cyclomatic-complexity */
120
- });
121
- return results;
122
- }
123
- exports.analyzeModelAndContent = analyzeModelAndContent;
124
- function printResult(results) {
125
- // Info
126
- results.info.forEach(result => {
127
- stentor_logger_1.log().info(result.message);
128
- });
129
- // Warning
130
- results.warnings.forEach(result => {
131
- stentor_logger_1.log().warn(result.message);
132
- });
133
- // Errors
134
- // Info
135
- results.errors.forEach(result => {
136
- stentor_logger_1.log().error(result.message);
137
- });
138
- }
139
- exports.printResult = printResult;
140
- //# sourceMappingURL=analyzeModelAndContent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"analyzeModelAndContent.js","sourceRoot":"","sources":["../src/analyzeModelAndContent.ts"],"names":[],"mappings":";;AAAA,oCAAoC;AACpC,mDAAqC;AACrC,mDAGwB;AACxB,qDAYyB;AAGzB,MAAM,mBAAmB,GAAG,gDAAgD,CAAC;AAa7E,SAAgB,sBAAsB,CAAC,KAA2B;IAC9D,MAAM,OAAO,GAAiC;QAC1C,IAAI,EAAE,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;KACb,CAAC;IAEF,MAAM,GAAG,GAAc,uBAAK,CAAC,KAAK,CAAC,CAAC;IAEpC,sDAAsD;IACtD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAChC,0CAA0C;QAC1C,MAAM,MAAM,GAAG,GAAG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