@xapp/stentor-analyze 1.35.8 → 1.35.9
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.
|
@@ -12,28 +12,28 @@ function analyzeModelAndContent(value) {
|
|
|
12
12
|
warnings: [],
|
|
13
13
|
errors: []
|
|
14
14
|
};
|
|
15
|
-
const map = stentor_utils_1.toMap(value);
|
|
15
|
+
const map = (0, stentor_utils_1.toMap)(value);
|
|
16
16
|
// Look for any without utterance patterns or content.
|
|
17
17
|
Object.keys(map).forEach(intentId => {
|
|
18
18
|
/* tslint:disable:cyclomatic-complexity */
|
|
19
19
|
const intent = map[intentId];
|
|
20
20
|
const referenceName = `${intent.name ? intent.name + " / " : ""}${intentId}`;
|
|
21
|
-
if (stentor_guards_1.isGlobalHandler(intent)) {
|
|
21
|
+
if ((0, stentor_guards_1.isGlobalHandler)(intent)) {
|
|
22
22
|
results.info.push({
|
|
23
23
|
id: intentId,
|
|
24
24
|
message: `${referenceName} is a global handler (it has utterances and content).`
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
// Warning if it doesn't have any utterances or content
|
|
28
|
-
if (!stentor_utils_1.hasUtterances(intent) && !stentor_utils_1.hasContent(intent)) {
|
|
28
|
+
if (!(0, stentor_utils_1.hasUtterances)(intent) && !(0, stentor_utils_1.hasContent)(intent)) {
|
|
29
29
|
results.warnings.push({
|
|
30
30
|
id: intentId,
|
|
31
31
|
message: `${referenceName} has neither utterances or content.`
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
34
|
// Warning if it doesn't have content for itself
|
|
35
|
-
if (stentor_utils_1.hasContent(intent)) {
|
|
36
|
-
if (stentor_guards_1.isHandler(intent) && !intent.content[intent.intentId]) {
|
|
35
|
+
if ((0, stentor_utils_1.hasContent)(intent)) {
|
|
36
|
+
if ((0, stentor_guards_1.isHandler)(intent) && !intent.content[intent.intentId]) {
|
|
37
37
|
results.warnings.push({
|
|
38
38
|
id: intentId,
|
|
39
39
|
message: `${referenceName} does not have content for it's own ID`
|
|
@@ -41,28 +41,28 @@ function analyzeModelAndContent(value) {
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
// Warning if it forwards to itself
|
|
44
|
-
if (stentor_utils_1.forwardsTo(intent, intent.intentId)) {
|
|
44
|
+
if ((0, stentor_utils_1.forwardsTo)(intent, intent.intentId)) {
|
|
45
45
|
results.warnings.push({
|
|
46
46
|
id: intentId,
|
|
47
47
|
message: `${referenceName} forwards to itself.`
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
// Info that is has an open ended response
|
|
51
|
-
if (stentor_utils_1.handles(intent, OPEN_ENDED_RESPONSE, stentor_utils_1.HandledIn.Forward)) {
|
|
51
|
+
if ((0, stentor_utils_1.handles)(intent, OPEN_ENDED_RESPONSE, stentor_utils_1.HandledIn.Forward)) {
|
|
52
52
|
results.info.push({
|
|
53
53
|
id: intentId,
|
|
54
54
|
message: `${intentId} handles an open-ended forward.`
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
// Warning if it has forwards and no reprompt
|
|
58
|
-
if (stentor_utils_1.hasForwards(intent) && !stentor_utils_1.hasReprompt(intent)) {
|
|
58
|
+
if ((0, stentor_utils_1.hasForwards)(intent) && !(0, stentor_utils_1.hasReprompt)(intent)) {
|
|
59
59
|
results.errors.push({
|
|
60
60
|
id: intentId,
|
|
61
61
|
message: `${referenceName} has forwards but no reprompts.`
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
// Warning if it has reprompt but no forwards
|
|
65
|
-
if (!stentor_utils_1.hasForwards(intent) && stentor_utils_1.hasReprompt(intent)) {
|
|
65
|
+
if (!(0, stentor_utils_1.hasForwards)(intent) && (0, stentor_utils_1.hasReprompt)(intent)) {
|
|
66
66
|
results.warnings.push({
|
|
67
67
|
id: intentId,
|
|
68
68
|
message: `${referenceName} has a reprompt but no forwards`
|
|
@@ -76,20 +76,20 @@ function analyzeModelAndContent(value) {
|
|
|
76
76
|
})
|
|
77
77
|
} */
|
|
78
78
|
// Error Contains improper comments
|
|
79
|
-
if (stentor_utils_1.responsesContain(intent, "<! --")) {
|
|
79
|
+
if ((0, stentor_utils_1.responsesContain)(intent, "<! --")) {
|
|
80
80
|
results.errors.push({
|
|
81
81
|
id: intentId,
|
|
82
82
|
message: `${referenceName} contains improperly formated comments (<! -- instead of <!--) in the response.`
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
// Error contains improper comments <!—
|
|
86
|
-
if (stentor_utils_1.responsesContain(intent, "<!—")) {
|
|
86
|
+
if ((0, stentor_utils_1.responsesContain)(intent, "<!—")) {
|
|
87
87
|
results.errors.push({
|
|
88
88
|
id: intentId,
|
|
89
89
|
message: `${referenceName} contains improperly formated comments (<!— instead of <!--) in the response.`
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
const containsInvalid = stentor_utils_1.containsInvalidResponse(intent);
|
|
92
|
+
const containsInvalid = (0, stentor_utils_1.containsInvalidResponse)(intent);
|
|
93
93
|
if (containsInvalid.error) {
|
|
94
94
|
results.errors.push({
|
|
95
95
|
id: intentId,
|
|
@@ -97,8 +97,8 @@ function analyzeModelAndContent(value) {
|
|
|
97
97
|
});
|
|
98
98
|
}
|
|
99
99
|
// Warning, has only one forward that isn't the open ended key
|
|
100
|
-
if (stentor_utils_1.hasForwards(intent)) {
|
|
101
|
-
if (stentor_guards_1.isHandler(intent)) {
|
|
100
|
+
if ((0, stentor_utils_1.hasForwards)(intent)) {
|
|
101
|
+
if ((0, stentor_guards_1.isHandler)(intent)) {
|
|
102
102
|
if (Object.keys(intent.forward).length === 1) {
|
|
103
103
|
const key = Object.keys(intent.forward)[0];
|
|
104
104
|
const paths = intent.forward[key];
|
|
@@ -125,16 +125,16 @@ exports.analyzeModelAndContent = analyzeModelAndContent;
|
|
|
125
125
|
function printResult(results) {
|
|
126
126
|
// Info
|
|
127
127
|
results.info.forEach(result => {
|
|
128
|
-
stentor_logger_1.log().info(result.message);
|
|
128
|
+
(0, stentor_logger_1.log)().info(result.message);
|
|
129
129
|
});
|
|
130
130
|
// Warning
|
|
131
131
|
results.warnings.forEach(result => {
|
|
132
|
-
stentor_logger_1.log().warn(result.message);
|
|
132
|
+
(0, stentor_logger_1.log)().warn(result.message);
|
|
133
133
|
});
|
|
134
134
|
// Errors
|
|
135
135
|
// Info
|
|
136
136
|
results.errors.forEach(result => {
|
|
137
|
-
stentor_logger_1.log().error(result.message);
|
|
137
|
+
(0, stentor_logger_1.log)().error(result.message);
|
|
138
138
|
});
|
|
139
139
|
}
|
|
140
140
|
exports.printResult = printResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzeModelAndContent.js","sourceRoot":"","sources":["../src/analyzeModelAndContent.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,mDAAqC;AACrC,mDAGwB;AAExB,iDAYuB;AAEvB,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,qBAAK,
|
|
1
|
+
{"version":3,"file":"analyzeModelAndContent.js","sourceRoot":"","sources":["../src/analyzeModelAndContent.ts"],"names":[],"mappings":";;;AAAA,oCAAoC;AACpC,mDAAqC;AACrC,mDAGwB;AAExB,iDAYuB;AAEvB,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,IAAA,qBAAK,EAAC,KAAK,CAAC,CAAC;IAEpC,sDAAsD;IACtD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,C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AC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC9B,IAAA,oBAAG,GAAE,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,SAAS;IACT,OAAO;IACP,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QAC5B,IAAA,oBAAG,GAAE,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACP,CAAC;AAhBD,kCAgBC"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "restricted"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.35.
|
|
7
|
+
"version": "1.35.9",
|
|
8
8
|
"description": "Intent & Handler analysis for :mega: stentor",
|
|
9
9
|
"types": "lib/index",
|
|
10
10
|
"main": "lib/index",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"stentor-models": "1.45.0",
|
|
27
27
|
"stentor-utils": "1.45.0",
|
|
28
28
|
"ts-node": "9.1.1",
|
|
29
|
-
"typescript": "4.
|
|
29
|
+
"typescript": "4.4.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"stentor-guards": "1.x",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"clean": "rm -rf ./lib/*",
|
|
41
41
|
"test": "exit 0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "818b4f076937a3d2a126c5a10941638af94b9533"
|
|
44
44
|
}
|