From c3d9af8bc00237d7d6332bd34fdaf0756dd476f4 Mon Sep 17 00:00:00 2001 From: JayWelborn Date: Tue, 15 Dec 2020 15:25:52 -0500 Subject: [PATCH] CS-1264 ran eslint --- src/constants/url.js | 4 +-- src/core/data.js | 2 +- src/handlers/lex-get-string.js | 15 ++++----- src/utils/logger-utils.js | 14 ++++---- src/utils/sugar/call-record-utils.js | 50 ++++++++++++++-------------- 5 files changed, 42 insertions(+), 43 deletions(-) diff --git a/src/constants/url.js b/src/constants/url.js index 05899e9f7e..d08b9e63d6 100644 --- a/src/constants/url.js +++ b/src/constants/url.js @@ -9,9 +9,9 @@ * Copyright (C) SugarCRM Inc. All rights reserved. */ -module.exports = { +module.exports = { /** * URL Partials */ - HTTPS_PREFIX: 'https://', + HTTPS_PREFIX: 'https://' }; diff --git a/src/core/data.js b/src/core/data.js index f82c7f4260..5859f419f8 100644 --- a/src/core/data.js +++ b/src/core/data.js @@ -9,7 +9,7 @@ * Copyright (C) SugarCRM Inc. All rights reserved. */ -var Bean = require('./bean.js'); +let Bean = require('./bean.js'); module.exports = { createBean: (module, data) => { diff --git a/src/handlers/lex-get-string.js b/src/handlers/lex-get-string.js index 75bfa66ad0..55476157cf 100644 --- a/src/handlers/lex-get-string.js +++ b/src/handlers/lex-get-string.js @@ -9,7 +9,7 @@ * Copyright (C) SugarCRM Inc. All rights reserved. */ -const loggerUtils = require("../utils/logger-utils"); +const loggerUtils = require('../utils/logger-utils'); /** * Close dialog with the customer, reporting fulfillmentState Fulfilled @@ -24,10 +24,10 @@ function close(sessionAttributes, fulfillmentState, message) { type: 'Close', fulfillmentState, message - }, + } }; } - + /** * Events * @param intentRequest @@ -35,10 +35,10 @@ function close(sessionAttributes, fulfillmentState, message) { */ function dispatch(intentRequest, callback) { const sessionAttributes = intentRequest.sessionAttributes; - + // assign the whole user input to sessionAttributes.string sessionAttributes.string = intentRequest.inputTranscript; - + callback( close( sessionAttributes, @@ -46,12 +46,12 @@ function dispatch(intentRequest, callback) { { 'contentType': 'PlainText', 'content': 'You entered: ' + sessionAttributes.string - + } ) ); } - + /** * Main handler * @param event @@ -70,4 +70,3 @@ exports.handler = (event, context, callback) => { callback(err); } }; - diff --git a/src/utils/logger-utils.js b/src/utils/logger-utils.js index 6792e4d71f..c67d2c471a 100644 --- a/src/utils/logger-utils.js +++ b/src/utils/logger-utils.js @@ -12,10 +12,10 @@ /** * Log the JSON to AWS Cloudwatch * - * @param {string} title - * @param {Object} json + * @param {string} title + * @param {Object} json */ -function logJson (title, json) { +function logJson(title, json) { console.log(`${title}:\n`, JSON.stringify(json)); } @@ -49,18 +49,18 @@ function logLexEvent(event) { /** * Log the S3 event for debugging * - * @param {Object} event + * @param {Object} event */ -function logS3Event (event) { +function logS3Event(event) { logJson('S3 Event', event); } /** * Log the Sugar API response for debugging * - * @param {string} response + * @param {string} response */ -function logSugarApiResponse (response) { +function logSugarApiResponse(response) { logJson('Sugar API Response', response); } diff --git a/src/utils/sugar/call-record-utils.js b/src/utils/sugar/call-record-utils.js index a67c5e88e3..4150ce1ceb 100644 --- a/src/utils/sugar/call-record-utils.js +++ b/src/utils/sugar/call-record-utils.js @@ -23,7 +23,7 @@ const CallsConstants = require('../../constants/sugar-modules/calls'); const ErrorMessages = require('../../constants/messages/error'); const UrlConstants = require('../../constants/url'); - /** +/** * Return a single call record, false otherwise * * @param {string} contactId the AWS Connect contact ID @@ -53,39 +53,39 @@ async function getCallRecord(contactId) { * Build the call recording URL based on an AWS Connect URL and not S3. Appropriate * AWS Connect user permissions are required to access the URL * - * @param {string} contactId + * @param {string} contactId */ -function buildCallRecordingUrl (contactId) { - let connectInstance = process.env.awsConnectInstance; - let connectDomain = process.env.awsConnectDomain; - let callRecordingPartialUrl = process.env.callRecordingPartialUrl; +function buildCallRecordingUrl(contactId) { + let connectInstance = process.env.awsConnectInstance; + let connectDomain = process.env.awsConnectDomain; + let callRecordingPartialUrl = process.env.callRecordingPartialUrl; - // return empty if contact ID is not defined - if (!contactId) { - console.warn('Call Recording URL Warning: Unable to construct a URL without AWS Connect contact ID'); - return ''; - } + // return empty if contact ID is not defined + if (!contactId) { + console.warn('Call Recording URL Warning: Unable to construct a URL without AWS Connect contact ID'); + return ''; + } - // return empty if one or more of the required parameters is not defined - if (!connectInstance || !connectDomain || !callRecordingPartialUrl) { - console.warn('Call Recording URL Warning: Unable to construct a URL with missing required parameter(s). ' + + // return empty if one or more of the required parameters is not defined + if (!connectInstance || !connectDomain || !callRecordingPartialUrl) { + console.warn('Call Recording URL Warning: Unable to construct a URL with missing required parameter(s). ' + 'Please check the following parameters: AwsConnectInstance, AWSConnectDomain, CallRecordingPartialURL'); - return ''; - } + return ''; + } - let encodedConnectInstance = encodeURIComponent(connectInstance); - let encodedContactId = encodeURIComponent(contactId); + let encodedConnectInstance = encodeURIComponent(connectInstance); + let encodedContactId = encodeURIComponent(contactId); - connectDomain = connectDomain.trim(); - callRecordingPartialUrl = callRecordingPartialUrl.trim(); + connectDomain = connectDomain.trim(); + callRecordingPartialUrl = callRecordingPartialUrl.trim(); - let url = UrlConstants.HTTPS_PREFIX + encodedConnectInstance + '.' + connectDomain + + let url = UrlConstants.HTTPS_PREFIX + encodedConnectInstance + '.' + connectDomain + callRecordingPartialUrl + encodedContactId; - return url; + return url; } -module.exports = { - getCallRecord, - buildCallRecordingUrl +module.exports = { + getCallRecord, + buildCallRecordingUrl };