chatbot-nc 1.0.58 → 1.0.59
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/dist/cjs/utils/common.d.ts +2 -2
- package/dist/cjs/utils/common.js +13 -4
- package/dist/cjs/utils/common.js.map +1 -1
- package/dist/cjs/utils/index.d.ts +12 -12
- package/dist/cjs/utils/intent.d.ts +10 -10
- package/dist/cjs/utils/intent.js +33 -26
- package/dist/cjs/utils/intent.js.map +1 -1
- package/dist/esm/utils/common.d.ts +2 -2
- package/dist/esm/utils/common.js +13 -4
- package/dist/esm/utils/common.js.map +1 -1
- package/dist/esm/utils/index.d.ts +12 -12
- package/dist/esm/utils/intent.d.ts +10 -10
- package/dist/esm/utils/intent.js +33 -26
- package/dist/esm/utils/intent.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/utils/common.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.Common = void 0;
|
|
4
13
|
/**
|
|
@@ -7,7 +16,7 @@ exports.Common = void 0;
|
|
|
7
16
|
* @param replacements
|
|
8
17
|
* @returns parsed object
|
|
9
18
|
*/
|
|
10
|
-
const parseText = (stringWithPlaceholders, replacements) => {
|
|
19
|
+
const parseText = (stringWithPlaceholders, replacements) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
20
|
try {
|
|
12
21
|
if (typeof stringWithPlaceholders === 'object') {
|
|
13
22
|
stringWithPlaceholders = JSON.stringify(stringWithPlaceholders);
|
|
@@ -22,13 +31,13 @@ const parseText = (stringWithPlaceholders, replacements) => {
|
|
|
22
31
|
catch (error) {
|
|
23
32
|
throw error;
|
|
24
33
|
}
|
|
25
|
-
};
|
|
34
|
+
});
|
|
26
35
|
/**
|
|
27
36
|
*
|
|
28
37
|
* @param text
|
|
29
38
|
* @returns
|
|
30
39
|
*/
|
|
31
|
-
const maskData = (text) => {
|
|
40
|
+
const maskData = (text) => __awaiter(void 0, void 0, void 0, function* () {
|
|
32
41
|
try {
|
|
33
42
|
if (typeof text === 'number') {
|
|
34
43
|
//Add Logic to mask
|
|
@@ -45,6 +54,6 @@ const maskData = (text) => {
|
|
|
45
54
|
catch (error) {
|
|
46
55
|
throw error;
|
|
47
56
|
}
|
|
48
|
-
};
|
|
57
|
+
});
|
|
49
58
|
exports.Common = { parseText, maskData };
|
|
50
59
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../utils/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../utils/common.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAO,sBAA2B,EAAE,YAAiB,EAAE,EAAE;IAC1E,IAAI;QACH,IAAI,OAAO,sBAAsB,KAAK,QAAQ,EAAE;YAC/C,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;SAChE;QACD,IAAI,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAgB,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC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C,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,GAAE,CAAC,EAAC,GAAG,CAAC,CAAC;;gBAE9H,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,EAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAC,GAAG,CAAC,CAAC;SACzG;QACD,OAAO,IAAI,CAAC;KACZ;IAAC,OAAO,KAAK,EAAE;QACf,MAAM,KAAK,CAAC;KACZ;AACF,CAAC,CAAA,CAAA;AAEY,QAAA,MAAM,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export declare const Utils: {
|
|
2
2
|
Intents: {
|
|
3
|
-
getSessionAttributes: (intentRequest: any) => any
|
|
4
|
-
getSessionAttributeValue: (intentRequest: any, name: string) => any
|
|
5
|
-
getSlots: (intentRequest: any) => any
|
|
6
|
-
getSlotValue: (intentRequest: any, slotName: string) => any
|
|
7
|
-
getConfidenceScore: (intentRequest: any) => any
|
|
8
|
-
getDateSlotValue: (intentRequest: any, slotName: string) => string
|
|
9
|
-
getTimeSlotValue: (intentRequest: any, slotName: string) => string | null
|
|
10
|
-
getProposedSlot: (intentRequest: any) => any
|
|
11
|
-
getRequestAttributes: (intentRequest: any) => any
|
|
12
|
-
getOrginalSlotValue: (intentRequest: any, slotName: string) => any
|
|
3
|
+
getSessionAttributes: (intentRequest: any) => Promise<any>;
|
|
4
|
+
getSessionAttributeValue: (intentRequest: any, name: string) => Promise<any>;
|
|
5
|
+
getSlots: (intentRequest: any) => Promise<any>;
|
|
6
|
+
getSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
7
|
+
getConfidenceScore: (intentRequest: any) => Promise<any>;
|
|
8
|
+
getDateSlotValue: (intentRequest: any, slotName: string) => Promise<string>;
|
|
9
|
+
getTimeSlotValue: (intentRequest: any, slotName: string) => Promise<string | null>;
|
|
10
|
+
getProposedSlot: (intentRequest: any) => Promise<any>;
|
|
11
|
+
getRequestAttributes: (intentRequest: any) => Promise<any>;
|
|
12
|
+
getOrginalSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
13
13
|
};
|
|
14
14
|
Common: {
|
|
15
|
-
parseText: (stringWithPlaceholders: any, replacements: any) => any
|
|
16
|
-
maskData: (text: any) => any
|
|
15
|
+
parseText: (stringWithPlaceholders: any, replacements: any) => Promise<any>;
|
|
16
|
+
maskData: (text: any) => Promise<any>;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const Intents: {
|
|
2
|
-
getSessionAttributes: (intentRequest: any) => any
|
|
3
|
-
getSessionAttributeValue: (intentRequest: any, name: string) => any
|
|
4
|
-
getSlots: (intentRequest: any) => any
|
|
5
|
-
getSlotValue: (intentRequest: any, slotName: string) => any
|
|
6
|
-
getConfidenceScore: (intentRequest: any) => any
|
|
7
|
-
getDateSlotValue: (intentRequest: any, slotName: string) => string
|
|
8
|
-
getTimeSlotValue: (intentRequest: any, slotName: string) => string | null
|
|
9
|
-
getProposedSlot: (intentRequest: any) => any
|
|
10
|
-
getRequestAttributes: (intentRequest: any) => any
|
|
11
|
-
getOrginalSlotValue: (intentRequest: any, slotName: string) => any
|
|
2
|
+
getSessionAttributes: (intentRequest: any) => Promise<any>;
|
|
3
|
+
getSessionAttributeValue: (intentRequest: any, name: string) => Promise<any>;
|
|
4
|
+
getSlots: (intentRequest: any) => Promise<any>;
|
|
5
|
+
getSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
6
|
+
getConfidenceScore: (intentRequest: any) => Promise<any>;
|
|
7
|
+
getDateSlotValue: (intentRequest: any, slotName: string) => Promise<string>;
|
|
8
|
+
getTimeSlotValue: (intentRequest: any, slotName: string) => Promise<string | null>;
|
|
9
|
+
getProposedSlot: (intentRequest: any) => Promise<any>;
|
|
10
|
+
getRequestAttributes: (intentRequest: any) => Promise<any>;
|
|
11
|
+
getOrginalSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
12
12
|
};
|
package/dist/cjs/utils/intent.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.Intents = void 0;
|
|
4
13
|
/**
|
|
@@ -6,7 +15,7 @@ exports.Intents = void 0;
|
|
|
6
15
|
* @param intentRequest lex event Request
|
|
7
16
|
* @returns list of slots
|
|
8
17
|
*/
|
|
9
|
-
const getSlots = (intentRequest) => {
|
|
18
|
+
const getSlots = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
10
19
|
try {
|
|
11
20
|
return intentRequest['sessionState']['intent']['slots'];
|
|
12
21
|
}
|
|
@@ -14,17 +23,17 @@ const getSlots = (intentRequest) => {
|
|
|
14
23
|
console.log("Error in Get Slots", error);
|
|
15
24
|
throw error;
|
|
16
25
|
}
|
|
17
|
-
};
|
|
26
|
+
});
|
|
18
27
|
/**
|
|
19
28
|
*
|
|
20
29
|
* @param intentRequest lex event request
|
|
21
30
|
* @param slotName slot name
|
|
22
31
|
* @returns slot resolved value
|
|
23
32
|
*/
|
|
24
|
-
const getSlotValue = (intentRequest, slotName) => {
|
|
33
|
+
const getSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
25
34
|
try {
|
|
26
35
|
let slots;
|
|
27
|
-
slots = getSlots(intentRequest);
|
|
36
|
+
slots = yield getSlots(intentRequest);
|
|
28
37
|
if (slots != null && slots[slotName] != null) {
|
|
29
38
|
return slots[slotName]['value']['interpretedValue'] || slots[slotName]['value']['resolvedValues'][0] || null;
|
|
30
39
|
}
|
|
@@ -36,17 +45,17 @@ const getSlotValue = (intentRequest, slotName) => {
|
|
|
36
45
|
console.log("Error in Get Slot Value", error);
|
|
37
46
|
throw error;
|
|
38
47
|
}
|
|
39
|
-
};
|
|
48
|
+
});
|
|
40
49
|
/**
|
|
41
50
|
*
|
|
42
51
|
* @param intentRequest lex event request
|
|
43
52
|
* @param slotName slot name
|
|
44
53
|
* @returns slot original value
|
|
45
54
|
*/
|
|
46
|
-
const getOrginalSlotValue = (intentRequest, slotName) => {
|
|
55
|
+
const getOrginalSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
47
56
|
try {
|
|
48
57
|
let slots;
|
|
49
|
-
slots = getSlots(intentRequest);
|
|
58
|
+
slots = yield getSlots(intentRequest);
|
|
50
59
|
if (slots != null && slots[slotName] != null) {
|
|
51
60
|
return slots[slotName]['value']['originalValue'] || slots[slotName]['value']['originalValue'] || null;
|
|
52
61
|
}
|
|
@@ -58,18 +67,16 @@ const getOrginalSlotValue = (intentRequest, slotName) => {
|
|
|
58
67
|
console.log("Error in Get Slot Value", error);
|
|
59
68
|
throw error;
|
|
60
69
|
}
|
|
61
|
-
};
|
|
70
|
+
});
|
|
62
71
|
/**
|
|
63
72
|
*
|
|
64
73
|
* @param intentRequest lex event
|
|
65
74
|
* @returns session attributes object
|
|
66
75
|
*/
|
|
67
|
-
const getSessionAttributes = (intentRequest) => {
|
|
76
|
+
const getSessionAttributes = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
68
77
|
try {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if (sessionState['sessionAttributes'] != null) {
|
|
72
|
-
return sessionState['sessionAttributes'];
|
|
78
|
+
if (intentRequest['sessionState']['sessionAttributes'] != null) {
|
|
79
|
+
return intentRequest['sessionState']['sessionAttributes'];
|
|
73
80
|
}
|
|
74
81
|
return {};
|
|
75
82
|
}
|
|
@@ -77,14 +84,14 @@ const getSessionAttributes = (intentRequest) => {
|
|
|
77
84
|
console.log("Error in Get Session Attributes", error);
|
|
78
85
|
throw error;
|
|
79
86
|
}
|
|
80
|
-
};
|
|
87
|
+
});
|
|
81
88
|
/**
|
|
82
89
|
*
|
|
83
90
|
* @param intentRequest lex event
|
|
84
91
|
* @param name attribute name
|
|
85
92
|
* @returns session attribute value
|
|
86
93
|
*/
|
|
87
|
-
const getSessionAttributeValue = (intentRequest, name) => {
|
|
94
|
+
const getSessionAttributeValue = (intentRequest, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
88
95
|
try {
|
|
89
96
|
let sessionState;
|
|
90
97
|
sessionState = intentRequest['sessionState'];
|
|
@@ -100,14 +107,14 @@ const getSessionAttributeValue = (intentRequest, name) => {
|
|
|
100
107
|
console.log("Error in Get Session Attribute Value", error);
|
|
101
108
|
throw error;
|
|
102
109
|
}
|
|
103
|
-
};
|
|
110
|
+
});
|
|
104
111
|
/**
|
|
105
112
|
*
|
|
106
113
|
* @param intentRequest
|
|
107
114
|
* @param slotName
|
|
108
115
|
* @returns
|
|
109
116
|
*/
|
|
110
|
-
const getDateSlotValue = (intentRequest, slotName) => {
|
|
117
|
+
const getDateSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
111
118
|
try {
|
|
112
119
|
let selectDate = null, date = getSlotValue(intentRequest, slotName);
|
|
113
120
|
let month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
@@ -123,14 +130,14 @@ const getDateSlotValue = (intentRequest, slotName) => {
|
|
|
123
130
|
console.log("Error in Get Date Slot Value", error);
|
|
124
131
|
throw error;
|
|
125
132
|
}
|
|
126
|
-
};
|
|
133
|
+
});
|
|
127
134
|
/**
|
|
128
135
|
*
|
|
129
136
|
* @param intentRequest
|
|
130
137
|
* @param slotName
|
|
131
138
|
* @returns
|
|
132
139
|
*/
|
|
133
|
-
const getTimeSlotValue = (intentRequest, slotName) => {
|
|
140
|
+
const getTimeSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
134
141
|
try {
|
|
135
142
|
let selectTime = null, time = getSlotValue(intentRequest, slotName);
|
|
136
143
|
try {
|
|
@@ -150,13 +157,13 @@ const getTimeSlotValue = (intentRequest, slotName) => {
|
|
|
150
157
|
console.log("Error in Get Date Slot Value", error);
|
|
151
158
|
throw error;
|
|
152
159
|
}
|
|
153
|
-
};
|
|
160
|
+
});
|
|
154
161
|
/**
|
|
155
162
|
*
|
|
156
163
|
* @param intentRequest
|
|
157
164
|
* @returns
|
|
158
165
|
*/
|
|
159
|
-
const getProposedSlot = (intentRequest) => {
|
|
166
|
+
const getProposedSlot = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
160
167
|
try {
|
|
161
168
|
if (intentRequest.proposedNextState) {
|
|
162
169
|
return intentRequest.proposedNextState.dialogAction.slotToElicit;
|
|
@@ -169,13 +176,13 @@ const getProposedSlot = (intentRequest) => {
|
|
|
169
176
|
console.log("Error in Get Proposed Slot", error);
|
|
170
177
|
throw error;
|
|
171
178
|
}
|
|
172
|
-
};
|
|
179
|
+
});
|
|
173
180
|
/**
|
|
174
181
|
*
|
|
175
182
|
* @param intentRequest
|
|
176
183
|
* @returns
|
|
177
184
|
*/
|
|
178
|
-
const getRequestAttributes = (intentRequest) => {
|
|
185
|
+
const getRequestAttributes = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
179
186
|
try {
|
|
180
187
|
if (intentRequest.requestAttributes) {
|
|
181
188
|
return intentRequest.requestAttributes;
|
|
@@ -188,13 +195,13 @@ const getRequestAttributes = (intentRequest) => {
|
|
|
188
195
|
console.log("Error in Get Requested Attributes", error);
|
|
189
196
|
throw error;
|
|
190
197
|
}
|
|
191
|
-
};
|
|
198
|
+
});
|
|
192
199
|
/**
|
|
193
200
|
*
|
|
194
201
|
* @param intentRequest
|
|
195
202
|
* @returns
|
|
196
203
|
*/
|
|
197
|
-
const getConfidenceScore = (intentRequest) => {
|
|
204
|
+
const getConfidenceScore = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
198
205
|
try {
|
|
199
206
|
return intentRequest['interpretations'][0]['nluConfidence'];
|
|
200
207
|
}
|
|
@@ -202,6 +209,6 @@ const getConfidenceScore = (intentRequest) => {
|
|
|
202
209
|
console.log("Error in Get Confidence Score", error);
|
|
203
210
|
throw error;
|
|
204
211
|
}
|
|
205
|
-
};
|
|
212
|
+
});
|
|
206
213
|
exports.Intents = { getSessionAttributes, getSessionAttributeValue, getSlots, getSlotValue, getConfidenceScore, getDateSlotValue, getTimeSlotValue, getProposedSlot, getRequestAttributes, getOrginalSlotValue };
|
|
207
214
|
//# sourceMappingURL=intent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../utils/intent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../utils/intent.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAO,aAAkB,EAAE,EAAE;IAC1C,IAAI;QACA,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QACnD,MAAM,KAAK,CAAC;KACf;AACL,CAAC,CAAA,CAAC;AAEW,QAAA,OAAO,GAAG,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/esm/utils/common.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
*
|
|
3
12
|
* @param stringWithPlaceholders
|
|
4
13
|
* @param replacements
|
|
5
14
|
* @returns parsed object
|
|
6
15
|
*/
|
|
7
|
-
const parseText = (stringWithPlaceholders, replacements) => {
|
|
16
|
+
const parseText = (stringWithPlaceholders, replacements) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8
17
|
try {
|
|
9
18
|
if (typeof stringWithPlaceholders === 'object') {
|
|
10
19
|
stringWithPlaceholders = JSON.stringify(stringWithPlaceholders);
|
|
@@ -19,13 +28,13 @@ const parseText = (stringWithPlaceholders, replacements) => {
|
|
|
19
28
|
catch (error) {
|
|
20
29
|
throw error;
|
|
21
30
|
}
|
|
22
|
-
};
|
|
31
|
+
});
|
|
23
32
|
/**
|
|
24
33
|
*
|
|
25
34
|
* @param text
|
|
26
35
|
* @returns
|
|
27
36
|
*/
|
|
28
|
-
const maskData = (text) => {
|
|
37
|
+
const maskData = (text) => __awaiter(void 0, void 0, void 0, function* () {
|
|
29
38
|
try {
|
|
30
39
|
if (typeof text === 'number') {
|
|
31
40
|
//Add Logic to mask
|
|
@@ -42,6 +51,6 @@ const maskData = (text) => {
|
|
|
42
51
|
catch (error) {
|
|
43
52
|
throw error;
|
|
44
53
|
}
|
|
45
|
-
};
|
|
54
|
+
});
|
|
46
55
|
export const Common = { parseText, maskData };
|
|
47
56
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../utils/common.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,SAAS,GAAG,
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../utils/common.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAO,sBAA2B,EAAE,YAAiB,EAAE,EAAE;IAC1E,IAAI;QACH,IAAI,OAAO,sBAAsB,KAAK,QAAQ,EAAE;YAC/C,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;SAChE;QACD,IAAI,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAgB,EAAE,EAAE,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC;QAC3J,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,WAAgB,EAAE,EAAE,CAAE,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,QAAQ,EAAC,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAA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,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAC,GAAG,CAAC,CAAC;SACzG;QACD,OAAO,IAAI,CAAC;KACZ;IAAC,OAAO,KAAK,EAAE;QACf,MAAM,KAAK,CAAC;KACZ;AACF,CAAC,CAAA,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export declare const Utils: {
|
|
2
2
|
Intents: {
|
|
3
|
-
getSessionAttributes: (intentRequest: any) => any
|
|
4
|
-
getSessionAttributeValue: (intentRequest: any, name: string) => any
|
|
5
|
-
getSlots: (intentRequest: any) => any
|
|
6
|
-
getSlotValue: (intentRequest: any, slotName: string) => any
|
|
7
|
-
getConfidenceScore: (intentRequest: any) => any
|
|
8
|
-
getDateSlotValue: (intentRequest: any, slotName: string) => string
|
|
9
|
-
getTimeSlotValue: (intentRequest: any, slotName: string) => string | null
|
|
10
|
-
getProposedSlot: (intentRequest: any) => any
|
|
11
|
-
getRequestAttributes: (intentRequest: any) => any
|
|
12
|
-
getOrginalSlotValue: (intentRequest: any, slotName: string) => any
|
|
3
|
+
getSessionAttributes: (intentRequest: any) => Promise<any>;
|
|
4
|
+
getSessionAttributeValue: (intentRequest: any, name: string) => Promise<any>;
|
|
5
|
+
getSlots: (intentRequest: any) => Promise<any>;
|
|
6
|
+
getSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
7
|
+
getConfidenceScore: (intentRequest: any) => Promise<any>;
|
|
8
|
+
getDateSlotValue: (intentRequest: any, slotName: string) => Promise<string>;
|
|
9
|
+
getTimeSlotValue: (intentRequest: any, slotName: string) => Promise<string | null>;
|
|
10
|
+
getProposedSlot: (intentRequest: any) => Promise<any>;
|
|
11
|
+
getRequestAttributes: (intentRequest: any) => Promise<any>;
|
|
12
|
+
getOrginalSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
13
13
|
};
|
|
14
14
|
Common: {
|
|
15
|
-
parseText: (stringWithPlaceholders: any, replacements: any) => any
|
|
16
|
-
maskData: (text: any) => any
|
|
15
|
+
parseText: (stringWithPlaceholders: any, replacements: any) => Promise<any>;
|
|
16
|
+
maskData: (text: any) => Promise<any>;
|
|
17
17
|
};
|
|
18
18
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export declare const Intents: {
|
|
2
|
-
getSessionAttributes: (intentRequest: any) => any
|
|
3
|
-
getSessionAttributeValue: (intentRequest: any, name: string) => any
|
|
4
|
-
getSlots: (intentRequest: any) => any
|
|
5
|
-
getSlotValue: (intentRequest: any, slotName: string) => any
|
|
6
|
-
getConfidenceScore: (intentRequest: any) => any
|
|
7
|
-
getDateSlotValue: (intentRequest: any, slotName: string) => string
|
|
8
|
-
getTimeSlotValue: (intentRequest: any, slotName: string) => string | null
|
|
9
|
-
getProposedSlot: (intentRequest: any) => any
|
|
10
|
-
getRequestAttributes: (intentRequest: any) => any
|
|
11
|
-
getOrginalSlotValue: (intentRequest: any, slotName: string) => any
|
|
2
|
+
getSessionAttributes: (intentRequest: any) => Promise<any>;
|
|
3
|
+
getSessionAttributeValue: (intentRequest: any, name: string) => Promise<any>;
|
|
4
|
+
getSlots: (intentRequest: any) => Promise<any>;
|
|
5
|
+
getSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
6
|
+
getConfidenceScore: (intentRequest: any) => Promise<any>;
|
|
7
|
+
getDateSlotValue: (intentRequest: any, slotName: string) => Promise<string>;
|
|
8
|
+
getTimeSlotValue: (intentRequest: any, slotName: string) => Promise<string | null>;
|
|
9
|
+
getProposedSlot: (intentRequest: any) => Promise<any>;
|
|
10
|
+
getRequestAttributes: (intentRequest: any) => Promise<any>;
|
|
11
|
+
getOrginalSlotValue: (intentRequest: any, slotName: string) => Promise<any>;
|
|
12
12
|
};
|
package/dist/esm/utils/intent.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
*
|
|
3
12
|
* @param intentRequest lex event Request
|
|
4
13
|
* @returns list of slots
|
|
5
14
|
*/
|
|
6
|
-
const getSlots = (intentRequest) => {
|
|
15
|
+
const getSlots = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
16
|
try {
|
|
8
17
|
return intentRequest['sessionState']['intent']['slots'];
|
|
9
18
|
}
|
|
@@ -11,17 +20,17 @@ const getSlots = (intentRequest) => {
|
|
|
11
20
|
console.log("Error in Get Slots", error);
|
|
12
21
|
throw error;
|
|
13
22
|
}
|
|
14
|
-
};
|
|
23
|
+
});
|
|
15
24
|
/**
|
|
16
25
|
*
|
|
17
26
|
* @param intentRequest lex event request
|
|
18
27
|
* @param slotName slot name
|
|
19
28
|
* @returns slot resolved value
|
|
20
29
|
*/
|
|
21
|
-
const getSlotValue = (intentRequest, slotName) => {
|
|
30
|
+
const getSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
31
|
try {
|
|
23
32
|
let slots;
|
|
24
|
-
slots = getSlots(intentRequest);
|
|
33
|
+
slots = yield getSlots(intentRequest);
|
|
25
34
|
if (slots != null && slots[slotName] != null) {
|
|
26
35
|
return slots[slotName]['value']['interpretedValue'] || slots[slotName]['value']['resolvedValues'][0] || null;
|
|
27
36
|
}
|
|
@@ -33,17 +42,17 @@ const getSlotValue = (intentRequest, slotName) => {
|
|
|
33
42
|
console.log("Error in Get Slot Value", error);
|
|
34
43
|
throw error;
|
|
35
44
|
}
|
|
36
|
-
};
|
|
45
|
+
});
|
|
37
46
|
/**
|
|
38
47
|
*
|
|
39
48
|
* @param intentRequest lex event request
|
|
40
49
|
* @param slotName slot name
|
|
41
50
|
* @returns slot original value
|
|
42
51
|
*/
|
|
43
|
-
const getOrginalSlotValue = (intentRequest, slotName) => {
|
|
52
|
+
const getOrginalSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
44
53
|
try {
|
|
45
54
|
let slots;
|
|
46
|
-
slots = getSlots(intentRequest);
|
|
55
|
+
slots = yield getSlots(intentRequest);
|
|
47
56
|
if (slots != null && slots[slotName] != null) {
|
|
48
57
|
return slots[slotName]['value']['originalValue'] || slots[slotName]['value']['originalValue'] || null;
|
|
49
58
|
}
|
|
@@ -55,18 +64,16 @@ const getOrginalSlotValue = (intentRequest, slotName) => {
|
|
|
55
64
|
console.log("Error in Get Slot Value", error);
|
|
56
65
|
throw error;
|
|
57
66
|
}
|
|
58
|
-
};
|
|
67
|
+
});
|
|
59
68
|
/**
|
|
60
69
|
*
|
|
61
70
|
* @param intentRequest lex event
|
|
62
71
|
* @returns session attributes object
|
|
63
72
|
*/
|
|
64
|
-
const getSessionAttributes = (intentRequest) => {
|
|
73
|
+
const getSessionAttributes = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
65
74
|
try {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
if (sessionState['sessionAttributes'] != null) {
|
|
69
|
-
return sessionState['sessionAttributes'];
|
|
75
|
+
if (intentRequest['sessionState']['sessionAttributes'] != null) {
|
|
76
|
+
return intentRequest['sessionState']['sessionAttributes'];
|
|
70
77
|
}
|
|
71
78
|
return {};
|
|
72
79
|
}
|
|
@@ -74,14 +81,14 @@ const getSessionAttributes = (intentRequest) => {
|
|
|
74
81
|
console.log("Error in Get Session Attributes", error);
|
|
75
82
|
throw error;
|
|
76
83
|
}
|
|
77
|
-
};
|
|
84
|
+
});
|
|
78
85
|
/**
|
|
79
86
|
*
|
|
80
87
|
* @param intentRequest lex event
|
|
81
88
|
* @param name attribute name
|
|
82
89
|
* @returns session attribute value
|
|
83
90
|
*/
|
|
84
|
-
const getSessionAttributeValue = (intentRequest, name) => {
|
|
91
|
+
const getSessionAttributeValue = (intentRequest, name) => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
92
|
try {
|
|
86
93
|
let sessionState;
|
|
87
94
|
sessionState = intentRequest['sessionState'];
|
|
@@ -97,14 +104,14 @@ const getSessionAttributeValue = (intentRequest, name) => {
|
|
|
97
104
|
console.log("Error in Get Session Attribute Value", error);
|
|
98
105
|
throw error;
|
|
99
106
|
}
|
|
100
|
-
};
|
|
107
|
+
});
|
|
101
108
|
/**
|
|
102
109
|
*
|
|
103
110
|
* @param intentRequest
|
|
104
111
|
* @param slotName
|
|
105
112
|
* @returns
|
|
106
113
|
*/
|
|
107
|
-
const getDateSlotValue = (intentRequest, slotName) => {
|
|
114
|
+
const getDateSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
108
115
|
try {
|
|
109
116
|
let selectDate = null, date = getSlotValue(intentRequest, slotName);
|
|
110
117
|
let month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
@@ -120,14 +127,14 @@ const getDateSlotValue = (intentRequest, slotName) => {
|
|
|
120
127
|
console.log("Error in Get Date Slot Value", error);
|
|
121
128
|
throw error;
|
|
122
129
|
}
|
|
123
|
-
};
|
|
130
|
+
});
|
|
124
131
|
/**
|
|
125
132
|
*
|
|
126
133
|
* @param intentRequest
|
|
127
134
|
* @param slotName
|
|
128
135
|
* @returns
|
|
129
136
|
*/
|
|
130
|
-
const getTimeSlotValue = (intentRequest, slotName) => {
|
|
137
|
+
const getTimeSlotValue = (intentRequest, slotName) => __awaiter(void 0, void 0, void 0, function* () {
|
|
131
138
|
try {
|
|
132
139
|
let selectTime = null, time = getSlotValue(intentRequest, slotName);
|
|
133
140
|
try {
|
|
@@ -147,13 +154,13 @@ const getTimeSlotValue = (intentRequest, slotName) => {
|
|
|
147
154
|
console.log("Error in Get Date Slot Value", error);
|
|
148
155
|
throw error;
|
|
149
156
|
}
|
|
150
|
-
};
|
|
157
|
+
});
|
|
151
158
|
/**
|
|
152
159
|
*
|
|
153
160
|
* @param intentRequest
|
|
154
161
|
* @returns
|
|
155
162
|
*/
|
|
156
|
-
const getProposedSlot = (intentRequest) => {
|
|
163
|
+
const getProposedSlot = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
157
164
|
try {
|
|
158
165
|
if (intentRequest.proposedNextState) {
|
|
159
166
|
return intentRequest.proposedNextState.dialogAction.slotToElicit;
|
|
@@ -166,13 +173,13 @@ const getProposedSlot = (intentRequest) => {
|
|
|
166
173
|
console.log("Error in Get Proposed Slot", error);
|
|
167
174
|
throw error;
|
|
168
175
|
}
|
|
169
|
-
};
|
|
176
|
+
});
|
|
170
177
|
/**
|
|
171
178
|
*
|
|
172
179
|
* @param intentRequest
|
|
173
180
|
* @returns
|
|
174
181
|
*/
|
|
175
|
-
const getRequestAttributes = (intentRequest) => {
|
|
182
|
+
const getRequestAttributes = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
176
183
|
try {
|
|
177
184
|
if (intentRequest.requestAttributes) {
|
|
178
185
|
return intentRequest.requestAttributes;
|
|
@@ -185,13 +192,13 @@ const getRequestAttributes = (intentRequest) => {
|
|
|
185
192
|
console.log("Error in Get Requested Attributes", error);
|
|
186
193
|
throw error;
|
|
187
194
|
}
|
|
188
|
-
};
|
|
195
|
+
});
|
|
189
196
|
/**
|
|
190
197
|
*
|
|
191
198
|
* @param intentRequest
|
|
192
199
|
* @returns
|
|
193
200
|
*/
|
|
194
|
-
const getConfidenceScore = (intentRequest) => {
|
|
201
|
+
const getConfidenceScore = (intentRequest) => __awaiter(void 0, void 0, void 0, function* () {
|
|
195
202
|
try {
|
|
196
203
|
return intentRequest['interpretations'][0]['nluConfidence'];
|
|
197
204
|
}
|
|
@@ -199,6 +206,6 @@ const getConfidenceScore = (intentRequest) => {
|
|
|
199
206
|
console.log("Error in Get Confidence Score", error);
|
|
200
207
|
throw error;
|
|
201
208
|
}
|
|
202
|
-
};
|
|
209
|
+
});
|
|
203
210
|
export const Intents = { getSessionAttributes, getSessionAttributeValue, getSlots, getSlotValue, getConfidenceScore, getDateSlotValue, getTimeSlotValue, getProposedSlot, getRequestAttributes, getOrginalSlotValue };
|
|
204
211
|
//# sourceMappingURL=intent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../utils/intent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../utils/intent.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAO,aAAkB,EAAE,EAAE;IAC1C,IAAI;QACA,OAAO,aAAa,CAAC,cAAc,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;KAC3D;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAA;QACxC,MAAM,KAAK,CAAC;KACf;AACL,CAAC,CAAA,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAO,aAAkB,EAAE,QAAgB,EAAE,EAAE;IAChE,IAAI;QACA,IAAI,KAAK,CAAC;QACV,KAAK,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,CAAC;QACtC,IAAI,KAAK,IAAI,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