Skip to content

Commit

Permalink
CS-1264 ran eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
jwelborn-sugar committed Dec 16, 2020
1 parent 9fa87fd commit 3aed94e
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
},
"scripts": {
"test": "jest --watchAll",
"lint": "eslint ./src ./__tests__"
"lint": "eslint --ext .js src/* __tests__/unit/* --fix"
}
}
4 changes: 2 additions & 2 deletions src/constants/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Copyright (C) SugarCRM Inc. All rights reserved.
*/

module.exports = {
module.exports = {
/**
* URL Partials
*/
HTTPS_PREFIX: 'https://',
HTTPS_PREFIX: 'https://'
};
2 changes: 1 addition & 1 deletion src/core/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
15 changes: 7 additions & 8 deletions src/handlers/lex-get-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,34 +24,34 @@ function close(sessionAttributes, fulfillmentState, message) {
type: 'Close',
fulfillmentState,
message
},
}
};
}

/**
* Events
* @param intentRequest
* @param callback
*/
function dispatch(intentRequest, callback) {
const sessionAttributes = intentRequest.sessionAttributes;

// assign the whole user input to sessionAttributes.string
sessionAttributes.string = intentRequest.inputTranscript;

callback(
close(
sessionAttributes,
'Fulfilled',
{
'contentType': 'PlainText',
'content': 'You entered: ' + sessionAttributes.string

}
)
);
}

/**
* Main handler
* @param event
Expand All @@ -70,4 +70,3 @@ exports.handler = (event, context, callback) => {
callback(err);
}
};

14 changes: 7 additions & 7 deletions src/utils/logger-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down Expand Up @@ -59,18 +59,18 @@ function logReturnValue(returnValue) {
/**
* 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);
}

Expand Down
50 changes: 25 additions & 25 deletions src/utils/sugar/call-record-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
};

0 comments on commit 3aed94e

Please sign in to comment.