chatbot-nc 1.0.56 → 1.0.58
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/aws/index.d.ts +1 -0
- package/dist/cjs/aws/services/AWSConnect.d.ts +8 -1
- package/dist/cjs/aws/services/AWSConnect.js +20 -1
- package/dist/cjs/aws/services/AWSConnect.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/common.d.ts +4 -0
- package/dist/cjs/utils/common.js +50 -0
- package/dist/cjs/utils/common.js.map +1 -0
- package/dist/cjs/utils/index.d.ts +18 -0
- package/dist/cjs/utils/index.js +10 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/intent.d.ts +12 -0
- package/dist/cjs/utils/intent.js +207 -0
- package/dist/cjs/utils/intent.js.map +1 -0
- package/dist/esm/aws/index.d.ts +1 -0
- package/dist/esm/aws/services/AWSConnect.d.ts +8 -1
- package/dist/esm/aws/services/AWSConnect.js +19 -1
- package/dist/esm/aws/services/AWSConnect.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/common.d.ts +4 -0
- package/dist/esm/utils/common.js +47 -0
- package/dist/esm/utils/common.js.map +1 -0
- package/dist/esm/utils/index.d.ts +18 -0
- package/dist/esm/utils/index.js +7 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/intent.d.ts +12 -0
- package/dist/esm/utils/intent.js +204 -0
- package/dist/esm/utils/intent.js.map +1 -0
- package/package.json +1 -1
package/dist/cjs/aws/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const AWS: {
|
|
|
59
59
|
startChatContact: (params: import("@aws-sdk/client-connect").StartChatContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartChatContactCommandOutput>;
|
|
60
60
|
startContactStreaming: (params: import("@aws-sdk/client-connect").StartContactStreamingCommandInput) => Promise<import("@aws-sdk/client-connect").StartContactStreamingCommandOutput>;
|
|
61
61
|
getContactAttributes: (params: import("@aws-sdk/client-connect").GetContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").GetContactAttributesCommandOutput>;
|
|
62
|
+
updateContactAttributes: (params: import("@aws-sdk/client-connect").UpdateContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").UpdateContactAttributesCommandOutput>;
|
|
62
63
|
startTaskContact: (params: import("@aws-sdk/client-connect").StartTaskContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartTaskContactCommandOutput>;
|
|
63
64
|
createInstance: (params: import("@aws-sdk/client-connect").CreateInstanceCommandInput) => Promise<import("@aws-sdk/client-connect").CreateInstanceCommandOutput>;
|
|
64
65
|
createContactFlow: (params: import("@aws-sdk/client-connect").CreateContactFlowCommandInput) => Promise<import("@aws-sdk/client-connect").CreateContactFlowCommandOutput>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateInstanceCommandInput, CreateContactFlowCommandInput, StartChatContactCommandInput, StartContactStreamingCommandInput, GetContactAttributesCommandInput, StartTaskContactCommandInput, CreateQueueCommandInput, CreateRoutingProfileCommandInput, CreateHoursOfOperationCommandInput, ClaimPhoneNumberCommandInput, ListPhoneNumbersV2CommandInput } from "@aws-sdk/client-connect";
|
|
1
|
+
import { CreateInstanceCommandInput, CreateContactFlowCommandInput, StartChatContactCommandInput, StartContactStreamingCommandInput, GetContactAttributesCommandInput, StartTaskContactCommandInput, CreateQueueCommandInput, CreateRoutingProfileCommandInput, CreateHoursOfOperationCommandInput, ClaimPhoneNumberCommandInput, ListPhoneNumbersV2CommandInput, UpdateContactAttributesCommandInput } from "@aws-sdk/client-connect";
|
|
2
2
|
/**
|
|
3
3
|
* This is used to get Contact Attribute.
|
|
4
4
|
* @param params parameters to get contact attribute
|
|
@@ -53,11 +53,18 @@ export declare const claimPhoneNumber: (params: ClaimPhoneNumberCommandInput) =>
|
|
|
53
53
|
* @returns
|
|
54
54
|
*/
|
|
55
55
|
export declare const getPhoneNumberList: (params: ListPhoneNumbersV2CommandInput) => Promise<import("@aws-sdk/client-connect").ListPhoneNumbersV2CommandOutput>;
|
|
56
|
+
/**
|
|
57
|
+
* This is used to update Contact Attribute.
|
|
58
|
+
* @param params parameters to update contact attribute
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export declare const updateContactAttributes: (params: UpdateContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").UpdateContactAttributesCommandOutput>;
|
|
56
62
|
export declare const Connect: {
|
|
57
63
|
getContact: (instanceId: string, CID: string) => Promise<import("@aws-sdk/client-connect").GetContactAttributesCommandOutput | null>;
|
|
58
64
|
startChatContact: (params: StartChatContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartChatContactCommandOutput>;
|
|
59
65
|
startContactStreaming: (params: StartContactStreamingCommandInput) => Promise<import("@aws-sdk/client-connect").StartContactStreamingCommandOutput>;
|
|
60
66
|
getContactAttributes: (params: GetContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").GetContactAttributesCommandOutput>;
|
|
67
|
+
updateContactAttributes: (params: UpdateContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").UpdateContactAttributesCommandOutput>;
|
|
61
68
|
startTaskContact: (params: StartTaskContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartTaskContactCommandOutput>;
|
|
62
69
|
createInstance: (params: CreateInstanceCommandInput) => Promise<import("@aws-sdk/client-connect").CreateInstanceCommandOutput>;
|
|
63
70
|
createContactFlow: (params: CreateContactFlowCommandInput) => Promise<import("@aws-sdk/client-connect").CreateContactFlowCommandOutput>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.Connect = exports.getPhoneNumberList = exports.claimPhoneNumber = exports.createHoursOfOperation = exports.createRoutingProfile = exports.createQueue = exports.createContactFlow = exports.createInstance = exports.startTaskContact = exports.getContactAttributes = void 0;
|
|
12
|
+
exports.Connect = exports.updateContactAttributes = exports.getPhoneNumberList = exports.claimPhoneNumber = exports.createHoursOfOperation = exports.createRoutingProfile = exports.createQueue = exports.createContactFlow = exports.createInstance = exports.startTaskContact = exports.getContactAttributes = void 0;
|
|
13
13
|
const client_connect_1 = require("@aws-sdk/client-connect");
|
|
14
14
|
const awsRegion = process.env.AWS_DEFAULT_REGION || 'us-east-1';
|
|
15
15
|
const client = new client_connect_1.ConnectClient({
|
|
@@ -236,11 +236,30 @@ const getPhoneNumberList = (params) => __awaiter(void 0, void 0, void 0, functio
|
|
|
236
236
|
}
|
|
237
237
|
});
|
|
238
238
|
exports.getPhoneNumberList = getPhoneNumberList;
|
|
239
|
+
/**
|
|
240
|
+
* This is used to update Contact Attribute.
|
|
241
|
+
* @param params parameters to update contact attribute
|
|
242
|
+
* @returns
|
|
243
|
+
*/
|
|
244
|
+
const updateContactAttributes = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
245
|
+
try {
|
|
246
|
+
const command = new client_connect_1.UpdateContactAttributesCommand(params);
|
|
247
|
+
const response = yield client.send(command);
|
|
248
|
+
console.log('update contact Attributes ' + response);
|
|
249
|
+
return response;
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
console.error(error);
|
|
253
|
+
throw new Error('error in update contact attributes aws sdk');
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
exports.updateContactAttributes = updateContactAttributes;
|
|
239
257
|
exports.Connect = {
|
|
240
258
|
getContact,
|
|
241
259
|
startChatContact,
|
|
242
260
|
startContactStreaming,
|
|
243
261
|
getContactAttributes: exports.getContactAttributes,
|
|
262
|
+
updateContactAttributes: exports.updateContactAttributes,
|
|
244
263
|
startTaskContact: exports.startTaskContact,
|
|
245
264
|
createInstance: exports.createInstance,
|
|
246
265
|
createContactFlow: exports.createContactFlow,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AWSConnect.js","sourceRoot":"","sources":["../../../../aws/services/AWSConnect.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"AWSConnect.js","sourceRoot":"","sources":["../../../../aws/services/AWSConnect.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAAsvB;AAEtvB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,WAAW,CAAC;AAEhE,MAAM,MAAM,GAAG,IAAI,8BAAa,CAAC;IAC7B,MAAM,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAO,UAAiB,EAAC,GAAU,EAAE,EAAE;IACtD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,IAAI;QACA,MAAM,KAAK,GAAE;YACT,UAAU,EAAC,UAAU;YACrB,gBAAgB,EAAC,GAAG;SACvB,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAC,KAAK,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,IAAI,4CAA2B,CAAC,KAAK,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,qBAAqB,GAAG,QAAQ,CAAC,CAAC;QAE9C,OAAO,QAAQ,CAAC;KAEnB;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAClB,OAAO,IAAI,CAAA;KACd;AACL,CAAC,CAAA,CAAA;AAED;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAO,MAAmC,EAAE,EAAE;IACnE,IAAI;QACA,MAAM,OAAO,GAAG,IAAI,wCAAuB,CAAC,MAAM,CAAC,CAAC;QACpD,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AQ,CAAC,CAAC;QAC5D,OAAO,QAAQ,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;KAC/D;AACL,CAAC,CAAA,CAAA;AAVY,QAAA,kBAAkB,sBAU9B;AAED;;;;GAIG;AACI,MAAM,uBAAuB,GAAC,CAAO,MAA0C,EAAC,EAAE;IACrF,IAAI;QACA,MAAM,OAAO,GAAG,IAAI,+CAA8B,CAAC,MAAM,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,4BAA4B,GAAG,QAAQ,CAAC,CAAC;QACrD,OAAO,QAAQ,CAAC;KACnB;IAAC,OAAO,KAAK,EAAE;QACZ,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAA;KAChE;AACL,CAAC,CAAA,CAAA;AAVY,QAAA,uBAAuB,2BAUnC;AAGY,QAAA,OAAO,GAAG;IACnB,UAAU;IACV,gBAAgB;IAChB,qBAAqB;IACrB,oBAAoB,EAApB,4BAAoB;IACpB,uBAAuB,EAAvB,+BAAuB;IACvB,gBAAgB,EAAhB,wBAAgB;IAChB,cAAc,EAAd,sBAAc;IACd,iBAAiB,EAAjB,yBAAiB;IACjB,WAAW,EAAX,mBAAW;IACX,oBAAoB,EAApB,4BAAoB;IACpB,sBAAsB,EAAtB,8BAAsB;IACtB,gBAAgB,EAAhB,wBAAgB;IAChB,kBAAkB,EAAlB,0BAAkB;CACrB,CAAA"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
|
|
|
6
6
|
import BaseCommunicationService from "./communication";
|
|
7
7
|
import HashService from "./hashing";
|
|
8
8
|
import UrlService from "./shortner";
|
|
9
|
-
|
|
9
|
+
import { Utils } from "./utils";
|
|
10
|
+
export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService };
|
package/dist/cjs/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.ENUM = exports.axios = exports.AWS = void 0;
|
|
29
|
+
exports.UrlService = exports.HashService = exports.BaseDynamoDBRepository = exports.WebHookEvent = exports.BaseCommunicationService = exports.Utils = exports.ENUM = exports.axios = exports.AWS = void 0;
|
|
30
30
|
const aws_1 = require("./aws");
|
|
31
31
|
Object.defineProperty(exports, "AWS", { enumerable: true, get: function () { return aws_1.AWS; } });
|
|
32
32
|
const axios_1 = __importDefault(require("axios"));
|
|
@@ -43,4 +43,6 @@ const hashing_1 = __importDefault(require("./hashing"));
|
|
|
43
43
|
exports.HashService = hashing_1.default;
|
|
44
44
|
const shortner_1 = __importDefault(require("./shortner"));
|
|
45
45
|
exports.UrlService = shortner_1.default;
|
|
46
|
+
const utils_1 = require("./utils");
|
|
47
|
+
Object.defineProperty(exports, "Utils", { enumerable: true, get: function () { return utils_1.Utils; } });
|
|
46
48
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA4B;AAWzB,oFAXM,SAAG,OAWN;AAVN,kDAAyB;AAWtB,gBAXI,eAAK,CAWJ;AAVR,6CAA+B;AAW5B,oBAAI;AAVP,kEAA0C;AAavC,uBAbI,sBAAY,CAaJ;AAZf,qEAA2D;AAaxD,iCAbI,kBAAsB,CAaJ;AAZzB,oEAAuD;AAUpD,mCAVI,uBAAwB,CAUJ;AAT3B,wDAAoC;AAYjC,sBAZI,iBAAW,CAYJ;AAXd,0DAAoC;AAYjC,qBAZI,kBAAU,CAYJ;AAXb,mCAAgC;AAM7B,sFANM,aAAK,OAMN"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Common = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param stringWithPlaceholders
|
|
7
|
+
* @param replacements
|
|
8
|
+
* @returns parsed object
|
|
9
|
+
*/
|
|
10
|
+
const parseText = (stringWithPlaceholders, replacements) => {
|
|
11
|
+
try {
|
|
12
|
+
if (typeof stringWithPlaceholders === 'object') {
|
|
13
|
+
stringWithPlaceholders = JSON.stringify(stringWithPlaceholders);
|
|
14
|
+
}
|
|
15
|
+
let string = stringWithPlaceholders.replace(/{\w+}/g, (placeholder) => replacements[placeholder.substring(1, placeholder.length - 1)] || placeholder);
|
|
16
|
+
string = string.replace(/{@mask-\w+}/g, (placeholder) => maskData(replacements[placeholder.replace("@mask-", "").substring(1, placeholder.replace("@mask-", "").length - 1)]) || placeholder);
|
|
17
|
+
if (typeof string === 'string') {
|
|
18
|
+
return JSON.parse(string);
|
|
19
|
+
}
|
|
20
|
+
return string;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw error;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @param text
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
const maskData = (text) => {
|
|
32
|
+
try {
|
|
33
|
+
if (typeof text === 'number') {
|
|
34
|
+
//Add Logic to mask
|
|
35
|
+
text = text.toString().substring(0, text.toString().length < 2 ? 1 : Math.floor(text.toString().length / 2)).padEnd(text.toString().length, "*");
|
|
36
|
+
}
|
|
37
|
+
if (typeof text === 'string') {
|
|
38
|
+
if (/^\d+\.\d+$/.test(text))
|
|
39
|
+
text = text.substring(0, text.indexOf(".") <= 2 ? 1 : text.indexOf(".") - 2).padEnd(text.length > 3 ? text.length : text.length - 1, "*");
|
|
40
|
+
else
|
|
41
|
+
text = text.substring(0, text.length < 2 ? 1 : Math.floor(text.length / 2)).padEnd(text.length, "*");
|
|
42
|
+
}
|
|
43
|
+
return text;
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
exports.Common = { parseText, maskData };
|
|
50
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../utils/common.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,sBAA2B,EAAE,YAAiB,EAAE,EAAE;IACpE,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,CAA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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;AAEY,QAAA,MAAM,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const Utils: {
|
|
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;
|
|
13
|
+
};
|
|
14
|
+
Common: {
|
|
15
|
+
parseText: (stringWithPlaceholders: any, replacements: any) => any;
|
|
16
|
+
maskData: (text: any) => any;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Utils = void 0;
|
|
4
|
+
const common_1 = require("./common");
|
|
5
|
+
const intent_1 = require("./intent");
|
|
6
|
+
exports.Utils = {
|
|
7
|
+
Intents: intent_1.Intents,
|
|
8
|
+
Common: common_1.Common
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../utils/index.ts"],"names":[],"mappings":";;;AACA,qCAAkC;AAClC,qCAAmC;AAGtB,QAAA,KAAK,GAAG;IACjB,OAAO,EAAP,gBAAO;IACP,MAAM,EAAN,eAAM;CACT,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
12
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Intents = void 0;
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param intentRequest lex event Request
|
|
7
|
+
* @returns list of slots
|
|
8
|
+
*/
|
|
9
|
+
const getSlots = (intentRequest) => {
|
|
10
|
+
try {
|
|
11
|
+
return intentRequest['sessionState']['intent']['slots'];
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
console.log("Error in Get Slots", error);
|
|
15
|
+
throw error;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param intentRequest lex event request
|
|
21
|
+
* @param slotName slot name
|
|
22
|
+
* @returns slot resolved value
|
|
23
|
+
*/
|
|
24
|
+
const getSlotValue = (intentRequest, slotName) => {
|
|
25
|
+
try {
|
|
26
|
+
let slots;
|
|
27
|
+
slots = getSlots(intentRequest);
|
|
28
|
+
if (slots != null && slots[slotName] != null) {
|
|
29
|
+
return slots[slotName]['value']['interpretedValue'] || slots[slotName]['value']['resolvedValues'][0] || null;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.log("Error in Get Slot Value", error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param intentRequest lex event request
|
|
43
|
+
* @param slotName slot name
|
|
44
|
+
* @returns slot original value
|
|
45
|
+
*/
|
|
46
|
+
const getOrginalSlotValue = (intentRequest, slotName) => {
|
|
47
|
+
try {
|
|
48
|
+
let slots;
|
|
49
|
+
slots = getSlots(intentRequest);
|
|
50
|
+
if (slots != null && slots[slotName] != null) {
|
|
51
|
+
return slots[slotName]['value']['originalValue'] || slots[slotName]['value']['originalValue'] || null;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
console.log("Error in Get Slot Value", error);
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
*
|
|
64
|
+
* @param intentRequest lex event
|
|
65
|
+
* @returns session attributes object
|
|
66
|
+
*/
|
|
67
|
+
const getSessionAttributes = (intentRequest) => {
|
|
68
|
+
try {
|
|
69
|
+
let sessionState;
|
|
70
|
+
sessionState = intentRequest['sessionState'];
|
|
71
|
+
if (sessionState['sessionAttributes'] != null) {
|
|
72
|
+
return sessionState['sessionAttributes'];
|
|
73
|
+
}
|
|
74
|
+
return {};
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
console.log("Error in Get Session Attributes", error);
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
*
|
|
83
|
+
* @param intentRequest lex event
|
|
84
|
+
* @param name attribute name
|
|
85
|
+
* @returns session attribute value
|
|
86
|
+
*/
|
|
87
|
+
const getSessionAttributeValue = (intentRequest, name) => {
|
|
88
|
+
try {
|
|
89
|
+
let sessionState;
|
|
90
|
+
sessionState = intentRequest['sessionState'];
|
|
91
|
+
if (sessionState['sessionAttributes'] != null) {
|
|
92
|
+
let sessionAttributeValue = sessionState['sessionAttributes'][name];
|
|
93
|
+
if (sessionAttributeValue)
|
|
94
|
+
return sessionAttributeValue;
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.log("Error in Get Session Attribute Value", error);
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param intentRequest
|
|
107
|
+
* @param slotName
|
|
108
|
+
* @returns
|
|
109
|
+
*/
|
|
110
|
+
const getDateSlotValue = (intentRequest, slotName) => {
|
|
111
|
+
try {
|
|
112
|
+
let selectDate = null, date = getSlotValue(intentRequest, slotName);
|
|
113
|
+
let month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
114
|
+
try {
|
|
115
|
+
selectDate = month[date.split('-')[1] - 1] + ' ' + date.split('-')[2];
|
|
116
|
+
return selectDate;
|
|
117
|
+
}
|
|
118
|
+
catch (err) {
|
|
119
|
+
return '';
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
console.log("Error in Get Date Slot Value", error);
|
|
124
|
+
throw error;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @param intentRequest
|
|
130
|
+
* @param slotName
|
|
131
|
+
* @returns
|
|
132
|
+
*/
|
|
133
|
+
const getTimeSlotValue = (intentRequest, slotName) => {
|
|
134
|
+
try {
|
|
135
|
+
let selectTime = null, time = getSlotValue(intentRequest, slotName);
|
|
136
|
+
try {
|
|
137
|
+
if (Number(time.split(':')[0]) < 12) {
|
|
138
|
+
selectTime = time + ' AM';
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
selectTime = Number(time.split(':')[0]) - 12 + ':' + time.split(':')[1] + ' PM';
|
|
142
|
+
}
|
|
143
|
+
return selectTime !== null ? selectTime : null;
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
return '';
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
console.log("Error in Get Date Slot Value", error);
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
*
|
|
156
|
+
* @param intentRequest
|
|
157
|
+
* @returns
|
|
158
|
+
*/
|
|
159
|
+
const getProposedSlot = (intentRequest) => {
|
|
160
|
+
try {
|
|
161
|
+
if (intentRequest.proposedNextState) {
|
|
162
|
+
return intentRequest.proposedNextState.dialogAction.slotToElicit;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
console.log("Error in Get Proposed Slot", error);
|
|
170
|
+
throw error;
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
*
|
|
175
|
+
* @param intentRequest
|
|
176
|
+
* @returns
|
|
177
|
+
*/
|
|
178
|
+
const getRequestAttributes = (intentRequest) => {
|
|
179
|
+
try {
|
|
180
|
+
if (intentRequest.requestAttributes) {
|
|
181
|
+
return intentRequest.requestAttributes;
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
console.log("Error in Get Requested Attributes", error);
|
|
189
|
+
throw error;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
*
|
|
194
|
+
* @param intentRequest
|
|
195
|
+
* @returns
|
|
196
|
+
*/
|
|
197
|
+
const getConfidenceScore = (intentRequest) => {
|
|
198
|
+
try {
|
|
199
|
+
return intentRequest['interpretations'][0]['nluConfidence'];
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
console.log("Error in Get Confidence Score", error);
|
|
203
|
+
throw error;
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
exports.Intents = { getSessionAttributes, getSessionAttributeValue, getSlots, getSlotValue, getConfidenceScore, getDateSlotValue, getTimeSlotValue, getProposedSlot, getRequestAttributes, getOrginalSlotValue };
|
|
207
|
+
//# sourceMappingURL=intent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../utils/intent.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,aAAkB,EAAE,EAAE;IACpC,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,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,aAAkB,EAAE,QAAgB,EAAE,EAAE;IAC1D,IAAI;QACA,IAAI,KA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AC,aAAkB,EAAE,EAAE;IAC3C,IAAI;QACA,IAAI,aAAa,CAAC,iBAAiB,EAAE;YACjC,OAAO,aAAa,CAAC,iBAAiB,CAAC,YAAY,CAAC,YAAY,CAAC;SACpE;aAAM;YACH,OAAO,IAAI,CAAC;SACf;KACJ;IACD,OAAO,KAAK,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAA;QAChD,MAAM,KAAK,CAAC;KACf;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,oBAAoB,GAAG,CAAC,aAAkB,EAAE,EAAE;IAChD,IAAI;QACA,IAAI,aAAa,CAAC,iBAAiB,EAAE;YACjC,OAAO,aAAa,CAAC,iBAAiB,CAAC;SAC1C;aAAM;YACH,OAAO,IAAI,CAAC;SACf;KACJ;IACD,OAAO,KAAK,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAA;QACvD,MAAM,KAAK,CAAC;KACf;AACL,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,kBAAkB,GAAG,CAAC,aAAkB,EAAE,EAAE;IAC9C,IAAI;QACA,OAAO,aAAa,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;KAC/D;IACD,OAAO,KAAK,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,KAAK,CAAC,CAAA;QACnD,MAAM,KAAK,CAAC;KACf;AACL,CAAC,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/aws/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare const AWS: {
|
|
|
59
59
|
startChatContact: (params: import("@aws-sdk/client-connect").StartChatContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartChatContactCommandOutput>;
|
|
60
60
|
startContactStreaming: (params: import("@aws-sdk/client-connect").StartContactStreamingCommandInput) => Promise<import("@aws-sdk/client-connect").StartContactStreamingCommandOutput>;
|
|
61
61
|
getContactAttributes: (params: import("@aws-sdk/client-connect").GetContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").GetContactAttributesCommandOutput>;
|
|
62
|
+
updateContactAttributes: (params: import("@aws-sdk/client-connect").UpdateContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").UpdateContactAttributesCommandOutput>;
|
|
62
63
|
startTaskContact: (params: import("@aws-sdk/client-connect").StartTaskContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartTaskContactCommandOutput>;
|
|
63
64
|
createInstance: (params: import("@aws-sdk/client-connect").CreateInstanceCommandInput) => Promise<import("@aws-sdk/client-connect").CreateInstanceCommandOutput>;
|
|
64
65
|
createContactFlow: (params: import("@aws-sdk/client-connect").CreateContactFlowCommandInput) => Promise<import("@aws-sdk/client-connect").CreateContactFlowCommandOutput>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateInstanceCommandInput, CreateContactFlowCommandInput, StartChatContactCommandInput, StartContactStreamingCommandInput, GetContactAttributesCommandInput, StartTaskContactCommandInput, CreateQueueCommandInput, CreateRoutingProfileCommandInput, CreateHoursOfOperationCommandInput, ClaimPhoneNumberCommandInput, ListPhoneNumbersV2CommandInput } from "@aws-sdk/client-connect";
|
|
1
|
+
import { CreateInstanceCommandInput, CreateContactFlowCommandInput, StartChatContactCommandInput, StartContactStreamingCommandInput, GetContactAttributesCommandInput, StartTaskContactCommandInput, CreateQueueCommandInput, CreateRoutingProfileCommandInput, CreateHoursOfOperationCommandInput, ClaimPhoneNumberCommandInput, ListPhoneNumbersV2CommandInput, UpdateContactAttributesCommandInput } from "@aws-sdk/client-connect";
|
|
2
2
|
/**
|
|
3
3
|
* This is used to get Contact Attribute.
|
|
4
4
|
* @param params parameters to get contact attribute
|
|
@@ -53,11 +53,18 @@ export declare const claimPhoneNumber: (params: ClaimPhoneNumberCommandInput) =>
|
|
|
53
53
|
* @returns
|
|
54
54
|
*/
|
|
55
55
|
export declare const getPhoneNumberList: (params: ListPhoneNumbersV2CommandInput) => Promise<import("@aws-sdk/client-connect").ListPhoneNumbersV2CommandOutput>;
|
|
56
|
+
/**
|
|
57
|
+
* This is used to update Contact Attribute.
|
|
58
|
+
* @param params parameters to update contact attribute
|
|
59
|
+
* @returns
|
|
60
|
+
*/
|
|
61
|
+
export declare const updateContactAttributes: (params: UpdateContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").UpdateContactAttributesCommandOutput>;
|
|
56
62
|
export declare const Connect: {
|
|
57
63
|
getContact: (instanceId: string, CID: string) => Promise<import("@aws-sdk/client-connect").GetContactAttributesCommandOutput | null>;
|
|
58
64
|
startChatContact: (params: StartChatContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartChatContactCommandOutput>;
|
|
59
65
|
startContactStreaming: (params: StartContactStreamingCommandInput) => Promise<import("@aws-sdk/client-connect").StartContactStreamingCommandOutput>;
|
|
60
66
|
getContactAttributes: (params: GetContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").GetContactAttributesCommandOutput>;
|
|
67
|
+
updateContactAttributes: (params: UpdateContactAttributesCommandInput) => Promise<import("@aws-sdk/client-connect").UpdateContactAttributesCommandOutput>;
|
|
61
68
|
startTaskContact: (params: StartTaskContactCommandInput) => Promise<import("@aws-sdk/client-connect").StartTaskContactCommandOutput>;
|
|
62
69
|
createInstance: (params: CreateInstanceCommandInput) => Promise<import("@aws-sdk/client-connect").CreateInstanceCommandOutput>;
|
|
63
70
|
createContactFlow: (params: CreateContactFlowCommandInput) => Promise<import("@aws-sdk/client-connect").CreateContactFlowCommandOutput>;
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { ConnectClient, GetContactAttributesCommand, CreateInstanceCommand, CreateContactFlowCommand, StartChatContactCommand, StartContactStreamingCommand, StartTaskContactCommand, CreateQueueCommand, CreateRoutingProfileCommand, CreateHoursOfOperationCommand, ClaimPhoneNumberCommand, ListPhoneNumbersV2Command } from "@aws-sdk/client-connect";
|
|
10
|
+
import { ConnectClient, GetContactAttributesCommand, CreateInstanceCommand, CreateContactFlowCommand, StartChatContactCommand, StartContactStreamingCommand, StartTaskContactCommand, CreateQueueCommand, CreateRoutingProfileCommand, CreateHoursOfOperationCommand, ClaimPhoneNumberCommand, ListPhoneNumbersV2Command, UpdateContactAttributesCommand } from "@aws-sdk/client-connect";
|
|
11
11
|
const awsRegion = process.env.AWS_DEFAULT_REGION || 'us-east-1';
|
|
12
12
|
const client = new ConnectClient({
|
|
13
13
|
region: awsRegion,
|
|
@@ -224,11 +224,29 @@ export const getPhoneNumberList = (params) => __awaiter(void 0, void 0, void 0,
|
|
|
224
224
|
throw new Error('error in list of phone number in instance');
|
|
225
225
|
}
|
|
226
226
|
});
|
|
227
|
+
/**
|
|
228
|
+
* This is used to update Contact Attribute.
|
|
229
|
+
* @param params parameters to update contact attribute
|
|
230
|
+
* @returns
|
|
231
|
+
*/
|
|
232
|
+
export const updateContactAttributes = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
233
|
+
try {
|
|
234
|
+
const command = new UpdateContactAttributesCommand(params);
|
|
235
|
+
const response = yield client.send(command);
|
|
236
|
+
console.log('update contact Attributes ' + response);
|
|
237
|
+
return response;
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
console.error(error);
|
|
241
|
+
throw new Error('error in update contact attributes aws sdk');
|
|
242
|
+
}
|
|
243
|
+
});
|
|
227
244
|
export const Connect = {
|
|
228
245
|
getContact,
|
|
229
246
|
startChatContact,
|
|
230
247
|
startContactStreaming,
|
|
231
248
|
getContactAttributes,
|
|
249
|
+
updateContactAttributes,
|
|
232
250
|
startTaskContact,
|
|
233
251
|
createInstance,
|
|
234
252
|
createContactFlow,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AWSConnect.js","sourceRoot":"","sources":["../../../../aws/services/AWSConnect.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,qBAAqB,EAA6B,wBAAwB,EAAgC,uBAAuB,EAAgC,4BAA4B,EAAqG,uBAAuB,EAAE,kBAAkB,EAA2B,2BAA2B,EAAoC,6BAA6B,EAAoE,uBAAuB,EAAkC,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"AWSConnect.js","sourceRoot":"","sources":["../../../../aws/services/AWSConnect.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAE,qBAAqB,EAA6B,wBAAwB,EAAgC,uBAAuB,EAAgC,4BAA4B,EAAqG,uBAAuB,EAAE,kBAAkB,EAA2B,2BAA2B,EAAoC,6BAA6B,EAAoE,uBAAuB,EAAkC,yBAAyB,EAAE,8BAA8B,EAAuC,MAAM,yBAAyB,CAAC;AAEtvB,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,WAAW,CAAC;AAEhE,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC;IAC7B,MAAM,EAAE,SAAS;CACpB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,UAAU,GAAG,CAAO,UAAiB,EAAC,GAAU,EAAE,EAAE;IACtD,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IACjC,IAAI;QACA,MAAM,KAAK,GAAE;YACT,UAAU,EAAC,UAAU;YACrB,gBAAgB,EAAC,GAAG;SACvB,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAC,KAAK,CAAC,CAAC;QACnD,MAAM,OAAO,GAAG,IAAI,2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B,kBAAkB;CACrB,CAAA"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -6,4 +6,5 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
|
|
|
6
6
|
import BaseCommunicationService from "./communication";
|
|
7
7
|
import HashService from "./hashing";
|
|
8
8
|
import UrlService from "./shortner";
|
|
9
|
-
|
|
9
|
+
import { Utils } from "./utils";
|
|
10
|
+
export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService };
|
package/dist/esm/index.js
CHANGED
|
@@ -6,5 +6,6 @@ import BaseDynamoDBRepository from "./repository/dynamodb";
|
|
|
6
6
|
import BaseCommunicationService from "./communication";
|
|
7
7
|
import HashService from "./hashing";
|
|
8
8
|
import UrlService from "./shortner";
|
|
9
|
-
|
|
9
|
+
import { Utils } from "./utils";
|
|
10
|
+
export { AWS, axios, ENUM, Utils, BaseCommunicationService, WebHookEvent, BaseDynamoDBRepository, HashService, UrlService };
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,WAAW,MAAM,WAAW,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAC1C,OAAO,sBAAsB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,wBAAwB,MAAM,iBAAiB,CAAC;AACvD,OAAO,WAAW,MAAM,WAAW,CAAC;AACpC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,OAAO,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,KAAK,EACL,wBAAwB,EACxB,YAAY,EACZ,sBAAsB,EACtB,WAAW,EACX,UAAU,EACZ,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param stringWithPlaceholders
|
|
4
|
+
* @param replacements
|
|
5
|
+
* @returns parsed object
|
|
6
|
+
*/
|
|
7
|
+
const parseText = (stringWithPlaceholders, replacements) => {
|
|
8
|
+
try {
|
|
9
|
+
if (typeof stringWithPlaceholders === 'object') {
|
|
10
|
+
stringWithPlaceholders = JSON.stringify(stringWithPlaceholders);
|
|
11
|
+
}
|
|
12
|
+
let string = stringWithPlaceholders.replace(/{\w+}/g, (placeholder) => replacements[placeholder.substring(1, placeholder.length - 1)] || placeholder);
|
|
13
|
+
string = string.replace(/{@mask-\w+}/g, (placeholder) => maskData(replacements[placeholder.replace("@mask-", "").substring(1, placeholder.replace("@mask-", "").length - 1)]) || placeholder);
|
|
14
|
+
if (typeof string === 'string') {
|
|
15
|
+
return JSON.parse(string);
|
|
16
|
+
}
|
|
17
|
+
return string;
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
throw error;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param text
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
const maskData = (text) => {
|
|
29
|
+
try {
|
|
30
|
+
if (typeof text === 'number') {
|
|
31
|
+
//Add Logic to mask
|
|
32
|
+
text = text.toString().substring(0, text.toString().length < 2 ? 1 : Math.floor(text.toString().length / 2)).padEnd(text.toString().length, "*");
|
|
33
|
+
}
|
|
34
|
+
if (typeof text === 'string') {
|
|
35
|
+
if (/^\d+\.\d+$/.test(text))
|
|
36
|
+
text = text.substring(0, text.indexOf(".") <= 2 ? 1 : text.indexOf(".") - 2).padEnd(text.length > 3 ? text.length : text.length - 1, "*");
|
|
37
|
+
else
|
|
38
|
+
text = text.substring(0, text.length < 2 ? 1 : Math.floor(text.length / 2)).padEnd(text.length, "*");
|
|
39
|
+
}
|
|
40
|
+
return text;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export const Common = { parseText, maskData };
|
|
47
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../utils/common.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,SAAS,GAAG,CAAC,sBAA2B,EAAE,YAAiB,EAAE,EAAE;IACpE,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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AM,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;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const Utils: {
|
|
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;
|
|
13
|
+
};
|
|
14
|
+
Common: {
|
|
15
|
+
parseText: (stringWithPlaceholders: any, replacements: any) => any;
|
|
16
|
+
maskData: (text: any) => any;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../utils/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,MAAM,CAAC,MAAM,KAAK,GAAG;IACjB,OAAO;IACP,MAAM;CACT,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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;
|
|
12
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param intentRequest lex event Request
|
|
4
|
+
* @returns list of slots
|
|
5
|
+
*/
|
|
6
|
+
const getSlots = (intentRequest) => {
|
|
7
|
+
try {
|
|
8
|
+
return intentRequest['sessionState']['intent']['slots'];
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
console.log("Error in Get Slots", error);
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param intentRequest lex event request
|
|
18
|
+
* @param slotName slot name
|
|
19
|
+
* @returns slot resolved value
|
|
20
|
+
*/
|
|
21
|
+
const getSlotValue = (intentRequest, slotName) => {
|
|
22
|
+
try {
|
|
23
|
+
let slots;
|
|
24
|
+
slots = getSlots(intentRequest);
|
|
25
|
+
if (slots != null && slots[slotName] != null) {
|
|
26
|
+
return slots[slotName]['value']['interpretedValue'] || slots[slotName]['value']['resolvedValues'][0] || null;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
console.log("Error in Get Slot Value", error);
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param intentRequest lex event request
|
|
40
|
+
* @param slotName slot name
|
|
41
|
+
* @returns slot original value
|
|
42
|
+
*/
|
|
43
|
+
const getOrginalSlotValue = (intentRequest, slotName) => {
|
|
44
|
+
try {
|
|
45
|
+
let slots;
|
|
46
|
+
slots = getSlots(intentRequest);
|
|
47
|
+
if (slots != null && slots[slotName] != null) {
|
|
48
|
+
return slots[slotName]['value']['originalValue'] || slots[slotName]['value']['originalValue'] || null;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
console.log("Error in Get Slot Value", error);
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
*
|
|
61
|
+
* @param intentRequest lex event
|
|
62
|
+
* @returns session attributes object
|
|
63
|
+
*/
|
|
64
|
+
const getSessionAttributes = (intentRequest) => {
|
|
65
|
+
try {
|
|
66
|
+
let sessionState;
|
|
67
|
+
sessionState = intentRequest['sessionState'];
|
|
68
|
+
if (sessionState['sessionAttributes'] != null) {
|
|
69
|
+
return sessionState['sessionAttributes'];
|
|
70
|
+
}
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
console.log("Error in Get Session Attributes", error);
|
|
75
|
+
throw error;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @param intentRequest lex event
|
|
81
|
+
* @param name attribute name
|
|
82
|
+
* @returns session attribute value
|
|
83
|
+
*/
|
|
84
|
+
const getSessionAttributeValue = (intentRequest, name) => {
|
|
85
|
+
try {
|
|
86
|
+
let sessionState;
|
|
87
|
+
sessionState = intentRequest['sessionState'];
|
|
88
|
+
if (sessionState['sessionAttributes'] != null) {
|
|
89
|
+
let sessionAttributeValue = sessionState['sessionAttributes'][name];
|
|
90
|
+
if (sessionAttributeValue)
|
|
91
|
+
return sessionAttributeValue;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
console.log("Error in Get Session Attribute Value", error);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
*
|
|
103
|
+
* @param intentRequest
|
|
104
|
+
* @param slotName
|
|
105
|
+
* @returns
|
|
106
|
+
*/
|
|
107
|
+
const getDateSlotValue = (intentRequest, slotName) => {
|
|
108
|
+
try {
|
|
109
|
+
let selectDate = null, date = getSlotValue(intentRequest, slotName);
|
|
110
|
+
let month = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
111
|
+
try {
|
|
112
|
+
selectDate = month[date.split('-')[1] - 1] + ' ' + date.split('-')[2];
|
|
113
|
+
return selectDate;
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
return '';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
console.log("Error in Get Date Slot Value", error);
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
/**
|
|
125
|
+
*
|
|
126
|
+
* @param intentRequest
|
|
127
|
+
* @param slotName
|
|
128
|
+
* @returns
|
|
129
|
+
*/
|
|
130
|
+
const getTimeSlotValue = (intentRequest, slotName) => {
|
|
131
|
+
try {
|
|
132
|
+
let selectTime = null, time = getSlotValue(intentRequest, slotName);
|
|
133
|
+
try {
|
|
134
|
+
if (Number(time.split(':')[0]) < 12) {
|
|
135
|
+
selectTime = time + ' AM';
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
selectTime = Number(time.split(':')[0]) - 12 + ':' + time.split(':')[1] + ' PM';
|
|
139
|
+
}
|
|
140
|
+
return selectTime !== null ? selectTime : null;
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
return '';
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
console.log("Error in Get Date Slot Value", error);
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
/**
|
|
152
|
+
*
|
|
153
|
+
* @param intentRequest
|
|
154
|
+
* @returns
|
|
155
|
+
*/
|
|
156
|
+
const getProposedSlot = (intentRequest) => {
|
|
157
|
+
try {
|
|
158
|
+
if (intentRequest.proposedNextState) {
|
|
159
|
+
return intentRequest.proposedNextState.dialogAction.slotToElicit;
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
console.log("Error in Get Proposed Slot", error);
|
|
167
|
+
throw error;
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
*
|
|
172
|
+
* @param intentRequest
|
|
173
|
+
* @returns
|
|
174
|
+
*/
|
|
175
|
+
const getRequestAttributes = (intentRequest) => {
|
|
176
|
+
try {
|
|
177
|
+
if (intentRequest.requestAttributes) {
|
|
178
|
+
return intentRequest.requestAttributes;
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch (error) {
|
|
185
|
+
console.log("Error in Get Requested Attributes", error);
|
|
186
|
+
throw error;
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
*
|
|
191
|
+
* @param intentRequest
|
|
192
|
+
* @returns
|
|
193
|
+
*/
|
|
194
|
+
const getConfidenceScore = (intentRequest) => {
|
|
195
|
+
try {
|
|
196
|
+
return intentRequest['interpretations'][0]['nluConfidence'];
|
|
197
|
+
}
|
|
198
|
+
catch (error) {
|
|
199
|
+
console.log("Error in Get Confidence Score", error);
|
|
200
|
+
throw error;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
export const Intents = { getSessionAttributes, getSessionAttributeValue, getSlots, getSlotValue, getConfidenceScore, getDateSlotValue, getTimeSlotValue, getProposedSlot, getRequestAttributes, getOrginalSlotValue };
|
|
204
|
+
//# sourceMappingURL=intent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intent.js","sourceRoot":"","sources":["../../../utils/intent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,aAAkB,EAAE,EAAE;IACpC,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,CAAC;AAEF;;;;;GAKG;AACH,MAAM,YAAY,GAAG,CAAC,aAAkB,EAAE,QAAgB,EAAE,EAAE;IAC1D,IAAI;QACA,IAAI,KAAK,CAAC;QACV,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;QAChC,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,IAAI,EAAE;YAC1C,OAAO,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;SAChH;aAAM;YACH,OAAO,IAAI,CAAC;SAC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